15b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 55b190011SAndrew Rist * distributed with this work for additional information 65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 85b190011SAndrew Rist * "License"); you may not use this file except in compliance 95b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 145b190011SAndrew Rist * software distributed under the License is distributed on an 155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 165b190011SAndrew Rist * KIND, either express or implied. See the License for the 175b190011SAndrew Rist * specific language governing permissions and limitations 185b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 205b190011SAndrew Rist *************************************************************/ 215b190011SAndrew Rist 225b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include "futext.hxx" 29cdf0e10cSrcweir #include <editeng/eeitem.hxx> 30cdf0e10cSrcweir #include <editeng/editerr.hxx> 31cdf0e10cSrcweir #include <svx/dlgutil.hxx> 32cdf0e10cSrcweir #include <svx/svxerr.hxx> 33cdf0e10cSrcweir #include <tools/urlobj.hxx> 34cdf0e10cSrcweir #include <vcl/help.hxx> 35cdf0e10cSrcweir #include <editeng/editstat.hxx> 36cdf0e10cSrcweir #include <svl/aeitem.hxx> 37cdf0e10cSrcweir #include <svl/intitem.hxx> 38cdf0e10cSrcweir #include <svx/svdotext.hxx> 39cdf0e10cSrcweir #include <svx/svdogrp.hxx> 40*d975be8cSAndre Fischer #include <svx/sidebar/ContextChangeEventMultiplexer.hxx> 41cdf0e10cSrcweir #include <editeng/flditem.hxx> 42cdf0e10cSrcweir #include <svl/style.hxx> 43cdf0e10cSrcweir #include <svx/svdpagv.hxx> 44cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 45cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 46cdf0e10cSrcweir #include <sfx2/bindings.hxx> 47cdf0e10cSrcweir #include <sfx2/request.hxx> 48cdf0e10cSrcweir #include <editeng/editeng.hxx> 49cdf0e10cSrcweir #include <svx/svdoutl.hxx> 50cdf0e10cSrcweir #include <svx/svxids.hrc> 51cdf0e10cSrcweir #include <sfx2/docfile.hxx> 52cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 53cdf0e10cSrcweir #include <editeng/outlobj.hxx> 54cdf0e10cSrcweir #include <svtools/langtab.hxx> 55cdf0e10cSrcweir 56cdf0e10cSrcweir // #104122# 57cdf0e10cSrcweir #include <editeng/frmdiritem.hxx> 58cdf0e10cSrcweir 59cdf0e10cSrcweir #include <svx/svdetc.hxx> 60cdf0e10cSrcweir #include <editeng/editview.hxx> 61cdf0e10cSrcweir 62cdf0e10cSrcweir #include "sdresid.hxx" 63cdf0e10cSrcweir #include "app.hrc" 64cdf0e10cSrcweir #include "res_bmp.hrc" 65cdf0e10cSrcweir #include "ViewShell.hxx" 66cdf0e10cSrcweir #include "ViewShellBase.hxx" 67cdf0e10cSrcweir #include "View.hxx" 68cdf0e10cSrcweir #include "Outliner.hxx" 69cdf0e10cSrcweir #include "Window.hxx" 70cdf0e10cSrcweir #include "drawdoc.hxx" 71cdf0e10cSrcweir #include "sdpage.hxx" 72cdf0e10cSrcweir #include "sdmod.hxx" 73cdf0e10cSrcweir #include "FrameView.hxx" 74cdf0e10cSrcweir #include "ToolBarManager.hxx" 75cdf0e10cSrcweir #include "DrawDocShell.hxx" 76cdf0e10cSrcweir #include "glob.hrc" 77cdf0e10cSrcweir #include "pres.hxx" 78cdf0e10cSrcweir #include "optsitem.hxx" 79cdf0e10cSrcweir 80cdf0e10cSrcweir using ::rtl::OUString; 81cdf0e10cSrcweir using namespace ::com::sun::star; 82cdf0e10cSrcweir using namespace ::com::sun::star::uno; 83cdf0e10cSrcweir using namespace ::com::sun::star::lang; 84cdf0e10cSrcweir using namespace ::com::sun::star::linguistic2; 85cdf0e10cSrcweir 86cdf0e10cSrcweir namespace sd { 87cdf0e10cSrcweir 88cdf0e10cSrcweir static sal_uInt16 SidArray[] = { 89cdf0e10cSrcweir SID_STYLE_FAMILY2, // 5542 90cdf0e10cSrcweir SID_STYLE_FAMILY5, // 5545 91cdf0e10cSrcweir SID_CUT, // 5710 92cdf0e10cSrcweir SID_COPY, // 5711 93cdf0e10cSrcweir SID_ATTR_TABSTOP, // 10002 94cdf0e10cSrcweir SID_ATTR_CHAR_FONT, // 10007 95cdf0e10cSrcweir SID_ATTR_CHAR_POSTURE, // 10008 96cdf0e10cSrcweir SID_ATTR_CHAR_WEIGHT, // 10009 97cdf0e10cSrcweir SID_ATTR_CHAR_UNDERLINE, // 10014 98cdf0e10cSrcweir SID_ATTR_CHAR_FONTHEIGHT, // 10015 99cdf0e10cSrcweir SID_ATTR_CHAR_COLOR, // 10017 100cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_LEFT, // 10028 101cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_RIGHT, // 10029 102cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_CENTER, // 10030 103cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_BLOCK, // 10031 104cdf0e10cSrcweir SID_ATTR_PARA_LINESPACE_10, // 10034 105cdf0e10cSrcweir SID_ATTR_PARA_LINESPACE_15, // 10035 106cdf0e10cSrcweir SID_ATTR_PARA_LINESPACE_20, // 10036 107cdf0e10cSrcweir SID_ATTR_PARA_LRSPACE, // 10043 108cdf0e10cSrcweir SID_OUTLINE_UP, // 10150 109cdf0e10cSrcweir SID_OUTLINE_DOWN, // 10151 110cdf0e10cSrcweir SID_OUTLINE_LEFT, // 10152 111cdf0e10cSrcweir SID_OUTLINE_RIGHT, // 10153 112cdf0e10cSrcweir SID_FORMTEXT_STYLE, // 10257 113cdf0e10cSrcweir SID_SET_SUPER_SCRIPT, // 10294 114cdf0e10cSrcweir SID_SET_SUB_SCRIPT, // 10295 115cdf0e10cSrcweir SID_HYPERLINK_GETLINK, // 10361 116cdf0e10cSrcweir SID_CHARMAP, // 10503 117cdf0e10cSrcweir SID_TEXTDIRECTION_LEFT_TO_RIGHT, // 10907 118cdf0e10cSrcweir SID_TEXTDIRECTION_TOP_TO_BOTTOM, // 10908 119cdf0e10cSrcweir SID_ATTR_PARA_LEFT_TO_RIGHT, // 10950 120cdf0e10cSrcweir SID_ATTR_PARA_RIGHT_TO_LEFT, // 10951 121cdf0e10cSrcweir FN_NUM_BULLET_ON, // 20138 122cdf0e10cSrcweir SID_PARASPACE_INCREASE, // 27346 123cdf0e10cSrcweir SID_PARASPACE_DECREASE, // 27347 124cdf0e10cSrcweir 0 }; 125cdf0e10cSrcweir 126cdf0e10cSrcweir TYPEINIT1( FuText, FuConstruct ); 127cdf0e10cSrcweir 128cdf0e10cSrcweir 129cdf0e10cSrcweir static sal_Bool bTestText = 0; 130cdf0e10cSrcweir 131cdf0e10cSrcweir /************************************************************************* 132cdf0e10cSrcweir |* 133cdf0e10cSrcweir |* Basisklasse fuer Textfunktionen 134cdf0e10cSrcweir |* 135cdf0e10cSrcweir \************************************************************************/ 136cdf0e10cSrcweir 137cdf0e10cSrcweir FuText::FuText( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ) 138cdf0e10cSrcweir : FuConstruct(pViewSh, pWin, pView, pDoc, rReq) 139cdf0e10cSrcweir , bFirstObjCreated(sal_False) 140cdf0e10cSrcweir , rRequest (rReq) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir } 143cdf0e10cSrcweir 144cdf0e10cSrcweir FunctionReference FuText::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq ) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir FunctionReference xFunc( new FuText( pViewSh, pWin, pView, pDoc, rReq ) ); 147cdf0e10cSrcweir return xFunc; 148cdf0e10cSrcweir } 149cdf0e10cSrcweir 150cdf0e10cSrcweir /************************************************************************* 151cdf0e10cSrcweir |* 152cdf0e10cSrcweir |* Destruktor 153cdf0e10cSrcweir |* 154cdf0e10cSrcweir \************************************************************************/ 155cdf0e10cSrcweir 156cdf0e10cSrcweir void FuText::disposing() 157cdf0e10cSrcweir { 158cdf0e10cSrcweir if(mpView) 159cdf0e10cSrcweir { 160cdf0e10cSrcweir if(mpView->SdrEndTextEdit(sal_False) == SDRENDTEXTEDIT_DELETED) 161cdf0e10cSrcweir mxTextObj.reset( 0 ); 162cdf0e10cSrcweir 163cdf0e10cSrcweir // die RequestHandler der benutzten Outliner zuruecksetzen auf den 164cdf0e10cSrcweir // Handler am Dokument 165cdf0e10cSrcweir ::Outliner* pOutliner = mpView->GetTextEditOutliner(); 166cdf0e10cSrcweir 167cdf0e10cSrcweir if (pOutliner) 168cdf0e10cSrcweir pOutliner->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(mpDoc->GetStyleSheetPool())); 169cdf0e10cSrcweir } 170cdf0e10cSrcweir } 171cdf0e10cSrcweir 172cdf0e10cSrcweir /************************************************************************* 173cdf0e10cSrcweir |* 174cdf0e10cSrcweir |* Execute functionality of this class: 175cdf0e10cSrcweir |* 176cdf0e10cSrcweir |* #71422: Start the functionality of this class in this method 177cdf0e10cSrcweir |* and not in the ctor. 178cdf0e10cSrcweir |* If you construct an object of this class and you put the 179cdf0e10cSrcweir |* address of this object to pFuActual you've got a problem, 180cdf0e10cSrcweir |* because some methods inside DoExecute use the pFuActual-Pointer. 181cdf0e10cSrcweir |* If the code inside DoExecute is executed inside the ctor, 182cdf0e10cSrcweir |* the value of pFuActual is not right. And the value will not 183cdf0e10cSrcweir |* be right until the ctor finished !!! 184cdf0e10cSrcweir |* 185cdf0e10cSrcweir \************************************************************************/ 186cdf0e10cSrcweir void FuText::DoExecute( SfxRequest& ) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBarShell( 189cdf0e10cSrcweir ToolBarManager::TBG_FUNCTION, 190cdf0e10cSrcweir RID_DRAW_TEXT_TOOLBOX); 191*d975be8cSAndre Fischer ContextChangeEventMultiplexer::NotifyContextChange( 192*d975be8cSAndre Fischer mpViewShell->GetViewShellBase().GetController(), 193*d975be8cSAndre Fischer ContextChangeEventMultiplexer::Application_Impress, 194*d975be8cSAndre Fischer ContextChangeEventMultiplexer::Context_TextEdit); 195cdf0e10cSrcweir 196cdf0e10cSrcweir mpView->SetCurrentObj(OBJ_TEXT); 197cdf0e10cSrcweir mpView->SetEditMode(SDREDITMODE_EDIT); 198cdf0e10cSrcweir 199cdf0e10cSrcweir MouseEvent aMEvt(mpWindow->GetPointerPosPixel()); 200cdf0e10cSrcweir 201cdf0e10cSrcweir if (nSlotId == SID_TEXTEDIT) 202cdf0e10cSrcweir { 203cdf0e10cSrcweir // Try to select an object 204cdf0e10cSrcweir SdrPageView* pPV = mpView->GetSdrPageView(); 205cdf0e10cSrcweir SdrViewEvent aVEvt; 206cdf0e10cSrcweir mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 207cdf0e10cSrcweir mpView->MarkObj(aVEvt.pRootObj, pPV); 208cdf0e10cSrcweir 209cdf0e10cSrcweir mxTextObj.reset( dynamic_cast< SdrTextObj* >( aVEvt.pObj ) ); 210cdf0e10cSrcweir } 211cdf0e10cSrcweir else if (mpView->AreObjectsMarked()) 212cdf0e10cSrcweir { 213cdf0e10cSrcweir const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 214cdf0e10cSrcweir 215cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1) 216cdf0e10cSrcweir { 217cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 218cdf0e10cSrcweir mxTextObj.reset( dynamic_cast< SdrTextObj* >( pObj ) ); 219cdf0e10cSrcweir } 220cdf0e10cSrcweir } 221cdf0e10cSrcweir 222cdf0e10cSrcweir // check for table 223cdf0e10cSrcweir if (mpView->AreObjectsMarked()) 224cdf0e10cSrcweir { 225cdf0e10cSrcweir const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 226cdf0e10cSrcweir 227cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1) 228cdf0e10cSrcweir { 229cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 230cdf0e10cSrcweir if( pObj && (pObj->GetObjInventor() == SdrInventor ) && (pObj->GetObjIdentifier() == OBJ_TABLE) ) 231cdf0e10cSrcweir { 232cdf0e10cSrcweir mpViewShell->GetViewShellBase().GetToolBarManager()->AddToolBarShell( ToolBarManager::TBG_FUNCTION, RID_DRAW_TABLE_TOOLBOX ); 233cdf0e10cSrcweir } 234cdf0e10cSrcweir } 235cdf0e10cSrcweir } 236cdf0e10cSrcweir 237cdf0e10cSrcweir sal_Bool bQuickDrag = sal_True; 238cdf0e10cSrcweir 239cdf0e10cSrcweir const SfxItemSet* pArgs = rRequest.GetArgs(); 240cdf0e10cSrcweir 241cdf0e10cSrcweir if (pArgs 242cdf0e10cSrcweir 243cdf0e10cSrcweir // #98198# test for type before using 244cdf0e10cSrcweir && SID_TEXTEDIT == nSlotId 245cdf0e10cSrcweir && SFX_ITEM_SET == pArgs->GetItemState(SID_TEXTEDIT) 246cdf0e10cSrcweir 247cdf0e10cSrcweir && (sal_uInt16)((SfxUInt16Item&)pArgs->Get(SID_TEXTEDIT)).GetValue() == 2) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir // Selection by doubleclick -> don't allow QuickDrag 250cdf0e10cSrcweir bQuickDrag = sal_False; 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir SetInEditMode(aMEvt, bQuickDrag); 254cdf0e10cSrcweir } 255cdf0e10cSrcweir 256cdf0e10cSrcweir /************************************************************************* 257cdf0e10cSrcweir |* 258cdf0e10cSrcweir |* MouseButtonDown-event 259cdf0e10cSrcweir |* 260cdf0e10cSrcweir \************************************************************************/ 261cdf0e10cSrcweir 262cdf0e10cSrcweir sal_Bool FuText::MouseButtonDown(const MouseEvent& rMEvt) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir bMBDown = sal_True; 265cdf0e10cSrcweir 266cdf0e10cSrcweir sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt); 267cdf0e10cSrcweir 268cdf0e10cSrcweir /* af: (de)Select object before showing the context menu. 269cdf0e10cSrcweir // Fuer PopupMenu (vorher DrawViewShell) 270cdf0e10cSrcweir if ((rMEvt.GetButtons() == MOUSE_RIGHT) && rMEvt.GetClicks() == 1 && 271cdf0e10cSrcweir mpView->IsTextEdit()) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir return (sal_True); 274cdf0e10cSrcweir } 275cdf0e10cSrcweir */ 276cdf0e10cSrcweir 277cdf0e10cSrcweir mpView->SetMarkHdlWhenTextEdit(sal_True); 278cdf0e10cSrcweir SdrViewEvent aVEvt; 279cdf0e10cSrcweir SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 280cdf0e10cSrcweir 281cdf0e10cSrcweir if (eHit == SDRHIT_TEXTEDIT) 282cdf0e10cSrcweir { 283cdf0e10cSrcweir // Text getroffen -> Event von SdrView auswerten lassen 284cdf0e10cSrcweir if (mpView->MouseButtonDown(rMEvt, mpWindow)) 285cdf0e10cSrcweir return (sal_True); 286cdf0e10cSrcweir } 287cdf0e10cSrcweir 288cdf0e10cSrcweir if (rMEvt.GetClicks() == 1) 289cdf0e10cSrcweir { 290cdf0e10cSrcweir if (mpView->IsTextEdit() && eHit != SDRHIT_MARKEDOBJECT && eHit != SDRHIT_HANDLE) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir // Texteingabe beenden 293cdf0e10cSrcweir if(mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED) 294cdf0e10cSrcweir { 295cdf0e10cSrcweir // Bugfix von MBA: bei Doppelclick auf der Wiese im Modus Text wird 296cdf0e10cSrcweir // beim zweiten Click eHit = SDRHIT_TEXTEDITOBJ erhalten, weil ja der 297cdf0e10cSrcweir // zweite Click auf das im ersten Click angelegte TextObject geht. 298cdf0e10cSrcweir // Dieses wird aber in SdrEndTextEdit entfernt, weil es leer ist. Es 299cdf0e10cSrcweir // befindet sich aber noch in der Mark-Liste und der Aufruf MarkObj 300cdf0e10cSrcweir // weiter unten greift dann auf das tote Object zu. 301cdf0e10cSrcweir // Als einfacher Fix wird nach SdrEndTextEdit noch einmal eHit ermittelt, 302cdf0e10cSrcweir // was dann SDRHIT_NONE liefert. 303cdf0e10cSrcweir mxTextObj.reset( NULL ); 304cdf0e10cSrcweir eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 305cdf0e10cSrcweir } 306cdf0e10cSrcweir 307cdf0e10cSrcweir mpView->SetCurrentObj(OBJ_TEXT); 308cdf0e10cSrcweir mpView->SetEditMode(SDREDITMODE_EDIT); 309cdf0e10cSrcweir } 310cdf0e10cSrcweir 311cdf0e10cSrcweir if (rMEvt.IsLeft() || rMEvt.IsRight()) 312cdf0e10cSrcweir { 313cdf0e10cSrcweir mpWindow->CaptureMouse(); 314cdf0e10cSrcweir SdrObject* pObj; 315cdf0e10cSrcweir SdrPageView* pPV = mpView->GetSdrPageView(); 316cdf0e10cSrcweir 317cdf0e10cSrcweir if (eHit == SDRHIT_TEXTEDIT) 318cdf0e10cSrcweir { 319cdf0e10cSrcweir SetInEditMode(rMEvt, sal_False); 320cdf0e10cSrcweir } 321cdf0e10cSrcweir else 322cdf0e10cSrcweir { 323cdf0e10cSrcweir sal_Bool bMacro = sal_False; 324cdf0e10cSrcweir 325cdf0e10cSrcweir if (bMacro && mpView->PickObj(aMDPos,mpView->getHitTolLog(),pObj,pPV,SDRSEARCH_PICKMACRO)) 326cdf0e10cSrcweir { 327cdf0e10cSrcweir // Makro 328cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() ); 329cdf0e10cSrcweir mpView->BegMacroObj(aMDPos,nHitLog,pObj,pPV,mpWindow); 330cdf0e10cSrcweir } 331cdf0e10cSrcweir else 332cdf0e10cSrcweir { 333cdf0e10cSrcweir if (eHit != SDRHIT_HANDLE) 334cdf0e10cSrcweir { 335cdf0e10cSrcweir // Selektion aufheben 336cdf0e10cSrcweir if (!rMEvt.IsShift() && eHit == SDRHIT_TEXTEDITOBJ) 337cdf0e10cSrcweir { 338cdf0e10cSrcweir mpView->UnmarkAll(); 339cdf0e10cSrcweir mpView->SetDragMode(SDRDRAG_MOVE); 340cdf0e10cSrcweir } 341cdf0e10cSrcweir } 342cdf0e10cSrcweir 343cdf0e10cSrcweir if ( aVEvt.eEvent == SDREVENT_EXECUTEURL || 344cdf0e10cSrcweir eHit == SDRHIT_HANDLE || 345cdf0e10cSrcweir eHit == SDRHIT_MARKEDOBJECT || 346cdf0e10cSrcweir eHit == SDRHIT_TEXTEDITOBJ || 347cdf0e10cSrcweir ( eHit == SDRHIT_UNMARKEDOBJECT && bFirstObjCreated && 348cdf0e10cSrcweir !bPermanent ) ) 349cdf0e10cSrcweir { 350cdf0e10cSrcweir /********************************************************** 351cdf0e10cSrcweir * Handle, markiertes oder unmarkiertes Objekt getroffen 352cdf0e10cSrcweir **********************************************************/ 353cdf0e10cSrcweir if (eHit == SDRHIT_TEXTEDITOBJ) 354cdf0e10cSrcweir { 355cdf0e10cSrcweir /****************************************************** 356cdf0e10cSrcweir * Text eines unmarkierten Objekts getroffen: 357cdf0e10cSrcweir * Objekt wird selektiert und in EditMode versetzt 358cdf0e10cSrcweir ******************************************************/ 359cdf0e10cSrcweir mpView->MarkObj(aVEvt.pRootObj, pPV); 360cdf0e10cSrcweir 361cdf0e10cSrcweir if (aVEvt.pObj && aVEvt.pObj->ISA(SdrTextObj)) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir mxTextObj.reset( static_cast<SdrTextObj*>(aVEvt.pObj) ); 364cdf0e10cSrcweir } 365cdf0e10cSrcweir 366cdf0e10cSrcweir SetInEditMode(rMEvt, sal_True); 367cdf0e10cSrcweir } 368cdf0e10cSrcweir else if (aVEvt.eEvent == SDREVENT_EXECUTEURL && !rMEvt.IsMod2()) 369cdf0e10cSrcweir { 370cdf0e10cSrcweir /****************************************************** 371cdf0e10cSrcweir * URL ausfuehren 372cdf0e10cSrcweir ******************************************************/ 373cdf0e10cSrcweir mpWindow->ReleaseMouse(); 374cdf0e10cSrcweir SfxStringItem aStrItem(SID_FILE_NAME, aVEvt.pURLField->GetURL()); 375cdf0e10cSrcweir SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName()); 376cdf0e10cSrcweir SfxBoolItem aBrowseItem( SID_BROWSE, sal_True ); 377cdf0e10cSrcweir SfxViewFrame* pFrame = mpViewShell->GetViewFrame(); 378cdf0e10cSrcweir mpWindow->ReleaseMouse(); 379cdf0e10cSrcweir 380cdf0e10cSrcweir if (rMEvt.IsMod1()) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir // Im neuen Frame oeffnen 383cdf0e10cSrcweir pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, 384cdf0e10cSrcweir &aStrItem, &aBrowseItem, &aReferer, 0L); 385cdf0e10cSrcweir } 386cdf0e10cSrcweir else 387cdf0e10cSrcweir { 388cdf0e10cSrcweir // Im aktuellen Frame oeffnen 389cdf0e10cSrcweir SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame); 390cdf0e10cSrcweir pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, 391cdf0e10cSrcweir &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L); 392cdf0e10cSrcweir } 393cdf0e10cSrcweir } 394cdf0e10cSrcweir else 395cdf0e10cSrcweir { 396cdf0e10cSrcweir /****************************************************** 397cdf0e10cSrcweir * Objekt oder Handle draggen 398cdf0e10cSrcweir ******************************************************/ 399cdf0e10cSrcweir 400cdf0e10cSrcweir // #i78748# 401cdf0e10cSrcweir // do the EndTextEdit first, it will delete the handles and force a 402cdf0e10cSrcweir // recreation. This will make aVEvt.pHdl to point to a deleted handle, 403cdf0e10cSrcweir // thus it is necessary to reset it and to get it again. 404cdf0e10cSrcweir 405cdf0e10cSrcweir // #i112855# 406cdf0e10cSrcweir // cl: I'm not sure why we checked here also for mxTextObj->GetOutlinerParaObjet 407cdf0e10cSrcweir // this caused SdrEndTextEdit() to be called also when not in text editing and 408cdf0e10cSrcweir // this does not make sense and caused troubles. (see issue 112855) 409cdf0e10cSrcweir 410cdf0e10cSrcweir // ::Outliner* pOutl = mpView->GetTextEditOutliner(); 411cdf0e10cSrcweir // 412cdf0e10cSrcweir // if (mxTextObj.is() && (mxTextObj->GetOutlinerParaObject() || 413cdf0e10cSrcweir // (pOutl && pOutl->GetText(pOutl->GetParagraph( 0 )).Len() != 0))) 414cdf0e10cSrcweir if( mpView->IsTextEdit() ) 415cdf0e10cSrcweir { 416cdf0e10cSrcweir mpView->SdrEndTextEdit(); 417cdf0e10cSrcweir 418cdf0e10cSrcweir if(aVEvt.pHdl) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir // force new handle identification, the pointer will be dead here 421cdf0e10cSrcweir // since SdrEndTextEdit has resetted (deleted) the handles. 422cdf0e10cSrcweir aVEvt.pHdl = 0; 423cdf0e10cSrcweir mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 424cdf0e10cSrcweir } 425cdf0e10cSrcweir } 426cdf0e10cSrcweir 427cdf0e10cSrcweir if (!aVEvt.pHdl) 428cdf0e10cSrcweir { 429cdf0e10cSrcweir if( eHit == SDRHIT_UNMARKEDOBJECT ) 430cdf0e10cSrcweir { 431cdf0e10cSrcweir if ( !rMEvt.IsShift() ) 432cdf0e10cSrcweir mpView->UnmarkAll(); 433cdf0e10cSrcweir 434cdf0e10cSrcweir mpView->MarkObj(aVEvt.pRootObj, pPV); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir 437cdf0e10cSrcweir // Objekt draggen 438cdf0e10cSrcweir bFirstMouseMove = sal_True; 439cdf0e10cSrcweir aDragTimer.Start(); 440cdf0e10cSrcweir } 441cdf0e10cSrcweir 442cdf0e10cSrcweir 443cdf0e10cSrcweir if ( ! rMEvt.IsRight()) 444cdf0e10cSrcweir { 445cdf0e10cSrcweir // we need to pick again since SdrEndTextEdit can rebuild the handles list 446cdf0e10cSrcweir eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 447cdf0e10cSrcweir if( (eHit == SDRHIT_HANDLE) || (eHit == SDRHIT_MARKEDOBJECT) ) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() ); 450cdf0e10cSrcweir mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog); 451cdf0e10cSrcweir } 452cdf0e10cSrcweir } 453cdf0e10cSrcweir bReturn = true; 454cdf0e10cSrcweir } 455cdf0e10cSrcweir } 456cdf0e10cSrcweir else if ( nSlotId != SID_TEXTEDIT && 457cdf0e10cSrcweir (bPermanent || !bFirstObjCreated) ) 458cdf0e10cSrcweir { 459cdf0e10cSrcweir /********************************************************** 460cdf0e10cSrcweir * Objekt erzeugen 461cdf0e10cSrcweir **********************************************************/ 462cdf0e10cSrcweir mpView->SetCurrentObj(OBJ_TEXT); 463cdf0e10cSrcweir mpView->SetEditMode(SDREDITMODE_CREATE); 464cdf0e10cSrcweir sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() ); 465cdf0e10cSrcweir mpView->BegCreateObj(aMDPos, (OutputDevice*) NULL, nDrgLog); 466cdf0e10cSrcweir } 467cdf0e10cSrcweir else 468cdf0e10cSrcweir { 469cdf0e10cSrcweir /********************************************************** 470cdf0e10cSrcweir * Selektieren 471cdf0e10cSrcweir **********************************************************/ 472cdf0e10cSrcweir if( !rMEvt.IsShift() ) 473cdf0e10cSrcweir mpView->UnmarkAll(); 474cdf0e10cSrcweir 475cdf0e10cSrcweir mpView->BegMarkObj( aMDPos ); 476cdf0e10cSrcweir } 477cdf0e10cSrcweir } 478cdf0e10cSrcweir } 479cdf0e10cSrcweir } 480cdf0e10cSrcweir } 481cdf0e10cSrcweir else if ( rMEvt.GetClicks() == 2 && !mpView->IsTextEdit() ) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir MouseEvent aMEvt( mpWindow->GetPointerPosPixel() ); 484cdf0e10cSrcweir SetInEditMode( aMEvt, sal_False ); 485cdf0e10cSrcweir } 486cdf0e10cSrcweir 487cdf0e10cSrcweir if (!bIsInDragMode) 488cdf0e10cSrcweir { 489cdf0e10cSrcweir ForcePointer(&rMEvt); 490cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate(SidArray); 491cdf0e10cSrcweir } 492cdf0e10cSrcweir 493cdf0e10cSrcweir return (bReturn); 494cdf0e10cSrcweir } 495cdf0e10cSrcweir 496cdf0e10cSrcweir /************************************************************************* 497cdf0e10cSrcweir |* 498cdf0e10cSrcweir |* MouseMove-event 499cdf0e10cSrcweir |* 500cdf0e10cSrcweir \************************************************************************/ 501cdf0e10cSrcweir 502cdf0e10cSrcweir sal_Bool FuText::MouseMove(const MouseEvent& rMEvt) 503cdf0e10cSrcweir { 504cdf0e10cSrcweir sal_Bool bReturn = FuDraw::MouseMove(rMEvt); 505cdf0e10cSrcweir 506cdf0e10cSrcweir if (aDragTimer.IsActive() ) 507cdf0e10cSrcweir { 508cdf0e10cSrcweir if( bFirstMouseMove ) 509cdf0e10cSrcweir bFirstMouseMove = sal_False; 510cdf0e10cSrcweir else 511cdf0e10cSrcweir aDragTimer.Stop(); 512cdf0e10cSrcweir } 513cdf0e10cSrcweir 514cdf0e10cSrcweir if (!bReturn && mpView->IsAction() && !mpDocSh->IsReadOnly()) 515cdf0e10cSrcweir { 516cdf0e10cSrcweir Point aPix(rMEvt.GetPosPixel()); 517cdf0e10cSrcweir Point aPnt(mpWindow->PixelToLogic(aPix)); 518cdf0e10cSrcweir 519cdf0e10cSrcweir ForceScroll(aPix); 520cdf0e10cSrcweir mpView->MovAction(aPnt); 521cdf0e10cSrcweir } 522cdf0e10cSrcweir 523cdf0e10cSrcweir ForcePointer(&rMEvt); 524cdf0e10cSrcweir 525cdf0e10cSrcweir return (bReturn); 526cdf0e10cSrcweir } 527cdf0e10cSrcweir 528cdf0e10cSrcweir /************************************************************************* 529cdf0e10cSrcweir |* 530cdf0e10cSrcweir |* MouseButtonUp-event 531cdf0e10cSrcweir |* 532cdf0e10cSrcweir \************************************************************************/ 533cdf0e10cSrcweir 534cdf0e10cSrcweir // #97016# 535cdf0e10cSrcweir void FuText::ImpSetAttributesForNewTextObject(SdrTextObj* pTxtObj) 536cdf0e10cSrcweir { 537cdf0e10cSrcweir if(mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) 538cdf0e10cSrcweir { 539cdf0e10cSrcweir if( nSlotId == SID_ATTR_CHAR ) 540cdf0e10cSrcweir { 541cdf0e10cSrcweir // Impress-Textobjekt wird erzeugt (faellt auf Zeilenhoehe zusammen) 542cdf0e10cSrcweir // Damit das Objekt beim anschliessenden Erzeugen gleich die richtige 543cdf0e10cSrcweir // Hoehe bekommt (sonst wird zuviel gepainted) 544cdf0e10cSrcweir SfxItemSet aSet(mpViewShell->GetPool()); 545cdf0e10cSrcweir aSet.Put(SdrTextMinFrameHeightItem(0)); 546cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowWidthItem(sal_False)); 547cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowHeightItem(sal_True)); 548cdf0e10cSrcweir pTxtObj->SetMergedItemSet(aSet); 549cdf0e10cSrcweir pTxtObj->AdjustTextFrameWidthAndHeight(); 550cdf0e10cSrcweir aSet.Put(SdrTextMaxFrameHeightItem(pTxtObj->GetLogicRect().GetSize().Height())); 551cdf0e10cSrcweir pTxtObj->SetMergedItemSet(aSet); 552cdf0e10cSrcweir } 553cdf0e10cSrcweir else if( nSlotId == SID_ATTR_CHAR_VERTICAL ) 554cdf0e10cSrcweir { 555cdf0e10cSrcweir SfxItemSet aSet(mpViewShell->GetPool()); 556cdf0e10cSrcweir aSet.Put(SdrTextMinFrameWidthItem(0)); 557cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowWidthItem(sal_True)); 558cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowHeightItem(sal_False)); 559cdf0e10cSrcweir 560cdf0e10cSrcweir // #91853# Needs to be set since default is SDRTEXTHORZADJUST_BLOCK 561cdf0e10cSrcweir aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); 562cdf0e10cSrcweir pTxtObj->SetMergedItemSet(aSet); 563cdf0e10cSrcweir pTxtObj->AdjustTextFrameWidthAndHeight(); 564cdf0e10cSrcweir aSet.Put(SdrTextMaxFrameWidthItem(pTxtObj->GetLogicRect().GetSize().Width())); 565cdf0e10cSrcweir pTxtObj->SetMergedItemSet(aSet); 566cdf0e10cSrcweir } 567cdf0e10cSrcweir } 568cdf0e10cSrcweir else 569cdf0e10cSrcweir { 570cdf0e10cSrcweir if( nSlotId == SID_ATTR_CHAR_VERTICAL ) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir // draw text object, needs to be initialized when vertical text is used 573cdf0e10cSrcweir SfxItemSet aSet(mpViewShell->GetPool()); 574cdf0e10cSrcweir 575cdf0e10cSrcweir // #91510# 576cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowWidthItem(sal_True)); 577cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowHeightItem(sal_False)); 578cdf0e10cSrcweir 579cdf0e10cSrcweir // #91508# 580cdf0e10cSrcweir //aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); 581cdf0e10cSrcweir //aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); 582cdf0e10cSrcweir 583cdf0e10cSrcweir // #107235# 584cdf0e10cSrcweir // Set defaults for vertical klick-n'drag text object, pool defaults are: 585cdf0e10cSrcweir // SdrTextVertAdjustItem: SDRTEXTVERTADJUST_TOP 586cdf0e10cSrcweir // SdrTextHorzAdjustItem: SDRTEXTHORZADJUST_BLOCK 587cdf0e10cSrcweir // Analog to that (thus, #91508# was not completely correct): 588cdf0e10cSrcweir aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK)); 589cdf0e10cSrcweir aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); 590cdf0e10cSrcweir 591cdf0e10cSrcweir pTxtObj->SetMergedItemSet(aSet); 592cdf0e10cSrcweir } 593cdf0e10cSrcweir } 594cdf0e10cSrcweir } 595cdf0e10cSrcweir 596cdf0e10cSrcweir // #97016# 597cdf0e10cSrcweir void FuText::ImpSetAttributesFitToSize(SdrTextObj* pTxtObj) 598cdf0e10cSrcweir { 599cdf0e10cSrcweir // FitToSize (An Rahmen anpassen) 600cdf0e10cSrcweir SfxItemSet aSet(mpViewShell->GetPool(), SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWWIDTH); 60126734c99SArmin Le Grand SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL; 60226734c99SArmin Le Grand aSet.Put(SdrTextFitToSizeTypeItem(eFTS)); 603cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowHeightItem(sal_False)); 604cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowWidthItem(sal_False)); 605cdf0e10cSrcweir pTxtObj->SetMergedItemSet(aSet); 606cdf0e10cSrcweir pTxtObj->AdjustTextFrameWidthAndHeight(); 607cdf0e10cSrcweir } 608cdf0e10cSrcweir 609cdf0e10cSrcweir // #97016# 610cdf0e10cSrcweir void FuText::ImpSetAttributesFitToSizeVertical(SdrTextObj* pTxtObj) 611cdf0e10cSrcweir { 61226734c99SArmin Le Grand SfxItemSet aSet(mpViewShell->GetPool(), 61326734c99SArmin Le Grand SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWWIDTH); 61426734c99SArmin Le Grand SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL; 61526734c99SArmin Le Grand aSet.Put(SdrTextFitToSizeTypeItem(eFTS)); 616cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowHeightItem(sal_False)); 617cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowWidthItem(sal_False)); 618cdf0e10cSrcweir pTxtObj->SetMergedItemSet(aSet); 619cdf0e10cSrcweir pTxtObj->AdjustTextFrameWidthAndHeight(); 620cdf0e10cSrcweir } 621cdf0e10cSrcweir 622cdf0e10cSrcweir // #97016# 623cdf0e10cSrcweir void FuText::ImpSetAttributesFitCommon(SdrTextObj* pTxtObj) 624cdf0e10cSrcweir { 625cdf0e10cSrcweir // Normales Textobjekt 626cdf0e10cSrcweir if (mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir if( nSlotId == SID_ATTR_CHAR ) 629cdf0e10cSrcweir { 630cdf0e10cSrcweir // Impress-Textobjekt (faellt auf Zeilenhoehe zusammen) 631cdf0e10cSrcweir SfxItemSet aSet(mpViewShell->GetPool()); 632cdf0e10cSrcweir aSet.Put(SdrTextMinFrameHeightItem(0)); 633cdf0e10cSrcweir aSet.Put(SdrTextMaxFrameHeightItem(0)); 634cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowHeightItem(sal_True)); 635cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowWidthItem(sal_False)); 636cdf0e10cSrcweir pTxtObj->SetMergedItemSet(aSet); 637cdf0e10cSrcweir } 638cdf0e10cSrcweir else if( nSlotId == SID_ATTR_CHAR_VERTICAL ) 639cdf0e10cSrcweir { 640cdf0e10cSrcweir SfxItemSet aSet(mpViewShell->GetPool()); 641cdf0e10cSrcweir aSet.Put(SdrTextMinFrameWidthItem(0)); 642cdf0e10cSrcweir aSet.Put(SdrTextMaxFrameWidthItem(0)); 643cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowWidthItem(sal_True)); 644cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowHeightItem(sal_False)); 645cdf0e10cSrcweir pTxtObj->SetMergedItemSet(aSet); 646cdf0e10cSrcweir } 647cdf0e10cSrcweir 648cdf0e10cSrcweir pTxtObj->AdjustTextFrameWidthAndHeight(); 649cdf0e10cSrcweir } 650cdf0e10cSrcweir } 651cdf0e10cSrcweir 652cdf0e10cSrcweir sal_Bool FuText::MouseButtonUp(const MouseEvent& rMEvt) 653cdf0e10cSrcweir { 654cdf0e10cSrcweir sal_Bool bReturn = sal_False; 655cdf0e10cSrcweir 656cdf0e10cSrcweir if (aDragTimer.IsActive()) 657cdf0e10cSrcweir { 658cdf0e10cSrcweir aDragTimer.Stop(); 659cdf0e10cSrcweir bIsInDragMode = sal_False; 660cdf0e10cSrcweir } 661cdf0e10cSrcweir 662cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray ); 663cdf0e10cSrcweir 664cdf0e10cSrcweir Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); 665cdf0e10cSrcweir 666cdf0e10cSrcweir if( (mpView && mpView->MouseButtonUp(rMEvt, mpWindow)) || rMEvt.GetClicks() == 2 ) 667cdf0e10cSrcweir return (sal_True); // Event von der SdrView ausgewertet 668cdf0e10cSrcweir 669cdf0e10cSrcweir sal_Bool bEmptyTextObj = sal_False; 670cdf0e10cSrcweir 671cdf0e10cSrcweir if (mxTextObj.is()) 672cdf0e10cSrcweir { 673cdf0e10cSrcweir const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 674cdf0e10cSrcweir 675cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1 676cdf0e10cSrcweir && ( rMarkList.GetMark(0)->GetMarkedSdrObj() == mxTextObj.get()) ) 677cdf0e10cSrcweir { 678cdf0e10cSrcweir if( mxTextObj.is() && !GetTextObj()->GetOutlinerParaObject() ) 679cdf0e10cSrcweir bEmptyTextObj = sal_True; 680cdf0e10cSrcweir else 681cdf0e10cSrcweir bFirstObjCreated = sal_True; 682cdf0e10cSrcweir } 683cdf0e10cSrcweir else 684cdf0e10cSrcweir { 685cdf0e10cSrcweir mxTextObj.reset( 0 ); 686cdf0e10cSrcweir } 687cdf0e10cSrcweir } 688cdf0e10cSrcweir 689cdf0e10cSrcweir if( mpView && mpView->IsDragObj()) 690cdf0e10cSrcweir { 691cdf0e10cSrcweir /********************************************************************** 692cdf0e10cSrcweir * Objekt wurde verschoben 693cdf0e10cSrcweir **********************************************************************/ 694cdf0e10cSrcweir FrameView* pFrameView = mpViewShell->GetFrameView(); 695cdf0e10cSrcweir sal_Bool bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy()); 696cdf0e10cSrcweir 697cdf0e10cSrcweir if (bDragWithCopy) 698cdf0e10cSrcweir { 699cdf0e10cSrcweir bDragWithCopy = !mpView->IsPresObjSelected(sal_False, sal_True); 700cdf0e10cSrcweir } 701cdf0e10cSrcweir 702cdf0e10cSrcweir mpView->SetDragWithCopy(bDragWithCopy); 703cdf0e10cSrcweir mpView->EndDragObj( mpView->IsDragWithCopy() ); 704cdf0e10cSrcweir mpView->ForceMarkedToAnotherPage(); 705cdf0e10cSrcweir mpView->SetCurrentObj(OBJ_TEXT); 706cdf0e10cSrcweir 707cdf0e10cSrcweir sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() ); 708cdf0e10cSrcweir 709cdf0e10cSrcweir if ( mpView->IsRotateAllowed() && mpViewShell->GetFrameView()->IsClickChangeRotation() && (rMEvt.GetClicks() != 2) && 710cdf0e10cSrcweir !rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsRight() && 711cdf0e10cSrcweir Abs(aPnt.X() - aMDPos.X()) < nDrgLog && 712cdf0e10cSrcweir Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog) 713cdf0e10cSrcweir { 714cdf0e10cSrcweir // toggle to rotation mode 715cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_ROTATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); 716cdf0e10cSrcweir } 717cdf0e10cSrcweir } 718cdf0e10cSrcweir else if( mpView && mpView->IsCreateObj() && rMEvt.IsLeft()) 719cdf0e10cSrcweir { 720cdf0e10cSrcweir /********************************************************************** 721cdf0e10cSrcweir * Objekt wurde erzeugt 722cdf0e10cSrcweir **********************************************************************/ 723cdf0e10cSrcweir mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetCreateObj() ) ); 724cdf0e10cSrcweir 725cdf0e10cSrcweir if( mxTextObj.is() ) 726cdf0e10cSrcweir { 727cdf0e10cSrcweir //AW outliner needs to be set to vertical when there is no 728cdf0e10cSrcweir // outliner object up to now; also it needs to be set back to not 729cdf0e10cSrcweir // vertical when there was a vertical one used last time. 730cdf0e10cSrcweir OutlinerParaObject* pOPO = GetTextObj()->GetOutlinerParaObject(); 731cdf0e10cSrcweir SdrOutliner& rOutl = mxTextObj->GetModel()->GetDrawOutliner(GetTextObj()); 732cdf0e10cSrcweir sal_Bool bVertical((pOPO && pOPO->IsVertical()) 733cdf0e10cSrcweir || nSlotId == SID_ATTR_CHAR_VERTICAL 734cdf0e10cSrcweir || nSlotId == SID_TEXT_FITTOSIZE_VERTICAL); 735cdf0e10cSrcweir rOutl.SetVertical(bVertical); 736cdf0e10cSrcweir 737cdf0e10cSrcweir // #107235# 738cdf0e10cSrcweir // Before ImpSetAttributesForNewTextObject the vertical writing mode 739cdf0e10cSrcweir // needs to be set at the object. This is done here at the OutlinerParaObject 740cdf0e10cSrcweir // directly to not mirror the layout text items involved. These items will be set 741cdf0e10cSrcweir // from ImpSetAttributesForNewTextObject and below. 742cdf0e10cSrcweir OutlinerParaObject* pPara = GetTextObj()->GetOutlinerParaObject(); 743cdf0e10cSrcweir 744cdf0e10cSrcweir if(!pPara) 745cdf0e10cSrcweir { 746cdf0e10cSrcweir GetTextObj()->ForceOutlinerParaObject(); 747cdf0e10cSrcweir pPara = GetTextObj()->GetOutlinerParaObject(); 748cdf0e10cSrcweir } 749cdf0e10cSrcweir 750cdf0e10cSrcweir if(pPara && (bool)bVertical != pPara->IsVertical()) 751cdf0e10cSrcweir { 752cdf0e10cSrcweir // set ParaObject orientation accordingly 753cdf0e10cSrcweir pPara->SetVertical(bVertical); 754cdf0e10cSrcweir } 755cdf0e10cSrcweir 756cdf0e10cSrcweir // #97016# 757cdf0e10cSrcweir ImpSetAttributesForNewTextObject(GetTextObj()); 758cdf0e10cSrcweir } 759cdf0e10cSrcweir 760cdf0e10cSrcweir if (!mpView->EndCreateObj(SDRCREATE_FORCEEND)) 761cdf0e10cSrcweir { 762cdf0e10cSrcweir // Textobjekt konnte nicht erzeugt werden 763cdf0e10cSrcweir mxTextObj.reset(0); 764cdf0e10cSrcweir } 765cdf0e10cSrcweir else if (nSlotId == SID_TEXT_FITTOSIZE) 766cdf0e10cSrcweir { 767cdf0e10cSrcweir // #97016# 768cdf0e10cSrcweir ImpSetAttributesFitToSize(GetTextObj()); 769cdf0e10cSrcweir 770cdf0e10cSrcweir SetInEditMode(rMEvt, sal_False); 771cdf0e10cSrcweir } 772cdf0e10cSrcweir else if ( nSlotId == SID_TEXT_FITTOSIZE_VERTICAL ) 773cdf0e10cSrcweir { 774cdf0e10cSrcweir // #97016# 775cdf0e10cSrcweir ImpSetAttributesFitToSizeVertical(GetTextObj()); 776cdf0e10cSrcweir 777cdf0e10cSrcweir SetInEditMode(rMEvt, sal_False); 778cdf0e10cSrcweir } 779cdf0e10cSrcweir else 780cdf0e10cSrcweir { 781cdf0e10cSrcweir // #97016# 782cdf0e10cSrcweir ImpSetAttributesFitCommon(GetTextObj()); 783cdf0e10cSrcweir 784cdf0e10cSrcweir // Damit die Handles und der graue Rahmen stimmen 785cdf0e10cSrcweir mpView->AdjustMarkHdl(); 786cdf0e10cSrcweir mpView->PickHandle(aPnt); 787cdf0e10cSrcweir SetInEditMode(rMEvt, sal_False); 788cdf0e10cSrcweir } 789cdf0e10cSrcweir } 790cdf0e10cSrcweir else if ( mpView && mpView->IsAction()) 791cdf0e10cSrcweir { 792cdf0e10cSrcweir mpView->EndAction(); 793cdf0e10cSrcweir } 794cdf0e10cSrcweir 795cdf0e10cSrcweir ForcePointer(&rMEvt); 796cdf0e10cSrcweir mpWindow->ReleaseMouse(); 797cdf0e10cSrcweir sal_uInt16 nDrgLog1 = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() ); 798cdf0e10cSrcweir 799cdf0e10cSrcweir if ( mpView && !mpView->AreObjectsMarked() && 800cdf0e10cSrcweir Abs(aMDPos.X() - aPnt.X()) < nDrgLog1 && 801cdf0e10cSrcweir Abs(aMDPos.Y() - aPnt.Y()) < nDrgLog1 && 802cdf0e10cSrcweir !rMEvt.IsShift() && !rMEvt.IsMod2() ) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir SdrPageView* pPV = mpView->GetSdrPageView(); 805cdf0e10cSrcweir SdrViewEvent aVEvt; 806cdf0e10cSrcweir mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 807cdf0e10cSrcweir mpView->MarkObj(aVEvt.pRootObj, pPV); 808cdf0e10cSrcweir } 809cdf0e10cSrcweir 810cdf0e10cSrcweir if ( !mxTextObj.is() && mpView ) 811cdf0e10cSrcweir { 812cdf0e10cSrcweir if ( ( (!bEmptyTextObj && bPermanent) || 813cdf0e10cSrcweir (!bFirstObjCreated && !bPermanent) ) && 814cdf0e10cSrcweir !mpDocSh->IsReadOnly() && 815cdf0e10cSrcweir nSlotId != SID_TEXTEDIT ) 816cdf0e10cSrcweir { 817cdf0e10cSrcweir /********************************************************************** 818cdf0e10cSrcweir * Mengentext (linksbuendiges AutoGrow) 819cdf0e10cSrcweir **********************************************************************/ 820cdf0e10cSrcweir mpView->SetCurrentObj(OBJ_TEXT); 821cdf0e10cSrcweir mpView->SetEditMode(SDREDITMODE_CREATE); 822cdf0e10cSrcweir sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() ); 823cdf0e10cSrcweir mpView->BegCreateObj(aMDPos, (OutputDevice*) NULL, nDrgLog); 824cdf0e10cSrcweir 825cdf0e10cSrcweir sal_Bool bSnapEnabled = mpView->IsSnapEnabled(); 826cdf0e10cSrcweir 827cdf0e10cSrcweir if (bSnapEnabled) 828cdf0e10cSrcweir mpView->SetSnapEnabled(sal_False); 829cdf0e10cSrcweir 830cdf0e10cSrcweir aPnt.X() += nDrgLog + nDrgLog; 831cdf0e10cSrcweir aPnt.Y() += nDrgLog + nDrgLog; 832cdf0e10cSrcweir mpView->MovAction(aPnt); 833cdf0e10cSrcweir 834cdf0e10cSrcweir mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetCreateObj() ) ); 835cdf0e10cSrcweir 836cdf0e10cSrcweir if(mxTextObj.is()) 837cdf0e10cSrcweir { 838cdf0e10cSrcweir GetTextObj()->SetDisableAutoWidthOnDragging(sal_True); 839cdf0e10cSrcweir } 840cdf0e10cSrcweir 841cdf0e10cSrcweir if(!mpView->EndCreateObj(SDRCREATE_FORCEEND)) 842cdf0e10cSrcweir { 843cdf0e10cSrcweir mxTextObj.reset(0); 844cdf0e10cSrcweir } 845cdf0e10cSrcweir 846cdf0e10cSrcweir if(bSnapEnabled) 847cdf0e10cSrcweir mpView->SetSnapEnabled(bSnapEnabled); 848cdf0e10cSrcweir 849cdf0e10cSrcweir if(mxTextObj.is()) 850cdf0e10cSrcweir { 851cdf0e10cSrcweir SfxItemSet aSet(mpViewShell->GetPool()); 852cdf0e10cSrcweir aSet.Put(SdrTextMinFrameHeightItem(0)); 853cdf0e10cSrcweir aSet.Put(SdrTextMinFrameWidthItem(0)); 854cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowHeightItem(sal_True)); 855cdf0e10cSrcweir aSet.Put(SdrTextAutoGrowWidthItem(sal_True)); 856cdf0e10cSrcweir 857cdf0e10cSrcweir // #91508# 858cdf0e10cSrcweir if(nSlotId == SID_ATTR_CHAR_VERTICAL) 859cdf0e10cSrcweir { 860cdf0e10cSrcweir // #107235# 861cdf0e10cSrcweir // 862cdf0e10cSrcweir // Here, all items which need to be different from pool default need to be set 863cdf0e10cSrcweir // again on the newly created text object. 864cdf0e10cSrcweir // Since this is a simple klick text object, it is first created, then SetVertical() 865cdf0e10cSrcweir // is used, then ImpSetAttributesForNewTextObject is called and then the object is 866cdf0e10cSrcweir // deleted again since not the minimum drag distance was travelled. Then, a new 867cdf0e10cSrcweir // klick text object is created and thus all that stuff needs to be set again here. 868cdf0e10cSrcweir // 869cdf0e10cSrcweir // Before using the new object the vertical writing mode 870cdf0e10cSrcweir // needs to be set. This is done here at the OutlinerParaObject 871cdf0e10cSrcweir // directly to not mirror the layout text items involved. These items will be set 872cdf0e10cSrcweir // below. 873cdf0e10cSrcweir OutlinerParaObject* pPara = GetTextObj()->GetOutlinerParaObject(); 874cdf0e10cSrcweir 875cdf0e10cSrcweir if(!pPara) 876cdf0e10cSrcweir { 877cdf0e10cSrcweir GetTextObj()->ForceOutlinerParaObject(); 878cdf0e10cSrcweir pPara = GetTextObj()->GetOutlinerParaObject(); 879cdf0e10cSrcweir } 880cdf0e10cSrcweir 881cdf0e10cSrcweir if(pPara && sal_True != pPara->IsVertical()) 882cdf0e10cSrcweir { 883cdf0e10cSrcweir // set ParaObject orientation accordingly 884cdf0e10cSrcweir pPara->SetVertical(sal_True); 885cdf0e10cSrcweir } 886cdf0e10cSrcweir 887cdf0e10cSrcweir // #91508# 888cdf0e10cSrcweir // aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); 889cdf0e10cSrcweir aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); 890cdf0e10cSrcweir 891cdf0e10cSrcweir // #107235# 892cdf0e10cSrcweir // Analog to the else case below, for vertical simple click texts 893cdf0e10cSrcweir // one of the defaulted setted items from ImpSetAttributesForNewTextObject 894cdf0e10cSrcweir // needs to be adapted to non-block mode. This could have been done with the 895cdf0e10cSrcweir // #104122#, but was obviously overseen. 896cdf0e10cSrcweir const SfxItemSet& rSet = mpView->GetDefaultAttr(); 897cdf0e10cSrcweir SvxFrameDirection eDirection = (SvxFrameDirection)((SvxFrameDirectionItem&)rSet.Get(EE_PARA_WRITINGDIR)).GetValue(); 898cdf0e10cSrcweir 899cdf0e10cSrcweir if(FRMDIR_HORI_RIGHT_TOP == eDirection || FRMDIR_VERT_TOP_RIGHT == eDirection) 900cdf0e10cSrcweir { 901cdf0e10cSrcweir aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM)); 902cdf0e10cSrcweir } 903cdf0e10cSrcweir else 904cdf0e10cSrcweir { 905cdf0e10cSrcweir aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); 906cdf0e10cSrcweir } 907cdf0e10cSrcweir } 908cdf0e10cSrcweir else 909cdf0e10cSrcweir { 910cdf0e10cSrcweir // #104122# This is for Format/Page settings. Since this also leads 911cdf0e10cSrcweir // to the object defaults to be changed, i think this code can be 912cdf0e10cSrcweir // removed. CL. wanted to take a look before adding this. 913cdf0e10cSrcweir //const SdrTextHorzAdjust eHA = ( ( pDoc && pDoc->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB ) ? 914cdf0e10cSrcweir // SDRTEXTHORZADJUST_RIGHT : SDRTEXTHORZADJUST_LEFT ); 915cdf0e10cSrcweir //aSet.Put( SdrTextHorzAdjustItem( eHA ) ); 916cdf0e10cSrcweir 917cdf0e10cSrcweir // #104122# Look in the object defaults if left-to-right is wanted. If 918cdf0e10cSrcweir // yes, set text anchoring to right to let the box grow to left. 919cdf0e10cSrcweir const SfxItemSet& rSet = mpView->GetDefaultAttr(); 920cdf0e10cSrcweir SvxFrameDirection eDirection = (SvxFrameDirection)((SvxFrameDirectionItem&)rSet.Get(EE_PARA_WRITINGDIR)).GetValue(); 921cdf0e10cSrcweir 922cdf0e10cSrcweir if(FRMDIR_HORI_RIGHT_TOP == eDirection) 923cdf0e10cSrcweir { 924cdf0e10cSrcweir aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); 925cdf0e10cSrcweir } 926cdf0e10cSrcweir else 927cdf0e10cSrcweir { 928cdf0e10cSrcweir aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); 929cdf0e10cSrcweir } 930cdf0e10cSrcweir } 931cdf0e10cSrcweir 932cdf0e10cSrcweir GetTextObj()->SetMergedItemSet(aSet); 933cdf0e10cSrcweir GetTextObj()->SetDisableAutoWidthOnDragging(sal_True); 934cdf0e10cSrcweir SetInEditMode(rMEvt, sal_False); 935cdf0e10cSrcweir } 936cdf0e10cSrcweir 937cdf0e10cSrcweir bFirstObjCreated = sal_True; 938cdf0e10cSrcweir } 939cdf0e10cSrcweir else 940cdf0e10cSrcweir { 941cdf0e10cSrcweir // In die Fkt. Selektion wechseln 942cdf0e10cSrcweir if (mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED) 943cdf0e10cSrcweir { 944cdf0e10cSrcweir mxTextObj.reset(0); 945cdf0e10cSrcweir } 946cdf0e10cSrcweir 947cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT, 948cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); 949cdf0e10cSrcweir } 950cdf0e10cSrcweir } 951cdf0e10cSrcweir 952cdf0e10cSrcweir bMBDown = sal_False; 953cdf0e10cSrcweir FuConstruct::MouseButtonUp(rMEvt); 954cdf0e10cSrcweir return (bReturn); 955cdf0e10cSrcweir } 956cdf0e10cSrcweir 957cdf0e10cSrcweir /************************************************************************* 958cdf0e10cSrcweir |* 959cdf0e10cSrcweir |* Tastaturereignisse bearbeiten 960cdf0e10cSrcweir |* 961cdf0e10cSrcweir |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls 962cdf0e10cSrcweir |* sal_False. 963cdf0e10cSrcweir |* 964cdf0e10cSrcweir \************************************************************************/ 965cdf0e10cSrcweir 966cdf0e10cSrcweir sal_Bool FuText::KeyInput(const KeyEvent& rKEvt) 967cdf0e10cSrcweir { 968cdf0e10cSrcweir sal_Bool bReturn = sal_False; 969cdf0e10cSrcweir mpView->SetMarkHdlWhenTextEdit(sal_True); 970cdf0e10cSrcweir 971cdf0e10cSrcweir KeyCode nCode = rKEvt.GetKeyCode(); 972cdf0e10cSrcweir sal_Bool bShift = nCode.IsShift(); 973cdf0e10cSrcweir 974cdf0e10cSrcweir // #97016# IV 975cdf0e10cSrcweir if(mxTextObj.is()) 976cdf0e10cSrcweir { 977cdf0e10cSrcweir // maybe object is deleted, test if it's equal to the selected object 978cdf0e10cSrcweir const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 979cdf0e10cSrcweir SdrObject* pSelectedObj = 0L; 980cdf0e10cSrcweir 981cdf0e10cSrcweir if(1 == rMarkList.GetMarkCount()) 982cdf0e10cSrcweir { 983cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 984cdf0e10cSrcweir pSelectedObj = pMark->GetMarkedSdrObj(); 985cdf0e10cSrcweir } 986cdf0e10cSrcweir 987cdf0e10cSrcweir if(mxTextObj.get() != pSelectedObj) 988cdf0e10cSrcweir { 989cdf0e10cSrcweir mxTextObj.reset(0); 990cdf0e10cSrcweir } 991cdf0e10cSrcweir } 992cdf0e10cSrcweir 993cdf0e10cSrcweir if ( mxTextObj.is() && mxTextObj->GetObjInventor() == SdrInventor && mxTextObj->GetObjIdentifier() == OBJ_TITLETEXT && rKEvt.GetKeyCode().GetCode() == KEY_RETURN ) 994cdf0e10cSrcweir { 995cdf0e10cSrcweir // Titeltext-Objekt: immer "weiche" Umbrueche 996cdf0e10cSrcweir bShift = sal_True; 997cdf0e10cSrcweir } 998cdf0e10cSrcweir 999cdf0e10cSrcweir sal_uInt16 nKey = nCode.GetCode(); 1000cdf0e10cSrcweir KeyCode aKeyCode (nKey, bShift, nCode.IsMod1(), nCode.IsMod2(), nCode.IsMod3() ); 1001cdf0e10cSrcweir KeyEvent aKEvt(rKEvt.GetCharCode(), aKeyCode); 1002cdf0e10cSrcweir 1003cdf0e10cSrcweir sal_Bool bOK = sal_True; 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir if (mpDocSh->IsReadOnly()) 1006cdf0e10cSrcweir { 1007cdf0e10cSrcweir bOK = !EditEngine::DoesKeyChangeText(aKEvt); 1008cdf0e10cSrcweir } 1009cdf0e10cSrcweir if( aKeyCode.GetCode() == KEY_PAGEUP || aKeyCode.GetCode() == KEY_PAGEDOWN ) 1010cdf0e10cSrcweir { 1011cdf0e10cSrcweir bOK = sal_False; // default handling in base class 1012cdf0e10cSrcweir } 1013cdf0e10cSrcweir 1014cdf0e10cSrcweir if (bOK && mpView->KeyInput(aKEvt, mpWindow) ) 1015cdf0e10cSrcweir { 1016cdf0e10cSrcweir bReturn = sal_True; 1017cdf0e10cSrcweir 1018cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray ); 1019cdf0e10cSrcweir 1020cdf0e10cSrcweir // if ( pTextObj ) 1021cdf0e10cSrcweir // pTextObj->SetEmptyPresObj(sal_False); 1022cdf0e10cSrcweir } 1023cdf0e10cSrcweir else if (aKeyCode == KEY_ESCAPE) 1024cdf0e10cSrcweir { 1025cdf0e10cSrcweir bReturn = cancel(); 1026cdf0e10cSrcweir } 1027cdf0e10cSrcweir 1028cdf0e10cSrcweir if( bPermanent ) 1029cdf0e10cSrcweir { 1030cdf0e10cSrcweir mpView->SetCurrentObj(OBJ_TEXT); 1031cdf0e10cSrcweir mpView->SetEditMode(SDREDITMODE_CREATE); 1032cdf0e10cSrcweir } 1033cdf0e10cSrcweir 1034cdf0e10cSrcweir if (!bReturn) 1035cdf0e10cSrcweir { 1036cdf0e10cSrcweir bReturn = FuDraw::KeyInput(aKEvt); 1037cdf0e10cSrcweir } 1038cdf0e10cSrcweir 1039cdf0e10cSrcweir return (bReturn); 1040cdf0e10cSrcweir } 1041cdf0e10cSrcweir 1042cdf0e10cSrcweir 1043cdf0e10cSrcweir 1044cdf0e10cSrcweir /************************************************************************* 1045cdf0e10cSrcweir |* 1046cdf0e10cSrcweir |* Function aktivieren 1047cdf0e10cSrcweir |* 1048cdf0e10cSrcweir \************************************************************************/ 1049cdf0e10cSrcweir 1050cdf0e10cSrcweir void FuText::Activate() 1051cdf0e10cSrcweir { 1052cdf0e10cSrcweir mpView->SetQuickTextEditMode(mpViewShell->GetFrameView()->IsQuickEdit()); 1053cdf0e10cSrcweir 1054cdf0e10cSrcweir // #i89661# it's no longer necessary to make it so big here, it's fine tuned 1055cdf0e10cSrcweir // for text objects in SdrMarkView::CheckSingleSdrObjectHit 1056cdf0e10cSrcweir mpView->SetHitTolerancePixel( 2 * HITPIX ); 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); 1059cdf0e10cSrcweir 1060cdf0e10cSrcweir if (pOLV) 1061cdf0e10cSrcweir pOLV->ShowCursor(); 1062cdf0e10cSrcweir 1063cdf0e10cSrcweir FuConstruct::Activate(); 1064cdf0e10cSrcweir 1065cdf0e10cSrcweir if( pOLV ) 1066cdf0e10cSrcweir mpView->SetEditMode(SDREDITMODE_EDIT); 1067cdf0e10cSrcweir } 1068cdf0e10cSrcweir 1069cdf0e10cSrcweir 1070cdf0e10cSrcweir /************************************************************************* 1071cdf0e10cSrcweir |* 1072cdf0e10cSrcweir |* Function deaktivieren 1073cdf0e10cSrcweir |* 1074cdf0e10cSrcweir \************************************************************************/ 1075cdf0e10cSrcweir 1076cdf0e10cSrcweir void FuText::Deactivate() 1077cdf0e10cSrcweir { 1078cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); 1079cdf0e10cSrcweir 1080cdf0e10cSrcweir if (pOLV) 1081cdf0e10cSrcweir pOLV->HideCursor(); 1082cdf0e10cSrcweir 1083cdf0e10cSrcweir mpView->SetHitTolerancePixel( HITPIX ); 1084cdf0e10cSrcweir 1085cdf0e10cSrcweir FuConstruct::Deactivate(); 1086cdf0e10cSrcweir } 1087cdf0e10cSrcweir 1088cdf0e10cSrcweir 1089cdf0e10cSrcweir /************************************************************************* 1090cdf0e10cSrcweir |* 1091cdf0e10cSrcweir |* Objekt in Edit-Mode setzen 1092cdf0e10cSrcweir |* 1093cdf0e10cSrcweir \************************************************************************/ 1094cdf0e10cSrcweir 1095cdf0e10cSrcweir void FuText::SetInEditMode(const MouseEvent& rMEvt, sal_Bool bQuickDrag) 1096cdf0e10cSrcweir { 1097cdf0e10cSrcweir SdrPageView* pPV = mpView->GetSdrPageView(); 1098cdf0e10cSrcweir if( mxTextObj.is() && (mxTextObj->GetPage() == pPV->GetPage()) ) 1099cdf0e10cSrcweir { 1100cdf0e10cSrcweir mpView->SetCurrentObj(OBJ_TEXT); 1101cdf0e10cSrcweir 1102cdf0e10cSrcweir if( bPermanent ) 1103cdf0e10cSrcweir mpView->SetEditMode(SDREDITMODE_CREATE); 1104cdf0e10cSrcweir else 1105cdf0e10cSrcweir mpView->SetEditMode(SDREDITMODE_EDIT); 1106cdf0e10cSrcweir 1107cdf0e10cSrcweir sal_Bool bEmptyOutliner = sal_False; 1108cdf0e10cSrcweir 1109cdf0e10cSrcweir if (!GetTextObj()->GetOutlinerParaObject() && mpView->GetTextEditOutliner()) 1110cdf0e10cSrcweir { 1111cdf0e10cSrcweir ::Outliner* pOutl = mpView->GetTextEditOutliner(); 1112cdf0e10cSrcweir sal_uLong nParaAnz = pOutl->GetParagraphCount(); 1113cdf0e10cSrcweir Paragraph* p1stPara = pOutl->GetParagraph( 0 ); 1114cdf0e10cSrcweir 1115cdf0e10cSrcweir if (nParaAnz==1 && p1stPara) 1116cdf0e10cSrcweir { 1117cdf0e10cSrcweir // Bei nur einem Pararaph 1118cdf0e10cSrcweir if (pOutl->GetText(p1stPara).Len() == 0) 1119cdf0e10cSrcweir { 1120cdf0e10cSrcweir bEmptyOutliner = sal_True; 1121cdf0e10cSrcweir } 1122cdf0e10cSrcweir } 1123cdf0e10cSrcweir } 1124cdf0e10cSrcweir 1125cdf0e10cSrcweir if (GetTextObj() != mpView->GetTextEditObject() || bEmptyOutliner) 1126cdf0e10cSrcweir { 1127cdf0e10cSrcweir sal_uInt32 nInv = mxTextObj->GetObjInventor(); 1128cdf0e10cSrcweir sal_uInt16 nSdrObjKind = mxTextObj->GetObjIdentifier(); 1129cdf0e10cSrcweir 1130cdf0e10cSrcweir if (nInv == SdrInventor && GetTextObj()->HasTextEdit() && 1131cdf0e10cSrcweir (nSdrObjKind == OBJ_TEXT || 1132cdf0e10cSrcweir nSdrObjKind == OBJ_TITLETEXT || 1133cdf0e10cSrcweir nSdrObjKind == OBJ_OUTLINETEXT || !mxTextObj->IsEmptyPresObj() ) ) 1134cdf0e10cSrcweir { 1135cdf0e10cSrcweir // Neuen Outliner machen (gehoert der SdrObjEditView) 1136cdf0e10cSrcweir SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpDoc ); 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir if (bEmptyOutliner) 1139cdf0e10cSrcweir mpView->SdrEndTextEdit(sal_True); 1140cdf0e10cSrcweir 1141cdf0e10cSrcweir SdrTextObj* pTextObj = GetTextObj(); 1142cdf0e10cSrcweir if( pTextObj ) 1143cdf0e10cSrcweir { 1144cdf0e10cSrcweir OutlinerParaObject* pOPO = pTextObj->GetOutlinerParaObject(); 1145cdf0e10cSrcweir if( ( pOPO && pOPO->IsVertical() ) || (nSlotId == SID_ATTR_CHAR_VERTICAL) || (nSlotId == SID_TEXT_FITTOSIZE_VERTICAL) ) 1146cdf0e10cSrcweir pOutl->SetVertical( sal_True ); 1147cdf0e10cSrcweir 1148cdf0e10cSrcweir if( pTextObj->getTextCount() > 1 ) 1149cdf0e10cSrcweir { 1150cdf0e10cSrcweir Point aPix(rMEvt.GetPosPixel()); 1151cdf0e10cSrcweir Point aPnt(mpWindow->PixelToLogic(aPix)); 1152cdf0e10cSrcweir pTextObj->setActiveText( pTextObj->CheckTextHit(aPnt ) ); 1153cdf0e10cSrcweir } 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir if (mpView->SdrBeginTextEdit(pTextObj, pPV, mpWindow, sal_True, pOutl) && mxTextObj->GetObjInventor() == SdrInventor) 1156cdf0e10cSrcweir { 1157cdf0e10cSrcweir bFirstObjCreated = sal_True; 1158cdf0e10cSrcweir DeleteDefaultText(); 1159cdf0e10cSrcweir 1160cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); 1161cdf0e10cSrcweir 1162cdf0e10cSrcweir nSdrObjKind = mxTextObj->GetObjIdentifier(); 1163cdf0e10cSrcweir 1164cdf0e10cSrcweir SdrViewEvent aVEvt; 1165cdf0e10cSrcweir SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 1166cdf0e10cSrcweir 1167cdf0e10cSrcweir if (eHit == SDRHIT_TEXTEDIT) 1168cdf0e10cSrcweir { 1169cdf0e10cSrcweir // Text getroffen 1170cdf0e10cSrcweir if (nSdrObjKind == OBJ_TEXT || 1171cdf0e10cSrcweir nSdrObjKind == OBJ_TITLETEXT || 1172cdf0e10cSrcweir nSdrObjKind == OBJ_OUTLINETEXT || 1173cdf0e10cSrcweir nSdrObjKind == OBJ_TABLE || 1174cdf0e10cSrcweir nSlotId == SID_TEXTEDIT || 1175cdf0e10cSrcweir !bQuickDrag) 1176cdf0e10cSrcweir { 1177cdf0e10cSrcweir pOLV->MouseButtonDown(rMEvt); 1178cdf0e10cSrcweir pOLV->MouseMove(rMEvt); 1179cdf0e10cSrcweir pOLV->MouseButtonUp(rMEvt); 1180cdf0e10cSrcweir } 1181cdf0e10cSrcweir 1182cdf0e10cSrcweir if (mpViewShell->GetFrameView()->IsQuickEdit() && bQuickDrag && GetTextObj()->GetOutlinerParaObject()) 1183cdf0e10cSrcweir { 1184cdf0e10cSrcweir pOLV->MouseButtonDown(rMEvt); 1185cdf0e10cSrcweir } 1186cdf0e10cSrcweir } 1187cdf0e10cSrcweir else 1188cdf0e10cSrcweir { 1189cdf0e10cSrcweir // #98198# Move cursor to end of text 1190cdf0e10cSrcweir ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND); 1191cdf0e10cSrcweir pOLV->SetSelection(aNewSelection); 1192cdf0e10cSrcweir } 1193cdf0e10cSrcweir } 1194cdf0e10cSrcweir else 1195cdf0e10cSrcweir { 1196cdf0e10cSrcweir mpView->RestoreDefaultText(dynamic_cast< SdrTextObj* >( mxTextObj.get() )); 1197cdf0e10cSrcweir } 1198cdf0e10cSrcweir } 1199cdf0e10cSrcweir } 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir } 1202cdf0e10cSrcweir else 1203cdf0e10cSrcweir { 1204cdf0e10cSrcweir mxTextObj.reset(0); 1205cdf0e10cSrcweir } 1206cdf0e10cSrcweir } 1207cdf0e10cSrcweir 1208cdf0e10cSrcweir /************************************************************************* 1209cdf0e10cSrcweir |* 1210cdf0e10cSrcweir |* Texteingabe wird gestartet, ggf. Default-Text loeschen 1211cdf0e10cSrcweir |* 1212cdf0e10cSrcweir \************************************************************************/ 1213cdf0e10cSrcweir 1214cdf0e10cSrcweir sal_Bool FuText::DeleteDefaultText() 1215cdf0e10cSrcweir { 1216cdf0e10cSrcweir sal_Bool bDeleted = sal_False; 1217cdf0e10cSrcweir 1218cdf0e10cSrcweir if ( mxTextObj.is() && mxTextObj->IsEmptyPresObj() ) 1219cdf0e10cSrcweir { 1220cdf0e10cSrcweir String aString; 1221cdf0e10cSrcweir SdPage* pPage = (SdPage*) mxTextObj->GetPage(); 1222cdf0e10cSrcweir 1223cdf0e10cSrcweir if (pPage) 1224cdf0e10cSrcweir { 1225cdf0e10cSrcweir PresObjKind ePresObjKind = pPage->GetPresObjKind(mxTextObj.get()); 1226cdf0e10cSrcweir 1227cdf0e10cSrcweir if ( (ePresObjKind == PRESOBJ_TITLE || 1228cdf0e10cSrcweir ePresObjKind == PRESOBJ_OUTLINE || 1229cdf0e10cSrcweir ePresObjKind == PRESOBJ_NOTES || 1230cdf0e10cSrcweir ePresObjKind == PRESOBJ_TEXT) && 1231cdf0e10cSrcweir !pPage->IsMasterPage() ) 1232cdf0e10cSrcweir { 1233cdf0e10cSrcweir ::Outliner* pOutliner = mpView->GetTextEditOutliner(); 1234cdf0e10cSrcweir SfxStyleSheet* pSheet = pOutliner->GetStyleSheet( 0 ); 1235cdf0e10cSrcweir sal_Bool bIsUndoEnabled = pOutliner->IsUndoEnabled(); 1236cdf0e10cSrcweir if( bIsUndoEnabled ) 1237cdf0e10cSrcweir pOutliner->EnableUndo(sal_False); 1238cdf0e10cSrcweir 1239cdf0e10cSrcweir pOutliner->SetText( String(), pOutliner->GetParagraph( 0 ) ); 1240cdf0e10cSrcweir 1241cdf0e10cSrcweir if( bIsUndoEnabled ) 1242cdf0e10cSrcweir pOutliner->EnableUndo(sal_True); 1243cdf0e10cSrcweir 1244cdf0e10cSrcweir if (pSheet && 1245cdf0e10cSrcweir (ePresObjKind == PRESOBJ_NOTES || ePresObjKind == PRESOBJ_TEXT)) 1246cdf0e10cSrcweir pOutliner->SetStyleSheet(0, pSheet); 1247cdf0e10cSrcweir 1248cdf0e10cSrcweir mxTextObj->SetEmptyPresObj(sal_True); 1249cdf0e10cSrcweir bDeleted = sal_True; 1250cdf0e10cSrcweir } 1251cdf0e10cSrcweir } 1252cdf0e10cSrcweir } 1253cdf0e10cSrcweir 1254cdf0e10cSrcweir return(bDeleted); 1255cdf0e10cSrcweir } 1256cdf0e10cSrcweir 1257cdf0e10cSrcweir /************************************************************************* 1258cdf0e10cSrcweir |* 1259cdf0e10cSrcweir |* Command-event 1260cdf0e10cSrcweir |* 1261cdf0e10cSrcweir \************************************************************************/ 1262cdf0e10cSrcweir 1263cdf0e10cSrcweir sal_Bool FuText::Command(const CommandEvent& rCEvt) 1264cdf0e10cSrcweir { 1265cdf0e10cSrcweir return( FuPoor::Command(rCEvt) ); 1266cdf0e10cSrcweir } 1267cdf0e10cSrcweir 1268cdf0e10cSrcweir /************************************************************************* 1269cdf0e10cSrcweir |* 1270cdf0e10cSrcweir |* Help-event 1271cdf0e10cSrcweir |* 1272cdf0e10cSrcweir \************************************************************************/ 1273cdf0e10cSrcweir 1274cdf0e10cSrcweir sal_Bool FuText::RequestHelp(const HelpEvent& rHEvt) 1275cdf0e10cSrcweir { 1276cdf0e10cSrcweir sal_Bool bReturn = sal_False; 1277cdf0e10cSrcweir 1278cdf0e10cSrcweir OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); 1279cdf0e10cSrcweir 1280cdf0e10cSrcweir if ((Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled()) && 1281cdf0e10cSrcweir mxTextObj.is() && pOLV && pOLV->GetFieldUnderMousePointer()) 1282cdf0e10cSrcweir { 1283cdf0e10cSrcweir String aHelpText; 1284cdf0e10cSrcweir const SvxFieldItem* pFieldItem = pOLV->GetFieldUnderMousePointer(); 1285cdf0e10cSrcweir const SvxFieldData* pField = pFieldItem->GetField(); 1286cdf0e10cSrcweir 1287cdf0e10cSrcweir if (pField && pField->ISA(SvxURLField)) 1288cdf0e10cSrcweir { 1289cdf0e10cSrcweir /****************************************************************** 1290cdf0e10cSrcweir * URL-Field 1291cdf0e10cSrcweir ******************************************************************/ 1292cdf0e10cSrcweir aHelpText = INetURLObject::decode( ((const SvxURLField*)pField)->GetURL(), '%', INetURLObject::DECODE_WITH_CHARSET ); 1293cdf0e10cSrcweir } 1294cdf0e10cSrcweir if (aHelpText.Len()) 1295cdf0e10cSrcweir { 1296cdf0e10cSrcweir Rectangle aLogicPix = mpWindow->LogicToPixel(mxTextObj->GetLogicRect()); 1297cdf0e10cSrcweir Rectangle aScreenRect(mpWindow->OutputToScreenPixel(aLogicPix.TopLeft()), 1298cdf0e10cSrcweir mpWindow->OutputToScreenPixel(aLogicPix.BottomRight())); 1299cdf0e10cSrcweir 1300cdf0e10cSrcweir if (Help::IsBalloonHelpEnabled()) 1301cdf0e10cSrcweir { 1302cdf0e10cSrcweir bReturn = Help::ShowBalloon( (Window*)mpWindow, rHEvt.GetMousePosPixel(), aScreenRect, aHelpText); 1303cdf0e10cSrcweir } 1304cdf0e10cSrcweir else if (Help::IsQuickHelpEnabled()) 1305cdf0e10cSrcweir { 1306cdf0e10cSrcweir bReturn = Help::ShowQuickHelp( (Window*)mpWindow, aScreenRect, aHelpText); 1307cdf0e10cSrcweir } 1308cdf0e10cSrcweir } 1309cdf0e10cSrcweir } 1310cdf0e10cSrcweir 1311cdf0e10cSrcweir if (!bReturn) 1312cdf0e10cSrcweir { 1313cdf0e10cSrcweir bReturn = FuConstruct::RequestHelp(rHEvt); 1314cdf0e10cSrcweir } 1315cdf0e10cSrcweir 1316cdf0e10cSrcweir return(bReturn); 1317cdf0e10cSrcweir } 1318cdf0e10cSrcweir 1319cdf0e10cSrcweir /************************************************************************* 1320cdf0e10cSrcweir |* 1321cdf0e10cSrcweir |* Request verarbeiten 1322cdf0e10cSrcweir |* 1323cdf0e10cSrcweir \************************************************************************/ 1324cdf0e10cSrcweir 1325cdf0e10cSrcweir void FuText::ReceiveRequest(SfxRequest& rReq) 1326cdf0e10cSrcweir { 1327cdf0e10cSrcweir nSlotId = rReq.GetSlot(); 1328cdf0e10cSrcweir 1329cdf0e10cSrcweir // Dann Basisklasse rufen (dort wird u.a. nSlotId NICHT gesetzt) 1330cdf0e10cSrcweir FuPoor::ReceiveRequest(rReq); 1331cdf0e10cSrcweir 1332cdf0e10cSrcweir if (nSlotId == SID_TEXTEDIT || mpViewShell->GetFrameView()->IsQuickEdit() || /*#95971#*/ SID_ATTR_CHAR == nSlotId) 1333cdf0e10cSrcweir { 1334cdf0e10cSrcweir MouseEvent aMEvt(mpWindow->GetPointerPosPixel()); 1335cdf0e10cSrcweir 1336cdf0e10cSrcweir mxTextObj.reset(0); 1337cdf0e10cSrcweir 1338cdf0e10cSrcweir if (nSlotId == SID_TEXTEDIT) 1339cdf0e10cSrcweir { 1340cdf0e10cSrcweir // Wird gerade editiert? 1341cdf0e10cSrcweir if(!bTestText) 1342cdf0e10cSrcweir mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetTextEditObject() ) ); 1343cdf0e10cSrcweir 1344cdf0e10cSrcweir if (!mxTextObj.is()) 1345cdf0e10cSrcweir { 1346cdf0e10cSrcweir // Versuchen, ein Obj zu selektieren 1347cdf0e10cSrcweir SdrPageView* pPV = mpView->GetSdrPageView(); 1348cdf0e10cSrcweir SdrViewEvent aVEvt; 1349cdf0e10cSrcweir mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 1350cdf0e10cSrcweir mpView->MarkObj(aVEvt.pRootObj, pPV); 1351cdf0e10cSrcweir 1352cdf0e10cSrcweir if (aVEvt.pObj && aVEvt.pObj->ISA(SdrTextObj)) 1353cdf0e10cSrcweir { 1354cdf0e10cSrcweir mxTextObj.reset( static_cast< SdrTextObj* >( aVEvt.pObj ) ); 1355cdf0e10cSrcweir } 1356cdf0e10cSrcweir } 1357cdf0e10cSrcweir } 1358cdf0e10cSrcweir else if (mpView->AreObjectsMarked()) 1359cdf0e10cSrcweir { 1360cdf0e10cSrcweir const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 1361cdf0e10cSrcweir 1362cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1) 1363cdf0e10cSrcweir { 1364cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 1365cdf0e10cSrcweir 1366cdf0e10cSrcweir if (pObj->ISA(SdrTextObj)) 1367cdf0e10cSrcweir { 1368cdf0e10cSrcweir mxTextObj.reset( static_cast< SdrTextObj* >( pObj ) ); 1369cdf0e10cSrcweir } 1370cdf0e10cSrcweir } 1371cdf0e10cSrcweir } 1372cdf0e10cSrcweir 1373cdf0e10cSrcweir sal_Bool bQuickDrag = sal_True; 1374cdf0e10cSrcweir 1375cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 1376cdf0e10cSrcweir 1377cdf0e10cSrcweir if (pArgs 1378cdf0e10cSrcweir 1379cdf0e10cSrcweir // #98198# test for type before using 1380cdf0e10cSrcweir && SID_TEXTEDIT == nSlotId 1381cdf0e10cSrcweir && SFX_ITEM_SET == pArgs->GetItemState(SID_TEXTEDIT) 1382cdf0e10cSrcweir 1383cdf0e10cSrcweir && (sal_uInt16) ((SfxUInt16Item&) pArgs->Get(SID_TEXTEDIT)).GetValue() == 2) 1384cdf0e10cSrcweir { 1385cdf0e10cSrcweir // Anwahl per Doppelklick -> kein QuickDrag zulassen 1386cdf0e10cSrcweir bQuickDrag = sal_False; 1387cdf0e10cSrcweir } 1388cdf0e10cSrcweir 1389cdf0e10cSrcweir SetInEditMode(aMEvt, bQuickDrag); 1390cdf0e10cSrcweir } 1391cdf0e10cSrcweir } 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir 1394cdf0e10cSrcweir 1395cdf0e10cSrcweir /************************************************************************* 1396cdf0e10cSrcweir |* 1397cdf0e10cSrcweir |* SpellChecker: Error-LinkHdl 1398cdf0e10cSrcweir |* 1399cdf0e10cSrcweir \************************************************************************/ 1400cdf0e10cSrcweir 1401cdf0e10cSrcweir IMPL_LINK( FuText, SpellError, void *, nLang ) 1402cdf0e10cSrcweir { 1403cdf0e10cSrcweir String aError( SvtLanguageTable::GetLanguageString( (LanguageType)(sal_uLong)nLang ) ); 1404cdf0e10cSrcweir ErrorHandler::HandleError(* new StringErrorInfo( 1405cdf0e10cSrcweir ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aError) ); 1406cdf0e10cSrcweir return 0; 1407cdf0e10cSrcweir } 1408cdf0e10cSrcweir 1409cdf0e10cSrcweir 1410cdf0e10cSrcweir /************************************************************************* 1411cdf0e10cSrcweir |* 1412cdf0e10cSrcweir |* Reaktion auf Doppelklick 1413cdf0e10cSrcweir |* 1414cdf0e10cSrcweir \************************************************************************/ 1415cdf0e10cSrcweir void FuText::DoubleClick(const MouseEvent& ) 1416cdf0e10cSrcweir { 1417cdf0e10cSrcweir // Nichts zu tun 1418cdf0e10cSrcweir } 1419cdf0e10cSrcweir 1420cdf0e10cSrcweir /** #97016# 1421cdf0e10cSrcweir #105815# Removed the insertion of default text and putting a new text 1422cdf0e10cSrcweir object directly into edit mode. 1423cdf0e10cSrcweir */ 1424cdf0e10cSrcweir SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle) 1425cdf0e10cSrcweir { 1426cdf0e10cSrcweir // case SID_TEXTEDIT: // BASIC ??? 1427cdf0e10cSrcweir // case SID_ATTR_CHAR: 1428cdf0e10cSrcweir // case SID_ATTR_CHAR_VERTICAL: 1429cdf0e10cSrcweir // case SID_TEXT_FITTOSIZE: 1430cdf0e10cSrcweir // case SID_TEXT_FITTOSIZE_VERTICAL: 1431cdf0e10cSrcweir 1432cdf0e10cSrcweir SdrObject* pObj = SdrObjFactory::MakeNewObject( 1433cdf0e10cSrcweir mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(), 1434cdf0e10cSrcweir 0L, mpDoc); 1435cdf0e10cSrcweir 1436cdf0e10cSrcweir if(pObj) 1437cdf0e10cSrcweir { 1438cdf0e10cSrcweir if(pObj->ISA(SdrTextObj)) 1439cdf0e10cSrcweir { 1440cdf0e10cSrcweir SdrTextObj* pText = (SdrTextObj*)pObj; 1441cdf0e10cSrcweir pText->SetLogicRect(rRectangle); 1442cdf0e10cSrcweir 1443cdf0e10cSrcweir sal_Bool bVertical = (SID_ATTR_CHAR_VERTICAL == nID || SID_TEXT_FITTOSIZE_VERTICAL == nID); 1444cdf0e10cSrcweir pText->SetVerticalWriting(bVertical); 1445cdf0e10cSrcweir 1446cdf0e10cSrcweir // #97016# 1447cdf0e10cSrcweir ImpSetAttributesForNewTextObject(pText); 1448cdf0e10cSrcweir 1449cdf0e10cSrcweir if (nSlotId == SID_TEXT_FITTOSIZE) 1450cdf0e10cSrcweir { 1451cdf0e10cSrcweir // #97016# 1452cdf0e10cSrcweir ImpSetAttributesFitToSize(pText); 1453cdf0e10cSrcweir } 1454cdf0e10cSrcweir else if ( nSlotId == SID_TEXT_FITTOSIZE_VERTICAL ) 1455cdf0e10cSrcweir { 1456cdf0e10cSrcweir // #97016# 1457cdf0e10cSrcweir ImpSetAttributesFitToSizeVertical(pText); 1458cdf0e10cSrcweir } 1459cdf0e10cSrcweir else 1460cdf0e10cSrcweir { 1461cdf0e10cSrcweir // #97016# 1462cdf0e10cSrcweir ImpSetAttributesFitCommon(pText); 1463cdf0e10cSrcweir } 1464cdf0e10cSrcweir 1465cdf0e10cSrcweir // Put text object into edit mode. 1466cdf0e10cSrcweir SdrPageView* pPV = mpView->GetSdrPageView(); 1467cdf0e10cSrcweir mpView->SdrBeginTextEdit(pText, pPV); 1468cdf0e10cSrcweir } 1469cdf0e10cSrcweir else 1470cdf0e10cSrcweir { 1471cdf0e10cSrcweir DBG_ERROR("Object is NO text object"); 1472cdf0e10cSrcweir } 1473cdf0e10cSrcweir } 1474cdf0e10cSrcweir 1475cdf0e10cSrcweir return pObj; 1476cdf0e10cSrcweir } 1477cdf0e10cSrcweir 1478cdf0e10cSrcweir 1479cdf0e10cSrcweir 1480cdf0e10cSrcweir 1481cdf0e10cSrcweir /** is called when the currenct function should be aborted. <p> 1482cdf0e10cSrcweir This is used when a function gets a KEY_ESCAPE but can also 1483cdf0e10cSrcweir be called directly. 1484cdf0e10cSrcweir 1485cdf0e10cSrcweir @returns true if a active function was aborted 1486cdf0e10cSrcweir */ 1487cdf0e10cSrcweir bool FuText::cancel() 1488cdf0e10cSrcweir { 1489cdf0e10cSrcweir if ( mpView->IsTextEdit() ) 1490cdf0e10cSrcweir { 1491cdf0e10cSrcweir if(mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED) 1492cdf0e10cSrcweir mxTextObj.reset(0); 1493cdf0e10cSrcweir 1494cdf0e10cSrcweir mpView->SetCurrentObj(OBJ_TEXT); 1495cdf0e10cSrcweir mpView->SetEditMode(SDREDITMODE_EDIT); 1496cdf0e10cSrcweir return true; 1497cdf0e10cSrcweir } 1498cdf0e10cSrcweir else 1499cdf0e10cSrcweir { 1500cdf0e10cSrcweir return false; 1501cdf0e10cSrcweir } 1502cdf0e10cSrcweir } 1503cdf0e10cSrcweir 1504cdf0e10cSrcweir void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFontList, ::sd::View* pView ) 1505cdf0e10cSrcweir { 1506cdf0e10cSrcweir if( !pFontList || !pView ) 1507cdf0e10cSrcweir return; 1508cdf0e10cSrcweir 1509cdf0e10cSrcweir if( pOLV ) 1510cdf0e10cSrcweir { 1511cdf0e10cSrcweir pOLV->GetEditView().ChangeFontSize( bGrow, pFontList ); 1512cdf0e10cSrcweir } 1513cdf0e10cSrcweir else 1514cdf0e10cSrcweir { 1515cdf0e10cSrcweir // SdDrawDocument* pDoc = pView->GetDoc(); 1516cdf0e10cSrcweir 1517cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 1518cdf0e10cSrcweir for( sal_uInt32 nMark = 0; nMark < rMarkList.GetMarkCount(); nMark++ ) 1519cdf0e10cSrcweir { 1520cdf0e10cSrcweir SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( rMarkList.GetMark(nMark)->GetMarkedSdrObj() ); 1521cdf0e10cSrcweir if( pTextObj ) 1522cdf0e10cSrcweir { 1523cdf0e10cSrcweir for( sal_Int32 nText = 0; nText < pTextObj->getTextCount(); nText++ ) 1524cdf0e10cSrcweir { 1525cdf0e10cSrcweir pTextObj->setActiveText( nText ); 1526cdf0e10cSrcweir 1527cdf0e10cSrcweir // Put text object into edit mode. 1528cdf0e10cSrcweir SdrPageView* pPV = pView->GetSdrPageView(); 1529cdf0e10cSrcweir pView->SdrBeginTextEdit(pTextObj, pPV); 1530cdf0e10cSrcweir 1531cdf0e10cSrcweir pOLV = pView->GetTextEditOutlinerView(); 1532cdf0e10cSrcweir if( pOLV ) 1533cdf0e10cSrcweir { 1534cdf0e10cSrcweir EditEngine* pEditEngine = pOLV->GetEditView().GetEditEngine(); 1535cdf0e10cSrcweir if( pEditEngine ) 1536cdf0e10cSrcweir { 1537cdf0e10cSrcweir ESelection aSel; 1538cdf0e10cSrcweir aSel.nEndPara = pEditEngine->GetParagraphCount()-1; 1539cdf0e10cSrcweir aSel.nEndPos = pEditEngine->GetTextLen(aSel.nEndPara); 1540cdf0e10cSrcweir pOLV->SetSelection(aSel); 1541cdf0e10cSrcweir } 1542cdf0e10cSrcweir 1543cdf0e10cSrcweir ChangeFontSize( bGrow, pOLV, pFontList, pView ); 1544cdf0e10cSrcweir } 1545cdf0e10cSrcweir 1546cdf0e10cSrcweir pView->SdrEndTextEdit(); 1547cdf0e10cSrcweir } 1548cdf0e10cSrcweir 1549cdf0e10cSrcweir SfxItemSet aShapeSet( pTextObj->GetMergedItemSet() ); 1550cdf0e10cSrcweir if( EditView::ChangeFontSize( bGrow, aShapeSet, pFontList ) ) 1551cdf0e10cSrcweir { 1552cdf0e10cSrcweir pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT ) ); 1553cdf0e10cSrcweir pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT_CJK ) ); 1554cdf0e10cSrcweir pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT_CTL ) ); 1555cdf0e10cSrcweir } 1556cdf0e10cSrcweir } 1557cdf0e10cSrcweir } 1558cdf0e10cSrcweir } 1559cdf0e10cSrcweir } 1560cdf0e10cSrcweir 1561cdf0e10cSrcweir } // end of namespace sd 1562cdf0e10cSrcweir 1563