From 7b384313399ee8199cd7241527c3dbc1d50694a2 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Mon, 11 Feb 2013 15:24:23 +0100 Subject: 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. --- sfx2/source/doc/doctemplates.cxx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 94ba00bd2c4f..d85ca00f72f5 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -639,8 +640,18 @@ sal_Bool SfxDocTplService_Impl::setTitleForURL( const OUString& rURL, const OUSt try { m_xDocProps->loadFromMedium(rURL, Sequence()); - m_xDocProps->setTitle(aTitle ); - m_xDocProps->storeToMedium(rURL, Sequence()); + m_xDocProps->setTitle(aTitle); + + uno::Reference< embed::XStorage > xStorage = ::comphelper::OStorageHelper::GetStorageFromURL( + rURL, embed::ElementModes::READWRITE); + + uno::Sequence 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& ) -- cgit