1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sc.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <svx/svddef.hxx> 32*cdf0e10cSrcweir #include <svx/svdoutl.hxx> 33*cdf0e10cSrcweir #include <editeng/outlobj.hxx> 34*cdf0e10cSrcweir #include <svx/sdtaaitm.hxx> 35*cdf0e10cSrcweir #include <svx/sdtacitm.hxx> 36*cdf0e10cSrcweir #include <svx/svdotext.hxx> 37*cdf0e10cSrcweir #include <editeng/unolingu.hxx> 38*cdf0e10cSrcweir #include <svx/svdocapt.hxx> 39*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 40*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 41*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 42*cdf0e10cSrcweir #include <svx/svxids.hrc> 43*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 44*cdf0e10cSrcweir #include <svl/itemset.hxx> 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir #include "futext.hxx" 47*cdf0e10cSrcweir #include "drwlayer.hxx" 48*cdf0e10cSrcweir #include "sc.hrc" 49*cdf0e10cSrcweir #include "tabvwsh.hxx" 50*cdf0e10cSrcweir #include "drawview.hxx" 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir // #98185# Create default drawing objects via keyboard 53*cdf0e10cSrcweir #include "scresid.hxx" 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir // Maximal erlaubte Mausbewegung um noch Drag&Drop zu starten 56*cdf0e10cSrcweir //! fusel,fuconstr,futext - zusammenfassen! 57*cdf0e10cSrcweir #define SC_MAXDRAGMOVE 3 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir //------------------------------------------------------------------ 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir void lcl_InvalidateAttribs( SfxBindings& rBindings ) 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT ); 64*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_POSTURE ); 65*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE ); 66*cdf0e10cSrcweir rBindings.Invalidate( SID_ULINE_VAL_NONE ); 67*cdf0e10cSrcweir rBindings.Invalidate( SID_ULINE_VAL_SINGLE ); 68*cdf0e10cSrcweir rBindings.Invalidate( SID_ULINE_VAL_DOUBLE ); 69*cdf0e10cSrcweir rBindings.Invalidate( SID_ULINE_VAL_DOTTED ); 70*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE ); 71*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_COLOR ); 72*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_FONT ); 73*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); 74*cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNLEFT ); 75*cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNCENTERHOR ); 76*cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNRIGHT ); 77*cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNBLOCK ); 78*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_10 ); 79*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_15 ); 80*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_20 ); 81*cdf0e10cSrcweir rBindings.Invalidate( SID_SET_SUPER_SCRIPT ); 82*cdf0e10cSrcweir rBindings.Invalidate( SID_SET_SUB_SCRIPT ); 83*cdf0e10cSrcweir rBindings.Invalidate( SID_HYPERLINK_GETLINK ); 84*cdf0e10cSrcweir rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT ); 85*cdf0e10cSrcweir rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM ); 86*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT ); 87*cdf0e10cSrcweir rBindings.Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT ); 88*cdf0e10cSrcweir // pseudo slots for Format menu 89*cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_LEFT ); 90*cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_HCENTER ); 91*cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_RIGHT ); 92*cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED ); 93*cdf0e10cSrcweir } 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir void lcl_UpdateHyphenator( Outliner& rOutliner, SdrObject* pObj ) 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir // use hyphenator only if hyphenation attribute is set 98*cdf0e10cSrcweir if ( pObj && ((const SfxBoolItem&)pObj->GetMergedItem(EE_PARA_HYPHENATE)).GetValue() ) { 99*cdf0e10cSrcweir com::sun::star::uno::Reference<com::sun::star::linguistic2::XHyphenator> xHyphenator( LinguMgr::GetHyphenator() ); 100*cdf0e10cSrcweir rOutliner.SetHyphenator( xHyphenator ); 101*cdf0e10cSrcweir } 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir /************************************************************************* 105*cdf0e10cSrcweir |* 106*cdf0e10cSrcweir |* Basisklasse fuer Textfunktionen 107*cdf0e10cSrcweir |* 108*cdf0e10cSrcweir \************************************************************************/ 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir FuText::FuText(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP, 111*cdf0e10cSrcweir SdrModel* pDoc, SfxRequest& rReq) : 112*cdf0e10cSrcweir FuConstruct(pViewSh, pWin, pViewP, pDoc, rReq), 113*cdf0e10cSrcweir pTextObj(NULL) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir /************************************************************************* 118*cdf0e10cSrcweir |* 119*cdf0e10cSrcweir |* Destruktor 120*cdf0e10cSrcweir |* 121*cdf0e10cSrcweir \************************************************************************/ 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir FuText::~FuText() 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir // StopEditMode(); // in Deactivate ! 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir /************************************************************************* 129*cdf0e10cSrcweir |* 130*cdf0e10cSrcweir |* MouseButtonDown-event 131*cdf0e10cSrcweir |* 132*cdf0e10cSrcweir \************************************************************************/ 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir sal_Bool __EXPORT FuText::MouseButtonDown(const MouseEvent& rMEvt) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir // #95491# remember button state for creation of own MouseEvents 137*cdf0e10cSrcweir SetMouseButtonCode(rMEvt.GetButtons()); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir if ( pView->MouseButtonDown(rMEvt, pWindow) ) 140*cdf0e10cSrcweir return (sal_True); // Event von der SdrView ausgewertet 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir if ( pView->IsTextEdit() ) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir if( !IsSizingOrMovingNote(rMEvt) ) 145*cdf0e10cSrcweir StopEditMode(); // Danebengeklickt, Ende mit Edit 146*cdf0e10cSrcweir pView->SetCreateMode(); 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() ); 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir if ( rMEvt.IsLeft() ) 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir SdrHdl* pHdl = pView->PickHandle(aMDPos); 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir sal_uLong nHdlNum = pView->GetHdlNum(pHdl); 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir if (pHdl != NULL) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir if (pView->HasMarkablePoints() && pView->IsPointMarkable(*pHdl)) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir sal_Bool bPointMarked=pView->IsPointMarked(*pHdl); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir if ( rMEvt.IsShift() ) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir if (!bPointMarked) 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir pView->MarkPoint(*pHdl); 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir else 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir pView->UnmarkPoint(*pHdl); 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir else 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir if (!bPointMarked) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir pView->UnmarkAllPoints(); 179*cdf0e10cSrcweir pView->MarkPoint(*pHdl); 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir pHdl=pView->GetHdl(nHdlNum); 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir SdrObject* pObj; 187*cdf0e10cSrcweir SdrPageView* pPV; 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir if ( pHdl != NULL || pView->IsMarkedHit(aMDPos) ) 190*cdf0e10cSrcweir { 191*cdf0e10cSrcweir if (pHdl == NULL && 192*cdf0e10cSrcweir // pView->TakeTextEditObject(aMDPos, pObj, pPV) ) 193*cdf0e10cSrcweir pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKTEXTEDIT) ) 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir SdrOutliner* pO = MakeOutliner(); 196*cdf0e10cSrcweir lcl_UpdateHyphenator( *pO, pObj ); 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir // vertical flag: 199*cdf0e10cSrcweir // deduced from slot ids only if text object has no content 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir sal_uInt16 nSlotID = aSfxRequest.GetSlot(); 202*cdf0e10cSrcweir sal_Bool bVertical = ( nSlotID == SID_DRAW_TEXT_VERTICAL ); 203*cdf0e10cSrcweir OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); 204*cdf0e10cSrcweir if ( pOPO ) 205*cdf0e10cSrcweir bVertical = pOPO->IsVertical(); // content wins 206*cdf0e10cSrcweir pO->SetVertical( bVertical ); 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir //!?? ohne uebergebenen Outliner stimmen die Defaults nicht ???!? 209*cdf0e10cSrcweir if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, sal_True, pO) ) 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir // EditEngine-UndoManager anmelden 212*cdf0e10cSrcweir pViewShell->SetDrawTextUndo( &pO->GetUndoManager() ); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir OutlinerView* pOLV = pView->GetTextEditOutlinerView(); 215*cdf0e10cSrcweir if ( pOLV->MouseButtonDown(rMEvt) ) 216*cdf0e10cSrcweir return (sal_True); // Event an den Outliner 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir else 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir // disable tail & circular move for caption objects. 222*cdf0e10cSrcweir bool bDrag = false; 223*cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 224*cdf0e10cSrcweir if( rMarkList.GetMarkCount() == 1 ) 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir SdrObject* pMarkedObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 227*cdf0e10cSrcweir if( ScDrawLayer::IsNoteCaption( pMarkedObj ) ) 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir if(pHdl->GetKind() != HDL_POLY && pHdl->GetKind() != HDL_CIRC) 230*cdf0e10cSrcweir bDrag = true; 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir else 233*cdf0e10cSrcweir bDrag = true; // different object 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir else 236*cdf0e10cSrcweir bDrag = true; // several objects 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir if ( bDrag ) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir aDragTimer.Start(); 241*cdf0e10cSrcweir pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl); 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir else 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir sal_Bool bMacro = sal_False; 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir // if (bMacro && pView->TakeMacroObject(aMDPos,pObj,pPV)) 250*cdf0e10cSrcweir if (bMacro && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) ) 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir pView->BegMacroObj(aMDPos,pObj,pPV,pWindow); 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir else 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir if (pView->IsEditMode()) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir sal_Bool bPointMode=pView->HasMarkablePoints(); 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir if (!rMEvt.IsShift()) 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir if (bPointMode) 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir pView->UnmarkAllPoints(); 266*cdf0e10cSrcweir } 267*cdf0e10cSrcweir else 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir pView->UnmarkAll(); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir pView->SetDragMode(SDRDRAG_MOVE); 273*cdf0e10cSrcweir SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings(); 274*cdf0e10cSrcweir rBindings.Invalidate( SID_OBJECT_ROTATE ); 275*cdf0e10cSrcweir rBindings.Invalidate( SID_OBJECT_MIRROR ); 276*cdf0e10cSrcweir pHdl=pView->GetHdl(nHdlNum); 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir if ( pView->MarkObj(aMDPos, -2, sal_False, rMEvt.IsMod1()) ) 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir aDragTimer.Start(); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir pHdl=pView->PickHandle(aMDPos); 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir if (pHdl!=NULL) 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir pView->MarkPoint(*pHdl); 288*cdf0e10cSrcweir pHdl=pView->GetHdl(nHdlNum); 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl); 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir else 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir if (bPointMode) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir pView->BegMarkPoints(aMDPos); 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir else 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir pView->BegMarkObj(aMDPos); 302*cdf0e10cSrcweir } 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir else if (aSfxRequest.GetSlot() == SID_DRAW_NOTEEDIT ) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir // Notizen editieren -> keine neuen Textobjekte erzeugen, 308*cdf0e10cSrcweir // stattdessen Textmodus verlassen 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir pViewShell->GetViewData()->GetDispatcher(). 311*cdf0e10cSrcweir Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir else 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir /********************************************************** 316*cdf0e10cSrcweir * Objekt erzeugen 317*cdf0e10cSrcweir **********************************************************/ 318*cdf0e10cSrcweir pView->BegCreateObj(aMDPos, (OutputDevice*) NULL); 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir } 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir if (!bIsInDragMode) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir pWindow->CaptureMouse(); 328*cdf0e10cSrcweir // ForcePointer(&rMEvt); 329*cdf0e10cSrcweir lcl_InvalidateAttribs( pViewShell->GetViewFrame()->GetBindings() ); 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir pViewShell->SetActivePointer(pView->GetPreferedPointer( 333*cdf0e10cSrcweir pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow )); 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir // return (bReturn); 336*cdf0e10cSrcweir return sal_True; 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir /************************************************************************* 340*cdf0e10cSrcweir |* 341*cdf0e10cSrcweir |* MouseMove-event 342*cdf0e10cSrcweir |* 343*cdf0e10cSrcweir \************************************************************************/ 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir sal_Bool __EXPORT FuText::MouseMove(const MouseEvent& rMEvt) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir sal_Bool bReturn = sal_False; 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir // pViewShell->SetActivePointer(aNewPointer); 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir pViewShell->SetActivePointer(pView->GetPreferedPointer( 352*cdf0e10cSrcweir pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow )); 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir if (aDragTimer.IsActive() ) 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir Point aOldPixel = pWindow->LogicToPixel( aMDPos ); 357*cdf0e10cSrcweir Point aNewPixel = rMEvt.GetPosPixel(); 358*cdf0e10cSrcweir if ( Abs( aOldPixel.X() - aNewPixel.X() ) > SC_MAXDRAGMOVE || 359*cdf0e10cSrcweir Abs( aOldPixel.Y() - aNewPixel.Y() ) > SC_MAXDRAGMOVE ) 360*cdf0e10cSrcweir aDragTimer.Stop(); 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir if ( pView->MouseMove(rMEvt, pWindow) ) 364*cdf0e10cSrcweir return (sal_True); // Event von der SdrView ausgewertet 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir if ( pView->IsAction() ) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir /* aNewPointer = Pointer(POINTER_TEXT); 369*cdf0e10cSrcweir pViewShell->SetActivePointer(aNewPointer); 370*cdf0e10cSrcweir */ 371*cdf0e10cSrcweir Point aPix(rMEvt.GetPosPixel()); 372*cdf0e10cSrcweir Point aPnt(pWindow->PixelToLogic(aPix)); 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir ForceScroll(aPix); 375*cdf0e10cSrcweir pView->MovAction(aPnt); 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir // ForcePointer(&rMEvt); 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir return (bReturn); 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir /************************************************************************* 384*cdf0e10cSrcweir |* 385*cdf0e10cSrcweir |* MouseButtonUp-event 386*cdf0e10cSrcweir |* 387*cdf0e10cSrcweir \************************************************************************/ 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir sal_Bool __EXPORT FuText::MouseButtonUp(const MouseEvent& rMEvt) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir // #95491# remember button state for creation of own MouseEvents 392*cdf0e10cSrcweir SetMouseButtonCode(rMEvt.GetButtons()); 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir sal_Bool bReturn = sal_False; 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir if (aDragTimer.IsActive() ) 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir aDragTimer.Stop(); 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir lcl_InvalidateAttribs( pViewShell->GetViewFrame()->GetBindings() ); 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir if ( pView->MouseButtonUp(rMEvt, pWindow) ) 406*cdf0e10cSrcweir return (sal_True); // Event von der SdrView ausgewertet 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir if ( pView->IsDragObj() ) 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir pView->EndDragObj( rMEvt.IsShift() ); 411*cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 412*cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1) 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 415*cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj(); 416*cdf0e10cSrcweir FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr(); 417*cdf0e10cSrcweir FuText* pText = static_cast<FuText*>(pPoor); 418*cdf0e10cSrcweir pText->StopDragMode(pObj ); 419*cdf0e10cSrcweir } 420*cdf0e10cSrcweir pView->ForceMarkedToAnotherPage(); 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir else if ( pView->IsCreateObj() ) 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir if (rMEvt.IsLeft()) 425*cdf0e10cSrcweir { 426*cdf0e10cSrcweir pView->EndCreateObj(SDRCREATE_FORCEEND); 427*cdf0e10cSrcweir if (aSfxRequest.GetSlot() == SID_DRAW_TEXT_MARQUEE) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir // Lauftext-Objekt erzeugen? 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 432*cdf0e10cSrcweir if (rMarkList.GetMark(0)) 433*cdf0e10cSrcweir { 434*cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir // die fuer das Scrollen benoetigten Attribute setzen 437*cdf0e10cSrcweir SfxItemSet aItemSet( pDrDoc->GetItemPool(), 438*cdf0e10cSrcweir SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST); 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir aItemSet.Put( SdrTextAutoGrowWidthItem( sal_False ) ); 441*cdf0e10cSrcweir aItemSet.Put( SdrTextAutoGrowHeightItem( sal_False ) ); 442*cdf0e10cSrcweir aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SLIDE ) ); 443*cdf0e10cSrcweir aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) ); 444*cdf0e10cSrcweir aItemSet.Put( SdrTextAniCountItem( 1 ) ); 445*cdf0e10cSrcweir aItemSet.Put( SdrTextAniAmountItem( 446*cdf0e10cSrcweir (sal_Int16)pWindow->PixelToLogic(Size(2,1)).Width()) ); 447*cdf0e10cSrcweir pObj->SetMergedItemSetAndBroadcast(aItemSet); 448*cdf0e10cSrcweir } 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir // #93382# init object different when vertical writing 452*cdf0e10cSrcweir sal_uInt16 nSlotID(aSfxRequest.GetSlot()); 453*cdf0e10cSrcweir sal_Bool bVertical = (SID_DRAW_TEXT_VERTICAL == nSlotID); 454*cdf0e10cSrcweir if(bVertical) 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 457*cdf0e10cSrcweir if(rMarkList.GetMark(0)) 458*cdf0e10cSrcweir { 459*cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 460*cdf0e10cSrcweir if(pObj && pObj->ISA(SdrTextObj)) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir SdrTextObj* pText = (SdrTextObj*)pObj; 463*cdf0e10cSrcweir SfxItemSet aSet(pDrDoc->GetItemPool()); 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir pText->SetVerticalWriting(sal_True); 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowWidthItem(sal_True)); 468*cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowHeightItem(sal_False)); 469*cdf0e10cSrcweir aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); 470*cdf0e10cSrcweir aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir pText->SetMergedItemSet(aSet); 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir } 475*cdf0e10cSrcweir } 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir SetInEditMode(); 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir // Modus verlassen bei einzelnem Klick 480*cdf0e10cSrcweir // (-> fuconstr) 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir if ( !pView->AreObjectsMarked() ) 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir pView->MarkObj(aPnt, -2, sal_False, rMEvt.IsMod1()); 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir SfxDispatcher& rDisp = pViewShell->GetViewData()->GetDispatcher(); 487*cdf0e10cSrcweir if ( pView->AreObjectsMarked() ) 488*cdf0e10cSrcweir rDisp.Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); 489*cdf0e10cSrcweir else 490*cdf0e10cSrcweir rDisp.Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); 491*cdf0e10cSrcweir } 492*cdf0e10cSrcweir } 493*cdf0e10cSrcweir } 494*cdf0e10cSrcweir else if ( pView->IsAction() ) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir pView->EndAction(); 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir else if( !pView->IsAction() ) 499*cdf0e10cSrcweir { 500*cdf0e10cSrcweir pWindow->ReleaseMouse(); 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir if ( !pView->AreObjectsMarked() && rMEvt.GetClicks() < 2 ) 503*cdf0e10cSrcweir { 504*cdf0e10cSrcweir pView->MarkObj(aPnt, -2, sal_False, rMEvt.IsMod1()); 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir SfxDispatcher& rDisp = pViewShell->GetViewData()->GetDispatcher(); 507*cdf0e10cSrcweir if ( pView->AreObjectsMarked() ) 508*cdf0e10cSrcweir rDisp.Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); 509*cdf0e10cSrcweir else 510*cdf0e10cSrcweir rDisp.Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir } 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir return (bReturn); 515*cdf0e10cSrcweir } 516*cdf0e10cSrcweir 517*cdf0e10cSrcweir /************************************************************************* 518*cdf0e10cSrcweir |* 519*cdf0e10cSrcweir |* Maus-Pointer umschalten 520*cdf0e10cSrcweir |* 521*cdf0e10cSrcweir \************************************************************************/ 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir void FuText::ForcePointer(const MouseEvent* /* pMEvt */) 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir pViewShell->SetActivePointer( aNewPointer ); 526*cdf0e10cSrcweir 527*cdf0e10cSrcweir /* 528*cdf0e10cSrcweir if ( !pView->IsAction() ) 529*cdf0e10cSrcweir { 530*cdf0e10cSrcweir Point aPnt(pWindow->PixelToLogic( pWindow->ScreenToOutputPixel( 531*cdf0e10cSrcweir Pointer::GetPosPixel() ) ) ); 532*cdf0e10cSrcweir SdrHdl* pHdl=pView->HitHandle(aPnt, *pWindow); 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir if (pHdl!=NULL) 535*cdf0e10cSrcweir { 536*cdf0e10cSrcweir pViewShell->SetActivePointer(pHdl->GetPointer() ); 537*cdf0e10cSrcweir } 538*cdf0e10cSrcweir else 539*cdf0e10cSrcweir { 540*cdf0e10cSrcweir SdrObject* pObj; 541*cdf0e10cSrcweir SdrPageView* pPV; 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir if ( pView->IsMarkedHit(aPnt) ) 544*cdf0e10cSrcweir { 545*cdf0e10cSrcweir if ( pView->TakeTextEditObject(aPnt, pObj, pPV) ) 546*cdf0e10cSrcweir { 547*cdf0e10cSrcweir pViewShell->SetActivePointer(Pointer(POINTER_TEXT)); 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir else 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir pViewShell->SetActivePointer(Pointer(POINTER_MOVE)); 552*cdf0e10cSrcweir } 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir else 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir // if ( pView->TakeMacroObject(aPnt, pObj, pPV) ) 557*cdf0e10cSrcweir if ( pView->PickObj(aPnt, pObj, pPV, SDRSEARCH_PICKMACRO) ) 558*cdf0e10cSrcweir { 559*cdf0e10cSrcweir pViewShell->SetActivePointer( pObj->GetMacroPointer() ); 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir else 562*cdf0e10cSrcweir { 563*cdf0e10cSrcweir pViewShell->SetActivePointer( aNewPointer ); 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir } 566*cdf0e10cSrcweir } 567*cdf0e10cSrcweir } 568*cdf0e10cSrcweir */ 569*cdf0e10cSrcweir } 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir /************************************************************************* 574*cdf0e10cSrcweir |* 575*cdf0e10cSrcweir |* Tastaturereignisse bearbeiten 576*cdf0e10cSrcweir |* 577*cdf0e10cSrcweir |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls 578*cdf0e10cSrcweir |* FALSE. 579*cdf0e10cSrcweir |* 580*cdf0e10cSrcweir \************************************************************************/ 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir sal_Bool __EXPORT FuText::KeyInput(const KeyEvent& rKEvt) 583*cdf0e10cSrcweir { 584*cdf0e10cSrcweir sal_Bool bReturn = sal_False; 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir if ( pView->KeyInput(rKEvt, pWindow) ) 587*cdf0e10cSrcweir { 588*cdf0e10cSrcweir bReturn = sal_True; 589*cdf0e10cSrcweir lcl_InvalidateAttribs( pViewShell->GetViewFrame()->GetBindings() ); 590*cdf0e10cSrcweir } 591*cdf0e10cSrcweir else 592*cdf0e10cSrcweir { 593*cdf0e10cSrcweir bReturn = FuDraw::KeyInput(rKEvt); 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir 596*cdf0e10cSrcweir return (bReturn); 597*cdf0e10cSrcweir } 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir 601*cdf0e10cSrcweir /************************************************************************* 602*cdf0e10cSrcweir |* 603*cdf0e10cSrcweir |* Function aktivieren 604*cdf0e10cSrcweir |* 605*cdf0e10cSrcweir \************************************************************************/ 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir void FuText::Activate() 608*cdf0e10cSrcweir { 609*cdf0e10cSrcweir pView->SetDragMode(SDRDRAG_MOVE); 610*cdf0e10cSrcweir SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings(); 611*cdf0e10cSrcweir rBindings.Invalidate( SID_OBJECT_ROTATE ); 612*cdf0e10cSrcweir rBindings.Invalidate( SID_OBJECT_MIRROR ); 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir // Sofort in den Edit Mode setzen 615*cdf0e10cSrcweir // SetInEditMode(); 616*cdf0e10cSrcweir 617*cdf0e10cSrcweir // if (!pTextObj) 618*cdf0e10cSrcweir { 619*cdf0e10cSrcweir /********************************************************************** 620*cdf0e10cSrcweir * Kein Textobjekt im EditMode, daher CreateMode setzen 621*cdf0e10cSrcweir **********************************************************************/ 622*cdf0e10cSrcweir sal_uInt16 nObj = OBJ_TEXT; 623*cdf0e10cSrcweir 624*cdf0e10cSrcweir /* sal_uInt16 nIdent; 625*cdf0e10cSrcweir sal_uInt32 nInvent; 626*cdf0e10cSrcweir pView->TakeCurrentObj(nIdent, nInvent); 627*cdf0e10cSrcweir */ 628*cdf0e10cSrcweir pView->SetCurrentObj(nObj); 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir pView->SetCreateMode(); 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir 633*cdf0e10cSrcweir aNewPointer = Pointer(POINTER_TEXT); 634*cdf0e10cSrcweir // aNewPointer = Pointer(POINTER_CROSS); //! ??? 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir aOldPointer = pWindow->GetPointer(); 637*cdf0e10cSrcweir pViewShell->SetActivePointer( aNewPointer ); 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir FuConstruct::Activate(); 640*cdf0e10cSrcweir } 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir /************************************************************************* 644*cdf0e10cSrcweir |* 645*cdf0e10cSrcweir |* Function deaktivieren 646*cdf0e10cSrcweir |* 647*cdf0e10cSrcweir \************************************************************************/ 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir void FuText::Deactivate() 650*cdf0e10cSrcweir { 651*cdf0e10cSrcweir FuConstruct::Deactivate(); 652*cdf0e10cSrcweir pViewShell->SetActivePointer( aOldPointer ); 653*cdf0e10cSrcweir StopEditMode(); 654*cdf0e10cSrcweir } 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir /************************************************************************* 658*cdf0e10cSrcweir |* 659*cdf0e10cSrcweir |* Selektion hat sich geaendert 660*cdf0e10cSrcweir |* 661*cdf0e10cSrcweir \************************************************************************/ 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir void FuText::SelectionHasChanged() 664*cdf0e10cSrcweir { 665*cdf0e10cSrcweir pView->SetDragMode(SDRDRAG_MOVE); 666*cdf0e10cSrcweir SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings(); 667*cdf0e10cSrcweir rBindings.Invalidate( SID_OBJECT_ROTATE ); 668*cdf0e10cSrcweir rBindings.Invalidate( SID_OBJECT_MIRROR ); 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir pTextObj = NULL; 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir if ( pView->AreObjectsMarked() ) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1) 677*cdf0e10cSrcweir { 678*cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 679*cdf0e10cSrcweir SdrObject* pObj = pMark->GetMarkedSdrObj(); 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir if (nSdrObjKind == OBJ_TEXT || 684*cdf0e10cSrcweir nSdrObjKind == OBJ_TITLETEXT || 685*cdf0e10cSrcweir nSdrObjKind == OBJ_OUTLINETEXT /* || 686*cdf0e10cSrcweir pObj->ISA(SdrTextObj) */ ) 687*cdf0e10cSrcweir { 688*cdf0e10cSrcweir pTextObj = (SdrTextObj*) pObj; 689*cdf0e10cSrcweir } 690*cdf0e10cSrcweir } 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir 693*cdf0e10cSrcweir if (!pTextObj) 694*cdf0e10cSrcweir { 695*cdf0e10cSrcweir /********************************************************************** 696*cdf0e10cSrcweir * Kein Textobjekt im EditMode, daher CreateMode setzen 697*cdf0e10cSrcweir **********************************************************************/ 698*cdf0e10cSrcweir sal_uInt16 nObj = OBJ_TEXT; 699*cdf0e10cSrcweir sal_uInt16 nIdent; 700*cdf0e10cSrcweir sal_uInt32 nInvent; 701*cdf0e10cSrcweir pView->TakeCurrentObj(nIdent, nInvent); 702*cdf0e10cSrcweir 703*cdf0e10cSrcweir // if (! pView->IsEditMode() ) 704*cdf0e10cSrcweir // { 705*cdf0e10cSrcweir // if (nIdent == OBJ_TEXT) 706*cdf0e10cSrcweir // { 707*cdf0e10cSrcweir // nObj = OBJ_TEXT; 708*cdf0e10cSrcweir // } 709*cdf0e10cSrcweir // else if (nIdent == OBJ_OUTLINETEXT) 710*cdf0e10cSrcweir // { 711*cdf0e10cSrcweir // nObj = OBJ_OUTLINETEXT; 712*cdf0e10cSrcweir // } 713*cdf0e10cSrcweir // else if (nIdent == OBJ_TITLETEXT) 714*cdf0e10cSrcweir // { 715*cdf0e10cSrcweir // nObj = OBJ_TITLETEXT; 716*cdf0e10cSrcweir // } 717*cdf0e10cSrcweir // } 718*cdf0e10cSrcweir 719*cdf0e10cSrcweir pView->SetCurrentObj(nObj); 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir pView->SetCreateMode(); 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir } 724*cdf0e10cSrcweir 725*cdf0e10cSrcweir /************************************************************************* 726*cdf0e10cSrcweir |* 727*cdf0e10cSrcweir |* Objekt in Edit-Mode setzen 728*cdf0e10cSrcweir |* 729*cdf0e10cSrcweir \************************************************************************/ 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel, 732*cdf0e10cSrcweir sal_Bool bCursorToEnd, const KeyEvent* pInitialKey) 733*cdf0e10cSrcweir { 734*cdf0e10cSrcweir /* It is possible to pass a special (unselected) object in pObj, e.g. the 735*cdf0e10cSrcweir caption object of a cell note. If pObj is 0, then the selected object 736*cdf0e10cSrcweir is used. The layer will be relocked in FuText::StopEditMode(). */ 737*cdf0e10cSrcweir if ( pObj && (pObj->GetLayer() == SC_LAYER_INTERN) ) 738*cdf0e10cSrcweir pView->UnlockInternalLayer(); 739*cdf0e10cSrcweir 740*cdf0e10cSrcweir if ( !pObj && pView->AreObjectsMarked() ) 741*cdf0e10cSrcweir { 742*cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 743*cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1) 744*cdf0e10cSrcweir { 745*cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 746*cdf0e10cSrcweir pObj = pMark->GetMarkedSdrObj(); 747*cdf0e10cSrcweir } 748*cdf0e10cSrcweir } 749*cdf0e10cSrcweir 750*cdf0e10cSrcweir pTextObj = NULL; 751*cdf0e10cSrcweir 752*cdf0e10cSrcweir if ( pObj ) 753*cdf0e10cSrcweir { 754*cdf0e10cSrcweir sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier(); 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir if (nSdrObjKind == OBJ_TEXT || 757*cdf0e10cSrcweir nSdrObjKind == OBJ_TITLETEXT || 758*cdf0e10cSrcweir nSdrObjKind == OBJ_OUTLINETEXT || 759*cdf0e10cSrcweir pObj->ISA(SdrTextObj)) 760*cdf0e10cSrcweir { 761*cdf0e10cSrcweir SdrPageView* pPV = pView->GetSdrPageView(); 762*cdf0e10cSrcweir Rectangle aRect = pObj->GetLogicRect(); 763*cdf0e10cSrcweir Point aPnt = aRect.Center(); 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir if ( pObj->HasTextEdit() ) 766*cdf0e10cSrcweir { 767*cdf0e10cSrcweir SdrOutliner* pO = MakeOutliner(); 768*cdf0e10cSrcweir lcl_UpdateHyphenator( *pO, pObj ); 769*cdf0e10cSrcweir 770*cdf0e10cSrcweir // vertical flag: 771*cdf0e10cSrcweir // deduced from slot ids only if text object has no content 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir sal_uInt16 nSlotID = aSfxRequest.GetSlot(); 774*cdf0e10cSrcweir sal_Bool bVertical = ( nSlotID == SID_DRAW_TEXT_VERTICAL ); 775*cdf0e10cSrcweir OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject(); 776*cdf0e10cSrcweir if ( pOPO ) 777*cdf0e10cSrcweir bVertical = pOPO->IsVertical(); // content wins 778*cdf0e10cSrcweir pO->SetVertical( bVertical ); 779*cdf0e10cSrcweir 780*cdf0e10cSrcweir //!?? ohne uebergebenen Outliner stimmen die Defaults nicht ???!? 781*cdf0e10cSrcweir if ( pView->SdrBeginTextEdit(pObj, pPV, pWindow, sal_True, pO) ) 782*cdf0e10cSrcweir { 783*cdf0e10cSrcweir // EditEngine-UndoManager anmelden 784*cdf0e10cSrcweir pViewShell->SetDrawTextUndo( &pO->GetUndoManager() ); 785*cdf0e10cSrcweir 786*cdf0e10cSrcweir pTextObj = (SdrTextObj*) pObj; 787*cdf0e10cSrcweir pView->SetEditMode(); 788*cdf0e10cSrcweir 789*cdf0e10cSrcweir // set text cursor to click position or to end, 790*cdf0e10cSrcweir // pass initial key event to outliner view 791*cdf0e10cSrcweir if ( pMousePixel || bCursorToEnd || pInitialKey ) 792*cdf0e10cSrcweir { 793*cdf0e10cSrcweir OutlinerView* pOLV = pView->GetTextEditOutlinerView(); 794*cdf0e10cSrcweir if (pOLV) 795*cdf0e10cSrcweir { 796*cdf0e10cSrcweir if ( pMousePixel ) 797*cdf0e10cSrcweir { 798*cdf0e10cSrcweir MouseEvent aEditEvt( *pMousePixel, 1, MOUSE_SYNTHETIC, MOUSE_LEFT, 0 ); 799*cdf0e10cSrcweir pOLV->MouseButtonDown(aEditEvt); 800*cdf0e10cSrcweir pOLV->MouseButtonUp(aEditEvt); 801*cdf0e10cSrcweir } 802*cdf0e10cSrcweir else if ( bCursorToEnd ) 803*cdf0e10cSrcweir { 804*cdf0e10cSrcweir ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND); 805*cdf0e10cSrcweir pOLV->SetSelection(aNewSelection); 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir if ( pInitialKey ) 809*cdf0e10cSrcweir pOLV->PostKeyEvent( *pInitialKey ); 810*cdf0e10cSrcweir } 811*cdf0e10cSrcweir } 812*cdf0e10cSrcweir } 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir } 815*cdf0e10cSrcweir } 816*cdf0e10cSrcweir } 817*cdf0e10cSrcweir 818*cdf0e10cSrcweir // #98185# Create default drawing objects via keyboard 819*cdf0e10cSrcweir SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle) 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir // case SID_DRAW_TEXT: 822*cdf0e10cSrcweir // case SID_DRAW_TEXT_VERTICAL: 823*cdf0e10cSrcweir // case SID_DRAW_TEXT_MARQUEE: 824*cdf0e10cSrcweir // case SID_DRAW_NOTEEDIT: 825*cdf0e10cSrcweir 826*cdf0e10cSrcweir SdrObject* pObj = SdrObjFactory::MakeNewObject( 827*cdf0e10cSrcweir pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(), 828*cdf0e10cSrcweir 0L, pDrDoc); 829*cdf0e10cSrcweir 830*cdf0e10cSrcweir if(pObj) 831*cdf0e10cSrcweir { 832*cdf0e10cSrcweir if(pObj->ISA(SdrTextObj)) 833*cdf0e10cSrcweir { 834*cdf0e10cSrcweir SdrTextObj* pText = (SdrTextObj*)pObj; 835*cdf0e10cSrcweir pText->SetLogicRect(rRectangle); 836*cdf0e10cSrcweir 837*cdf0e10cSrcweir // #105815# don't set default text, start edit mode instead 838*cdf0e10cSrcweir // String aText(ScResId(STR_CAPTION_DEFAULT_TEXT)); 839*cdf0e10cSrcweir // pText->SetText(aText); 840*cdf0e10cSrcweir 841*cdf0e10cSrcweir sal_Bool bVertical = (SID_DRAW_TEXT_VERTICAL == nID); 842*cdf0e10cSrcweir sal_Bool bMarquee = (SID_DRAW_TEXT_MARQUEE == nID); 843*cdf0e10cSrcweir 844*cdf0e10cSrcweir pText->SetVerticalWriting(bVertical); 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir if(bVertical) 847*cdf0e10cSrcweir { 848*cdf0e10cSrcweir SfxItemSet aSet(pDrDoc->GetItemPool()); 849*cdf0e10cSrcweir 850*cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowWidthItem(sal_True)); 851*cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowHeightItem(sal_False)); 852*cdf0e10cSrcweir aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); 853*cdf0e10cSrcweir aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); 854*cdf0e10cSrcweir 855*cdf0e10cSrcweir pText->SetMergedItemSet(aSet); 856*cdf0e10cSrcweir } 857*cdf0e10cSrcweir 858*cdf0e10cSrcweir if(bMarquee) 859*cdf0e10cSrcweir { 860*cdf0e10cSrcweir SfxItemSet aSet(pDrDoc->GetItemPool(), SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST); 861*cdf0e10cSrcweir 862*cdf0e10cSrcweir aSet.Put( SdrTextAutoGrowWidthItem( sal_False ) ); 863*cdf0e10cSrcweir aSet.Put( SdrTextAutoGrowHeightItem( sal_False ) ); 864*cdf0e10cSrcweir aSet.Put( SdrTextAniKindItem( SDRTEXTANI_SLIDE ) ); 865*cdf0e10cSrcweir aSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) ); 866*cdf0e10cSrcweir aSet.Put( SdrTextAniCountItem( 1 ) ); 867*cdf0e10cSrcweir aSet.Put( SdrTextAniAmountItem( (sal_Int16)pWindow->PixelToLogic(Size(2,1)).Width()) ); 868*cdf0e10cSrcweir 869*cdf0e10cSrcweir pObj->SetMergedItemSetAndBroadcast(aSet); 870*cdf0e10cSrcweir } 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir SetInEditMode( pObj ); // #105815# start edit mode 873*cdf0e10cSrcweir } 874*cdf0e10cSrcweir else 875*cdf0e10cSrcweir { 876*cdf0e10cSrcweir DBG_ERROR("Object is NO text object"); 877*cdf0e10cSrcweir } 878*cdf0e10cSrcweir } 879*cdf0e10cSrcweir 880*cdf0e10cSrcweir return pObj; 881*cdf0e10cSrcweir } 882*cdf0e10cSrcweir 883