LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/view - drviewsf.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 100 364 27.5 %
Date: 2013-07-09 Functions: 4 6 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "DrawViewShell.hxx"
      22             : #include <com/sun/star/form/FormButtonType.hpp>
      23             : #include <com/sun/star/beans/XPropertySet.hpp>
      24             : #include <comphelper/string.hxx>
      25             : #include <svx/svxids.hrc>
      26             : #include <svx/globl3d.hxx>
      27             : #include <svx/hlnkitem.hxx>
      28             : #include <editeng/eeitem.hxx>
      29             : #include <editeng/flditem.hxx>
      30             : #include <sfx2/viewfrm.hxx>
      31             : #include <svl/whiter.hxx>
      32             : #include <svl/eitem.hxx>
      33             : #include <svl/itempool.hxx>
      34             : #include <sfx2/tplpitem.hxx>
      35             : #include <sfx2/bindings.hxx>
      36             : #include <sfx2/app.hxx>
      37             : #include <sfx2/templdlg.hxx>
      38             : #include <svx/xdef.hxx>
      39             : #include <svx/svddef.hxx>
      40             : #include <svx/fmglob.hxx>
      41             : #include <svx/svdouno.hxx>
      42             : #include <svx/fmshell.hxx>
      43             : #include <svl/cjkoptions.hxx>
      44             : 
      45             : #ifndef SD_FRAME_VIEW
      46             : #include "FrameView.hxx"
      47             : #endif
      48             : #include "Outliner.hxx"
      49             : #include "app.hrc"
      50             : 
      51             : #include "sdmod.hxx"
      52             : #include "stlsheet.hxx"
      53             : #include "drawview.hxx"
      54             : #include "drawdoc.hxx"
      55             : #include "Window.hxx"
      56             : #include "ViewShellBase.hxx"
      57             : #include "FormShellManager.hxx"
      58             : #include "cfgids.hxx"
      59             : #include "anminfo.hxx"
      60             : 
      61             : #include <editeng/lspcitem.hxx>
      62             : #include <editeng/ulspitem.hxx>
      63             : #include <editeng/lrspitem.hxx>
      64             : #include <editeng/escapementitem.hxx>
      65             : #include <editeng/numitem.hxx>
      66             : #include <editeng/adjustitem.hxx>
      67             : #include <svx/nbdtmgfact.hxx>
      68             : #include <svx/nbdtmg.hxx>
      69             : 
      70             : using namespace svx::sidebar;
      71             : using namespace ::com::sun::star;
      72             : 
      73             : namespace sd {
      74             : 
      75             : /**
      76             :  * Set state of controller SfxSlots
      77             :  */
      78          66 : void DrawViewShell::GetCtrlState(SfxItemSet &rSet)
      79             : {
      80          66 :     if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN)
      81             :     {
      82             :         // let "last version" of SFx en/disable
      83           0 :         GetViewFrame()->GetSlotState (SID_RELOAD, NULL, &rSet);
      84             :     }
      85             : 
      86          66 :     if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK))
      87             :     {
      88           0 :         SvxHyperlinkItem aHLinkItem;
      89             : 
      90           0 :         OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
      91             : 
      92           0 :         if (pOLV)
      93             :         {
      94           0 :             bool bField = false;
      95           0 :             const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
      96           0 :             if (pFieldItem)
      97             :             {
      98           0 :                 ESelection aSel = pOLV->GetSelection();
      99           0 :                 if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
     100             :                 {
     101           0 :                     const SvxFieldData* pField = pFieldItem->GetField();
     102           0 :                     if (pField->ISA(SvxURLField))
     103             :                     {
     104           0 :                         aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
     105           0 :                         aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
     106           0 :                         aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
     107           0 :                         bField = true;
     108             :                     }
     109             :                 }
     110             :             }
     111           0 :             if (!bField)
     112             :             {
     113             :                 // use selected text as name for urls
     114           0 :                 String sReturn = pOLV->GetSelected();
     115           0 :                 sReturn.Erase(255);
     116           0 :                 aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
     117             :             }
     118             :         }
     119             :         else
     120             :         {
     121           0 :             if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0)
     122             :             {
     123           0 :                 bool bFound = false;
     124             : 
     125           0 :                 SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
     126           0 :                 if( pMarkedObj && (FmFormInventor == pMarkedObj->GetObjInventor()) )
     127             :                 {
     128           0 :                     SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( pMarkedObj );
     129             : 
     130           0 :                     if(pUnoCtrl) try
     131             :                     {
     132           0 :                         uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
     133           0 :                         uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
     134           0 :                         uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
     135             : 
     136           0 :                         form::FormButtonType eButtonType = form::FormButtonType_URL;
     137           0 :                         const OUString sButtonType( "ButtonType" );
     138           0 :                         if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) )
     139             :                         {
     140           0 :                             OUString aString;
     141             : 
     142             :                             // Label
     143           0 :                             const OUString sLabel( "Label" );
     144           0 :                             if(xPropInfo->hasPropertyByName(sLabel))
     145             :                             {
     146           0 :                                 if( xPropSet->getPropertyValue(sLabel) >>= aString )
     147           0 :                                     aHLinkItem.SetName(String( aString ));
     148             :                             }
     149             : 
     150             :                             // URL
     151           0 :                             const OUString sTargetURL( "TargetURL" );
     152           0 :                             if(xPropInfo->hasPropertyByName(sTargetURL))
     153             :                             {
     154           0 :                                 if( xPropSet->getPropertyValue(sTargetURL) >>= aString )
     155           0 :                                     aHLinkItem.SetURL(String( aString ));
     156             :                             }
     157             : 
     158             :                             // Target
     159           0 :                             const OUString sTargetFrame( "TargetFrame" );
     160           0 :                             if(xPropInfo->hasPropertyByName(sTargetFrame) )
     161             :                             {
     162           0 :                                 if( xPropSet->getPropertyValue(sTargetFrame) >>= aString )
     163           0 :                                     aHLinkItem.SetTargetFrame(String( aString ));
     164             :                             }
     165             : 
     166           0 :                             aHLinkItem.SetInsertMode(HLINK_BUTTON);
     167           0 :                             bFound = true;
     168           0 :                         }
     169             :                     }
     170           0 :                     catch( uno::Exception& )
     171             :                     {
     172             :                     }
     173             :                 }
     174             : 
     175             :                 // try interaction link
     176           0 :                 if( !bFound && pMarkedObj )
     177             :                 {
     178           0 :                     SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj);
     179           0 :                     if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) )
     180           0 :                         aHLinkItem.SetURL( pInfo->GetBookmark());
     181           0 :                     aHLinkItem.SetInsertMode(HLINK_BUTTON);
     182             :                 }
     183             :             }
     184             :         }
     185             : 
     186           0 :         rSet.Put(aHLinkItem);
     187             :     }
     188          66 :     rSet.Put( SfxBoolItem( SID_READONLY_MODE, mbReadOnly ) );
     189             : 
     190             :     // output quality
     191         198 :     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_COLOR ) ||
     192         132 :         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_GRAYSCALE ) ||
     193         198 :         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_BLACKWHITE ) ||
     194          66 :         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_CONTRAST ) )
     195             :     {
     196           0 :         const sal_uLong nMode = (sal_Int32)GetActiveWindow()->GetDrawMode();
     197           0 :         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_COLOR, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_COLOR == nMode) ) );
     198           0 :         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_GRAYSCALE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_GRAYSCALE == nMode) ) );
     199           0 :         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_BLACKWHITE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_BLACKWHITE == nMode) ) );
     200           0 :         rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_CONTRAST, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_CONTRAST == nMode) ) );
     201             :     }
     202             : 
     203          66 :     if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) )
     204             :     {
     205           0 :         rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) );
     206             :     }
     207             : 
     208          66 :     if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ATTR_YEAR2000) )
     209             :     {
     210           0 :         FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
     211           0 :         if (pFormShell != NULL)
     212             :         {
     213           0 :             sal_uInt16 nState = 0;
     214           0 :             if (pFormShell->GetY2KState(nState))
     215           0 :                 rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nState ) );
     216             :             else
     217           0 :                 rSet.DisableItem( SID_ATTR_YEAR2000 );
     218             :         }
     219             :     }
     220             : 
     221          66 :     if ( !GetView()->GetTextEditOutliner() )
     222             :     {
     223          66 :         SvtCJKOptions aCJKOptions;
     224          66 :         if( !aCJKOptions.IsChangeCaseMapEnabled() )
     225             :         {
     226          66 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
     227          66 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
     228          66 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
     229          66 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
     230             :         }
     231             :         else
     232             :         {
     233           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
     234           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
     235           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
     236           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
     237             :         }
     238             : 
     239          66 :         rSet.DisableItem( SID_TRANSLITERATE_SENTENCE_CASE );
     240          66 :         rSet.DisableItem( SID_TRANSLITERATE_TITLE_CASE );
     241          66 :         rSet.DisableItem( SID_TRANSLITERATE_TOGGLE_CASE );
     242          66 :         rSet.DisableItem( SID_TRANSLITERATE_UPPER );
     243          66 :         rSet.DisableItem( SID_TRANSLITERATE_LOWER );
     244          66 :         rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
     245          66 :         rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
     246          66 :         rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
     247          66 :         rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
     248             :     }
     249             :     else
     250             :     {
     251           0 :         SvtCJKOptions aCJKOptions;
     252           0 :         if( !aCJKOptions.IsChangeCaseMapEnabled() )
     253             :         {
     254           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
     255           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
     256           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
     257           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
     258           0 :             rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
     259           0 :             rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
     260           0 :             rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
     261           0 :             rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
     262             :         }
     263             :         else
     264             :         {
     265           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
     266           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
     267           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
     268           0 :             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
     269           0 :         }
     270             :     }
     271          66 : }
     272             : 
     273             : 
     274             : 
     275        1008 : void DrawViewShell::GetAttrState( SfxItemSet& rSet )
     276             : {
     277        1008 :     SfxWhichIter    aIter( rSet );
     278        1008 :     sal_uInt16          nWhich = aIter.FirstWhich();
     279             : 
     280        1008 :     sal_Bool    bAttr = sal_False;
     281        2016 :     SfxAllItemSet aAllSet( *rSet.GetPool() );
     282             : 
     283        3692 :     while ( nWhich )
     284             :     {
     285        1676 :         sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
     286         984 :             ? GetPool().GetSlotId(nWhich)
     287        2660 :             : nWhich;
     288        1676 :         switch ( nSlotId )
     289             :         {
     290             :             case SID_ATTR_PARA_ADJUST_LEFT:
     291             :             {
     292           0 :                 SfxItemSet aAttrs( GetDoc()->GetPool() );
     293           0 :                 mpDrawView->GetAttributes( aAttrs );
     294             : 
     295           0 :                 SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
     296           0 :                 SvxAdjust eAdj = aItem.GetAdjust();
     297           0 :                 if ( eAdj == SVX_ADJUST_LEFT)
     298             :                 {
     299           0 :                     rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) );
     300             :                 }
     301             : 
     302           0 :                 bAttr = sal_True;
     303             : 
     304           0 :                 Invalidate(nSlotId);
     305             :             }
     306           0 :             break;
     307             :             case SID_ATTR_PARA_ADJUST_CENTER:
     308             :             {
     309           0 :                 SfxItemSet aAttrs( GetDoc()->GetPool() );
     310           0 :                 mpDrawView->GetAttributes( aAttrs );
     311             : 
     312           0 :                 SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
     313           0 :                 SvxAdjust eAdj = aItem.GetAdjust();
     314           0 :                 if ( eAdj == SVX_ADJUST_CENTER)
     315             :                 {
     316           0 :                     rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) );
     317             :                 }
     318             : 
     319           0 :                 bAttr = sal_True;
     320             : 
     321           0 :                 Invalidate(nSlotId);
     322             :             }
     323           0 :             break;
     324             :             case SID_ATTR_PARA_ADJUST_RIGHT:
     325             :             {
     326           0 :                 SfxItemSet aAttrs( GetDoc()->GetPool() );
     327           0 :                 mpDrawView->GetAttributes( aAttrs );
     328             : 
     329           0 :                 SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
     330           0 :                 SvxAdjust eAdj = aItem.GetAdjust();
     331           0 :                 if ( eAdj == SVX_ADJUST_RIGHT)
     332             :                 {
     333           0 :                     rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) );
     334             :                 }
     335             : 
     336           0 :                 bAttr = sal_True;
     337             : 
     338           0 :                 Invalidate(nSlotId);
     339             :             }
     340           0 :             break;
     341             :             case SID_ATTR_PARA_ADJUST_BLOCK:
     342             :             {
     343           0 :                 SfxItemSet aAttrs( GetDoc()->GetPool() );
     344           0 :                 mpDrawView->GetAttributes( aAttrs );
     345             : 
     346           0 :                 SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) );
     347           0 :                 SvxAdjust eAdj = aItem.GetAdjust();
     348           0 :                 if ( eAdj == SVX_ADJUST_BLOCK)
     349             :                 {
     350           0 :                     rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) );
     351             :                 }
     352             : 
     353           0 :                 bAttr = sal_True;
     354             : 
     355           0 :                 Invalidate(nSlotId);
     356             :             }
     357           0 :             break;
     358             :             case SID_ATTR_PARA_LRSPACE:
     359             :             {
     360          57 :                 SfxItemSet aAttrs( GetDoc()->GetPool() );
     361          57 :                 mpDrawView->GetAttributes( aAttrs );
     362         114 :                 SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrs.Get( EE_PARA_LRSPACE ) );
     363          57 :                 aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE);
     364          57 :                 rSet.Put(aLRSpace);
     365          57 :                 bAttr = sal_True;
     366         114 :                 Invalidate(SID_ATTR_PARA_LRSPACE);
     367             :             }
     368          57 :             break;
     369             :             case SID_ATTR_PARA_LINESPACE:
     370             :             {
     371           0 :                 SfxItemSet aAttrs( GetDoc()->GetPool() );
     372           0 :                 mpDrawView->GetAttributes( aAttrs );
     373           0 :                 SvxLineSpacingItem aLineLR = ( (const SvxLineSpacingItem&) aAttrs.Get( EE_PARA_SBL ) );
     374           0 :                 rSet.Put(aLineLR);
     375           0 :                 bAttr = sal_True;
     376           0 :                 Invalidate(SID_ATTR_PARA_LINESPACE);
     377             :             }
     378           0 :             break;
     379             :             case SID_ATTR_PARA_ULSPACE:
     380             :             {
     381           0 :                 SfxItemSet aAttrs( GetDoc()->GetPool() );
     382           0 :                 mpDrawView->GetAttributes( aAttrs );
     383           0 :                 SvxULSpaceItem aULSP = ( (const SvxULSpaceItem&) aAttrs.Get( EE_PARA_ULSPACE ) );
     384           0 :                 aULSP.SetWhich(SID_ATTR_PARA_ULSPACE);
     385           0 :                 rSet.Put(aULSP);
     386           0 :                 bAttr = sal_True;
     387           0 :                 Invalidate(SID_ATTR_PARA_ULSPACE);
     388             :             }
     389           0 :             break;
     390             :             case SID_ATTR_FILL_STYLE:
     391             :             case SID_ATTR_FILL_COLOR:
     392             :             case SID_ATTR_FILL_GRADIENT:
     393             :             case SID_ATTR_FILL_HATCH:
     394             :             case SID_ATTR_FILL_BITMAP:
     395             :             case SID_ATTR_FILL_SHADOW:
     396             :             case SID_ATTR_FILL_TRANSPARENCE:
     397             :             case SID_ATTR_FILL_FLOATTRANSPARENCE:
     398             :             case SID_ATTR_LINE_STYLE:
     399             :             case SID_ATTR_LINE_DASH:
     400             :             case SID_ATTR_LINE_WIDTH:
     401             :             case SID_ATTR_LINE_COLOR:
     402             :             case SID_ATTR_LINE_TRANSPARENCE:
     403             :             case SID_ATTR_LINE_JOINT:
     404             :             case SID_ATTR_LINE_CAP:
     405             :             case SID_ATTR_TEXT_FITTOSIZE:
     406             :             case SID_ATTR_CHAR_FONT:
     407             :             case SID_ATTR_CHAR_FONTHEIGHT:
     408             :             case SID_ATTR_CHAR_SHADOWED:
     409             :             case SID_ATTR_CHAR_POSTURE:
     410             :             case SID_ATTR_CHAR_UNDERLINE:
     411             :             case SID_ATTR_CHAR_STRIKEOUT:
     412             :             case SID_ATTR_CHAR_WEIGHT:
     413             :             case SID_ATTR_CHAR_COLOR:
     414             :             case SID_ATTR_CHAR_KERNING:
     415             :             case SID_SET_SUB_SCRIPT:
     416             :             case SID_SET_SUPER_SCRIPT:
     417             :             {
     418         984 :                 bAttr = sal_True;
     419             :             }
     420         984 :             break;
     421             : 
     422             :             case SID_HYPHENATION:
     423             :             {
     424           0 :                 SfxItemSet aAttrs( GetDoc()->GetPool() );
     425           0 :                 mpDrawView->GetAttributes( aAttrs );
     426           0 :                 if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE )
     427             :                 {
     428           0 :                     sal_Bool bValue = ( (const SfxBoolItem&) aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue();
     429           0 :                     rSet.Put( SfxBoolItem( SID_HYPHENATION, bValue ) );
     430           0 :                 }
     431             :             }
     432           0 :             break;
     433             : 
     434             :             case SID_STYLE_FAMILY2:
     435             :             case SID_STYLE_FAMILY3:
     436             :             case SID_STYLE_FAMILY5:
     437             :             case SID_STYLE_APPLY: // StyleControl
     438             :             {
     439           2 :                 SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet();
     440           2 :                 if( pStyleSheet )
     441             :                 {
     442           2 :                     if( nSlotId != SID_STYLE_APPLY && !mpDrawView->AreObjectsMarked() )
     443             :                     {
     444           2 :                         SfxTemplateItem aTmpItem( nWhich, String() );
     445           2 :                         aAllSet.Put( aTmpItem, aTmpItem.Which()  );
     446             :                     }
     447             :                     else
     448             :                     {
     449           0 :                         if (pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
     450           0 :                             pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
     451             : 
     452           0 :                         if( pStyleSheet )
     453             :                         {
     454           0 :                             SfxStyleFamily eFamily = pStyleSheet->GetFamily();
     455             : 
     456           0 :                             if ((eFamily == SD_STYLE_FAMILY_GRAPHICS &&     nSlotId == SID_STYLE_FAMILY2)       ||
     457           0 :                                 (eFamily == SD_STYLE_FAMILY_CELL     && nSlotId == SID_STYLE_FAMILY3)       ||
     458           0 :                                 (eFamily == SD_STYLE_FAMILY_PSEUDO &&   nSlotId == SID_STYLE_FAMILY5))
     459             :                             {
     460           0 :                                 SfxTemplateItem aTmpItem ( nWhich, pStyleSheet->GetName() );
     461           0 :                                 aAllSet.Put( aTmpItem, aTmpItem.Which()  );
     462             :                             }
     463             :                             else
     464             :                             {
     465           0 :                                 SfxTemplateItem aTmpItem(nWhich, String());
     466           0 :                                 aAllSet.Put(aTmpItem,aTmpItem.Which()  );
     467             :                             }
     468             :                         }
     469             :                     }
     470             :                 }
     471             :                 else
     472           0 :                 {   SfxTemplateItem aItem( nWhich, String() );
     473           0 :                     aAllSet.Put( aItem, aItem.Which() );
     474             :                 }
     475             :             }
     476           2 :             break;
     477             : 
     478             :             case SID_SET_DEFAULT:
     479             :             {
     480           0 :                 if( !mpDrawView->GetMarkedObjectList().GetMarkCount() ||
     481           0 :                     ( !mpDrawView->IsTextEdit() && !mpDrawView->GetStyleSheet() )
     482             :                   )
     483           0 :                     rSet.DisableItem( nWhich );
     484             :             }
     485           0 :             break;
     486             : 
     487             :             case SID_STYLE_WATERCAN:
     488             :             {
     489           5 :                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
     490           5 :                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
     491           0 :                     rSet.Put(SfxBoolItem(nWhich,sal_False));
     492             :                 else
     493             :                 {
     494           5 :                     SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan());
     495           5 :                     aAllSet.Put( aItem, aItem.Which());
     496             :                 }
     497             :             }
     498           5 :             break;
     499             : 
     500             :             case SID_STYLE_NEW:
     501             :             {
     502           5 :                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
     503           5 :                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
     504           0 :                     rSet.DisableItem(nWhich);
     505             :             }
     506           5 :             break;
     507             : 
     508             :             case SID_STYLE_DRAGHIERARCHIE:
     509             :             {
     510           5 :                 ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
     511           5 :                 if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
     512           0 :                     rSet.DisableItem(nWhich);
     513             :             }
     514           5 :             break;
     515             : 
     516             :             case SID_STYLE_NEW_BY_EXAMPLE:
     517             :             {
     518             :                 // It is not possible to create PseudoStyleSheets 'by Example';
     519             :                 // normal style sheets need a selected object for that
     520           5 :                 ISfxTemplateCommon* pTemplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
     521           5 :                 if (pTemplCommon)
     522             :                 {
     523           2 :                     if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
     524             :                     {
     525           0 :                         rSet.DisableItem(nWhich);
     526             :                     }
     527           2 :                     else if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_GRAPHICS)
     528             :                     {
     529           2 :                         if (!mpDrawView->AreObjectsMarked())
     530             :                         {
     531           2 :                             rSet.DisableItem(nWhich);
     532             :                         }
     533             :                     }
     534             :                 }
     535             :                 // if there is no (yet) a designer, we have to go back into the
     536             :                 // view state; an actual set family can not be considered
     537             :                 else
     538             :                 {
     539           3 :                     if (!mpDrawView->AreObjectsMarked())
     540             :                     {
     541           3 :                         rSet.DisableItem(nWhich);
     542             :                     }
     543             :                 }
     544             : 
     545             :             }
     546           5 :             break;
     547             : 
     548             :             case SID_STYLE_UPDATE_BY_EXAMPLE:
     549             :             {
     550           5 :                 if (!mpDrawView->AreObjectsMarked())
     551             :                 {
     552           5 :                     rSet.DisableItem(nWhich);
     553             :                 }
     554             :             }
     555           5 :             break;
     556             :             case FN_BUL_NUM_RULE_INDEX:
     557             :             case FN_NUM_NUM_RULE_INDEX:
     558             :             {
     559           0 :                 SfxItemSet aEditAttr( GetDoc()->GetPool() );
     560           0 :                 mpDrawView->GetAttributes( aEditAttr );
     561             : 
     562           0 :                 SfxItemSet aNewAttr( GetPool(), EE_ITEMS_START, EE_ITEMS_END );
     563           0 :                 aNewAttr.Put( aEditAttr, sal_False );
     564             : 
     565             : 
     566           0 :                 sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
     567           0 :                 SvxNumRule* pNumRule = NULL;
     568           0 :                 const SfxPoolItem* pTmpItem=NULL;
     569           0 :                 sal_uInt16 nNumItemId = SID_ATTR_NUMBERING_RULE;
     570             : 
     571             :                 //if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem))
     572             :                 //  nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue();
     573           0 :                 rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
     574           0 :                 rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
     575           0 :                 nActNumLvl = mpDrawView->GetSelectionLevel();
     576           0 :                 pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId);
     577             : 
     578           0 :                 if (pTmpItem)
     579           0 :                     pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule());
     580             : 
     581           0 :                 if ( pNumRule )
     582             :                 {
     583           0 :                     sal_uInt16 nMask = 1;
     584           0 :                     sal_uInt16 nCount = 0;
     585           0 :                     sal_uInt16 nCurLevel = (sal_uInt16)0xFFFF;
     586           0 :                     for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++)
     587             :                     {
     588           0 :                         if(nActNumLvl & nMask)
     589             :                         {
     590           0 :                             nCount++;
     591           0 :                             nCurLevel = i;
     592             :                         }
     593           0 :                         nMask <<= 1;
     594             :                     }
     595           0 :                     if ( nCount == 1 )
     596             :                     {
     597           0 :                         sal_Bool bBullets = sal_False;
     598           0 :                         const SvxNumberFormat* pNumFmt = pNumRule->Get(nCurLevel);
     599           0 :                         if ( pNumFmt )
     600             :                         {
     601           0 :                             switch(pNumFmt->GetNumberingType())
     602             :                             {
     603             :                                 case SVX_NUM_CHAR_SPECIAL:
     604             :                                 case SVX_NUM_BITMAP:
     605           0 :                                     bBullets = sal_True;
     606           0 :                                     break;
     607             : 
     608             :                                 default:
     609           0 :                                     bBullets = sal_False;
     610             :                             }
     611             : 
     612           0 :                             rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
     613           0 :                             rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
     614           0 :                             if ( bBullets )
     615             :                             {
     616           0 :                                 NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
     617           0 :                                 if ( pBullets )
     618             :                                 {
     619           0 :                                     sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(*pNumRule,nActNumLvl);
     620           0 :                                      rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex));
     621             :                                 }
     622             :                             }else
     623             :                             {
     624           0 :                                 NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
     625           0 :                                 if ( pNumbering )
     626             :                                 {
     627           0 :                                     sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(*pNumRule,nActNumLvl);
     628           0 :                                      rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex));
     629             :                                 }
     630             :                             }
     631             :                         }
     632             :                     }
     633           0 :                   delete pNumRule;
     634           0 :                 }
     635             :             }
     636           0 :             break;
     637             :             //End
     638             :             // Added by Li Hui for story 179.
     639             :             case FN_NUM_BULLET_ON:
     640             :             case FN_NUM_NUMBERING_ON:
     641             :             {
     642           0 :                 sal_Bool bEnable = sal_False;
     643           0 :                 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
     644           0 :                 const sal_uInt32 nMarkCount = rMarkList.GetMarkCount();
     645           0 :                 for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++)
     646             :                 {
     647           0 :                     SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(rMarkList.GetMark(nIndex)->GetMarkedSdrObj());
     648           0 :                     if (pTextObj && pTextObj->GetObjInventor() == SdrInventor)
     649             :                     {
     650           0 :                         if (pTextObj->GetObjIdentifier() != OBJ_OLE2)
     651             :                         {
     652           0 :                             bEnable = sal_True;
     653           0 :                             break;
     654             :                         }
     655             :                     }
     656             :                 }
     657           0 :                 if (bEnable)
     658             :                 {
     659           0 :                     rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_False));
     660           0 :                     rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON, sal_False));
     661             :                 }
     662             :                 else
     663             :                 {
     664           0 :                     rSet.DisableItem(FN_NUM_BULLET_ON);
     665           0 :                     rSet.DisableItem(FN_NUM_NUMBERING_ON);
     666             :                 }
     667             :             }
     668           0 :             break;
     669             :         }
     670        1676 :         nWhich = aIter.NextWhich();
     671             :     }
     672             : 
     673        1008 :     SfxItemSet* pSet = NULL;
     674             : 
     675        1008 :     if( bAttr )
     676             :     {
     677         639 :         pSet = new SfxItemSet( GetDoc()->GetPool() );
     678         639 :         mpDrawView->GetAttributes( *pSet );
     679         639 :         rSet.Put( *pSet, sal_False );
     680             :     }
     681             : 
     682        1008 :     rSet.Put( aAllSet, sal_False );
     683             : 
     684             :     // there were changes at area and/or line attributes
     685        1008 :     if( bAttr && pSet )
     686             :     {
     687             :         // if the view owns selected objects, corresponding items have to be
     688             :         // changed from SFX_ITEM_DEFAULT (_ON) to SFX_ITEM_DISABLED
     689         639 :         if( mpDrawView->AreObjectsMarked() )
     690             :         {
     691           0 :             SfxWhichIter aNewIter( *pSet, XATTR_LINE_FIRST, XATTR_FILL_LAST );
     692           0 :             nWhich = aNewIter.FirstWhich();
     693           0 :             while( nWhich )
     694             :             {
     695           0 :                 if( SFX_ITEM_DEFAULT == pSet->GetItemState( nWhich ) )
     696             :                 {
     697           0 :                     rSet.ClearItem( nWhich );
     698           0 :                     rSet.DisableItem( nWhich );
     699             :                 }
     700           0 :                 nWhich = aNewIter.NextWhich();
     701           0 :             }
     702             :         }
     703             : 
     704         639 :         SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE );
     705         639 :         if ( eState == SFX_ITEM_DONTCARE )
     706             :         {
     707           0 :             rSet.InvalidateItem(EE_PARA_LRSPACE);
     708           0 :             rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
     709             :         }
     710         639 :         eState = pSet->GetItemState( EE_PARA_SBL );
     711         639 :         if ( eState == SFX_ITEM_DONTCARE )
     712             :         {
     713           0 :             rSet.InvalidateItem(EE_PARA_SBL);
     714           0 :             rSet.InvalidateItem(SID_ATTR_PARA_LINESPACE);
     715             :         }
     716         639 :         eState = pSet->GetItemState( EE_PARA_ULSPACE );
     717         639 :         if ( eState == SFX_ITEM_DONTCARE )
     718             :         {
     719           0 :             rSet.InvalidateItem(EE_PARA_ULSPACE);
     720           0 :             rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE);
     721             :         }
     722             : 
     723             :         SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
     724         639 :                         pSet->Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
     725         639 :         if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
     726             :         {
     727           0 :             rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) );
     728             :         }
     729         639 :         else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
     730             :         {
     731           0 :             rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) );
     732             :         }
     733             : 
     734         639 :         eState = pSet->GetItemState( EE_CHAR_KERNING, sal_True );
     735         639 :         if ( eState == SFX_ITEM_DONTCARE )
     736             :         {
     737           0 :             rSet.InvalidateItem(EE_CHAR_KERNING);
     738           0 :             rSet.InvalidateItem(SID_ATTR_CHAR_KERNING);
     739             :         }
     740         639 :         delete pSet;
     741        1008 :     }
     742        1008 : }
     743             : 
     744             : 
     745             : 
     746           0 : String DrawViewShell::GetSelectionText(sal_Bool bCompleteWords)
     747             : {
     748           0 :     String aStrSelection;
     749           0 :     ::Outliner* pOl = mpDrawView->GetTextEditOutliner();
     750           0 :     OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
     751             : 
     752           0 :     if (pOl && pOlView)
     753             :     {
     754           0 :         if (bCompleteWords)
     755             :         {
     756           0 :             ESelection aSel = pOlView->GetSelection();
     757           0 :             String aStrCurrentDelimiters = pOl->GetWordDelimiters();
     758             : 
     759           0 :             pOl->SetWordDelimiters( OUString(" .,;\"'" ));
     760           0 :             aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos );
     761           0 :             pOl->SetWordDelimiters( aStrCurrentDelimiters );
     762             :         }
     763             :         else
     764             :         {
     765           0 :             aStrSelection = pOlView->GetSelected();
     766             :         }
     767             :     }
     768             : 
     769           0 :     return (aStrSelection);
     770             : }
     771             : 
     772             : 
     773           0 : sal_Bool DrawViewShell::HasSelection(sal_Bool bText) const
     774             : {
     775           0 :     sal_Bool bReturn = sal_False;
     776             : 
     777           0 :     if (bText)
     778             :     {
     779           0 :         OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
     780             : 
     781           0 :         if (pOlView && pOlView->GetSelected().Len() != 0)
     782             :         {
     783           0 :             bReturn = sal_True;
     784             :         }
     785             :     }
     786           0 :     else if (mpDrawView->GetMarkedObjectList().GetMarkCount() != 0)
     787             :     {
     788           0 :         bReturn = sal_True;
     789             :     }
     790             : 
     791           0 :     return bReturn;
     792             : }
     793             : 
     794          33 : } // end of namespace sd
     795             : 
     796             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10