[Libreoffice-commits] .: 2 commits - sw/source
Caolán McNamara
caolan at kemper.freedesktop.org
Thu Mar 8 05:49:04 PST 2012
sw/source/core/swg/SwXMLTextBlocks.cxx | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
New commits:
commit 0c075735344122c1c016289951f2bf832cec69a7
Author: Szabolcs Dezsi <dezsiszabi at hotmail.com>
Date: Thu Mar 8 13:47:50 2012 +0000
Fixed crash when renaming AutoText
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx
index 1ee655a..ba3b00a 100644
--- a/sw/source/core/swg/SwXMLTextBlocks.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks.cxx
@@ -218,7 +218,13 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const String& rNewShort, con
String aNewStreamName( aPackageName ); aNewStreamName += sExt;
xRoot = xBlkRoot->openStorageElement( aOldName, embed::ElementModes::READWRITE );
- xRoot->renameElement ( aOldStreamName, aNewStreamName );
+ try
+ {
+ xRoot->renameElement ( aOldStreamName, aNewStreamName );
+ }
+ catch(const container::ElementExistException&)
+ {
+ }
uno::Reference < embed::XTransactedObject > xTrans( xRoot, uno::UNO_QUERY );
if ( xTrans.is() )
xTrans->commit();
commit dbe20175fed8e82bec3578ae3af800dac7bc45f4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Mar 8 13:37:40 2012 +0000
Resolves: fdo#46939 don't rename autotext when source and dest are the same
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx
index 5a19bc6..1ee655a 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 );
More information about the Libreoffice-commits
mailing list