[Libreoffice-commits] core.git: vcl/inc vcl/source

Caolán McNamara caolanm at redhat.com
Thu Apr 4 06:26:28 PDT 2013


 vcl/inc/vcl/builder.hxx       |    4 ++--
 vcl/source/window/builder.cxx |   15 ++++++++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 1439c2fedd8a8c2e52bac3346e7e2ab588922fd9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Apr 4 14:23:18 2013 +0100

    use existing hook for replacing %FOO variables
    
    Change-Id: Ib10545d964e96ae6f92583bbad8479951385247c

diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index c606055..8202aa1 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -11,6 +11,7 @@
 #define _VCLBUILDER_HXX
 
 #include <typeinfo>
+#include <tools/resmgr.hxx> //for poxy ResHookProc typedef
 #include <vcl/dllapi.h>
 #include <vcl/window.hxx>
 #include <xmlreader/xmlreader.hxx>
@@ -196,8 +197,7 @@ private:
 
     OString m_sID;
     OString m_sHelpRoot;
-    OString m_sProductName;
-    OString m_sVendor;
+    ResHookProc m_pStringReplace;
     Window *m_pParent;
     bool m_bToplevelHasDeferredInit;
     bool m_bToplevelParentFound;
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 75959b6..01a7185 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -138,8 +138,7 @@ namespace
 VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OString sID)
     : m_sID(sID)
     , m_sHelpRoot(OUStringToOString(sUIFile, RTL_TEXTENCODING_UTF8))
-    , m_sProductName(OUStringToOString(utl::ConfigManager::getProductName(), RTL_TEXTENCODING_UTF8))
-    , m_sVendor(OUStringToOString(utl::ConfigManager::getVendor(), RTL_TEXTENCODING_UTF8))
+    , m_pStringReplace(ResMgr::GetReadStringHook())
     , m_pParent(pParent)
     , m_bToplevelParentFound(false)
     , m_pParserState(new ParserState)
@@ -2403,9 +2402,15 @@ void VclBuilder::collectProperty(xmlreader::XmlReader &reader, const OString &rI
     if (!sProperty.isEmpty())
     {
         sProperty = sProperty.replace('_', '-');
-        rMap[sProperty] = sValue.
-            replaceAll("%PRODUCTNAME", m_sProductName).
-            replaceAll("%OOOVENDOR", m_sVendor);
+        if (m_pStringReplace)
+        {
+            OUString sTmp = (*m_pStringReplace)(OStringToOUString(sValue, RTL_TEXTENCODING_UTF8));
+            rMap[sProperty] = OUStringToOString(sTmp, RTL_TEXTENCODING_UTF8);
+        }
+        else
+        {
+            rMap[sProperty] = sValue;
+        }
     }
 }
 


More information about the Libreoffice-commits mailing list