LCOV - code coverage report
Current view: top level - sw/source/ui/shells - drawdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 89 0.0 %
Date: 2012-08-25 Functions: 0 3 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 137 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <svx/svxids.hrc>
      30                 :            : #include <vcl/msgbox.hxx>
      31                 :            : #include <sfx2/request.hxx>
      32                 :            : #include <sfx2/dispatch.hxx>
      33                 :            : #include <svx/svdview.hxx>
      34                 :            : #include <svx/drawitem.hxx>
      35                 :            : 
      36                 :            : #include <svx/xtable.hxx>
      37                 :            : #include "view.hxx"
      38                 :            : #include "wrtsh.hxx"
      39                 :            : #include "docsh.hxx"
      40                 :            : #include "cmdid.h"
      41                 :            : 
      42                 :            : #include "drawsh.hxx"
      43                 :            : #include <svx/svxdlg.hxx>
      44                 :            : #include <svx/dialogs.hrc>
      45                 :            : 
      46                 :          0 : void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
      47                 :            : {
      48         [ #  # ]:          0 :     SwWrtShell*     pSh     = &GetShell();
      49         [ #  # ]:          0 :     SdrView*        pView   = pSh->GetDrawView();
      50                 :          0 :     SdrModel*       pDoc    = pView->GetModel();
      51                 :          0 :     sal_Bool            bChanged = pDoc->IsChanged();
      52         [ #  # ]:          0 :     pDoc->SetChanged(sal_False);
      53                 :            : 
      54         [ #  # ]:          0 :     SfxItemSet aNewAttr( pDoc->GetItemPool() );
      55         [ #  # ]:          0 :     pView->GetAttributes( aNewAttr );
      56                 :            : 
      57         [ #  # ]:          0 :     GetView().NoRotate();
      58                 :            : 
      59   [ #  #  #  # ]:          0 :     switch (rReq.GetSlot())
      60                 :            :     {
      61                 :            :         case FN_DRAWTEXT_ATTR_DLG:
      62                 :            :         {
      63         [ #  # ]:          0 :             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
      64         [ #  # ]:          0 :             if ( pFact )
      65                 :            :             {
      66         [ #  # ]:          0 :                 SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( NULL, &aNewAttr, pView );
      67         [ #  # ]:          0 :                 sal_uInt16 nResult = pDlg->Execute();
      68                 :            : 
      69         [ #  # ]:          0 :                 if (nResult == RET_OK)
      70                 :            :                 {
      71         [ #  # ]:          0 :                     if (pView->AreObjectsMarked())
      72                 :            :                     {
      73         [ #  # ]:          0 :                         pSh->StartAction();
      74 [ #  # ][ #  # ]:          0 :                         pView->SetAttributes(*pDlg->GetOutputItemSet());
      75 [ #  # ][ #  # ]:          0 :                         rReq.Done(*(pDlg->GetOutputItemSet()));
      76         [ #  # ]:          0 :                         pSh->EndAction();
      77                 :            :                     }
      78                 :            :                 }
      79                 :            : 
      80 [ #  # ][ #  # ]:          0 :                 delete( pDlg );
      81                 :            :             }
      82                 :            :         }
      83                 :          0 :         break;
      84                 :            : 
      85                 :            :         case SID_ATTRIBUTES_AREA:
      86                 :            :         {
      87                 :          0 :             sal_Bool bHasMarked = pView->AreObjectsMarked();
      88                 :            : 
      89         [ #  # ]:          0 :             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
      90                 :            :             AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog( NULL,
      91                 :            :                                                                             &aNewAttr,
      92                 :            :                                                                             pDoc,
      93         [ #  # ]:          0 :                                                                             pView);
      94 [ #  # ][ #  # ]:          0 :             if (pDlg->Execute() == RET_OK)
      95                 :            :             {
      96         [ #  # ]:          0 :                 pSh->StartAction();
      97         [ #  # ]:          0 :                 if (bHasMarked)
      98 [ #  # ][ #  # ]:          0 :                     pView->SetAttributes(*pDlg->GetOutputItemSet());
      99                 :            :                 else
     100 [ #  # ][ #  # ]:          0 :                     pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), sal_False);
     101         [ #  # ]:          0 :                 pSh->EndAction();
     102                 :            : 
     103                 :            :                 static sal_uInt16 aInval[] =
     104                 :            :                 {
     105                 :            :                     SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, 0
     106                 :            :                 };
     107                 :          0 :                 SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
     108         [ #  # ]:          0 :                 rBnd.Invalidate(aInval);
     109         [ #  # ]:          0 :                 rBnd.Update(SID_ATTR_FILL_STYLE);
     110         [ #  # ]:          0 :                 rBnd.Update(SID_ATTR_FILL_COLOR);
     111                 :            :             }
     112 [ #  # ][ #  # ]:          0 :             delete pDlg;
     113                 :            :         }
     114                 :          0 :         break;
     115                 :            : 
     116                 :            :         case SID_ATTRIBUTES_LINE:
     117                 :            :         {
     118                 :          0 :             sal_Bool bHasMarked = pView->AreObjectsMarked();
     119                 :            : 
     120                 :          0 :             const SdrObject* pObj = NULL;
     121                 :          0 :             const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     122         [ #  # ]:          0 :             if( rMarkList.GetMarkCount() == 1 )
     123 [ #  # ][ #  # ]:          0 :                 pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     124                 :            : 
     125         [ #  # ]:          0 :             SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     126                 :            :             OSL_ENSURE(pFact, "Dialogdiet Factory fail!");
     127                 :            :             SfxAbstractTabDialog * pDlg = pFact->CreateSvxLineTabDialog( NULL,
     128                 :            :                     &aNewAttr,
     129                 :            :                 pDoc,
     130                 :            :                 pObj,
     131         [ #  # ]:          0 :                 bHasMarked);
     132                 :            :             OSL_ENSURE(pDlg, "Dialogdiet fail!");
     133 [ #  # ][ #  # ]:          0 :             if (pDlg->Execute() == RET_OK)
     134                 :            :             {
     135         [ #  # ]:          0 :                 pSh->StartAction();
     136         [ #  # ]:          0 :                 if(bHasMarked)
     137 [ #  # ][ #  # ]:          0 :                     pView->SetAttrToMarked(*pDlg->GetOutputItemSet(), sal_False);
     138                 :            :                 else
     139 [ #  # ][ #  # ]:          0 :                     pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), sal_False);
     140         [ #  # ]:          0 :                 pSh->EndAction();
     141                 :            : 
     142                 :            :                 static sal_uInt16 aInval[] =
     143                 :            :                 {
     144                 :            :                     SID_ATTR_LINE_STYLE, SID_ATTR_LINE_WIDTH,
     145                 :            :                     SID_ATTR_LINE_COLOR, 0
     146                 :            :                 };
     147                 :            : 
     148         [ #  # ]:          0 :                 GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
     149                 :            :             }
     150 [ #  # ][ #  # ]:          0 :             delete pDlg;
     151                 :            :         }
     152                 :          0 :         break;
     153                 :            : 
     154                 :            :         default:
     155                 :          0 :             break;
     156                 :            :     }
     157                 :            : 
     158                 :            : 
     159         [ #  # ]:          0 :     if (pDoc->IsChanged())
     160 [ #  # ][ #  # ]:          0 :         GetShell().SetModified();
     161                 :            :     else
     162         [ #  # ]:          0 :         if (bChanged)
     163 [ #  # ][ #  # ]:          0 :             pDoc->SetChanged(sal_True);
     164                 :          0 : }
     165                 :            : 
     166                 :          0 : void SwDrawShell::ExecDrawAttrArgs(SfxRequest& rReq)
     167                 :            : {
     168                 :          0 :     SwWrtShell* pSh   = &GetShell();
     169                 :          0 :     SdrView*    pView = pSh->GetDrawView();
     170                 :          0 :     const SfxItemSet* pArgs = rReq.GetArgs();
     171                 :          0 :     sal_Bool        bChanged = pView->GetModel()->IsChanged();
     172                 :          0 :     pView->GetModel()->SetChanged(sal_False);
     173                 :            : 
     174                 :          0 :     GetView().NoRotate();
     175                 :            : 
     176         [ #  # ]:          0 :     if (pArgs)
     177                 :            :     {
     178         [ #  # ]:          0 :         if(pView->AreObjectsMarked())
     179                 :          0 :             pView->SetAttrToMarked(*rReq.GetArgs(), sal_False);
     180                 :            :         else
     181                 :          0 :             pView->SetDefaultAttr(*rReq.GetArgs(), sal_False);
     182                 :            :     }
     183                 :            :     else
     184                 :            :     {
     185                 :          0 :         SfxDispatcher* pDis = pSh->GetView().GetViewFrame()->GetDispatcher();
     186      [ #  #  # ]:          0 :         switch (rReq.GetSlot())
     187                 :            :         {
     188                 :            :             case SID_ATTR_FILL_STYLE:
     189                 :            :             case SID_ATTR_FILL_COLOR:
     190                 :            :             case SID_ATTR_FILL_GRADIENT:
     191                 :            :             case SID_ATTR_FILL_HATCH:
     192                 :            :             case SID_ATTR_FILL_BITMAP:
     193                 :          0 :                 pDis->Execute(SID_ATTRIBUTES_AREA, sal_False);
     194                 :          0 :                 break;
     195                 :            :             case SID_ATTR_LINE_STYLE:
     196                 :            :             case SID_ATTR_LINE_DASH:
     197                 :            :             case SID_ATTR_LINE_WIDTH:
     198                 :            :             case SID_ATTR_LINE_COLOR:
     199                 :          0 :                 pDis->Execute(SID_ATTRIBUTES_LINE, sal_False);
     200                 :          0 :                 break;
     201                 :            :         }
     202                 :            :     }
     203         [ #  # ]:          0 :     if (pView->GetModel()->IsChanged())
     204                 :          0 :         GetShell().SetModified();
     205                 :            :     else
     206         [ #  # ]:          0 :         if (bChanged)
     207                 :          0 :             pView->GetModel()->SetChanged(sal_True);
     208                 :          0 : }
     209                 :            : 
     210                 :          0 : void SwDrawShell::GetDrawAttrState(SfxItemSet& rSet)
     211                 :            : {
     212                 :          0 :     SdrView* pSdrView = GetShell().GetDrawView();
     213                 :            : 
     214         [ #  # ]:          0 :     if (pSdrView->AreObjectsMarked())
     215                 :            :     {
     216                 :          0 :         sal_Bool bDisable = Disable( rSet );
     217                 :            : 
     218         [ #  # ]:          0 :         if( !bDisable )
     219                 :          0 :             pSdrView->GetAttributes( rSet );
     220                 :            :     }
     221                 :            :     else
     222                 :          0 :         rSet.Put(pSdrView->GetDefaultAttr());
     223                 :          0 : }
     224                 :            : 
     225                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10