diff options
author | sb <sb@openoffice.org> | 2010-11-19 11:35:41 +0100 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-11-19 11:35:41 +0100 |
commit | 91b0140b03639bff0354ec43bc1ea86cc8d2573e (patch) | |
tree | 63d5e3a28316843b4e6c040e56ec2a8d5ac6f853 /unotools | |
parent | 955e88c80e9abce3f15aa55d434dae6ae17d7d43 (diff) | |
parent | 8dc3743ca56382374183bec5cd1a11d53f3085b8 (diff) |
sb131: merged in re/DEV300_next towards DEV300_m94
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/pathoptions.cxx | 13 | ||||
-rw-r--r-- | unotools/source/ucbhelper/tempfile.cxx | 14 |
2 files changed, 20 insertions, 7 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 ) diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index e77dc529e410..87fddc0c65cd 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -198,19 +198,19 @@ String ConstructTempDir_Impl( const String* pParent ) void CreateTempName_Impl( String& rName, sal_Bool bKeep, sal_Bool bDir = sal_True ) { // add a suitable tempname - // Prefix can have 5 chars, leaving 3 for numbers. 26 ** 3 == 17576 - // ER 13.07.00 why not radix 36 [0-9A-Z] ?!? - const unsigned nRadix = 26; + // 36 ** 6 == 2176782336 + unsigned const nRadix = 36; + unsigned long const nMax = (nRadix*nRadix*nRadix*nRadix*nRadix*nRadix); String aName( rName ); aName += String::CreateFromAscii( "sv" ); rName.Erase(); - static unsigned long u = Time::GetSystemTicks(); - for ( unsigned long nOld = u; ++u != nOld; ) + unsigned long nSeed = Time::GetSystemTicks() % nMax; + for ( unsigned long u = nSeed; ++u != nSeed; ) { - u %= (nRadix*nRadix*nRadix); + u %= nMax; String aTmp( aName ); - aTmp += String::CreateFromInt32( (sal_Int32) (unsigned) u, nRadix ); + aTmp += String::CreateFromInt64( static_cast<sal_Int64>(u), nRadix ); aTmp += String::CreateFromAscii( ".tmp" ); if ( bDir ) |