desktop/source/lib/init.cxx |   16 ++++++++++------
 sw/inc/tblafmt.hxx          |    6 +++---
 2 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 022720488e10d25733ed785dc90e008300ecfcb4
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sun Mar 16 14:43:15 2025 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Jun 2 22:55:17 2025 +0200

    rework getStyles a little to create a getComponentStyles function
    
    Change-Id: I0fed7f27100289e4934bcf818831a6cd4f2c1701
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186066
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 716c97c9a18a..1953667efe48 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -6440,13 +6440,11 @@ static char* getFontSubset (std::string_view aFontName)
     return pJson;
 }
 
-static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
+static char* getComponentStyles(const 
css::uno::Reference<css::lang::XComponent>& rComponent, int docType, const 
char* pCommand)
 {
-    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
-
     boost::property_tree::ptree aTree;
     aTree.put("commandName", pCommand);
-    uno::Reference<css::style::XStyleFamiliesSupplier> 
xStyleFamiliesSupplier(pDocument->mxComponent, uno::UNO_QUERY);
+    uno::Reference<css::style::XStyleFamiliesSupplier> 
xStyleFamiliesSupplier(rComponent, uno::UNO_QUERY);
     const uno::Reference<container::XNameAccess> xStyleFamilies = 
xStyleFamiliesSupplier->getStyleFamilies();
     if (!xStyleFamilies.is())
     {
@@ -6480,7 +6478,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
         // should be shown in the normal dropdown, which we should add to the 
start of the list
         // to simplify their selection.
         if (sStyleFam == "ParagraphStyles"
-            && doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT)
+            && docType == LOK_DOCTYPE_TEXT)
         {
             for (const OUString& rStyle: aWriterStyles)
             {
@@ -6498,7 +6496,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
             // Filter out the default styles - they are already at the top
             // of the list
             if (aDefaultStyleNames.find(rStyle) == aDefaultStyleNames.end() ||
-                (sStyleFam != "ParagraphStyles" || doc_getDocumentType(pThis) 
!= LOK_DOCTYPE_TEXT) )
+                (sStyleFam != "ParagraphStyles" || docType != 
LOK_DOCTYPE_TEXT) )
             {
                 boost::property_tree::ptree aChild;
                 aChild.put("", rStyle.toUtf8());
@@ -6567,6 +6565,12 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
     return pJson;
 }
 
+static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
+{
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+    return getComponentStyles(pDocument->mxComponent, 
doc_getDocumentType(pThis), pCommand);
+}
+
 namespace {
 
 enum class UndoOrRedo
commit e53ab9ac6f3f2bd70829a142340006b89b2a1a75
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri May 30 20:39:08 2025 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Jun 2 22:55:01 2025 +0200

    make m_aAutoFormat copy on write
    
    Change-Id: I475821bca12037171ae0452a1ee6712524761096
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186065
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index 0af6a1f15792..db9e1391ac6f 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -98,7 +98,7 @@ public:
 class SW_DLLPUBLIC SwBoxAutoFormat
 {
 private:
-    SwAutoFormatProps m_aAutoFormat;
+    o3tl::cow_wrapper<SwAutoFormatProps> m_aAutoFormat;
 
     // associated UNO object, if such exists
     unotools::WeakReference<SwXTextCellStyle> m_xAutoFormatUnoObject;
@@ -108,8 +108,8 @@ public:
         { return m_xAutoFormatUnoObject; }
     void SetXObject(rtl::Reference<SwXTextCellStyle> const& xObject);
 
-    const SwAutoFormatProps& GetProps() const { return m_aAutoFormat; }
-    SwAutoFormatProps& GetProps() { return m_aAutoFormat; }
+    const SwAutoFormatProps& GetProps() const { return *m_aAutoFormat; }
+    SwAutoFormatProps& GetProps() { return *m_aAutoFormat; }
 };
 
 enum class SwTableAutoFormatUpdateFlags { Char = 1, Box = 2 };

Reply via email to