svdedxv.cxx (26734c99) svdedxv.cxx (69ffbee1)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 59 unchanged lines hidden (view full) ---

68#include "svx/globl3d.hxx"
69#include <editeng/outliner.hxx>
70#include <editeng/adjitem.hxx>
71
72// #98988#
73#include <svtools/colorcfg.hxx>
74#include <vcl/svapp.hxx> //add CHINA001
75#include <svx/sdrpaintwindow.hxx>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 59 unchanged lines hidden (view full) ---

68#include "svx/globl3d.hxx"
69#include <editeng/outliner.hxx>
70#include <editeng/adjitem.hxx>
71
72// #98988#
73#include <svtools/colorcfg.hxx>
74#include <vcl/svapp.hxx> //add CHINA001
75#include <svx/sdrpaintwindow.hxx>
76#include <svx/sdrundomanager.hxx>
76
77////////////////////////////////////////////////////////////////////////////////////////////////////
78
79void SdrObjEditView::ImpClearVars()
80{
81 bQuickTextEditMode=sal_True;
82 bMacroMode=sal_True;
83 pTextEditOutliner=NULL;

--- 8 unchanged lines hidden (view full) ---

92 pMacroPV=NULL;
93 pMacroWin=NULL;
94 nMacroTol=0;
95 bTextEditDontDelete=sal_False;
96 bTextEditOnlyOneView=sal_False;
97}
98
99SdrObjEditView::SdrObjEditView(SdrModel* pModel1, OutputDevice* pOut):
77
78////////////////////////////////////////////////////////////////////////////////////////////////////
79
80void SdrObjEditView::ImpClearVars()
81{
82 bQuickTextEditMode=sal_True;
83 bMacroMode=sal_True;
84 pTextEditOutliner=NULL;

--- 8 unchanged lines hidden (view full) ---

93 pMacroPV=NULL;
94 pMacroWin=NULL;
95 nMacroTol=0;
96 bTextEditDontDelete=sal_False;
97 bTextEditOnlyOneView=sal_False;
98}
99
100SdrObjEditView::SdrObjEditView(SdrModel* pModel1, OutputDevice* pOut):
100 SdrGlueEditView(pModel1,pOut)
101 SdrGlueEditView(pModel1,pOut),
102 mpOldTextEditUndoManager(0)
101{
102 ImpClearVars();
103}
104
105SdrObjEditView::~SdrObjEditView()
106{
107 pTextEditWin = NULL; // Damit es in SdrEndTextEdit kein ShowCursor gibt
108 if (IsTextEdit()) SdrEndTextEdit();
109 if (pTextEditOutliner!=NULL) {
110 delete pTextEditOutliner;
111 }
103{
104 ImpClearVars();
105}
106
107SdrObjEditView::~SdrObjEditView()
108{
109 pTextEditWin = NULL; // Damit es in SdrEndTextEdit kein ShowCursor gibt
110 if (IsTextEdit()) SdrEndTextEdit();
111 if (pTextEditOutliner!=NULL) {
112 delete pTextEditOutliner;
113 }
114
115 if(mpOldTextEditUndoManager)
116 {
117 delete mpOldTextEditUndoManager;
118 }
112}
113
114////////////////////////////////////////////////////////////////////////////////////////////////////
115
116sal_Bool SdrObjEditView::IsAction() const
117{
118 return IsMacroObj() || SdrGlueEditView::IsAction();
119}

--- 412 unchanged lines hidden (view full) ---

532 bOk = (sal_Bool)rStr.Len();
533 }
534 if (!bOk && aOldCalcFieldValueLink.IsSet()) {
535 return aOldCalcFieldValueLink.Call(pFI);
536 }
537 return 0;
538}
539
119}
120
121////////////////////////////////////////////////////////////////////////////////////////////////////
122
123sal_Bool SdrObjEditView::IsAction() const
124{
125 return IsMacroObj() || SdrGlueEditView::IsAction();
126}

--- 412 unchanged lines hidden (view full) ---

