LCOV - code coverage report
Current view: top level - sw/source/core/uibase/shells - drawsh.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 260 0.0 %
Date: 2014-04-14 Functions: 0 18 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10