LCOV - code coverage report
Current view: top level - svx/source/toolbars - fontworkbar.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 26 318 8.2 %
Date: 2012-08-25 Functions: 6 22 27.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 36 551 6.5 %

           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/svdundo.hxx>
      30                 :            : #include <sfx2/app.hxx>
      31                 :            : #include <sfx2/request.hxx>
      32                 :            : #include <sfx2/objface.hxx>
      33                 :            : #include <sfx2/viewsh.hxx>
      34                 :            : #include "svx/unoapi.hxx"
      35                 :            : #include <com/sun/star/drawing/XShape.hpp>
      36                 :            : #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
      37                 :            : #include <svx/dialmgr.hxx>
      38                 :            : #include <svx/svdoashp.hxx>
      39                 :            : #include <svx/dialogs.hrc>
      40                 :            : #include <svx/svdview.hxx>
      41                 :            : #include <svx/sdasitm.hxx>
      42                 :            : #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
      43                 :            : #include <sfx2/bindings.hxx>
      44                 :            : #include <editeng/eeitem.hxx>
      45                 :            : #include <editeng/charscaleitem.hxx>
      46                 :            : #include <editeng/kernitem.hxx>
      47                 :            : #include <svx/sdrpaintwindow.hxx>
      48                 :            : 
      49                 :            : #include <svx/svxids.hrc>
      50                 :            : #include <svx/fontworkbar.hxx>
      51                 :            : #include "svx/fontworkgallery.hxx"
      52                 :            : 
      53                 :            : using ::rtl::OUString;
      54                 :            : 
      55                 :            : using namespace ::svx;
      56                 :            : using namespace ::cppu;
      57                 :            : using namespace ::com::sun::star;
      58                 :            : using namespace ::com::sun::star::beans;
      59                 :            : using namespace ::com::sun::star::uno;
      60                 :            : 
      61                 :          0 : void SetAlignmentState( SdrView* pSdrView, SfxItemSet& rSet )
      62                 :            : {
      63                 :          0 :     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
      64                 :          0 :     sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
      65                 :            : 
      66                 :          0 :     sal_Int32   nAlignment = -1;
      67         [ #  # ]:          0 :     for( i = 0; i < nCount; i++ )
      68                 :            :     {
      69                 :          0 :         SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
      70         [ #  # ]:          0 :         if( pObj->ISA(SdrObjCustomShape) )
      71                 :            :         {
      72                 :          0 :             sal_Int32 nOldAlignment = nAlignment;
      73                 :          0 :             SdrTextHorzAdjustItem&      rTextHorzAdjustItem    = (SdrTextHorzAdjustItem&)pObj->GetMergedItem( SDRATTR_TEXT_HORZADJUST );
      74                 :          0 :             SdrTextFitToSizeTypeItem&   rTextFitToSizeTypeItem = (SdrTextFitToSizeTypeItem&)pObj->GetMergedItem( SDRATTR_TEXT_FITTOSIZE );
      75   [ #  #  #  #  :          0 :             switch ( rTextHorzAdjustItem.GetValue() )
                      # ]
      76                 :            :             {
      77                 :          0 :                 case SDRTEXTHORZADJUST_LEFT   : nAlignment = 0; break;
      78                 :          0 :                 case SDRTEXTHORZADJUST_CENTER : nAlignment = 1; break;
      79                 :          0 :                 case SDRTEXTHORZADJUST_RIGHT  : nAlignment = 2; break;
      80                 :            :                 case SDRTEXTHORZADJUST_BLOCK  :
      81                 :            :                 {
      82         [ #  # ]:          0 :                     if ( rTextFitToSizeTypeItem.GetValue() == SDRTEXTFIT_NONE )
      83                 :          0 :                         nAlignment = 3;
      84         [ #  # ]:          0 :                     else if ( rTextFitToSizeTypeItem.GetValue() == SDRTEXTFIT_ALLLINES )
      85                 :          0 :                         nAlignment = 4;
      86                 :            :                 }
      87                 :            :             }
      88 [ #  # ][ #  # ]:          0 :             if ( ( nOldAlignment != -1 ) && ( nOldAlignment != nAlignment ) )
      89                 :            :             {
      90                 :          0 :                 nAlignment = -1;
      91                 :          0 :                 break;
      92                 :            :             }
      93                 :            :         }
      94                 :            :     }
      95         [ #  # ]:          0 :     rSet.Put( SfxInt32Item( SID_FONTWORK_ALIGNMENT, nAlignment ) );
      96                 :          0 : }
      97                 :            : 
      98                 :          0 : void SetCharacterSpacingState( SdrView* pSdrView, SfxItemSet& rSet )
      99                 :            : {
     100                 :          0 :     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     101                 :          0 :     sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
     102                 :            : 
     103                 :          0 :     sal_Int32   nCharacterSpacing = -1;
     104         [ #  # ]:          0 :     for( i = 0; i < nCount; i++ )
     105                 :            :     {
     106                 :          0 :         SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
     107         [ #  # ]:          0 :         if( pObj->ISA(SdrObjCustomShape) )
     108                 :            :         {
     109                 :          0 :             sal_Int32 nOldCharacterSpacing = nCharacterSpacing;
     110                 :          0 :             SvxCharScaleWidthItem& rCharScaleWidthItem = (SvxCharScaleWidthItem&)pObj->GetMergedItem( EE_CHAR_FONTWIDTH );
     111                 :          0 :             nCharacterSpacing = rCharScaleWidthItem.GetValue();
     112 [ #  # ][ #  # ]:          0 :             if ( ( nOldCharacterSpacing != -1 ) && ( nOldCharacterSpacing != nCharacterSpacing ) )
     113                 :            :             {
     114                 :          0 :                 nCharacterSpacing = -1;
     115                 :          0 :                 break;
     116                 :            :             }
     117                 :            :         }
     118                 :            :     }
     119         [ #  # ]:          0 :     rSet.Put( SfxInt32Item( SID_FONTWORK_CHARACTER_SPACING, nCharacterSpacing ) );
     120                 :          0 : }
     121                 :            : 
     122                 :            : 
     123                 :          0 : void SetKernCharacterPairsState( SdrView* pSdrView, SfxItemSet& rSet )
     124                 :            : {
     125                 :          0 :     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     126                 :          0 :     sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
     127                 :            : 
     128                 :          0 :     sal_Bool    bChecked = sal_False;
     129         [ #  # ]:          0 :     for( i = 0; i < nCount; i++ )
     130                 :            :     {
     131                 :          0 :         SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
     132         [ #  # ]:          0 :         if( pObj->ISA(SdrObjCustomShape) )
     133                 :            :         {
     134                 :          0 :             SvxKerningItem& rKerningItem = (SvxKerningItem&)pObj->GetMergedItem( EE_CHAR_KERNING );
     135         [ #  # ]:          0 :             if ( rKerningItem.GetValue() )
     136                 :          0 :                 bChecked = sal_True;
     137                 :            :         }
     138                 :            :     }
     139         [ #  # ]:          0 :     rSet.Put( SfxBoolItem( SID_FONTWORK_KERN_CHARACTER_PAIRS, bChecked ) );
     140                 :          0 : }
     141                 :            : 
     142                 :          0 : void SetFontWorkShapeTypeState( SdrView* pSdrView, SfxItemSet& rSet )
     143                 :            : {
     144                 :          0 :     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     145                 :          0 :     sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
     146                 :            : 
     147                 :          0 :     rtl::OUString aFontWorkShapeType;
     148                 :            : 
     149         [ #  # ]:          0 :     for( i = 0; i < nCount; i++ )
     150                 :            :     {
     151 [ #  # ][ #  # ]:          0 :         SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
     152 [ #  # ][ #  # ]:          0 :         if( pObj->ISA( SdrObjCustomShape ) )
                 [ #  # ]
     153                 :            :         {
     154         [ #  # ]:          0 :             const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
     155 [ #  # ][ #  # ]:          0 :             SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
     156         [ #  # ]:          0 :             Any* pAny = aGeometryItem.GetPropertyValueByName( sType );
     157         [ #  # ]:          0 :             if( pAny )
     158                 :            :             {
     159                 :          0 :                 rtl::OUString aType;
     160         [ #  # ]:          0 :                 if ( *pAny >>= aType )
     161                 :            :                 {
     162         [ #  # ]:          0 :                     if ( !aFontWorkShapeType.isEmpty() )
     163                 :            :                     {
     164         [ #  # ]:          0 :                         if ( !aFontWorkShapeType.equals( aType ) )  // different FontWorkShapeTypes selected ?
     165                 :            :                         {
     166                 :          0 :                             aFontWorkShapeType = rtl::OUString();
     167                 :            :                             break;
     168                 :            :                         }
     169                 :            :                     }
     170                 :          0 :                     aFontWorkShapeType = aType;
     171         [ #  # ]:          0 :                 }
     172 [ #  # ][ #  # ]:          0 :             }
                 [ #  # ]
     173                 :            :         }
     174                 :            :     }
     175 [ #  # ][ #  # ]:          0 :     rSet.Put( SfxStringItem( SID_FONTWORK_SHAPE_TYPE, aFontWorkShapeType ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     176                 :          0 : }
     177                 :            : 
     178                 :            : /*************************************************************************
     179                 :            : |*
     180                 :            : |* Standardinterface deklarieren (Die Slotmap darf nicht leer sein, also
     181                 :            : |* tragen wir etwas ein, was hier (hoffentlich) nie vorkommt).
     182                 :            : |*
     183                 :            : \************************************************************************/
     184                 :            : 
     185                 :            : SFX_SLOTMAP(FontworkBar)
     186                 :            : {
     187                 :            :     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
     188                 :            : };
     189                 :            : 
     190 [ +  + ][ +  - ]:        405 : SFX_IMPL_INTERFACE(FontworkBar, SfxShell, SVX_RES(RID_SVX_FONTWORK_BAR))
                 [ +  - ]
     191                 :            : {
     192 [ +  - ][ +  - ]:        135 :     SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT, SVX_RES(RID_SVX_FONTWORK_BAR) );
     193                 :        135 : }
     194                 :            : 
     195 [ #  # ][ #  # ]:          8 : TYPEINIT1( FontworkBar, SfxShell );
     196                 :            : 
     197                 :            : 
     198                 :            : /*************************************************************************
     199                 :            : |*
     200                 :            : |* Standard-Konstruktor
     201                 :            : |*
     202                 :            : \************************************************************************/
     203                 :            : 
     204                 :          0 : FontworkBar::FontworkBar(SfxViewShell* pViewShell )
     205                 :          0 : : SfxShell(pViewShell)
     206                 :            : {
     207                 :            :     DBG_ASSERT( pViewShell, "svx::FontworkBar::FontworkBar(), I need a viewshell!" );
     208         [ #  # ]:          0 :     if( pViewShell )
     209                 :          0 :         SetPool(&pViewShell->GetPool());
     210                 :            : 
     211         [ #  # ]:          0 :     SetHelpId( SVX_INTERFACE_FONTWORK_BAR );
     212 [ #  # ][ #  # ]:          0 :     SetName( String( SVX_RES( RID_SVX_FONTWORK_BAR) ));
         [ #  # ][ #  # ]
     213                 :          0 : }
     214                 :            : 
     215                 :            : 
     216                 :            : /*************************************************************************
     217                 :            : |*
     218                 :            : |* Destruktor
     219                 :            : |*
     220                 :            : \************************************************************************/
     221                 :            : 
     222                 :          0 : FontworkBar::~FontworkBar()
     223                 :            : {
     224         [ #  # ]:          0 :     SetRepeatTarget(NULL);
     225         [ #  # ]:          0 : }
     226                 :            : 
     227                 :          0 : static Window* ImpGetViewWin(SdrView* pView)
     228                 :            : {
     229         [ #  # ]:          0 :     if( pView )
     230                 :            :     {
     231                 :          0 :         const sal_uInt32 nAnz(pView->PaintWindowCount());
     232         [ #  # ]:          0 :         for(sal_uInt32 nNum(0L); nNum < nAnz; nNum++)
     233                 :            :         {
     234                 :          0 :             OutputDevice* pOut = &(pView->GetPaintWindow(nNum)->GetOutputDevice());
     235                 :            : 
     236         [ #  # ]:          0 :             if(OUTDEV_WINDOW == pOut->GetOutDevType())
     237                 :            :             {
     238                 :          0 :                 return (Window*)pOut;
     239                 :            :             }
     240                 :            :         }
     241                 :            :     }
     242                 :            : 
     243                 :          0 :     return 0L;
     244                 :            : }
     245                 :            : 
     246                 :            : namespace svx {
     247                 :        522 : bool checkForSelectedFontWork( SdrView* pSdrView, sal_uInt32& nCheckStatus )
     248                 :            : {
     249         [ -  + ]:        522 :     if ( nCheckStatus & 2 )
     250                 :          0 :         return ( nCheckStatus & 1 ) != 0;
     251                 :            : 
     252 [ +  + ][ +  - ]:        522 :     static const rtl::OUString  sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
         [ +  - ][ #  # ]
     253                 :            : 
     254                 :        522 :     const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     255                 :        522 :     sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
     256                 :        522 :     sal_Bool bFound = sal_False;
     257 [ +  + ][ +  - ]:        524 :     for(i=0;(i<nCount) && !bFound ; i++)
                 [ +  + ]
     258                 :            :     {
     259 [ +  - ][ +  - ]:          2 :         SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
     260 [ +  - ][ +  - ]:          2 :         if( pObj->ISA(SdrObjCustomShape) )
                 [ -  + ]
     261                 :            :         {
     262 [ #  # ][ #  # ]:          0 :             SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
     263         [ #  # ]:          0 :             Any* pAny = aGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
     264         [ #  # ]:          0 :             if( pAny )
     265         [ #  # ]:          0 :                 *pAny >>= bFound;
     266                 :            :         }
     267                 :            :     }
     268         [ -  + ]:        522 :     if ( bFound )
     269                 :          0 :         nCheckStatus |= 1;
     270                 :        522 :     nCheckStatus |= 2;
     271                 :        522 :     return bFound;
     272                 :            : }
     273                 :            : }
     274                 :            : 
     275                 :          0 : static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem& rGeometryItem, SdrObject* pObj )
     276                 :            : {
     277 [ #  # ][ #  # ]:          0 :     static const rtl::OUString  sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
         [ #  # ][ #  # ]
     278 [ #  # ][ #  # ]:          0 :     static const rtl::OUString  sSameLetterHeights( RTL_CONSTASCII_USTRINGPARAM ( "SameLetterHeights" ) );
         [ #  # ][ #  # ]
     279                 :            : 
     280                 :          0 :     sal_uInt16 nSID = rReq.GetSlot();
     281   [ #  #  #  #  :          0 :     switch( nSID )
                      # ]
     282                 :            :     {
     283                 :            :         case SID_FONTWORK_SAME_LETTER_HEIGHTS:
     284                 :            :         {
     285                 :          0 :             com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sSameLetterHeights );
     286         [ #  # ]:          0 :             if( pAny )
     287                 :            :             {
     288                 :            :                 sal_Bool bOn;
     289                 :          0 :                 (*pAny) >>= bOn;
     290                 :          0 :                 bOn = !bOn;
     291         [ #  # ]:          0 :                 (*pAny) <<= bOn;
     292                 :            :             }
     293                 :            :         }
     294                 :          0 :         break;
     295                 :            : 
     296                 :            :         case SID_FONTWORK_ALIGNMENT:
     297                 :            :         {
     298 [ #  # ][ #  # ]:          0 :             if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_FONTWORK_ALIGNMENT ) == SFX_ITEM_SET )
                 [ #  # ]
     299                 :            :             {
     300                 :          0 :                 sal_Int32 nValue = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_ALIGNMENT))->GetValue();
     301 [ #  # ][ #  # ]:          0 :                 if ( ( nValue >= 0 ) && ( nValue < 5 ) )
     302                 :            :                 {
     303                 :          0 :                     SdrFitToSizeType eFTS = SDRTEXTFIT_NONE;
     304                 :            :                     SdrTextHorzAdjust eHorzAdjust;
     305   [ #  #  #  #  :          0 :                     switch ( nValue )
                      # ]
     306                 :            :                     {
     307                 :          0 :                         case 4 : eFTS = SDRTEXTFIT_ALLLINES; // passthrough
     308                 :          0 :                         case 3 : eHorzAdjust = SDRTEXTHORZADJUST_BLOCK; break;
     309                 :            :                         default:
     310                 :          0 :                         case 0 : eHorzAdjust = SDRTEXTHORZADJUST_LEFT; break;
     311                 :          0 :                         case 1 : eHorzAdjust = SDRTEXTHORZADJUST_CENTER; break;
     312                 :          0 :                         case 2 : eHorzAdjust = SDRTEXTHORZADJUST_RIGHT; break;
     313                 :            :                     }
     314         [ #  # ]:          0 :                     pObj->SetMergedItem( SdrTextHorzAdjustItem( eHorzAdjust ) );
     315         [ #  # ]:          0 :                     pObj->SetMergedItem( SdrTextFitToSizeTypeItem( eFTS ) );
     316                 :          0 :                     pObj->BroadcastObjectChange();
     317                 :            :                 }
     318                 :            :             }
     319                 :            :         }
     320                 :          0 :         break;
     321                 :            : 
     322                 :            :         case SID_FONTWORK_CHARACTER_SPACING:
     323                 :            :         {
     324 [ #  # ][ #  # ]:          0 :             if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SFX_ITEM_SET ) )
                 [ #  # ]
     325                 :            :             {
     326                 :          0 :                 sal_Int32 nCharSpacing = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_CHARACTER_SPACING))->GetValue();
     327         [ #  # ]:          0 :                 pObj->SetMergedItem( SvxCharScaleWidthItem( (sal_uInt16)nCharSpacing, EE_CHAR_FONTWIDTH ) );
     328                 :          0 :                 pObj->BroadcastObjectChange();
     329                 :            :             }
     330                 :            :         }
     331                 :          0 :         break;
     332                 :            : 
     333                 :            :         case SID_FONTWORK_KERN_CHARACTER_PAIRS:
     334                 :            :         {
     335 [ #  # ][ #  # ]:          0 :             if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_KERN_CHARACTER_PAIRS ) == SFX_ITEM_SET ) )
                 [ #  # ]
     336                 :            :             {
     337                 :            :                 // sal_Bool bKernCharacterPairs = ((const SfxBoolItem*)rReq.GetArgs()->GetItem(SID_FONTWORK_KERN_CHARACTER_PAIRS))->GetValue();
     338                 :            : //TODO:             pObj->SetMergedItem( SvxCharScaleWidthItem( (sal_uInt16)nCharSpacing, EE_CHAR_FONTWIDTH ) );
     339                 :          0 :                 pObj->BroadcastObjectChange();
     340                 :            :             }
     341                 :            :         }
     342                 :          0 :         break;
     343                 :            :     }
     344                 :          0 : }
     345                 :            : 
     346                 :            : #include "svx/gallery.hxx"
     347                 :            : #include <svx/fmmodel.hxx>
     348                 :            : #include <svx/fmpage.hxx>
     349                 :            : #include <svl/itempool.hxx>
     350                 :            : 
     351                 :          0 : void GetGeometryForCustomShape( SdrCustomShapeGeometryItem& rGeometryItem, const rtl::OUString rCustomShape )
     352                 :            : {
     353         [ #  # ]:          0 :     const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
     354                 :            : 
     355                 :          0 :     com::sun::star::beans::PropertyValue aPropVal;
     356                 :          0 :     aPropVal.Name = sType;
     357         [ #  # ]:          0 :     aPropVal.Value <<= rCustomShape;
     358         [ #  # ]:          0 :     rGeometryItem.SetPropertyValue( aPropVal );
     359                 :            : 
     360         [ #  # ]:          0 :     const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM ( "AdjustmentValues" ) );
     361         [ #  # ]:          0 :     const rtl::OUString sCoordinateOrigin( RTL_CONSTASCII_USTRINGPARAM ( "CoordinateOrigin" ) );
     362         [ #  # ]:          0 :     const rtl::OUString sCoordinateSize( RTL_CONSTASCII_USTRINGPARAM ( "CoordinateSize" ) );
     363         [ #  # ]:          0 :     const rtl::OUString sEquations( RTL_CONSTASCII_USTRINGPARAM ( "Equations" ) );
     364         [ #  # ]:          0 :     const rtl::OUString sHandles( RTL_CONSTASCII_USTRINGPARAM ( "Handles" ) );
     365         [ #  # ]:          0 :     const rtl::OUString sPath( RTL_CONSTASCII_USTRINGPARAM ( "Path" ) );
     366         [ #  # ]:          0 :     rGeometryItem.ClearPropertyValue( sAdjustmentValues );
     367         [ #  # ]:          0 :     rGeometryItem.ClearPropertyValue( sCoordinateOrigin );
     368         [ #  # ]:          0 :     rGeometryItem.ClearPropertyValue( sCoordinateSize );
     369         [ #  # ]:          0 :     rGeometryItem.ClearPropertyValue( sEquations );
     370         [ #  # ]:          0 :     rGeometryItem.ClearPropertyValue( sHandles );
     371         [ #  # ]:          0 :     rGeometryItem.ClearPropertyValue( sPath );
     372                 :            : 
     373                 :            :     /* SJ: CustomShapes that are available in the gallery are having the highest
     374                 :            :        priority, so we will take a look there before taking the internal default */
     375                 :            : 
     376 [ #  # ][ #  # ]:          0 :     if ( GalleryExplorer::GetSdrObjCount( GALLERY_THEME_POWERPOINT ) )
     377                 :            :     {
     378         [ #  # ]:          0 :         std::vector< rtl::OUString > aObjList;
     379 [ #  # ][ #  # ]:          0 :         if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) )
     380                 :            :         {
     381                 :            :             sal_uInt16 i;
     382         [ #  # ]:          0 :             for ( i = 0; i < aObjList.size(); i++ )
     383                 :            :             {
     384         [ #  # ]:          0 :                 if ( aObjList[ i ].equalsIgnoreAsciiCase( rCustomShape ) )
     385                 :            :                 {
     386         [ #  # ]:          0 :                     FmFormModel aFormModel;
     387                 :          0 :                     SfxItemPool& rPool = aFormModel.GetItemPool();
     388         [ #  # ]:          0 :                     rPool.FreezeIdRanges();
     389 [ #  # ][ #  # ]:          0 :                     if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) )
     390                 :            :                     {
     391 [ #  # ][ #  # ]:          0 :                         const SdrObject* pSourceObj = aFormModel.GetPage( 0 )->GetObj( 0 );
     392         [ #  # ]:          0 :                         if( pSourceObj )
     393                 :            :                         {
     394                 :          0 :                             PropertyValue aPropVal_;
     395         [ #  # ]:          0 :                             SdrCustomShapeGeometryItem& rSourceGeometry = (SdrCustomShapeGeometryItem&)pSourceObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
     396         [ #  # ]:          0 :                             com::sun::star::uno::Any* pAny = rSourceGeometry.GetPropertyValueByName( sType );
     397         [ #  # ]:          0 :                             if ( pAny )
     398                 :            :                             {
     399                 :          0 :                                 aPropVal_.Name = sType;
     400                 :          0 :                                 aPropVal_.Value = *pAny;
     401         [ #  # ]:          0 :                                 rGeometryItem.SetPropertyValue( aPropVal_ );
     402                 :            :                             }
     403         [ #  # ]:          0 :                             pAny = rSourceGeometry.GetPropertyValueByName( sAdjustmentValues );
     404         [ #  # ]:          0 :                             if ( pAny )
     405                 :            :                             {
     406                 :          0 :                                 aPropVal_.Name = sAdjustmentValues;
     407                 :          0 :                                 aPropVal_.Value = *pAny;
     408         [ #  # ]:          0 :                                 rGeometryItem.SetPropertyValue( aPropVal_ );
     409                 :            :                             }
     410         [ #  # ]:          0 :                             pAny = rSourceGeometry.GetPropertyValueByName( sCoordinateOrigin );
     411         [ #  # ]:          0 :                             if ( pAny )
     412                 :            :                             {
     413                 :          0 :                                 aPropVal_.Name = sCoordinateOrigin;
     414                 :          0 :                                 aPropVal_.Value = *pAny;
     415         [ #  # ]:          0 :                                 rGeometryItem.SetPropertyValue( aPropVal_ );
     416                 :            :                             }
     417         [ #  # ]:          0 :                             pAny = rSourceGeometry.GetPropertyValueByName( sCoordinateSize );
     418         [ #  # ]:          0 :                             if ( pAny )
     419                 :            :                             {
     420                 :          0 :                                 aPropVal_.Name = sCoordinateSize;
     421                 :          0 :                                 aPropVal_.Value = *pAny;
     422         [ #  # ]:          0 :                                 rGeometryItem.SetPropertyValue( aPropVal_ );
     423                 :            :                             }
     424         [ #  # ]:          0 :                             pAny = rSourceGeometry.GetPropertyValueByName( sEquations );
     425         [ #  # ]:          0 :                             if ( pAny )
     426                 :            :                             {
     427                 :          0 :                                 aPropVal_.Name = sEquations;
     428                 :          0 :                                 aPropVal_.Value = *pAny;
     429         [ #  # ]:          0 :                                 rGeometryItem.SetPropertyValue( aPropVal_ );
     430                 :            :                             }
     431         [ #  # ]:          0 :                             pAny = rSourceGeometry.GetPropertyValueByName( sHandles );
     432         [ #  # ]:          0 :                             if ( pAny )
     433                 :            :                             {
     434                 :          0 :                                 aPropVal_.Name = sHandles;
     435                 :          0 :                                 aPropVal_.Value = *pAny;
     436         [ #  # ]:          0 :                                 rGeometryItem.SetPropertyValue( aPropVal_ );
     437                 :            :                             }
     438         [ #  # ]:          0 :                             pAny = rSourceGeometry.GetPropertyValueByName( sPath );
     439         [ #  # ]:          0 :                             if ( pAny )
     440                 :            :                             {
     441                 :          0 :                                 aPropVal_.Name = sPath;
     442                 :          0 :                                 aPropVal_.Value = *pAny;
     443         [ #  # ]:          0 :                                 rGeometryItem.SetPropertyValue( aPropVal_ );
     444                 :          0 :                             }
     445                 :            :                         }
     446         [ #  # ]:          0 :                     }
     447                 :            :                 }
     448                 :            :             }
     449                 :          0 :         }
     450                 :          0 :     }
     451                 :          0 : }
     452                 :            : 
     453                 :            : 
     454                 :          0 : void FontworkBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBindings )
     455                 :            : {
     456                 :          0 :     sal_uInt16 nStrResId = 0;
     457                 :            : 
     458                 :          0 :     sal_uInt16 nSID = rReq.GetSlot();
     459   [ #  #  #  #  :          0 :     switch( nSID )
             #  #  #  # ]
     460                 :            :     {
     461                 :            :         case SID_FONTWORK_GALLERY_FLOATER:
     462                 :            :         {
     463 [ #  # ][ #  # ]:          0 :             FontWorkGalleryDialog aDlg( pSdrView, ImpGetViewWin(pSdrView), nSID );
     464 [ #  # ][ #  # ]:          0 :             aDlg.Execute();
     465                 :            :         }
     466                 :          0 :         break;
     467                 :            : 
     468                 :            :         case SID_FONTWORK_SHAPE_TYPE:
     469                 :            :         {
     470                 :          0 :             rtl::OUString aCustomShape;
     471                 :          0 :             const SfxItemSet* pArgs = rReq.GetArgs();
     472         [ #  # ]:          0 :             if ( pArgs )
     473                 :            :             {
     474         [ #  # ]:          0 :                 const SfxStringItem& rItm = (const SfxStringItem&)pArgs->Get( rReq.GetSlot() );
     475         [ #  # ]:          0 :                 aCustomShape = rItm.GetValue();
     476                 :            :             }
     477         [ #  # ]:          0 :             if ( !aCustomShape.isEmpty() )
     478                 :            :             {
     479                 :          0 :                 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     480                 :          0 :                 sal_uInt32 nCount = rMarkList.GetMarkCount(), i;
     481         [ #  # ]:          0 :                 for( i = 0; i < nCount; i++ )
     482                 :            :                 {
     483 [ #  # ][ #  # ]:          0 :                     SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
     484 [ #  # ][ #  # ]:          0 :                     if( pObj->ISA(SdrObjCustomShape) )
                 [ #  # ]
     485                 :            :                     {
     486         [ #  # ]:          0 :                         const bool bUndo = pSdrView->IsUndoEnabled();
     487                 :            : 
     488         [ #  # ]:          0 :                         if( bUndo )
     489                 :            :                         {
     490 [ #  # ][ #  # ]:          0 :                             String aStr( SVX_RES( RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE ) );
     491         [ #  # ]:          0 :                             pSdrView->BegUndo( aStr );
     492 [ #  # ][ #  # ]:          0 :                             pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
         [ #  # ][ #  # ]
     493                 :            :                         }
     494 [ #  # ][ #  # ]:          0 :                         SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
     495         [ #  # ]:          0 :                         GetGeometryForCustomShape( aGeometryItem, aCustomShape );
     496         [ #  # ]:          0 :                         pObj->SetMergedItem( aGeometryItem );
     497                 :            : 
     498                 :          0 :                         Reference< drawing::XShape > aXShape = GetXShapeForSdrObject( (SdrObjCustomShape*)pObj );
     499         [ #  # ]:          0 :                         if ( aXShape.is() )
     500                 :            :                         {
     501         [ #  # ]:          0 :                             Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( aXShape, UNO_QUERY );
     502         [ #  # ]:          0 :                             if( xDefaulter.is() )
     503 [ #  # ][ #  # ]:          0 :                                 xDefaulter->createCustomShapeDefaults( aCustomShape );
     504                 :            :                         }
     505                 :            : 
     506         [ #  # ]:          0 :                         pObj->BroadcastObjectChange();
     507         [ #  # ]:          0 :                         if( bUndo )
     508         [ #  # ]:          0 :                             pSdrView->EndUndo();
     509         [ #  # ]:          0 :                         pSdrView->AdjustMarkHdl(); //HMH sal_True );
     510 [ #  # ][ #  # ]:          0 :                         rBindings.Invalidate( SID_FONTWORK_SHAPE_TYPE );
     511                 :            :                     }
     512                 :            :                 }
     513                 :          0 :             }
     514                 :            :         }
     515                 :          0 :         break;
     516                 :            : 
     517                 :            :         case SID_FONTWORK_CHARACTER_SPACING_DIALOG :
     518                 :            :         {
     519 [ #  # ][ #  # ]:          0 :             if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SFX_ITEM_SET ) )
                 [ #  # ]
     520                 :            :             {
     521         [ #  # ]:          0 :                 sal_Int32 nCharSpacing = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_FONTWORK_CHARACTER_SPACING))->GetValue();
     522         [ #  # ]:          0 :                 FontworkCharacterSpacingDialog aDlg( 0L, nCharSpacing );
     523         [ #  # ]:          0 :                 sal_uInt16 nRet = aDlg.Execute();
     524         [ #  # ]:          0 :                 if( nRet != 0 )
     525                 :            :                 {
     526 [ #  # ][ #  # ]:          0 :                     SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, aDlg.getScale() );
     527                 :          0 :                     SfxPoolItem* aItems[] = { &aItem, 0 };
     528 [ #  # ][ #  # ]:          0 :                     rBindings.Execute( SID_FONTWORK_CHARACTER_SPACING, (const SfxPoolItem**)aItems );
     529         [ #  # ]:          0 :                 }
     530                 :            :             }
     531                 :            :         }
     532                 :          0 :         break;
     533                 :            : 
     534                 :            :         case SID_FONTWORK_SHAPE:
     535                 :            :         case SID_FONTWORK_ALIGNMENT:
     536                 :            :         {
     537         [ #  # ]:          0 :             if ( !nStrResId )
     538                 :          0 :                 nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_ALIGNMENT;
     539                 :            :         }   // PASSTROUGH
     540                 :            :         case SID_FONTWORK_CHARACTER_SPACING:
     541                 :            :         {
     542         [ #  # ]:          0 :             if ( !nStrResId )
     543                 :          0 :                 nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
     544                 :            :         }   // PASSTROUGH
     545                 :            :         case SID_FONTWORK_KERN_CHARACTER_PAIRS:
     546                 :            :         {
     547         [ #  # ]:          0 :             if ( !nStrResId )
     548                 :          0 :                 nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_CHARACTER_SPACING;
     549                 :            :         }   // PASSTROUGH
     550                 :            :         case SID_FONTWORK_SAME_LETTER_HEIGHTS:
     551                 :            :         {
     552         [ #  # ]:          0 :             if ( !nStrResId )
     553                 :          0 :                 nStrResId = RID_SVXSTR_UNDO_APPLY_FONTWORK_SAME_LETTER_HEIGHT;
     554                 :            : 
     555                 :          0 :             const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
     556                 :          0 :             sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
     557         [ #  # ]:          0 :             for( i = 0; i < nCount; i++ )
     558                 :            :             {
     559                 :          0 :                 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
     560         [ #  # ]:          0 :                 if( pObj->ISA(SdrObjCustomShape) )
     561                 :            :                 {
     562         [ #  # ]:          0 :                     const bool bUndo = pSdrView->IsUndoEnabled();
     563         [ #  # ]:          0 :                     if( bUndo )
     564                 :            :                     {
     565 [ #  # ][ #  # ]:          0 :                         String aStr( SVX_RES( nStrResId ) );
     566         [ #  # ]:          0 :                         pSdrView->BegUndo( aStr );
     567 [ #  # ][ #  # ]:          0 :                         pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
         [ #  # ][ #  # ]
     568                 :            :                     }
     569 [ #  # ][ #  # ]:          0 :                     SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
     570         [ #  # ]:          0 :                     impl_execute( pSdrView, rReq, aGeometryItem, pObj );
     571         [ #  # ]:          0 :                     pObj->SetMergedItem( aGeometryItem );
     572         [ #  # ]:          0 :                     pObj->BroadcastObjectChange();
     573         [ #  # ]:          0 :                     if( bUndo )
     574 [ #  # ][ #  # ]:          0 :                         pSdrView->EndUndo();
     575                 :            :                 }
     576                 :            :             }
     577                 :            :         }
     578                 :          0 :         break;
     579                 :            :     };
     580                 :          0 : }
     581                 :            : 
     582                 :       6385 : void FontworkBar::getState( SdrView* pSdrView, SfxItemSet& rSet )
     583                 :            : {
     584                 :       6385 :     sal_uInt32 nCheckStatus = 0;
     585                 :            : 
     586 [ +  - ][ -  + ]:       6385 :     if ( rSet.GetItemState( SID_FONTWORK_ALIGNMENT_FLOATER ) != SFX_ITEM_UNKNOWN )
     587                 :            :     {
     588 [ #  # ][ #  # ]:          0 :         if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
     589         [ #  # ]:          0 :             rSet.DisableItem( SID_FONTWORK_ALIGNMENT_FLOATER );
     590                 :            :     }
     591 [ +  - ][ -  + ]:       6385 :     if ( rSet.GetItemState( SID_FONTWORK_ALIGNMENT ) != SFX_ITEM_UNKNOWN )
     592                 :            :     {
     593 [ #  # ][ #  # ]:          0 :         if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
     594         [ #  # ]:          0 :             rSet.DisableItem( SID_FONTWORK_ALIGNMENT );
     595                 :            :         else
     596         [ #  # ]:          0 :             SetAlignmentState( pSdrView, rSet );
     597                 :            :     }
     598 [ +  - ][ -  + ]:       6385 :     if ( rSet.GetItemState( SID_FONTWORK_CHARACTER_SPACING_FLOATER ) != SFX_ITEM_UNKNOWN )
     599                 :            :     {
     600 [ #  # ][ #  # ]:          0 :         if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
     601         [ #  # ]:          0 :             rSet.DisableItem( SID_FONTWORK_CHARACTER_SPACING_FLOATER );
     602                 :            :     }
     603 [ +  - ][ -  + ]:       6385 :     if ( rSet.GetItemState( SID_FONTWORK_CHARACTER_SPACING ) != SFX_ITEM_UNKNOWN )
     604                 :            :     {
     605 [ #  # ][ #  # ]:          0 :         if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
     606         [ #  # ]:          0 :             rSet.DisableItem( SID_FONTWORK_CHARACTER_SPACING );
     607                 :            :         else
     608         [ #  # ]:          0 :             SetCharacterSpacingState( pSdrView, rSet );
     609                 :            :     }
     610 [ +  - ][ -  + ]:       6385 :     if ( rSet.GetItemState( SID_FONTWORK_KERN_CHARACTER_PAIRS ) != SFX_ITEM_UNKNOWN )
     611                 :            :     {
     612 [ #  # ][ #  # ]:          0 :         if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
     613         [ #  # ]:          0 :             rSet.DisableItem( SID_FONTWORK_KERN_CHARACTER_PAIRS );
     614                 :            :         else
     615         [ #  # ]:          0 :             SetKernCharacterPairsState( pSdrView, rSet );
     616                 :            :     }
     617 [ +  - ][ -  + ]:       6385 :     if ( rSet.GetItemState( SID_FONTWORK_SAME_LETTER_HEIGHTS ) != SFX_ITEM_UNKNOWN )
     618                 :            :     {
     619 [ #  # ][ #  # ]:          0 :         if ( !checkForSelectedFontWork( pSdrView, nCheckStatus ) )
     620         [ #  # ]:          0 :             rSet.DisableItem( SID_FONTWORK_SAME_LETTER_HEIGHTS );
     621                 :            :     }
     622 [ +  - ][ -  + ]:       6385 :     if ( rSet.GetItemState( SID_FONTWORK_SHAPE_TYPE ) != SFX_ITEM_UNKNOWN )
     623                 :            :     {
     624 [ #  # ][ #  # ]:          0 :         if ( !checkForSelectedFontWork( pSdrView, nCheckStatus  ) )
     625         [ #  # ]:          0 :             rSet.DisableItem( SID_FONTWORK_SHAPE_TYPE );
     626                 :            :         else
     627         [ #  # ]:          0 :             SetFontWorkShapeTypeState( pSdrView, rSet );
     628                 :            :     }
     629                 :       6385 : }
     630                 :            : 
     631                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10