LCOV - code coverage report
Current view: top level - sd/source/core - stlsheet.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 342 555 61.6 %
Date: 2012-08-25 Functions: 36 59 61.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 588 1516 38.8 %

           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 <com/sun/star/beans/PropertyAttribute.hpp>
      31                 :            : #include <com/sun/star/lang/DisposedException.hpp>
      32                 :            : #include <com/sun/star/style/XStyle.hpp>
      33                 :            : 
      34                 :            : #include <osl/mutex.hxx>
      35                 :            : #include <vcl/svapp.hxx>
      36                 :            : #include <comphelper/serviceinfohelper.hxx>
      37                 :            : #include <boost/bind.hpp>
      38                 :            : 
      39                 :            : #include "eetext.hxx"
      40                 :            : #include <editeng/eeitem.hxx>
      41                 :            : #include <editeng/fhgtitem.hxx>
      42                 :            : #include <svx/svdoattr.hxx>
      43                 :            : #include <editeng/ulspitem.hxx>
      44                 :            : #include <svl/smplhint.hxx>
      45                 :            : #include <svl/itemset.hxx>
      46                 :            : 
      47                 :            : #include <svx/xflbmtit.hxx>
      48                 :            : #include <svx/xflbstit.hxx>
      49                 :            : #include <editeng/bulitem.hxx>
      50                 :            : #include <editeng/lrspitem.hxx>
      51                 :            : #include <svx/unoshprp.hxx>
      52                 :            : #include <svx/unoshape.hxx>
      53                 :            : #include <svx/svdpool.hxx>
      54                 :            : #include "stlsheet.hxx"
      55                 :            : #include "sdresid.hxx"
      56                 :            : #include "sdpage.hxx"
      57                 :            : #include "drawdoc.hxx"
      58                 :            : #include "stlpool.hxx"
      59                 :            : #include "glob.hrc"
      60                 :            : #include "app.hrc"
      61                 :            : #include "glob.hxx"
      62                 :            : #include "helpids.h"
      63                 :            : #include "../ui/inc/DrawViewShell.hxx"
      64                 :            : #include "../ui/inc/ViewShellBase.hxx"
      65                 :            : 
      66                 :            : using ::rtl::OUString;
      67                 :            : using ::osl::MutexGuard;
      68                 :            : using ::osl::ClearableMutexGuard;
      69                 :            : using ::cppu::OInterfaceContainerHelper;
      70                 :            : using namespace ::com::sun::star::uno;
      71                 :            : using namespace ::com::sun::star::util;
      72                 :            : using namespace ::com::sun::star::lang;
      73                 :            : using namespace ::com::sun::star::style;
      74                 :            : using namespace ::com::sun::star::beans;
      75                 :            : using namespace ::com::sun::star::container;
      76                 :            : using namespace ::com::sun::star::drawing;
      77                 :            : 
      78                 :            : #define WID_STYLE_DISPNAME  7998
      79                 :            : #define WID_STYLE_FAMILY    7999
      80                 :            : 
      81                 :     117159 : static SvxItemPropertySet& GetStylePropertySet()
      82                 :            : {
      83                 :            :     static const SfxItemPropertyMapEntry aFullPropertyMap_Impl[] =
      84                 :            :     {
      85         [ +  - ]:         10 :         { RTL_CONSTASCII_STRINGPARAM("Family"),                 WID_STYLE_FAMILY,       &::getCppuType((const OUString*)0), PropertyAttribute::READONLY,    0},
      86         [ +  - ]:         10 :         { RTL_CONSTASCII_STRINGPARAM("UserDefinedAttributes"),  SDRATTR_XMLATTRIBUTES,  &XNameContainer::static_type(), 0,     0},
      87         [ +  - ]:         10 :         { RTL_CONSTASCII_STRINGPARAM("DisplayName"),            WID_STYLE_DISPNAME,     &::getCppuType((const OUString*)0), PropertyAttribute::READONLY,    0},
      88                 :            : 
      89 [ +  - ][ +  - ]:         10 :         SVX_UNOEDIT_NUMBERING_PROPERTIE,
      90 [ +  - ][ +  - ]:         10 :         SHADOW_PROPERTIES
         [ +  - ][ +  - ]
                 [ +  - ]
      91 [ +  - ][ +  - ]:         10 :         LINE_PROPERTIES
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      92 [ +  - ][ +  - ]:         10 :         LINE_PROPERTIES_START_END
         [ +  - ][ +  - ]
      93 [ +  - ][ +  - ]:         10 :         FILL_PROPERTIES
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      94         [ +  - ]:         10 :         EDGERADIUS_PROPERTIES
      95 [ +  - ][ +  - ]:         10 :         TEXT_PROPERTIES_DEFAULTS
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      96 [ +  - ][ +  - ]:         10 :         CONNECTOR_PROPERTIES
         [ +  - ][ +  - ]
                 [ +  - ]
      97 [ +  - ][ +  - ]:         10 :         SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
      98                 :            :         {0,0,0,0,0,0}
      99 [ +  + ][ +  - ]:     117169 :     };
                 [ #  # ]
     100                 :            : 
     101 [ +  + ][ +  - ]:     117159 :     static SvxItemPropertySet aPropSet( aFullPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
         [ +  - ][ +  - ]
                 [ #  # ]
     102                 :     117159 :     return aPropSet;
     103                 :            : }
     104                 :            : 
     105         [ -  + ]:      10164 : class ModifyListenerForewarder : public SfxListener
     106                 :            : {
     107                 :            : public:
     108                 :            :     ModifyListenerForewarder( SdStyleSheet* pStyleSheet );
     109                 :            : 
     110                 :            :     virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
     111                 :            : 
     112                 :            : private:
     113                 :            :     SdStyleSheet* mpStyleSheet;
     114                 :            : };
     115                 :            : 
     116                 :       5181 : ModifyListenerForewarder::ModifyListenerForewarder( SdStyleSheet* pStyleSheet )
     117                 :       5181 : : mpStyleSheet( pStyleSheet )
     118                 :            : {
     119         [ +  - ]:       5181 :     if( pStyleSheet )
     120                 :            :     {
     121                 :       5181 :         SfxBroadcaster& rBC = static_cast< SfxBroadcaster& >( *pStyleSheet );
     122         [ +  - ]:       5181 :         StartListening( rBC );
     123                 :            :     }
     124                 :       5181 : }
     125                 :            : 
     126                 :      15555 : void ModifyListenerForewarder::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/)
     127                 :            : {
     128         [ +  - ]:      15555 :     if( mpStyleSheet )
     129                 :      15555 :         mpStyleSheet->notifyModifyListener();
     130                 :      15555 : }
     131                 :            : 
     132                 :      12201 : SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool& _rPool, SfxStyleFamily eFamily, sal_uInt16 _nMask)
     133                 :            : : SdStyleSheetBase( UniString( rDisplayName ), _rPool, eFamily, _nMask)
     134                 :            : , ::cppu::BaseMutex()
     135                 :            : , msApiName( rDisplayName )
     136                 :            : , mxPool( const_cast< SfxStyleSheetBasePool* >(&_rPool) )
     137 [ +  - ][ +  - ]:      12201 : , mrBHelper( m_aMutex )
                 [ +  - ]
     138                 :            : {
     139                 :      12201 : }
     140                 :            : 
     141                 :          0 : SdStyleSheet::SdStyleSheet( const SdStyleSheet & r )
     142                 :            : : SdStyleSheetBase( r )
     143                 :            : , ::cppu::BaseMutex()
     144                 :            : , msApiName( r.msApiName )
     145                 :            : , mxPool( r.mxPool )
     146 [ #  # ][ #  # ]:          0 : , mrBHelper( m_aMutex )
     147                 :            : {
     148                 :          0 : }
     149                 :            : 
     150 [ +  - ][ +  - ]:      11970 : SdStyleSheet::~SdStyleSheet()
                 [ +  - ]
     151                 :            : {
     152 [ +  + ][ +  - ]:      11970 :     delete pSet;
     153                 :      11970 :     pSet = NULL;    // damit nachfolgende Destruktoren eine Chance haben
     154         [ -  + ]:      23940 : }
     155                 :            : 
     156                 :          0 : void SdStyleSheet::SetApiName( const OUString& rApiName )
     157                 :            : {
     158                 :          0 :     msApiName = rApiName;
     159                 :          0 : }
     160                 :            : 
     161                 :      14868 : rtl::OUString SdStyleSheet::GetApiName() const
     162                 :            : {
     163         [ +  - ]:      14868 :     if( !msApiName.isEmpty() )
     164                 :      14868 :         return msApiName;
     165                 :            :     else
     166                 :      14868 :         return GetName();
     167                 :            : }
     168                 :            : 
     169                 :            : 
     170                 :          0 : void SdStyleSheet::Load (SvStream& rIn, sal_uInt16 nVersion)
     171                 :            : {
     172                 :          0 :     SfxStyleSheetBase::Load(rIn, nVersion);
     173                 :            : 
     174                 :            :     // Die Default-Maske war frueher 0xAFFE.
     175                 :            :     // Aus dieser Default-Maske wurden die benoetigten Flags ausmaskiert.
     176                 :            :     // Nun wurde das Flag SFXSTYLEBIT_READONLY eingefuehrt, was dazu
     177                 :            :     // das alle StyleSheets read-only waren.
     178                 :            :     // Da im Draw kein StyleSheet read-only sein soll, wird an dieser Stelle
     179                 :            :     // das Flag zurueckgesetzt.
     180                 :          0 :     nMask &= ~SFXSTYLEBIT_READONLY;
     181                 :          0 : }
     182                 :            : 
     183                 :            : /*************************************************************************
     184                 :            : |*
     185                 :            : |* Store
     186                 :            : |*
     187                 :            : \************************************************************************/
     188                 :            : 
     189                 :          0 : void SdStyleSheet::Store(SvStream& rOut)
     190                 :            : {
     191                 :          0 :     SfxStyleSheetBase::Store(rOut);
     192                 :          0 : }
     193                 :            : 
     194                 :            : /*************************************************************************
     195                 :            : |*
     196                 :            : |* Parent setzen
     197                 :            : |*
     198                 :            : \************************************************************************/
     199                 :            : 
     200                 :      13283 : sal_Bool SdStyleSheet::SetParent(const String& rParentName)
     201                 :            : {
     202                 :      13283 :     sal_Bool bResult = sal_False;
     203                 :            : 
     204         [ +  - ]:      13283 :     if (SfxStyleSheet::SetParent(rParentName))
     205                 :            :     {
     206                 :            :         // PseudoStyleSheets haben keine eigenen ItemSets
     207         [ +  + ]:      13283 :         if (nFamily != SD_STYLE_FAMILY_PSEUDO)
     208                 :            :         {
     209         [ +  + ]:      11242 :             if( rParentName.Len() )
     210                 :            :             {
     211                 :       8918 :                 SfxStyleSheetBase* pStyle = pPool->Find(rParentName, nFamily);
     212         [ +  - ]:       8918 :                 if (pStyle)
     213                 :            :                 {
     214                 :       8918 :                     bResult = sal_True;
     215                 :       8918 :                     SfxItemSet& rParentSet = pStyle->GetItemSet();
     216                 :       8918 :                     GetItemSet().SetParent(&rParentSet);
     217         [ +  - ]:       8918 :                     Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
     218                 :            :                 }
     219                 :            :             }
     220                 :            :             else
     221                 :            :             {
     222                 :       2324 :                 bResult = sal_True;
     223                 :       2324 :                 GetItemSet().SetParent(NULL);
     224         [ +  - ]:       2324 :                 Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
     225                 :            :             }
     226                 :            :         }
     227                 :            :         else
     228                 :            :         {
     229                 :       2041 :             bResult = sal_True;
     230                 :            :         }
     231                 :            :     }
     232                 :      13283 :     return bResult;
     233                 :            : }
     234                 :            : 
     235                 :            : /*************************************************************************
     236                 :            : |*
     237                 :            : |* ItemSet ggfs. erzeugen und herausreichen
     238                 :            : |*
     239                 :            : \************************************************************************/
     240                 :            : 
     241                 :     729724 : SfxItemSet& SdStyleSheet::GetItemSet()
     242                 :            : {
     243 [ +  + ][ +  + ]:     729724 :     if (nFamily == SD_STYLE_FAMILY_GRAPHICS || nFamily == SD_STYLE_FAMILY_MASTERPAGE)
     244                 :            :     {
     245                 :            :         // ggfs. das ItemSet 'on demand' anlegen
     246         [ +  + ]:     701009 :         if (!pSet)
     247                 :            :         {
     248                 :            :             sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST,              XATTR_LINE_LAST,
     249                 :            :                                          XATTR_FILL_FIRST,              XATTR_FILL_LAST,
     250                 :            : 
     251                 :            :                                         SDRATTR_SHADOW_FIRST,           SDRATTR_SHADOW_LAST,
     252                 :            :                                         SDRATTR_TEXT_MINFRAMEHEIGHT,    SDRATTR_TEXT_CONTOURFRAME,
     253                 :            : 
     254                 :            :                                         SDRATTR_TEXT_WORDWRAP,          SDRATTR_TEXT_AUTOGROWSIZE,
     255                 :            : 
     256                 :            :                                         SDRATTR_EDGE_FIRST,             SDRATTR_EDGE_LAST,
     257                 :            :                                         SDRATTR_MEASURE_FIRST,          SDRATTR_MEASURE_LAST,
     258                 :            : 
     259                 :            :                                         EE_PARA_START,                  EE_CHAR_END,
     260                 :            : 
     261                 :            :                                         SDRATTR_XMLATTRIBUTES,          SDRATTR_TEXT_USEFIXEDCELLHEIGHT,
     262                 :            : 
     263                 :            :                                         SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
     264                 :       4665 :                                         0, 0 };
     265                 :            : 
     266 [ +  - ][ +  - ]:       4665 :             pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable);
                 [ +  - ]
     267                 :            :         }
     268                 :            : 
     269                 :     701009 :         return *pSet;
     270                 :            :     }
     271                 :            : 
     272         [ +  + ]:      28715 :     else if( nFamily == SD_STYLE_FAMILY_CELL )
     273                 :            :     {
     274         [ +  + ]:      26117 :         if (!pSet)
     275                 :            :         {
     276                 :            :             sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST,              XATTR_LINE_LAST,
     277                 :            :                                          XATTR_FILL_FIRST,              XATTR_FILL_LAST,
     278                 :            : 
     279                 :            :                                         SDRATTR_SHADOW_FIRST,           SDRATTR_SHADOW_LAST,
     280                 :            :                                         SDRATTR_TEXT_MINFRAMEHEIGHT,    SDRATTR_TEXT_CONTOURFRAME,
     281                 :            : 
     282                 :            :                                         SDRATTR_TEXT_WORDWRAP,          SDRATTR_TEXT_AUTOGROWSIZE,
     283                 :            : 
     284                 :            :                                         EE_PARA_START,                  EE_CHAR_END,
     285                 :            : 
     286                 :            :                                         SDRATTR_TABLE_FIRST,            SDRATTR_TABLE_LAST,
     287                 :            :                                         SDRATTR_XMLATTRIBUTES,          SDRATTR_XMLATTRIBUTES,
     288                 :            : 
     289                 :       5338 :                                         0, 0 };
     290                 :            : 
     291 [ +  - ][ +  - ]:       5338 :             pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable);
                 [ +  - ]
     292                 :            :         }
     293                 :            : 
     294                 :      26117 :         return *pSet;
     295                 :            :     }
     296                 :            : 
     297                 :            :     // dies ist eine Stellvertretervorlage fuer die interne Vorlage des
     298                 :            :     // aktuellen Praesentationslayouts: dessen ItemSet returnieren
     299                 :            :     else
     300                 :            :     {
     301                 :            : 
     302                 :       2598 :         SdStyleSheet* pSdSheet = GetRealStyleSheet();
     303                 :            : 
     304         [ +  - ]:       2598 :         if (pSdSheet)
     305                 :            :         {
     306                 :       2598 :             return(pSdSheet->GetItemSet());
     307                 :            :         }
     308                 :            :         else
     309                 :            :         {
     310         [ #  # ]:          0 :             if (!pSet)
     311                 :            :             {
     312                 :            :                 sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST,              XATTR_LINE_LAST,
     313                 :            :                                              XATTR_FILL_FIRST,              XATTR_FILL_LAST,
     314                 :            : 
     315                 :            :                                              SDRATTR_SHADOW_FIRST,          SDRATTR_SHADOW_LAST,
     316                 :            :                                              SDRATTR_TEXT_MINFRAMEHEIGHT,   SDRATTR_TEXT_CONTOURFRAME,
     317                 :            : 
     318                 :            :                                              SDRATTR_TEXT_WORDWRAP,         SDRATTR_TEXT_AUTOGROWSIZE,
     319                 :            : 
     320                 :            :                                              SDRATTR_EDGE_FIRST,            SDRATTR_EDGE_LAST,
     321                 :            :                                              SDRATTR_MEASURE_FIRST,         SDRATTR_MEASURE_LAST,
     322                 :            : 
     323                 :            :                                              EE_PARA_START,                 EE_CHAR_END,
     324                 :            : 
     325                 :            :                                             SDRATTR_XMLATTRIBUTES,          SDRATTR_TEXT_USEFIXEDCELLHEIGHT,
     326                 :            : 
     327                 :            :                                             SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
     328                 :          0 :                                              0, 0 };
     329                 :            : 
     330 [ #  # ][ #  # ]:          0 :                 pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable);
                 [ #  # ]
     331                 :            :             }
     332                 :            : 
     333                 :     729724 :             return(*pSet);
     334                 :            :         }
     335                 :            :     }
     336                 :            : }
     337                 :            : 
     338                 :            : /*************************************************************************
     339                 :            : |*
     340                 :            : |* IsUsed(), eine Vorlage gilt als benutzt, wenn sie von eingefuegten Objekten
     341                 :            : |*           oder von benutzten Vorlagen referenziert wird
     342                 :            : |*
     343                 :            : \************************************************************************/
     344                 :            : 
     345                 :        804 : sal_Bool SdStyleSheet::IsUsed() const
     346                 :            : {
     347                 :        804 :     sal_Bool bResult = sal_False;
     348                 :            : 
     349                 :        804 :     sal_uInt16 nListenerCount = GetListenerCount();
     350         [ +  - ]:        804 :     if (nListenerCount > 0)
     351                 :            :     {
     352         [ +  + ]:       1992 :         for (sal_uInt16 n = 0; n < nListenerCount; n++)
     353                 :            :         {
     354                 :       1188 :             SfxListener* pListener = GetListener(n);
     355         [ -  + ]:       1188 :             if( pListener == this )
     356                 :          0 :                 continue;
     357                 :            : 
     358                 :            :             // NULL-Pointer ist im Listener-Array erlaubt
     359 [ +  - ][ -  + ]:       1188 :             if (pListener && pListener->ISA(SdrAttrObj))
                 [ -  + ]
     360                 :            :             {
     361                 :          0 :                 bResult = ((SdrAttrObj*)pListener)->IsInserted();
     362                 :            :             }
     363 [ +  - ][ +  + ]:       1188 :             else if (pListener && pListener->ISA(SfxStyleSheet))
                 [ +  + ]
     364                 :            :             {
     365 [ +  - ][ +  - ]:        396 :                 bResult = ((SfxStyleSheet*)pListener)->IsUsed();
                 [ +  - ]
     366                 :            :             }
     367         [ -  + ]:       1188 :             if (bResult)
     368                 :          0 :                 break;
     369                 :            :         }
     370                 :            :     }
     371                 :            : 
     372         [ +  - ]:        804 :     if( !bResult )
     373                 :            :     {
     374         [ +  - ]:        804 :         MutexGuard aGuard( mrBHelper.rMutex );
     375                 :            : 
     376 [ +  - ][ +  - ]:        804 :         OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( XModifyListener::static_type() );
     377         [ +  + ]:        804 :         if( pContainer )
     378                 :            :         {
     379         [ +  - ]:        792 :             Sequence< Reference< XInterface > > aModifyListeners( pContainer->getElements() );
     380         [ +  - ]:        792 :             Reference< XInterface > *p = aModifyListeners.getArray();
     381                 :        792 :             sal_Int32 nCount = aModifyListeners.getLength();
     382 [ +  + ][ +  - ]:       2640 :             while( nCount-- && !bResult )
                 [ +  + ]
     383                 :            :             {
     384         [ +  - ]:       1848 :                 Reference< XStyle > xStyle( *p++, UNO_QUERY );
     385         [ +  - ]:       1848 :                 if( xStyle.is() )
     386 [ +  - ][ +  - ]:       1848 :                     bResult = xStyle->isInUse();
     387         [ +  - ]:       2640 :             }
     388         [ +  - ]:        804 :         }
     389                 :            :     }
     390                 :        804 :     return bResult;
     391                 :            : }
     392                 :            : 
     393                 :            : /*************************************************************************
     394                 :            : |*
     395                 :            : |* das StyleSheet ermitteln, fuer das dieses StyleSheet steht
     396                 :            : |*
     397                 :            : \************************************************************************/
     398                 :            : 
     399                 :       2598 : SdStyleSheet* SdStyleSheet::GetRealStyleSheet() const
     400                 :            : {
     401         [ +  - ]:       2598 :     String aRealStyle;
     402         [ +  - ]:       2598 :     String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
     403                 :       2598 :     SdStyleSheet* pRealStyle = NULL;
     404                 :       2598 :     SdDrawDocument* pDoc = ((SdStyleSheetPool*)pPool)->GetDoc();
     405                 :            : 
     406                 :       2598 :     ::sd::DrawViewShell* pDrawViewShell = 0;
     407                 :            : 
     408 [ +  - ][ +  - ]:       2598 :     ::sd::ViewShellBase* pBase = dynamic_cast< ::sd::ViewShellBase* >( SfxViewShell::Current() );
     409         [ -  + ]:       2598 :     if( pBase )
     410 [ #  # ][ #  # ]:          0 :         pDrawViewShell = dynamic_cast< ::sd::DrawViewShell* >( pBase->GetMainViewShell().get() );
                 [ #  # ]
     411                 :            : 
     412 [ -  + ][ #  # ]:       2598 :     if (pDrawViewShell && pDrawViewShell->GetDoc() == pDoc)
         [ #  # ][ -  + ]
     413                 :            :     {
     414         [ #  # ]:          0 :         SdPage* pPage = pDrawViewShell->getCurrentPage();
     415         [ #  # ]:          0 :         if( pPage )
     416                 :            :         {
     417 [ #  # ][ #  # ]:          0 :             aRealStyle = pPage->GetLayoutName();
                 [ #  # ]
     418                 :            :             // cut after seperator string
     419 [ #  # ][ #  # ]:          0 :             aRealStyle.Erase(aRealStyle.Search(aSep) + aSep.Len());
     420                 :            :         }
     421                 :            :     }
     422                 :            : 
     423         [ +  - ]:       2598 :     if (aRealStyle.Len() == 0)
     424                 :            :     {
     425         [ +  - ]:       2598 :         SdPage* pPage = pDoc->GetSdPage(0, PK_STANDARD);
     426                 :            : 
     427         [ +  + ]:       2598 :         if (pPage)
     428                 :            :         {
     429 [ +  - ][ +  - ]:        306 :             aRealStyle = pDoc->GetSdPage(0, PK_STANDARD)->GetLayoutName();
         [ +  - ][ +  - ]
     430                 :            :         }
     431                 :            :         else
     432                 :            :         {
     433                 :            :             // Noch keine Seite vorhanden
     434                 :            :             // Dieses kann beim Aktualisieren vonDokumentvorlagen vorkommen
     435         [ +  - ]:       2292 :             SfxStyleSheetIterator aIter(pPool, SD_STYLE_FAMILY_MASTERPAGE);
     436         [ +  - ]:       2292 :             SfxStyleSheetBase* pSheet = aIter.First();
     437         [ +  - ]:       2292 :             if( pSheet )
     438 [ +  - ][ +  - ]:       2292 :                 aRealStyle = pSheet->GetName();
                 [ +  - ]
     439                 :            :         }
     440                 :            : 
     441 [ +  - ][ +  - ]:       2598 :         aRealStyle.Erase(aRealStyle.Search(aSep) + aSep.Len());
     442                 :            :     }
     443                 :            : 
     444                 :            :     // jetzt vom Namen (landessprachlich angepasst) auf den internen
     445                 :            :     // Namen (unabhaengig von der Landessprache) mappen
     446         [ +  - ]:       2598 :     String aInternalName;
     447                 :            : 
     448 [ +  - ][ +  - ]:       2598 :     if (aName == String(SdResId(STR_PSEUDOSHEET_TITLE)))
         [ +  - ][ +  - ]
                 [ +  + ]
     449                 :            :     {
     450 [ +  - ][ +  - ]:         15 :         aInternalName = String(SdResId(STR_LAYOUT_TITLE));
         [ +  - ][ +  - ]
     451                 :            :     }
     452 [ +  - ][ +  - ]:       2583 :     else if (aName == String(SdResId(STR_PSEUDOSHEET_SUBTITLE)))
         [ +  - ][ +  - ]
                 [ +  + ]
     453                 :            :     {
     454 [ +  - ][ +  - ]:         15 :         aInternalName = String(SdResId(STR_LAYOUT_SUBTITLE));
         [ +  - ][ +  - ]
     455                 :            :     }
     456 [ +  - ][ +  - ]:       2568 :     else if (aName == String(SdResId(STR_PSEUDOSHEET_BACKGROUND)))
         [ +  - ][ +  - ]
                 [ +  + ]
     457                 :            :     {
     458 [ +  - ][ +  - ]:         15 :         aInternalName = String(SdResId(STR_LAYOUT_BACKGROUND));
         [ +  - ][ +  - ]
     459                 :            :     }
     460 [ +  - ][ +  - ]:       2553 :     else if (aName == String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS)))
         [ +  - ][ +  - ]
                 [ +  + ]
     461                 :            :     {
     462 [ +  - ][ +  - ]:       2403 :         aInternalName = String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
         [ +  - ][ +  - ]
     463                 :            :     }
     464 [ +  - ][ +  - ]:        150 :     else if (aName == String(SdResId(STR_PSEUDOSHEET_NOTES)))
         [ +  - ][ +  - ]
                 [ +  + ]
     465                 :            :     {
     466 [ +  - ][ +  - ]:         15 :         aInternalName = String(SdResId(STR_LAYOUT_NOTES));
         [ +  - ][ +  - ]
     467                 :            :     }
     468                 :            :     else
     469                 :            :     {
     470 [ +  - ][ +  - ]:        135 :         String aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE));
     471         [ +  - ]:        135 :         sal_uInt16 nPos = aName.Search(aOutlineStr);
     472         [ +  - ]:        135 :         if (nPos != STRING_NOTFOUND)
     473                 :            :         {
     474         [ +  - ]:        135 :             String aNumStr(aName.Copy(aOutlineStr.Len()));
     475 [ +  - ][ +  - ]:        135 :             aInternalName = String(SdResId(STR_LAYOUT_OUTLINE));
         [ +  - ][ +  - ]
     476 [ +  - ][ +  - ]:        135 :             aInternalName += aNumStr;
     477         [ +  - ]:        135 :         }
     478                 :            :     }
     479                 :            : 
     480         [ +  - ]:       2598 :     aRealStyle += aInternalName;
     481         [ +  - ]:       2598 :     pRealStyle = static_cast< SdStyleSheet* >( pPool->Find(aRealStyle, SD_STYLE_FAMILY_MASTERPAGE) );
     482                 :            : 
     483                 :            : #ifdef DBG_UTIL
     484                 :            :     if( !pRealStyle )
     485                 :            :     {
     486                 :            :         SfxStyleSheetIterator aIter(pPool, SD_STYLE_FAMILY_MASTERPAGE);
     487                 :            :         if( aIter.Count() > 0 )
     488                 :            :             // StyleSheet not found, but pool already loaded
     489                 :            :             DBG_ASSERT(pRealStyle, "Internal StyleSheet not found");
     490                 :            :     }
     491                 :            : #endif
     492                 :            : 
     493 [ +  - ][ +  - ]:       2598 :     return pRealStyle;
                 [ +  - ]
     494                 :            : }
     495                 :            : 
     496                 :            : /*************************************************************************
     497                 :            : |*
     498                 :            : |* das PseudoStyleSheet ermitteln, durch das dieses StyleSheet vertreten wird
     499                 :            : |*
     500                 :            : \************************************************************************/
     501                 :            : 
     502                 :          0 : SdStyleSheet* SdStyleSheet::GetPseudoStyleSheet() const
     503                 :            : {
     504                 :          0 :     SdStyleSheet* pPseudoStyle = NULL;
     505         [ #  # ]:          0 :     String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR ));
     506         [ #  # ]:          0 :     String aStyleName(aName);
     507                 :            :         // ohne Layoutnamen und Separator
     508 [ #  # ][ #  # ]:          0 :     aStyleName.Erase(0, aStyleName.Search(aSep) + aSep.Len());
     509                 :            : 
     510 [ #  # ][ #  # ]:          0 :     if (aStyleName == String(SdResId(STR_LAYOUT_TITLE)))
         [ #  # ][ #  # ]
                 [ #  # ]
     511                 :            :     {
     512 [ #  # ][ #  # ]:          0 :         aStyleName = String(SdResId(STR_PSEUDOSHEET_TITLE));
         [ #  # ][ #  # ]
     513                 :            :     }
     514 [ #  # ][ #  # ]:          0 :     else if (aStyleName == String(SdResId(STR_LAYOUT_SUBTITLE)))
         [ #  # ][ #  # ]
                 [ #  # ]
     515                 :            :     {
     516 [ #  # ][ #  # ]:          0 :         aStyleName = String(SdResId(STR_PSEUDOSHEET_SUBTITLE));
         [ #  # ][ #  # ]
     517                 :            :     }
     518 [ #  # ][ #  # ]:          0 :     else if (aStyleName == String(SdResId(STR_LAYOUT_BACKGROUND)))
         [ #  # ][ #  # ]
                 [ #  # ]
     519                 :            :     {
     520 [ #  # ][ #  # ]:          0 :         aStyleName = String(SdResId(STR_PSEUDOSHEET_BACKGROUND));
         [ #  # ][ #  # ]
     521                 :            :     }
     522 [ #  # ][ #  # ]:          0 :     else if (aStyleName == String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS)))
         [ #  # ][ #  # ]
                 [ #  # ]
     523                 :            :     {
     524 [ #  # ][ #  # ]:          0 :         aStyleName = String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS));
         [ #  # ][ #  # ]
     525                 :            :     }
     526 [ #  # ][ #  # ]:          0 :     else if (aStyleName == String(SdResId(STR_LAYOUT_NOTES)))
         [ #  # ][ #  # ]
                 [ #  # ]
     527                 :            :     {
     528 [ #  # ][ #  # ]:          0 :         aStyleName = String(SdResId(STR_PSEUDOSHEET_NOTES));
         [ #  # ][ #  # ]
     529                 :            :     }
     530                 :            :     else
     531                 :            :     {
     532 [ #  # ][ #  # ]:          0 :         String aOutlineStr((SdResId(STR_LAYOUT_OUTLINE)));
     533         [ #  # ]:          0 :         sal_uInt16 nPos = aStyleName.Search(aOutlineStr);
     534         [ #  # ]:          0 :         if (nPos != STRING_NOTFOUND)
     535                 :            :         {
     536         [ #  # ]:          0 :             String aNumStr(aStyleName.Copy(aOutlineStr.Len()));
     537 [ #  # ][ #  # ]:          0 :             aStyleName = String(SdResId(STR_PSEUDOSHEET_OUTLINE));
         [ #  # ][ #  # ]
     538 [ #  # ][ #  # ]:          0 :             aStyleName += aNumStr;
     539         [ #  # ]:          0 :         }
     540                 :            :     }
     541                 :            : 
     542         [ #  # ]:          0 :     pPseudoStyle = static_cast<SdStyleSheet*>(pPool->Find(aStyleName, SD_STYLE_FAMILY_PSEUDO));
     543                 :            :     DBG_ASSERT(pPseudoStyle, "PseudoStyleSheet nicht gefunden");
     544                 :            : 
     545 [ #  # ][ #  # ]:          0 :     return pPseudoStyle;
     546                 :            : }
     547                 :            : 
     548                 :            : 
     549                 :            : /*************************************************************************
     550                 :            : |*
     551                 :            : |* Notify
     552                 :            : |*
     553                 :            : \************************************************************************/
     554                 :            : 
     555                 :     772633 : void SdStyleSheet::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     556                 :            : {
     557                 :            :     // erstmal die Basisklassenfunktionalitaet
     558                 :     772633 :     SfxStyleSheet::Notify(rBC, rHint);
     559                 :            : 
     560                 :            :     // wenn der Stellvertreter ein Notify bezueglich geaenderter Attribute
     561                 :            :     // bekommt, sorgt er dafuer, dass das eigentlich gemeinte StyleSheet
     562                 :            :     // broadcastet
     563 [ +  + ][ +  - ]:     772633 :     SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint);
     564         [ +  + ]:     772633 :     sal_uLong nId = pSimple == NULL ? 0 : pSimple->GetId();
     565 [ +  + ][ -  + ]:     772633 :     if (nId == SFX_HINT_DATACHANGED && nFamily == SD_STYLE_FAMILY_PSEUDO)
     566                 :            :     {
     567                 :          0 :         SdStyleSheet* pRealStyle = GetRealStyleSheet();
     568         [ #  # ]:          0 :         if (pRealStyle)
     569                 :          0 :             pRealStyle->Broadcast(rHint);
     570                 :            :     }
     571                 :     772633 : }
     572                 :            : 
     573                 :            : /*************************************************************************
     574                 :            : |* AdjustToFontHeight passt die Bulletbreite und den linken Texteinzug
     575                 :            : |* des uebergebenen ItemSets dessen Fonthoehe an. Die neuen Werte werden so
     576                 :            : |* berechnet, dass das Verhaeltnis zur Fonthoehe so ist wie im StyleSheet.
     577                 :            : |*
     578                 :            : |* bOnlyMissingItems legt fest, ob lediglich nicht gesetzte Items ergaenzt
     579                 :            : |* (sal_True) oder explizit gesetzte Items ueberschreiben werden sollen (sal_False)
     580                 :            : |*
     581                 :            : \************************************************************************/
     582                 :            : 
     583                 :          0 : void SdStyleSheet::AdjustToFontHeight(SfxItemSet& rSet, sal_Bool bOnlyMissingItems)
     584                 :            : {
     585                 :            :     // Bulletbreite und Texteinzug an neue Fonthoehe
     586                 :            :     // anpassen, wenn sie nicht explizit gesetzt wurden
     587                 :          0 :     SfxStyleFamily eFamily = nFamily;
     588         [ #  # ]:          0 :     String aStyleName(aName);
     589         [ #  # ]:          0 :     if (eFamily == SD_STYLE_FAMILY_PSEUDO)
     590                 :            :     {
     591         [ #  # ]:          0 :         SfxStyleSheet* pRealStyle = GetRealStyleSheet();
     592                 :          0 :         eFamily = pRealStyle->GetFamily();
     593 [ #  # ][ #  # ]:          0 :         aStyleName = pRealStyle->GetName();
     594                 :            :     }
     595                 :            : 
     596 [ #  # ][ #  # ]:          0 :     if (eFamily == SD_STYLE_FAMILY_MASTERPAGE &&
         [ #  # ][ #  # ]
     597 [ #  # ][ #  # ]:          0 :         aStyleName.Search(String(SdResId(STR_LAYOUT_OUTLINE))) != STRING_NOTFOUND &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     598         [ #  # ]:          0 :         rSet.GetItemState(EE_CHAR_FONTHEIGHT) == SFX_ITEM_SET)
     599                 :            :     {
     600         [ #  # ]:          0 :         const SfxItemSet* pCurSet = &GetItemSet();
     601         [ #  # ]:          0 :         sal_uInt32 nNewHeight = ((SvxFontHeightItem&)rSet.Get(EE_CHAR_FONTHEIGHT)).GetHeight();
     602         [ #  # ]:          0 :         sal_uInt32 nOldHeight = ((SvxFontHeightItem&)pCurSet->Get(EE_CHAR_FONTHEIGHT)).GetHeight();
     603                 :            : 
     604 [ #  # ][ #  # ]:          0 :         if (rSet.GetItemState(EE_PARA_BULLET) != SFX_ITEM_SET || !bOnlyMissingItems)
         [ #  # ][ #  # ]
     605                 :            :         {
     606         [ #  # ]:          0 :             const SvxBulletItem& rBItem = (const SvxBulletItem&)pCurSet->Get(EE_PARA_BULLET);
     607                 :          0 :             double fBulletFraction = double(rBItem.GetWidth()) / nOldHeight;
     608         [ #  # ]:          0 :             SvxBulletItem aNewBItem(rBItem);
     609                 :          0 :             aNewBItem.SetWidth((sal_uInt32)(fBulletFraction * nNewHeight));
     610 [ #  # ][ #  # ]:          0 :             rSet.Put(aNewBItem);
     611                 :            :         }
     612                 :            : 
     613 [ #  # ][ #  # ]:          0 :         if (rSet.GetItemState(EE_PARA_LRSPACE) != SFX_ITEM_SET || !bOnlyMissingItems)
         [ #  # ][ #  # ]
     614                 :            :         {
     615         [ #  # ]:          0 :             const SvxLRSpaceItem& rLRItem = (const SvxLRSpaceItem&)pCurSet->Get(EE_PARA_LRSPACE);
     616                 :          0 :             double fIndentFraction = double(rLRItem.GetTxtLeft()) / nOldHeight;
     617         [ #  # ]:          0 :             SvxLRSpaceItem aNewLRItem(rLRItem);
     618         [ #  # ]:          0 :             aNewLRItem.SetTxtLeft(fIndentFraction * nNewHeight);
     619                 :          0 :             double fFirstIndentFraction = double(rLRItem.GetTxtFirstLineOfst()) / nOldHeight;
     620         [ #  # ]:          0 :             aNewLRItem.SetTxtFirstLineOfst((short)(fFirstIndentFraction * nNewHeight));
     621 [ #  # ][ #  # ]:          0 :             rSet.Put(aNewLRItem);
     622                 :            :         }
     623                 :            : 
     624 [ #  # ][ #  # ]:          0 :         if (rSet.GetItemState(EE_PARA_ULSPACE) != SFX_ITEM_SET || !bOnlyMissingItems)
         [ #  # ][ #  # ]
     625                 :            :         {
     626         [ #  # ]:          0 :             const SvxULSpaceItem& rULItem = (const SvxULSpaceItem&)pCurSet->Get(EE_PARA_ULSPACE);
     627         [ #  # ]:          0 :             SvxULSpaceItem aNewULItem(rULItem);
     628                 :          0 :             double fLowerFraction = double(rULItem.GetLower()) / nOldHeight;
     629                 :          0 :             aNewULItem.SetLower((sal_uInt16)(fLowerFraction * nNewHeight));
     630                 :          0 :             double fUpperFraction = double(rULItem.GetUpper()) / nOldHeight;
     631                 :          0 :             aNewULItem.SetUpper((sal_uInt16)(fUpperFraction * nNewHeight));
     632 [ #  # ][ #  # ]:          0 :             rSet.Put(aNewULItem);
     633                 :            :         }
     634         [ #  # ]:          0 :     }
     635                 :          0 : }
     636                 :            : 
     637                 :            : // --------------------------------------------------------------------
     638                 :            : 
     639                 :          0 : sal_Bool SdStyleSheet::HasFollowSupport() const
     640                 :            : {
     641                 :          0 :     return sal_False;
     642                 :            : }
     643                 :            : 
     644                 :            : // --------------------------------------------------------------------
     645                 :            : 
     646                 :          0 : sal_Bool SdStyleSheet::HasParentSupport() const
     647                 :            : {
     648                 :          0 :     return sal_True;
     649                 :            : }
     650                 :            : 
     651                 :            : // --------------------------------------------------------------------
     652                 :            : 
     653                 :          0 : sal_Bool SdStyleSheet::HasClearParentSupport() const
     654                 :            : {
     655                 :          0 :     return sal_True;
     656                 :            : }
     657                 :            : 
     658                 :            : // --------------------------------------------------------------------
     659                 :            : 
     660                 :        182 : sal_Bool SdStyleSheet::SetName( const UniString& rName )
     661                 :            : {
     662                 :        182 :     return SfxStyleSheet::SetName( rName );
     663                 :            : }
     664                 :            : 
     665                 :            : // --------------------------------------------------------------------
     666                 :            : 
     667                 :       7020 : void SdStyleSheet::SetHelpId( const String& r, sal_uLong nId )
     668                 :            : {
     669                 :       7020 :     SfxStyleSheet::SetHelpId( r, nId );
     670                 :            : 
     671 [ +  + ][ +  + ]:       7020 :     if( (nId >= HID_PSEUDOSHEET_OUTLINE1) && ( nId <= HID_PSEUDOSHEET_OUTLINE9 ) )
     672                 :            :     {
     673                 :       2898 :         msApiName = "outline";
     674                 :       2898 :         msApiName += OUString( (sal_Unicode)( '1' + (nId - HID_PSEUDOSHEET_OUTLINE1) ) );
     675                 :            :     }
     676                 :            :     else
     677                 :            :     {
     678                 :            :         static struct ApiNameMap
     679                 :            :         {
     680                 :            :             const sal_Char* mpApiName;
     681                 :            :             sal_uInt32      mnApiNameLength;
     682                 :            :             sal_uInt32      mnHelpId;
     683                 :            :         }
     684                 :            :         pApiNameMap[] =
     685                 :            :         {
     686                 :            :             { RTL_CONSTASCII_STRINGPARAM( "title" ),            HID_PSEUDOSHEET_TITLE },
     687                 :            :             { RTL_CONSTASCII_STRINGPARAM( "subtitle" ),         HID_PSEUDOSHEET_SUBTITLE },
     688                 :            :             { RTL_CONSTASCII_STRINGPARAM( "background" ),       HID_PSEUDOSHEET_BACKGROUND },
     689                 :            :             { RTL_CONSTASCII_STRINGPARAM( "backgroundobjects" ),HID_PSEUDOSHEET_BACKGROUNDOBJECTS },
     690                 :            :             { RTL_CONSTASCII_STRINGPARAM( "notes" ),            HID_PSEUDOSHEET_NOTES },
     691                 :            :             { RTL_CONSTASCII_STRINGPARAM( "standard" ),         HID_STANDARD_STYLESHEET_NAME },
     692                 :            :             { RTL_CONSTASCII_STRINGPARAM( "objectwitharrow" ),  HID_POOLSHEET_OBJWITHARROW },
     693                 :            :             { RTL_CONSTASCII_STRINGPARAM( "objectwithshadow" ), HID_POOLSHEET_OBJWITHSHADOW },
     694                 :            :             { RTL_CONSTASCII_STRINGPARAM( "objectwithoutfill" ),HID_POOLSHEET_OBJWITHOUTFILL },
     695                 :            :             { RTL_CONSTASCII_STRINGPARAM( "text" ),             HID_POOLSHEET_TEXT },
     696                 :            :             { RTL_CONSTASCII_STRINGPARAM( "textbody" ),         HID_POOLSHEET_TEXTBODY },
     697                 :            :             { RTL_CONSTASCII_STRINGPARAM( "textbodyjustfied" ), HID_POOLSHEET_TEXTBODY_JUSTIFY },
     698                 :            :             { RTL_CONSTASCII_STRINGPARAM( "textbodyindent" ),   HID_POOLSHEET_TEXTBODY_INDENT },
     699                 :            :             { RTL_CONSTASCII_STRINGPARAM( "title" ),            HID_POOLSHEET_TITLE },
     700                 :            :             { RTL_CONSTASCII_STRINGPARAM( "title1" ),           HID_POOLSHEET_TITLE1 },
     701                 :            :             { RTL_CONSTASCII_STRINGPARAM( "title2" ),           HID_POOLSHEET_TITLE2 },
     702                 :            :             { RTL_CONSTASCII_STRINGPARAM( "headline" ),         HID_POOLSHEET_HEADLINE },
     703                 :            :             { RTL_CONSTASCII_STRINGPARAM( "headline1" ),        HID_POOLSHEET_HEADLINE1 },
     704                 :            :             { RTL_CONSTASCII_STRINGPARAM( "headline2" ),        HID_POOLSHEET_HEADLINE2 },
     705                 :            :             { RTL_CONSTASCII_STRINGPARAM( "measure" ),          HID_POOLSHEET_MEASURE },
     706                 :            :             { 0, 0, 0 }
     707                 :            :         };
     708                 :            : 
     709                 :       4122 :         ApiNameMap* p = pApiNameMap;
     710         [ +  + ]:      38742 :         while( p->mpApiName )
     711                 :            :         {
     712         [ +  + ]:      38585 :             if( nId == p->mnHelpId )
     713                 :            :             {
     714                 :       3965 :                 msApiName = OUString( p->mpApiName, p->mnApiNameLength, RTL_TEXTENCODING_ASCII_US );
     715                 :       3965 :                 break;
     716                 :            :             }
     717                 :      34620 :             p++;
     718                 :            :         }
     719                 :            :     }
     720                 :       7020 : }
     721                 :            : 
     722                 :            : // --------------------------------------------------------------------
     723                 :            : 
     724                 :       1344 : OUString SdStyleSheet::GetFamilyString( SfxStyleFamily eFamily )
     725                 :            : {
     726         [ +  + ]:       1344 :     switch( eFamily )
     727                 :            :     {
     728                 :            :     case SD_STYLE_FAMILY_CELL:
     729                 :        533 :         return OUString( "cell" );
     730                 :            :     default:
     731                 :            :         OSL_FAIL( "SdStyleSheet::GetFamilyString(), illegal family!" );
     732                 :            :     case SD_STYLE_FAMILY_GRAPHICS:
     733                 :       1344 :         return OUString( "graphics" );
     734                 :            :     }
     735                 :            : }
     736                 :            : 
     737                 :            : // --------------------------------------------------------------------
     738                 :            : 
     739                 :     112015 : void SdStyleSheet::throwIfDisposed() throw (RuntimeException)
     740                 :            : {
     741         [ -  + ]:     112015 :     if( !mxPool.is() )
     742         [ #  # ]:          0 :         throw DisposedException();
     743                 :     112015 : }
     744                 :            : 
     745                 :            : // --------------------------------------------------------------------
     746                 :            : 
     747                 :          0 : SdStyleSheet* SdStyleSheet::CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily )
     748                 :            : {
     749                 :          0 :     OUString aPrefix( "user" );
     750                 :          0 :     OUString aName;
     751                 :          0 :     sal_Int32 nIndex = 1;
     752         [ #  # ]:          0 :     do
     753                 :            :     {
     754                 :          0 :         aName = aPrefix + OUString::valueOf( nIndex++ );
     755                 :            :     }
     756 [ #  # ][ #  # ]:          0 :     while( rPool.Find( aName, eFamily ) != 0 );
                 [ #  # ]
     757                 :            : 
     758         [ #  # ]:          0 :     return new SdStyleSheet(aName, rPool, eFamily, SFXSTYLEBIT_USERDEF);
     759                 :            : }
     760                 :            : 
     761                 :            : // --------------------------------------------------------------------
     762                 :            : // XInterface
     763                 :            : // --------------------------------------------------------------------
     764                 :            : 
     765                 :     215911 : void SAL_CALL SdStyleSheet::release(  ) throw ()
     766                 :            : {
     767         [ +  + ]:     215911 :     if (osl_decrementInterlockedCount( &m_refCount ) == 0)
     768                 :            :     {
     769                 :            :         // restore reference count:
     770                 :      11970 :         osl_incrementInterlockedCount( &m_refCount );
     771         [ -  + ]:      11970 :         if (! mrBHelper.bDisposed) try
     772                 :            :         {
     773         [ #  # ]:          0 :             dispose();
     774                 :            :         }
     775                 :          0 :         catch (RuntimeException const& exc)
     776                 :            :         { // don't break throw ()
     777                 :            :             OSL_FAIL(
     778                 :            :                 OUStringToOString(
     779                 :            :                     exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
     780                 :            :             static_cast<void>(exc);
     781                 :            :         }
     782                 :            :         OSL_ASSERT( mrBHelper.bDisposed );
     783                 :      11970 :         SdStyleSheetBase::release();
     784                 :            :     }
     785         [ #  # ]:     215911 : }
     786                 :            : 
     787                 :            : // --------------------------------------------------------------------
     788                 :            : // XComponent
     789                 :            : // --------------------------------------------------------------------
     790                 :            : 
     791                 :      11970 : void SAL_CALL SdStyleSheet::dispose(  ) throw (RuntimeException)
     792                 :            : {
     793         [ +  - ]:      11970 :     ClearableMutexGuard aGuard( mrBHelper.rMutex );
     794 [ +  - ][ +  - ]:      11970 :     if (!mrBHelper.bDisposed && !mrBHelper.bInDispose)
     795                 :            :     {
     796                 :      11970 :         mrBHelper.bInDispose = sal_True;
     797         [ +  - ]:      11970 :         aGuard.clear();
     798                 :            :         try
     799                 :            :         {
     800                 :            :             // side effect: keeping a reference to this
     801 [ +  - ][ +  - ]:      11970 :             EventObject aEvt( static_cast< OWeakObject * >( this ) );
     802                 :            :             try
     803                 :            :             {
     804         [ +  - ]:      11970 :                 mrBHelper.aLC.disposeAndClear( aEvt );
     805         [ +  - ]:      11970 :                 disposing();
     806                 :            :             }
     807                 :          0 :             catch (...)
     808                 :            :             {
     809         [ #  # ]:          0 :                 MutexGuard aGuard2( mrBHelper.rMutex );
     810                 :            :                 // bDisposed and bInDispose must be set in this order:
     811                 :          0 :                 mrBHelper.bDisposed = sal_True;
     812                 :          0 :                 mrBHelper.bInDispose = sal_False;
     813                 :          0 :                 throw;
     814                 :            :             }
     815         [ +  - ]:      11970 :             MutexGuard aGuard2( mrBHelper.rMutex );
     816                 :            :             // bDisposed and bInDispose must be set in this order:
     817                 :      11970 :             mrBHelper.bDisposed = sal_True;
     818 [ +  - ][ +  - ]:      11970 :             mrBHelper.bInDispose = sal_False;
     819                 :            :         }
     820                 :          0 :         catch (RuntimeException &)
     821                 :            :         {
     822                 :          0 :             throw;
     823                 :            :         }
     824      [ #  #  # ]:          0 :         catch (const Exception & exc)
     825                 :            :         {
     826         [ #  # ]:          0 :             throw RuntimeException( "unexpected UNO exception caught: "  +  exc.Message, Reference< XInterface >() );
     827                 :            :         }
     828         [ +  - ]:      11970 :     }
     829                 :      11970 : }
     830                 :            : 
     831                 :            : // --------------------------------------------------------------------
     832                 :            : 
     833                 :      11970 : void SdStyleSheet::disposing()
     834                 :            : {
     835                 :      11970 :     mxPool.clear();
     836                 :      11970 : }
     837                 :            : 
     838                 :            : // --------------------------------------------------------------------
     839                 :            : 
     840                 :          0 : void SAL_CALL SdStyleSheet::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
     841                 :            : {
     842         [ #  # ]:          0 :     ClearableMutexGuard aGuard( mrBHelper.rMutex );
     843 [ #  # ][ #  # ]:          0 :     if (mrBHelper.bDisposed || mrBHelper.bInDispose)
     844                 :            :     {
     845         [ #  # ]:          0 :         aGuard.clear();
     846 [ #  # ][ #  # ]:          0 :         EventObject aEvt( static_cast< OWeakObject * >( this ) );
     847 [ #  # ][ #  # ]:          0 :         xListener->disposing( aEvt );
                 [ #  # ]
     848                 :            :     }
     849                 :            :     else
     850                 :            :     {
     851 [ #  # ][ #  # ]:          0 :         mrBHelper.addListener( ::getCppuType( &xListener ), xListener );
     852         [ #  # ]:          0 :     }
     853                 :          0 : }
     854                 :            : 
     855                 :            : // --------------------------------------------------------------------
     856                 :            : 
     857                 :          0 : void SAL_CALL SdStyleSheet::removeEventListener( const Reference< XEventListener >& xListener  ) throw (RuntimeException)
     858                 :            : {
     859                 :          0 :     mrBHelper.removeListener( ::getCppuType( &xListener ), xListener );
     860                 :          0 : }
     861                 :            : 
     862                 :            : //------------------------------------------------------------------------
     863                 :            : // XModifyBroadcaster
     864                 :            : //------------------------------------------------------------------------
     865                 :            : 
     866                 :      12110 : void SAL_CALL SdStyleSheet::addModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
     867                 :            : {
     868         [ +  - ]:      12110 :     ClearableMutexGuard aGuard( mrBHelper.rMutex );
     869 [ +  - ][ -  + ]:      12110 :     if (mrBHelper.bDisposed || mrBHelper.bInDispose)
     870                 :            :     {
     871         [ #  # ]:          0 :         aGuard.clear();
     872 [ #  # ][ #  # ]:          0 :         EventObject aEvt( static_cast< OWeakObject * >( this ) );
     873 [ #  # ][ #  # ]:          0 :         xListener->disposing( aEvt );
                 [ #  # ]
     874                 :            :     }
     875                 :            :     else
     876                 :            :     {
     877         [ +  + ]:      12110 :         if( !mpModifyListenerForewarder.get() )
     878 [ +  - ][ +  - ]:       5181 :             mpModifyListenerForewarder.reset( new ModifyListenerForewarder( this ) );
                 [ +  - ]
     879 [ +  - ][ +  - ]:      12110 :         mrBHelper.addListener( XModifyListener::static_type(), xListener );
     880         [ +  - ]:      12110 :     }
     881                 :      12110 : }
     882                 :            : 
     883                 :            : //------------------------------------------------------------------------
     884                 :            : 
     885                 :          0 : void SAL_CALL SdStyleSheet::removeModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
     886                 :            : {
     887                 :          0 :     mrBHelper.removeListener( XModifyListener::static_type(), xListener );
     888                 :          0 : }
     889                 :            : 
     890                 :            : //------------------------------------------------------------------------
     891                 :            : 
     892                 :      15555 : void SdStyleSheet::notifyModifyListener()
     893                 :            : {
     894         [ +  - ]:      15555 :     MutexGuard aGuard( mrBHelper.rMutex );
     895                 :            : 
     896 [ +  - ][ +  - ]:      15555 :     OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( XModifyListener::static_type() );
     897         [ +  - ]:      15555 :     if( pContainer )
     898                 :            :     {
     899 [ +  - ][ +  - ]:      15555 :         EventObject aEvt( static_cast< OWeakObject * >( this ) );
     900 [ +  - ][ +  - ]:      15555 :         pContainer->forEach<XModifyListener>( boost::bind( &XModifyListener::modified, _1, boost::cref( aEvt ) ) );
         [ +  - ][ +  - ]
     901         [ +  - ]:      15555 :     }
     902                 :      15555 : }
     903                 :            : 
     904                 :            : 
     905                 :            : // --------------------------------------------------------------------
     906                 :            : // XServiceInfo
     907                 :            : // --------------------------------------------------------------------
     908                 :            : 
     909                 :          0 : OUString SAL_CALL SdStyleSheet::getImplementationName() throw(RuntimeException)
     910                 :            : {
     911                 :          0 :     return OUString( "SdStyleSheet" );
     912                 :            : }
     913                 :            : 
     914                 :            : // --------------------------------------------------------------------
     915                 :            : 
     916                 :          0 : sal_Bool SAL_CALL SdStyleSheet::supportsService( const OUString& ServiceName ) throw(RuntimeException)
     917                 :            : {
     918                 :          0 :     return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
     919                 :            : }
     920                 :            : 
     921                 :            : // --------------------------------------------------------------------
     922                 :            : 
     923                 :          0 : Sequence< OUString > SAL_CALL SdStyleSheet::getSupportedServiceNames() throw(RuntimeException)
     924                 :            : {
     925                 :          0 :     Sequence< OUString > aNameSequence( 10 );
     926         [ #  # ]:          0 :     OUString* pStrings = aNameSequence.getArray();
     927                 :            : 
     928                 :          0 :     *pStrings++ = "com.sun.star.style.Style";
     929                 :          0 :     *pStrings++ = "com.sun.star.drawing.FillProperties";
     930                 :          0 :     *pStrings++ = "com.sun.star.drawing.LineProperties";
     931                 :          0 :     *pStrings++ = "com.sun.star.drawing.ShadowProperties";
     932                 :          0 :     *pStrings++ = "com.sun.star.drawing.ConnectorProperties";
     933                 :          0 :     *pStrings++ = "com.sun.star.drawing.MeasureProperties";
     934                 :          0 :     *pStrings++ = "com.sun.star.style.ParagraphProperties";
     935                 :          0 :     *pStrings++ = "com.sun.star.style.CharacterProperties";
     936                 :          0 :     *pStrings++ = "com.sun.star.drawing.TextProperties";
     937                 :          0 :     *pStrings++ = "com.sun.star.drawing.Text";
     938                 :            : 
     939                 :          0 :     return aNameSequence;
     940                 :            : }
     941                 :            : 
     942                 :            : // --------------------------------------------------------------------
     943                 :            : // XNamed
     944                 :            : // --------------------------------------------------------------------
     945                 :            : 
     946                 :        952 : OUString SAL_CALL SdStyleSheet::getName() throw(RuntimeException)
     947                 :            : {
     948         [ +  - ]:        952 :     SolarMutexGuard aGuard;
     949         [ +  - ]:        952 :     throwIfDisposed();
     950 [ +  - ][ +  - ]:        952 :     return GetApiName();
     951                 :            : }
     952                 :            : 
     953                 :            : // --------------------------------------------------------------------
     954                 :            : 
     955                 :          0 : void SAL_CALL SdStyleSheet::setName( const OUString& rName  ) throw(RuntimeException)
     956                 :            : {
     957         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     958         [ #  # ]:          0 :     throwIfDisposed();
     959                 :            : 
     960 [ #  # ][ #  # ]:          0 :     if( SetName( rName ) )
         [ #  # ][ #  # ]
     961                 :            :     {
     962                 :          0 :         msApiName = rName;
     963 [ #  # ][ #  # ]:          0 :         Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
                 [ #  # ]
     964         [ #  # ]:          0 :     }
     965                 :          0 : }
     966                 :            : 
     967                 :            : // --------------------------------------------------------------------
     968                 :            : // XStyle
     969                 :            : // --------------------------------------------------------------------
     970                 :            : 
     971                 :          0 : sal_Bool SAL_CALL SdStyleSheet::isUserDefined() throw(RuntimeException)
     972                 :            : {
     973         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     974         [ #  # ]:          0 :     throwIfDisposed();
     975 [ #  # ][ #  # ]:          0 :     return IsUserDefined() ? sal_True : sal_False;
     976                 :            : }
     977                 :            : 
     978                 :            : // --------------------------------------------------------------------
     979                 :            : 
     980                 :        408 : sal_Bool SAL_CALL SdStyleSheet::isInUse() throw(RuntimeException)
     981                 :            : {
     982         [ +  - ]:        408 :     SolarMutexGuard aGuard;
     983         [ +  - ]:        408 :     throwIfDisposed();
     984 [ +  - ][ -  + ]:        408 :     return IsUsed() ? sal_True : sal_False;
                 [ +  - ]
     985                 :            : }
     986                 :            : 
     987                 :            : // --------------------------------------------------------------------
     988                 :            : 
     989                 :        236 : OUString SAL_CALL SdStyleSheet::getParentStyle() throw(RuntimeException)
     990                 :            : {
     991         [ +  - ]:        236 :     SolarMutexGuard aGuard;
     992         [ +  - ]:        236 :     throwIfDisposed();
     993                 :            : 
     994 [ +  - ][ +  + ]:        236 :     if( GetParent().Len() )
     995                 :            :     {
     996 [ +  - ][ +  - ]:        200 :         SdStyleSheet* pParentStyle = static_cast< SdStyleSheet* >( mxPool->Find( GetParent(), nFamily ) );
     997         [ +  - ]:        200 :         if( pParentStyle )
     998                 :        200 :             return pParentStyle->msApiName;
     999                 :            :     }
    1000         [ +  - ]:        236 :     return OUString();
    1001                 :            : }
    1002                 :            : 
    1003                 :            : // --------------------------------------------------------------------
    1004                 :            : 
    1005                 :        233 : void SAL_CALL SdStyleSheet::setParentStyle( const OUString& rParentName  ) throw(NoSuchElementException, RuntimeException)
    1006                 :            : {
    1007         [ +  - ]:        233 :     SolarMutexGuard aGuard;
    1008         [ +  - ]:        233 :     throwIfDisposed();
    1009                 :            : 
    1010         [ +  + ]:        233 :     if( !rParentName.isEmpty() )
    1011                 :            :     {
    1012         [ +  - ]:        219 :         const SfxStyles& rStyles = mxPool->GetStyles();
    1013                 :            : 
    1014                 :            :         /* Use reverse iterator to find the parents quicker - most probably its inserted recently.
    1015                 :            :          * Also avoids/fixes the issue n#708518
    1016                 :            :          * To fix it completely its probably wiser to compare this->GetName() and pStyle->GetName() or use complete names for styles (?)
    1017                 :            :          */
    1018 [ +  - ][ +  - ]:      15566 :         for( SfxStyles::const_reverse_iterator iter( rStyles.rbegin() ); iter != rStyles.rend(); ++iter )
                 [ +  - ]
    1019                 :            :         {
    1020         [ +  - ]:      15566 :             SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() );
    1021 [ +  + ][ +  + ]:      15566 :             if( pStyle && (pStyle->nFamily == nFamily) && (pStyle->msApiName == rParentName) )
         [ +  + ][ +  - ]
    1022                 :            :             {
    1023         [ +  - ]:        219 :                 if( pStyle != this )
    1024 [ +  - ][ +  - ]:        219 :                     SetParent( pStyle->GetName() );
    1025                 :        233 :                 return;
    1026                 :            :             }
    1027                 :            :         }
    1028         [ #  # ]:        219 :         throw NoSuchElementException();
    1029                 :            :     }
    1030                 :            :     else
    1031                 :            :     {
    1032 [ +  - ][ +  - ]:        247 :         SetParent( rParentName );
         [ +  - ][ +  + ]
    1033         [ +  - ]:        233 :     }
    1034                 :            : }
    1035                 :            : 
    1036                 :            : // --------------------------------------------------------------------
    1037                 :            : // XPropertySet
    1038                 :            : // --------------------------------------------------------------------
    1039                 :            : 
    1040                 :       1195 : Reference< XPropertySetInfo > SdStyleSheet::getPropertySetInfo() throw(RuntimeException)
    1041                 :            : {
    1042                 :       1195 :     throwIfDisposed();
    1043 [ +  - ][ +  + ]:       1195 :     static Reference< XPropertySetInfo > xInfo;
    1044         [ +  + ]:       1195 :     if( !xInfo.is() )
    1045         [ +  - ]:         10 :         xInfo = GetStylePropertySet().getPropertySetInfo();
    1046                 :       1195 :     return xInfo;
    1047                 :            : }
    1048                 :            : 
    1049                 :            : // --------------------------------------------------------------------
    1050                 :            : 
    1051                 :       6294 : void SAL_CALL SdStyleSheet::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
    1052                 :            : {
    1053         [ +  - ]:       6294 :     SolarMutexGuard aGuard;
    1054         [ +  - ]:       6294 :     throwIfDisposed();
    1055                 :            : 
    1056                 :       6294 :     const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
    1057         [ +  + ]:       6294 :     if( pEntry == NULL )
    1058                 :            :     {
    1059         [ +  - ]:        276 :         throw UnknownPropertyException();
    1060                 :            :     }
    1061                 :            :     else
    1062                 :            :     {
    1063         [ +  + ]:       6018 :         if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
    1064                 :            :             return; // not yet implemented for styles
    1065                 :            : 
    1066         [ -  + ]:       5928 :         if( pEntry->nWID == WID_STYLE_FAMILY )
    1067         [ #  # ]:          0 :             throw PropertyVetoException();
    1068                 :            : 
    1069 [ +  + ][ +  + ]:       5928 :         if( (pEntry->nWID == EE_PARA_NUMBULLET) && (GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) )
                 [ +  + ]
    1070                 :            :         {
    1071         [ +  - ]:         21 :             String aStr;
    1072         [ +  - ]:         21 :             const sal_uInt32 nTempHelpId = GetHelpId( aStr );
    1073                 :            : 
    1074 [ +  + ][ -  + ]:         21 :             if( (nTempHelpId >= HID_PSEUDOSHEET_OUTLINE2) && (nTempHelpId <= HID_PSEUDOSHEET_OUTLINE9) )
    1075 [ +  - ][ +  - ]:         21 :                 return;
    1076                 :            :         }
    1077                 :            : 
    1078         [ +  - ]:       5928 :         SfxItemSet &rStyleSet = GetItemSet();
    1079                 :            : 
    1080         [ -  + ]:       5928 :         if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
    1081                 :            :         {
    1082                 :            :             BitmapMode eMode;
    1083 [ #  # ][ #  # ]:          0 :             if( aValue >>= eMode )
    1084                 :            :             {
    1085 [ #  # ][ #  # ]:          0 :                 rStyleSet.Put( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) );
                 [ #  # ]
    1086 [ #  # ][ #  # ]:          0 :                 rStyleSet.Put( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) );
                 [ #  # ]
    1087                 :            :                 return;
    1088                 :            :             }
    1089         [ #  # ]:          0 :             throw IllegalArgumentException();
    1090                 :            :         }
    1091                 :            : 
    1092 [ +  - ][ +  - ]:       5928 :         SfxItemSet aSet( GetPool().GetPool(),   pEntry->nWID, pEntry->nWID);
    1093         [ +  - ]:       5928 :         aSet.Put( rStyleSet );
    1094                 :            : 
    1095         [ +  + ]:       5928 :         if( !aSet.Count() )
    1096                 :            :         {
    1097         [ +  + ]:       2813 :             if( EE_PARA_NUMBULLET == pEntry->nWID )
    1098                 :            :             {
    1099         [ +  - ]:         32 :                 Font aBulletFont;
    1100         [ +  - ]:         32 :                 SdStyleSheetPool::PutNumBulletItem( this, aBulletFont );
    1101 [ +  - ][ +  - ]:         32 :                 aSet.Put( rStyleSet );
    1102                 :            :             }
    1103                 :            :             else
    1104                 :            :             {
    1105 [ +  - ][ +  - ]:       2781 :                 aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) );
                 [ +  - ]
    1106                 :            :             }
    1107                 :            :         }
    1108                 :            : 
    1109 [ +  + ][ +  - ]:       5928 :         if( pEntry->nMemberId == MID_NAME &&
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
         [ +  + ][ +  - ]
    1110                 :            :             ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT ||
    1111                 :            :               pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ||
    1112                 :            :               pEntry->nWID == XATTR_LINESTART || pEntry->nWID == XATTR_LINEEND || pEntry->nWID == XATTR_LINEDASH) )
    1113                 :            :         {
    1114                 :         36 :             OUString aTempName;
    1115         [ -  + ]:         36 :             if(!(aValue >>= aTempName ))
    1116         [ #  # ]:          0 :                 throw IllegalArgumentException();
    1117                 :            : 
    1118         [ +  - ]:         36 :             SvxShape::SetFillAttribute( pEntry->nWID, aTempName, aSet );
    1119                 :            :         }
    1120 [ +  - ][ +  + ]:       5892 :         else if(!SvxUnoTextRangeBase::SetPropertyValueHelper( aSet, pEntry, aValue, aSet ))
    1121                 :            :         {
    1122 [ +  - ][ +  - ]:       5802 :             SvxItemPropertySet_setPropertyValue( GetStylePropertySet(), pEntry, aValue, aSet );
    1123                 :            :         }
    1124                 :            : 
    1125         [ +  - ]:       5928 :         rStyleSet.Put( aSet );
    1126 [ +  - ][ +  - ]:       6018 :         Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
         [ +  - ][ +  - ]
    1127 [ +  - ][ +  + ]:       6294 :     }
    1128                 :            : }
    1129                 :            : 
    1130                 :            : // --------------------------------------------------------------------
    1131                 :            : 
    1132                 :       2688 : Any SAL_CALL SdStyleSheet::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1133                 :            : {
    1134         [ +  - ]:       2688 :     SolarMutexGuard aGuard;
    1135                 :            : 
    1136         [ +  - ]:       2688 :     throwIfDisposed();
    1137                 :            : 
    1138                 :       2688 :     const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
    1139         [ -  + ]:       2688 :     if( pEntry == NULL )
    1140                 :            :     {
    1141         [ #  # ]:          0 :         throw UnknownPropertyException();
    1142                 :            :     }
    1143                 :            :     else
    1144                 :            :     {
    1145                 :       2688 :         Any aAny;
    1146                 :            : 
    1147         [ +  + ]:       2688 :         if( pEntry->nWID == WID_STYLE_FAMILY )
    1148                 :            :         {
    1149         [ +  + ]:         72 :             if( nFamily == SD_STYLE_FAMILY_MASTERPAGE )
    1150                 :            :             {
    1151 [ +  - ][ +  - ]:         56 :                 const OUString aLayoutName( GetName() );
    1152         [ +  - ]:         56 :                 aAny <<= aLayoutName.copy( 0, aLayoutName.indexOf( SD_LT_SEPARATOR) );
    1153                 :            :             }
    1154                 :            :             else
    1155                 :            :             {
    1156 [ +  - ][ +  - ]:         16 :                 aAny <<= GetFamilyString(nFamily);
    1157                 :            :             }
    1158                 :            :         }
    1159         [ -  + ]:       2616 :         else if( pEntry->nWID == WID_STYLE_DISPNAME )
    1160                 :            :         {
    1161         [ #  # ]:          0 :             aAny <<= maDisplayName;
    1162                 :            :         }
    1163         [ -  + ]:       2616 :         else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
    1164                 :            :         {
    1165         [ #  # ]:          0 :             aAny <<= sal_False;
    1166                 :            :         }
    1167         [ -  + ]:       2616 :         else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
    1168                 :            :         {
    1169         [ #  # ]:          0 :             SfxItemSet &rStyleSet = GetItemSet();
    1170                 :            : 
    1171         [ #  # ]:          0 :             XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)rStyleSet.GetItem(XATTR_FILLBMP_STRETCH);
    1172         [ #  # ]:          0 :             XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)rStyleSet.GetItem(XATTR_FILLBMP_TILE);
    1173                 :            : 
    1174 [ #  # ][ #  # ]:          0 :             if( pStretchItem && pTileItem )
    1175                 :            :             {
    1176         [ #  # ]:          0 :                 if( pTileItem->GetValue() )
    1177         [ #  # ]:          0 :                     aAny <<= BitmapMode_REPEAT;
    1178         [ #  # ]:          0 :                 else if( pStretchItem->GetValue() )
    1179         [ #  # ]:          0 :                     aAny <<= BitmapMode_STRETCH;
    1180                 :            :                 else
    1181         [ #  # ]:          0 :                     aAny <<= BitmapMode_NO_REPEAT;
    1182                 :            :             }
    1183                 :            :         }
    1184                 :            :         else
    1185                 :            :         {
    1186 [ +  - ][ +  - ]:       2616 :             SfxItemSet aSet( GetPool().GetPool(),   pEntry->nWID, pEntry->nWID);
    1187                 :            : 
    1188                 :            :             const SfxPoolItem* pItem;
    1189         [ +  - ]:       2616 :             SfxItemSet& rStyleSet = GetItemSet();
    1190                 :            : 
    1191 [ +  - ][ +  - ]:       2616 :             if( rStyleSet.GetItemState( pEntry->nWID, sal_True, &pItem ) == SFX_ITEM_SET )
    1192         [ +  - ]:       2616 :                 aSet.Put(  *pItem );
    1193                 :            : 
    1194         [ -  + ]:       2616 :             if( !aSet.Count() )
    1195 [ #  # ][ #  # ]:          0 :                 aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) );
                 [ #  # ]
    1196                 :            : 
    1197 [ +  - ][ +  + ]:       2616 :             if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pEntry, aAny ))
    1198                 :         24 :                 return aAny;
    1199                 :            : 
    1200                 :            :             // Hole Wert aus ItemSet
    1201 [ +  - ][ +  - ]:       2616 :             aAny = SvxItemPropertySet_getPropertyValue( GetStylePropertySet(),pEntry, aSet );
         [ +  - ][ +  + ]
    1202                 :            :         }
    1203                 :            : 
    1204         [ -  + ]:       2664 :         if( *pEntry->pType != aAny.getValueType() )
    1205                 :            :         {
    1206                 :            :             // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
    1207 [ #  # ][ #  # ]:          0 :             if( ( *pEntry->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1208                 :            :             {
    1209                 :          0 :                 sal_Int32 nValue = 0;
    1210                 :          0 :                 aAny >>= nValue;
    1211         [ #  # ]:          0 :                 aAny <<= (sal_Int16)nValue;
    1212                 :            :             }
    1213                 :            :             else
    1214                 :            :             {
    1215                 :            :                 OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
    1216                 :            :             }
    1217                 :            :         }
    1218                 :            : 
    1219                 :       2688 :         return aAny;
    1220         [ +  - ]:       2688 :     }
    1221                 :            : }
    1222                 :            : 
    1223                 :            : // --------------------------------------------------------------------
    1224                 :            : 
    1225                 :          0 : void SAL_CALL SdStyleSheet::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >&  ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
    1226                 :          0 : void SAL_CALL SdStyleSheet::removePropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >&  ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
    1227                 :          0 : void SAL_CALL SdStyleSheet::addVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >&  ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
    1228                 :          0 : void SAL_CALL SdStyleSheet::removeVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >&  ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
    1229                 :            : 
    1230                 :            : // --------------------------------------------------------------------
    1231                 :            : // XPropertyState
    1232                 :            : // --------------------------------------------------------------------
    1233                 :            : 
    1234                 :      97440 : PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
    1235                 :            : {
    1236         [ +  - ]:      97440 :     SolarMutexGuard aGuard;
    1237                 :            : 
    1238         [ +  - ]:      97440 :     throwIfDisposed();
    1239                 :            : 
    1240                 :      97440 :     const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
    1241                 :            : 
    1242         [ -  + ]:      97440 :     if( pEntry == NULL )
    1243         [ #  # ]:          0 :         throw UnknownPropertyException();
    1244                 :            : 
    1245         [ -  + ]:      97440 :     if( pEntry->nWID == WID_STYLE_FAMILY )
    1246                 :            :     {
    1247                 :          0 :         return PropertyState_DIRECT_VALUE;
    1248                 :            :     }
    1249         [ +  + ]:      97440 :     else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
    1250                 :            :     {
    1251                 :        511 :         return PropertyState_DEFAULT_VALUE;
    1252                 :            :     }
    1253         [ +  + ]:      96929 :     else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
    1254                 :            :     {
    1255         [ +  - ]:        515 :         const SfxItemSet& rSet = GetItemSet();
    1256                 :            : 
    1257 [ +  - ][ +  - ]:       1030 :         if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET ||
         [ -  + ][ -  + ]
    1258         [ +  - ]:        515 :             rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET )
    1259                 :            :         {
    1260                 :          0 :             return PropertyState_DIRECT_VALUE;
    1261                 :            :         }
    1262                 :            :         else
    1263                 :            :         {
    1264                 :        515 :             return PropertyState_AMBIGUOUS_VALUE;
    1265                 :            :         }
    1266                 :            :     }
    1267                 :            :     else
    1268                 :            :     {
    1269         [ +  - ]:      96414 :         SfxItemSet &rStyleSet = GetItemSet();
    1270                 :            : 
    1271                 :            :         PropertyState eState;
    1272                 :            : 
    1273         [ +  - ]:      96414 :         switch( rStyleSet.GetItemState( pEntry->nWID, sal_False ) )
              [ +  +  + ]
    1274                 :            :         {
    1275                 :            :         case SFX_ITEM_READONLY:
    1276                 :            :         case SFX_ITEM_SET:
    1277                 :       5087 :             eState = PropertyState_DIRECT_VALUE;
    1278                 :       5087 :             break;
    1279                 :            :         case SFX_ITEM_DEFAULT:
    1280                 :      91123 :             eState = PropertyState_DEFAULT_VALUE;
    1281                 :      91123 :             break;
    1282                 :            :         default:
    1283                 :        204 :             eState = PropertyState_AMBIGUOUS_VALUE;
    1284                 :        204 :             break;
    1285                 :            :         }
    1286                 :            : 
    1287                 :            :         // if a item is set, this doesn't mean we want it :)
    1288         [ +  + ]:      96414 :         if( ( PropertyState_DIRECT_VALUE == eState ) )
    1289                 :            :         {
    1290         [ +  + ]:       5087 :             switch( pEntry->nWID )
    1291                 :            :             {
    1292                 :            :             case XATTR_FILLBITMAP:
    1293                 :            :             case XATTR_FILLGRADIENT:
    1294                 :            :             case XATTR_FILLHATCH:
    1295                 :            :             case XATTR_FILLFLOATTRANSPARENCE:
    1296                 :            :             case XATTR_LINEEND:
    1297                 :            :             case XATTR_LINESTART:
    1298                 :            :             case XATTR_LINEDASH:
    1299                 :            :                 {
    1300         [ +  - ]:        207 :                     NameOrIndex* pItem = (NameOrIndex*)rStyleSet.GetItem((sal_uInt16)pEntry->nWID);
    1301 [ +  - ][ +  - ]:        207 :                     if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) )
         [ +  + ][ +  - ]
                 [ +  - ]
           [ +  +  #  # ]
    1302                 :        138 :                         eState = PropertyState_DEFAULT_VALUE;
    1303                 :            :                 }
    1304                 :            :             }
    1305                 :            :         }
    1306                 :            : 
    1307                 :      96414 :         return eState;
    1308         [ +  - ]:      97440 :     }
    1309                 :            : }
    1310                 :            : 
    1311                 :            : // --------------------------------------------------------------------
    1312                 :            : 
    1313                 :        236 : Sequence< PropertyState > SAL_CALL SdStyleSheet::getPropertyStates( const Sequence< OUString >& aPropertyName ) throw(UnknownPropertyException, RuntimeException)
    1314                 :            : {
    1315         [ +  - ]:        236 :     SolarMutexGuard aGuard;
    1316                 :            : 
    1317         [ +  - ]:        236 :     throwIfDisposed();
    1318                 :            : 
    1319                 :        236 :     sal_Int32 nCount = aPropertyName.getLength();
    1320                 :        236 :     const OUString* pNames = aPropertyName.getConstArray();
    1321                 :            : 
    1322         [ +  - ]:        236 :     Sequence< PropertyState > aPropertyStateSequence( nCount );
    1323         [ +  - ]:        236 :     PropertyState* pState = aPropertyStateSequence.getArray();
    1324                 :            : 
    1325         [ +  + ]:      32568 :     while( nCount-- )
    1326         [ +  - ]:      32332 :         *pState++ = getPropertyState( *pNames++ );
    1327                 :            : 
    1328         [ +  - ]:        236 :     return aPropertyStateSequence;
    1329                 :            : }
    1330                 :            : 
    1331                 :            : // --------------------------------------------------------------------
    1332                 :            : 
    1333                 :       2333 : void SAL_CALL SdStyleSheet::setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
    1334                 :            : {
    1335         [ +  - ]:       2333 :     SolarMutexGuard aGuard;
    1336                 :            : 
    1337         [ +  - ]:       2333 :     throwIfDisposed();
    1338                 :            : 
    1339                 :       2333 :     const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
    1340         [ -  + ]:       2333 :     if( pEntry == NULL )
    1341         [ #  # ]:          0 :         throw UnknownPropertyException();
    1342                 :            : 
    1343         [ +  - ]:       2333 :     SfxItemSet &rStyleSet = GetItemSet();
    1344                 :            : 
    1345         [ -  + ]:       2333 :     if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
    1346                 :            :     {
    1347         [ #  # ]:          0 :         rStyleSet.ClearItem( XATTR_FILLBMP_STRETCH );
    1348         [ #  # ]:          0 :         rStyleSet.ClearItem( XATTR_FILLBMP_TILE );
    1349                 :            :     }
    1350                 :            :     else
    1351                 :            :     {
    1352         [ +  - ]:       2333 :         rStyleSet.ClearItem( pEntry->nWID );
    1353                 :            :     }
    1354 [ +  - ][ +  - ]:       2333 :     Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
         [ +  - ][ +  - ]
    1355                 :       2333 : }
    1356                 :            : 
    1357                 :            : // --------------------------------------------------------------------
    1358                 :            : 
    1359                 :          0 : Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
    1360                 :            : {
    1361         [ #  # ]:          0 :     SolarMutexGuard aGuard;
    1362                 :            : 
    1363         [ #  # ]:          0 :     throwIfDisposed();
    1364                 :            : 
    1365                 :          0 :     const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
    1366         [ #  # ]:          0 :     if( pEntry == NULL )
    1367         [ #  # ]:          0 :         throw UnknownPropertyException();
    1368                 :          0 :     Any aRet;
    1369         [ #  # ]:          0 :     if( pEntry->nWID == WID_STYLE_FAMILY )
    1370                 :            :     {
    1371 [ #  # ][ #  # ]:          0 :         aRet <<= GetFamilyString(nFamily);
    1372                 :            :     }
    1373         [ #  # ]:          0 :     else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
    1374                 :            :     {
    1375         [ #  # ]:          0 :         aRet <<= sal_False;
    1376                 :            :     }
    1377         [ #  # ]:          0 :     else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
    1378                 :            :     {
    1379         [ #  # ]:          0 :         aRet <<= BitmapMode_REPEAT;
    1380                 :            :     }
    1381                 :            :     else
    1382                 :            :     {
    1383         [ #  # ]:          0 :         SfxItemPool& rMyPool = GetPool().GetPool();
    1384         [ #  # ]:          0 :         SfxItemSet aSet( rMyPool,   pEntry->nWID, pEntry->nWID);
    1385 [ #  # ][ #  # ]:          0 :         aSet.Put( rMyPool.GetDefaultItem( pEntry->nWID ) );
    1386 [ #  # ][ #  # ]:          0 :         aRet = SvxItemPropertySet_getPropertyValue( GetStylePropertySet(), pEntry, aSet );
                 [ #  # ]
    1387                 :            :     }
    1388         [ #  # ]:          0 :     return aRet;
    1389                 :            : }
    1390                 :            : 
    1391                 :            : // --------------------------------------------------------------------
    1392                 :            : 
    1393                 :            : /** this is used because our property map is not sorted yet */
    1394                 :     108755 : const SfxItemPropertySimpleEntry* SdStyleSheet::getPropertyMapEntry( const OUString& rPropertyName ) const throw()
    1395                 :            : {
    1396                 :     108755 :     return GetStylePropertySet().getPropertyMapEntry(rPropertyName);
    1397 [ +  - ][ +  - ]:         75 : }
    1398                 :            : 
    1399                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10