include/svl/style.hxx                 |    3 ++-
 sc/source/filter/inc/stylesbuffer.hxx |    2 ++
 sc/source/filter/oox/stylesbuffer.cxx |   20 ++++++++++++--------
 svl/source/items/style.cxx            |    5 -----
 4 files changed, 16 insertions(+), 14 deletions(-)

New commits:
commit b3024367fd9ba9d8b1a91dd22b37ca55ab8280e2
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Dec 22 11:53:08 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Jan 1 14:31:41 2026 +0100

    tdf#166684 avoid re-creating ExtConditional stylesheets
    
    there are a lot of them, and renaming them is expensive.
    
    Shaves 10% off load time.
    
    Change-Id: Ic5c3347367babd9156ceec94f78ef6f1017c6e4d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196088
    Reviewed-by: Tomaž Vajngerl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit 10d85b215e7086086f99cc95dc76947c3ab3869a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196360
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sc/source/filter/inc/stylesbuffer.hxx 
b/sc/source/filter/inc/stylesbuffer.hxx
index 9ab8c1b597aa..edef69b403cc 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -35,6 +35,7 @@
 #include <docmodel/color/ComplexColor.hxx>
 #include <attarray.hxx>
 #include <vector>
+#include <unordered_set>
 
 class ScPatternCache;
 
@@ -927,6 +928,7 @@ private:
     DxfVector           maDxfs;             /// List of differential cell 
styles.
     DxfVector           maExtDxfs;          /// List of differential extlst 
cell styles.
     mutable DxfStyleMap maDxfStyles;        /// Maps DXF identifiers to Calc 
style sheet names.
+    mutable std::unordered_set<sal_Int32> maExtConditionalStyles;  /// DXF 
identifiers for ExtCondition which have been mapped to styles.
 };
 
 } // namespace oox::xls
diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index 15547d4b4e22..6c54004fb965 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -3120,16 +3120,20 @@ OUString StylesBuffer::createExtDxfStyle( sal_Int32 
nDxfId ) const
     {
         rStyleName = "ExtConditionalStyle_" + OUString::number(nDxfId + 1);
 
-        // Create a cell style. This may overwrite an existing style if
-        // one with the same name exists.
-        ScStyleSheet& rStyleSheet = ScfTools::MakeCellStyleSheet(
-                *getScDocument().GetStyleSheetPool(), rStyleName, true);
+        // use a map to avoid creating the same style more than once.
+        if (maExtConditionalStyles.insert(nDxfId).second)
+        {
+            // Create a cell style. This may overwrite an existing style if
+            // one with the same name exists.
+            ScStyleSheet& rStyleSheet = ScfTools::MakeCellStyleSheet(
+                    *getScDocument().GetStyleSheetPool(), rStyleName, true);
 
-        rStyleSheet.ResetParent();
-        SfxItemSet& rStyleItemSet =
-            rStyleSheet.GetItemSet();
+            rStyleSheet.ResetParent();
+            SfxItemSet& rStyleItemSet =
+                rStyleSheet.GetItemSet();
 
-        pDxf->fillToItemSet(rStyleItemSet);
+            pDxf->fillToItemSet(rStyleItemSet);
+        }
     }
 
     // on error: fallback to default style
commit e72a16a5002433a470f0ec8ac9bf3cf0db202774
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Dec 22 10:30:56 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Jan 1 14:31:31 2026 +0100

    tdf#166684 inline SfxStyleSheetIterator::GetSearchFamily
    
    which is a little hot here, and this is just a getter method.
    Shaves about 1% off.
    
    Change-Id: I94fcdbb35e1be9cbc446f7f7709eaa67d21d0d48
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196064
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Tomaž Vajngerl <[email protected]>
    (cherry picked from commit a6812f5dab4b4eab0dca92a0556a70317aeca80d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196359
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index 94f71375251d..8cd3a038e6e4 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -205,7 +205,8 @@ public:
     SfxStyleSheetIterator(const SfxStyleSheetBasePool *pBase,
                           SfxStyleFamily eFam, SfxStyleSearchBits 
n=SfxStyleSearchBits::All );
     SfxStyleSearchBits GetSearchMask() const;
-    SfxStyleFamily GetSearchFamily() const;
+    SfxStyleFamily GetSearchFamily() const { return nSearchFamily; }
+
     virtual sal_Int32 Count();
     virtual SfxStyleSheetBase *operator[](sal_Int32 nIdx);
     virtual SfxStyleSheetBase* First();
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index fefcd02c78dd..bccbe71f7614 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -364,11 +364,6 @@ OUString SfxStyleSheetBase::GetDescription( MapUnit 
eMetric )
     return aDesc.makeStringAndClear();
 }
 
-SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const
-{
-    return nSearchFamily;
-}
-
 inline bool SfxStyleSheetIterator::IsTrivialSearch() const
 {
     return (( nMask & SfxStyleSearchBits::AllVisible ) == 
SfxStyleSearchBits::AllVisible) &&

Reply via email to