LCOV - code coverage report
Current view: top level - sd/source/ui/view - drviewsf.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 86 221 38.9 %
Date: 2012-08-25 Functions: 2 4 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 127 644 19.7 %

           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                 :            : 
      30                 :            : #include "DrawViewShell.hxx"
      31                 :            : #include <com/sun/star/form/FormButtonType.hpp>
      32                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      33                 :            : #include <comphelper/string.hxx>
      34                 :            : #include <svx/svxids.hrc>
      35                 :            : #include <svx/globl3d.hxx>
      36                 :            : #include <svx/hlnkitem.hxx>
      37                 :            : #include <editeng/eeitem.hxx>
      38                 :            : #include <editeng/flditem.hxx>
      39                 :            : #include <sfx2/viewfrm.hxx>
      40                 :            : #include <svl/whiter.hxx>
      41                 :            : #include <svl/eitem.hxx>
      42                 :            : #include <svl/itempool.hxx>
      43                 :            : #include <sfx2/tplpitem.hxx>
      44                 :            : #include <sfx2/bindings.hxx>
      45                 :            : #include <sfx2/app.hxx>
      46                 :            : #include <sfx2/templdlg.hxx>
      47                 :            : #include <svx/xdef.hxx>
      48                 :            : #include <svx/svddef.hxx>
      49                 :            : #include <svx/fmglob.hxx>
      50                 :            : #include <svx/svdouno.hxx>
      51                 :            : #include <svx/fmshell.hxx>
      52                 :            : #include <svl/cjkoptions.hxx>
      53                 :            : 
      54                 :            : #ifndef SD_FRAME_VIEW
      55                 :            : #include "FrameView.hxx"
      56                 :            : #endif
      57                 :            : #include "Outliner.hxx"
      58                 :            : #include "app.hrc"
      59                 :            : 
      60                 :            : #include "app.hxx"
      61                 :            : #include "stlsheet.hxx"
      62                 :            : #include "drawview.hxx"
      63                 :            : #include "drawdoc.hxx"
      64                 :            : #include "Window.hxx"
      65                 :            : #include "ViewShellBase.hxx"
      66                 :            : #include "FormShellManager.hxx"
      67                 :            : #include "cfgids.hxx"
      68                 :            : #include "anminfo.hxx"
      69                 :            : 
      70                 :            : using ::rtl::OUString;
      71                 :            : using namespace ::com::sun::star;
      72                 :            : 
      73                 :            : namespace sd {
      74                 :            : 
      75                 :            : /*************************************************************************
      76                 :            : |*
      77                 :            : |* Status von Controller-SfxSlots setzen
      78                 :            : |*
      79                 :            : \************************************************************************/
      80                 :            : 
      81                 :        142 : void DrawViewShell::GetCtrlState(SfxItemSet &rSet)
      82                 :            : {
      83         [ -  + ]:        142 :     if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN)
      84                 :            :     {
      85                 :            :         // "Letzte Version" vom SFx en/disablen lassen
      86                 :          0 :         GetViewFrame()->GetSlotState (SID_RELOAD, NULL, &rSet);
      87                 :            :     }
      88                 :            : 
      89         [ -  + ]:        142 :     if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK))
      90                 :            :     {
      91         [ #  # ]:          0 :         SvxHyperlinkItem aHLinkItem;
      92                 :            : 
      93                 :          0 :         OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
      94                 :            : 
      95         [ #  # ]:          0 :         if (pOLV)
      96                 :            :         {
      97                 :          0 :             bool bField = false;
      98         [ #  # ]:          0 :             const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
      99         [ #  # ]:          0 :             if (pFieldItem)
     100                 :            :             {
     101         [ #  # ]:          0 :                 ESelection aSel = pOLV->GetSelection();
     102         [ #  # ]:          0 :                 if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
     103                 :            :                 {
     104                 :          0 :                     const SvxFieldData* pField = pFieldItem->GetField();
     105 [ #  # ][ #  # ]:          0 :                     if (pField->ISA(SvxURLField))
                 [ #  # ]
     106                 :            :                     {
     107 [ #  # ][ #  # ]:          0 :                         aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
                 [ #  # ]
     108 [ #  # ][ #  # ]:          0 :                         aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
                 [ #  # ]
     109 [ #  # ][ #  # ]:          0 :                         aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
                 [ #  # ]
     110                 :          0 :                         bField = true;
     111                 :            :                     }
     112                 :            :                 }
     113                 :            :             }
     114         [ #  # ]:          0 :             if (!bField)
     115                 :            :             {
     116                 :            :                 // use selected text as name for urls
     117         [ #  # ]:          0 :                 String sReturn = pOLV->GetSelected();
     118         [ #  # ]:          0 :                 sReturn.Erase(255);
     119 [ #  # ][ #  # ]:          0 :                 aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     120                 :            :             }
     121                 :            :         }
     122                 :            :         else
     123                 :            :         {
     124         [ #  # ]:          0 :             if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0)
     125                 :            :             {
     126                 :          0 :                 bool bFound = false;
     127                 :            : 
     128 [ #  # ][ #  # ]:          0 :                 SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
     129 [ #  # ][ #  # ]:          0 :                 if( pMarkedObj && (FmFormInventor == pMarkedObj->GetObjInventor()) )
         [ #  # ][ #  # ]
     130                 :            :                 {
     131         [ #  # ]:          0 :                     SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( pMarkedObj );
     132                 :            : 
     133         [ #  # ]:          0 :                     if(pUnoCtrl) try
     134                 :            :                     {
     135 [ #  # ][ #  # ]:          0 :                         uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
     136         [ #  # ]:          0 :                         uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
     137 [ #  # ][ #  # ]:          0 :                         uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     138                 :            : 
     139                 :          0 :                         form::FormButtonType eButtonType = form::FormButtonType_URL;
     140                 :          0 :                         const OUString sButtonType( "ButtonType" );
     141 [ #  # ][ #  # ]:          0 :                         if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     142                 :            :                         {
     143                 :          0 :                             OUString aString;
     144                 :            : 
     145                 :            :                             // Label
     146                 :          0 :                             const OUString sLabel( "Label" );
     147 [ #  # ][ #  # ]:          0 :                             if(xPropInfo->hasPropertyByName(sLabel))
                 [ #  # ]
     148                 :            :                             {
     149 [ #  # ][ #  # ]:          0 :                                 if( xPropSet->getPropertyValue(sLabel) >>= aString )
                 [ #  # ]
     150 [ #  # ][ #  # ]:          0 :                                     aHLinkItem.SetName(String( aString ));
                 [ #  # ]
     151                 :            :                             }
     152                 :            : 
     153                 :            :                             // URL
     154                 :          0 :                             const OUString sTargetURL( "TargetURL" );
     155 [ #  # ][ #  # ]:          0 :                             if(xPropInfo->hasPropertyByName(sTargetURL))
                 [ #  # ]
     156                 :            :                             {
     157 [ #  # ][ #  # ]:          0 :                                 if( xPropSet->getPropertyValue(sTargetURL) >>= aString )
                 [ #  # ]
     158 [ #  # ][ #  # ]:          0 :                                     aHLinkItem.SetURL(String( aString ));
                 [ #  # ]
     159                 :            :                             }
     160                 :            : 
     161                 :            :                             // Target
     162                 :          0 :                             const OUString sTargetFrame( "TargetFrame" );
     163 [ #  # ][ #  # ]:          0 :                             if(xPropInfo->hasPropertyByName(sTargetFrame) )
                 [ #  # ]
     164                 :            :                             {
     165 [ #  # ][ #  # ]:          0 :                                 if( xPropSet->getPropertyValue(sTargetFrame) >>= aString )
                 [ #  # ]
     166 [ #  # ][ #  # ]:          0 :                                     aHLinkItem.SetTargetFrame(String( aString ));
                 [ #  # ]
     167                 :            :                             }
     168                 :            : 
     169                 :          0 :                             aHLinkItem.SetInsertMode(HLINK_BUTTON);
     170                 :          0 :                             bFound = true;
     171         [ #  # ]:          0 :                         }
     172                 :            :                     }
     173         [ #  # ]:          0 :                     catch( uno::Exception& )
     174                 :            :                     {
     175                 :            :                     }
     176                 :            :                 }
     177                 :            : 
     178                 :            :                 // try interaction link
     179 [ #  # ][ #  # ]:          0 :                 if( !bFound && pMarkedObj )
     180                 :            :                 {
     181         [ #  # ]:          0 :                     SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj);
     182 [ #  # ][ #  # ]:          0 :                     if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) )
     183 [ #  # ][ #  # ]:          0 :                         aHLinkItem.SetURL( pInfo->GetBookmark());
                 [ #  # ]
     184                 :          0 :                     aHLinkItem.SetInsertMode(HLINK_BUTTON);
     185                 :            :                 }
     186                 :            :             }
     187                 :            :         }
     188                 :            : 
     189 [ #  # ][ #  # ]:          0 :         rSet.Put(aHLinkItem);
     190                 :            :     }
     191         [ +  - ]:        142 :     rSet.Put( SfxBoolItem( SID_READONLY_MODE, mbReadOnly ) );
     192                 :            : 
     193                 :            :     // Ausgabequalitaet
     194 [ -  + ][ +  -  :        568 :     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_COLOR ) ||
          +  -  +  -  -  
                      + ]
     195                 :        142 :         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_GRAYSCALE ) ||
     196                 :        142 :         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_BLACKWHITE ) ||
     197                 :        142 :         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_CONTRAST ) )
     198                 :            :     {
     199                 :          0 :         const sal_uLong nMode = (sal_Int32)GetActiveWindow()->GetDrawMode();
     200         [ #  # ]:          0 :         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_COLOR, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_COLOR == nMode) ) );
     201         [ #  # ]:          0 :         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_GRAYSCALE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_GRAYSCALE == nMode) ) );
     202         [ #  # ]:          0 :         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_BLACKWHITE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_BLACKWHITE == nMode) ) );
     203         [ #  # ]:          0 :         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_CONTRAST, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_CONTRAST == nMode) ) );
     204                 :            :     }
     205                 :            : 
     206         [ -  + ]:        142 :     if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) )
     207                 :            :     {
     208         [ #  # ]:          0 :         rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) );
     209                 :            :     }
     210                 :            : 
     211         [ -  + ]:        142 :     if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ATTR_YEAR2000) )
     212                 :            :     {
     213         [ #  # ]:          0 :         FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
     214         [ #  # ]:          0 :         if (pFormShell != NULL)
     215                 :            :         {
     216                 :          0 :             sal_uInt16 nState = 0;
     217 [ #  # ][ #  # ]:          0 :             if (pFormShell->GetY2KState(nState))
     218 [ #  # ][ #  # ]:          0 :                 rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nState ) );
                 [ #  # ]
     219                 :            :             else
     220         [ #  # ]:          0 :                 rSet.DisableItem( SID_ATTR_YEAR2000 );
     221                 :            :         }
     222                 :            :     }
     223                 :            : 
     224         [ +  - ]:        142 :     if ( !GetView()->GetTextEditOutliner() )
     225                 :            :     {
     226         [ +  - ]:        142 :         SvtCJKOptions aCJKOptions;
     227 [ +  - ][ +  - ]:        142 :         if( !aCJKOptions.IsChangeCaseMapEnabled() )
     228                 :            :         {
     229 [ +  - ][ +  - ]:        142 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
     230 [ +  - ][ +  - ]:        142 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
     231 [ +  - ][ +  - ]:        142 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
     232 [ +  - ][ +  - ]:        142 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
     233                 :            :         }
     234                 :            :         else
     235                 :            :         {
     236 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
     237 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
     238 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
     239 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
     240                 :            :         }
     241                 :            : 
     242         [ +  - ]:        142 :         rSet.DisableItem( SID_TRANSLITERATE_SENTENCE_CASE );
     243         [ +  - ]:        142 :         rSet.DisableItem( SID_TRANSLITERATE_TITLE_CASE );
     244         [ +  - ]:        142 :         rSet.DisableItem( SID_TRANSLITERATE_TOGGLE_CASE );
     245         [ +  - ]:        142 :         rSet.DisableItem( SID_TRANSLITERATE_UPPER );
     246         [ +  - ]:        142 :         rSet.DisableItem( SID_TRANSLITERATE_LOWER );
     247         [ +  - ]:        142 :         rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
     248         [ +  - ]:        142 :         rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
     249         [ +  - ]:        142 :         rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
     250 [ +  - ][ +  - ]:        142 :         rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
     251                 :            :     }
     252                 :            :     else
     253                 :            :     {
     254         [ #  # ]:          0 :         SvtCJKOptions aCJKOptions;
     255 [ #  # ][ #  # ]:          0 :         if( !aCJKOptions.IsChangeCaseMapEnabled() )
     256                 :            :         {
     257 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
     258 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
     259 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
     260 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
     261         [ #  # ]:          0 :             rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
     262         [ #  # ]:          0 :             rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
     263         [ #  # ]:          0 :             rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
     264         [ #  # ]:          0 :             rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
     265                 :            :         }
     266                 :            :         else
     267                 :            :         {
     268 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
     269 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
     270 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
     271 [ #  # ][ #  # ]:          0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
     272         [ #  # ]:          0 :         }
     273                 :            :     }
     274                 :        142 : }
     275                 :            : 
     276                 :            : 
     277                 :            : /*************************************************************************
     278                 :            : |*
     279                 :            : |* Status der Attribut-Items
     280                 :            : |*
     281                 :            : \************************************************************************/
     282                 :            : 
     283                 :       1970 : void DrawViewShell::GetAttrState( SfxItemSet& rSet )
     284                 :            : {
     285         [ +  - ]:       1970 :     SfxWhichIter    aIter( rSet );
     286         [ +  - ]:       1970 :     sal_uInt16          nWhich = aIter.FirstWhich();
     287                 :            : 
     288                 :       1970 :     sal_Bool    bAttr = sal_False;
     289         [ +  - ]:       1970 :     SfxAllItemSet aAllSet( *rSet.GetPool() );
     290                 :            : 
     291         [ +  + ]:       4839 :     while ( nWhich )
     292                 :            :     {
     293                 :       2869 :         sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
     294                 :       1738 :             ? GetPool().GetSlotId(nWhich)
     295   [ +  +  +  - ]:       4607 :             : nWhich;
     296   [ +  -  +  -  :       2869 :         switch ( nSlotId )
          +  +  +  +  +  
                      + ]
     297                 :            :         {
     298                 :            :             case SID_ATTR_FILL_STYLE:
     299                 :            :             case SID_ATTR_FILL_COLOR:
     300                 :            :             case SID_ATTR_FILL_GRADIENT:
     301                 :            :             case SID_ATTR_FILL_HATCH:
     302                 :            :             case SID_ATTR_FILL_BITMAP:
     303                 :            :             case SID_ATTR_FILL_SHADOW:
     304                 :            :             case SID_ATTR_LINE_STYLE:
     305                 :            :             case SID_ATTR_LINE_DASH:
     306                 :            :             case SID_ATTR_LINE_WIDTH:
     307                 :            :             case SID_ATTR_LINE_COLOR:
     308                 :            :             case SID_ATTR_TEXT_FITTOSIZE:
     309                 :            :             {
     310                 :       1738 :                 bAttr = sal_True;
     311                 :            :             }
     312                 :       1738 :             break;
     313                 :            : 
     314                 :            :             case SID_HYPHENATION:
     315                 :            :             {
     316 [ #  # ][ #  # ]:          0 :                 SfxItemSet aAttrs( GetDoc()->GetPool() );
     317         [ #  # ]:          0 :                 mpDrawView->GetAttributes( aAttrs );
     318 [ #  # ][ #  # ]:          0 :                 if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE )
     319                 :            :                 {
     320         [ #  # ]:          0 :                     sal_Bool bValue = ( (const SfxBoolItem&) aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue();
     321 [ #  # ][ #  # ]:          0 :                     rSet.Put( SfxBoolItem( SID_HYPHENATION, bValue ) );
                 [ #  # ]
     322         [ #  # ]:          0 :                 }
     323                 :            :             }
     324                 :          0 :             break;
     325                 :            : 
     326                 :            :             case SID_STYLE_FAMILY2:
     327                 :            :             case SID_STYLE_FAMILY3:
     328                 :            :             case SID_STYLE_FAMILY5:
     329                 :            :             case SID_STYLE_APPLY: // StyleControl
     330                 :            :             {
     331         [ +  - ]:          4 :                 SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet();
     332         [ +  - ]:          4 :                 if( pStyleSheet )
     333                 :            :                 {
     334 [ +  - ][ +  - ]:          4 :                     if( nSlotId != SID_STYLE_APPLY && !mpDrawView->AreObjectsMarked() )
                 [ +  - ]
     335                 :            :                     {
     336 [ +  - ][ +  - ]:          4 :                         SfxTemplateItem aTmpItem( nWhich, String() );
                 [ +  - ]
     337 [ +  - ][ +  - ]:          4 :                         aAllSet.Put( aTmpItem, aTmpItem.Which()  );
     338                 :            :                     }
     339                 :            :                     else
     340                 :            :                     {
     341         [ #  # ]:          0 :                         if (pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
     342         [ #  # ]:          0 :                             pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
     343                 :            : 
     344         [ #  # ]:          0 :                         if( pStyleSheet )
     345                 :            :                         {
     346                 :          0 :                             SfxStyleFamily eFamily = pStyleSheet->GetFamily();
     347                 :            : 
     348 [ #  # ][ #  # ]:          0 :                             if ((eFamily == SD_STYLE_FAMILY_GRAPHICS &&     nSlotId == SID_STYLE_FAMILY2)       ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     349                 :            :                                 (eFamily == SD_STYLE_FAMILY_CELL     && nSlotId == SID_STYLE_FAMILY3)       ||
     350                 :            :                                 (eFamily == SD_STYLE_FAMILY_PSEUDO &&   nSlotId == SID_STYLE_FAMILY5))
     351                 :            :                             {
     352 [ #  # ][ #  # ]:          0 :                                 SfxTemplateItem aTmpItem ( nWhich, pStyleSheet->GetName() );
     353 [ #  # ][ #  # ]:          0 :                                 aAllSet.Put( aTmpItem, aTmpItem.Which()  );
     354                 :            :                             }
     355                 :            :                             else
     356                 :            :                             {
     357 [ #  # ][ #  # ]:          0 :                                 SfxTemplateItem aTmpItem(nWhich, String());
                 [ #  # ]
     358 [ #  # ][ #  # ]:          0 :                                 aAllSet.Put(aTmpItem,aTmpItem.Which()  );
     359                 :            :                             }
     360                 :            :                         }
     361                 :            :                     }
     362                 :            :                 }
     363                 :            :                 else
     364 [ #  # ][ #  # ]:          0 :                 {   SfxTemplateItem aItem( nWhich, String() );
                 [ #  # ]
     365 [ #  # ][ #  # ]:          0 :                     aAllSet.Put( aItem, aItem.Which() );
     366                 :            :                 }
     367                 :            :             }
     368                 :          4 :             break;
     369                 :            : 
     370                 :            :             case SID_SET_DEFAULT:
     371                 :            :             {
     372 [ #  # ][ #  # ]:          0 :                 if( !mpDrawView->GetMarkedObjectList().GetMarkCount() ||
         [ #  # ][ #  # ]
     373 [ #  # ][ #  # ]:          0 :                     ( !mpDrawView->IsTextEdit() && !mpDrawView->GetStyleSheet() )
     374                 :            :                   )
     375         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     376                 :            :             }
     377                 :          0 :             break;
     378                 :            : 
     379                 :            :             case SID_STYLE_WATERCAN:
     380                 :            :             {
     381 [ +  - ][ +  - ]:         10 :                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
                 [ +  - ]
     382 [ +  + ][ +  - ]:         10 :                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
         [ -  + ][ -  + ]
     383 [ #  # ][ #  # ]:          0 :                     rSet.Put(SfxBoolItem(nWhich,sal_False));
                 [ #  # ]
     384                 :            :                 else
     385                 :            :                 {
     386 [ +  - ][ +  - ]:         10 :                     SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan());
     387 [ +  - ][ +  - ]:         10 :                     aAllSet.Put( aItem, aItem.Which());
     388                 :            :                 }
     389                 :            :             }
     390                 :         10 :             break;
     391                 :            : 
     392                 :            :             case SID_STYLE_NEW:
     393                 :            :             {
     394 [ +  - ][ +  - ]:         10 :                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
                 [ +  - ]
     395 [ +  + ][ +  - ]:         10 :                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
         [ -  + ][ -  + ]
     396         [ #  # ]:          0 :                     rSet.DisableItem(nWhich);
     397                 :            :             }
     398                 :         10 :             break;
     399                 :            : 
     400                 :            :             case SID_STYLE_DRAGHIERARCHIE:
     401                 :            :             {
     402 [ +  - ][ +  - ]:         10 :                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
                 [ +  - ]
     403 [ +  + ][ +  - ]:         10 :                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
         [ -  + ][ -  + ]
     404         [ #  # ]:          0 :                     rSet.DisableItem(nWhich);
     405                 :            :             }
     406                 :         10 :             break;
     407                 :            : 
     408                 :            :             case SID_STYLE_NEW_BY_EXAMPLE:
     409                 :            :             {
     410                 :            :                 // PseudoStyleSheets koennen nicht 'by Example' erzeugt werden;
     411                 :            :                 // normale StyleSheets brauchen dafuer ein selektiertes Objekt
     412 [ +  - ][ +  - ]:         10 :                 ISfxTemplateCommon* pTemplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
                 [ +  - ]
     413         [ +  + ]:         10 :                 if (pTemplCommon)
     414                 :            :                 {
     415 [ +  - ][ -  + ]:          4 :                     if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
     416                 :            :                     {
     417         [ #  # ]:          0 :                         rSet.DisableItem(nWhich);
     418                 :            :                     }
     419 [ +  - ][ +  - ]:          4 :                     else if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_GRAPHICS)
     420                 :            :                     {
     421         [ +  - ]:          4 :                         if (!mpDrawView->AreObjectsMarked())
     422                 :            :                         {
     423         [ +  - ]:          4 :                             rSet.DisableItem(nWhich);
     424                 :            :                         }
     425                 :            :                     }
     426                 :            :                 }
     427                 :            :                 // falls (noch) kein Gestalter da ist, muessen wir uns auf den
     428                 :            :                 // View-Zustand zurueckziehen; eine aktuell eingestellte Familie
     429                 :            :                 // kann nicht beruecksichtigt werden
     430                 :            :                 else
     431                 :            :                 {
     432         [ +  - ]:          6 :                     if (!mpDrawView->AreObjectsMarked())
     433                 :            :                     {
     434         [ +  - ]:          6 :                         rSet.DisableItem(nWhich);
     435                 :            :                     }
     436                 :            :                 }
     437                 :            : 
     438                 :            :             }
     439                 :         10 :             break;
     440                 :            : 
     441                 :            :             case SID_STYLE_UPDATE_BY_EXAMPLE:
     442                 :            :             {
     443         [ +  - ]:         10 :                 if (!mpDrawView->AreObjectsMarked())
     444                 :            :                 {
     445         [ +  - ]:         10 :                     rSet.DisableItem(nWhich);
     446                 :            :                 }
     447                 :            :             }
     448                 :         10 :             break;
     449                 :            :         }
     450         [ +  - ]:       2869 :         nWhich = aIter.NextWhich();
     451                 :            :     }
     452                 :            : 
     453                 :       1970 :     SfxItemSet* pSet = NULL;
     454                 :            : 
     455         [ +  + ]:       1970 :     if( bAttr )
     456                 :            :     {
     457 [ +  - ][ +  - ]:       1216 :         pSet = new SfxItemSet( GetDoc()->GetPool() );
                 [ +  - ]
     458         [ +  - ]:       1216 :         mpDrawView->GetAttributes( *pSet );
     459         [ +  - ]:       1216 :         rSet.Put( *pSet, sal_False );
     460                 :            :     }
     461                 :            : 
     462         [ +  - ]:       1970 :     rSet.Put( aAllSet, sal_False );
     463                 :            : 
     464                 :            :     // Flaechen und/oder Linienattribute wurden geaendert
     465 [ +  + ][ +  - ]:       1970 :     if( bAttr && pSet )
     466                 :            :     {
     467                 :            :         // Wenn die View selektierte Objekte besitzt, muessen entspr. Items
     468                 :            :         // von SFX_ITEM_DEFAULT (_ON) auf SFX_ITEM_DISABLED geaendert werden
     469         [ +  + ]:       1216 :         if( mpDrawView->AreObjectsMarked() )
     470                 :            :         {
     471         [ +  - ]:          1 :             SfxWhichIter aNewIter( *pSet, XATTR_LINE_FIRST, XATTR_FILL_LAST );
     472         [ +  - ]:          1 :             nWhich = aNewIter.FirstWhich();
     473         [ +  + ]:         34 :             while( nWhich )
     474                 :            :             {
     475 [ +  - ][ -  + ]:         33 :                 if( SFX_ITEM_DEFAULT == pSet->GetItemState( nWhich ) )
     476                 :            :                 {
     477         [ #  # ]:          0 :                     rSet.ClearItem( nWhich );
     478         [ #  # ]:          0 :                     rSet.DisableItem( nWhich );
     479                 :            :                 }
     480         [ +  - ]:         33 :                 nWhich = aNewIter.NextWhich();
     481         [ +  - ]:          1 :             }
     482                 :            :         }
     483 [ +  - ][ +  - ]:       1216 :         delete pSet;
     484 [ +  - ][ +  - ]:       1970 :     }
     485                 :            : 
     486                 :       1970 : }
     487                 :            : 
     488                 :            : 
     489                 :            : /*************************************************************************
     490                 :            : |*
     491                 :            : |* Text der Selektion zurueckgeben
     492                 :            : |*
     493                 :            : \************************************************************************/
     494                 :            : 
     495                 :          0 : String DrawViewShell::GetSelectionText(sal_Bool bCompleteWords)
     496                 :            : {
     497                 :          0 :     String aStrSelection;
     498                 :          0 :     ::Outliner* pOl = mpDrawView->GetTextEditOutliner();
     499                 :          0 :     OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
     500                 :            : 
     501 [ #  # ][ #  # ]:          0 :     if (pOl && pOlView)
     502                 :            :     {
     503         [ #  # ]:          0 :         if (bCompleteWords)
     504                 :            :         {
     505         [ #  # ]:          0 :             ESelection aSel = pOlView->GetSelection();
     506         [ #  # ]:          0 :             String aStrCurrentDelimiters = pOl->GetWordDelimiters();
     507                 :            : 
     508 [ #  # ][ #  # ]:          0 :             pOl->SetWordDelimiters( OUString(" .,;\"'" ));
                 [ #  # ]
     509 [ #  # ][ #  # ]:          0 :             aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos );
                 [ #  # ]
     510 [ #  # ][ #  # ]:          0 :             pOl->SetWordDelimiters( aStrCurrentDelimiters );
     511                 :            :         }
     512                 :            :         else
     513                 :            :         {
     514 [ #  # ][ #  # ]:          0 :             aStrSelection = pOlView->GetSelected();
                 [ #  # ]
     515                 :            :         }
     516                 :            :     }
     517                 :            : 
     518                 :          0 :     return (aStrSelection);
     519                 :            : }
     520                 :            : 
     521                 :            : /*************************************************************************
     522                 :            : |*
     523                 :            : |* Ist etwas selektiert?
     524                 :            : |*
     525                 :            : \************************************************************************/
     526                 :            : 
     527                 :          0 : sal_Bool DrawViewShell::HasSelection(sal_Bool bText) const
     528                 :            : {
     529                 :          0 :     sal_Bool bReturn = sal_False;
     530                 :            : 
     531         [ #  # ]:          0 :     if (bText)
     532                 :            :     {
     533                 :          0 :         OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
     534                 :            : 
     535 [ #  # ][ #  # ]:          0 :         if (pOlView && pOlView->GetSelected().Len() != 0)
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     536                 :            :         {
     537                 :          0 :             bReturn = sal_True;
     538                 :            :         }
     539                 :            :     }
     540         [ #  # ]:          0 :     else if (mpDrawView->GetMarkedObjectList().GetMarkCount() != 0)
     541                 :            :     {
     542                 :          0 :         bReturn = sal_True;
     543                 :            :     }
     544                 :            : 
     545                 :          0 :     return bReturn;
     546                 :            : }
     547                 :            : 
     548                 :            : } // end of namespace sd
     549                 :            : 
     550                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10