summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/lib/init.cxx19
-rw-r--r--framework/source/services/substitutepathvars.cxx23
2 files changed, 34 insertions, 8 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f4e2c39f6d07..4842a9732cee 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -107,6 +107,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/util/thePathSettings.hpp>
+#include <com/sun/star/util/PathSubstitution.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/util/XFlushable.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
@@ -8237,12 +8238,20 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
utl::Bootstrap::reloadData();
// Now that bootstrap User/Shared installation paths have been (re)set to the final
- // location, reinitialize the PathSettings so $(userurl)/$(instdir) path variables
- // will be expanded using these newly set paths and not the paths detected during
- // preinit which used unorthodox throwaway temp locations
+ // location, reinitialize the PathSubstitution rules and PathSettings so that
+ // $(userurl)/$(instdir) path variables will be expanded using these newly set
+ // paths and not the paths detected during preinit which used unorthodox throwaway
+ // temp locations
+
+ // First reinitialize the PathSubstitution rules
+ uno::Reference<css::util::XStringSubstitution> xPathSubst(util::PathSubstitution::create(xContext));
+ uno::Reference<lang::XInitialization> xReInitSubstitution(xPathSubst, uno::UNO_QUERY_THROW);
+ xReInitSubstitution->initialize({});
+
+ // PathSettings depend on PathSubstitution rules
uno::Reference<css::util::XPathSettings> xPathSettings = util::thePathSettings::get(xContext);
- uno::Reference<lang::XInitialization> xReInit(xPathSettings, uno::UNO_QUERY_THROW);
- xReInit->initialize({});
+ uno::Reference<lang::XInitialization> xReInitSettings(xPathSettings, uno::UNO_QUERY_THROW);
+ xReInitSettings->initialize({});
}
}
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index 3d84cb619384..febece5e6040 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -35,6 +35,7 @@
#include <officecfg/Office/Paths.hxx>
+#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
@@ -130,7 +131,8 @@ struct ReSubstFixedVarOrder
typedef comphelper::WeakComponentImplHelper<
css::util::XStringSubstitution,
- css::lang::XServiceInfo > SubstitutePathVariables_BASE;
+ css::lang::XServiceInfo,
+ css::lang::XInitialization > SubstitutePathVariables_BASE;
class SubstitutePathVariables : public SubstitutePathVariables_BASE
{
@@ -157,7 +159,12 @@ public:
virtual OUString SAL_CALL reSubstituteVariables( const OUString& aText ) override;
virtual OUString SAL_CALL getSubstituteVariableValue( const OUString& variable ) override;
-protected:
+ // XInitialization
+ virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& /*rArguments*/) override;
+
+private:
+ void impl_initialize();
+
void SetPredefinedPathVariables();
// Special case (transient) values can change during runtime!
@@ -189,6 +196,11 @@ private:
SubstitutePathVariables::SubstitutePathVariables()
{
+ impl_initialize();
+}
+
+void SubstitutePathVariables::impl_initialize()
+{
SetPredefinedPathVariables();
// Init the predefined/fixed variable to index hash map
@@ -219,6 +231,12 @@ SubstitutePathVariables::SubstitutePathVariables()
sort(m_aReSubstFixedVarOrder.begin(),m_aReSubstFixedVarOrder.end());
}
+void SAL_CALL SubstitutePathVariables::initialize(const css::uno::Sequence<css::uno::Any>& /*rArguments*/)
+{
+ std::unique_lock g(m_aMutex);
+ impl_initialize();
+}
+
// XStringSubstitution
OUString SAL_CALL SubstitutePathVariables::substituteVariables( const OUString& aText, sal_Bool bSubstRequired )
{
@@ -598,7 +616,6 @@ OUString const & SubstitutePathVariables::impl_getSubstituteVariableValue( const
void SubstitutePathVariables::SetPredefinedPathVariables()
{
-
m_aPreDefVars.m_FixedVar[PREDEFVAR_BRANDBASEURL] = "$BRAND_BASE_DIR";
rtl::Bootstrap::expandMacros(
m_aPreDefVars.m_FixedVar[PREDEFVAR_BRANDBASEURL]);