summaryrefslogtreecommitdiffstats
path: root/chart2/source/controller/main/ChartController_TextEdit.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/main/ChartController_TextEdit.cxx')
-rw-r--r--chart2/source/controller/main/ChartController_TextEdit.cxx42
1 files changed, 16 insertions, 26 deletions
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx
index 6091fd8ef3f8..910dcb962731 100644
--- a/chart2/source/controller/main/ChartController_TextEdit.cxx
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -29,6 +29,8 @@
#include "precompiled_chart2.hxx"
#include "ChartController.hxx"
+#include "ResId.hxx"
+#include "UndoGuard.hxx"
#include "DrawViewWrapper.hxx"
#include "ChartWindow.hxx"
#include "TitleHelper.hxx"
@@ -36,6 +38,7 @@
#include "macros.hxx"
#include "ControllerLockGuard.hxx"
#include "AccessibleTextHelper.hxx"
+#include "Strings.hrc"
#include "chartview/DrawModelWrapper.hxx"
#include <svx/svdotext.hxx>
@@ -81,7 +84,9 @@ void ChartController::StartTextEdit( const Point* pMousePixel )
if(!pTextObj)
return;
- m_xUndoManager->preAction( getModel());
+ OSL_PRECOND( !m_pTextActionUndoGuard.get(), "ChartController::StartTextEdit: already have a TextUndoGuard!?" );
+ m_pTextActionUndoGuard.reset( new UndoGuard(
+ String( SchResId( STR_ACTION_EDIT_TEXT ) ), m_xUndoManager ) );
SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner();
//pOutliner->SetRefDevice(m_pChartWindow);
//pOutliner->SetStyleSheetPool((SfxStyleSheetPool*)pStyleSheetPool);
@@ -165,26 +170,11 @@ bool ChartController::EndTextEdit()
TitleHelper::setCompleteString( aString, uno::Reference<
::com::sun::star::chart2::XTitle >::query( xPropSet ), m_xCC );
- try
- {
- m_xUndoManager->postAction( C2U("Edit Text") );
- }
- catch( uno::RuntimeException& e)
- {
- ASSERT_EXCEPTION( e );
- }
- }
- else
- {
- try
- {
- m_xUndoManager->cancelAction();
- }
- catch ( uno::RuntimeException& e )
- {
- ASSERT_EXCEPTION( e );
- }
+ OSL_ENSURE( m_pTextActionUndoGuard.get(), "ChartController::EndTextEdit: no TextUndoGuard!" );
+ if ( m_pTextActionUndoGuard.get() )
+ m_pTextActionUndoGuard->commit();
}
+ m_pTextActionUndoGuard.reset();
}
return true;
}
@@ -203,10 +193,10 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
DBG_ASSERT( pFact, "No dialog factory" );
SfxAllItemSet aSet( m_pDrawModelWrapper->GetItemPool() );
- aSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) );
+ aSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) );
//set fixed current font
- aSet.Put( SfxBoolItem( FN_PARAM_2, TRUE ) ); //maybe not necessary in future
+ aSet.Put( SfxBoolItem( FN_PARAM_2, sal_True ) ); //maybe not necessary in future
Font aCurFont = m_pDrawViewWrapper->getOutliner()->GetRefDevice()->GetFont();
aSet.Put( SvxFontItem( aCurFont.GetFamily(), aCurFont.GetName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), SID_ATTR_CHAR_FONT ) );
@@ -218,7 +208,7 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
const SfxItemSet* pSet = pDlg->GetOutputItemSet();
const SfxPoolItem* pItem=0;
String aString;
- if ( pSet && pSet->GetItemState( SID_CHARMAP, TRUE, &pItem) == SFX_ITEM_SET &&
+ if ( pSet && pSet->GetItemState( SID_CHARMAP, sal_True, &pItem) == SFX_ITEM_SET &&
pItem->ISA(SfxStringItem) )
aString = dynamic_cast<const SfxStringItem*>(pItem)->GetValue();
@@ -232,7 +222,7 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
// prevent flicker
pOutlinerView->HideCursor();
- pOutliner->SetUpdateMode(FALSE);
+ pOutliner->SetUpdateMode(sal_False);
// delete current selection by inserting empty String, so current
// attributes become unique (sel. has to be erased anyway)
@@ -240,7 +230,7 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
//SfxUndoManager& rUndoMgr = pOutliner->GetUndoManager();
//rUndoMgr.EnterListAction( String( SchResId( STR_UNDO_INSERT_SPECCHAR )), String( SchResId( STR_UNDO_INSERT_SPECCHAR )));
- pOutlinerView->InsertText(aString, TRUE);
+ pOutlinerView->InsertText(aString, sal_True);
ESelection aSel = pOutlinerView->GetSelection();
aSel.nStartPara = aSel.nEndPara;
@@ -250,7 +240,7 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter()
//rUndoMgr.LeaveListAction();
// show changes
- pOutliner->SetUpdateMode(TRUE);
+ pOutliner->SetUpdateMode(sal_True);
pOutlinerView->ShowCursor();
}