diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-03-08 13:37:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-03-08 13:48:34 +0000 |
commit | dbe20175fed8e82bec3578ae3af800dac7bc45f4 (patch) | |
tree | 20d8f9b8ed608e01a562893fa921a761bc058cad /sw | |
parent | 672ad9493a484a606df2f546caf98a7a7355fe31 (diff) |
Resolves: fdo#46939 don't rename autotext when source and dest are the same
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks.cxx | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index 5a19bc612bad..1ee655ac45f0 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -208,22 +208,23 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const String& rNewShort, con String aOldName (aNames[ nIdx ]->aPackageName); aShort = rNewShort; GeneratePackageName( aShort, aPackageName ); - if (IsOnlyTextBlock ( nIdx ) ) - { - String sExt( String::CreateFromAscii( ".xml" )); - String aOldStreamName( aOldName ); aOldStreamName += sExt; - String aNewStreamName( aPackageName ); aNewStreamName += sExt; - - xRoot = xBlkRoot->openStorageElement( aOldName, embed::ElementModes::READWRITE ); - xRoot->renameElement ( aOldStreamName, aNewStreamName ); - uno::Reference < embed::XTransactedObject > xTrans( xRoot, uno::UNO_QUERY ); - if ( xTrans.is() ) - xTrans->commit(); - xRoot = 0; - } if(aOldName != aPackageName) { + if (IsOnlyTextBlock ( nIdx ) ) + { + String sExt( String::CreateFromAscii( ".xml" )); + String aOldStreamName( aOldName ); aOldStreamName += sExt; + String aNewStreamName( aPackageName ); aNewStreamName += sExt; + + xRoot = xBlkRoot->openStorageElement( aOldName, embed::ElementModes::READWRITE ); + xRoot->renameElement ( aOldStreamName, aNewStreamName ); + uno::Reference < embed::XTransactedObject > xTrans( xRoot, uno::UNO_QUERY ); + if ( xTrans.is() ) + xTrans->commit(); + xRoot = 0; + } + try { xBlkRoot->renameElement ( aOldName, aPackageName ); |