n#685123: Undo corrupting the document.

This commit is contained in:
Muthu Subramanian
2011-10-07 20:15:01 +05:30
parent 90645b9be8
commit ce285da92f

View File

@@ -258,9 +258,15 @@ void FuFormatPaintBrush::Paste( bool bNoCharacterFormats, bool bNoParagraphForma
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
if( mpItemSet.get() && ( rMarkList.GetMarkCount() == 1 ) ) if( mpItemSet.get() && ( rMarkList.GetMarkCount() == 1 ) )
{ {
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); SdrObject* pObj( NULL );
bool bUndo = mpDoc->IsUndoEnabled();
if( mpDoc->IsUndoEnabled() ) if( bUndo && !mpView->GetTextEditOutlinerView() )
pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
// n685123: ApplyFormatPaintBrush itself would store undo information
// except in a few cases (?)
if( pObj )
{ {
String sLabel( mpViewShell->GetViewShellBase().RetrieveLabelFromCommand( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatPaintbrush" ) ) ) ); String sLabel( mpViewShell->GetViewShellBase().RetrieveLabelFromCommand( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatPaintbrush" ) ) ) );
mpDoc->BegUndo( sLabel ); mpDoc->BegUndo( sLabel );
@@ -269,7 +275,7 @@ void FuFormatPaintBrush::Paste( bool bNoCharacterFormats, bool bNoParagraphForma
mpView->ApplyFormatPaintBrush( *mpItemSet.get(), bNoCharacterFormats, bNoParagraphFormats ); mpView->ApplyFormatPaintBrush( *mpItemSet.get(), bNoCharacterFormats, bNoParagraphFormats );
if( mpDoc->IsUndoEnabled() ) if( pObj )
{ {
mpDoc->EndUndo(); mpDoc->EndUndo();
} }