diff options
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/xmlnume.cxx | 9 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextListAutoStylePool.cxx | 20 | ||||
-rw-r--r-- | xmloff/source/text/txtstyle.cxx | 2 |
3 files changed, 23 insertions, 8 deletions
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index 682fc648af41..9ec9350374db 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -782,9 +782,7 @@ void SvxXMLNumRuleExport::exportOutline() } } -void SvxXMLNumRuleExport::exportStyles( bool bUsed, - XMLTextListAutoStylePool *pPool, - bool bExportChapterNumbering ) +void SvxXMLNumRuleExport::exportStyles( bool bUsed, bool bExportChapterNumbering ) { if( bExportChapterNumbering ) exportOutline(); @@ -821,11 +819,8 @@ void SvxXMLNumRuleExport::exportStyles( bool bUsed, xStyles->getByIndex( i ) >>= xStyle; if( !bUsed || xStyle->isInUse() ) - { exportStyle( xStyle ); - if( pPool ) - pPool->RegisterName( xStyle->getName() ); - } + } } diff --git a/xmloff/source/text/XMLTextListAutoStylePool.cxx b/xmloff/source/text/XMLTextListAutoStylePool.cxx index 893fdbdc5a4a..1e6cfdc368d8 100644 --- a/xmloff/source/text/XMLTextListAutoStylePool.cxx +++ b/xmloff/source/text/XMLTextListAutoStylePool.cxx @@ -23,6 +23,8 @@ #include <tools/solar.h> #include <o3tl/sorted_vector.hxx> #include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/style/XStyle.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/ucb/XAnyCompareFactory.hpp> #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/container/XIndexReplace.hpp> @@ -160,6 +162,24 @@ XMLTextListAutoStylePool::XMLTextListAutoStylePool( SvXMLExport& rExp ) : if( bStylesOnly ) sPrefix = "ML"; + Reference<XStyleFamiliesSupplier> xFamiliesSupp(rExport.GetModel(), UNO_QUERY); + SAL_WARN_IF(!xFamiliesSupp.is(), "xmloff", "getStyleFamilies() from XModel failed for export!"); + Reference< XNameAccess > xFamilies; + if (xFamiliesSupp.is()) + xFamilies = xFamiliesSupp->getStyleFamilies(); + + Reference<XIndexAccess> xStyles; + static const OUStringLiteral aNumberStyleName(u"NumberingStyles"); + if (xFamilies.is() && xFamilies->hasByName(aNumberStyleName)) + xFamilies->getByName(aNumberStyleName) >>= xStyles; + + const sal_Int32 nStyles = xStyles.is() ? xStyles->getCount() : 0; + for (sal_Int32 i = 0; i < nStyles; i++) + { + Reference<XStyle> xStyle; + xStyles->getByIndex(i) >>= xStyle; + RegisterName(xStyle->getName()); + } } XMLTextListAutoStylePool::~XMLTextListAutoStylePool() diff --git a/xmloff/source/text/txtstyle.cxx b/xmloff/source/text/txtstyle.cxx index fd04a925bc35..4cc211dcff0b 100644 --- a/xmloff/source/text/txtstyle.cxx +++ b/xmloff/source/text/txtstyle.cxx @@ -108,7 +108,7 @@ void XMLTextParagraphExport::exportStyleAttributes( void XMLTextParagraphExport::exportNumStyles( bool bUsed ) { SvxXMLNumRuleExport aNumRuleExport( GetExport() ); - aNumRuleExport.exportStyles( bUsed, &maListAutoPool, !IsBlockMode() ); + aNumRuleExport.exportStyles(bUsed, !IsBlockMode()); } void XMLTextParagraphExport::exportTextStyles( bool bUsed, bool bProg ) |