diff options
author | Muthu Subramanian <sumuthu@suse.com> | 2011-10-07 20:15:01 +0530 |
---|---|---|
committer | Muthu Subramanian <sumuthu@suse.com> | 2011-10-07 20:15:01 +0530 |
commit | ce285da92f95995a4e7c3a63713a8b004a1ab967 (patch) | |
tree | b8d39b72f9f59c16ef9bbb6b2baf9475244c9d08 | |
parent | do not check if unsigned is less than zero in in soltools/..hastbl.cxx (diff) | |
download | core-ce285da92f95995a4e7c3a63713a8b004a1ab967.tar.gz core-ce285da92f95995a4e7c3a63713a8b004a1ab967.zip |
n#685123: Undo corrupting the document.
-rw-r--r-- | sd/source/ui/func/fuformatpaintbrush.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sd/source/ui/func/fuformatpaintbrush.cxx b/sd/source/ui/func/fuformatpaintbrush.cxx index 77908a5335e8..700ed0860ee7 100644 --- a/sd/source/ui/func/fuformatpaintbrush.cxx +++ b/sd/source/ui/func/fuformatpaintbrush.cxx @@ -256,20 +256,26 @@ bool FuFormatPaintBrush::HasContentForThisType( sal_uInt32 nObjectInventor, sal_ void FuFormatPaintBrush::Paste( bool bNoCharacterFormats, bool bNoParagraphFormats ) { 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( bUndo && !mpView->GetTextEditOutlinerView() ) + pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if( mpDoc->IsUndoEnabled() ) + // 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" ) ) ) ); mpDoc->BegUndo( sLabel ); - mpDoc->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoAttrObject(*pObj,sal_False,sal_True)); + mpDoc->AddUndo( mpDoc->GetSdrUndoFactory().CreateUndoAttrObject( *pObj, sal_False, sal_True ) ); } mpView->ApplyFormatPaintBrush( *mpItemSet.get(), bNoCharacterFormats, bNoParagraphFormats ); - if( mpDoc->IsUndoEnabled() ) + if( pObj ) { mpDoc->EndUndo(); } |