539 bOk = (sal_Bool)rStr.Len();
540 }
541 if (!bOk && aOldCalcFieldValueLink.IsSet()) {
542 return aOldCalcFieldValueLink.Call(pFI);
543 }
544 return 0;
545}
546
547IMPL_LINK(SdrObjEditView, EndTextEditHdl, SdrUndoManager*, /*pUndoManager*/)
548{
549 SdrEndTextEdit();
550 return 0;
551}
552
540sal_Bool SdrObjEditView::SdrBeginTextEdit(
541 SdrObject* pObj, SdrPageView* pPV, Window* pWin,
542 sal_Bool bIsNewObj, SdrOutliner* pGivenOutliner,
543 OutlinerView* pGivenOutlinerView,
544 sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView,
545 sal_Bool bGrabFocus)
546{
547 SdrEndTextEdit();

--- 212 unchanged lines hidden (view full) ---

760 GetModel()->Broadcast(aHint);
761 }
762
763 pTextEditOutliner->setVisualizedPage(0);
764
765 if( mxSelectionController.is() )
766 mxSelectionController->onSelectionHasChanged();
767
553sal_Bool SdrObjEditView::SdrBeginTextEdit(
554 SdrObject* pObj, SdrPageView* pPV, Window* pWin,
555 sal_Bool bIsNewObj, SdrOutliner* pGivenOutliner,
556 OutlinerView* pGivenOutlinerView,
557 sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView,
558 sal_Bool bGrabFocus)
559{
560 SdrEndTextEdit();

--- 212 unchanged lines hidden (view full) ---

773 GetModel()->Broadcast(aHint);
774 }
775
776 pTextEditOutliner->setVisualizedPage(0);
777
778 if( mxSelectionController.is() )
779 mxSelectionController->onSelectionHasChanged();
780
781 if(IsUndoEnabled())
782 {
783 SdrUndoManager* pSdrUndoManager = dynamic_cast< SdrUndoManager* >(GetModel()->GetSdrUndoManager());
784
785 if(pSdrUndoManager)
786 {
787 // we have an outliner, undo manager and it's an EditUndoManager, exchange
788 // the document undo manager and the default one from the outliner and tell
789 // it that text edit starts by setting a callback if it needs to end text edit mode.
790 if(mpOldTextEditUndoManager)
791 {
792 // should not happen, delete it
793 delete mpOldTextEditUndoManager;
794 mpOldTextEditUndoManager = 0;
795 }
796
797 mpOldTextEditUndoManager = pTextEditOutliner->SetUndoManager(pSdrUndoManager);
798 pSdrUndoManager->SetEndTextEditHdl(LINK(this, SdrObjEditView, EndTextEditHdl));
799 }
800 else
801 {
802 OSL_ENSURE(false, "The document undo manager is not derived from SdrUndoManager (!)");
803 }
804 }
805
768 return sal_True; // Gut gelaufen, TextEdit laeuft nun
769 }
770 else
771 {
772 bBrk = sal_True;
773 pTextEditOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
774 pTextEditOutliner->SetBeginPasteOrDropHdl(Link());
775 pTextEditOutliner->SetEndPasteOrDropHdl(Link());

--- 41 unchanged lines hidden (view full) ---

817SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(sal_Bool bDontDeleteReally)
818{
819 SdrEndTextEditKind eRet=SDRENDTEXTEDIT_UNCHANGED;
820 SdrTextObj* pTEObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
821 Window* pTEWin =pTextEditWin;
822 SdrOutliner* pTEOutliner =pTextEditOutliner;
823 OutlinerView* pTEOutlinerView=pTextEditOutlinerView;
824 Cursor* pTECursorMerker=pTextEditCursorMerker;
806 return sal_True; // Gut gelaufen, TextEdit laeuft nun
807 }
808 else
809 {
810 bBrk = sal_True;
811 pTextEditOutliner->SetCalcFieldValueHdl(aOldCalcFieldValueLink);
812 pTextEditOutliner->SetBeginPasteOrDropHdl(Link());
813 pTextEditOutliner->SetEndPasteOrDropHdl(Link());

--- 41 unchanged lines hidden (view full) ---

855SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(sal_Bool bDontDeleteReally)
856{
857 SdrEndTextEditKind eRet=SDRENDTEXTEDIT_UNCHANGED;
858 SdrTextObj* pTEObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() );
859 Window* pTEWin =pTextEditWin;
860 SdrOutliner* pTEOutliner =pTextEditOutliner;
861 OutlinerView* pTEOutlinerView=pTextEditOutlinerView;
862 Cursor* pTECursorMerker=pTextEditCursorMerker;
863 SdrUndoManager* pExtraUndoEditUndoManager = 0;
825
864
865 if(IsUndoEnabled() && GetModel() && pTEObj && pTEOutliner)
866 {
867 // change back the UndoManager to the remembered original one
868 ::svl::IUndoManager* pOriginal = pTEOutliner->SetUndoManager(mpOldTextEditUndoManager);
869 mpOldTextEditUndoManager = 0;
870
871 if(pOriginal)
872 {
873 // check if we got back our document undo manager
874 SdrUndoManager* pSdrUndoManager = dynamic_cast< SdrUndoManager* >(GetModel()->GetSdrUndoManager());
875
876 if(pSdrUndoManager && dynamic_cast< SdrUndoManager* >(pOriginal) == pSdrUndoManager)
877 {
878 // We are ending text edit; execute all redos to create a complete text change
879 // undo action for the redo buffer. Also mark this state when at least one redo was
880 // executed; the created TextChange needs to be undone plus the first real undo
881 // outside the text edit changes
882 while(pSdrUndoManager->GetRedoActionCount())
883 {
884 pExtraUndoEditUndoManager = pSdrUndoManager;
885 pSdrUndoManager->Redo();
886 }
887
888 // reset the callback link and let the undo manager cleanup all text edit
889 // undo actions to get the stack back to the form before the text edit
890 pSdrUndoManager->SetEndTextEditHdl(Link());
891 }
892 else
893 {
894 OSL_ENSURE(false, "�Got UndoManager back in SdrEndTextEdit which is NOT the expected document UndoManager (!)");
895 delete pOriginal;
896 }
897 }
898 }
899
826 // send HINT_ENDEDIT #99840#
827 if( GetModel() && mxTextEditObj.is() )
828 {
829 SdrHint aHint(*mxTextEditObj.get());
830 aHint.SetKind(HINT_ENDEDIT);
831 GetModel()->Broadcast(aHint);
832 }
833

--- 192 unchanged lines hidden (view full) ---

1026 !pTEObj->GetModel()->isLocked() &&
1027 pTEObj->GetBroadcaster())
1028 {
1029 SdrHint aHint(HINT_ENDEDIT);
1030 aHint.SetObject(pTEObj);
1031 ((SfxBroadcaster*)pTEObj->GetBroadcaster())->Broadcast(aHint);
1032 }
1033
900 // send HINT_ENDEDIT #99840#
901 if( GetModel() && mxTextEditObj.is() )
902 {
903 SdrHint aHint(*mxTextEditObj.get());
904 aHint.SetKind(HINT_ENDEDIT);
905 GetModel()->Broadcast(aHint);
906 }
907

--- 192 unchanged lines hidden (view full) ---

1100 !pTEObj->GetModel()->isLocked() &&
1101 pTEObj->GetBroadcaster())
1102 {
1103 SdrHint aHint(HINT_ENDEDIT);
1104 aHint.SetObject(pTEObj);
1105 ((SfxBroadcaster*)pTEObj->GetBroadcaster())->Broadcast(aHint);
1106 }
1107
1034 return eRet;
1108 if(pExtraUndoEditUndoManager)
1109 {
1110 // undo the text edit action since it was created as part of a EndTextEdit
1111 // callback from undo itself. This needs to be done after the call to
1112 // FmFormView::SdrEndTextEdit since it gets created there
1113 pExtraUndoEditUndoManager->Undo();
1114 }
1115
1116 return eRet;
1035}
1036
1037////////////////////////////////////////////////////////////////////////////////////////////////////
1038// info about TextEdit. Default is sal_False.
1039bool SdrObjEditView::IsTextEdit() const
1040{
1041 return mxTextEditObj.is();
1042}

--- 1126 unchanged lines hidden ---
1117}
1118
1119////////////////////////////////////////////////////////////////////////////////////////////////////
1120// info about TextEdit. Default is sal_False.
1121bool SdrObjEditView::IsTextEdit() const
1122{
1123 return mxTextEditObj.is();
1124}

--- 1126 unchanged lines hidden ---