diff options
author | Dirk Völzke <dv@openoffice.org> | 2001-05-23 09:41:53 +0000 |
---|---|---|
committer | Dirk Völzke <dv@openoffice.org> | 2001-05-23 09:41:53 +0000 |
commit | 6f61c08755432e4eccb55655d7433d4952d56819 (patch) | |
tree | 657159b9f3a6471c5b9ba9b7fc7d01303ebde2bc /sfx2/source/doc/doctempl.cxx | |
parent | 39dcd561255d9c1b438c618c9810a1b39eeb3d65 (diff) |
#86105# CopyOrMove() now stores the correct target url
Diffstat (limited to 'sfx2/source/doc/doctempl.cxx')
-rw-r--r-- | sfx2/source/doc/doctempl.cxx | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 146053ea3c37..815e314ee3b3 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: doctempl.cxx,v $ * - * $Revision: 1.39 $ + * $Revision: 1.40 $ * - * last change: $Author: th $ $Date: 2001-05-11 11:38:59 $ + * last change: $Author: dv $ $Date: 2001-05-23 10:41:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -971,14 +971,7 @@ BOOL SfxDocumentTemplates::CopyOrMove if ( !pTargetRgn ) return FALSE; - EntryData_Impl *pTarget = pTargetRgn->GetEntry( nTargetIdx ); - - OUString aTitle; - - if ( pTarget ) - aTitle = pTarget->GetTitle(); - else - aTitle = pSource->GetTitle(); + OUString aTitle = pSource->GetTitle(); Reference< XDocumentTemplates > xTemplates = pImp->getDocTemplates(); @@ -986,19 +979,24 @@ BOOL SfxDocumentTemplates::CopyOrMove aTitle, pSource->GetTargetURL() ) ) { - if ( bMove ) - { - pSourceRgn->DeleteEntry( nSourceIdx ); - // --**-- delete the original file - } - + INetURLObject aSourceObj( pSource->GetTargetURL() ); INetURLObject aNewTarget( pTargetRgn->GetTargetURL() ); aNewTarget.insertName( aTitle, false, INetURLObject::LAST_SEGMENT, true, INetURLObject::ENCODE_ALL ); + aNewTarget.setExtension( aSourceObj.getExtension() ); - pTargetRgn->AddEntry( aTitle, aNewTarget.GetMainURL() ); + pTargetRgn->AddEntry( aTitle, aNewTarget.GetMainURL(), &nTargetIdx ); + + if ( bMove ) + { + // --**-- delete the original file + sal_Bool bDeleted = xTemplates->removeTemplate( pSourceRgn->GetTitle(), + pSource->GetTitle() ); + if ( bDeleted ) + pSourceRgn->DeleteEntry( nSourceIdx ); + } return sal_True; } |