Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / ui / drawfunc / futext.cxx
blob5405ca2c608a7b8b58a90d730a34ee2198d99e8a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <svx/svddef.hxx>
21 #include <svx/svdoutl.hxx>
22 #include <editeng/outlobj.hxx>
23 #include <svx/sdtaaitm.hxx>
24 #include <svx/sdtacitm.hxx>
25 #include <svx/svdotext.hxx>
26 #include <svx/sdtagitm.hxx>
27 #include <editeng/unolingu.hxx>
28 #include <sfx2/bindings.hxx>
29 #include <sfx2/dispatch.hxx>
30 #include <sfx2/viewfrm.hxx>
31 #include <svx/svxids.hrc>
32 #include <editeng/eeitem.hxx>
33 #include <svl/itemset.hxx>
35 #include <futext.hxx>
36 #include <drwlayer.hxx>
37 #include <sc.hrc>
38 #include <tabvwsh.hxx>
39 #include <drawview.hxx>
41 // maximum of mouse movement which allows to start Drag&Drop
42 //! fusel,fuconstr,futext - combined!
43 #define SC_MAXDRAGMOVE 3
45 static void lcl_InvalidateAttribs( SfxBindings& rBindings )
47 rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT );
48 rBindings.Invalidate( SID_ATTR_CHAR_POSTURE );
49 rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
50 rBindings.Invalidate( SID_ULINE_VAL_NONE );
51 rBindings.Invalidate( SID_ULINE_VAL_SINGLE );
52 rBindings.Invalidate( SID_ULINE_VAL_DOUBLE );
53 rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
54 rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
55 rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
56 rBindings.Invalidate( SID_ATTR_CHAR_BACK_COLOR );
57 rBindings.Invalidate( SID_ATTR_CHAR_FONT );
58 rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
59 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );
60 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
61 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
62 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
63 rBindings.Invalidate( SID_ALIGNLEFT );
64 rBindings.Invalidate( SID_ALIGNCENTERHOR );
65 rBindings.Invalidate( SID_ALIGNRIGHT );
66 rBindings.Invalidate( SID_ALIGNBLOCK );
67 rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_10 );
68 rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_15 );
69 rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_20 );
70 rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
71 rBindings.Invalidate( SID_SET_SUB_SCRIPT );
72 rBindings.Invalidate( SID_HYPERLINK_GETLINK );
73 rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
74 rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
75 rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
76 rBindings.Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
77 rBindings.Invalidate( SID_TABLE_VERT_NONE );
78 rBindings.Invalidate( SID_TABLE_VERT_CENTER );
79 rBindings.Invalidate( SID_TABLE_VERT_BOTTOM );
80 // pseudo slots for Format menu
81 rBindings.Invalidate( SID_ALIGN_ANY_LEFT );
82 rBindings.Invalidate( SID_ALIGN_ANY_HCENTER );
83 rBindings.Invalidate( SID_ALIGN_ANY_RIGHT );
84 rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED );
85 rBindings.Invalidate( SID_ATTR_CHAR_KERNING );
86 rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
87 rBindings.Invalidate( SID_SET_SUB_SCRIPT );
88 rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
89 rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED );
92 static void lcl_UpdateHyphenator( Outliner& rOutliner, const SdrObject* pObj )
94 // use hyphenator only if hyphenation attribute is set
95 if ( pObj && pObj->GetMergedItem(EE_PARA_HYPHENATE).GetValue() ) {
96 css::uno::Reference<css::linguistic2::XHyphenator> xHyphenator( LinguMgr::GetHyphenator() );
97 rOutliner.SetHyphenator( xHyphenator );
101 FuText::FuText(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pViewP,
102 SdrModel* pDoc, const SfxRequest& rReq)
103 : FuConstruct(rViewSh, pWin, pViewP, pDoc, rReq)
107 FuText::~FuText()
109 // StopEditMode(); // in Deactivate !
112 bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
114 // remember button state for creation of own MouseEvents
115 SetMouseButtonCode(rMEvt.GetButtons());
116 bool bStraightEnter = true;
118 if ( pView->MouseButtonDown(rMEvt, pWindow) )
119 return true; // event handled from SdrView
121 if ( pView->IsTextEdit() )
123 if ( IsEditingANote() )
125 if( !IsSizingOrMovingNote(rMEvt) )
127 StopEditMode(); // Clicked outside, ending edit
128 bStraightEnter = false;
131 else
133 StopEditMode(); // Clicked outside, ending edit
134 pView->UnmarkAll();
135 bStraightEnter = false;
137 pView->SetCreateMode();
140 aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
142 if ( rMEvt.IsLeft() )
144 SdrHdl* pHdl = pView->PickHandle(aMDPos);
145 const size_t nHdlNum = pView->GetHdlNum(pHdl);
146 if (pHdl != nullptr)
148 if (pView->HasMarkablePoints() && pView->IsPointMarkable(*pHdl))
150 bool bPointMarked=pView->IsPointMarked(*pHdl);
152 if ( rMEvt.IsShift() )
154 if (!bPointMarked)
156 pView->MarkPoint(*pHdl);
158 else
160 pView->UnmarkPoint(*pHdl);
163 else
165 if (!bPointMarked)
167 pView->UnmarkAllPoints();
168 pView->MarkPoint(*pHdl);
171 pHdl=pView->GetHdl(nHdlNum);
175 SdrPageView* pPV = nullptr;
177 if ( pHdl != nullptr || pView->IsMarkedHit(aMDPos) )
179 SdrObject* pObj = (pHdl == nullptr) ?
180 pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::PICKTEXTEDIT) :
181 nullptr;
182 if (pObj)
184 std::unique_ptr<SdrOutliner> pO = MakeOutliner();
185 lcl_UpdateHyphenator( *pO, pObj );
187 // vertical flag:
188 // deduced from slot ids only if text object has no content
189 sal_uInt16 nSlotID = aSfxRequest.GetSlot();
190 bool bVertical = ( nSlotID == SID_DRAW_TEXT_VERTICAL );
191 OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
192 if ( pOPO )
193 bVertical = pOPO->IsVertical(); // content wins
194 pO->SetVertical( bVertical );
196 //!?? the default values are not correct when result is without outliner ???!?
197 auto pOTemp = pO.get();
198 if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, true, pO.release()) )
200 // subscribe EditEngine-UndoManager
201 rViewShell.SetDrawTextUndo( &pOTemp->GetUndoManager() );
203 OutlinerView* pOLV = pView->GetTextEditOutlinerView();
204 if ( pOLV->MouseButtonDown(rMEvt) )
205 return true; // Event to the Outliner
208 else
210 // disable tail & circular move for caption objects.
211 bool bDrag = false;
212 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
213 if( rMarkList.GetMarkCount() == 1 )
215 SdrObject* pMarkedObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
216 if( ScDrawLayer::IsNoteCaption( pMarkedObj ) )
218 if(pHdl->GetKind() != SdrHdlKind::Poly && pHdl->GetKind() != SdrHdlKind::Circle)
219 bDrag = true;
221 else
222 bDrag = true; // different object
224 else
225 bDrag = true; // several objects
227 if ( bDrag )
229 aDragTimer.Start();
230 pView->BegDragObj(aMDPos, nullptr, pHdl);
234 else
236 if (pView->IsEditMode())
238 bool bPointMode=pView->HasMarkablePoints();
240 if (!rMEvt.IsShift())
242 if (bPointMode)
244 pView->UnmarkAllPoints();
246 else
248 pView->UnmarkAll();
251 pView->SetDragMode(SdrDragMode::Move);
252 SfxBindings& rBindings = rViewShell.GetViewFrame()->GetBindings();
253 rBindings.Invalidate( SID_OBJECT_ROTATE );
254 rBindings.Invalidate( SID_OBJECT_MIRROR );
257 if ( pView->MarkObj(aMDPos, -2, false, rMEvt.IsMod1()) )
259 aDragTimer.Start();
261 pHdl=pView->PickHandle(aMDPos);
263 if (pHdl!=nullptr)
265 pView->MarkPoint(*pHdl);
266 pHdl=pView->GetHdl(nHdlNum);
269 pView->BegDragObj(aMDPos, nullptr, pHdl);
271 else
273 if (bPointMode)
275 pView->BegMarkPoints(aMDPos);
277 else
279 pView->BegMarkObj(aMDPos);
283 else if (aSfxRequest.GetSlot() == SID_DRAW_NOTEEDIT )
285 // Edit notes -> create no new text objects
286 // and leave text mode
287 rViewShell.GetViewData().GetDispatcher().
288 Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
290 else
292 if (bStraightEnter)//Hack for that silly idea that creating text fields is inside the text routine
294 // create object
295 pView->BegCreateObj(aMDPos);
297 else if (SdrObject* pObj = pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK))
299 pView->UnmarkAllObj();
300 ScViewData& rViewData = rViewShell.GetViewData();
301 rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
302 pView->MarkObj(pObj,pPV);
304 pHdl=pView->PickHandle(aMDPos);
305 pView->BegDragObj(aMDPos, nullptr, pHdl);
306 return true;
312 if (!bIsInDragMode)
314 pWindow->CaptureMouse();
315 // ForcePointer(&rMEvt);
316 lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() );
319 rViewShell.SetActivePointer(pView->GetPreferredPointer(
320 pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow ));
321 if (!bStraightEnter)
323 pView->UnmarkAll();
324 ScViewData& rViewData = rViewShell.GetViewData();
325 rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
328 return true;
331 bool FuText::MouseMove(const MouseEvent& rMEvt)
333 rViewShell.SetActivePointer(pView->GetPreferredPointer(
334 pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow ));
336 if (aDragTimer.IsActive() )
338 Point aOldPixel = pWindow->LogicToPixel( aMDPos );
339 Point aNewPixel = rMEvt.GetPosPixel();
340 if ( std::abs( aOldPixel.X() - aNewPixel.X() ) > SC_MAXDRAGMOVE ||
341 std::abs( aOldPixel.Y() - aNewPixel.Y() ) > SC_MAXDRAGMOVE )
342 aDragTimer.Stop();
345 Point aPix(rMEvt.GetPosPixel());
346 Point aPnt(pWindow->PixelToLogic(aPix));
348 if ( pView->MouseMove(rMEvt, pWindow) )
349 return true; // event handled from SdrView
351 if ( pView->IsAction() )
353 ForceScroll(aPix);
354 pView->MovAction(aPnt);
357 return false;
360 bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
362 // remember button state for creation of own MouseEvents
363 SetMouseButtonCode(rMEvt.GetButtons());
365 if (aDragTimer.IsActive() )
367 aDragTimer.Stop();
370 lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() );
372 Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
374 if ( pView->MouseButtonUp(rMEvt, pWindow) )
375 return true; // Event evaluated by SdrView
377 if ( pView->IsDragObj() )
379 pView->EndDragObj( rMEvt.IsShift() );
380 pView->ForceMarkedToAnotherPage();
382 else if ( pView->IsCreateObj() )
384 if (rMEvt.IsLeft())
386 pView->EndCreateObj(SdrCreateCmd::ForceEnd);
387 if (aSfxRequest.GetSlot() == SID_DRAW_TEXT_MARQUEE)
389 // create marquee-object?
390 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
391 if (rMarkList.GetMark(0))
393 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
395 // set needed attributes for scrolling
396 SfxItemSet aItemSet( pDrDoc->GetItemPool(),
397 svl::Items<SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST>{});
399 aItemSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
400 aItemSet.Put( makeSdrTextAutoGrowHeightItem( false ) );
401 aItemSet.Put( SdrTextAniKindItem( SdrTextAniKind::Slide ) );
402 aItemSet.Put( SdrTextAniDirectionItem( SdrTextAniDirection::Left ) );
403 aItemSet.Put( SdrTextAniCountItem( 1 ) );
404 aItemSet.Put( SdrTextAniAmountItem(
405 static_cast<sal_Int16>(pWindow->PixelToLogic(Size(2,1)).Width())) );
406 pObj->SetMergedItemSetAndBroadcast(aItemSet);
410 // init object different when vertical writing
411 sal_uInt16 nSlotID(aSfxRequest.GetSlot());
412 bool bVertical = (SID_DRAW_TEXT_VERTICAL == nSlotID);
413 if(bVertical)
415 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
416 if(rMarkList.GetMark(0))
418 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
419 if(auto pText = dynamic_cast<SdrTextObj*>( pObj))
421 SfxItemSet aSet(pDrDoc->GetItemPool());
423 pText->SetVerticalWriting(true);
425 aSet.Put(makeSdrTextAutoGrowWidthItem(true));
426 aSet.Put(makeSdrTextAutoGrowHeightItem(false));
427 aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
428 aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
430 pText->SetMergedItemSet(aSet);
435 SetInEditMode();
437 // leave mode when sole click (-> fuconstr)
438 if ( !pView->AreObjectsMarked() )
440 pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
442 SfxDispatcher& rDisp = rViewShell.GetViewData().GetDispatcher();
443 if ( pView->AreObjectsMarked() )
444 rDisp.Execute(SID_OBJECT_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD);
445 else
446 rDisp.Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
450 else if ( pView->IsAction() )
452 pView->EndAction();
454 else if( !pView->IsAction() )
456 pWindow->ReleaseMouse();
458 if ( !pView->AreObjectsMarked() && rMEvt.GetClicks() < 2 )
460 pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
462 SfxDispatcher& rDisp = rViewShell.GetViewData().GetDispatcher();
463 if ( pView->AreObjectsMarked() )
464 rDisp.Execute(SID_OBJECT_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD);
465 else
466 rDisp.Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
470 return false;
473 // switch mouse-pointer
474 void FuText::ForcePointer(const MouseEvent* /* pMEvt */)
476 rViewShell.SetActivePointer( aNewPointer );
479 // modify keyboard events
480 // if a KeyEvent is being processed, then the return value is sal_True, else FALSE.
481 bool FuText::KeyInput(const KeyEvent& rKEvt)
483 bool bReturn = false;
485 if ( pView->KeyInput(rKEvt, pWindow) )
487 bReturn = true;
488 lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() );
490 else
492 bReturn = FuDraw::KeyInput(rKEvt);
495 return bReturn;
498 void FuText::Activate()
500 pView->SetDragMode(SdrDragMode::Move);
501 SfxBindings& rBindings = rViewShell.GetViewFrame()->GetBindings();
502 rBindings.Invalidate( SID_OBJECT_ROTATE );
503 rBindings.Invalidate( SID_OBJECT_MIRROR );
505 // instant set the edit mode
506 // SetInEditMode();
508 // if (!pTextObj)
510 // no text object in EditMode, therefore set CreateMode
512 pView->SetCurrentObj(OBJ_TEXT);
514 pView->SetCreateMode();
517 aNewPointer = PointerStyle::Text;
519 aOldPointer = pWindow->GetPointer();
520 rViewShell.SetActivePointer( aNewPointer );
522 FuConstruct::Activate();
525 void FuText::Deactivate()
527 FuConstruct::Deactivate();
528 rViewShell.SetActivePointer( aOldPointer );
529 StopEditMode();
532 // switch object to Edit-Mode
533 void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel,
534 bool bCursorToEnd, const KeyEvent* pInitialKey)
536 /* It is possible to pass a special (unselected) object in pObj, e.g. the
537 caption object of a cell note. If pObj is 0, then the selected object
538 is used. The layer will be relocked in FuText::StopEditMode(). */
539 if ( pObj && (pObj->GetLayer() == SC_LAYER_INTERN) )
540 pView->UnlockInternalLayer();
542 if ( !pObj && pView->AreObjectsMarked() )
544 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
545 if (rMarkList.GetMarkCount() == 1)
547 SdrMark* pMark = rMarkList.GetMark(0);
548 pObj = pMark->GetMarkedSdrObj();
552 if ( pObj )
554 sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
556 if (nSdrObjKind == OBJ_TEXT ||
557 nSdrObjKind == OBJ_TITLETEXT ||
558 nSdrObjKind == OBJ_OUTLINETEXT ||
559 dynamic_cast<const SdrTextObj*>( pObj) != nullptr)
561 SdrPageView* pPV = pView->GetSdrPageView();
563 if ( pObj->HasTextEdit() )
565 std::unique_ptr<SdrOutliner> pO = MakeOutliner();
566 lcl_UpdateHyphenator( *pO, pObj );
568 // vertical flag:
569 // deduced from slot ids only if text object has no content
571 sal_uInt16 nSlotID = aSfxRequest.GetSlot();
572 bool bVertical = ( nSlotID == SID_DRAW_TEXT_VERTICAL );
573 OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
574 if ( pOPO )
575 bVertical = pOPO->IsVertical(); // content wins
576 pO->SetVertical( bVertical );
578 //!?? without returned Outliner the defaults are not correct ???!?
579 auto pOTemp = pO.get();
580 if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, true, pO.release()) )
582 // Toggle out of paste mode if we are in it, otherwise
583 // pressing return in this object will instead go to the
584 // sheet and be considered an overwrite-cell instruction
585 rViewShell.GetViewData().SetPasteMode(ScPasteFlags::NONE);
586 rViewShell.UpdateCopySourceOverlay();
588 // EditEngine-UndoManager anmelden
589 rViewShell.SetDrawTextUndo( &pOTemp->GetUndoManager() );
591 pView->SetEditMode();
593 // set text cursor to click position or to end,
594 // pass initial key event to outliner view
595 if ( pMousePixel || bCursorToEnd || pInitialKey )
597 OutlinerView* pOLV = pView->GetTextEditOutlinerView();
598 if (pOLV)
600 if ( pMousePixel )
602 MouseEvent aEditEvt( *pMousePixel, 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0 );
603 pOLV->MouseButtonDown(aEditEvt);
604 pOLV->MouseButtonUp(aEditEvt);
606 else if ( bCursorToEnd )
608 ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
609 pOLV->SetSelection(aNewSelection);
612 if ( pInitialKey )
613 pOLV->PostKeyEvent( *pInitialKey );
622 // Create default drawing objects via keyboard
623 SdrObjectUniquePtr FuText::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle)
625 // case SID_DRAW_TEXT:
626 // case SID_DRAW_TEXT_VERTICAL:
627 // case SID_DRAW_TEXT_MARQUEE:
628 // case SID_DRAW_NOTEEDIT:
630 SdrObjectUniquePtr pObj(SdrObjFactory::MakeNewObject(
631 *pDrDoc,
632 pView->GetCurrentObjInventor(),
633 pView->GetCurrentObjIdentifier()));
635 if(pObj)
637 if(auto pText = dynamic_cast<SdrTextObj*>( pObj.get() ))
639 pText->SetLogicRect(rRectangle);
641 // don't set default text, start edit mode instead
642 // String aText(ScResId(STR_CAPTION_DEFAULT_TEXT));
643 // pText->SetText(aText);
645 bool bVertical = (SID_DRAW_TEXT_VERTICAL == nID);
646 bool bMarquee = (SID_DRAW_TEXT_MARQUEE == nID);
648 pText->SetVerticalWriting(bVertical);
650 if(bVertical)
652 SfxItemSet aSet(pDrDoc->GetItemPool());
654 aSet.Put(makeSdrTextAutoGrowWidthItem(true));
655 aSet.Put(makeSdrTextAutoGrowHeightItem(false));
656 aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
657 aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
659 pText->SetMergedItemSet(aSet);
662 if(bMarquee)
664 SfxItemSet aSet(pDrDoc->GetItemPool(), svl::Items<SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST>{});
666 aSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
667 aSet.Put( makeSdrTextAutoGrowHeightItem( false ) );
668 aSet.Put( SdrTextAniKindItem( SdrTextAniKind::Slide ) );
669 aSet.Put( SdrTextAniDirectionItem( SdrTextAniDirection::Left ) );
670 aSet.Put( SdrTextAniCountItem( 1 ) );
671 aSet.Put( SdrTextAniAmountItem( static_cast<sal_Int16>(pWindow->PixelToLogic(Size(2,1)).Width())) );
673 pObj->SetMergedItemSetAndBroadcast(aSet);
676 SetInEditMode( pObj.get() ); // start edit mode
678 else
680 OSL_FAIL("Object is NO text object");
684 return pObj;
687 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */