tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / drawfunc / futext.cxx
blob3826e04fe474e31c73b45493e55f9d32c5103aad
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 <editeng/editund2.hxx>
29 #include <sfx2/bindings.hxx>
30 #include <sfx2/dispatch.hxx>
31 #include <sfx2/viewfrm.hxx>
32 #include <svx/svxids.hrc>
33 #include <editeng/eeitem.hxx>
34 #include <svl/itemset.hxx>
35 #include <osl/diagnose.h>
37 #include <futext.hxx>
38 #include <drwlayer.hxx>
39 #include <sc.hrc>
40 #include <tabvwsh.hxx>
41 #include <drawview.hxx>
43 // maximum of mouse movement which allows to start Drag&Drop
44 //! fusel,fuconstr,futext - combined!
45 #define SC_MAXDRAGMOVE 3
47 static void lcl_InvalidateAttribs( SfxBindings& rBindings )
49 rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT );
50 rBindings.Invalidate( SID_ATTR_CHAR_POSTURE );
51 rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
52 rBindings.Invalidate( SID_ULINE_VAL_NONE );
53 rBindings.Invalidate( SID_ULINE_VAL_SINGLE );
54 rBindings.Invalidate( SID_ULINE_VAL_DOUBLE );
55 rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
56 rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
57 rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
58 rBindings.Invalidate( SID_ATTR_CHAR_BACK_COLOR );
59 rBindings.Invalidate( SID_ATTR_CHAR_FONT );
60 rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
61 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );
62 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
63 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
64 rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
65 rBindings.Invalidate( SID_ALIGNLEFT );
66 rBindings.Invalidate( SID_ALIGNCENTERHOR );
67 rBindings.Invalidate( SID_ALIGNRIGHT );
68 rBindings.Invalidate( SID_ALIGNBLOCK );
69 rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_10 );
70 rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_15 );
71 rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_20 );
72 rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
73 rBindings.Invalidate( SID_SET_SUB_SCRIPT );
74 rBindings.Invalidate( SID_HYPERLINK_GETLINK );
75 rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
76 rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
77 rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
78 rBindings.Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
79 rBindings.Invalidate( SID_TABLE_VERT_NONE );
80 rBindings.Invalidate( SID_TABLE_VERT_CENTER );
81 rBindings.Invalidate( SID_TABLE_VERT_BOTTOM );
82 // pseudo slots for Format menu
83 rBindings.Invalidate( SID_ALIGN_ANY_LEFT );
84 rBindings.Invalidate( SID_ALIGN_ANY_HCENTER );
85 rBindings.Invalidate( SID_ALIGN_ANY_RIGHT );
86 rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED );
87 rBindings.Invalidate( SID_ATTR_CHAR_KERNING );
88 rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
89 rBindings.Invalidate( SID_SET_SUB_SCRIPT );
90 rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
91 rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED );
94 static void lcl_UpdateHyphenator( Outliner& rOutliner, const SdrObject* pObj )
96 // use hyphenator only if hyphenation attribute is set
97 if ( pObj && pObj->GetMergedItem(EE_PARA_HYPHENATE).GetValue() ) {
98 css::uno::Reference<css::linguistic2::XHyphenator> xHyphenator( LinguMgr::GetHyphenator() );
99 rOutliner.SetHyphenator( xHyphenator );
103 FuText::FuText(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pViewP,
104 SdrModel* pDoc, const SfxRequest& rReq)
105 : FuConstruct(rViewSh, pWin, pViewP, pDoc, rReq)
109 FuText::~FuText()
111 // StopEditMode(); // in Deactivate !
114 bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
116 // remember button state for creation of own MouseEvents
117 SetMouseButtonCode(rMEvt.GetButtons());
118 bool bStraightEnter = true;
120 if ( pView->MouseButtonDown(rMEvt, pWindow->GetOutDev()) )
121 return true; // event handled from SdrView
123 if ( pView->IsTextEdit() )
125 if ( IsEditingANote() )
127 if( !IsSizingOrMovingNote(rMEvt) )
129 StopEditMode(); // Clicked outside, ending edit
130 bStraightEnter = false;
133 else
135 StopEditMode(); // Clicked outside, ending edit
136 pView->UnmarkAll();
137 bStraightEnter = false;
139 pView->SetCreateMode();
142 aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
144 if ( rMEvt.IsLeft() )
146 SdrHdl* pHdl = pView->PickHandle(aMDPos);
147 const size_t nHdlNum = pView->GetHdlNum(pHdl);
148 if (pHdl != nullptr)
150 if (pView->HasMarkablePoints() && pView->IsPointMarkable(*pHdl))
152 bool bPointMarked=pView->IsPointMarked(*pHdl);
154 if ( rMEvt.IsShift() )
156 if (!bPointMarked)
158 pView->MarkPoint(*pHdl);
160 else
162 pView->UnmarkPoint(*pHdl);
165 else
167 if (!bPointMarked)
169 pView->UnmarkAllPoints();
170 pView->MarkPoint(*pHdl);
173 pHdl=pView->GetHdl(nHdlNum);
177 SdrPageView* pPV = nullptr;
179 if ( pHdl != nullptr || pView->IsMarkedHit(aMDPos) )
181 SdrObject* pObj = (pHdl == nullptr) ?
182 pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::PICKTEXTEDIT) :
183 nullptr;
184 if (pObj)
186 std::unique_ptr<SdrOutliner> pO = MakeOutliner();
187 lcl_UpdateHyphenator( *pO, pObj );
189 // vertical flag:
190 // deduced from slot ids only if text object has no content
191 sal_uInt16 nSlotID = aSfxRequest.GetSlot();
192 bool bVertical = ( nSlotID == SID_DRAW_TEXT_VERTICAL );
193 OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
194 if ( pOPO )
195 bVertical = pOPO->IsEffectivelyVertical(); // content wins
196 pO->SetVertical( bVertical );
198 //!?? the default values are not correct when result is without outliner ???!?
199 auto pOTemp = pO.get();
200 if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, true, pO.release()) )
202 // subscribe EditEngine-UndoManager
203 rViewShell.SetDrawTextUndo( &pOTemp->GetUndoManager() );
205 OutlinerView* pOLV = pView->GetTextEditOutlinerView();
206 if ( pOLV->MouseButtonDown(rMEvt) )
207 return true; // Event to the Outliner
210 else
212 // disable tail & circular move for caption objects.
213 bool bDrag = false;
214 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
215 if( rMarkList.GetMarkCount() == 1 )
217 SdrObject* pMarkedObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
218 if( ScDrawLayer::IsNoteCaption( pMarkedObj ) )
220 assert(pHdl);
221 if(pHdl->GetKind() != SdrHdlKind::Poly && pHdl->GetKind() != SdrHdlKind::Circle)
222 bDrag = true;
224 else
225 bDrag = true; // different object
227 else
228 bDrag = true; // several objects
230 if ( bDrag )
232 aDragTimer.Start();
233 pView->BegDragObj(aMDPos, nullptr, pHdl);
237 else
239 if (pView->IsEditMode())
241 bool bPointMode=pView->HasMarkablePoints();
243 if (!rMEvt.IsShift())
245 if (bPointMode)
247 pView->UnmarkAllPoints();
249 else
251 pView->UnmarkAll();
254 pView->SetDragMode(SdrDragMode::Move);
255 SfxBindings& rBindings = rViewShell.GetViewFrame().GetBindings();
256 rBindings.Invalidate( SID_OBJECT_ROTATE );
257 rBindings.Invalidate( SID_OBJECT_MIRROR );
260 if ( pView->MarkObj(aMDPos, -2, false, rMEvt.IsMod1()) )
262 aDragTimer.Start();
264 pHdl=pView->PickHandle(aMDPos);
266 if (pHdl!=nullptr)
268 pView->MarkPoint(*pHdl);
269 pHdl=pView->GetHdl(nHdlNum);
272 pView->BegDragObj(aMDPos, nullptr, pHdl);
274 else
276 if (bPointMode)
278 pView->BegMarkPoints(aMDPos);
280 else
282 pView->BegMarkObj(aMDPos);
286 else if (aSfxRequest.GetSlot() == SID_DRAW_NOTEEDIT )
288 // Edit notes -> create no new text objects
289 // and leave text mode
290 rViewShell.GetViewData().GetDispatcher().
291 Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
293 else
295 if (bStraightEnter)//Hack for that silly idea that creating text fields is inside the text routine
297 // create object
298 pView->BegCreateObj(aMDPos);
300 else if (SdrObject* pObj = pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK))
302 pView->UnmarkAllObj();
303 ScViewData& rViewData = rViewShell.GetViewData();
304 rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
305 pView->MarkObj(pObj,pPV);
307 pHdl=pView->PickHandle(aMDPos);
308 pView->BegDragObj(aMDPos, nullptr, pHdl);
309 return true;
315 if (!bIsInDragMode)
317 pWindow->CaptureMouse();
318 // ForcePointer(&rMEvt);
319 lcl_InvalidateAttribs( rViewShell.GetViewFrame().GetBindings() );
322 rViewShell.SetActivePointer(pView->GetPreferredPointer(
323 pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow->GetOutDev() ));
324 if (!bStraightEnter)
326 pView->UnmarkAll();
327 ScViewData& rViewData = rViewShell.GetViewData();
328 rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
331 return true;
334 bool FuText::MouseMove(const MouseEvent& rMEvt)
336 rViewShell.SetActivePointer(pView->GetPreferredPointer(
337 pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow->GetOutDev() ));
339 if (aDragTimer.IsActive() )
341 Point aOldPixel = pWindow->LogicToPixel( aMDPos );
342 Point aNewPixel = rMEvt.GetPosPixel();
343 if ( std::abs( aOldPixel.X() - aNewPixel.X() ) > SC_MAXDRAGMOVE ||
344 std::abs( aOldPixel.Y() - aNewPixel.Y() ) > SC_MAXDRAGMOVE )
345 aDragTimer.Stop();
348 Point aPix(rMEvt.GetPosPixel());
349 Point aPnt(pWindow->PixelToLogic(aPix));
351 if ( pView->MouseMove(rMEvt, pWindow->GetOutDev()) )
352 return true; // event handled from SdrView
354 if ( pView->IsAction() )
356 ForceScroll(aPix);
357 pView->MovAction(aPnt);
360 return false;
363 bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
365 // remember button state for creation of own MouseEvents
366 SetMouseButtonCode(rMEvt.GetButtons());
368 if (aDragTimer.IsActive() )
370 aDragTimer.Stop();
373 lcl_InvalidateAttribs( rViewShell.GetViewFrame().GetBindings() );
375 Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
377 if ( pView->MouseButtonUp(rMEvt, pWindow->GetOutDev()) )
378 return true; // Event evaluated by SdrView
380 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
381 if ( pView->IsDragObj() )
383 pView->EndDragObj( rMEvt.IsShift() );
384 pView->ForceMarkedToAnotherPage();
386 else if ( pView->IsCreateObj() )
388 if (rMEvt.IsLeft())
390 pView->EndCreateObj(SdrCreateCmd::ForceEnd);
391 if (aSfxRequest.GetSlot() == SID_DRAW_TEXT_MARQUEE)
393 // create marquee-object?
394 if (rMarkList.GetMark(0))
396 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
398 // set needed attributes for scrolling
399 SfxItemSetFixed<SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST> aItemSet( pDrDoc->GetItemPool());
401 aItemSet.Put( makeSdrTextAutoGrowWidthItem( false ) );
402 aItemSet.Put( makeSdrTextAutoGrowHeightItem( false ) );
403 aItemSet.Put( SdrTextAniKindItem( SdrTextAniKind::Slide ) );
404 aItemSet.Put( SdrTextAniDirectionItem( SdrTextAniDirection::Left ) );
405 aItemSet.Put( SdrTextAniCountItem( 1 ) );
406 aItemSet.Put( SdrTextAniAmountItem(
407 static_cast<sal_Int16>(pWindow->PixelToLogic(Size(2,1)).Width())) );
408 pObj->SetMergedItemSetAndBroadcast(aItemSet);
412 // init object different when vertical writing
413 sal_uInt16 nSlotID(aSfxRequest.GetSlot());
414 bool bVertical = (SID_DRAW_TEXT_VERTICAL == nSlotID);
415 if(bVertical)
417 if(rMarkList.GetMark(0))
419 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
420 if(auto pText = DynCastSdrTextObj( pObj))
422 SfxItemSet aSet(pDrDoc->GetItemPool());
424 pText->SetVerticalWriting(true);
426 aSet.Put(makeSdrTextAutoGrowWidthItem(true));
427 aSet.Put(makeSdrTextAutoGrowHeightItem(false));
428 aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
429 aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
431 pText->SetMergedItemSet(aSet);
436 SetInEditMode();
438 // leave mode when sole click (-> fuconstr)
439 if ( rMarkList.GetMarkCount() == 0 )
441 pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
443 SfxDispatcher& rDisp = rViewShell.GetViewData().GetDispatcher();
444 if ( rMarkList.GetMarkCount() != 0 )
445 rDisp.Execute(SID_OBJECT_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD);
446 else
447 rDisp.Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
451 else if ( pView->IsAction() )
453 pView->EndAction();
455 else if( !pView->IsAction() )
457 pWindow->ReleaseMouse();
459 if ( rMarkList.GetMarkCount() == 0 && rMEvt.GetClicks() < 2 )
461 pView->MarkObj(aPnt, -2, false, rMEvt.IsMod1());
463 SfxDispatcher& rDisp = rViewShell.GetViewData().GetDispatcher();
464 if ( rMarkList.GetMarkCount() != 0 )
465 rDisp.Execute(SID_OBJECT_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD);
466 else
467 rDisp.Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD);
471 return false;
474 // switch mouse-pointer
475 void FuText::ForcePointer(const MouseEvent* /* pMEvt */)
477 rViewShell.SetActivePointer( aNewPointer );
480 // modify keyboard events
481 // if a KeyEvent is being processed, then the return value is sal_True, else FALSE.
482 bool FuText::KeyInput(const KeyEvent& rKEvt)
484 bool bReturn = false;
486 if ( pView->KeyInput(rKEvt, pWindow) )
488 bReturn = true;
489 lcl_InvalidateAttribs( rViewShell.GetViewFrame().GetBindings() );
491 else
493 bReturn = FuDraw::KeyInput(rKEvt);
496 return bReturn;
499 void FuText::Activate()
501 pView->SetDragMode(SdrDragMode::Move);
502 SfxBindings& rBindings = rViewShell.GetViewFrame().GetBindings();
503 rBindings.Invalidate( SID_OBJECT_ROTATE );
504 rBindings.Invalidate( SID_OBJECT_MIRROR );
506 // instant set the edit mode
507 // SetInEditMode();
509 // if (!pTextObj)
511 // no text object in EditMode, therefore set CreateMode
513 pView->SetCurrentObj(SdrObjKind::Text);
515 pView->SetCreateMode();
518 aNewPointer = PointerStyle::Text;
520 aOldPointer = pWindow->GetPointer();
521 rViewShell.SetActivePointer( aNewPointer );
523 FuConstruct::Activate();
526 void FuText::Deactivate()
528 FuConstruct::Deactivate();
529 rViewShell.SetActivePointer( aOldPointer );
530 StopEditMode();
533 // switch object to Edit-Mode
534 void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel,
535 bool bCursorToEnd, const KeyEvent* pInitialKey)
537 /* It is possible to pass a special (unselected) object in pObj, e.g. the
538 caption object of a cell note. If pObj is 0, then the selected object
539 is used. The layer will be relocked in FuText::StopEditMode(). */
540 if ( pObj && (pObj->GetLayer() == SC_LAYER_INTERN) )
541 pView->UnlockInternalLayer();
543 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
544 if ( !pObj && rMarkList.GetMarkCount() != 0 )
546 if (rMarkList.GetMarkCount() == 1)
548 SdrMark* pMark = rMarkList.GetMark(0);
549 pObj = pMark->GetMarkedSdrObj();
553 if ( !pObj )
554 return;
556 SdrObjKind nSdrObjKind = pObj->GetObjIdentifier();
558 if (!(nSdrObjKind == SdrObjKind::Text ||
559 nSdrObjKind == SdrObjKind::TitleText ||
560 nSdrObjKind == SdrObjKind::OutlineText ||
561 DynCastSdrTextObj( pObj) != nullptr))
562 return;
564 SdrPageView* pPV = pView->GetSdrPageView();
566 if ( !pObj->HasTextEdit() )
567 return;
569 std::unique_ptr<SdrOutliner> pO = MakeOutliner();
570 lcl_UpdateHyphenator( *pO, pObj );
572 // vertical flag:
573 // deduced from slot ids only if text object has no content
575 sal_uInt16 nSlotID = aSfxRequest.GetSlot();
576 bool bVertical = ( nSlotID == SID_DRAW_TEXT_VERTICAL );
577 OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
578 if ( pOPO )
579 bVertical = pOPO->IsEffectivelyVertical(); // content wins
580 pO->SetVertical( bVertical );
582 //!?? without returned Outliner the defaults are not correct ???!?
583 auto pOTemp = pO.get();
584 if ( !pView->SdrBeginTextEdit(pObj, pPV, pWindow, true, pO.release()) )
585 return;
587 // Toggle out of paste mode if we are in it, otherwise
588 // pressing return in this object will instead go to the
589 // sheet and be considered an overwrite-cell instruction
590 rViewShell.GetViewData().SetPasteMode(ScPasteFlags::NONE);
591 rViewShell.UpdateCopySourceOverlay();
593 // EditEngine-UndoManager anmelden
594 rViewShell.SetDrawTextUndo( &pOTemp->GetUndoManager() );
596 pView->SetEditMode();
598 // set text cursor to click position or to end,
599 // pass initial key event to outliner view
600 if ( !(pMousePixel || bCursorToEnd || pInitialKey) )
601 return;
603 OutlinerView* pOLV = pView->GetTextEditOutlinerView();
604 if (!pOLV)
605 return;
607 if ( pMousePixel )
609 MouseEvent aEditEvt( *pMousePixel, 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0 );
610 pOLV->MouseButtonDown(aEditEvt);
611 pOLV->MouseButtonUp(aEditEvt);
613 else if ( bCursorToEnd )
615 pOLV->SetSelection(ESelection::AtEnd());
618 if ( pInitialKey )
619 pOLV->PostKeyEvent( *pInitialKey );
622 // Create default drawing objects via keyboard
623 rtl::Reference<SdrObject> 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 rtl::Reference<SdrObject> pObj(SdrObjFactory::MakeNewObject(
631 *pDrDoc,
632 pView->GetCurrentObjInventor(),
633 pView->GetCurrentObjIdentifier()));
635 if(pObj)
637 if(auto pText = DynCastSdrTextObj( 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 SfxItemSetFixed<SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST> aSet(pDrDoc->GetItemPool());
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: */