diff options
Diffstat (limited to 'sfx2/source/doc/doctemplates.cxx')
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 7df93afaa63e..099e649506c0 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -72,6 +72,7 @@ #include "sfxurlrelocator.hxx" #include "doctemplateslocal.hxx" #include <sfx2/docfac.hxx> +#include <sfx2/docfile.hxx> #include "doc.hrc" //----------------------------------------------------------------------------- @@ -909,7 +910,8 @@ sal_Bool SfxDocTplService_Impl::CreateNewUniqueFolderWithPrefix( const ::rtl::OU Content aParent; - if ( Content::create( aDirPath.GetMainURL( INetURLObject::NO_DECODE ), maCmdEnv, aParent ) ) + uno::Reference< XCommandEnvironment > aQuietEnv; + if ( Content::create( aDirPath.GetMainURL( INetURLObject::NO_DECODE ), aQuietEnv, aParent ) ) { for ( sal_Int32 nInd = 0; nInd < 32000; nInd++ ) { @@ -1919,7 +1921,11 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, aStoreArgs[1].Name = ::rtl::OUString::createFromAscii( "DocumentTitle" ); aStoreArgs[1].Value <<= rTemplateName; - rStorable->storeToURL( aNewTemplateTargetURL, aStoreArgs ); + ::rtl::OUString aCurrentDocumentURL = rStorable->getLocation(); + if( !SfxMedium::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() )) + rStorable->storeToURL( aNewTemplateTargetURL, aStoreArgs ); + else + rStorable->store(); // the storing was successful, now the old template with the same name can be removed if it existed if ( aTemplateToRemoveTargetURL.getLength() ) |