LCOV - code coverage report
Current view: top level - sw/source/ui/shells - drawsh.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 198 2.5 %
Date: 2012-08-25 Functions: 3 14 21.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 9 432 2.1 %

           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 <tools/shl.hxx>
      30                 :            : #include <svx/svdview.hxx>
      31                 :            : #include <svx/svdotext.hxx>
      32                 :            : #include <svl/whiter.hxx>
      33                 :            : #include <svx/fontwork.hxx>
      34                 :            : #include <sfx2/request.hxx>
      35                 :            : #include <sfx2/bindings.hxx>
      36                 :            : #include <sfx2/objface.hxx>
      37                 :            : #include <svl/itemiter.hxx>
      38                 :            : #include <svl/srchitem.hxx>
      39                 :            : #include <svx/xftsfit.hxx>
      40                 :            : #include <svx/extrusionbar.hxx>
      41                 :            : #include <svx/fontworkbar.hxx>
      42                 :            : #include <svx/tbxcustomshapes.hxx>
      43                 :            : #include <uitool.hxx>
      44                 :            : #include <wview.hxx>
      45                 :            : #include <swmodule.hxx>
      46                 :            : #include <swwait.hxx>
      47                 :            : #include <docstat.hxx>
      48                 :            : #include <IDocumentStatistics.hxx>
      49                 :            : 
      50                 :            : #include <comphelper/processfactory.hxx>
      51                 :            : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
      52                 :            : 
      53                 :            : #include <svx/xtable.hxx>
      54                 :            : 
      55                 :            : #include "swundo.hxx"
      56                 :            : #include "wrtsh.hxx"
      57                 :            : #include "cmdid.h"
      58                 :            : #include "globals.hrc"
      59                 :            : #include "helpid.h"
      60                 :            : #include "popup.hrc"
      61                 :            : #include "shells.hrc"
      62                 :            : #include "drwbassh.hxx"
      63                 :            : #include "drawsh.hxx"
      64                 :            : 
      65                 :            : #define SwDrawShell
      66                 :            : #include <sfx2/msg.hxx>
      67                 :            : #include "swslots.hxx"
      68                 :            : #include "swabstdlg.hxx"
      69                 :            : #include <wordcountdialog.hxx>
      70                 :            : #include "misc.hrc"
      71                 :            : 
      72                 :            : using namespace ::com::sun::star;
      73                 :            : using namespace ::com::sun::star::uno;
      74                 :            : 
      75 [ +  + ][ +  - ]:        365 : SFX_IMPL_INTERFACE(SwDrawShell, SwDrawBaseShell, SW_RES(STR_SHELLNAME_DRAW))
         [ +  - ][ +  - ]
      76                 :            : {
      77 [ +  - ][ +  - ]:         73 :     SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRAW_POPUPMENU));
      78 [ +  - ][ +  - ]:         73 :     SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_DRAW_TOOLBOX));
      79                 :         73 :     SFX_CHILDWINDOW_REGISTRATION(SvxFontWorkChildWindow::GetChildWindowId());
      80                 :         73 : }
      81                 :            : 
      82 [ #  # ][ #  # ]:          0 : TYPEINIT1(SwDrawShell,SwDrawBaseShell)
      83                 :            : 
      84                 :          0 : void SwDrawShell::Execute(SfxRequest &rReq)
      85                 :            : {
      86         [ #  # ]:          0 :     SwWrtShell          &rSh = GetShell();
      87         [ #  # ]:          0 :     SdrView             *pSdrView = rSh.GetDrawView();
      88                 :          0 :     const SfxItemSet    *pArgs = rReq.GetArgs();
      89                 :          0 :     SfxBindings         &rBnd  = GetView().GetViewFrame()->GetBindings();
      90                 :          0 :     sal_uInt16               nSlotId = rReq.GetSlot();
      91                 :          0 :     sal_Bool                 bChanged = pSdrView->GetModel()->IsChanged();
      92                 :            : 
      93         [ #  # ]:          0 :     pSdrView->GetModel()->SetChanged(sal_False);
      94                 :            : 
      95                 :            :     const SfxPoolItem* pItem;
      96         [ #  # ]:          0 :     if(pArgs)
      97         [ #  # ]:          0 :         pArgs->GetItemState(nSlotId, sal_False, &pItem);
      98                 :            : 
      99                 :          0 :     sal_Bool bMirror = sal_True;
     100                 :            : 
     101   [ #  #  #  #  :          0 :     switch (nSlotId)
          #  #  #  #  #  
          #  #  #  #  #  
                      # ]
     102                 :            :     {
     103                 :            :         case SID_OBJECT_ROTATE:
     104 [ #  # ][ #  # ]:          0 :             if (rSh.IsObjSelected() && pSdrView->IsRotateAllowed())
         [ #  # ][ #  # ]
                 [ #  # ]
     105                 :            :             {
     106         [ #  # ]:          0 :                 if (GetView().IsDrawRotate())
     107         [ #  # ]:          0 :                     rSh.SetDragMode(SDRDRAG_MOVE);
     108                 :            :                 else
     109         [ #  # ]:          0 :                     rSh.SetDragMode(SDRDRAG_ROTATE);
     110                 :            : 
     111                 :          0 :                 GetView().FlipDrawRotate();
     112                 :            :             }
     113                 :          0 :             break;
     114                 :            : 
     115                 :            :         case SID_BEZIER_EDIT:
     116         [ #  # ]:          0 :             if (GetView().IsDrawRotate())
     117                 :            :             {
     118         [ #  # ]:          0 :                 rSh.SetDragMode(SDRDRAG_MOVE);
     119                 :          0 :                 GetView().FlipDrawRotate();
     120                 :            :             }
     121                 :          0 :             GetView().FlipDrawSelMode();
     122         [ #  # ]:          0 :             pSdrView->SetFrameDragSingles(GetView().IsDrawSelMode());
     123         [ #  # ]:          0 :             GetView().AttrChangedNotify(&rSh); // Shellwechsel...
     124                 :          0 :             break;
     125                 :            : 
     126                 :            :         case SID_OBJECT_HELL:
     127 [ #  # ][ #  # ]:          0 :             if (rSh.IsObjSelected())
     128                 :            :             {
     129         [ #  # ]:          0 :                 rSh.StartUndo( UNDO_START );
     130         [ #  # ]:          0 :                 SetWrapMode(FN_FRAME_WRAPTHRU_TRANSP);
     131         [ #  # ]:          0 :                 rSh.SelectionToHell();
     132         [ #  # ]:          0 :                 rSh.EndUndo( UNDO_END );
     133         [ #  # ]:          0 :                 rBnd.Invalidate(SID_OBJECT_HEAVEN);
     134                 :            :             }
     135                 :          0 :             break;
     136                 :            : 
     137                 :            :         case SID_OBJECT_HEAVEN:
     138 [ #  # ][ #  # ]:          0 :             if (rSh.IsObjSelected())
     139                 :            :             {
     140         [ #  # ]:          0 :                 rSh.StartUndo( UNDO_START );
     141         [ #  # ]:          0 :                 SetWrapMode(FN_FRAME_WRAPTHRU);
     142         [ #  # ]:          0 :                 rSh.SelectionToHeaven();
     143         [ #  # ]:          0 :                 rSh.EndUndo( UNDO_END );
     144         [ #  # ]:          0 :                 rBnd.Invalidate(SID_OBJECT_HELL);
     145                 :            :             }
     146                 :          0 :             break;
     147                 :            : 
     148                 :            :         case FN_TOOL_HIERARCHIE:
     149 [ #  # ][ #  # ]:          0 :             if (rSh.IsObjSelected())
     150                 :            :             {
     151         [ #  # ]:          0 :                 rSh.StartUndo( UNDO_START );
     152 [ #  # ][ #  # ]:          0 :                 if (rSh.GetLayerId() == 0)
     153                 :            :                 {
     154         [ #  # ]:          0 :                     SetWrapMode(FN_FRAME_WRAPTHRU);
     155         [ #  # ]:          0 :                     rSh.SelectionToHeaven();
     156                 :            :                 }
     157                 :            :                 else
     158                 :            :                 {
     159         [ #  # ]:          0 :                     SetWrapMode(FN_FRAME_WRAPTHRU_TRANSP);
     160         [ #  # ]:          0 :                     rSh.SelectionToHell();
     161                 :            :                 }
     162         [ #  # ]:          0 :                 rSh.EndUndo( UNDO_END );
     163         [ #  # ]:          0 :                 rBnd.Invalidate( SID_OBJECT_HELL );
     164         [ #  # ]:          0 :                 rBnd.Invalidate( SID_OBJECT_HEAVEN );
     165                 :            :             }
     166                 :          0 :             break;
     167                 :            : 
     168                 :            :         case FN_FLIP_HORZ_GRAFIC:
     169                 :          0 :             bMirror = sal_False;
     170                 :            :             /* no break */
     171                 :            :         case FN_FLIP_VERT_GRAFIC:
     172         [ #  # ]:          0 :             rSh.MirrorSelection( bMirror );
     173                 :          0 :             break;
     174                 :            : 
     175                 :            :         case SID_FONTWORK:
     176                 :            :         {
     177 [ #  # ][ #  # ]:          0 :             FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView()));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     178 [ #  # ][ #  # ]:          0 :             SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
         [ #  # ][ #  # ]
     179                 :          0 :             SfxViewFrame* pVFrame = GetView().GetViewFrame();
     180         [ #  # ]:          0 :             if (pArgs)
     181                 :            :             {
     182         [ #  # ]:          0 :                 pVFrame->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
     183 [ #  # ][ #  # ]:          0 :                     ((const SfxBoolItem&)(pArgs->Get(SID_FONTWORK))).GetValue());
     184                 :            :             }
     185                 :            :             else
     186 [ #  # ][ #  # ]:          0 :                 pVFrame->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
     187         [ #  # ]:          0 :             pVFrame->GetBindings().Invalidate(SID_FONTWORK);
     188                 :            :         }
     189                 :          0 :         break;
     190                 :            :         case FN_FORMAT_FOOTNOTE_DLG:
     191                 :            :         {
     192         [ #  # ]:          0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     193                 :            :             OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
     194                 :            : 
     195         [ #  # ]:          0 :             VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), GetView().GetWrtShell(), DLG_DOC_FOOTNOTE );
     196                 :            :             OSL_ENSURE(pDlg, "Dialogdiet fail!");
     197         [ #  # ]:          0 :             pDlg->Execute();
     198 [ #  # ][ #  # ]:          0 :             delete pDlg;
     199                 :          0 :             break;
     200                 :            :         }
     201                 :            :         case FN_NUMBERING_OUTLINE_DLG:
     202                 :            :         {
     203         [ #  # ]:          0 :             SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
     204         [ #  # ]:          0 :             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     205                 :            :             OSL_ENSURE(pFact, "Dialogdiet fail!");
     206                 :            :             SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
     207         [ #  # ]:          0 :                                                         GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
     208                 :            :             OSL_ENSURE(pDlg, "Dialogdiet fail!");
     209         [ #  # ]:          0 :             pDlg->Execute();
     210 [ #  # ][ #  # ]:          0 :             delete pDlg;
     211 [ #  # ][ #  # ]:          0 :             rReq.Done();
     212                 :            :         }
     213                 :          0 :         break;
     214                 :            :         case SID_OPEN_XML_FILTERSETTINGS:
     215                 :            :         {
     216                 :            :             try
     217                 :            :             {
     218 [ #  # ][ #  # ]:          0 :                 uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ui.XSLTFilterDialog"))), uno::UNO_QUERY);
         [ #  # ][ #  # ]
                 [ #  # ]
     219         [ #  # ]:          0 :                 if( xDialog.is() )
     220                 :            :                 {
     221 [ #  # ][ #  # ]:          0 :                     xDialog->execute();
     222         [ #  # ]:          0 :                 }
     223                 :            :             }
     224         [ #  # ]:          0 :             catch (const uno::Exception&)
     225                 :            :             {
     226                 :            :             }
     227         [ #  # ]:          0 :             rReq.Ignore ();
     228                 :            :         }
     229                 :          0 :         break;
     230                 :            :         case FN_WORDCOUNT_DIALOG:
     231                 :            :         {
     232                 :          0 :             SfxViewFrame* pVFrame = GetView().GetViewFrame();
     233         [ #  # ]:          0 :             if (pVFrame != NULL)
     234                 :            :             {
     235         [ #  # ]:          0 :                 pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
     236         [ #  # ]:          0 :                 Invalidate(rReq.GetSlot());
     237                 :            : 
     238 [ #  # ][ #  # ]:          0 :                 SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
     239         [ #  # ]:          0 :                 if (pWrdCnt)
     240         [ #  # ]:          0 :                     pWrdCnt->UpdateCounts();
     241                 :            :             }
     242                 :            :         }
     243                 :          0 :         break;
     244                 :            :         case SID_EXTRUSION_TOOGLE:
     245                 :            :         case SID_EXTRUSION_TILT_DOWN:
     246                 :            :         case SID_EXTRUSION_TILT_UP:
     247                 :            :         case SID_EXTRUSION_TILT_LEFT:
     248                 :            :         case SID_EXTRUSION_TILT_RIGHT:
     249                 :            :         case SID_EXTRUSION_3D_COLOR:
     250                 :            :         case SID_EXTRUSION_DEPTH:
     251                 :            :         case SID_EXTRUSION_DIRECTION:
     252                 :            :         case SID_EXTRUSION_PROJECTION:
     253                 :            :         case SID_EXTRUSION_LIGHTING_DIRECTION:
     254                 :            :         case SID_EXTRUSION_LIGHTING_INTENSITY:
     255                 :            :         case SID_EXTRUSION_SURFACE:
     256                 :            :         case SID_EXTRUSION_DEPTH_FLOATER:
     257                 :            :         case SID_EXTRUSION_DIRECTION_FLOATER:
     258                 :            :         case SID_EXTRUSION_LIGHTING_FLOATER:
     259                 :            :         case SID_EXTRUSION_SURFACE_FLOATER:
     260                 :            :         case SID_EXTRUSION_DEPTH_DIALOG:
     261         [ #  # ]:          0 :             svx::ExtrusionBar::execute( pSdrView, rReq, rBnd );
     262         [ #  # ]:          0 :             rReq.Ignore ();
     263                 :          0 :             break;
     264                 :            : 
     265                 :            :         case SID_FONTWORK_SHAPE:
     266                 :            :         case SID_FONTWORK_SHAPE_TYPE:
     267                 :            :         case SID_FONTWORK_ALIGNMENT:
     268                 :            :         case SID_FONTWORK_SAME_LETTER_HEIGHTS:
     269                 :            :         case SID_FONTWORK_CHARACTER_SPACING:
     270                 :            :         case SID_FONTWORK_KERN_CHARACTER_PAIRS:
     271                 :            :         case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
     272                 :            :         case SID_FONTWORK_ALIGNMENT_FLOATER:
     273                 :            :         case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
     274         [ #  # ]:          0 :             svx::FontworkBar::execute( pSdrView, rReq, rBnd );
     275         [ #  # ]:          0 :             rReq.Ignore ();
     276                 :          0 :             break;
     277                 :            : 
     278                 :            :         default:
     279                 :            :             OSL_ENSURE(!this, "wrong dispatcher");
     280                 :          0 :             return;
     281                 :            :     }
     282         [ #  # ]:          0 :     if (pSdrView->GetModel()->IsChanged())
     283         [ #  # ]:          0 :         rSh.SetModified();
     284         [ #  # ]:          0 :     else if (bChanged)
     285         [ #  # ]:          0 :         pSdrView->GetModel()->SetChanged(sal_True);
     286                 :            : }
     287                 :            : 
     288                 :          0 : void SwDrawShell::GetState(SfxItemSet& rSet)
     289                 :            : {
     290         [ #  # ]:          0 :     SwWrtShell &rSh = GetShell();
     291         [ #  # ]:          0 :     SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
     292         [ #  # ]:          0 :     SfxWhichIter aIter( rSet );
     293         [ #  # ]:          0 :     sal_uInt16 nWhich = aIter.FirstWhich();
     294         [ #  # ]:          0 :     sal_Bool bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT);
     295                 :            : 
     296         [ #  # ]:          0 :     if (!bProtected)    // Im Parent nachsehen
     297         [ #  # ]:          0 :         bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
     298                 :            : 
     299         [ #  # ]:          0 :     while( nWhich )
     300                 :            :     {
     301   [ #  #  #  #  :          0 :         switch( nWhich )
             #  #  #  #  
                      # ]
     302                 :            :         {
     303                 :            :             case SID_OBJECT_HELL:
     304 [ #  # ][ #  # ]:          0 :                 if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 0 || bProtected )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     305         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     306                 :          0 :                 break;
     307                 :            : 
     308                 :            :             case SID_OBJECT_HEAVEN:
     309 [ #  # ][ #  # ]:          0 :                 if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 1 || bProtected )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     310         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     311                 :          0 :                 break;
     312                 :            : 
     313                 :            :             case FN_TOOL_HIERARCHIE:
     314 [ #  # ][ #  # ]:          0 :                 if ( !rSh.IsObjSelected() || bProtected )
         [ #  # ][ #  # ]
     315         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     316                 :          0 :                 break;
     317                 :            : 
     318                 :            :             case SID_OBJECT_ROTATE:
     319                 :            :             {
     320                 :          0 :                 const sal_Bool bIsRotate = GetView().IsDrawRotate();
     321 [ #  # ][ #  # ]:          0 :                 if ( (!bIsRotate && !pSdrView->IsRotateAllowed()) || bProtected )
         [ #  # ][ #  # ]
                 [ #  # ]
     322         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     323                 :            :                 else
     324 [ #  # ][ #  # ]:          0 :                     rSet.Put( SfxBoolItem( nWhich, bIsRotate ) );
                 [ #  # ]
     325                 :            :             }
     326                 :          0 :             break;
     327                 :            : 
     328                 :            :             case SID_BEZIER_EDIT:
     329 [ #  # ][ #  # ]:          0 :                 if (!Disable(rSet, nWhich))
     330 [ #  # ][ #  # ]:          0 :                     rSet.Put( SfxBoolItem( nWhich, !GetView().IsDrawSelMode()));
                 [ #  # ]
     331                 :          0 :             break;
     332                 :            : 
     333                 :            :             case FN_FLIP_HORZ_GRAFIC:
     334 [ #  # ][ #  # ]:          0 :                 if ( !pSdrView->IsMirrorAllowed() || bProtected )
         [ #  # ][ #  # ]
     335         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     336                 :          0 :                 break;
     337                 :            : 
     338                 :            :             case FN_FLIP_VERT_GRAFIC:
     339 [ #  # ][ #  # ]:          0 :                 if ( !pSdrView->IsMirrorAllowed() || bProtected )
         [ #  # ][ #  # ]
     340         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     341                 :          0 :                 break;
     342                 :            : 
     343                 :            :             case SID_FONTWORK:
     344                 :            :             {
     345         [ #  # ]:          0 :                 if (bProtected)
     346         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     347                 :            :                 else
     348                 :            :                 {
     349         [ #  # ]:          0 :                     const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
     350 [ #  # ][ #  # ]:          0 :                     rSet.Put(SfxBoolItem( nWhich , GetView().GetViewFrame()->HasChildWindow(nId)));
         [ #  # ][ #  # ]
     351                 :            :                 }
     352                 :            :             }
     353                 :          0 :             break;
     354                 :            :         }
     355         [ #  # ]:          0 :         nWhich = aIter.NextWhich();
     356                 :            :     }
     357         [ #  # ]:          0 :     svx::ExtrusionBar::getState( pSdrView, rSet );
     358 [ #  # ][ #  # ]:          0 :     svx::FontworkBar::getState( pSdrView, rSet );
     359                 :          0 : }
     360                 :            : 
     361                 :          0 : SwDrawShell::SwDrawShell(SwView &_rView) :
     362                 :          0 :     SwDrawBaseShell(_rView)
     363                 :            : {
     364         [ #  # ]:          0 :     SetHelpId(SW_DRAWSHELL);
     365 [ #  # ][ #  # ]:          0 :     SetName(rtl::OUString("Draw"));
                 [ #  # ]
     366                 :          0 : }
     367                 :            : 
     368                 :            : /*************************************************************************
     369                 :            : |*
     370                 :            : |* SfxRequests fuer FontWork bearbeiten
     371                 :            : |*
     372                 :            : \************************************************************************/
     373                 :          0 : void SwDrawShell::ExecFormText(SfxRequest& rReq)
     374                 :            : {
     375                 :          0 :     SwWrtShell &rSh = GetShell();
     376                 :          0 :     SdrView*    pDrView = rSh.GetDrawView();
     377                 :          0 :     sal_Bool        bChanged = pDrView->GetModel()->IsChanged();
     378                 :          0 :     pDrView->GetModel()->SetChanged(sal_False);
     379                 :            : 
     380                 :          0 :     const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
     381                 :            : 
     382 [ #  # ][ #  # ]:          0 :     if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
                 [ #  # ]
     383                 :            :     {
     384                 :          0 :         const SfxItemSet& rSet = *rReq.GetArgs();
     385                 :            :         const SfxPoolItem* pItem;
     386                 :            : 
     387 [ #  # ][ #  # ]:          0 :         if ( pDrView->IsTextEdit() )
     388                 :            :         {
     389         [ #  # ]:          0 :             pDrView->SdrEndTextEdit( sal_True );
     390         [ #  # ]:          0 :             GetView().AttrChangedNotify(&rSh);
     391                 :            :         }
     392                 :            : 
     393         [ #  # ]:          0 :         if ( rSet.GetItemState(XATTR_FORMTXTSTDFORM, sal_True, &pItem) ==
           [ #  #  #  # ]
                 [ #  # ]
     394                 :            :              SFX_ITEM_SET &&
     395                 :          0 :             ((const XFormTextStdFormItem*) pItem)->GetValue() != XFTFORM_NONE )
     396                 :            :         {
     397                 :            : 
     398         [ #  # ]:          0 :             const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
     399                 :            : 
     400                 :          0 :             SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*)(GetView().GetViewFrame()->
     401         [ #  # ]:          0 :                                         GetChildWindow(nId)->GetWindow());
     402                 :            : 
     403                 :          0 :             pDlg->CreateStdFormObj(*pDrView, *pDrView->GetSdrPageView(),
     404 [ #  # ][ #  # ]:          0 :                                     rSet, *rMarkList.GetMark(0)->GetMarkedSdrObj(),
     405                 :            :                                    ((const XFormTextStdFormItem*) pItem)->
     406         [ #  # ]:          0 :                                    GetValue());
     407                 :            : 
     408                 :            :         }
     409                 :            :         else
     410         [ #  # ]:          0 :             pDrView->SetAttributes(rSet);
     411                 :            :     }
     412         [ #  # ]:          0 :     if (pDrView->GetModel()->IsChanged())
     413                 :          0 :         rSh.SetModified();
     414                 :            :     else
     415         [ #  # ]:          0 :         if (bChanged)
     416                 :          0 :             pDrView->GetModel()->SetChanged(sal_True);
     417                 :          0 : }
     418                 :            : 
     419                 :            : /*************************************************************************
     420                 :            : |*
     421                 :            : |* Statuswerte fuer FontWork zurueckgeben
     422                 :            : |*
     423                 :            : \************************************************************************/
     424                 :          0 : void SwDrawShell::GetFormTextState(SfxItemSet& rSet)
     425                 :            : {
     426                 :          0 :     SwWrtShell &rSh = GetShell();
     427                 :          0 :     SdrView* pDrView = rSh.GetDrawView();
     428                 :          0 :     const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
     429                 :          0 :     const SdrObject* pObj = NULL;
     430                 :          0 :     SvxFontWorkDialog* pDlg = NULL;
     431                 :            : 
     432                 :          0 :     const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
     433                 :            : 
     434                 :          0 :     SfxViewFrame* pVFrame = GetView().GetViewFrame();
     435         [ #  # ]:          0 :     if ( pVFrame->HasChildWindow(nId) )
     436                 :          0 :         pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow());
     437                 :            : 
     438         [ #  # ]:          0 :     if ( rMarkList.GetMarkCount() == 1 )
     439                 :          0 :         pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     440                 :            : 
     441         [ #  # ]:          0 :     if ( pObj == NULL || !pObj->ISA(SdrTextObj) ||
           [ #  #  #  # ]
                 [ #  # ]
     442                 :          0 :         !((SdrTextObj*) pObj)->HasText() )
     443                 :            :     {
     444                 :            : #define XATTR_ANZ 12
     445                 :            :         static const sal_uInt16 nXAttr[ XATTR_ANZ ] =
     446                 :            :         {
     447                 :            :             XATTR_FORMTXTSTYLE, XATTR_FORMTXTADJUST, XATTR_FORMTXTDISTANCE,
     448                 :            :             XATTR_FORMTXTSTART, XATTR_FORMTXTMIRROR, XATTR_FORMTXTSTDFORM,
     449                 :            :             XATTR_FORMTXTHIDEFORM, XATTR_FORMTXTOUTLINE, XATTR_FORMTXTSHADOW,
     450                 :            :             XATTR_FORMTXTSHDWCOLOR, XATTR_FORMTXTSHDWXVAL, XATTR_FORMTXTSHDWYVAL
     451                 :            :         };
     452         [ #  # ]:          0 :         for( sal_uInt16 i = 0; i < XATTR_ANZ; )
     453                 :          0 :             rSet.DisableItem( nXAttr[ i++ ] );
     454                 :            :     }
     455                 :            :     else
     456                 :            :     {
     457         [ #  # ]:          0 :         if ( pDlg )
     458         [ #  # ]:          0 :             pDlg->SetColorList(XColorList::GetStdColorList());
     459                 :            : 
     460                 :          0 :         pDrView->GetAttributes( rSet );
     461                 :            :     }
     462                 :          0 : }
     463                 :            : 
     464                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10