1efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5efeef26fSAndrew Rist * distributed with this work for additional information 6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14efeef26fSAndrew Rist * software distributed under the License is distributed on an 15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17efeef26fSAndrew Rist * specific language governing permissions and limitations 18efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20efeef26fSAndrew Rist *************************************************************/ 21efeef26fSAndrew Rist 22efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <tools/shl.hxx> 29cdf0e10cSrcweir #include <svx/svdview.hxx> 30cdf0e10cSrcweir #include <svx/svdotext.hxx> 31cdf0e10cSrcweir #include <svl/whiter.hxx> 32cdf0e10cSrcweir #include <svx/fontwork.hxx> 33cdf0e10cSrcweir #include <sfx2/request.hxx> 34cdf0e10cSrcweir #include <sfx2/bindings.hxx> 35cdf0e10cSrcweir #include <sfx2/objface.hxx> 36cdf0e10cSrcweir #include <svl/itemiter.hxx> 37cdf0e10cSrcweir #include <svl/srchitem.hxx> 38cdf0e10cSrcweir #include <svx/extrusionbar.hxx> 39cdf0e10cSrcweir #include <svx/fontworkbar.hxx> 40cdf0e10cSrcweir #include <svx/tbxcustomshapes.hxx> 41cdf0e10cSrcweir #include <uitool.hxx> 42cdf0e10cSrcweir #include <wview.hxx> 43cdf0e10cSrcweir #include <swmodule.hxx> 44cdf0e10cSrcweir #include <swwait.hxx> 45cdf0e10cSrcweir #include <docstat.hxx> 46cdf0e10cSrcweir #include <IDocumentStatistics.hxx> 47cdf0e10cSrcweir 48cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 49cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> 50cdf0e10cSrcweir 51cdf0e10cSrcweir #include <svx/xtable.hxx> 52f120fe41SAndre Fischer #include <sfx2/sidebar/EnumContext.hxx> 53ef076a15SArmin Le Grand #include <svx/svdoashp.hxx> 54*52f1c2eeSArmin Le Grand #include <svx/svdoole2.hxx> 55*52f1c2eeSArmin Le Grand #include <sfx2/opengrf.hxx> 56*52f1c2eeSArmin Le Grand #include <svx/svdograf.hxx> 57*52f1c2eeSArmin Le Grand #include <svx/svdundo.hxx> 58*52f1c2eeSArmin Le Grand #include <svx/xbtmpit.hxx> 59cdf0e10cSrcweir 60cdf0e10cSrcweir #include "swundo.hxx" 61cdf0e10cSrcweir #include "wrtsh.hxx" 62cdf0e10cSrcweir #include "cmdid.h" 63cdf0e10cSrcweir #include "globals.hrc" 64cdf0e10cSrcweir #include "helpid.h" 65cdf0e10cSrcweir #include "popup.hrc" 66cdf0e10cSrcweir #include "shells.hrc" 67cdf0e10cSrcweir #include "drwbassh.hxx" 68cdf0e10cSrcweir #include "drawsh.hxx" 69cdf0e10cSrcweir 70cdf0e10cSrcweir #define SwDrawShell 71cdf0e10cSrcweir #include <sfx2/msg.hxx> 72cdf0e10cSrcweir #include "swslots.hxx" 73cdf0e10cSrcweir #include "swabstdlg.hxx" //CHINA001 74cdf0e10cSrcweir #include "misc.hrc" 75cdf0e10cSrcweir 76cdf0e10cSrcweir using namespace ::com::sun::star; 77cdf0e10cSrcweir using namespace ::com::sun::star::uno; 78cdf0e10cSrcweir 79cdf0e10cSrcweir SFX_IMPL_INTERFACE(SwDrawShell, SwDrawBaseShell, SW_RES(STR_SHELLNAME_DRAW)) 80cdf0e10cSrcweir { 81cdf0e10cSrcweir SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRAW_POPUPMENU)); 82cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_DRAW_TOOLBOX)); 83cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION(SvxFontWorkChildWindow::GetChildWindowId()); 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir TYPEINIT1(SwDrawShell,SwDrawBaseShell) 87cdf0e10cSrcweir 88cdf0e10cSrcweir /*-------------------------------------------------------------------- 89cdf0e10cSrcweir Beschreibung: 90cdf0e10cSrcweir --------------------------------------------------------------------*/ 91cdf0e10cSrcweir 92cdf0e10cSrcweir 93*52f1c2eeSArmin Le Grand // #123922# check as the name implies 94*52f1c2eeSArmin Le Grand SdrObject* SwDrawShell::IsSingleFillableNonOLESelected() 95*52f1c2eeSArmin Le Grand { 96*52f1c2eeSArmin Le Grand SwWrtShell &rSh = GetShell(); 97*52f1c2eeSArmin Le Grand SdrView* pSdrView = rSh.GetDrawView(); 98*52f1c2eeSArmin Le Grand 99*52f1c2eeSArmin Le Grand if(!pSdrView) 100*52f1c2eeSArmin Le Grand { 101*52f1c2eeSArmin Le Grand return 0; 102*52f1c2eeSArmin Le Grand } 103*52f1c2eeSArmin Le Grand 104*52f1c2eeSArmin Le Grand if(1 != pSdrView->GetMarkedObjectCount()) 105*52f1c2eeSArmin Le Grand { 106*52f1c2eeSArmin Le Grand return 0; 107*52f1c2eeSArmin Le Grand } 108*52f1c2eeSArmin Le Grand 109*52f1c2eeSArmin Le Grand SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0); 110*52f1c2eeSArmin Le Grand 111*52f1c2eeSArmin Le Grand if(!pPickObj) 112*52f1c2eeSArmin Le Grand { 113*52f1c2eeSArmin Le Grand return 0; 114*52f1c2eeSArmin Le Grand } 115*52f1c2eeSArmin Le Grand 116*52f1c2eeSArmin Le Grand if(!pPickObj->IsClosedObj()) 117*52f1c2eeSArmin Le Grand { 118*52f1c2eeSArmin Le Grand return 0; 119*52f1c2eeSArmin Le Grand } 120*52f1c2eeSArmin Le Grand 121*52f1c2eeSArmin Le Grand if(dynamic_cast< SdrOle2Obj* >(pPickObj)) 122*52f1c2eeSArmin Le Grand { 123*52f1c2eeSArmin Le Grand return 0; 124*52f1c2eeSArmin Le Grand } 125*52f1c2eeSArmin Le Grand 126*52f1c2eeSArmin Le Grand return pPickObj; 127*52f1c2eeSArmin Le Grand } 128*52f1c2eeSArmin Le Grand 129*52f1c2eeSArmin Le Grand // #123922# insert given graphic data dependent of the object type in focus 130*52f1c2eeSArmin Le Grand void SwDrawShell::InsertPictureFromFile(SdrObject& rObject) 131*52f1c2eeSArmin Le Grand { 132*52f1c2eeSArmin Le Grand SwWrtShell &rSh = GetShell(); 133*52f1c2eeSArmin Le Grand SdrView* pSdrView = rSh.GetDrawView(); 134*52f1c2eeSArmin Le Grand 135*52f1c2eeSArmin Le Grand if(pSdrView) 136*52f1c2eeSArmin Le Grand { 137*52f1c2eeSArmin Le Grand SvxOpenGraphicDialog aDlg(SW_RESSTR(STR_INSERT_GRAPHIC)); 138*52f1c2eeSArmin Le Grand 139*52f1c2eeSArmin Le Grand if(GRFILTER_OK == aDlg.Execute()) 140*52f1c2eeSArmin Le Grand { 141*52f1c2eeSArmin Le Grand Graphic aGraphic; 142*52f1c2eeSArmin Le Grand int nError(aDlg.GetGraphic(aGraphic)); 143*52f1c2eeSArmin Le Grand 144*52f1c2eeSArmin Le Grand if(GRFILTER_OK == nError) 145*52f1c2eeSArmin Le Grand { 146*52f1c2eeSArmin Le Grand const bool bAsLink(aDlg.IsAsLink()); 147*52f1c2eeSArmin Le Grand SdrObject* pResult = &rObject; 148*52f1c2eeSArmin Le Grand 149*52f1c2eeSArmin Le Grand rSh.StartUndo(UNDO_PASTE_CLIPBOARD); 150*52f1c2eeSArmin Le Grand 151*52f1c2eeSArmin Le Grand if(dynamic_cast< SdrGrafObj* >(&rObject)) 152*52f1c2eeSArmin Le Grand { 153*52f1c2eeSArmin Le Grand SdrGrafObj* pNewGrafObj = (SdrGrafObj*)rObject.Clone(); 154*52f1c2eeSArmin Le Grand 155*52f1c2eeSArmin Le Grand pNewGrafObj->SetGraphic(aGraphic); 156*52f1c2eeSArmin Le Grand 157*52f1c2eeSArmin Le Grand // #123922# for handling MasterObject and virtual ones correctly, SW 158*52f1c2eeSArmin Le Grand // wants us to call ReplaceObject at the page, but that also 159*52f1c2eeSArmin Le Grand // triggers the same assertion (I tried it), so stay at the view method 160*52f1c2eeSArmin Le Grand pSdrView->ReplaceObjectAtView(&rObject, *pSdrView->GetSdrPageView(), pNewGrafObj); 161*52f1c2eeSArmin Le Grand 162*52f1c2eeSArmin Le Grand // set in all cases - the Clone() will have copied an existing link (!) 163*52f1c2eeSArmin Le Grand pNewGrafObj->SetGraphicLink( 164*52f1c2eeSArmin Le Grand bAsLink ? aDlg.GetPath() : String(), 165*52f1c2eeSArmin Le Grand bAsLink ? aDlg.GetCurrentFilter() : String()); 166*52f1c2eeSArmin Le Grand 167*52f1c2eeSArmin Le Grand pResult = pNewGrafObj; 168*52f1c2eeSArmin Le Grand } 169*52f1c2eeSArmin Le Grand else // if(rObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rObject)) 170*52f1c2eeSArmin Le Grand { 171*52f1c2eeSArmin Le Grand pSdrView->AddUndo(new SdrUndoAttrObj(rObject)); 172*52f1c2eeSArmin Le Grand 173*52f1c2eeSArmin Le Grand SfxItemSet aSet(pSdrView->GetModel()->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP); 174*52f1c2eeSArmin Le Grand 175*52f1c2eeSArmin Le Grand aSet.Put(XFillStyleItem(XFILL_BITMAP)); 176*52f1c2eeSArmin Le Grand aSet.Put(XFillBitmapItem(String(), aGraphic)); 177*52f1c2eeSArmin Le Grand rObject.SetMergedItemSetAndBroadcast(aSet); 178*52f1c2eeSArmin Le Grand } 179*52f1c2eeSArmin Le Grand 180*52f1c2eeSArmin Le Grand rSh.EndUndo( UNDO_END ); 181*52f1c2eeSArmin Le Grand 182*52f1c2eeSArmin Le Grand if(pResult) 183*52f1c2eeSArmin Le Grand { 184*52f1c2eeSArmin Le Grand // we are done; mark the modified/new object 185*52f1c2eeSArmin Le Grand pSdrView->MarkObj(pResult, pSdrView->GetSdrPageView()); 186*52f1c2eeSArmin Le Grand } 187*52f1c2eeSArmin Le Grand } 188*52f1c2eeSArmin Le Grand } 189*52f1c2eeSArmin Le Grand } 190*52f1c2eeSArmin Le Grand } 191*52f1c2eeSArmin Le Grand 192cdf0e10cSrcweir void SwDrawShell::Execute(SfxRequest &rReq) 193cdf0e10cSrcweir { 194cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 195cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 196cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 197cdf0e10cSrcweir SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings(); 198cdf0e10cSrcweir sal_uInt16 nSlotId = rReq.GetSlot(); 199cdf0e10cSrcweir sal_Bool bChanged = pSdrView->GetModel()->IsChanged(); 200cdf0e10cSrcweir 201cdf0e10cSrcweir pSdrView->GetModel()->SetChanged(sal_False); 202cdf0e10cSrcweir 203cdf0e10cSrcweir const SfxPoolItem* pItem; 204cdf0e10cSrcweir if(pArgs) 205cdf0e10cSrcweir pArgs->GetItemState(nSlotId, sal_False, &pItem); 206cdf0e10cSrcweir 207cdf0e10cSrcweir sal_Bool bMirror = sal_True; 208cdf0e10cSrcweir 209cdf0e10cSrcweir switch (nSlotId) 210cdf0e10cSrcweir { 211cdf0e10cSrcweir case SID_OBJECT_ROTATE: 212cdf0e10cSrcweir if (rSh.IsObjSelected() && pSdrView->IsRotateAllowed()) 213cdf0e10cSrcweir { 214cdf0e10cSrcweir if (GetView().IsDrawRotate()) 215cdf0e10cSrcweir rSh.SetDragMode(SDRDRAG_MOVE); 216cdf0e10cSrcweir else 217cdf0e10cSrcweir rSh.SetDragMode(SDRDRAG_ROTATE); 218cdf0e10cSrcweir 219cdf0e10cSrcweir GetView().FlipDrawRotate(); 220cdf0e10cSrcweir } 221cdf0e10cSrcweir break; 222cdf0e10cSrcweir 223cdf0e10cSrcweir case SID_BEZIER_EDIT: 224cdf0e10cSrcweir if (GetView().IsDrawRotate()) 225cdf0e10cSrcweir { 226cdf0e10cSrcweir rSh.SetDragMode(SDRDRAG_MOVE); 227cdf0e10cSrcweir GetView().FlipDrawRotate(); 228cdf0e10cSrcweir } 229cdf0e10cSrcweir GetView().FlipDrawSelMode(); 230cdf0e10cSrcweir pSdrView->SetFrameDragSingles(GetView().IsDrawSelMode()); 231cdf0e10cSrcweir GetView().AttrChangedNotify(&rSh); // Shellwechsel... 232cdf0e10cSrcweir break; 233cdf0e10cSrcweir 234cdf0e10cSrcweir case SID_OBJECT_HELL: 235cdf0e10cSrcweir if (rSh.IsObjSelected()) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir rSh.StartUndo( UNDO_START ); 238cdf0e10cSrcweir SetWrapMode(FN_FRAME_WRAPTHRU_TRANSP); 239cdf0e10cSrcweir rSh.SelectionToHell(); 240cdf0e10cSrcweir rSh.EndUndo( UNDO_END ); 241cdf0e10cSrcweir rBnd.Invalidate(SID_OBJECT_HEAVEN); 242cdf0e10cSrcweir } 243cdf0e10cSrcweir break; 244cdf0e10cSrcweir 245cdf0e10cSrcweir case SID_OBJECT_HEAVEN: 246cdf0e10cSrcweir if (rSh.IsObjSelected()) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir rSh.StartUndo( UNDO_START ); 249cdf0e10cSrcweir SetWrapMode(FN_FRAME_WRAPTHRU); 250cdf0e10cSrcweir rSh.SelectionToHeaven(); 251cdf0e10cSrcweir rSh.EndUndo( UNDO_END ); 252cdf0e10cSrcweir rBnd.Invalidate(SID_OBJECT_HELL); 253cdf0e10cSrcweir } 254cdf0e10cSrcweir break; 255cdf0e10cSrcweir 256cdf0e10cSrcweir case FN_TOOL_HIERARCHIE: 257cdf0e10cSrcweir if (rSh.IsObjSelected()) 258cdf0e10cSrcweir { 259cdf0e10cSrcweir rSh.StartUndo( UNDO_START ); 260cdf0e10cSrcweir if (rSh.GetLayerId() == 0) 261cdf0e10cSrcweir { 262cdf0e10cSrcweir SetWrapMode(FN_FRAME_WRAPTHRU); 263cdf0e10cSrcweir rSh.SelectionToHeaven(); 264cdf0e10cSrcweir } 265cdf0e10cSrcweir else 266cdf0e10cSrcweir { 267cdf0e10cSrcweir SetWrapMode(FN_FRAME_WRAPTHRU_TRANSP); 268cdf0e10cSrcweir rSh.SelectionToHell(); 269cdf0e10cSrcweir } 270cdf0e10cSrcweir rSh.EndUndo( UNDO_END ); 271cdf0e10cSrcweir rBnd.Invalidate( SID_OBJECT_HELL ); 272cdf0e10cSrcweir rBnd.Invalidate( SID_OBJECT_HEAVEN ); 273cdf0e10cSrcweir } 274cdf0e10cSrcweir break; 275cdf0e10cSrcweir 276261e9a4bSOliver-Rainer Wittmann case SID_FLIP_VERTICAL: 277cdf0e10cSrcweir bMirror = sal_False; 278cdf0e10cSrcweir /* no break */ 279261e9a4bSOliver-Rainer Wittmann case SID_FLIP_HORIZONTAL: 280cdf0e10cSrcweir rSh.MirrorSelection( bMirror ); 281cdf0e10cSrcweir break; 282cdf0e10cSrcweir 283cdf0e10cSrcweir case SID_FONTWORK: 284cdf0e10cSrcweir { 285cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView())); 286cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); 287cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame(); 288cdf0e10cSrcweir if (pArgs) 289cdf0e10cSrcweir { 290cdf0e10cSrcweir pVFrame->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(), 291cdf0e10cSrcweir ((const SfxBoolItem&)(pArgs->Get(SID_FONTWORK))).GetValue()); 292cdf0e10cSrcweir } 293cdf0e10cSrcweir else 294cdf0e10cSrcweir pVFrame->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() ); 295cdf0e10cSrcweir pVFrame->GetBindings().Invalidate(SID_FONTWORK); 296cdf0e10cSrcweir } 297cdf0e10cSrcweir break; 298cdf0e10cSrcweir case FN_FORMAT_FOOTNOTE_DLG: 299cdf0e10cSrcweir { 300cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 301cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 302cdf0e10cSrcweir 303cdf0e10cSrcweir VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), GetView().GetWrtShell(), DLG_DOC_FOOTNOTE ); 304cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 305cdf0e10cSrcweir pDlg->Execute(); 306cdf0e10cSrcweir delete pDlg; 307cdf0e10cSrcweir break; 308cdf0e10cSrcweir } 309cdf0e10cSrcweir case FN_NUMBERING_OUTLINE_DLG: 310cdf0e10cSrcweir { 311cdf0e10cSrcweir SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); 312cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 313cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 314cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE, 315cdf0e10cSrcweir GetView().GetWindow(), &aTmp, GetView().GetWrtShell()); 316cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 317cdf0e10cSrcweir pDlg->Execute(); 318cdf0e10cSrcweir delete pDlg; 319cdf0e10cSrcweir rReq.Done(); 320cdf0e10cSrcweir } 321cdf0e10cSrcweir break; 322cdf0e10cSrcweir case SID_OPEN_XML_FILTERSETTINGS: 323cdf0e10cSrcweir { 324cdf0e10cSrcweir try 325cdf0e10cSrcweir { 326cdf0e10cSrcweir uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY); 327cdf0e10cSrcweir if( xDialog.is() ) 328cdf0e10cSrcweir { 329cdf0e10cSrcweir xDialog->execute(); 330cdf0e10cSrcweir } 331cdf0e10cSrcweir } 332cdf0e10cSrcweir catch( uno::Exception& ) 333cdf0e10cSrcweir { 334cdf0e10cSrcweir } 335cdf0e10cSrcweir rReq.Ignore (); 336cdf0e10cSrcweir } 337cdf0e10cSrcweir break; 338cdf0e10cSrcweir case FN_WORDCOUNT_DIALOG: 339cdf0e10cSrcweir { 340cdf0e10cSrcweir SwDocStat aCurr; 341cdf0e10cSrcweir SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() ); 342cdf0e10cSrcweir { 343cdf0e10cSrcweir SwWait aWait( *GetView().GetDocShell(), sal_True ); 344cdf0e10cSrcweir rSh.StartAction(); 345cdf0e10cSrcweir rSh.CountWords( aCurr ); 346cdf0e10cSrcweir rSh.UpdateDocStat( aDocStat ); 347cdf0e10cSrcweir rSh.EndAction(); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir 350cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 351cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 352cdf0e10cSrcweir AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() ); 353cdf0e10cSrcweir pDialog->SetValues(aCurr, aDocStat ); 354cdf0e10cSrcweir pDialog->Execute(); 355cdf0e10cSrcweir delete pDialog; 356cdf0e10cSrcweir } 357cdf0e10cSrcweir break; 358cdf0e10cSrcweir case SID_EXTRUSION_TOOGLE: 359cdf0e10cSrcweir case SID_EXTRUSION_TILT_DOWN: 360cdf0e10cSrcweir case SID_EXTRUSION_TILT_UP: 361cdf0e10cSrcweir case SID_EXTRUSION_TILT_LEFT: 362cdf0e10cSrcweir case SID_EXTRUSION_TILT_RIGHT: 363cdf0e10cSrcweir case SID_EXTRUSION_3D_COLOR: 364cdf0e10cSrcweir case SID_EXTRUSION_DEPTH: 365cdf0e10cSrcweir case SID_EXTRUSION_DIRECTION: 366cdf0e10cSrcweir case SID_EXTRUSION_PROJECTION: 367cdf0e10cSrcweir case SID_EXTRUSION_LIGHTING_DIRECTION: 368cdf0e10cSrcweir case SID_EXTRUSION_LIGHTING_INTENSITY: 369cdf0e10cSrcweir case SID_EXTRUSION_SURFACE: 370cdf0e10cSrcweir case SID_EXTRUSION_DEPTH_FLOATER: 371cdf0e10cSrcweir case SID_EXTRUSION_DIRECTION_FLOATER: 372cdf0e10cSrcweir case SID_EXTRUSION_LIGHTING_FLOATER: 373cdf0e10cSrcweir case SID_EXTRUSION_SURFACE_FLOATER: 374cdf0e10cSrcweir case SID_EXTRUSION_DEPTH_DIALOG: 375cdf0e10cSrcweir svx::ExtrusionBar::execute( pSdrView, rReq, rBnd ); 376cdf0e10cSrcweir rReq.Ignore (); 377cdf0e10cSrcweir break; 378cdf0e10cSrcweir 379cdf0e10cSrcweir case SID_FONTWORK_SHAPE: 380cdf0e10cSrcweir case SID_FONTWORK_SHAPE_TYPE: 381cdf0e10cSrcweir case SID_FONTWORK_ALIGNMENT: 382cdf0e10cSrcweir case SID_FONTWORK_SAME_LETTER_HEIGHTS: 383cdf0e10cSrcweir case SID_FONTWORK_CHARACTER_SPACING: 384cdf0e10cSrcweir case SID_FONTWORK_KERN_CHARACTER_PAIRS: 385cdf0e10cSrcweir case SID_FONTWORK_CHARACTER_SPACING_FLOATER: 386cdf0e10cSrcweir case SID_FONTWORK_ALIGNMENT_FLOATER: 387cdf0e10cSrcweir case SID_FONTWORK_CHARACTER_SPACING_DIALOG: 388cdf0e10cSrcweir svx::FontworkBar::execute( pSdrView, rReq, rBnd ); 389cdf0e10cSrcweir rReq.Ignore (); 390cdf0e10cSrcweir break; 391cdf0e10cSrcweir 392*52f1c2eeSArmin Le Grand case SID_INSERT_GRAPHIC: 393*52f1c2eeSArmin Le Grand { 394*52f1c2eeSArmin Le Grand // #123922# check if we can do something 395*52f1c2eeSArmin Le Grand SdrObject* pObj = IsSingleFillableNonOLESelected(); 396*52f1c2eeSArmin Le Grand 397*52f1c2eeSArmin Le Grand if(pObj) 398*52f1c2eeSArmin Le Grand { 399*52f1c2eeSArmin Le Grand // ...and if yes, do something 400*52f1c2eeSArmin Le Grand InsertPictureFromFile(*pObj); 401*52f1c2eeSArmin Le Grand bool bBla = true; 402*52f1c2eeSArmin Le Grand } 403*52f1c2eeSArmin Le Grand 404*52f1c2eeSArmin Le Grand break; 405*52f1c2eeSArmin Le Grand } 406*52f1c2eeSArmin Le Grand 407cdf0e10cSrcweir default: 408cdf0e10cSrcweir DBG_ASSERT(!this, "falscher Dispatcher"); 409cdf0e10cSrcweir return; 410cdf0e10cSrcweir } 411cdf0e10cSrcweir if (pSdrView->GetModel()->IsChanged()) 412cdf0e10cSrcweir rSh.SetModified(); 413cdf0e10cSrcweir else if (bChanged) 414cdf0e10cSrcweir pSdrView->GetModel()->SetChanged(sal_True); 415cdf0e10cSrcweir } 416cdf0e10cSrcweir 417cdf0e10cSrcweir /*-------------------------------------------------------------------- 418cdf0e10cSrcweir Beschreibung: 419cdf0e10cSrcweir --------------------------------------------------------------------*/ 420cdf0e10cSrcweir 421cdf0e10cSrcweir void SwDrawShell::GetState(SfxItemSet& rSet) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 424cdf0e10cSrcweir SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList(); 425cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 426cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 427cdf0e10cSrcweir sal_Bool bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT); 428cdf0e10cSrcweir 429cdf0e10cSrcweir if (!bProtected) // Im Parent nachsehen 430cdf0e10cSrcweir bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0; 431cdf0e10cSrcweir 432cdf0e10cSrcweir while( nWhich ) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir switch( nWhich ) 435cdf0e10cSrcweir { 436cdf0e10cSrcweir case SID_OBJECT_HELL: 437cdf0e10cSrcweir if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 0 || bProtected ) 438cdf0e10cSrcweir rSet.DisableItem( nWhich ); 439cdf0e10cSrcweir break; 440cdf0e10cSrcweir 441cdf0e10cSrcweir case SID_OBJECT_HEAVEN: 442cdf0e10cSrcweir if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 1 || bProtected ) 443cdf0e10cSrcweir rSet.DisableItem( nWhich ); 444cdf0e10cSrcweir break; 445cdf0e10cSrcweir 446cdf0e10cSrcweir case FN_TOOL_HIERARCHIE: 447cdf0e10cSrcweir if ( !rSh.IsObjSelected() || bProtected ) 448cdf0e10cSrcweir rSet.DisableItem( nWhich ); 449cdf0e10cSrcweir break; 450cdf0e10cSrcweir 451cdf0e10cSrcweir case SID_OBJECT_ROTATE: 452cdf0e10cSrcweir { 453cdf0e10cSrcweir const sal_Bool bIsRotate = GetView().IsDrawRotate(); 454cdf0e10cSrcweir if ( (!bIsRotate && !pSdrView->IsRotateAllowed()) || bProtected ) 455cdf0e10cSrcweir rSet.DisableItem( nWhich ); 456cdf0e10cSrcweir else 457cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bIsRotate ) ); 458cdf0e10cSrcweir } 459cdf0e10cSrcweir break; 460cdf0e10cSrcweir 461cdf0e10cSrcweir case SID_BEZIER_EDIT: 462cdf0e10cSrcweir if (!Disable(rSet, nWhich)) 463cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, !GetView().IsDrawSelMode())); 464cdf0e10cSrcweir break; 465cdf0e10cSrcweir 466ee093554SAndre Fischer case SID_FLIP_VERTICAL: 467cdf0e10cSrcweir if ( !pSdrView->IsMirrorAllowed() || bProtected ) 468261e9a4bSOliver-Rainer Wittmann { 469cdf0e10cSrcweir rSet.DisableItem( nWhich ); 470261e9a4bSOliver-Rainer Wittmann } 471261e9a4bSOliver-Rainer Wittmann else 472261e9a4bSOliver-Rainer Wittmann { 473261e9a4bSOliver-Rainer Wittmann // TTTT - needs to be adapted in aw080: 474261e9a4bSOliver-Rainer Wittmann // state is not kept for drawing objects --> provide not flipped state 475261e9a4bSOliver-Rainer Wittmann rSet.Put( SfxBoolItem( nWhich, sal_False ) ); 476261e9a4bSOliver-Rainer Wittmann } 477261e9a4bSOliver-Rainer Wittmann break; 478261e9a4bSOliver-Rainer Wittmann 479261e9a4bSOliver-Rainer Wittmann case SID_FLIP_HORIZONTAL: 480261e9a4bSOliver-Rainer Wittmann if ( !pSdrView->IsMirrorAllowed() || bProtected ) 481261e9a4bSOliver-Rainer Wittmann { 482261e9a4bSOliver-Rainer Wittmann rSet.DisableItem( nWhich ); 483261e9a4bSOliver-Rainer Wittmann } 484261e9a4bSOliver-Rainer Wittmann else 485261e9a4bSOliver-Rainer Wittmann { 486261e9a4bSOliver-Rainer Wittmann // TTTT - needs to be adapted in aw080: 487261e9a4bSOliver-Rainer Wittmann // state is not kept for drawing objects --> provide not flipped state 488261e9a4bSOliver-Rainer Wittmann rSet.Put( SfxBoolItem( nWhich, sal_False ) ); 489261e9a4bSOliver-Rainer Wittmann } 490cdf0e10cSrcweir break; 491cdf0e10cSrcweir 492cdf0e10cSrcweir case SID_FONTWORK: 493cdf0e10cSrcweir { 494cdf0e10cSrcweir if (bProtected) 495cdf0e10cSrcweir rSet.DisableItem( nWhich ); 496cdf0e10cSrcweir else 497cdf0e10cSrcweir { 498cdf0e10cSrcweir const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); 499cdf0e10cSrcweir rSet.Put(SfxBoolItem( nWhich , GetView().GetViewFrame()->HasChildWindow(nId))); 500cdf0e10cSrcweir } 501cdf0e10cSrcweir } 502cdf0e10cSrcweir break; 503*52f1c2eeSArmin Le Grand 504*52f1c2eeSArmin Le Grand case SID_INSERT_GRAPHIC: 505*52f1c2eeSArmin Le Grand { 506*52f1c2eeSArmin Le Grand // #123922# check if we can do something 507*52f1c2eeSArmin Le Grand SdrObject* pObj = IsSingleFillableNonOLESelected(); 508*52f1c2eeSArmin Le Grand 509*52f1c2eeSArmin Le Grand if(!pObj) 510*52f1c2eeSArmin Le Grand { 511*52f1c2eeSArmin Le Grand rSet.DisableItem(nWhich); 512*52f1c2eeSArmin Le Grand } 513*52f1c2eeSArmin Le Grand 514*52f1c2eeSArmin Le Grand break; 515*52f1c2eeSArmin Le Grand } 516cdf0e10cSrcweir } 517cdf0e10cSrcweir nWhich = aIter.NextWhich(); 518cdf0e10cSrcweir } 519cdf0e10cSrcweir svx::ExtrusionBar::getState( pSdrView, rSet ); 520cdf0e10cSrcweir svx::FontworkBar::getState( pSdrView, rSet ); 521cdf0e10cSrcweir } 522cdf0e10cSrcweir 523cdf0e10cSrcweir /*-------------------------------------------------------------------- 524cdf0e10cSrcweir Beschreibung: 525cdf0e10cSrcweir --------------------------------------------------------------------*/ 526cdf0e10cSrcweir 527cdf0e10cSrcweir 528cdf0e10cSrcweir 529cdf0e10cSrcweir SwDrawShell::SwDrawShell(SwView &_rView) : 530cdf0e10cSrcweir SwDrawBaseShell(_rView) 531cdf0e10cSrcweir { 532cdf0e10cSrcweir SetHelpId(SW_DRAWSHELL); 533cdf0e10cSrcweir SetName(String::CreateFromAscii("Draw")); 534f120fe41SAndre Fischer 535f120fe41SAndre Fischer SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Draw)); 536cdf0e10cSrcweir } 537cdf0e10cSrcweir 538cdf0e10cSrcweir /************************************************************************* 539cdf0e10cSrcweir |* 540cdf0e10cSrcweir |* SfxRequests fuer FontWork bearbeiten 541cdf0e10cSrcweir |* 542cdf0e10cSrcweir \************************************************************************/ 543cdf0e10cSrcweir 544cdf0e10cSrcweir 545cdf0e10cSrcweir 546cdf0e10cSrcweir void SwDrawShell::ExecFormText(SfxRequest& rReq) 547cdf0e10cSrcweir { 548cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 549cdf0e10cSrcweir SdrView* pDrView = rSh.GetDrawView(); 550cdf0e10cSrcweir sal_Bool bChanged = pDrView->GetModel()->IsChanged(); 551cdf0e10cSrcweir pDrView->GetModel()->SetChanged(sal_False); 552cdf0e10cSrcweir 553cdf0e10cSrcweir const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); 554cdf0e10cSrcweir 555cdf0e10cSrcweir if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() ) 556cdf0e10cSrcweir { 557cdf0e10cSrcweir const SfxItemSet& rSet = *rReq.GetArgs(); 558cdf0e10cSrcweir 559cdf0e10cSrcweir if ( pDrView->IsTextEdit() ) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir pDrView->SdrEndTextEdit( sal_True ); 562cdf0e10cSrcweir GetView().AttrChangedNotify(&rSh); 563cdf0e10cSrcweir } 564cdf0e10cSrcweir 565cdf0e10cSrcweir pDrView->SetAttributes(rSet); 566cdf0e10cSrcweir } 567cdf0e10cSrcweir if (pDrView->GetModel()->IsChanged()) 568cdf0e10cSrcweir rSh.SetModified(); 569cdf0e10cSrcweir else 570cdf0e10cSrcweir if (bChanged) 571cdf0e10cSrcweir pDrView->GetModel()->SetChanged(sal_True); 572cdf0e10cSrcweir } 573cdf0e10cSrcweir 574cdf0e10cSrcweir /************************************************************************* 575cdf0e10cSrcweir |* 576cdf0e10cSrcweir |* Statuswerte fuer FontWork zurueckgeben 577cdf0e10cSrcweir |* 578cdf0e10cSrcweir \************************************************************************/ 579cdf0e10cSrcweir 580cdf0e10cSrcweir 581cdf0e10cSrcweir 582cdf0e10cSrcweir void SwDrawShell::GetFormTextState(SfxItemSet& rSet) 583cdf0e10cSrcweir { 584cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 585cdf0e10cSrcweir SdrView* pDrView = rSh.GetDrawView(); 586cdf0e10cSrcweir const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); 587cdf0e10cSrcweir const SdrObject* pObj = NULL; 588cdf0e10cSrcweir SvxFontWorkDialog* pDlg = NULL; 589cdf0e10cSrcweir 590cdf0e10cSrcweir const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); 591cdf0e10cSrcweir 592cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame(); 593cdf0e10cSrcweir if ( pVFrame->HasChildWindow(nId) ) 594cdf0e10cSrcweir pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow()); 595cdf0e10cSrcweir 596cdf0e10cSrcweir if ( rMarkList.GetMarkCount() == 1 ) 597cdf0e10cSrcweir pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 598cdf0e10cSrcweir 599ef076a15SArmin Le Grand const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj); 600ef076a15SArmin Le Grand const bool bDeactivate( 601ef076a15SArmin Le Grand !pObj || 602ef076a15SArmin Le Grand !pTextObj || 603ef076a15SArmin Le Grand !pTextObj->HasText() || 604ef076a15SArmin Le Grand dynamic_cast< const SdrObjCustomShape* >(pObj)); // #121538# no FontWork for CustomShapes 605ef076a15SArmin Le Grand 606ef076a15SArmin Le Grand if(bDeactivate) 607cdf0e10cSrcweir { 608ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSTYLE); 609ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTADJUST); 610ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTDISTANCE); 611ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSTART); 612ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTMIRROR); 613ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTHIDEFORM); 614ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTOUTLINE); 615ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSHADOW); 616ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR); 617ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSHDWXVAL); 618ef076a15SArmin Le Grand rSet.DisableItem(XATTR_FORMTXTSHDWYVAL); 619cdf0e10cSrcweir } 620cdf0e10cSrcweir else 621cdf0e10cSrcweir { 622cdf0e10cSrcweir if ( pDlg ) 62397e8a929SArmin Le Grand pDlg->SetColorTable(XColorList::GetStdColorList()); 624cdf0e10cSrcweir 625cdf0e10cSrcweir pDrView->GetAttributes( rSet ); 626cdf0e10cSrcweir } 627cdf0e10cSrcweir } 628