summaryrefslogtreecommitdiff
path: root/unotools/source
diff options
context:
space:
mode:
Diffstat (limited to 'unotools/source')
-rw-r--r--unotools/source/config/pathoptions.cxx13
-rw-r--r--unotools/source/ucbhelper/tempfile.cxx14
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 )