[Libreoffice-commits] core.git: include/xmloff xmloff/inc xmloff/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 3 12:10:38 UTC 2020


 include/xmloff/XMLTextShapeStyleContext.hxx       |    2 -
 include/xmloff/prstylei.hxx                       |    4 +-
 include/xmloff/xmlimp.hxx                         |    8 ++--
 xmloff/inc/txtfldi.hxx                            |    2 -
 xmloff/source/core/xmlimp.cxx                     |   36 +++++++++++-----------
 xmloff/source/style/XMLFontStylesContext_impl.hxx |    4 +-
 xmloff/source/style/prstylei.cxx                  |   14 +++-----
 xmloff/source/text/XMLIndexTOCContext.cxx         |   11 +++---
 xmloff/source/text/XMLIndexTOCContext.hxx         |    4 +-
 xmloff/source/text/XMLTextListBlockContext.cxx    |    6 +--
 xmloff/source/text/XMLTextListBlockContext.hxx    |    2 -
 xmloff/source/text/XMLTextShapeStyleContext.cxx   |    6 +--
 xmloff/source/text/txtfldi.cxx                    |    7 +---
 xmloff/source/text/txtimp.cxx                     |   32 +++++++------------
 14 files changed, 61 insertions(+), 77 deletions(-)

New commits:
commit b83beb8481b645b4db04112d63837a372cba6e57
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 3 11:15:12 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 3 14:10:00 2020 +0200

    use more explicit types in xmloff
    
    instead of declaring them as a base-type, and then static-casting
    everwhere
    
    Change-Id: I53b901c5353bb39ca9a0357aa442f50d2f475e7d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99995
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/XMLTextShapeStyleContext.hxx b/include/xmloff/XMLTextShapeStyleContext.hxx
index cf5d5ca24e90..1919d55c3d28 100644
--- a/include/xmloff/XMLTextShapeStyleContext.hxx
+++ b/include/xmloff/XMLTextShapeStyleContext.hxx
@@ -27,7 +27,7 @@ class XMLOFF_DLLPUBLIC XMLTextShapeStyleContext final : public XMLShapeStyleCont
 {
     bool                  bAutoUpdate : 1;
 
-    SvXMLImportContextRef xEventContext;
+    rtl::Reference<XMLEventsImportContext> xEventContext;
 
     virtual void SetAttribute( sal_uInt16 nPrefixKey,
                                const OUString& rLocalName,
diff --git a/include/xmloff/prstylei.hxx b/include/xmloff/prstylei.hxx
index 8aa109ff702e..42f5c732c423 100644
--- a/include/xmloff/prstylei.hxx
+++ b/include/xmloff/prstylei.hxx
@@ -42,7 +42,7 @@ class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext
 private:
     ::std::vector< XMLPropertyState >          maProperties;
     css::uno::Reference < css::style::XStyle > mxStyle;
-    SvXMLImportContextRef                      mxStyles;
+    rtl::Reference<SvXMLStylesContext>         mxStyles;
 
     XMLPropStyleContext(XMLPropStyleContext const &) = delete;
     XMLPropStyleContext& operator =(XMLPropStyleContext const &) = delete;
@@ -77,7 +77,7 @@ protected:
     virtual void SetAttribute( sal_uInt16 nPrefixKey,
                                const OUString& rLocalName,
                                const OUString& rValue ) override;
-    SvXMLStylesContext *GetStyles() { return static_cast<SvXMLStylesContext *>(mxStyles.get()); }
+    SvXMLStylesContext *GetStyles() { return mxStyles.get(); }
     ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; }
 
     // Override this method to create a new style. It's called by
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index c2e720b3391f..3742c7b79acf 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -196,10 +196,10 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public cppu::WeakImplHelper<
     rtl::Reference< SchXMLImportHelper >              mxChartImport;
     rtl::Reference< ::xmloff::OFormLayerXMLImport >   mxFormImport;
 
-    SvXMLImportContextRef mxFontDecls;
-    SvXMLImportContextRef mxStyles;
-    SvXMLImportContextRef mxAutoStyles;
-    SvXMLImportContextRef mxMasterStyles;
+    rtl::Reference<XMLFontStylesContext> mxFontDecls;
+    rtl::Reference<SvXMLStylesContext> mxStyles;
+    rtl::Reference<SvXMLStylesContext> mxAutoStyles;
+    rtl::Reference<SvXMLStylesContext> mxMasterStyles;
 
     css::uno::Reference< css::container::XNameContainer > mxGradientHelper;
     css::uno::Reference< css::container::XNameContainer > mxHatchHelper;
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index d5aee115d4d9..bea6df8bb853 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -879,7 +879,7 @@ private:
 class XMLMacroFieldImportContext final : public XMLTextFieldImportContext
 {
     OUString sDescription;
-    SvXMLImportContextRef xEventContext;
+    rtl::Reference<XMLEventsImportContext> xEventContext;
 
     OUString sMacro; // macro for old documents (pre 638i)
 
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 387b4a8de19a..479faef73416 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -627,13 +627,13 @@ void SAL_CALL SvXMLImport::endDocument()
     }
 
     if( mxFontDecls.is() )
-        static_cast<SvXMLStylesContext *>(mxFontDecls.get())->dispose();
+        mxFontDecls->dispose();
     if( mxStyles.is() )
-        static_cast<SvXMLStylesContext *>(mxStyles.get())->dispose();
+        mxStyles->dispose();
     if( mxAutoStyles.is() )
-        static_cast<SvXMLStylesContext *>(mxAutoStyles.get())->dispose();
+        mxAutoStyles->dispose();
     if( mxMasterStyles.is() )
-        static_cast<SvXMLStylesContext *>(mxMasterStyles.get())->dispose();
+        mxMasterStyles->dispose();
 
     // possible form-layer related knittings which can only be done when
     // the whole document exists
@@ -1622,14 +1622,14 @@ XMLEventImportHelper& SvXMLImport::GetEventImport()
 void SvXMLImport::SetFontDecls( XMLFontStylesContext *pFontDecls )
 {
     if (mxFontDecls.is())
-        static_cast<SvXMLStylesContext*>(mxFontDecls.get())->dispose();
+        mxFontDecls->dispose();
     mxFontDecls = pFontDecls;
 }
 
 void SvXMLImport::SetStyles( SvXMLStylesContext *pStyles )
 {
     if (mxStyles.is())
-        static_cast<SvXMLStylesContext*>(mxStyles.get())->dispose();
+        mxStyles->dispose();
     mxStyles = pStyles;
 }
 
@@ -1653,7 +1653,7 @@ void SvXMLImport::SetAutoStyles( SvXMLStylesContext *pAutoStyles )
         }
     }
     if (mxAutoStyles.is())
