1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <editeng/eeitem.hxx>
22 #include <svx/sdrpagewindow.hxx>
23 #include <svx/sdrpaintwindow.hxx>
24 #include <tools/urlobj.hxx>
25 #include <vcl/help.hxx>
26 #include <editeng/fhgtitem.hxx>
27 #include <svl/intitem.hxx>
28 #include <svl/stritem.hxx>
29 #include <svx/svdotext.hxx>
30 #include <editeng/flditem.hxx>
31 #include <svl/style.hxx>
32 #include <svx/svdpagv.hxx>
33 #include <svx/sdtmfitm.hxx>
34 #include <svx/sdtagitm.hxx>
35 #include <svx/sdtfsitm.hxx>
36 #include <sfx2/viewfrm.hxx>
37 #include <sfx2/dispatch.hxx>
38 #include <sfx2/bindings.hxx>
39 #include <sfx2/request.hxx>
40 #include <editeng/editeng.hxx>
41 #include <svx/svdoutl.hxx>
42 #include <svx/svxids.hrc>
43 #include <svx/sdr/overlay/overlaymanager.hxx>
44 #include <sfx2/docfile.hxx>
45 #include <editeng/outlobj.hxx>
46 #include <osl/diagnose.h>
48 #include <editeng/frmdiritem.hxx>
50 #include <svx/svdetc.hxx>
51 #include <editeng/editview.hxx>
53 #include <sdresid.hxx>
56 #include <ViewShell.hxx>
57 #include <ViewShellBase.hxx>
60 #include <drawdoc.hxx>
62 #include <FrameView.hxx>
63 #include <ToolBarManager.hxx>
64 #include <DrawDocShell.hxx>
65 #include <strings.hrc>
68 using namespace ::com::sun::star
;
69 using namespace ::com::sun::star::uno
;
70 using namespace ::com::sun::star::lang
;
71 using namespace ::com::sun::star::linguistic2
;
75 const sal_uInt16 SidArray
[] = {
76 SID_STYLE_FAMILY2
, // 5542
77 SID_STYLE_FAMILY5
, // 5545
82 SID_ATTR_TABSTOP
, // 10002
83 SID_ATTR_CHAR_FONT
, // 10007
84 SID_ATTR_CHAR_POSTURE
, // 10008
85 SID_ATTR_CHAR_WEIGHT
, // 10009
86 SID_ATTR_CHAR_SHADOWED
, // 10010
87 SID_ATTR_CHAR_STRIKEOUT
, // 10013
88 SID_ATTR_CHAR_UNDERLINE
, // 10014
89 SID_ATTR_CHAR_FONTHEIGHT
, // 10015
90 SID_ATTR_CHAR_COLOR
, // 10017
91 SID_ATTR_CHAR_KERNING
, // 10018
92 SID_ATTR_CHAR_CASEMAP
, // 10019
93 SID_ATTR_PARA_ADJUST_LEFT
, // 10028
94 SID_ATTR_PARA_ADJUST_RIGHT
, // 10029
95 SID_ATTR_PARA_ADJUST_CENTER
, // 10030
96 SID_ATTR_PARA_ADJUST_BLOCK
, // 10031
97 SID_ATTR_PARA_LINESPACE_10
, // 10034
98 SID_ATTR_PARA_LINESPACE_15
, // 10035
99 SID_ATTR_PARA_LINESPACE_20
, // 10036
100 SID_ATTR_PARA_ULSPACE
, // 10042
101 SID_ATTR_PARA_LRSPACE
, // 10043
102 SID_ATTR_TRANSFORM_POS_X
, // 10088
103 SID_ATTR_TRANSFORM_POS_Y
, // 10089
104 SID_ATTR_TRANSFORM_WIDTH
, // 10090
105 SID_ATTR_TRANSFORM_HEIGHT
, // 10091
106 SID_ATTR_TRANSFORM_ROT_X
, // 10093
107 SID_ATTR_TRANSFORM_ROT_Y
, // 10094
108 SID_ATTR_TRANSFORM_ANGLE
, // 10095 //Added
109 SID_OUTLINE_UP
, // 10150
110 SID_OUTLINE_DOWN
, // 10151
111 SID_OUTLINE_LEFT
, // 10152
112 SID_OUTLINE_RIGHT
, // 10153
113 SID_ATTR_TRANSFORM_PROTECT_POS
, // 10236
114 SID_ATTR_TRANSFORM_PROTECT_SIZE
, // 10237 //Added
115 SID_FORMTEXT_STYLE
, // 10257
116 SID_SET_SUPER_SCRIPT
, // 10294
117 SID_SET_SUB_SCRIPT
, // 10295
118 SID_ATTR_TRANSFORM_AUTOWIDTH
, // 10310
119 SID_ATTR_TRANSFORM_AUTOHEIGHT
, // 10311 //Added
120 SID_HYPERLINK_GETLINK
, // 10361
121 SID_DEC_INDENT
, // 10461
122 SID_INC_INDENT
, // 10462
123 SID_CHARMAP
, // 10503
124 SID_TEXTDIRECTION_LEFT_TO_RIGHT
, // 10907
125 SID_TEXTDIRECTION_TOP_TO_BOTTOM
, // 10908
126 SID_ATTR_PARA_LEFT_TO_RIGHT
, // 10950
127 SID_ATTR_PARA_RIGHT_TO_LEFT
, // 10951
128 SID_PARASPACE_INCREASE
, // 11145
129 SID_PARASPACE_DECREASE
, // 11146
130 FN_NUM_BULLET_ON
, // 20138
135 * base class for text functions
137 FuText::FuText( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
138 : FuConstruct(pViewSh
, pWin
, pView
, pDoc
, rReq
)
139 , bFirstObjCreated(false)
140 , bJustEndedEdit(false)
145 rtl::Reference
<FuPoor
> FuText::Create( ViewShell
* pViewSh
, ::sd::Window
* pWin
, ::sd::View
* pView
, SdDrawDocument
* pDoc
, SfxRequest
& rReq
)
147 rtl::Reference
<FuPoor
> xFunc( new FuText( pViewSh
, pWin
, pView
, pDoc
, rReq
) );
151 void FuText::disposing()
155 if(mpView
->SdrEndTextEdit() == SdrEndTextEditKind::Deleted
)
158 // reset the RequestHandler of the used Outliner to the handler of the document
159 ::Outliner
* pOutliner
= mpView
->GetTextEditOutliner();
162 pOutliner
->SetStyleSheetPool(static_cast<SfxStyleSheetPool
*>(mpDoc
->GetStyleSheetPool()));
166 /*************************************************************************
168 |* Execute functionality of this class:
170 |* #71422: Start the functionality of this class in this method
171 |* and not in the ctor.
172 |* If you construct an object of this class and you put the
173 |* address of this object to pFuActual you've got a problem,
174 |* because some methods inside DoExecute use the pFuActual-Pointer.
175 |* If the code inside DoExecute is executed inside the ctor,
176 |* the value of pFuActual is not right. And the value will not
177 |* be right until the ctor finished !!!
179 \************************************************************************/
180 void FuText::DoExecute( SfxRequest
& )
182 mpViewShell
->GetViewShellBase().GetToolBarManager()->SetToolBarShell(
183 ToolBarManager::ToolBarGroup::Function
,
184 ToolbarId::Draw_Text_Toolbox_Sd
);
186 mpView
->SetCurrentObj(SdrObjKind::Text
);
187 mpView
->SetEditMode(SdrViewEditMode::Edit
);
189 MouseEvent
aMEvt(mpWindow
->GetPointerPosPixel());
191 if (nSlotId
== SID_TEXTEDIT
)
193 // Try to select an object
194 SdrPageView
* pPV
= mpView
->GetSdrPageView();
196 mpView
->PickAnything(aMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
197 mpView
->MarkObj(aVEvt
.mpRootObj
, pPV
);
199 mxTextObj
= DynCastSdrTextObj( aVEvt
.mpObj
);
201 else if (mpView
->AreObjectsMarked())
203 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
205 if (rMarkList
.GetMarkCount() == 1)
207 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
208 mxTextObj
= DynCastSdrTextObj( pObj
);
213 if (mpView
->AreObjectsMarked())
215 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
217 if (rMarkList
.GetMarkCount() == 1)
219 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
220 if( pObj
&& (pObj
->GetObjInventor() == SdrInventor::Default
) && (pObj
->GetObjIdentifier() == SdrObjKind::Table
) )
222 mpViewShell
->GetViewShellBase().GetToolBarManager()->AddToolBarShell(ToolBarManager::ToolBarGroup::Function
, ToolbarId::Draw_Table_Toolbox
);
227 bool bQuickDrag
= true;
229 const SfxItemSet
* pArgs
= rRequest
.GetArgs();
233 // test for type before using
234 && SID_TEXTEDIT
== nSlotId
235 && SfxItemState::SET
== pArgs
->GetItemState(SID_TEXTEDIT
)
237 && pArgs
->Get(SID_TEXTEDIT
).GetValue() == 2)
239 // Selection by doubleclick -> don't allow QuickDrag
243 SetInEditMode(aMEvt
, bQuickDrag
);
246 bool FuText::MouseButtonDown(const MouseEvent
& rMEvt
)
249 bJustEndedEdit
= false;
251 bool bReturn
= FuDraw::MouseButtonDown(rMEvt
);
254 SdrHitKind eHit
= mpView
->PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
256 // handle URL also during the text editing
257 if (rMEvt
.GetClicks() == 1 && rMEvt
.IsLeft() && rMEvt
.IsMod1())
259 OutlinerView
* pOLV
= mpView
->GetTextEditOutlinerView();
261 if (mxTextObj
.get().is() && pOLV
&& pOLV
->GetFieldUnderMousePointer())
263 const SvxFieldItem
* pFieldItem
= pOLV
->GetFieldUnderMousePointer();
266 const SvxFieldData
* pField
= pFieldItem
->GetField();
268 if (auto pURLField
= dynamic_cast< const SvxURLField
*>( pField
))
270 eHit
= SdrHitKind::MarkedObject
;
271 aVEvt
.meEvent
= SdrEventKind::ExecuteUrl
;
272 aVEvt
.mpURLField
= pURLField
;
278 if (eHit
== SdrHitKind::TextEdit
)
280 // hit text -> SdrView handles event
281 if (mpView
->MouseButtonDown(rMEvt
, mpWindow
->GetOutDev()))
285 if (rMEvt
.GetClicks() == 1)
287 if (mpView
->IsTextEdit() && eHit
!= SdrHitKind::MarkedObject
&& eHit
!= SdrHitKind::Handle
)
290 if(mpView
->SdrEndTextEdit() == SdrEndTextEditKind::Deleted
)
292 /* Bugfix from MBA: during a double click onto the unused? area
293 in text mode, we get with the second click eHit =
294 SdrHitKind::TextEditObj since it goes to the TextObject which was
295 created with the first click. But this is removed by
296 SdrEndTextEdit since it is empty. But it is still in the mark
297 list. The call MarkObj further below accesses then the dead
298 object. As a simple fix, we determine eHit after
299 SdrEndTextEdit again, this returns then SdrHitKind::NONE. */
301 eHit
= mpView
->PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
304 mpView
->SetCurrentObj(SdrObjKind::Text
);
305 mpView
->SetEditMode(SdrViewEditMode::Edit
);
308 if (rMEvt
.IsLeft() || rMEvt
.IsRight())
310 mpWindow
->CaptureMouse();
311 SdrPageView
* pPV
= mpView
->GetSdrPageView();
313 if (eHit
== SdrHitKind::TextEdit
)
315 SetInEditMode(rMEvt
, false);
319 // Don't remark table when clicking in it, mark change triggers a lot of updating
320 bool bMarkChanges
= true;
321 rtl::Reference
< sdr::SelectionController
> xSelectionController(mpView
->getSelectionController());
322 if (eHit
== SdrHitKind::TextEditObj
&& xSelectionController
.is())
324 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
325 if (rMarkList
.GetMarkCount() == 1 && rMarkList
.GetMark(0)->GetMarkedSdrObj() == aVEvt
.mpRootObj
)
326 bMarkChanges
= false;
329 if (eHit
!= SdrHitKind::Handle
)
331 // deselect selection
332 if (!rMEvt
.IsShift() && eHit
== SdrHitKind::TextEditObj
)
337 mpView
->SetDragMode(SdrDragMode::Move
);
342 if ( aVEvt
.meEvent
== SdrEventKind::ExecuteUrl
||
343 eHit
== SdrHitKind::Handle
||
344 eHit
== SdrHitKind::MarkedObject
||
345 eHit
== SdrHitKind::TextEditObj
||
346 ( eHit
== SdrHitKind::UnmarkedObject
&& bFirstObjCreated
&&
349 // Handle, hit marked or unmarked object
350 if (eHit
== SdrHitKind::TextEditObj
)
352 /* hit text of unmarked object:
353 select object and set to EditMode */
355 mpView
->MarkObj(aVEvt
.mpRootObj
, pPV
);
357 if (auto pSdrTextObj
= DynCastSdrTextObj(aVEvt
.mpObj
))
359 mxTextObj
= pSdrTextObj
;
362 SetInEditMode(rMEvt
, true);
364 else if (aVEvt
.meEvent
== SdrEventKind::ExecuteUrl
&& !rMEvt
.IsMod2())
367 mpWindow
->ReleaseMouse();
369 if (aVEvt
.mpURLField
)
371 SfxStringItem
aStrItem(SID_FILE_NAME
, aVEvt
.mpURLField
->GetURL());
372 SfxStringItem
aReferer(SID_REFERER
, mpDocSh
->GetMedium()->GetName());
373 SfxBoolItem
aBrowseItem( SID_BROWSE
, true );
374 SfxViewFrame
* pFrame
= mpViewShell
->GetViewFrame();
379 pFrame
->GetDispatcher()->ExecuteList(SID_OPENDOC
,
380 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
,
381 { &aStrItem
, &aBrowseItem
, &aReferer
});
385 // open in current frame
386 SfxFrameItem
aFrameItem(SID_DOCFRAME
, pFrame
);
387 pFrame
->GetDispatcher()->ExecuteList(SID_OPENDOC
,
388 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
,
389 { &aStrItem
, &aFrameItem
, &aBrowseItem
, &aReferer
});
395 // drag object or handle
398 // do the EndTextEdit first, it will delete the handles and force a
399 // recreation. This will make aVEvt.mpHdl to point to a deleted handle,
400 // thus it is necessary to reset it and to get it again.
403 // cl: I'm not sure why we checked here also for mxTextObj->GetOutlinerParaObject
404 // this caused SdrEndTextEdit() to be called also when not in text editing and
405 // this does not make sense and caused troubles. (see issue 112855)
407 if( mpView
->IsTextEdit() )
409 mpView
->SdrEndTextEdit();
410 bJustEndedEdit
= true;
414 // force new handle identification, the pointer will be dead here
415 // since SdrEndTextEdit has reset (deleted) the handles.
416 aVEvt
.mpHdl
= nullptr;
417 mpView
->PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
423 if( eHit
== SdrHitKind::UnmarkedObject
)
425 if ( !rMEvt
.IsShift() )
428 mpView
->MarkObj(aVEvt
.mpRootObj
, pPV
);
432 bFirstMouseMove
= true;
436 if ( ! rMEvt
.IsRight())
438 // we need to pick again since SdrEndTextEdit can rebuild the handles list
439 eHit
= mpView
->PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
440 if( (eHit
== SdrHitKind::Handle
) || (eHit
== SdrHitKind::MarkedObject
) )
442 sal_uInt16 nDrgLog
= sal_uInt16 ( mpWindow
->PixelToLogic(Size(mpView
->GetDragThresholdPixels(),0)).Width() );
443 mpView
->BegDragObj(aMDPos
, nullptr, aVEvt
.mpHdl
, nDrgLog
);
449 else if ( nSlotId
!= SID_TEXTEDIT
&&
450 (bPermanent
|| !bFirstObjCreated
) )
453 mpView
->SetCurrentObj(SdrObjKind::Text
);
454 mpView
->SetEditMode(SdrViewEditMode::Create
);
455 sal_uInt16 nDrgLog
= sal_uInt16 ( mpWindow
->PixelToLogic(Size(mpView
->GetDragThresholdPixels(),0)).Width() );
456 mpView
->BegCreateObj(aMDPos
, nullptr, nDrgLog
);
461 if( !rMEvt
.IsShift() )
464 mpView
->BegMarkObj( aMDPos
);
469 else if ( rMEvt
.GetClicks() == 2 && !mpView
->IsTextEdit() )
471 MouseEvent
aMEvt( mpWindow
->GetPointerPosPixel() );
472 SetInEditMode( aMEvt
, false );
477 ForcePointer(&rMEvt
);
478 mpViewShell
->GetViewFrame()->GetBindings().Invalidate(SidArray
);
484 bool FuText::MouseMove(const MouseEvent
& rMEvt
)
486 bool bReturn
= FuDraw::MouseMove(rMEvt
);
488 if (aDragTimer
.IsActive() )
490 if( bFirstMouseMove
)
491 bFirstMouseMove
= false;
496 if (!bReturn
&& mpView
->IsAction() && !mpDocSh
->IsReadOnly())
498 Point
aPix(rMEvt
.GetPosPixel());
499 Point
aPnt(mpWindow
->PixelToLogic(aPix
));
502 mpView
->MovAction(aPnt
);
505 ForcePointer(&rMEvt
);
510 void FuText::ImpSetAttributesForNewTextObject(SdrTextObj
* pTxtObj
)
512 if( nSlotId
== SID_ATTR_CHAR
)
514 SfxItemSet
aSet(mpViewShell
->GetPool());
515 aSet
.Put(makeSdrTextAutoGrowWidthItem(false));
516 aSet
.Put(makeSdrTextAutoGrowHeightItem(true));
517 pTxtObj
->SetMergedItemSet(aSet
);
518 pTxtObj
->AdjustTextFrameWidthAndHeight();
519 const SfxViewShell
* pCurrentViewShell
= SfxViewShell::Current();
520 if (pCurrentViewShell
&& (pCurrentViewShell
->isLOKMobilePhone() || pCurrentViewShell
->isLOKTablet()))
521 pTxtObj
->SetText(SdResId(STR_PRESOBJ_TEXT_EDIT_MOBILE
));
523 else if( nSlotId
== SID_ATTR_CHAR_VERTICAL
)
525 // draw text object, needs to be initialized when vertical text is used
526 SfxItemSet
aSet(mpViewShell
->GetPool());
528 aSet
.Put(makeSdrTextAutoGrowWidthItem(true));
529 aSet
.Put(makeSdrTextAutoGrowHeightItem(false));
531 // Set defaults for vertical click-n'drag text object, pool defaults are:
532 // SdrTextVertAdjustItem: SDRTEXTVERTADJUST_TOP
533 // SdrTextHorzAdjustItem: SDRTEXTHORZADJUST_BLOCK
535 aSet
.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK
));
536 aSet
.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT
));
538 pTxtObj
->SetMergedItemSet(aSet
);
539 pTxtObj
->AdjustTextFrameWidthAndHeight();
543 void FuText::ImpSetAttributesFitToSize(SdrTextObj
* pTxtObj
)
545 // FitToSize (fit to frame)
546 SfxItemSetFixed
<SDRATTR_TEXT_AUTOGROWHEIGHT
, SDRATTR_TEXT_AUTOGROWWIDTH
> aSet(mpViewShell
->GetPool());
547 aSet
.Put(SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_PROPORTIONAL
));
548 aSet
.Put(makeSdrTextAutoGrowHeightItem(false));
549 aSet
.Put(makeSdrTextAutoGrowWidthItem(false));
550 pTxtObj
->SetMergedItemSet(aSet
);
551 pTxtObj
->AdjustTextFrameWidthAndHeight();
554 void FuText::ImpSetAttributesFitToSizeVertical(SdrTextObj
* pTxtObj
)
556 SfxItemSetFixed
<SDRATTR_TEXT_AUTOGROWHEIGHT
, SDRATTR_TEXT_AUTOGROWWIDTH
> aSet(mpViewShell
->GetPool());
557 aSet
.Put(SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_PROPORTIONAL
));
558 aSet
.Put(makeSdrTextAutoGrowHeightItem(false));
559 aSet
.Put(makeSdrTextAutoGrowWidthItem(false));
560 pTxtObj
->SetMergedItemSet(aSet
);
561 pTxtObj
->AdjustTextFrameWidthAndHeight();
564 bool FuText::MouseButtonUp(const MouseEvent
& rMEvt
)
566 bool bReturn
= false;
567 if (aDragTimer
.IsActive())
570 bIsInDragMode
= false;
573 mpViewShell
->GetViewFrame()->GetBindings().Invalidate( SidArray
);
575 Point
aPnt( mpWindow
->PixelToLogic( rMEvt
.GetPosPixel() ) );
577 if( (mpView
&& mpView
->MouseButtonUp(rMEvt
, mpWindow
->GetOutDev())) || rMEvt
.GetClicks() == 2 )
578 return true; // handle event from SdrView
580 bool bEmptyTextObj
= false;
582 if (mxTextObj
.get().is())
588 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
590 if (rMarkList
.GetMarkCount() == 1
591 && ( rMarkList
.GetMark(0)->GetMarkedSdrObj() == mxTextObj
.get().get()) )
593 if( mxTextObj
.get().is() && !GetTextObj()->GetOutlinerParaObject() )
594 bEmptyTextObj
= true;
596 bFirstObjCreated
= true;
607 if( mpView
&& mpView
->IsDragObj())
610 FrameView
* pFrameView
= mpViewShell
->GetFrameView();
611 bool bDragWithCopy
= (rMEvt
.IsMod1() && pFrameView
->IsDragWithCopy());
615 bDragWithCopy
= !mpView
->IsPresObjSelected(false);
618 mpView
->SetDragWithCopy(bDragWithCopy
);
619 mpView
->EndDragObj( mpView
->IsDragWithCopy() );
620 mpView
->ForceMarkedToAnotherPage();
621 mpView
->SetCurrentObj(SdrObjKind::Text
);
623 sal_uInt16 nDrgLog
= sal_uInt16 ( mpWindow
->PixelToLogic(Size(mpView
->GetDragThresholdPixels(),0)).Width() );
627 bJustEndedEdit
= false;
630 if ((rMEvt
.GetClicks() != 2) &&
631 !rMEvt
.IsShift() && !rMEvt
.IsMod1() && !rMEvt
.IsMod2() && !rMEvt
.IsRight() &&
632 std::abs(aPnt
.X() - aMDPos
.X()) < nDrgLog
&&
633 std::abs(aPnt
.Y() - aMDPos
.Y()) < nDrgLog
)
635 /*************************************************************
636 * From text mode, you don't want to rotate immediately.
637 **************************************************************/
639 SdrObject
* pObj
= mpView
->PickObj(aMDPos
, mpView
->getHitTolLog(), pPV
, SdrSearchOptions::ALSOONMASTER
| SdrSearchOptions::BEFOREMARK
);
640 if (pObj
&& pPV
->IsObjMarkable(pObj
))
642 mpView
->UnmarkAllObj();
643 mpView
->MarkObj(pObj
,pPV
);
648 else if( mpView
&& mpView
->IsCreateObj() && rMEvt
.IsLeft())
650 // object was created
651 rtl::Reference
<SdrTextObj
> pTextObj
= DynCastSdrTextObj( mpView
->GetCreateObj() );
652 mxTextObj
= pTextObj
.get();
656 //AW outliner needs to be set to vertical when there is no
657 // outliner object up to now; also it needs to be set back to not
658 // vertical when there was a vertical one used last time.
659 OutlinerParaObject
* pOPO
= GetTextObj()->GetOutlinerParaObject();
660 SdrOutliner
& rOutl(pTextObj
->getSdrModelFromSdrObject().GetDrawOutliner(GetTextObj()));
661 bool bVertical((pOPO
&& pOPO
->IsEffectivelyVertical())
662 || nSlotId
== SID_ATTR_CHAR_VERTICAL
663 || nSlotId
== SID_TEXT_FITTOSIZE_VERTICAL
);
664 rOutl
.SetVertical(bVertical
);
666 // Before ImpSetAttributesForNewTextObject the vertical writing mode
667 // needs to be set at the object. This is done here at the OutlinerParaObject
668 // directly to not mirror the layout text items involved. These items will be set
669 // from ImpSetAttributesForNewTextObject and below.
670 OutlinerParaObject
* pPara
= GetTextObj()->GetOutlinerParaObject();
674 GetTextObj()->ForceOutlinerParaObject();
675 pPara
= GetTextObj()->GetOutlinerParaObject();
678 if(pPara
&& bVertical
!= pPara
->IsEffectivelyVertical())
680 // set ParaObject orientation accordingly
681 pPara
->SetVertical(bVertical
);
684 ImpSetAttributesForNewTextObject(GetTextObj());
687 if (!mpView
->EndCreateObj(SdrCreateCmd::ForceEnd
))
689 // it was not possible to create text object
693 else if (nSlotId
== SID_TEXT_FITTOSIZE
)
695 ImpSetAttributesFitToSize(GetTextObj());
697 SetInEditMode(rMEvt
, false);
699 else if ( nSlotId
== SID_TEXT_FITTOSIZE_VERTICAL
)
701 ImpSetAttributesFitToSizeVertical(GetTextObj());
703 SetInEditMode(rMEvt
, false);
707 // thereby the handles and the gray frame are correct
708 mpView
->AdjustMarkHdl();
709 mpView
->PickHandle(aPnt
);
710 SetInEditMode(rMEvt
, false);
713 else if ( mpView
&& mpView
->IsAction())
718 ForcePointer(&rMEvt
);
719 mpWindow
->ReleaseMouse();
721 if ( mpView
&& !mpView
->AreObjectsMarked() )
723 sal_uInt16 nDrgLog1
= sal_uInt16 ( mpWindow
->PixelToLogic(Size(mpView
->GetDragThresholdPixels(),0)).Width() );
724 if ( std::abs(aMDPos
.X() - aPnt
.X()) < nDrgLog1
&&
725 std::abs(aMDPos
.Y() - aPnt
.Y()) < nDrgLog1
&&
726 !rMEvt
.IsShift() && !rMEvt
.IsMod2() )
728 SdrPageView
* pPV2
= mpView
->GetSdrPageView();
730 mpView
->PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
731 mpView
->MarkObj(aVEvt
.mpRootObj
, pPV2
);
735 if ( !mxTextObj
.get().is() && mpView
)
737 if ( ( (!bEmptyTextObj
&& bPermanent
) ||
738 (!bFirstObjCreated
&& !bPermanent
) ) &&
739 !mpDocSh
->IsReadOnly() &&
740 nSlotId
!= SID_TEXTEDIT
)
742 // text body (left-justified AutoGrow)
743 mpView
->SetCurrentObj(SdrObjKind::Text
);
744 mpView
->SetEditMode(SdrViewEditMode::Create
);
745 sal_uInt16 nDrgLog
= sal_uInt16 ( mpWindow
->PixelToLogic(Size(mpView
->GetDragThresholdPixels(),0)).Width() );
746 mpView
->BegCreateObj(aMDPos
, nullptr, nDrgLog
);
748 bool bSnapEnabled
= mpView
->IsSnapEnabled();
751 mpView
->SetSnapEnabled(false);
753 aPnt
.AdjustX(nDrgLog
+ nDrgLog
);
754 aPnt
.AdjustY(nDrgLog
+ nDrgLog
);
755 mpView
->MovAction(aPnt
);
757 mxTextObj
= DynCastSdrTextObj( mpView
->GetCreateObj() );
759 if(mxTextObj
.get().is())
761 GetTextObj()->SetDisableAutoWidthOnDragging(true);
764 if(!mpView
->EndCreateObj(SdrCreateCmd::ForceEnd
))
770 mpView
->SetSnapEnabled(bSnapEnabled
);
772 if(mxTextObj
.get().is())
774 SfxItemSet
aSet(mpViewShell
->GetPool());
775 aSet
.Put(makeSdrTextMinFrameHeightItem(0));
776 aSet
.Put(makeSdrTextMinFrameWidthItem(0));
777 aSet
.Put(makeSdrTextAutoGrowHeightItem(true));
778 aSet
.Put(makeSdrTextAutoGrowWidthItem(true));
780 if(nSlotId
== SID_ATTR_CHAR_VERTICAL
)
782 // Here, all items which need to be different from pool default need to be set
783 // again on the newly created text object.
784 // Since this is a simple click text object, it is first created, then SetVertical()
785 // is used, then ImpSetAttributesForNewTextObject is called and then the object is
786 // deleted again since not the minimum drag distance was travelled. Then, a new
787 // click text object is created and thus all that stuff needs to be set again here.
789 // Before using the new object the vertical writing mode
790 // needs to be set. This is done here at the OutlinerParaObject
791 // directly to not mirror the layout text items involved. These items will be set
793 OutlinerParaObject
* pPara
= GetTextObj()->GetOutlinerParaObject();
797 GetTextObj()->ForceOutlinerParaObject();
798 pPara
= GetTextObj()->GetOutlinerParaObject();
801 if(pPara
&& !pPara
->IsEffectivelyVertical())
803 // set ParaObject orientation accordingly
804 pPara
->SetVertical(true);
807 aSet
.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT
));
809 // Analog to the else case below, for vertical simple click texts
810 // one of the default set items from ImpSetAttributesForNewTextObject
811 // needs to be adapted to non-block mode.
812 const SfxItemSet
& rSet
= mpView
->GetDefaultAttr();
813 SvxFrameDirection eDirection
= rSet
.Get(EE_PARA_WRITINGDIR
).GetValue();
815 if(SvxFrameDirection::Horizontal_RL_TB
== eDirection
|| SvxFrameDirection::Vertical_RL_TB
== eDirection
)
817 aSet
.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM
));
821 aSet
.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP
));
826 // This is for Format/Page settings. Since this also leads
827 // to the object defaults to be changed, i think this code can be
828 // removed. CL. wanted to take a look before adding this.
830 // Look in the object defaults if left-to-right is wanted. If
831 // yes, set text anchoring to right to let the box grow to left.
832 const SfxItemSet
& rSet
= mpView
->GetDefaultAttr();
833 SvxFrameDirection eDirection
= rSet
.Get(EE_PARA_WRITINGDIR
).GetValue();
835 if(SvxFrameDirection::Horizontal_RL_TB
== eDirection
)
837 aSet
.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT
));
841 aSet
.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT
));
845 GetTextObj()->SetMergedItemSet(aSet
);
846 GetTextObj()->SetDisableAutoWidthOnDragging(true);
847 SetInEditMode(rMEvt
, false);
850 bFirstObjCreated
= true;
854 // switch to selection
855 if (mpView
->SdrEndTextEdit() == SdrEndTextEditKind::Deleted
)
860 mpViewShell
->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT
,
861 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
866 bJustEndedEdit
= false;
870 FuConstruct::MouseButtonUp(rMEvt
);
875 * handle keyboard events
876 * @returns sal_True if the event was handled, sal_False otherwise
878 bool FuText::KeyInput(const KeyEvent
& rKEvt
)
880 bool bReturn
= false;
882 vcl::KeyCode nCode
= rKEvt
.GetKeyCode();
883 bool bShift
= nCode
.IsShift();
885 if(mxTextObj
.get().is())
887 // maybe object is deleted, test if it's equal to the selected object
888 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
889 SdrObject
* pSelectedObj
= nullptr;
891 if(1 == rMarkList
.GetMarkCount())
893 SdrMark
* pMark
= rMarkList
.GetMark(0);
894 pSelectedObj
= pMark
->GetMarkedSdrObj();
897 if(mxTextObj
.get().get() != pSelectedObj
)
903 if (auto pTextObj
= mxTextObj
.get())
904 if ( pTextObj
->GetObjInventor() == SdrInventor::Default
&& pTextObj
->GetObjIdentifier() == SdrObjKind::TitleText
&& rKEvt
.GetKeyCode().GetCode() == KEY_RETURN
)
906 // title text object: always soft breaks
910 sal_uInt16 nKey
= nCode
.GetCode();
911 vcl::KeyCode
aKeyCode (nKey
, bShift
, nCode
.IsMod1(), nCode
.IsMod2(), nCode
.IsMod3() );
912 KeyEvent
aKEvt(rKEvt
.GetCharCode(), aKeyCode
);
916 if (mpDocSh
->IsReadOnly())
918 bOK
= !EditEngine::DoesKeyChangeText(aKEvt
);
920 if( aKeyCode
.GetCode() == KEY_PAGEUP
|| aKeyCode
.GetCode() == KEY_PAGEDOWN
)
922 bOK
= false; // default handling in base class
925 if (bOK
&& mpView
->KeyInput(aKEvt
, mpWindow
) )
929 mpViewShell
->GetViewFrame()->GetBindings().Invalidate( SidArray
);
932 else if (aKeyCode
== KEY_ESCAPE
)
939 mpView
->SetCurrentObj(SdrObjKind::Text
);
940 mpView
->SetEditMode(SdrViewEditMode::Create
);
945 bReturn
= FuDraw::KeyInput(aKEvt
);
951 void FuText::Activate()
953 mpView
->SetQuickTextEditMode(mpViewShell
->GetFrameView()->IsQuickEdit());
955 // #i89661# it's no longer necessary to make it so big here, it's fine tuned
956 // for text objects in SdrMarkView::CheckSingleSdrObjectHit
957 mpView
->SetHitTolerancePixel( 2 * HITPIX
);
959 OutlinerView
* pOLV
= mpView
->GetTextEditOutlinerView();
962 pOLV
->ShowCursor(/*bGotoCursor=*/true, /*bActivate=*/true);
964 FuConstruct::Activate();
967 mpView
->SetEditMode(SdrViewEditMode::Edit
);
970 void FuText::Deactivate()
972 OutlinerView
* pOLV
= mpView
->GetTextEditOutlinerView();
975 pOLV
->HideCursor(/*bDeactivate=*/true);
977 mpView
->SetHitTolerancePixel( HITPIX
);
979 FuConstruct::Deactivate();
983 * Sets the object into the edit mode.
985 void FuText::SetInEditMode(const MouseEvent
& rMEvt
, bool bQuickDrag
)
987 SdrPageView
* pPV
= mpView
->GetSdrPageView();
988 if( mxTextObj
.get().is() && (mxTextObj
.get()->getSdrPageFromSdrObject() == pPV
->GetPage()) )
990 mpView
->SetCurrentObj(SdrObjKind::Text
);
993 mpView
->SetEditMode(SdrViewEditMode::Create
);
995 mpView
->SetEditMode(SdrViewEditMode::Edit
);
997 bool bEmptyOutliner
= false;
999 if (!GetTextObj()->GetOutlinerParaObject() && mpView
->GetTextEditOutliner())
1001 ::Outliner
* pOutl
= mpView
->GetTextEditOutliner();
1002 sal_Int32 nParagraphCnt
= pOutl
->GetParagraphCount();
1003 Paragraph
* p1stPara
= pOutl
->GetParagraph( 0 );
1005 if (nParagraphCnt
==1 && p1stPara
)
1007 // with only one paragraph
1008 if (pOutl
->GetText(p1stPara
).isEmpty())
1010 bEmptyOutliner
= true;
1015 if (GetTextObj() != mpView
->GetTextEditObject() || bEmptyOutliner
)
1017 rtl::Reference
<SdrTextObj
> pTextObj
= mxTextObj
.get();
1018 SdrInventor nInv
= pTextObj
->GetObjInventor();
1019 SdrObjKind nSdrObjKind
= pTextObj
->GetObjIdentifier();
1021 if (nInv
== SdrInventor::Default
&& GetTextObj()->HasTextEdit() &&
1022 (nSdrObjKind
== SdrObjKind::Text
||
1023 nSdrObjKind
== SdrObjKind::TitleText
||
1024 nSdrObjKind
== SdrObjKind::OutlineText
|| !pTextObj
->IsEmptyPresObj() ) )
1026 // create new outliner (owned by SdrObjEditView)
1027 std::unique_ptr
<SdrOutliner
> pOutl
= SdrMakeOutliner(OutlinerMode::OutlineObject
, *mpDoc
);
1030 mpView
->SdrEndTextEdit(true);
1032 pTextObj
= GetTextObj();
1035 OutlinerParaObject
* pOPO
= pTextObj
->GetOutlinerParaObject();
1036 if( pOPO
&& pOPO
->IsEffectivelyVertical() )
1038 pOutl
->SetVertical(pOPO
->GetVertical());
1039 pOutl
->SetRotation(pOPO
->GetRotation());
1041 else if (nSlotId
== SID_ATTR_CHAR_VERTICAL
|| nSlotId
== SID_TEXT_FITTOSIZE_VERTICAL
)
1042 pOutl
->SetVertical( true );
1044 if( pTextObj
->getTextCount() > 1 )
1046 Point
aPix(rMEvt
.GetPosPixel());
1047 Point
aPnt(mpWindow
->PixelToLogic(aPix
));
1048 pTextObj
->setActiveText( pTextObj
->CheckTextHit(aPnt
) );
1051 if (mpView
->SdrBeginTextEdit(pTextObj
.get(), pPV
, mpWindow
, true, pOutl
.release()) && mxTextObj
.get()->GetObjInventor() == SdrInventor::Default
)
1053 //tdf#102293 flush overlay before going on to pass clicks down to
1054 //the outline view which will want to paint selections
1055 for (sal_uInt32 b
= 0; b
< pPV
->PageWindowCount(); ++b
)
1057 const SdrPageWindow
& rPageWindow
= *pPV
->GetPageWindow(b
);
1058 if (!rPageWindow
.GetPaintWindow().OutputToWindow())
1060 const rtl::Reference
< sdr::overlay::OverlayManager
>& xManager
= rPageWindow
.GetOverlayManager();
1066 bFirstObjCreated
= true;
1067 DeleteDefaultText();
1069 OutlinerView
* pOLV
= mpView
->GetTextEditOutlinerView();
1071 nSdrObjKind
= mxTextObj
.get()->GetObjIdentifier();
1074 SdrHitKind eHit
= mpView
->PickAnything(rMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
1076 if (eHit
== SdrHitKind::TextEdit
)
1079 if (nSdrObjKind
== SdrObjKind::Text
||
1080 nSdrObjKind
== SdrObjKind::TitleText
||
1081 nSdrObjKind
== SdrObjKind::OutlineText
||
1082 nSdrObjKind
== SdrObjKind::Table
||
1083 nSlotId
== SID_TEXTEDIT
||
1086 pOLV
->MouseButtonDown(rMEvt
);
1087 pOLV
->MouseMove(rMEvt
);
1088 pOLV
->MouseButtonUp(rMEvt
);
1091 if (mpViewShell
->GetFrameView()->IsQuickEdit() && bQuickDrag
&& GetTextObj()->GetOutlinerParaObject())
1093 pOLV
->MouseButtonDown(rMEvt
);
1098 // Move cursor to end of text
1099 ESelection
aNewSelection(EE_PARA_NOT_FOUND
, EE_INDEX_NOT_FOUND
, EE_PARA_NOT_FOUND
, EE_INDEX_NOT_FOUND
);
1100 if (pOLV
!= nullptr)
1101 pOLV
->SetSelection(aNewSelection
);
1106 mpView
->RestoreDefaultText( mxTextObj
.get().get() );
1114 mxTextObj
= nullptr;
1119 * Text entry is started, if necessary delete the default text.
1121 void FuText::DeleteDefaultText()
1123 if ( !(mxTextObj
.get().is() && mxTextObj
.get()->IsEmptyPresObj()) )
1126 SdPage
* pPage
= static_cast<SdPage
*>( mxTextObj
.get()->getSdrPageFromSdrObject() );
1131 PresObjKind ePresObjKind
= pPage
->GetPresObjKind(mxTextObj
.get().get());
1133 if ( !(ePresObjKind
== PresObjKind::Title
||
1134 ePresObjKind
== PresObjKind::Outline
||
1135 ePresObjKind
== PresObjKind::Notes
||
1136 ePresObjKind
== PresObjKind::Text
) ||
1137 pPage
->IsMasterPage() )
1140 ::Outliner
* pOutliner
= mpView
->GetTextEditOutliner();
1141 SfxStyleSheet
* pSheet
= pOutliner
->GetStyleSheet( 0 );
1142 bool bIsUndoEnabled
= pOutliner
->IsUndoEnabled();
1143 if( bIsUndoEnabled
)
1144 pOutliner
->EnableUndo(false);
1146 pOutliner
->SetText( OUString(), pOutliner
->GetParagraph( 0 ) );
1148 if( bIsUndoEnabled
)
1149 pOutliner
->EnableUndo(true);
1152 (ePresObjKind
== PresObjKind::Notes
|| ePresObjKind
== PresObjKind::Text
))
1153 pOutliner
->SetStyleSheet(0, pSheet
);
1155 mxTextObj
.get()->SetEmptyPresObj(true);
1158 bool FuText::RequestHelp(const HelpEvent
& rHEvt
)
1160 bool bReturn
= false;
1162 OutlinerView
* pOLV
= mpView
->GetTextEditOutlinerView();
1164 if ((Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled()) &&
1165 mxTextObj
.get().is() && pOLV
&& pOLV
->GetFieldUnderMousePointer())
1168 const SvxFieldItem
* pFieldItem
= pOLV
->GetFieldUnderMousePointer();
1169 const SvxFieldData
* pField
= pFieldItem
->GetField();
1171 if (auto pURLField
= dynamic_cast< const SvxURLField
*>( pField
))
1174 aHelpText
= INetURLObject::decode( pURLField
->GetURL(), INetURLObject::DecodeMechanism::WithCharset
);
1176 if (!aHelpText
.isEmpty())
1178 ::tools::Rectangle aLogicPix
= mpWindow
->LogicToPixel(mxTextObj
.get()->GetLogicRect());
1179 ::tools::Rectangle
aScreenRect(mpWindow
->OutputToScreenPixel(aLogicPix
.TopLeft()),
1180 mpWindow
->OutputToScreenPixel(aLogicPix
.BottomRight()));
1182 if (Help::IsBalloonHelpEnabled())
1184 Help::ShowBalloon( static_cast<vcl::Window
*>(mpWindow
), rHEvt
.GetMousePosPixel(), aScreenRect
, aHelpText
);
1187 else if (Help::IsQuickHelpEnabled())
1189 Help::ShowQuickHelp( static_cast<vcl::Window
*>(mpWindow
), aScreenRect
, aHelpText
);
1197 bReturn
= FuConstruct::RequestHelp(rHEvt
);
1203 void FuText::ReceiveRequest(SfxRequest
& rReq
)
1205 nSlotId
= rReq
.GetSlot();
1207 // then we call the base class (besides others, nSlotId is NOT set there)
1208 FuPoor::ReceiveRequest(rReq
);
1210 if (!(nSlotId
== SID_TEXTEDIT
|| mpViewShell
->GetFrameView()->IsQuickEdit() || SID_ATTR_CHAR
== nSlotId
))
1213 MouseEvent
aMEvt(mpWindow
->GetPointerPosPixel());
1215 mxTextObj
= nullptr;
1217 if (nSlotId
== SID_TEXTEDIT
)
1219 // are we currently editing?
1220 mxTextObj
= mpView
->GetTextEditObject();
1222 if (!mxTextObj
.get().is())
1224 // Try to select an object
1225 SdrPageView
* pPV
= mpView
->GetSdrPageView();
1227 mpView
->PickAnything(aMEvt
, SdrMouseEventKind::BUTTONDOWN
, aVEvt
);
1228 mpView
->MarkObj(aVEvt
.mpRootObj
, pPV
);
1230 if (auto pSdrTextObj
= DynCastSdrTextObj(aVEvt
.mpObj
))
1232 mxTextObj
= pSdrTextObj
;
1236 else if (mpView
->AreObjectsMarked())
1238 const SdrMarkList
& rMarkList
= mpView
->GetMarkedObjectList();
1240 if (rMarkList
.GetMarkCount() == 1)
1242 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
1244 if( auto pTextObj
= DynCastSdrTextObj( pObj
))
1246 mxTextObj
= pTextObj
;
1251 bool bQuickDrag
= true;
1253 const SfxItemSet
* pArgs
= rReq
.GetArgs();
1257 // test for type before using
1258 && SID_TEXTEDIT
== nSlotId
1259 && SfxItemState::SET
== pArgs
->GetItemState(SID_TEXTEDIT
)
1261 && pArgs
->Get(SID_TEXTEDIT
).GetValue() == 2)
1263 // selection with double click -> do not allow QuickDrag
1267 SetInEditMode(aMEvt
, bQuickDrag
);
1270 void FuText::DoubleClick(const MouseEvent
& )
1275 /** Removed the insertion of default text and putting a new text
1276 object directly into edit mode.
1278 rtl::Reference
<SdrObject
> FuText::CreateDefaultObject(const sal_uInt16 nID
, const ::tools::Rectangle
& rRectangle
)
1280 rtl::Reference
<SdrObject
> pObj( SdrObjFactory::MakeNewObject(
1281 mpView
->getSdrModelFromSdrView(),
1282 mpView
->GetCurrentObjInventor(),
1283 mpView
->GetCurrentObjIdentifier(),
1288 if( auto pText
= DynCastSdrTextObj( pObj
.get() ) )
1290 pText
->SetLogicRect(rRectangle
);
1292 bool bVertical
= (SID_ATTR_CHAR_VERTICAL
== nID
|| SID_TEXT_FITTOSIZE_VERTICAL
== nID
);
1293 pText
->SetVerticalWriting(bVertical
);
1295 ImpSetAttributesForNewTextObject(pText
);
1297 if (nSlotId
== SID_TEXT_FITTOSIZE
)
1299 ImpSetAttributesFitToSize(pText
);
1301 else if ( nSlotId
== SID_TEXT_FITTOSIZE_VERTICAL
)
1303 ImpSetAttributesFitToSizeVertical(pText
);
1306 // Put text object into edit mode.
1307 SdrPageView
* pPV
= mpView
->GetSdrPageView();
1308 mpView
->SdrBeginTextEdit(pText
, pPV
);
1312 OSL_FAIL("Object is NO text object");
1319 /** is called when the current function should be aborted. <p>
1320 This is used when a function gets a KEY_ESCAPE but can also
1323 @returns true if an active function was aborted
1325 bool FuText::cancel()
1327 if ( mpView
->IsTextEdit() )
1329 if(mpView
->SdrEndTextEdit() == SdrEndTextEditKind::Deleted
)
1330 mxTextObj
= nullptr;
1332 mpView
->SetCurrentObj(SdrObjKind::Text
);
1333 mpView
->SetEditMode(SdrViewEditMode::Edit
);
1342 void FuText::ChangeFontSize( bool bGrow
, OutlinerView
* pOLV
, const FontList
* pFontList
, ::sd::View
* pView
)
1344 if( !pFontList
|| !pView
)
1349 pOLV
->GetEditView().ChangeFontSize( bGrow
, pFontList
);
1354 pView
->BegUndo(SdResId(bGrow
? STR_GROW_FONT_SIZE
: STR_SHRINK_FONT_SIZE
));
1355 const SdrMarkList
& rMarkList
= pView
->GetMarkedObjectList();
1356 for( size_t nMark
= 0; nMark
< rMarkList
.GetMarkCount(); ++nMark
)
1358 SdrTextObj
* pTextObj
= DynCastSdrTextObj( rMarkList
.GetMark(nMark
)->GetMarkedSdrObj() );
1361 rtl::Reference
<sdr::SelectionController
> xSelectionController(pView
->getSelectionController());
1362 if (xSelectionController
.is() && xSelectionController
->ChangeFontSize(bGrow
, pFontList
))
1366 for( sal_Int32 nText
= 0; nText
< pTextObj
->getTextCount(); nText
++ )
1368 pTextObj
->setActiveText( nText
);
1370 // Put text object into edit mode.
1371 SdrPageView
* pPV
= pView
->GetSdrPageView();
1372 pView
->SdrBeginTextEdit(pTextObj
, pPV
);
1374 pOLV
= pView
->GetTextEditOutlinerView();
1377 EditEngine
* pEditEngine
= pOLV
->GetEditView().GetEditEngine();
1381 aSel
.nEndPara
= pEditEngine
->GetParagraphCount()-1;
1382 aSel
.nEndPos
= pEditEngine
->GetTextLen(aSel
.nEndPara
);
1383 pOLV
->SetSelection(aSel
);
1386 ChangeFontSize( bGrow
, pOLV
, pFontList
, pView
);
1389 pView
->SdrEndTextEdit();
1392 SfxItemSet
aShapeSet( pTextObj
->GetMergedItemSet() );
1393 if( EditView::ChangeFontSize( bGrow
, aShapeSet
, pFontList
) )
1395 pTextObj
->SetObjectItemNoBroadcast( aShapeSet
.Get( EE_CHAR_FONTHEIGHT
) );
1396 pTextObj
->SetObjectItemNoBroadcast( aShapeSet
.Get( EE_CHAR_FONTHEIGHT_CJK
) );
1397 pTextObj
->SetObjectItemNoBroadcast( aShapeSet
.Get( EE_CHAR_FONTHEIGHT_CTL
) );
1405 void FuText::InvalidateBindings()
1407 mpViewShell
->GetViewFrame()->GetBindings().Invalidate(SidArray
);
1411 } // end of namespace sd
1413 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */