xmloff/source/draw/ximpshap.cxx |   19 +++++++++++--------
 xmloff/source/draw/ximpshap.hxx |    2 ++
 2 files changed, 13 insertions(+), 8 deletions(-)

New commits:
commit bb68797ab182d46a0951669da3bb6651b6de198c
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Feb 28 20:37:05 2026 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sun Mar 1 01:07:35 2026 +0100

    extract an SdXMLShapeContext::FindAutoStyle
    
    Change-Id: I54eee36b97e8baa3d8fb6d07f345853b04f20305
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200684
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index b033111be983..40912115fbe2 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -605,6 +605,15 @@ void SdXMLShapeContext::SetTransformation()
     xPropSet->setPropertyValue(u"Transformation"_ustr, Any(aUnoMatrix));
 }
 
+const SvXMLStyleContext* SdXMLShapeContext::FindAutoStyle()
+{
+    if (maDrawStyleName.isEmpty())
+        return nullptr;
+    if (const SvXMLStylesContext* pAutoStyles = 
GetImport().GetShapeImport()->GetAutoStylesContext())
+        return pAutoStyles->FindStyleChildContext(mnStyleFamily, 
maDrawStyleName);
+    return nullptr;
+}
+
 void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */)
 {
     try
@@ -619,14 +628,8 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = 
true */)
             if(maDrawStyleName.isEmpty())
                 break;
 
-            const SvXMLStyleContext* pStyle = nullptr;
-            bool bAutoStyle(false);
-
-            if(GetImport().GetShapeImport()->GetAutoStylesContext())
-                pStyle = 
GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(mnStyleFamily,
 maDrawStyleName);
-
-            if(pStyle)
-                bAutoStyle = true;
+            const SvXMLStyleContext* pStyle = FindAutoStyle();
+            bool bAutoStyle = pStyle != nullptr;
 
             if(!pStyle && GetImport().GetShapeImport()->GetStylesContext())
                 pStyle = 
GetImport().GetShapeImport()->GetStylesContext()->FindStyleChildContext(mnStyleFamily,
 maDrawStyleName);
diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx
index 640cf26fdb5b..5af3bc4f9afc 100644
--- a/xmloff/source/draw/ximpshap.hxx
+++ b/xmloff/source/draw/ximpshap.hxx
@@ -36,6 +36,7 @@
 #include <xmlmultiimagehelper.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 
+class SvXMLStyleContext;
 template<typename EnumT> struct SvXMLEnumMapEntry;
 
 // common shape context
@@ -82,6 +83,7 @@ protected:
 
     /** if bSupportsStyle is false, auto styles will be set but not a style */
     void SetStyle( bool bSupportsStyle = true );
+    const SvXMLStyleContext* FindAutoStyle();
     void SetLayer();
     void SetThumbnail();
 

Reply via email to