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_sw.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include "hintids.hxx" 33*cdf0e10cSrcweir #include <svl/aeitem.hxx> 34*cdf0e10cSrcweir #include <svl/itempool.hxx> 35*cdf0e10cSrcweir #include <svx/svdobj.hxx> 36*cdf0e10cSrcweir #include <svx/svdview.hxx> 37*cdf0e10cSrcweir #include <svx/svdpage.hxx> 38*cdf0e10cSrcweir #include <editeng/editview.hxx> 39*cdf0e10cSrcweir #include <editeng/editeng.hxx> 40*cdf0e10cSrcweir #include <editeng/outliner.hxx> 41*cdf0e10cSrcweir #include <svx/fmview.hxx> 42*cdf0e10cSrcweir #include <svx/dataaccessdescriptor.hxx> 43*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 44*cdf0e10cSrcweir #include <doc.hxx> 45*cdf0e10cSrcweir #include <editeng/langitem.hxx> 46*cdf0e10cSrcweir #include <linguistic/lngprops.hxx> 47*cdf0e10cSrcweir #include <editeng/unolingu.hxx> 48*cdf0e10cSrcweir #include <svx/fontworkbar.hxx> 49*cdf0e10cSrcweir #include <svx/fontworkgallery.hxx> 50*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 51*cdf0e10cSrcweir #include <svx/svdogrp.hxx> 52*cdf0e10cSrcweir #include <svx/svdetc.hxx> 53*cdf0e10cSrcweir #include <editeng/editstat.hxx> 54*cdf0e10cSrcweir #include <sfx2/request.hxx> 55*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 56*cdf0e10cSrcweir #include <sfx2/printer.hxx> 57*cdf0e10cSrcweir #include <svx/fmglob.hxx> 58*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 59*cdf0e10cSrcweir #include <svx/svdoutl.hxx> 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir #include "view.hxx" 62*cdf0e10cSrcweir #include "wrtsh.hxx" 63*cdf0e10cSrcweir #include "viewopt.hxx" 64*cdf0e10cSrcweir #include "cmdid.h" 65*cdf0e10cSrcweir #include "drawsh.hxx" 66*cdf0e10cSrcweir #include "drwbassh.hxx" 67*cdf0e10cSrcweir #include "beziersh.hxx" 68*cdf0e10cSrcweir #include "conrect.hxx" 69*cdf0e10cSrcweir #include "conpoly.hxx" 70*cdf0e10cSrcweir #include "conarc.hxx" 71*cdf0e10cSrcweir #include "conform.hxx" 72*cdf0e10cSrcweir #include "concustomshape.hxx" 73*cdf0e10cSrcweir #include "dselect.hxx" 74*cdf0e10cSrcweir #include "edtwin.hxx" 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir // #108784# 77*cdf0e10cSrcweir #include <dcontact.hxx> 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir // #108784# 80*cdf0e10cSrcweir #include <svx/svdpagv.hxx> 81*cdf0e10cSrcweir #include <svx/extrusionbar.hxx> 82*cdf0e10cSrcweir #include <vcl/svapp.hxx> 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir using namespace ::com::sun::star; 85*cdf0e10cSrcweir /*-------------------------------------------------------------------- 86*cdf0e10cSrcweir Beschreibung: Drawing-Ids ausfuehren 87*cdf0e10cSrcweir --------------------------------------------------------------------*/ 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir void SwView::ExecDraw(SfxRequest& rReq) 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 92*cdf0e10cSrcweir const SfxPoolItem* pItem; 93*cdf0e10cSrcweir const SfxAllEnumItem* pEItem = 0; 94*cdf0e10cSrcweir const SfxStringItem* pStringItem = 0; 95*cdf0e10cSrcweir SdrView *pSdrView = pWrtShell->GetDrawView(); 96*cdf0e10cSrcweir sal_Bool bDeselect = sal_False; 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir sal_uInt16 nSlotId = rReq.GetSlot(); 99*cdf0e10cSrcweir if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(GetPool().GetWhich(nSlotId), sal_False, &pItem)) 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir pEItem = dynamic_cast< const SfxAllEnumItem*>(pItem); 102*cdf0e10cSrcweir pStringItem = dynamic_cast< const SfxStringItem*>(pItem); 103*cdf0e10cSrcweir } 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir if (SID_INSERT_DRAW == nSlotId && pEItem) 106*cdf0e10cSrcweir switch ( pEItem->GetValue() ) 107*cdf0e10cSrcweir { 108*cdf0e10cSrcweir case SVX_SNAP_DRAW_SELECT: nSlotId = SID_OBJECT_SELECT; break; 109*cdf0e10cSrcweir case SVX_SNAP_DRAW_LINE: nSlotId = SID_DRAW_LINE; break; 110*cdf0e10cSrcweir case SVX_SNAP_DRAW_RECT: nSlotId = SID_DRAW_RECT; break; 111*cdf0e10cSrcweir case SVX_SNAP_DRAW_ELLIPSE: nSlotId = SID_DRAW_ELLIPSE; break; 112*cdf0e10cSrcweir case SVX_SNAP_DRAW_POLYGON_NOFILL: nSlotId = SID_DRAW_POLYGON_NOFILL; break; 113*cdf0e10cSrcweir case SVX_SNAP_DRAW_BEZIER_NOFILL: nSlotId = SID_DRAW_BEZIER_NOFILL; break; 114*cdf0e10cSrcweir case SVX_SNAP_DRAW_FREELINE_NOFILL: nSlotId = SID_DRAW_FREELINE_NOFILL; break; 115*cdf0e10cSrcweir case SVX_SNAP_DRAW_ARC: nSlotId = SID_DRAW_ARC; break; 116*cdf0e10cSrcweir case SVX_SNAP_DRAW_PIE: nSlotId = SID_DRAW_PIE; break; 117*cdf0e10cSrcweir case SVX_SNAP_DRAW_CIRCLECUT: nSlotId = SID_DRAW_CIRCLECUT; break; 118*cdf0e10cSrcweir case SVX_SNAP_DRAW_TEXT: nSlotId = SID_DRAW_TEXT; break; 119*cdf0e10cSrcweir case SVX_SNAP_DRAW_TEXT_VERTICAL: nSlotId = SID_DRAW_TEXT_VERTICAL; break; 120*cdf0e10cSrcweir case SVX_SNAP_DRAW_TEXT_MARQUEE: nSlotId = SID_DRAW_TEXT_MARQUEE; break; 121*cdf0e10cSrcweir case SVX_SNAP_DRAW_CAPTION: nSlotId = SID_DRAW_CAPTION; break; 122*cdf0e10cSrcweir case SVX_SNAP_DRAW_CAPTION_VERTICAL: nSlotId = SID_DRAW_CAPTION_VERTICAL; break; 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir if (nSlotId == SID_OBJECT_SELECT && nFormSfxId == nSlotId) 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir bDeselect = sal_True; 128*cdf0e10cSrcweir } 129*cdf0e10cSrcweir else if (nSlotId == SID_FM_CREATE_CONTROL) 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, sal_False ); 132*cdf0e10cSrcweir if( pIdentifierItem ) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir sal_uInt16 nNewId = pIdentifierItem->GetValue(); 135*cdf0e10cSrcweir if (nNewId == nFormSfxId) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir bDeselect = sal_True; 138*cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute(SID_FM_LEAVE_CREATE); // Button soll rauspoppen 139*cdf0e10cSrcweir } 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir } 142*cdf0e10cSrcweir else if( nSlotId == SID_FM_CREATE_FIELDCONTROL) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir FmFormView* pFormView = PTR_CAST( FmFormView, pSdrView ); 145*cdf0e10cSrcweir if ( pFormView ) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pDescriptorItem, SfxUnoAnyItem, SID_FM_DATACCESS_DESCRIPTOR, sal_False ); 148*cdf0e10cSrcweir DBG_ASSERT( pDescriptorItem, "SwView::ExecDraw(SID_FM_CREATE_FIELDCONTROL): invalid request args!" ); 149*cdf0e10cSrcweir if( pDescriptorItem ) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir ::svx::ODataAccessDescriptor aDescriptor( pDescriptorItem->GetValue() ); 152*cdf0e10cSrcweir SdrObject* pObj = pFormView->CreateFieldControl( aDescriptor ); 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir if ( pObj ) 155*cdf0e10cSrcweir { 156*cdf0e10cSrcweir Size aDocSize(pWrtShell->GetDocSize()); 157*cdf0e10cSrcweir const SwRect& rVisArea = pWrtShell->VisArea(); 158*cdf0e10cSrcweir Point aStartPos = rVisArea.Center(); 159*cdf0e10cSrcweir if(rVisArea.Width() > aDocSize.Width()) 160*cdf0e10cSrcweir aStartPos.X() = aDocSize.Width() / 2 + rVisArea.Left(); 161*cdf0e10cSrcweir if(rVisArea.Height() > aDocSize.Height()) 162*cdf0e10cSrcweir aStartPos.Y() = aDocSize.Height() / 2 + rVisArea.Top(); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir //determine the size of the object 165*cdf0e10cSrcweir if(pObj->IsGroupObject()) 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir const Rectangle& rBoundRect = ((SdrObjGroup*)pObj)->GetCurrentBoundRect(); 168*cdf0e10cSrcweir aStartPos.X() -= rBoundRect.GetWidth()/2; 169*cdf0e10cSrcweir aStartPos.Y() -= rBoundRect.GetHeight()/2; 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir // TODO: unmark all other 173*cdf0e10cSrcweir pWrtShell->EnterStdMode(); 174*cdf0e10cSrcweir pWrtShell->SwFEShell::InsertDrawObj( *pObj, aStartPos ); 175*cdf0e10cSrcweir } 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir else if ( nSlotId == SID_FONTWORK_GALLERY_FLOATER ) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir Window* pWin = &( pWrtShell->GetView().GetViewFrame()->GetWindow() ); 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir if ( pWin ) 184*cdf0e10cSrcweir pWin->EnterWait(); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir if( !pWrtShell->HasDrawView() ) 187*cdf0e10cSrcweir pWrtShell->MakeDrawView(); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir pSdrView = pWrtShell->GetDrawView(); 190*cdf0e10cSrcweir if ( pSdrView ) 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir SdrObject* pObj = NULL; 193*cdf0e10cSrcweir svx::FontWorkGalleryDialog aDlg( pSdrView, pWin, nSlotId ); 194*cdf0e10cSrcweir aDlg.SetSdrObjectRef( &pObj, pSdrView->GetModel() ); 195*cdf0e10cSrcweir aDlg.Execute(); 196*cdf0e10cSrcweir if ( pObj ) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir Size aDocSize( pWrtShell->GetDocSize() ); 199*cdf0e10cSrcweir const SwRect& rVisArea = pWrtShell->VisArea(); 200*cdf0e10cSrcweir Point aPos( rVisArea.Center() ); 201*cdf0e10cSrcweir Size aSize; 202*cdf0e10cSrcweir Size aPrefSize( pObj->GetSnapRect().GetSize() ); 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir if( rVisArea.Width() > aDocSize.Width()) 205*cdf0e10cSrcweir aPos.X() = aDocSize.Width() / 2 + rVisArea.Left(); 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir if(rVisArea.Height() > aDocSize.Height()) 208*cdf0e10cSrcweir aPos.Y() = aDocSize.Height() / 2 + rVisArea.Top(); 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir if( aPrefSize.Width() && aPrefSize.Height() ) 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir if( pWin ) 213*cdf0e10cSrcweir aSize = pWin->PixelToLogic( aPrefSize, MAP_TWIP ); 214*cdf0e10cSrcweir else 215*cdf0e10cSrcweir aSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_TWIP ); 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir else 218*cdf0e10cSrcweir aSize = Size( 2835, 2835 ); 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir pWrtShell->EnterStdMode(); 221*cdf0e10cSrcweir pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos ); 222*cdf0e10cSrcweir rReq.Ignore (); 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir if( pWin ) 226*cdf0e10cSrcweir pWin->LeaveWait(); 227*cdf0e10cSrcweir } 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir if( nSlotId == SID_DRAW_CS_ID ) 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir //deselect if same custom shape is selected again 232*cdf0e10cSrcweir SwDrawBase* pFuncPtr = GetDrawFuncPtr(); 233*cdf0e10cSrcweir if( pFuncPtr && pFuncPtr->GetSlotId() == SID_DRAW_CS_ID ) 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir ConstCustomShape* pConstCustomShape = (ConstCustomShape*)(pFuncPtr); 236*cdf0e10cSrcweir rtl::OUString aNew = ConstCustomShape::GetShapeTypeFromRequest( rReq ); 237*cdf0e10cSrcweir rtl::OUString aOld = pConstCustomShape->GetShapeType(); 238*cdf0e10cSrcweir if( aNew == aOld ) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir bDeselect = true; 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir //deselect if same shape is selected again (but different custom shapes do have same slot id) 246*cdf0e10cSrcweir if ( bDeselect || (nSlotId == nDrawSfxId && 247*cdf0e10cSrcweir (!pStringItem || (pStringItem->GetValue() == sDrawCustom)) 248*cdf0e10cSrcweir && (nSlotId != SID_DRAW_CS_ID) ) ) 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir if (GetDrawFuncPtr()) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir GetDrawFuncPtr()->Deactivate(); 253*cdf0e10cSrcweir SetDrawFuncPtr(NULL); 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir if (pWrtShell->IsObjSelected() && !pWrtShell->IsSelFrmMode()) 257*cdf0e10cSrcweir pWrtShell->EnterSelFrmMode(NULL); 258*cdf0e10cSrcweir LeaveDrawCreate(); 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir AttrChangedNotify(pWrtShell); 263*cdf0e10cSrcweir return; 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir LeaveDrawCreate(); 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir if (pWrtShell->IsFrmSelected()) 269*cdf0e10cSrcweir pWrtShell->EnterStdMode(); // wegen Bug #45639 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir SwDrawBase* pFuncPtr = NULL; 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir switch (nSlotId) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir case SID_OBJECT_SELECT: 276*cdf0e10cSrcweir case SID_DRAW_SELECT: 277*cdf0e10cSrcweir pFuncPtr = new DrawSelection(pWrtShell, pEditWin, this); 278*cdf0e10cSrcweir nDrawSfxId = nFormSfxId = SID_OBJECT_SELECT; 279*cdf0e10cSrcweir sDrawCustom.Erase(); 280*cdf0e10cSrcweir break; 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir case SID_DRAW_LINE: 283*cdf0e10cSrcweir case SID_DRAW_RECT: 284*cdf0e10cSrcweir case SID_DRAW_ELLIPSE: 285*cdf0e10cSrcweir case SID_DRAW_TEXT: 286*cdf0e10cSrcweir case SID_DRAW_TEXT_VERTICAL: 287*cdf0e10cSrcweir case SID_DRAW_TEXT_MARQUEE: 288*cdf0e10cSrcweir case SID_DRAW_CAPTION: 289*cdf0e10cSrcweir case SID_DRAW_CAPTION_VERTICAL: 290*cdf0e10cSrcweir pFuncPtr = new ConstRectangle(pWrtShell, pEditWin, this); 291*cdf0e10cSrcweir nDrawSfxId = nSlotId; 292*cdf0e10cSrcweir sDrawCustom.Erase(); 293*cdf0e10cSrcweir break; 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir case SID_DRAW_POLYGON_NOFILL: 296*cdf0e10cSrcweir case SID_DRAW_BEZIER_NOFILL: 297*cdf0e10cSrcweir case SID_DRAW_FREELINE_NOFILL: 298*cdf0e10cSrcweir pFuncPtr = new ConstPolygon(pWrtShell, pEditWin, this); 299*cdf0e10cSrcweir nDrawSfxId = nSlotId; 300*cdf0e10cSrcweir sDrawCustom.Erase(); 301*cdf0e10cSrcweir break; 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir case SID_DRAW_ARC: 304*cdf0e10cSrcweir case SID_DRAW_PIE: 305*cdf0e10cSrcweir case SID_DRAW_CIRCLECUT: 306*cdf0e10cSrcweir pFuncPtr = new ConstArc(pWrtShell, pEditWin, this); 307*cdf0e10cSrcweir nDrawSfxId = nSlotId; 308*cdf0e10cSrcweir sDrawCustom.Erase(); 309*cdf0e10cSrcweir break; 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir case SID_FM_CREATE_CONTROL: 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, sal_False ); 314*cdf0e10cSrcweir if( pIdentifierItem ) 315*cdf0e10cSrcweir nSlotId = pIdentifierItem->GetValue(); 316*cdf0e10cSrcweir pFuncPtr = new ConstFormControl(pWrtShell, pEditWin, this); 317*cdf0e10cSrcweir nFormSfxId = nSlotId; 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir break; 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir case SID_DRAWTBX_CS_BASIC : 322*cdf0e10cSrcweir case SID_DRAWTBX_CS_SYMBOL : 323*cdf0e10cSrcweir case SID_DRAWTBX_CS_ARROW : 324*cdf0e10cSrcweir case SID_DRAWTBX_CS_FLOWCHART : 325*cdf0e10cSrcweir case SID_DRAWTBX_CS_CALLOUT : 326*cdf0e10cSrcweir case SID_DRAWTBX_CS_STAR : 327*cdf0e10cSrcweir case SID_DRAW_CS_ID : 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir pFuncPtr = new ConstCustomShape(pWrtShell, pEditWin, this, rReq ); 330*cdf0e10cSrcweir nDrawSfxId = nSlotId; 331*cdf0e10cSrcweir if ( nSlotId != SID_DRAW_CS_ID ) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir if ( pStringItem ) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir sDrawCustom = pStringItem->GetValue(); 336*cdf0e10cSrcweir aCurrShapeEnumCommand[ nSlotId - SID_DRAWTBX_CS_BASIC ] = sDrawCustom; 337*cdf0e10cSrcweir SfxBindings& rBind = GetViewFrame()->GetBindings(); 338*cdf0e10cSrcweir rBind.Invalidate( nSlotId ); 339*cdf0e10cSrcweir rBind.Update( nSlotId ); 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir break; 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir default: 346*cdf0e10cSrcweir break; 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInval[] = 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir // Slot-Ids muessen beim Aufruf von Invalidate sortiert sein! 352*cdf0e10cSrcweir SID_ATTRIBUTES_AREA, 353*cdf0e10cSrcweir SID_INSERT_DRAW, 354*cdf0e10cSrcweir 0 355*cdf0e10cSrcweir }; 356*cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(aInval); 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir sal_Bool bEndTextEdit = sal_True; 359*cdf0e10cSrcweir if (pFuncPtr) 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir if (GetDrawFuncPtr()) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir GetDrawFuncPtr()->Deactivate(); 364*cdf0e10cSrcweir SetDrawFuncPtr(NULL); 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir SetDrawFuncPtr(pFuncPtr); 368*cdf0e10cSrcweir AttrChangedNotify(pWrtShell); 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir pFuncPtr->Activate(nSlotId); 371*cdf0e10cSrcweir NoRotate(); 372*cdf0e10cSrcweir if(rReq.GetModifier() == KEY_MOD1) 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir if(SID_OBJECT_SELECT == nDrawSfxId ) 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir pWrtShell->GotoObj(sal_True); 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir else 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir pFuncPtr->CreateDefaultObject(); 381*cdf0e10cSrcweir pFuncPtr->Deactivate(); 382*cdf0e10cSrcweir SetDrawFuncPtr(NULL); 383*cdf0e10cSrcweir LeaveDrawCreate(); 384*cdf0e10cSrcweir pWrtShell->EnterStdMode(); 385*cdf0e10cSrcweir SdrView *pTmpSdrView = pWrtShell->GetDrawView(); 386*cdf0e10cSrcweir const SdrMarkList& rMarkList = pTmpSdrView->GetMarkedObjectList(); 387*cdf0e10cSrcweir if(rMarkList.GetMarkCount() == 1 && 388*cdf0e10cSrcweir (SID_DRAW_TEXT == nSlotId || SID_DRAW_TEXT_VERTICAL == nSlotId || 389*cdf0e10cSrcweir SID_DRAW_TEXT_MARQUEE == nSlotId )) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 392*cdf0e10cSrcweir BeginTextEdit(pObj); 393*cdf0e10cSrcweir bEndTextEdit = sal_False; 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir } 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir else 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir if (pWrtShell->IsObjSelected() && !pWrtShell->IsSelFrmMode()) 401*cdf0e10cSrcweir pWrtShell->EnterSelFrmMode(NULL); 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir if(bEndTextEdit && pSdrView && pSdrView->IsTextEdit()) 405*cdf0e10cSrcweir pSdrView->SdrEndTextEdit( sal_True ); 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir AttrChangedNotify(pWrtShell); 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir /*-------------------------------------------------------------------- 411*cdf0e10cSrcweir Beschreibung: Drawing beenden 412*cdf0e10cSrcweir --------------------------------------------------------------------*/ 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir void SwView::ExitDraw() 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir NoRotate(); 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir if(pShell) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir //#126062 # the shell may be invalid at close/reload/SwitchToViewShell 423*cdf0e10cSrcweir SfxDispatcher* pDispatch = GetViewFrame()->GetDispatcher(); 424*cdf0e10cSrcweir sal_uInt16 nIdx = 0; 425*cdf0e10cSrcweir SfxShell* pTest = 0; 426*cdf0e10cSrcweir do 427*cdf0e10cSrcweir { 428*cdf0e10cSrcweir pTest = pDispatch->GetShell(nIdx++); 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir while( pTest && pTest != this && pTest != pShell); 431*cdf0e10cSrcweir if(pTest == pShell && 432*cdf0e10cSrcweir // don't call LeaveSelFrmMode() etc. for the below, 433*cdf0e10cSrcweir // because objects may still be selected: 434*cdf0e10cSrcweir !pShell->ISA(SwDrawBaseShell) && 435*cdf0e10cSrcweir !pShell->ISA(SwBezierShell) && 436*cdf0e10cSrcweir !pShell->ISA(svx::ExtrusionBar) && 437*cdf0e10cSrcweir !pShell->ISA(svx::FontworkBar)) 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir SdrView *pSdrView = pWrtShell->GetDrawView(); 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir if (pSdrView && pSdrView->IsGroupEntered()) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir pSdrView->LeaveOneGroup(); 444*cdf0e10cSrcweir pSdrView->UnmarkAll(); 445*cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(SID_ENTER_GROUP); 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir if (GetDrawFuncPtr()) 449*cdf0e10cSrcweir { 450*cdf0e10cSrcweir if (pWrtShell->IsSelFrmMode()) 451*cdf0e10cSrcweir pWrtShell->LeaveSelFrmMode(); 452*cdf0e10cSrcweir GetDrawFuncPtr()->Deactivate(); 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir SetDrawFuncPtr(NULL); 455*cdf0e10cSrcweir LeaveDrawCreate(); 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); 458*cdf0e10cSrcweir } 459*cdf0e10cSrcweir GetEditWin().SetPointer(Pointer(POINTER_TEXT)); 460*cdf0e10cSrcweir } 461*cdf0e10cSrcweir } 462*cdf0e10cSrcweir } 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir /*-------------------------------------------------------------------- 465*cdf0e10cSrcweir Beschreibung: Rotate-Mode abschalten 466*cdf0e10cSrcweir --------------------------------------------------------------------*/ 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir void SwView::NoRotate() 471*cdf0e10cSrcweir { 472*cdf0e10cSrcweir if (IsDrawRotate()) 473*cdf0e10cSrcweir { 474*cdf0e10cSrcweir pWrtShell->SetDragMode(SDRDRAG_MOVE); 475*cdf0e10cSrcweir FlipDrawRotate(); 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir const SfxBoolItem aTmp( SID_OBJECT_ROTATE, sal_False ); 478*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetState( aTmp ); 479*cdf0e10cSrcweir } 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir /****************************************************************************** 483*cdf0e10cSrcweir * Beschreibung: DrawTextEditMode einschalten 484*cdf0e10cSrcweir ******************************************************************************/ 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir sal_Bool SwView::EnterDrawTextMode(const Point& aDocPos) 487*cdf0e10cSrcweir { 488*cdf0e10cSrcweir SdrObject* pObj; 489*cdf0e10cSrcweir SdrPageView* pPV; 490*cdf0e10cSrcweir SwWrtShell *pSh = &GetWrtShell(); 491*cdf0e10cSrcweir SdrView *pSdrView = pSh->GetDrawView(); 492*cdf0e10cSrcweir ASSERT( pSdrView, "EnterDrawTextMode without DrawView?" ); 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir sal_Bool bReturn = sal_False; 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir sal_uInt16 nOld = pSdrView->GetHitTolerancePixel(); 497*cdf0e10cSrcweir pSdrView->SetHitTolerancePixel( 2 ); 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir if( pSdrView->IsMarkedHit( aDocPos ) && 500*cdf0e10cSrcweir !pSdrView->PickHandle( aDocPos ) && IsTextTool() && 501*cdf0e10cSrcweir pSdrView->PickObj( aDocPos, pSdrView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKTEXTEDIT ) && 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir // #108784# 504*cdf0e10cSrcweir // To allow SwDrawVirtObj text objects to be activated, allow their type, too. 505*cdf0e10cSrcweir //pObj->ISA( SdrTextObj ) && 506*cdf0e10cSrcweir ( pObj->ISA( SdrTextObj ) || 507*cdf0e10cSrcweir ( pObj->ISA(SwDrawVirtObj) && 508*cdf0e10cSrcweir ((SwDrawVirtObj*)pObj)->GetReferencedObj().ISA(SdrTextObj) ) ) && 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir !pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT)) 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir bReturn = BeginTextEdit( pObj, pPV, pEditWin, sal_False ); 513*cdf0e10cSrcweir } 514*cdf0e10cSrcweir 515*cdf0e10cSrcweir pSdrView->SetHitTolerancePixel( nOld ); 516*cdf0e10cSrcweir 517*cdf0e10cSrcweir return bReturn; 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir /****************************************************************************** 521*cdf0e10cSrcweir * Beschreibung: DrawTextEditMode einschalten 522*cdf0e10cSrcweir ******************************************************************************/ 523*cdf0e10cSrcweir sal_Bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, Window* pWin, 524*cdf0e10cSrcweir bool bIsNewObj, bool bSetSelectionToStart) 525*cdf0e10cSrcweir { 526*cdf0e10cSrcweir SwWrtShell *pSh = &GetWrtShell(); 527*cdf0e10cSrcweir SdrView *pSdrView = pSh->GetDrawView(); 528*cdf0e10cSrcweir SdrOutliner* pOutliner = ::SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrView->GetModel()); 529*cdf0e10cSrcweir uno::Reference< linguistic2::XSpellChecker1 > xSpell( ::GetSpellChecker() ); 530*cdf0e10cSrcweir if (pOutliner) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir pOutliner->SetRefDevice(pSh->getIDocumentDeviceAccess()->getReferenceDevice(false)); 533*cdf0e10cSrcweir pOutliner->SetSpeller(xSpell); 534*cdf0e10cSrcweir uno::Reference<linguistic2::XHyphenator> xHyphenator( ::GetHyphenator() ); 535*cdf0e10cSrcweir pOutliner->SetHyphenator( xHyphenator ); 536*cdf0e10cSrcweir pSh->SetCalcFieldValueHdl(pOutliner); 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir sal_uInt32 nCntrl = pOutliner->GetControlWord(); 539*cdf0e10cSrcweir nCntrl |= EE_CNTRL_ALLOWBIGOBJS; 540*cdf0e10cSrcweir nCntrl |= EE_CNTRL_URLSFXEXECUTE; 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir const SwViewOption *pOpt = pSh->GetViewOptions(); 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir if (SwViewOption::IsFieldShadings()) 545*cdf0e10cSrcweir nCntrl |= EE_CNTRL_MARKFIELDS; 546*cdf0e10cSrcweir else 547*cdf0e10cSrcweir nCntrl &= ~EE_CNTRL_MARKFIELDS; 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir if (pOpt->IsOnlineSpell()) 550*cdf0e10cSrcweir nCntrl |= EE_CNTRL_ONLINESPELLING; 551*cdf0e10cSrcweir else 552*cdf0e10cSrcweir nCntrl &= ~EE_CNTRL_ONLINESPELLING; 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir pOutliner->SetControlWord(nCntrl); 555*cdf0e10cSrcweir const SfxPoolItem& rItem = pSh->GetDoc()->GetDefault(RES_CHRATR_LANGUAGE); 556*cdf0e10cSrcweir pOutliner->SetDefaultLanguage(((const SvxLanguageItem&)rItem).GetLanguage()); 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir if( bIsNewObj ) 559*cdf0e10cSrcweir pOutliner->SetVertical( SID_DRAW_TEXT_VERTICAL == nDrawSfxId || 560*cdf0e10cSrcweir SID_DRAW_CAPTION_VERTICAL == nDrawSfxId ); 561*cdf0e10cSrcweir // #i7672# 562*cdf0e10cSrcweir // No longer necessary, see text below 563*cdf0e10cSrcweir // Color aBackground(pSh->GetShapeBackgrd()); 564*cdf0e10cSrcweir // pOutliner->SetBackgroundColor(aBackground); 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir // OD 09.12.2002 #103045# - set default horizontal text direction at outliner 567*cdf0e10cSrcweir EEHorizontalTextDirection aDefHoriTextDir = 568*cdf0e10cSrcweir pSh->IsShapeDefaultHoriTextDirR2L() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R; 569*cdf0e10cSrcweir pOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir ); 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir // #108784# 573*cdf0e10cSrcweir // To allow editing the referenced object from a SwDrawVirtObj here 574*cdf0e10cSrcweir // the original needs to be fetched evenually. This ATM activates the 575*cdf0e10cSrcweir // text edit mode for the original object. 576*cdf0e10cSrcweir SdrObject* pToBeActivated = pObj; 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir // #108784# 579*cdf0e10cSrcweir // Always the original object is edited. To allow the TextEdit to happen 580*cdf0e10cSrcweir // where the VirtObj is positioned, on demand a occurring offset is set at 581*cdf0e10cSrcweir // the TextEdit object. That offset is used for creating and managing the 582*cdf0e10cSrcweir // OutlinerView. 583*cdf0e10cSrcweir Point aNewTextEditOffset(0, 0); 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir if(pObj->ISA(SwDrawVirtObj)) 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir SwDrawVirtObj* pVirtObj = (SwDrawVirtObj*)pObj; 588*cdf0e10cSrcweir pToBeActivated = &((SdrObject&)pVirtObj->GetReferencedObj()); 589*cdf0e10cSrcweir aNewTextEditOffset = pVirtObj->GetOffset(); 590*cdf0e10cSrcweir } 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir // set in each case, thus it will be correct for all objects 593*cdf0e10cSrcweir ((SdrTextObj*)pToBeActivated)->SetTextEditOffset(aNewTextEditOffset); 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir sal_Bool bRet(pSdrView->SdrBeginTextEdit( pToBeActivated, pPV, pWin, sal_True, pOutliner, 0, sal_False, sal_False, sal_False )); 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir // #i7672# 598*cdf0e10cSrcweir // Since SdrBeginTextEdit actually creates the OutlinerView and thus also 599*cdf0e10cSrcweir // sets the background color, an own background color needs to be set 600*cdf0e10cSrcweir // after TextEditing was started. This is now done here. 601*cdf0e10cSrcweir if(bRet) 602*cdf0e10cSrcweir { 603*cdf0e10cSrcweir OutlinerView* pView = pSdrView->GetTextEditOutlinerView(); 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir if(pView) 606*cdf0e10cSrcweir { 607*cdf0e10cSrcweir Color aBackground(pSh->GetShapeBackgrd()); 608*cdf0e10cSrcweir pView->SetBackgroundColor(aBackground); 609*cdf0e10cSrcweir } 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir // editing should start at the end of text, spell checking at the beginning ... 612*cdf0e10cSrcweir ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND); 613*cdf0e10cSrcweir if (bSetSelectionToStart) 614*cdf0e10cSrcweir aNewSelection = ESelection(); 615*cdf0e10cSrcweir pView->SetSelection(aNewSelection); 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir return bRet; 619*cdf0e10cSrcweir } 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir /****************************************************************************** 622*cdf0e10cSrcweir * Beschreibung: Ist ein DrawTextObjekt selektiert? 623*cdf0e10cSrcweir ******************************************************************************/ 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir sal_Bool SwView::IsTextTool() const 628*cdf0e10cSrcweir { 629*cdf0e10cSrcweir sal_uInt16 nId; 630*cdf0e10cSrcweir sal_uInt32 nInvent; 631*cdf0e10cSrcweir SdrView *pSdrView = GetWrtShell().GetDrawView(); 632*cdf0e10cSrcweir ASSERT( pSdrView, "IsTextTool without DrawView?" ); 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir if (pSdrView->IsCreateMode()) 635*cdf0e10cSrcweir pSdrView->SetCreateMode(sal_False); 636*cdf0e10cSrcweir 637*cdf0e10cSrcweir pSdrView->TakeCurrentObj(nId,nInvent); 638*cdf0e10cSrcweir return (nInvent==SdrInventor); 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir /*-------------------------------------------------------------------- 642*cdf0e10cSrcweir Beschreibung: 643*cdf0e10cSrcweir --------------------------------------------------------------------*/ 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir SdrView* SwView::GetDrawView() const 648*cdf0e10cSrcweir { 649*cdf0e10cSrcweir return GetWrtShell().GetDrawView(); 650*cdf0e10cSrcweir } 651*cdf0e10cSrcweir 652*cdf0e10cSrcweir /*-------------------------------------------------------------------- 653*cdf0e10cSrcweir Beschreibung: 654*cdf0e10cSrcweir --------------------------------------------------------------------*/ 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir 658*cdf0e10cSrcweir sal_Bool SwView::IsBezierEditMode() 659*cdf0e10cSrcweir { 660*cdf0e10cSrcweir return (!IsDrawSelMode() && GetWrtShell().GetDrawView()->HasMarkablePoints()); 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir /*-------------------------------------------------------------------- 664*cdf0e10cSrcweir Beschreibung: 665*cdf0e10cSrcweir --------------------------------------------------------------------*/ 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir sal_Bool SwView::IsFormMode() const 668*cdf0e10cSrcweir { 669*cdf0e10cSrcweir if (GetDrawFuncPtr() && GetDrawFuncPtr()->IsCreateObj()) 670*cdf0e10cSrcweir { 671*cdf0e10cSrcweir return (GetDrawFuncPtr()->IsInsertForm()); 672*cdf0e10cSrcweir } 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir return AreOnlyFormsSelected(); 675*cdf0e10cSrcweir } 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir /*-------------------------------------------------------------------- 678*cdf0e10cSrcweir Beschreibung: 679*cdf0e10cSrcweir --------------------------------------------------------------------*/ 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir void SwView::SetDrawFuncPtr(SwDrawBase* pFuncPtr) 684*cdf0e10cSrcweir { 685*cdf0e10cSrcweir if (pDrawActual) 686*cdf0e10cSrcweir delete pDrawActual; 687*cdf0e10cSrcweir pDrawActual = pFuncPtr; 688*cdf0e10cSrcweir } 689*cdf0e10cSrcweir 690*cdf0e10cSrcweir /*-------------------------------------------------------------------- 691*cdf0e10cSrcweir Beschreibung: 692*cdf0e10cSrcweir --------------------------------------------------------------------*/ 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir void SwView::SetSelDrawSlot() 695*cdf0e10cSrcweir { 696*cdf0e10cSrcweir nDrawSfxId = SID_OBJECT_SELECT; 697*cdf0e10cSrcweir sDrawCustom.Erase(); 698*cdf0e10cSrcweir } 699*cdf0e10cSrcweir 700*cdf0e10cSrcweir /*-------------------------------------------------------------------- 701*cdf0e10cSrcweir Beschreibung: 702*cdf0e10cSrcweir --------------------------------------------------------------------*/ 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir sal_Bool SwView::AreOnlyFormsSelected() const 705*cdf0e10cSrcweir { 706*cdf0e10cSrcweir if ( GetWrtShell().IsFrmSelected() ) 707*cdf0e10cSrcweir return sal_False; 708*cdf0e10cSrcweir 709*cdf0e10cSrcweir sal_Bool bForm = sal_True; 710*cdf0e10cSrcweir 711*cdf0e10cSrcweir SdrView* pSdrView = GetWrtShell().GetDrawView(); 712*cdf0e10cSrcweir 713*cdf0e10cSrcweir const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); 714*cdf0e10cSrcweir sal_uInt32 nCount = rMarkList.GetMarkCount(); 715*cdf0e10cSrcweir 716*cdf0e10cSrcweir if (nCount) 717*cdf0e10cSrcweir { 718*cdf0e10cSrcweir for (sal_uInt32 i = 0; i < nCount; i++) 719*cdf0e10cSrcweir { 720*cdf0e10cSrcweir // Sind ausser Controls noch normale Draw-Objekte selektiert? 721*cdf0e10cSrcweir SdrObject *pSdrObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 722*cdf0e10cSrcweir 723*cdf0e10cSrcweir if (!HasOnlyObj(pSdrObj, FmFormInventor)) 724*cdf0e10cSrcweir { 725*cdf0e10cSrcweir bForm = sal_False; 726*cdf0e10cSrcweir break; 727*cdf0e10cSrcweir } 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir } 730*cdf0e10cSrcweir else 731*cdf0e10cSrcweir bForm = sal_False; 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir return bForm; 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir /*-------------------------------------------------------------------- 737*cdf0e10cSrcweir Beschreibung: 738*cdf0e10cSrcweir --------------------------------------------------------------------*/ 739*cdf0e10cSrcweir 740*cdf0e10cSrcweir sal_Bool SwView::HasDrwObj(SdrObject *pSdrObj) const 741*cdf0e10cSrcweir { 742*cdf0e10cSrcweir sal_Bool bRet = sal_False; 743*cdf0e10cSrcweir 744*cdf0e10cSrcweir if (pSdrObj->IsGroupObject()) 745*cdf0e10cSrcweir { 746*cdf0e10cSrcweir SdrObjList* pList = pSdrObj->GetSubList(); 747*cdf0e10cSrcweir sal_uInt32 nCnt = pList->GetObjCount(); 748*cdf0e10cSrcweir 749*cdf0e10cSrcweir for (sal_uInt32 i = 0; i < nCnt; i++) 750*cdf0e10cSrcweir if ((bRet = HasDrwObj(pList->GetObj(i))) == sal_True) 751*cdf0e10cSrcweir break; 752*cdf0e10cSrcweir } 753*cdf0e10cSrcweir else if (SdrInventor == pSdrObj->GetObjInventor() || pSdrObj->Is3DObj()) 754*cdf0e10cSrcweir return sal_True; 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir return bRet; 757*cdf0e10cSrcweir } 758*cdf0e10cSrcweir 759*cdf0e10cSrcweir /*-------------------------------------------------------------------- 760*cdf0e10cSrcweir Beschreibung: 761*cdf0e10cSrcweir --------------------------------------------------------------------*/ 762*cdf0e10cSrcweir 763*cdf0e10cSrcweir sal_Bool SwView::HasOnlyObj(SdrObject *pSdrObj, sal_uInt32 eObjInventor) const 764*cdf0e10cSrcweir { 765*cdf0e10cSrcweir sal_Bool bRet = sal_False; 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir if (pSdrObj->IsGroupObject()) 768*cdf0e10cSrcweir { 769*cdf0e10cSrcweir SdrObjList* pList = pSdrObj->GetSubList(); 770*cdf0e10cSrcweir sal_uInt32 nCnt = pList->GetObjCount(); 771*cdf0e10cSrcweir 772*cdf0e10cSrcweir for (sal_uInt32 i = 0; i < nCnt; i++) 773*cdf0e10cSrcweir if ((bRet = HasOnlyObj(pList->GetObj(i), eObjInventor)) == sal_False) 774*cdf0e10cSrcweir break; 775*cdf0e10cSrcweir } 776*cdf0e10cSrcweir else if (eObjInventor == pSdrObj->GetObjInventor()) 777*cdf0e10cSrcweir return sal_True; 778*cdf0e10cSrcweir 779*cdf0e10cSrcweir return bRet; 780*cdf0e10cSrcweir } 781*cdf0e10cSrcweir 782*cdf0e10cSrcweir 783*cdf0e10cSrcweir //#i87414# mod 784*cdf0e10cSrcweir IMPL_LINK(SwView, OnlineSpellCallback, SpellCallbackInfo*, pInfo) 785*cdf0e10cSrcweir { 786*cdf0e10cSrcweir if (pInfo->nCommand == SPELLCMD_STARTSPELLDLG) 787*cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON); 788*cdf0e10cSrcweir return 0; 789*cdf0e10cSrcweir } 790*cdf0e10cSrcweir 791*cdf0e10cSrcweir /*-------------------------------------------------------------------- 792*cdf0e10cSrcweir Beschreibung: 793*cdf0e10cSrcweir --------------------------------------------------------------------*/ 794*cdf0e10cSrcweir sal_Bool SwView::ExecDrwTxtSpellPopup(const Point& rPt) 795*cdf0e10cSrcweir { 796*cdf0e10cSrcweir sal_Bool bRet = sal_False; 797*cdf0e10cSrcweir SdrView *pSdrView = pWrtShell->GetDrawView(); 798*cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); 799*cdf0e10cSrcweir Point aPos( GetEditWin().LogicToPixel( rPt ) ); 800*cdf0e10cSrcweir 801*cdf0e10cSrcweir if (pOLV->IsWrongSpelledWordAtPos( aPos )) 802*cdf0e10cSrcweir { 803*cdf0e10cSrcweir bRet = sal_True; 804*cdf0e10cSrcweir Link aLink = LINK(this, SwView, OnlineSpellCallback); 805*cdf0e10cSrcweir pOLV->ExecuteSpellPopup( aPos,&aLink ); 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir return bRet; 808*cdf0e10cSrcweir } 809*cdf0e10cSrcweir 810*cdf0e10cSrcweir /*-------------------------------------------------------------------- 811*cdf0e10cSrcweir Beschreibung: 812*cdf0e10cSrcweir --------------------------------------------------------------------*/ 813*cdf0e10cSrcweir 814*cdf0e10cSrcweir 815*cdf0e10cSrcweir 816*cdf0e10cSrcweir sal_Bool SwView::IsDrawTextHyphenate() 817*cdf0e10cSrcweir { 818*cdf0e10cSrcweir SdrView *pSdrView = pWrtShell->GetDrawView(); 819*cdf0e10cSrcweir sal_Bool bHyphenate = sal_False; 820*cdf0e10cSrcweir 821*cdf0e10cSrcweir SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool(), 822*cdf0e10cSrcweir EE_PARA_HYPHENATE, EE_PARA_HYPHENATE ); 823*cdf0e10cSrcweir if( pSdrView->GetAttributes( aNewAttr ) && 824*cdf0e10cSrcweir aNewAttr.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE ) 825*cdf0e10cSrcweir bHyphenate = ((const SfxBoolItem&)aNewAttr.Get( EE_PARA_HYPHENATE )). 826*cdf0e10cSrcweir GetValue(); 827*cdf0e10cSrcweir 828*cdf0e10cSrcweir return bHyphenate; 829*cdf0e10cSrcweir } 830*cdf0e10cSrcweir 831*cdf0e10cSrcweir /*-------------------------------------------------------------------- 832*cdf0e10cSrcweir Beschreibung: 833*cdf0e10cSrcweir --------------------------------------------------------------------*/ 834*cdf0e10cSrcweir 835*cdf0e10cSrcweir 836*cdf0e10cSrcweir 837*cdf0e10cSrcweir void SwView::HyphenateDrawText() 838*cdf0e10cSrcweir { 839*cdf0e10cSrcweir SdrView *pSdrView = pWrtShell->GetDrawView(); 840*cdf0e10cSrcweir sal_Bool bHyphenate = IsDrawTextHyphenate(); 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE ); 843*cdf0e10cSrcweir aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, !bHyphenate ) ); 844*cdf0e10cSrcweir pSdrView->SetAttributes( aSet ); 845*cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(FN_HYPHENATE_OPT_DLG); 846*cdf0e10cSrcweir } 847*cdf0e10cSrcweir 848*cdf0e10cSrcweir 849*cdf0e10cSrcweir 850