diff options
Diffstat (limited to 'xmloff/source/draw/ximpstyl.cxx')
-rw-r--r-- | xmloff/source/draw/ximpstyl.cxx | 67 |
1 files changed, 20 insertions, 47 deletions
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index aee1d7b5debf..5a4266850089 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -379,8 +379,7 @@ SdXMLPageMasterContext::SdXMLPageMasterContext( sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList>& xAttrList) -: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID), - mpPageMasterStyle( nullptr ) +: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID) { // set family to something special at SvXMLStyleContext // for differences in search-methods @@ -405,16 +404,6 @@ SdXMLPageMasterContext::SdXMLPageMasterContext( } } -SdXMLPageMasterContext::~SdXMLPageMasterContext() -{ - // release remembered contexts, they are no longer needed - if(mpPageMasterStyle) - { - mpPageMasterStyle->ReleaseRef(); - mpPageMasterStyle = nullptr; - } -} - SvXMLImportContext *SdXMLPageMasterContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, @@ -424,12 +413,9 @@ SvXMLImportContext *SdXMLPageMasterContext::CreateChildContext( if(nPrefix == XML_NAMESPACE_STYLE && IsXMLToken( rLocalName, XML_PAGE_LAYOUT_PROPERTIES) ) { - pContext = new SdXMLPageMasterStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList); - - // remember SdXMLPresentationPlaceholderContext for later evaluation - pContext->AddFirstRef(); - DBG_ASSERT(!mpPageMasterStyle, "PageMasterStyle is set, there seem to be two of them (!)"); - mpPageMasterStyle = static_cast<SdXMLPageMasterStyleContext*>(pContext); + DBG_ASSERT(!mxPageMasterStyle.is(), "PageMasterStyle is set, there seem to be two of them (!)"); + mxPageMasterStyle.set(new SdXMLPageMasterStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList)); + pContext = mxPageMasterStyle.get(); } // call base class @@ -465,10 +451,6 @@ SdXMLPresentationPageLayoutContext::SdXMLPresentationPageLayoutContext( } } -SdXMLPresentationPageLayoutContext::~SdXMLPresentationPageLayoutContext() -{ -} - SvXMLImportContext *SdXMLPresentationPageLayoutContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, @@ -478,13 +460,13 @@ SvXMLImportContext *SdXMLPresentationPageLayoutContext::CreateChildContext( if(nPrefix == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_PLACEHOLDER ) ) { + const uno::Reference< SdXMLPresentationPlaceholderContext > xContext{ + new SdXMLPresentationPlaceholderContext(GetSdImport(), nPrefix, rLocalName, xAttrList)}; // presentation:placeholder inside style:presentation-page-layout context - pContext = new SdXMLPresentationPlaceholderContext( - GetSdImport(), nPrefix, rLocalName, xAttrList); + pContext = xContext.get(); // remember SdXMLPresentationPlaceholderContext for later evaluation - pContext->AddFirstRef(); - maList.push_back( static_cast<SdXMLPresentationPlaceholderContext*>(pContext) ); + maList.push_back( xContext ); } // call base class @@ -501,7 +483,7 @@ void SdXMLPresentationPageLayoutContext::EndElement() // at the moment only use number of types used there if( !maList.empty() ) { - SdXMLPresentationPlaceholderContext* pObj0 = maList[ 0 ]; + SdXMLPresentationPlaceholderContext* pObj0 = maList[ 0 ].get(); if( pObj0->GetName() == "handout" ) { switch( maList.size() ) @@ -543,7 +525,7 @@ void SdXMLPresentationPageLayoutContext::EndElement() } case 2: { - SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ]; + SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ].get(); if( pObj1->GetName() == "subtitle" ) { @@ -586,8 +568,8 @@ void SdXMLPresentationPageLayoutContext::EndElement() } case 3: { - SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ]; - SdXMLPresentationPlaceholderContext* pObj2 = maList[ 2 ]; + SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ].get(); + SdXMLPresentationPlaceholderContext* pObj2 = maList[ 2 ].get(); if( pObj1->GetName() == "outline" ) { @@ -651,8 +633,8 @@ void SdXMLPresentationPageLayoutContext::EndElement() } case 4: { - SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ]; - SdXMLPresentationPlaceholderContext* pObj2 = maList[ 2 ]; + SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ].get(); + SdXMLPresentationPlaceholderContext* pObj2 = maList[ 2 ].get(); if( pObj1->GetName() == "object" ) { @@ -673,7 +655,7 @@ void SdXMLPresentationPageLayoutContext::EndElement() } case 5: { - SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ]; + SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ].get(); if( pObj1->GetName() == "object" ) { @@ -700,8 +682,6 @@ void SdXMLPresentationPageLayoutContext::EndElement() } // release remembered contexts, they are no longer needed - for ( size_t i = maList.size(); i > 0; ) - maList[ --i ]->ReleaseRef(); maList.clear(); } } @@ -1459,13 +1439,6 @@ SdXMLMasterStylesContext::SdXMLMasterStylesContext( { } -SdXMLMasterStylesContext::~SdXMLMasterStylesContext() -{ - for ( size_t i = maMasterPageList.size(); i > 0; ) - maMasterPageList[ --i ]->ReleaseRef(); - maMasterPageList.clear(); -} - SvXMLImportContext* SdXMLMasterStylesContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, @@ -1501,11 +1474,11 @@ SvXMLImportContext* SdXMLMasterStylesContext::CreateChildContext( uno::Reference< drawing::XShapes > xNewShapes(xNewMasterPage, uno::UNO_QUERY); if(xNewShapes.is() && GetSdImport().GetShapeImport()->GetStylesContext()) { - pContext = new SdXMLMasterPageContext(GetSdImport(), - nPrefix, rLocalName, xAttrList, xNewShapes); - - pContext->AddFirstRef(); - maMasterPageList.push_back( static_cast<SdXMLMasterPageContext*>(pContext) ); + const uno::Reference<SdXMLMasterPageContext> xContext{ + new SdXMLMasterPageContext(GetSdImport(), + nPrefix, rLocalName, xAttrList, xNewShapes)}; + pContext = xContext.get(); + maMasterPageList.push_back(xContext); } } } |