LCOV - code coverage report
Current view: top level - sw/source/core/uibase/shells - drawdlg.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 91 0.0 %
Date: 2014-04-14 Functions: 0 5 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 <svx/svxids.hrc>
      21             : #include <vcl/msgbox.hxx>
      22             : #include <sfx2/request.hxx>
      23             : #include <sfx2/dispatch.hxx>
      24             : #include <svx/svdview.hxx>
      25             : #include <svx/drawitem.hxx>
      26             : 
      27             : #include <svx/xtable.hxx>
      28             : #include "view.hxx"
      29             : #include "wrtsh.hxx"
      30             : #include "docsh.hxx"
      31             : #include "cmdid.h"
      32             : 
      33             : #include "drawsh.hxx"
      34             : #include <svx/svxdlg.hxx>
      35             : #include <svx/dialogs.hrc>
      36             : 
      37           0 : void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
      38             : {
      39           0 :     SwWrtShell*     pSh     = &GetShell();
      40           0 :     SdrView*        pView   = pSh->GetDrawView();
      41           0 :     SdrModel*       pDoc    = pView->GetModel();
      42           0 :     sal_Bool            bChanged = pDoc->IsChanged();
      43           0 :     pDoc->SetChanged(false);
      44             : 
      45           0 :     SfxItemSet aNewAttr( pDoc->GetItemPool() );
      46           0 :     pView->GetAttributes( aNewAttr );
      47             : 
      48           0 :     GetView().NoRotate();
      49             : 
      50           0 :     switch (rReq.GetSlot())
      51             :     {
      52             :         case FN_DRAWTEXT_ATTR_DLG:
      53             :         {
      54           0 :             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
      55           0 :             if ( pFact )
      56             :             {
      57           0 :                 SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( NULL, &aNewAttr, pView );
      58           0 :                 sal_uInt16 nResult = pDlg->Execute();
      59             : 
      60           0 :                 if (nResult == RET_OK)
      61             :                 {
      62           0 :                     if (pView->AreObjectsMarked())
      63             :                     {
      64           0 :                         pSh->StartAction();
      65           0 :                         pView->SetAttributes(*pDlg->GetOutputItemSet());
      66           0 :                         rReq.Done(*(pDlg->GetOutputItemSet()));
      67           0 :                         pSh->EndAction();
      68             :                     }
      69             :                 }
      70             : 
      71           0 :                 delete( pDlg );
      72             :             }
      73             :         }
      74           0 :         break;
      75             : 
      76             :         case SID_ATTRIBUTES_AREA:
      77             :         {
      78           0 :             sal_Bool bHasMarked = pView->AreObjectsMarked();
      79             : 
      80           0 :             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
      81             :             AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog( NULL,
      82             :                                                                             &aNewAttr,
      83             :                                                                             pDoc,
      84           0 :                                                                             true);
      85           0 :             if (pDlg->Execute() == RET_OK)
      86             :             {
      87           0 :                 pSh->StartAction();
      88           0 :                 if (bHasMarked)
      89           0 :                     pView->SetAttributes(*pDlg->GetOutputItemSet());
      90             :                 else
      91           0 :                     pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), false);
      92           0 :                 pSh->EndAction();
      93             : 
      94             :                 static sal_uInt16 aInval[] =
      95             :                 {
      96             :                     SID_ATTR_FILL_STYLE,
      97             :                     SID_ATTR_FILL_COLOR,
      98             :                     SID_ATTR_FILL_TRANSPARENCE,
      99             :                     SID_ATTR_FILL_FLOATTRANSPARENCE,
     100             :                     0
     101             :                 };
     102           0 :                 SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
     103           0 :                 rBnd.Invalidate(aInval);
     104           0 :                 rBnd.Update(SID_ATTR_FILL_STYLE);
     105           0 :                 rBnd.Update(SID_ATTR_FILL_COLOR);
     106           0 :                 rBnd.Update(SID_ATTR_FILL_TRANSPARENCE);
     107           0 :                 rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE);
     108             :             }
     109           0 :             delete pDlg;
     110             :         }
     111           0 :         break;
     112             : 
     113             :         case SID_ATTRIBUTES_LINE:
     114             :         {
     115           0 :             sal_Bool bHasMarked = pView->AreObjectsMarked();
     116             : 
     117           0 :             const SdrObject* pObj = NULL;
     118           0 :             const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     119           0 :             if( rMarkList.GetMarkCount() == 1 )
     120           0 :                 pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     121             : 
     122           0 :             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     123             :             OSL_ENSURE(pFact, "Dialogdiet Factory fail!");
     124             :             SfxAbstractTabDialog * pDlg = pFact->CreateSvxLineTabDialog( NULL,
     125             :                     &aNewAttr,
     126             :                 pDoc,
     127             :                 pObj,
     128           0 :                 bHasMarked);
     129             :             OSL_ENSURE(pDlg, "Dialogdiet fail!");
     130           0 :             if (pDlg->Execute() == RET_OK)
     131             :             {
     132           0 :                 pSh->StartAction();
     133           0 :                 if(bHasMarked)
     134           0 :                     pView->SetAttrToMarked(*pDlg->GetOutputItemSet(), false);
     135             :                 else
     136           0 :                     pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), false);
     137           0 :                 pSh->EndAction();
     138             : 
     139             :                 static sal_uInt16 aInval[] =
     140             :                 {
     141             :                     SID_ATTR_LINE_STYLE,                // ( SID_SVX_START + 169 )
     142             :                     SID_ATTR_LINE_DASH,                 // ( SID_SVX_START + 170 )
     143             :                     SID_ATTR_LINE_WIDTH,                // ( SID_SVX_START + 171 )
     144             :                     SID_ATTR_LINE_COLOR,                // ( SID_SVX_START + 172 )
     145             :                     SID_ATTR_LINE_START,                // ( SID_SVX_START + 173 )
     146             :                     SID_ATTR_LINE_END,                  // ( SID_SVX_START + 174 )
     147             :                     SID_ATTR_LINE_TRANSPARENCE,         // (SID_SVX_START+1107)
     148             :                     SID_ATTR_LINE_JOINT,                // (SID_SVX_START+1110)
     149             :                     SID_ATTR_LINE_CAP,                  // (SID_SVX_START+1111)
     150             :                     0
     151             :                 };
     152             : 
     153           0 :                 GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
     154             :             }
     155           0 :             delete pDlg;
     156             :         }
     157           0 :         break;
     158             : 
     159             :         default:
     160           0 :             break;
     161             :     }
     162             : 
     163           0 :     if (pDoc->IsChanged())
     164           0 :         GetShell().SetModified();
     165             :     else
     166           0 :         if (bChanged)
     167           0 :             pDoc->SetChanged(true);
     168           0 : }
     169             : 
     170           0 : void SwDrawShell::ExecDrawAttrArgs(SfxRequest& rReq)
     171             : {
     172           0 :     SwWrtShell* pSh   = &GetShell();
     173           0 :     SdrView*    pView = pSh->GetDrawView();
     174           0 :     const SfxItemSet* pArgs = rReq.GetArgs();
     175           0 :     sal_Bool        bChanged = pView->GetModel()->IsChanged();
     176           0 :     pView->GetModel()->SetChanged(false);
     177             : 
     178           0 :     GetView().NoRotate();
     179             : 
     180           0 :     if (pArgs)
     181             :     {
     182           0 :         if(pView->AreObjectsMarked())
     183           0 :             pView->SetAttrToMarked(*rReq.GetArgs(), false);
     184             :         else
     185           0 :             pView->SetDefaultAttr(*rReq.GetArgs(), false);
     186             :     }
     187             :     else
     188             :     {
     189           0 :         SfxDispatcher* pDis = pSh->GetView().GetViewFrame()->GetDispatcher();
     190           0 :         switch (rReq.GetSlot())
     191             :         {
     192             :             case SID_ATTR_FILL_STYLE:
     193             :             case SID_ATTR_FILL_COLOR:
     194             :             case SID_ATTR_FILL_GRADIENT:
     195             :             case SID_ATTR_FILL_HATCH:
     196             :             case SID_ATTR_FILL_BITMAP:
     197             :             case SID_ATTR_FILL_TRANSPARENCE:
     198             :             case SID_ATTR_FILL_FLOATTRANSPARENCE:
     199           0 :                 pDis->Execute(SID_ATTRIBUTES_AREA, sal_False);
     200           0 :                 break;
     201             :             case SID_ATTR_LINE_STYLE:
     202             :             case SID_ATTR_LINE_DASH:
     203             :             case SID_ATTR_LINE_WIDTH:
     204             :             case SID_ATTR_LINE_COLOR:
     205             :             case SID_ATTR_LINE_TRANSPARENCE:
     206             :             case SID_ATTR_LINE_JOINT:
     207             :             case SID_ATTR_LINE_CAP:
     208           0 :                 pDis->Execute(SID_ATTRIBUTES_LINE, sal_False);
     209           0 :                 break;
     210             :         }
     211             :     }
     212           0 :     if (pView->GetModel()->IsChanged())
     213           0 :         GetShell().SetModified();
     214             :     else
     215           0 :         if (bChanged)
     216           0 :             pView->GetModel()->SetChanged(true);
     217           0 : }
     218             : 
     219           0 : void SwDrawShell::GetDrawAttrState(SfxItemSet& rSet)
     220             : {
     221           0 :     SdrView* pSdrView = GetShell().GetDrawView();
     222             : 
     223           0 :     if (pSdrView->AreObjectsMarked())
     224             :     {
     225           0 :         sal_Bool bDisable = Disable( rSet );
     226             : 
     227           0 :         if( !bDisable )
     228           0 :             pSdrView->GetAttributes( rSet );
     229             :     }
     230             :     else
     231           0 :         rSet.Put(pSdrView->GetDefaultAttr());
     232           0 : }
     233             : 
     234             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10