From 6fc6494aa9fea0b47fbf048998d7bd412ef478b1 Mon Sep 17 00:00:00 2001
From: Vishv Brahmbhatt <vishvbrahmbhatt19@gmail.com>
Date: Wed, 11 Sep 2013 00:44:36 +0530
Subject: 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>
---
 comphelper/source/misc/expandmacro.cxx | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

(limited to 'comphelper')

diff --git a/comphelper/source/misc/expandmacro.cxx b/comphelper/source/misc/expandmacro.cxx
index a7eae4b12548..86eb7c21183e 100644
--- a/comphelper/source/misc/expandmacro.cxx
+++ b/comphelper/source/misc/expandmacro.cxx
@@ -10,29 +10,17 @@
 #include <comphelper/expandmacro.hxx>
 
 #include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/util/theMacroExpander.hpp>
 #include <rtl/ustring.hxx>
 #include <rtl/uri.hxx>
-#include <osl/file.h>
-#include <comphelper/processfactory.hxx>
+#include <rtl/bootstrap.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
-using ::com::sun::star::lang::XMultiServiceFactory;
 
 namespace comphelper
 {
     rtl::OUString getExpandedFilePath(const rtl::OUString& filepath)
     {
-        const Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
-        return getExpandedFilePath(filepath, xContext);
-    }
-
-    rtl::OUString getExpandedFilePath(const rtl::OUString& filepath, const Reference<XComponentContext>& xContext)
-    {
-        Reference< util::XMacroExpander > xMacroExpander = util::theMacroExpander::get( xContext );
-
         rtl::OUString aFilename = filepath;
 
         if( aFilename.startsWith( "vnd.sun.star.expand:" ) )
@@ -44,16 +32,10 @@ namespace comphelper
             aMacro = rtl::Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
 
             // expand macro string
-            aFilename = xMacroExpander->expandMacros( aMacro );
-        }
+            rtl::Bootstrap::expandMacros( aMacro);
 
-        if( aFilename.startsWith( "file://" ) )
-        {
-            rtl::OUString aSysPath;
-            if( osl_getSystemPathFromFileURL( aFilename.pData, &aSysPath.pData ) == osl_File_E_None )
-                aFilename = aSysPath;
+            aFilename = aMacro;
         }
-
         return aFilename;
     }
 }
-- 
cgit