[ooo-build-commit] patches/dev300

Thorsten Behrens thorsten at kemper.freedesktop.org
Mon Aug 3 00:19:42 PDT 2009


 patches/dev300/apply                             |    3 
 patches/dev300/normalize-template-paths-fix.diff |  100 +++++++++++++++++++++++
 2 files changed, 103 insertions(+)

New commits:
commit e6f28b61ba8bcf89d84f62e90f43e5cb19bd1390
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Mon Aug 3 09:13:28 2009 +0200

    Expand path placeholders early; correctly normalize paths
    
    * patches/dev300/apply: added the patch
    * patches/dev300/normalize-template-paths-fix.diff: fixes two
      problems. first, the template dialog did not expand path
      placeholders (like OOO_BASEDIR etc.) before normalization.
      Second, the OfficeInstallationDirectories::makeRelocatableURL()
      method replaced the OOo dir in the wrong string.

diff --git a/patches/dev300/apply b/patches/dev300/apply
index e3a561a..de462ac 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3321,6 +3321,9 @@ ppt-customshape-shading-fix.diff, n#485637, thorsten
 # purge autoshape geometry on model change
 svx-autoshape-cache-purge.diff, n#520104, thorsten
 
+# expand path placeholders early in template dialog
+normalize-template-paths-fix.diff, n#512146, thorsten
+
 [ OOXML ]
 oox-pptx-import-fix-placeholder-text-style.diff, n#479834, rodo
 oox-pptx-import-fix-text-body-properties-priority.diff, n#403402, rodo
diff --git a/patches/dev300/normalize-template-paths-fix.diff b/patches/dev300/normalize-template-paths-fix.diff
new file mode 100644
index 0000000..b67e16b
--- /dev/null
+++ b/patches/dev300/normalize-template-paths-fix.diff
@@ -0,0 +1,100 @@
+fix template path bug
+
+From: Thorsten Behrens <thb at openoffice.org>
+
+
+---
+
+ .../officeinstallationdirectories.cxx              |   12 +++----
+ sfx2/source/doc/doctemplates.cxx                   |   35 ++++++++++++++++++++
+ 2 files changed, 41 insertions(+), 6 deletions(-)
+
+
+diff --git comphelper/source/officeinstdir/officeinstallationdirectories.cxx comphelper/source/officeinstdir/officeinstallationdirectories.cxx
+index cd09ff6..bcbae52 100644
+--- comphelper/source/officeinstdir/officeinstallationdirectories.cxx
++++ comphelper/source/officeinstdir/officeinstallationdirectories.cxx
+@@ -207,9 +207,9 @@ OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL )
+         if ( nIndex  != -1 )
+         {
+             return rtl::OUString(
+-                URL.replaceAt( nIndex,
+-                               m_pOfficeDir->getLength(),
+-                               m_aOfficeDirMacro ) );
++                aCanonicalURL.replaceAt( nIndex,
++                                         m_pOfficeDir->getLength(),
++                                         m_aOfficeDirMacro ) );
+         }
+         else
+         {
+@@ -217,9 +217,9 @@ OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL )
+             if ( nIndex  != -1 )
+             {
+                 return rtl::OUString(
+-                    URL.replaceAt( nIndex,
+-                                   m_pUserDir->getLength(),
+-                                   m_aUserDirMacro ) );
++                    aCanonicalURL.replaceAt( nIndex,
++                                             m_pUserDir->getLength(),
++                                             m_aUserDirMacro ) );
+             }
+         }
+     }
+diff --git sfx2/source/doc/doctemplates.cxx sfx2/source/doc/doctemplates.cxx
+index c23ef53..63734a5 100644
+--- sfx2/source/doc/doctemplates.cxx
++++ sfx2/source/doc/doctemplates.cxx
+@@ -51,6 +51,7 @@
+ #include <com/sun/star/beans/XPropertySetInfo.hpp>
+ #include <com/sun/star/beans/XPropertyContainer.hpp>
+ #include <com/sun/star/beans/StringPair.hpp>
++#include <com/sun/star/util/XMacroExpander.hpp>
+ #include <com/sun/star/container/XContainerQuery.hpp>
+ #include <com/sun/star/document/XTypeDetection.hpp>
+ #include <com/sun/star/document/XStandaloneDocumentInfo.hpp>
+@@ -601,11 +602,45 @@ void SfxDocTplService_Impl::getDirList()
+ 
+     maTemplateDirs = Sequence< OUString >( nCount );
+ 
++    uno::Reference< XComponentContext > xCtx;
++    uno::Reference< util::XMacroExpander > xExpander;
++    uno::Reference< XPropertySet > xPropSet( mxFactory, UNO_QUERY );
++    const rtl::OUString aPrefix(
++        RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.expand:" ) );
++
++    if ( xPropSet.is() )
++    {
++        xPropSet->getPropertyValue(
++            rtl::OUString(
++                RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) )
++            >>= xCtx;
++    }
++
++    if ( xCtx.is() )
++    {
++        xCtx->getValueByName(
++            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
++                               "/singletons/com.sun.star.util.theMacroExpander" ) ) )
++            >>= xExpander;
++
++        OSL_ENSURE( xExpander.is(),
++                    "Unable to obtain macro expander singleton!" );
++    }
++
+     for ( USHORT i=0; i<nCount; i++ )
+     {
+         aURL.SetSmartProtocol( INET_PROT_FILE );
+         aURL.SetURL( aDirs.GetToken( i, C_DELIM ) );
+         maTemplateDirs[i] = aURL.GetMainURL( INetURLObject::NO_DECODE );
++        
++        sal_Int32 nIndex = maTemplateDirs[i].indexOf( aPrefix );
++        if ( nIndex != -1 && xExpander.is() )
++        {
++            maTemplateDirs[i] = maTemplateDirs[i].replaceAt(nIndex,
++                                                            aPrefix.getLength(),
++                                                            rtl::OUString());
++            maTemplateDirs[i] = xExpander->expandMacros( maTemplateDirs[i] );
++        }
+     }
+ 
+     aValue <<= maTemplateDirs;


More information about the ooo-build-commit mailing list