[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sfx2/source

Cédric Bosdonnat cedric.bosdonnat at free.fr
Tue Feb 12 00:34:50 PST 2013


 sfx2/source/doc/doctemplates.cxx |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit df37dd7d3ce201d1ba5a0065c126db107ce18ead
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Mon Feb 11 15:24:23 2013 +0100

    Fixed SfxDocTplService_Impl::setTitleForURL to keep all streams.
    
    After commit 117fdb98, the setTitleForURL only wrote the meta.xml file
    to the odf container, dropping all the other streams. Use storeToStorage
    as in the old implementation to fix the problem.
    
    Even though marginal, this problem is important for templates renaming.
    
    Change-Id: Ia9b6abfc112f102e2bd2ae9d3080c4ed827200df
    Reviewed-on: https://gerrit.libreoffice.org/2107
    Reviewed-by: Tor Lillqvist <tml at iki.fi>
    Tested-by: Tor Lillqvist <tml at iki.fi>

diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 1313fee..9720fab 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -32,6 +32,7 @@
 #include <comphelper/componentcontext.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/storagehelper.hxx>
 #include <comphelper/string.hxx>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -646,8 +647,18 @@ sal_Bool SfxDocTplService_Impl::setTitleForURL( const OUString& rURL, const OUSt
         try
         {
             m_xDocProps->loadFromMedium(rURL, Sequence<PropertyValue>());
-            m_xDocProps->setTitle(aTitle );
-            m_xDocProps->storeToMedium(rURL, Sequence<PropertyValue>());
+            m_xDocProps->setTitle(aTitle);
+
+            uno::Reference< embed::XStorage > xStorage = ::comphelper::OStorageHelper::GetStorageFromURL(
+                    rURL, embed::ElementModes::READWRITE);
+
+            uno::Sequence<beans::PropertyValue> medium(2);
+            medium[0].Name = ::rtl::OUString("DocumentBaseURL");
+            medium[0].Value <<= rURL;
+            medium[1].Name = ::rtl::OUString("URL");
+            medium[1].Value <<= rURL;
+
+            m_xDocProps->storeToStorage(xStorage, medium);
             return true;
         }
         catch ( Exception& )


More information about the Libreoffice-commits mailing list