summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-09-24 15:14:48 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-09-24 15:14:48 +0200
commitfc85672befcbbca764c6a082040387fc2d41d8a8 (patch)
treeb870957bc8981656e152020f806e92e3e39f4a3e /unotools
parentd3a48ab9c41bd4c7ba6b48fb70ce6b55026c9b20 (diff)
dba34a: #i114733# SearchFile: expand vnd.sun.star.expand URLs before processing them further
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/pathoptions.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx
index 2ae6f0c97f0c..3cf43a1f3bc9 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -46,12 +46,14 @@
#include <unotools/ucbhelper.hxx>
#include <vos/process.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/util/XStringSubstitution.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/XMacroExpander.hpp>
#include <rtl/instance.hxx>
#include <itemholder1.hxx>
@@ -998,6 +1000,17 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath )
if ( LocalFileHelper::ConvertPhysicalNameToURL( aPathToken, aURL ) )
aObj.SetURL( aURL );
}
+ if ( aObj.GetProtocol() == INET_PROT_VND_SUN_STAR_EXPAND )
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XMacroExpander > xMacroExpander( aContext.getSingleton( "com.sun.star.util.theMacroExpander" ), UNO_QUERY );
+ OSL_ENSURE( xMacroExpander.is(), "SvtPathOptions::SearchFile: unable to access the MacroExpander singleton!" );
+ if ( xMacroExpander.is() )
+ {
+ const ::rtl::OUString sExpandedPath = xMacroExpander->expandMacros( aObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ) );
+ aObj.SetURL( sExpandedPath );
+ }
+ }
xub_StrLen i, nCount = aIniFile.GetTokenCount( '/' );
for ( i = 0; i < nCount; ++i )