diff options
author | Vishv Brahmbhatt <vishvbrahmbhatt19@gmail.com> | 2013-09-11 00:44:36 +0530 |
---|---|---|
committer | Thorsten Behrens <thb@documentfoundation.org> | 2013-09-13 14:26:39 +0000 |
commit | 6fc6494aa9fea0b47fbf048998d7bd412ef478b1 (patch) | |
tree | 4c377bee5774dceec6aa6c43f36644d3fde72a28 /sd | |
parent | 8b3cbc71151cf91a97e4c4340430876c8d02d030 (diff) |
Using macro expansion function for the remaining config entries.
Macro Expansion function is used in 'CustomAnimationPreset.cxx'
& 'TransitionPreset.cxx' to avoid code redundancy.Also appropriate
changes are to made to 'getExpandedFilePath' function.
Change-Id: I6b6ae068db3499fe2de2e78a884f9e0737577651
Reviewed-on: https://gerrit.libreoffice.org/5910
Reviewed-by: Thorsten Behrens <thb@documentfoundation.org>
Tested-by: Thorsten Behrens <thb@documentfoundation.org>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/CustomAnimationPreset.cxx | 14 | ||||
-rw-r--r-- | sd/source/core/TransitionPreset.cxx | 14 | ||||
-rw-r--r-- | sd/source/core/drawdoc.cxx | 6 |
3 files changed, 6 insertions, 28 deletions
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx index b03359b08d78..988302774e6f 100644 --- a/sd/source/core/CustomAnimationPreset.cxx +++ b/sd/source/core/CustomAnimationPreset.cxx @@ -33,6 +33,7 @@ #include <comphelper/string.hxx> #include <unotools/pathoptions.hxx> #include <tools/stream.hxx> +#include <comphelper/expandmacro.hxx> #include <tools/debug.hxx> #include <rtl/uri.hxx> @@ -291,8 +292,6 @@ Reference< XAnimationNode > implImportEffects( const Reference< XMultiServiceFac return xRootNode; } -#define EXPAND_PROTOCOL "vnd.sun.star.expand:" - void CustomAnimationPresets::importEffects() { try @@ -324,16 +323,7 @@ void CustomAnimationPresets::importEffects() for( sal_Int32 i=0; i<aFiles.getLength(); ++i ) { - OUString aURL = aFiles[i]; - if( aURL.startsWith( EXPAND_PROTOCOL ) ) - { - // cut protocol - OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) ); - // decode uric class chars - aMacro = rtl::Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - // expand macro string - aURL = xMacroExpander->expandMacros( aMacro ); - } + OUString aURL = ::comphelper::getExpandedFilePath(aFiles[i]); mxRootNode = implImportEffects( xServiceFactory, aURL ); diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx index e7b6a9bb82f2..966ccde50185 100644 --- a/sd/source/core/TransitionPreset.cxx +++ b/sd/source/core/TransitionPreset.cxx @@ -31,6 +31,7 @@ #include <comphelper/processfactory.hxx> #include <unotools/pathoptions.hxx> #include <tools/stream.hxx> +#include <comphelper/expandmacro.hxx> #include <rtl/uri.hxx> #include <rtl/instance.hxx> @@ -134,8 +135,6 @@ bool TransitionPreset::importTransitionsFile( TransitionPresetList& rList, return true; } -#define EXPAND_PROTOCOL "vnd.sun.star.expand:" - bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList ) { bool bRet = false; @@ -174,16 +173,7 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList ) for( sal_Int32 i=0; i<aFiles.getLength(); ++i ) { - OUString aURL = aFiles[i]; - if( aURL.startsWith( EXPAND_PROTOCOL ) ) - { - // cut protocol - OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) ); - // decode uric class chars - aMacro = rtl::Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - // expand macro string - aURL = xMacroExpander->expandMacros( aMacro ); - } + OUString aURL = ::comphelper::getExpandedFilePath(aFiles[i]); bRet |= importTransitionsFile( rList, xServiceFactory, diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index e327215f8968..2d23bbda4524 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -1000,8 +1000,7 @@ void SdDrawDocument::InitLayoutVector() rtl::OUString sFilename; for( sal_Int32 i=0; i < aFiles.getLength(); ++i ) { - rtl::OUString filepath = aFiles[i]; - sFilename= ::comphelper::getExpandedFilePath(filepath,xContext); + sFilename = ::comphelper::getExpandedFilePath(aFiles[i]); // load layout file into DOM Reference< XMultiServiceFactory > xServiceFactory( @@ -1030,8 +1029,7 @@ void SdDrawDocument::InitObjectVector() rtl::OUString sFilename; for( sal_Int32 i=0; i < aFiles.getLength(); ++i ) { - rtl::OUString filepath = aFiles[i]; - sFilename= ::comphelper::getExpandedFilePath(filepath,xContext); + sFilename = ::comphelper::getExpandedFilePath(aFiles[i]); // load presentation object file into DOM Reference< XMultiServiceFactory > xServiceFactory( |