diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-02-06 12:09:48 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-02-06 12:44:37 +0100 |
commit | 1a3c90a292c7fc9060604151de9dc51eecf5b6a7 (patch) | |
tree | 226567cca6b2f74e749f36cc3ef3b76d67eb91a1 /xmloff | |
parent | fdfd5c111de740456bc03df727b9c74a617237fc (diff) |
sw: let drawinglayer manage gradient styles of our textframes
With this, the hacks from commits
81a46fc86a530f028a5bd2f5e52fe0372d50ee38 and
d7efffebd9651dd866349915360ade64b97d7301 are no longer necessary.
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 64 |
1 files changed, 26 insertions, 38 deletions
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 0c5773b8cdbd..94e145412a34 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1540,55 +1540,43 @@ void SvXMLExport::_ExportFontDecls() mxFontAutoStylePool->exportXML(); } -void lcl_ExportGradientStyle(SvXMLExport& rExport, uno::Reference< lang::XMultiServiceFactory > xFact, OUString aServiceName, std::vector<OUString>& rGradientNames) +void SvXMLExport::_ExportStyles( sal_Bool ) { - try + uno::Reference< lang::XMultiServiceFactory > xFact( GetModel(), uno::UNO_QUERY ); + if( xFact.is()) { - uno::Reference< container::XNameAccess > xGradient( xFact->createInstance( aServiceName ), uno::UNO_QUERY ); - if( xGradient.is() ) + // export (fill-)gradient-styles + try { - XMLGradientStyleExport aGradientStyle( rExport ); - - if( xGradient->hasElements() ) + uno::Reference< container::XNameAccess > xGradient( xFact->createInstance( OUString("com.sun.star.drawing.GradientTable" ) ), uno::UNO_QUERY ); + if( xGradient.is() ) { - uno::Sequence< OUString > aNamesSeq ( xGradient->getElementNames() ); - sal_Int32 nCount = aNamesSeq.getLength(); - for( sal_Int32 i=0; i<nCount; i++ ) - { - const OUString& rStrName = aNamesSeq[ i ]; - - // Avoid duplicated style names. - if (std::find(rGradientNames.begin(), rGradientNames.end(), rStrName) != rGradientNames.end()) - continue; + XMLGradientStyleExport aGradientStyle( *this ); - try + if( xGradient->hasElements() ) + { + uno::Sequence< OUString > aNamesSeq ( xGradient->getElementNames() ); + sal_Int32 nCount = aNamesSeq.getLength(); + for( sal_Int32 i=0; i<nCount; i++ ) { - uno::Any aValue = xGradient->getByName( rStrName ); + const OUString& rStrName = aNamesSeq[ i ]; - aGradientStyle.exportXML( rStrName, aValue ); - rGradientNames.push_back(rStrName); - } - catch(const container::NoSuchElementException&) - { + try + { + uno::Any aValue = xGradient->getByName( rStrName ); + + aGradientStyle.exportXML( rStrName, aValue ); + } + catch(const container::NoSuchElementException&) + { + } } } } } - } - catch(const lang::ServiceNotRegisteredException&) - { - } -} - -void SvXMLExport::_ExportStyles( sal_Bool ) -{ - uno::Reference< lang::XMultiServiceFactory > xFact( GetModel(), uno::UNO_QUERY ); - if( xFact.is()) - { - // export (fill-)gradient-styles - std::vector<OUString> aGradientNames; - lcl_ExportGradientStyle(*this, xFact, "com.sun.star.drawing.GradientTable", aGradientNames); - lcl_ExportGradientStyle(*this, xFact, "com.sun.star.text.GradientTable", aGradientNames); + catch(const lang::ServiceNotRegisteredException&) + { + } // export (fill-)hatch-styles try |