-        static_cast<SvXMLStylesContext*>(mxAutoStyles.get())->dispose();
+        mxAutoStyles->dispose();
     mxAutoStyles = pAutoStyles;
     GetTextImport()->SetAutoStyles( pAutoStyles );
     GetShapeImport()->SetAutoStylesContext( pAutoStyles );
@@ -1664,38 +1664,38 @@ void SvXMLImport::SetAutoStyles( SvXMLStylesContext *pAutoStyles )
 void SvXMLImport::SetMasterStyles( SvXMLStylesContext *pMasterStyles )
 {
     if (mxMasterStyles.is())
-        static_cast<SvXMLStylesContext*>(mxMasterStyles.get())->dispose();
+        mxMasterStyles->dispose();
     mxMasterStyles = pMasterStyles;
 }
 
 XMLFontStylesContext *SvXMLImport::GetFontDecls()
 {
-    return static_cast<XMLFontStylesContext *>(mxFontDecls.get());
+    return mxFontDecls.get();
 }
 
 SvXMLStylesContext *SvXMLImport::GetStyles()
 {
-    return static_cast<SvXMLStylesContext *>(mxStyles.get());
+    return mxStyles.get();
 }
 
 SvXMLStylesContext *SvXMLImport::GetAutoStyles()
 {
-    return static_cast<SvXMLStylesContext *>(mxAutoStyles.get());
+    return mxAutoStyles.get();
 }
 
 const XMLFontStylesContext *SvXMLImport::GetFontDecls() const
 {
-    return static_cast<const XMLFontStylesContext *>(mxFontDecls.get());
+    return mxFontDecls.get();
 }
 
 const SvXMLStylesContext *SvXMLImport::GetStyles() const
 {
-    return static_cast<const SvXMLStylesContext *>(mxStyles.get());
+    return mxStyles.get();
 }
 
 const SvXMLStylesContext *SvXMLImport::GetAutoStyles() const
 {
-    return static_cast<const SvXMLStylesContext *>(mxAutoStyles.get());
+    return mxAutoStyles.get();
 }
 
 OUString SvXMLImport::GetAbsoluteReference(const OUString& rValue) const
