diff options
Diffstat (limited to 'xmloff/source/style/xmlnume.cxx')
-rw-r--r-- | xmloff/source/style/xmlnume.cxx | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index 882b27971dd7..3c9e25fb643b 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -720,57 +720,57 @@ void SvxXMLNumRuleExport::exportOutline() UNO_QUERY ); SAL_WARN_IF( !xCNSupplier.is(), "xmloff", "no chapter numbering supplier" ); - if( xCNSupplier.is() ) - { - Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() ); - SAL_WARN_IF( !xNumRule.is(), "xmloff", "no chapter numbering rules" ); + if( !xCNSupplier.is() ) + return; + + Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() ); + SAL_WARN_IF( !xNumRule.is(), "xmloff", "no chapter numbering rules" ); + + if( !xNumRule.is() ) + return; - if( xNumRule.is() ) + /* Outline style has property style:name since ODF 1.2 + Thus, export this property and adjust fix for issue #i69627# (#i90780#) + */ + OUString sOutlineStyleName; + { + Reference<XPropertySet> xNumRulePropSet( + xCNSupplier->getChapterNumberingRules(), UNO_QUERY ); + if (xNumRulePropSet.is()) { - /* Outline style has property style:name since ODF 1.2 - Thus, export this property and adjust fix for issue #i69627# (#i90780#) - */ - OUString sOutlineStyleName; - { - Reference<XPropertySet> xNumRulePropSet( - xCNSupplier->getChapterNumberingRules(), UNO_QUERY ); - if (xNumRulePropSet.is()) - { - xNumRulePropSet->getPropertyValue( "Name" ) >>= sOutlineStyleName; - } - } - const SvtSaveOptions::ODFSaneDefaultVersion nODFVersion = - GetExport().getSaneDefaultVersion(); - if ((nODFVersion == SvtSaveOptions::ODFSVER_010 || - nODFVersion == SvtSaveOptions::ODFSVER_011) - && GetExport().writeOutlineStyleAsNormalListStyle()) - { - exportNumberingRule( sOutlineStyleName, false, xNumRule ); - } - else - { - if (nODFVersion != SvtSaveOptions::ODFSVER_010 && - nODFVersion != SvtSaveOptions::ODFSVER_011) - { - // style:name="..." - GetExport().CheckAttrList(); - if ( !sOutlineStyleName.isEmpty() ) - { - bool bEncoded = false; - GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, - GetExport().EncodeStyleName( sOutlineStyleName, - &bEncoded ) ); - if( bEncoded ) - GetExport().AddAttribute( XML_NAMESPACE_STYLE, - XML_DISPLAY_NAME, - sOutlineStyleName ); - } - } - SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, - XML_OUTLINE_STYLE, true, true ); - exportLevelStyles( xNumRule, true ); + xNumRulePropSet->getPropertyValue( "Name" ) >>= sOutlineStyleName; + } + } + const SvtSaveOptions::ODFSaneDefaultVersion nODFVersion = + GetExport().getSaneDefaultVersion(); + if ((nODFVersion == SvtSaveOptions::ODFSVER_010 || + nODFVersion == SvtSaveOptions::ODFSVER_011) + && GetExport().writeOutlineStyleAsNormalListStyle()) + { + exportNumberingRule( sOutlineStyleName, false, xNumRule ); + } + else + { + if (nODFVersion != SvtSaveOptions::ODFSVER_010 && + nODFVersion != SvtSaveOptions::ODFSVER_011) + { + // style:name="..." + GetExport().CheckAttrList(); + if ( !sOutlineStyleName.isEmpty() ) + { + bool bEncoded = false; + GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, + GetExport().EncodeStyleName( sOutlineStyleName, + &bEncoded ) ); + if( bEncoded ) + GetExport().AddAttribute( XML_NAMESPACE_STYLE, + XML_DISPLAY_NAME, + sOutlineStyleName ); } } + SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, + XML_OUTLINE_STYLE, true, true ); + exportLevelStyles( xNumRule, true ); } } @@ -783,40 +783,40 @@ void SvxXMLNumRuleExport::exportStyles( bool bUsed, Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY ); SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "No XStyleFamiliesSupplier from XModel for export!" ); - if( xFamiliesSupp.is() ) - { - Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() ); - SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "getStyleFamilies() from XModel failed for export!" ); + if( !xFamiliesSupp.is() ) + return; - if( xFamilies.is() ) - { - const OUString aNumberStyleName( "NumberingStyles" ); + Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() ); + SAL_WARN_IF( !xFamiliesSupp.is(), "xmloff", "getStyleFamilies() from XModel failed for export!" ); - Reference< XIndexAccess > xStyles; - if( xFamilies->hasByName( aNumberStyleName ) ) - { - xFamilies->getByName( aNumberStyleName ) >>= xStyles; + if( !xFamilies.is() ) + return; - SAL_WARN_IF( !xStyles.is(), "xmloff", "Style not found for export!" ); + const OUString aNumberStyleName( "NumberingStyles" ); - if( xStyles.is() ) - { - const sal_Int32 nStyles = xStyles->getCount(); - - for( sal_Int32 i=0; i < nStyles; i++ ) - { - Reference< XStyle > xStyle; - xStyles->getByIndex( i ) >>= xStyle; - - if( !bUsed || xStyle->isInUse() ) - { - exportStyle( xStyle ); - if( pPool ) - pPool->RegisterName( xStyle->getName() ); - } - } - } - } + Reference< XIndexAccess > xStyles; + if( !xFamilies->hasByName( aNumberStyleName ) ) + return; + + xFamilies->getByName( aNumberStyleName ) >>= xStyles; + + SAL_WARN_IF( !xStyles.is(), "xmloff", "Style not found for export!" ); + + if( !xStyles.is() ) + return; + + const sal_Int32 nStyles = xStyles->getCount(); + + for( sal_Int32 i=0; i < nStyles; i++ ) + { + Reference< XStyle > xStyle; + xStyles->getByIndex( i ) >>= xStyle; + + if( !bUsed || xStyle->isInUse() ) + { + exportStyle( xStyle ); + if( pPool ) + pPool->RegisterName( xStyle->getName() ); } } } |