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