@@ -1873,13 +1873,13 @@ void SvXMLImport::SetError(
 void SvXMLImport::DisposingModel()
 {
     if( mxFontDecls.is() )
-        static_cast<SvXMLStylesContext *>(mxFontDecls.get())->dispose();
+        mxFontDecls->dispose();
     if( mxStyles.is() )
-        static_cast<SvXMLStylesContext *>(mxStyles.get())->dispose();
+        mxStyles->dispose();
     if( mxAutoStyles.is() )
-        static_cast<SvXMLStylesContext *>(mxAutoStyles.get())->dispose();
+        mxAutoStyles->dispose();
     if( mxMasterStyles.is() )
-        static_cast<SvXMLStylesContext *>(mxMasterStyles.get())->dispose();
+        mxMasterStyles->dispose();
 
     mxModel.set(nullptr);
     mxEventListener.set(nullptr);
diff --git a/xmloff/source/style/XMLFontStylesContext_impl.hxx b/xmloff/source/style/XMLFontStylesContext_impl.hxx
index 2d7880389391..854523e9a15b 100644
--- a/xmloff/source/style/XMLFontStylesContext_impl.hxx
+++ b/xmloff/source/style/XMLFontStylesContext_impl.hxx
@@ -35,11 +35,11 @@ class XMLFontStyleContextFontFace : public SvXMLStyleContext
     css::uno::Any aPitch;
     css::uno::Any aEnc;
 
-    SvXMLImportContextRef xStyles;
+    rtl::Reference<XMLFontStylesContext> xStyles;
 
     XMLFontStylesContext *GetStyles()
     {
-        return static_cast<XMLFontStylesContext *>(xStyles.get());
+        return xStyles.get();
     }
 
 public:
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index 4712bf4e5bb7..708ae6675e57 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -211,8 +211,7 @@ SvXMLImportContextRef XMLPropStyleContext::CreateChildContext(
     if( nFamily )
     {
         rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
-            static_cast<SvXMLStylesContext *>(mxStyles.get())->GetImportPropertyMapper(
-                                                        GetFamily() );
+            mxStyles->GetImportPropertyMapper( GetFamily() );
         if( xImpPrMap.is() )
             xContext = new SvXMLPropertySetContext( GetImport(), nPrefix,
                                                     rLocalName, xAttrList,
@@ -232,8 +231,7 @@ void XMLPropStyleContext::FillPropertySet(
             const Reference< XPropertySet > & rPropSet )
 {
     rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
-        static_cast<SvXMLStylesContext *>(mxStyles.get())->GetImportPropertyMapper(
-                                                                GetFamily() );
+        mxStyles->GetImportPropertyMapper( GetFamily() );
     SAL_WARN_IF( !xImpPrMap.is(), "xmloff", "There is the import prop mapper" );
     if( xImpPrMap.is() )
         xImpPrMap->FillPropertySet( maProperties, rPropSet );
@@ -247,8 +245,7 @@ Reference < XStyle > XMLPropStyleContext::Create()
 {
     Reference < XStyle > xNewStyle;
 
-    OUString sServiceName(
-        static_cast<SvXMLStylesContext *>(mxStyles.get())->GetServiceName( GetFamily() ) );
+    OUString sServiceName = mxStyles->GetServiceName( GetFamily() );
     if( !sServiceName.isEmpty() )
     {
         Reference< XMultiServiceFactory > xFactory( GetImport().GetModel(),
@@ -267,7 +264,7 @@ Reference < XStyle > XMLPropStyleContext::Create()
 
 void XMLPropStyleContext::CreateAndInsert( bool bOverwrite )
 {
-    SvXMLStylesContext* pSvXMLStylesContext = static_cast< SvXMLStylesContext* >(mxStyles.get());
+    SvXMLStylesContext* pSvXMLStylesContext = mxStyles.get();
     rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily());
     OSL_ENSURE(xImpPrMap.is(), "There is no import prop mapper");
 
@@ -460,8 +457,7 @@ void XMLPropStyleContext::Finish( bool bOverwrite )
         return;
 
     // The families container must exist
-    Reference < XNameContainer > xFamilies =
-        static_cast<SvXMLStylesContext *>(mxStyles.get())->GetStylesContainer( GetFamily() );
+    Reference < XNameContainer > xFamilies = mxStyles->GetStylesContainer( GetFamily() );
     SAL_WARN_IF( !xFamilies.is(), "xmloff", "Families lost" );
     if( !xFamilies.is() )
         return;
diff --git a/xmloff/source/text/XMLIndexTOCContext.cxx b/xmloff/source/text/XMLIndexTOCContext.cxx
index 6024b1188fd6..2077ac562c7f 100644
--- a/xmloff/source/text/XMLIndexTOCContext.cxx
+++ b/xmloff/source/text/XMLIndexTOCContext.cxx
@@ -256,8 +256,7 @@ void XMLIndexTOCContext::EndElement()
 
         // get rid of last paragraph (unless it's the only paragraph)
         rHelper->GetCursor()->goRight(1, false);
-        if( xBodyContextRef.is() &&
-            static_cast<XMLIndexBodyContext*>(xBodyContextRef.get())->HasContent() )
+        if( xBodyContextRef.is() && xBodyContextRef->HasContent() )
         {
             rHelper->GetCursor()->goLeft(1, true);
             rHelper->GetText()->insertString(rHelper->GetCursorAsRange(),
@@ -287,12 +286,12 @@ SvXMLImportContextRef XMLIndexTOCContext::CreateChildContext(
         {
             if ( IsXMLToken( rLocalName, XML_INDEX_BODY ) )
             {
-                xContext = new XMLIndexBodyContext(GetImport(), nPrefix,
+                rtl::Reference<XMLIndexBodyContext> xNewBodyContext = new XMLIndexBodyContext(GetImport(), nPrefix,
                                                    rLocalName);
-                if ( !xBodyContextRef.is() ||
-                     !static_cast<XMLIndexBodyContext*>(xBodyContextRef.get())->HasContent() )
+                xContext = xNewBodyContext;
+                if ( !xBodyContextRef.is() || !xBodyContextRef->HasContent() )
                 {
-                    xBodyContextRef = xContext;
+                    xBodyContextRef = xNewBodyContext;
                 }
             }
             else if (IsXMLToken(rLocalName, aIndexSourceElementMap[eIndexType]))
diff --git a/xmloff/source/text/XMLIndexTOCContext.hxx b/xmloff/source/text/XMLIndexTOCContext.hxx
index c24d283b98ef..8e3566c8cf1d 100644
--- a/xmloff/source/text/XMLIndexTOCContext.hxx
+++ b/xmloff/source/text/XMLIndexTOCContext.hxx
@@ -43,7 +43,7 @@ enum IndexTypeEnum
     TEXT_INDEX_UNKNOWN
 };
 
-
+class XMLIndexBodyContext;
 /**
  * Import all indices.
  *
@@ -61,7 +61,7 @@ class XMLIndexTOCContext : public SvXMLImportContext
 
     bool bValid;
 
-    SvXMLImportContextRef xBodyContextRef;
+    rtl::Reference<XMLIndexBodyContext> xBodyContextRef;
 
 public:
 
diff --git a/xmloff/source/text/XMLTextListBlockContext.cxx b/xmloff/source/text/XMLTextListBlockContext.cxx
index 0ed4fb91d1be..6265bcf48a9f 100644
--- a/xmloff/source/text/XMLTextListBlockContext.cxx
+++ b/xmloff/source/text/XMLTextListBlockContext.cxx
@@ -70,8 +70,7 @@ XMLTextListBlockContext::XMLTextListBlockContext(
     OUString sParentListStyleName;
     if( mxParentListBlock.is() )
     {
-        XMLTextListBlockContext *pParent =
-                                static_cast<XMLTextListBlockContext *>(mxParentListBlock.get());
+        XMLTextListBlockContext *pParent = mxParentListBlock.get();
         msListStyleName = pParent->msListStyleName;
         sParentListStyleName = msListStyleName;
         mxNumRules = pParent->GetNumRules();
@@ -234,8 +233,7 @@ void XMLTextListBlockContext::EndElement()
 {
     // Numbering has not to be restarted if it has been restarted within
     // a child list.
-    XMLTextListBlockContext *pParent =
-                                static_cast<XMLTextListBlockContext *>(mxParentListBlock.get());
+    XMLTextListBlockContext *pParent = mxParentListBlock.get();
     if( pParent )
     {
         pParent->mbRestartNumbering = mbRestartNumbering;
diff --git a/xmloff/source/text/XMLTextListBlockContext.hxx b/xmloff/source/text/XMLTextListBlockContext.hxx
index d60e5f52589f..f77a2d4ebdfd 100644
--- a/xmloff/source/text/XMLTextListBlockContext.hxx
+++ b/xmloff/source/text/XMLTextListBlockContext.hxx
@@ -34,7 +34,7 @@ class XMLTextListBlockContext : public SvXMLImportContext
     // text:style-name property of <list> element
     OUString         msListStyleName;
 
-    SvXMLImportContextRef   mxParentListBlock;
+    rtl::Reference<XMLTextListBlockContext> mxParentListBlock;
 
     sal_Int16               mnLevel;
     bool                mbRestartNumbering;
diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx b/xmloff/source/text/XMLTextShapeStyleContext.cxx
index 78c18282ec50..746dc2f443da 100644
--- a/xmloff/source/text/XMLTextShapeStyleContext.cxx
+++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx
@@ -189,9 +189,9 @@ SvXMLImportContextRef XMLTextShapeStyleContext::CreateChildContext(
     {
         // create and remember events import context
         // (for delayed processing of events)
-        xContext = new XMLEventsImportContext( GetImport(), nPrefix,
+        xEventContext = new XMLEventsImportContext( GetImport(), nPrefix,
                                                    rLocalName);
-        xEventContext = xContext;
+        xContext = xEventContext;
     }
 
     if (!xContext)
@@ -222,7 +222,7 @@ void XMLTextShapeStyleContext::CreateAndInsert( bool bOverwrite )
     {
         // set event supplier and release reference to context
         Reference<XEventsSupplier> xEventsSupplier(xStyle, UNO_QUERY);
-        static_cast<XMLEventsImportContext *>(xEventContext.get())->SetEvents(xEventsSupplier);
+        xEventContext->SetEvents(xEventsSupplier);
         xEventContext = nullptr;
     }
 }
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 02898ad629dc..2d9c33812700 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -2436,10 +2436,10 @@ SvXMLImportContextRef XMLMacroFieldImportContext::CreateChildContext(
          IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
     {
         // create events context and remember it!
-        xContext = new XMLEventsImportContext(
+        xEventContext = new XMLEventsImportContext(
             GetImport(), nPrefix, rLocalName );
-        xEventContext = xContext;
         bValid = true;
+        return xEventContext;
     }
 
     return xContext;
@@ -2479,8 +2479,7 @@ void XMLMacroFieldImportContext::PrepareField(
     if ( xEventContext.is() )
     {
         // get event sequence
-        XMLEventsImportContext* pEvents =
-            static_cast<XMLEventsImportContext*>(xEventContext.get());
+        XMLEventsImportContext* pEvents = xEventContext.get();
         Sequence<PropertyValue> aValues;
         pEvents->GetEventSequence( "OnClick", aValues );
 
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 6e4fefaa0cd2..bf1be258be99 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -522,7 +522,7 @@ struct XMLTextImportHelper::Impl
     std::unique_ptr< std::vector<OUString> > m_xNextFrmNames;
     std::unique_ptr<XMLTextListsHelper> m_xTextListsHelper;
 
-    SvXMLImportContextRef m_xAutoStyles;
+    rtl::Reference<SvXMLStylesContext> m_xAutoStyles;
 
     rtl::Reference< SvXMLImportPropertyMapper > m_xParaImpPrMap;
     rtl::Reference< SvXMLImportPropertyMapper > m_xTextImpPrMap;
@@ -1051,7 +1051,7 @@ XMLTextImportHelper::~XMLTextImportHelper()
 void XMLTextImportHelper::dispose()
 {
     if (m_xImpl->m_xAutoStyles)
-        static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->dispose();
+        m_xImpl->m_xAutoStyles->dispose();
 }
 
 SvXMLImportPropertyMapper *XMLTextImportHelper::CreateShapeExtPropMapper(SvXMLImport& rImport)
@@ -1327,7 +1327,7 @@ OUString XMLTextImportHelper::ConvertStarFonts( const OUString& rChars,
                 if (!rStyleName.isEmpty() && m_xImpl->m_xAutoStyles.is())
                 {
                     const SvXMLStyleContext* pTempStyle =
-                        static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->
+                        m_xImpl->m_xAutoStyles->
                                 FindStyleChildContext( nFamily, rStyleName,
                                                        true );
                     pStyle = const_cast<XMLTextStyleContext*>( dynamic_cast< const XMLTextStyleContext* >(pTempStyle));
@@ -1339,8 +1339,7 @@ OUString XMLTextImportHelper::ConvertStarFonts( const OUString& rChars,
                     if( nCount )
                     {
                         rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
-                            static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())
-                                ->GetImportPropertyMapper(nFamily);
+                            m_xImpl->m_xAutoStyles->GetImportPropertyMapper(nFamily);
                         if( xImpPrMap.is() )
                         {
                             rtl::Reference<XMLPropertySetMapper> rPropMapper =
@@ -1536,8 +1535,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
     if (!sStyleName.isEmpty() && m_xImpl->m_xAutoStyles.is())
     {
         const SvXMLStyleContext* pTempStyle =
-            static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->
-                    FindStyleChildContext( nFamily, sStyleName, true );
+            m_xImpl->m_xAutoStyles->FindStyleChildContext( nFamily, sStyleName, true );
         pStyle = const_cast<XMLTextStyleContext*>(dynamic_cast< const XMLTextStyleContext* >(pTempStyle));
     }
     if( pStyle )
@@ -2220,8 +2218,7 @@ void XMLTextImportHelper::SetRuby(
         if (!rStyleName.isEmpty() && m_xImpl->m_xAutoStyles.is())
         {
             const SvXMLStyleContext* pTempStyle =
-                static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->
-                FindStyleChildContext( XmlStyleFamily::TEXT_RUBY,
+                m_xImpl->m_xAutoStyles->FindStyleChildContext( XmlStyleFamily::TEXT_RUBY,
                                        rStyleName, true );
             XMLPropStyleContext *pStyle = const_cast<XMLPropStyleContext*>(dynamic_cast< const XMLPropStyleContext* >(pTempStyle));
 
@@ -2463,8 +2460,7 @@ sal_Int32 XMLTextImportHelper::GetDataStyleKey(const OUString& sStyleName,
         return -1;
 
     const SvXMLStyleContext* pStyle =
-        static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->
-                  FindStyleChildContext( XmlStyleFamily::DATA_STYLE,
+        m_xImpl->m_xAutoStyles->FindStyleChildContext( XmlStyleFamily::DATA_STYLE,
                                               sStyleName, true );
 
     // get appropriate context
@@ -2499,8 +2495,7 @@ const SvxXMLListStyleContext *XMLTextImportHelper::FindAutoListStyle( const OUSt
     if (m_xImpl->m_xAutoStyles.is())
     {
         const SvXMLStyleContext* pTempStyle =
-            static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->
-                    FindStyleChildContext( XmlStyleFamily::TEXT_LIST, rName,
+            m_xImpl->m_xAutoStyles->FindStyleChildContext( XmlStyleFamily::TEXT_LIST, rName,
                                            true );
         pStyle = dynamic_cast< const SvxXMLListStyleContext* >(pTempStyle);
     }
@@ -2514,8 +2509,7 @@ XMLPropStyleContext *XMLTextImportHelper::FindAutoFrameStyle( const OUString& rN
     if (m_xImpl->m_xAutoStyles.is())
     {
         const SvXMLStyleContext* pTempStyle =
-            static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->
-                    FindStyleChildContext( XmlStyleFamily::SD_GRAPHICS_ID, rName,
+            m_xImpl->m_xAutoStyles->FindStyleChildContext( XmlStyleFamily::SD_GRAPHICS_ID, rName,
                                            true );
         pStyle = const_cast<XMLPropStyleContext*>(dynamic_cast< const XMLPropStyleContext* >(pTempStyle));
     }
@@ -2530,8 +2524,7 @@ XMLPropStyleContext* XMLTextImportHelper::FindSectionStyle(
     if (m_xImpl->m_xAutoStyles.is())
     {
         const SvXMLStyleContext* pTempStyle =
-            static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->
-                           FindStyleChildContext(
+            m_xImpl->m_xAutoStyles->FindStyleChildContext(
                                XmlStyleFamily::TEXT_SECTION,
                                rName, true );
         pStyle = const_cast<XMLPropStyleContext*>(dynamic_cast< const XMLPropStyleContext* >(pTempStyle));
@@ -2547,8 +2540,7 @@ XMLPropStyleContext* XMLTextImportHelper::FindPageMaster(
     if (m_xImpl->m_xAutoStyles.is())
     {
         const SvXMLStyleContext* pTempStyle =
-            static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->
-                           FindStyleChildContext(
+            m_xImpl->m_xAutoStyles->FindStyleChildContext(
                                XmlStyleFamily::PAGE_MASTER,
                                rName, true );
         pStyle = const_cast<XMLPropStyleContext*>(dynamic_cast< const XMLPropStyleContext* >(pTempStyle));
@@ -2564,7 +2556,7 @@ XMLPropStyleContext * XMLTextImportHelper::FindDrawingPage(OUString const& rName
         return nullptr;
     }
     SvXMLStyleContext const* pStyle(
-        static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->FindStyleChildContext(
+        m_xImpl->m_xAutoStyles->FindStyleChildContext(
                XmlStyleFamily::SD_DRAWINGPAGE_ID, rName, true));
     assert(pStyle == nullptr || dynamic_cast<XMLPropStyleContext const*>(pStyle) != nullptr);
     return const_cast<XMLPropStyleContext*>(static_cast<XMLPropStyleContext const*>(pStyle));


More information about the Libreoffice-commits mailing list