LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unostyle.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 1548 2248 68.9 %
Date: 2014-04-11 Functions: 122 179 68.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <svx/svxids.hrc>
      21             : #include <hintids.hxx>
      22             : #include <osl/mutex.hxx>
      23             : #include <vcl/svapp.hxx>
      24             : #include <svl/smplhint.hxx>
      25             : #include <svtools/ctrltool.hxx>
      26             : #include <svl/style.hxx>
      27             : #include <svl/itemiter.hxx>
      28             : #include <svx/pageitem.hxx>
      29             : #include <editeng/sizeitem.hxx>
      30             : #include <editeng/ulspitem.hxx>
      31             : #include <editeng/lrspitem.hxx>
      32             : #include <editeng/boxitem.hxx>
      33             : #include <editeng/shaditem.hxx>
      34             : #include <editeng/brushitem.hxx>
      35             : #include <editeng/flstitem.hxx>
      36             : #include <editeng/paperinf.hxx>
      37             : #include <pagedesc.hxx>
      38             : #include <doc.hxx>
      39             : #include <IDocumentUndoRedo.hxx>
      40             : #include <docary.hxx>
      41             : #include <charfmt.hxx>
      42             : #include <cmdid.h>
      43             : #include <unostyle.hxx>
      44             : #include <unosett.hxx>
      45             : #include <docsh.hxx>
      46             : #include <swstyle.h>
      47             : #include <paratr.hxx>
      48             : #include <unoprnms.hxx>
      49             : #include <shellio.hxx>
      50             : #include <docstyle.hxx>
      51             : #include <unotextbodyhf.hxx>
      52             : #include <fmthdft.hxx>
      53             : #include <fmtpdsc.hxx>
      54             : #include <poolfmt.hrc>
      55             : #include <poolfmt.hxx>
      56             : #include "unoevent.hxx"
      57             : #include <fmtruby.hxx>
      58             : #include <SwStyleNameMapper.hxx>
      59             : #include <sfx2/printer.hxx>
      60             : #include <com/sun/star/style/ParagraphStyleCategory.hpp>
      61             : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      62             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      63             : #include <com/sun/star/beans/NamedValue.hpp>
      64             : #include <com/sun/star/drawing/BitmapMode.hpp>
      65             : #include <istyleaccess.hxx>
      66             : #include <GetMetricVal.hxx>
      67             : #include <fmtfsize.hxx>
      68             : #include <numrule.hxx>
      69             : 
      70             : #include <comphelper/servicehelper.hxx>
      71             : #include <cppuhelper/supportsservice.hxx>
      72             : 
      73             : //UUUU
      74             : #include <unobrushitemhelper.hxx>
      75             : #include <editeng/unoipset.hxx>
      76             : #include <editeng/memberids.hrc>
      77             : #include <svx/unoshape.hxx>
      78             : #include <svx/xflbstit.hxx>
      79             : #include <svx/xflbmtit.hxx>
      80             : 
      81             : #include <boost/shared_ptr.hpp>
      82             : 
      83             : #include "ccoll.hxx"
      84             : #include "unocore.hrc"
      85             : 
      86             : #include <cassert>
      87             : #include <set>
      88             : 
      89             : #define STYLE_FAMILY_COUNT 5            // we have 5 style families
      90             : #define TYPE_BOOL       0
      91             : #define TYPE_SIZE       1
      92             : #define TYPE_BRUSH      2
      93             : #define TYPE_ULSPACE    3
      94             : #define TYPE_SHADOW     4
      95             : #define TYPE_LRSPACE    5
      96             : #define TYPE_BOX        6
      97             : 
      98             : const unsigned short aStyleByIndex[] =
      99             : {
     100             :     SFX_STYLE_FAMILY_CHAR,
     101             :     SFX_STYLE_FAMILY_PARA,
     102             :     SFX_STYLE_FAMILY_PAGE     ,
     103             :     SFX_STYLE_FAMILY_FRAME    ,
     104             :     SFX_STYLE_FAMILY_PSEUDO
     105             : };
     106             : 
     107             : // Already implemented autostyle families: 3
     108             : #define AUTOSTYLE_FAMILY_COUNT 3
     109             : const IStyleAccess::SwAutoStyleFamily aAutoStyleByIndex[] =
     110             : {
     111             :     IStyleAccess::AUTO_STYLE_CHAR,
     112             :     IStyleAccess::AUTO_STYLE_RUBY,
     113             :     IStyleAccess::AUTO_STYLE_PARA
     114             : };
     115             : 
     116             : using namespace ::com::sun::star;
     117             : 
     118             : //convert FN_... to RES_ in header and footer itemset
     119        1052 : static sal_uInt16 lcl_ConvertFNToRES(sal_uInt16 nFNId)
     120             : {
     121        1052 :     sal_uInt16 nRes = USHRT_MAX;
     122        1052 :     switch(nFNId)
     123             :     {
     124             :         case FN_UNO_FOOTER_ON:
     125             :         case FN_UNO_HEADER_ON:
     126           4 :         break;
     127             :         case FN_UNO_FOOTER_BACKGROUND:
     128         260 :         case FN_UNO_HEADER_BACKGROUND:      nRes = RES_BACKGROUND;
     129         260 :         break;
     130             :         case FN_UNO_FOOTER_BOX:
     131         420 :         case FN_UNO_HEADER_BOX:             nRes = RES_BOX;
     132         420 :         break;
     133             :         case FN_UNO_FOOTER_LR_SPACE:
     134         104 :         case FN_UNO_HEADER_LR_SPACE:        nRes = RES_LR_SPACE;
     135         104 :         break;
     136             :         case FN_UNO_FOOTER_SHADOW:
     137          52 :         case FN_UNO_HEADER_SHADOW:          nRes = RES_SHADOW;
     138          52 :         break;
     139             :         case FN_UNO_FOOTER_BODY_DISTANCE:
     140          52 :         case FN_UNO_HEADER_BODY_DISTANCE:   nRes = RES_UL_SPACE;
     141          52 :         break;
     142             :         case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
     143          52 :         case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
     144          52 :         break;
     145             :         case FN_UNO_FOOTER_SHARE_CONTENT:
     146           4 :         case FN_UNO_HEADER_SHARE_CONTENT:   nRes = SID_ATTR_PAGE_SHARED;
     147           4 :         break;
     148           0 :         case FN_UNO_FIRST_SHARE_CONTENT:   nRes = SID_ATTR_PAGE_SHARED_FIRST;
     149           0 :         break;
     150             :         case FN_UNO_FOOTER_HEIGHT:
     151          52 :         case FN_UNO_HEADER_HEIGHT:          nRes = SID_ATTR_PAGE_SIZE;
     152          52 :         break;
     153             :         case FN_UNO_FOOTER_EAT_SPACING:
     154          52 :         case FN_UNO_HEADER_EAT_SPACING:   nRes = RES_HEADER_FOOTER_EAT_SPACING;
     155          52 :         break;
     156             :     }
     157        1052 :     return nRes;
     158             : 
     159             : }
     160             : 
     161      144139 : static SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum ( SfxStyleFamily eFamily )
     162             : {
     163      144139 :     switch ( eFamily )
     164             :     {
     165             :         case SFX_STYLE_FAMILY_CHAR:
     166       34222 :             return nsSwGetPoolIdFromName::GET_POOLID_CHRFMT;
     167             :         case SFX_STYLE_FAMILY_PARA:
     168       56870 :             return nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL;
     169             :         case SFX_STYLE_FAMILY_FRAME:
     170        3108 :             return nsSwGetPoolIdFromName::GET_POOLID_FRMFMT;
     171             :         case SFX_STYLE_FAMILY_PAGE:
     172        6955 :             return nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC;
     173             :         case SFX_STYLE_FAMILY_PSEUDO:
     174       42984 :             return nsSwGetPoolIdFromName::GET_POOLID_NUMRULE;
     175             :         default:
     176             :             OSL_ENSURE(false, "someone asking for all styles in unostyle.cxx!" );
     177           0 :             return nsSwGetPoolIdFromName::GET_POOLID_CHRFMT;
     178             :     }
     179             : }
     180             : 
     181          65 : class SwAutoStylesEnumImpl
     182             : {
     183             :     std::vector<SfxItemSet_Pointer_t> mAutoStyles;
     184             :     std::vector<SfxItemSet_Pointer_t>::iterator aIter;
     185             :     SwDoc* pDoc;
     186             :     IStyleAccess::SwAutoStyleFamily eFamily;
     187             : public:
     188             :     SwAutoStylesEnumImpl( SwDoc* pInitDoc, IStyleAccess::SwAutoStyleFamily eFam );
     189         115 :     sal_Bool hasMoreElements() { return aIter != mAutoStyles.end(); }
     190          26 :     SfxItemSet_Pointer_t nextElement() { return *(aIter++); }
     191          26 :     IStyleAccess::SwAutoStyleFamily getFamily() const { return eFamily; }
     192          26 :     SwDoc* getDoc() const { return pDoc; }
     193             : };
     194             : 
     195             : /******************************************************************
     196             :  * SwXStyleFamilies
     197             :  ******************************************************************/
     198           0 : OUString SwXStyleFamilies::getImplementationName(void) throw( uno::RuntimeException, std::exception )
     199             : {
     200           0 :     return OUString("SwXStyleFamilies");
     201             : }
     202             : 
     203           0 : sal_Bool SwXStyleFamilies::supportsService(const OUString& rServiceName) throw( uno::RuntimeException, std::exception )
     204             : {
     205           0 :     return cppu::supportsService(this, rServiceName);
     206             : }
     207             : 
     208           0 : uno::Sequence< OUString > SwXStyleFamilies::getSupportedServiceNames(void) throw( uno::RuntimeException, std::exception )
     209             : {
     210           0 :     uno::Sequence< OUString > aRet(1);
     211           0 :     OUString* pArray = aRet.getArray();
     212           0 :     pArray[0] = "com.sun.star.style.StyleFamilies";
     213           0 :     return aRet;
     214             : }
     215             : 
     216        1691 : SwXStyleFamilies::SwXStyleFamilies(SwDocShell& rDocShell) :
     217             :     SwUnoCollection(rDocShell.GetDoc()),
     218             :     pDocShell(&rDocShell),
     219             :     pxCharStyles(0),
     220             :     pxParaStyles(0),
     221             :     pxFrameStyles(0),
     222             :     pxPageStyles(0),
     223        1691 :     pxNumberingStyles(0)
     224             : {
     225             : 
     226        1691 : }
     227             : 
     228        5070 : SwXStyleFamilies::~SwXStyleFamilies()
     229             : {
     230        1690 :     delete pxCharStyles;
     231        1690 :     delete pxParaStyles;
     232        1690 :     delete pxFrameStyles;
     233        1690 :     delete pxPageStyles;
     234        1690 :     delete pxNumberingStyles;
     235        3380 : }
     236             : 
     237       19260 : uno::Any SAL_CALL SwXStyleFamilies::getByName(const OUString& Name)
     238             :     throw(
     239             :         container::NoSuchElementException,
     240             :         lang::WrappedTargetException,
     241             :         uno::RuntimeException, std::exception )
     242             : {
     243       19260 :     SolarMutexGuard aGuard;
     244             : // der Index kommt aus const unsigned short aStyleByIndex[] =
     245       19260 :     uno::Any aRet;
     246       19260 :     if(!IsValid())
     247           0 :         throw uno::RuntimeException();
     248       19260 :     if(Name.equalsAscii("CharacterStyles") )
     249        6456 :         aRet = getByIndex(0);
     250       12804 :     else if(Name.equalsAscii("ParagraphStyles") )
     251        5622 :         aRet = getByIndex(1);
     252        7182 :     else if(Name.equalsAscii("FrameStyles") )
     253        1684 :         aRet = getByIndex(3);
     254        5498 :     else if(Name.equalsAscii("PageStyles") )
     255        2036 :         aRet = getByIndex(2);
     256        3462 :     else if(Name.equalsAscii("NumberingStyles") )
     257        3461 :         aRet = getByIndex(4);
     258             :     else
     259           1 :         throw container::NoSuchElementException();
     260       19260 :     return aRet;
     261             : }
     262             : 
     263           1 : uno::Sequence< OUString > SwXStyleFamilies::getElementNames(void) throw( uno::RuntimeException, std::exception )
     264             : {
     265           1 :     uno::Sequence< OUString > aNames(STYLE_FAMILY_COUNT);
     266           1 :     OUString* pNames = aNames.getArray();
     267           1 :     pNames[0] = "CharacterStyles";
     268           1 :     pNames[1] = "ParagraphStyles";
     269           1 :     pNames[2] = "FrameStyles";
     270           1 :     pNames[3] = "PageStyles";
     271           1 :     pNames[4] = "NumberingStyles";
     272           1 :     return aNames;
     273             : }
     274             : 
     275        2883 : sal_Bool SwXStyleFamilies::hasByName(const OUString& Name) throw( uno::RuntimeException, std::exception )
     276             : {
     277        8078 :     if( Name.equalsAscii("CharacterStyles") ||
     278        3960 :         Name.equalsAscii("ParagraphStyles") ||
     279        2782 :         Name.equalsAscii("FrameStyles") ||
     280        4553 :         Name.equalsAscii("PageStyles") ||
     281         536 :         Name.equalsAscii("NumberingStyles") )
     282        2861 :         return sal_True;
     283             :     else
     284          22 :         return sal_False;
     285             : }
     286             : 
     287           1 : sal_Int32 SwXStyleFamilies::getCount(void) throw( uno::RuntimeException, std::exception )
     288             : {
     289           1 :     return STYLE_FAMILY_COUNT;
     290             : }
     291             : 
     292       19269 : uno::Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex)
     293             :     throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     294             : {
     295       19269 :     SolarMutexGuard aGuard;
     296       19269 :     uno::Any aRet;
     297       19269 :     if(nIndex < 0 || nIndex >= STYLE_FAMILY_COUNT)
     298           1 :         throw lang::IndexOutOfBoundsException();
     299       19268 :     if(IsValid())
     300             :     {
     301       19268 :         uno::Reference< container::XNameContainer >  aRef;
     302       19268 :         sal_uInt16 nType = aStyleByIndex[nIndex];
     303       19268 :         switch( nType )
     304             :         {
     305             :             case SFX_STYLE_FAMILY_CHAR:
     306             :             {
     307        6462 :                 if(!pxCharStyles)
     308             :                 {
     309        1141 :                     ((SwXStyleFamilies*)this)->pxCharStyles = new uno::Reference< container::XNameContainer > ();
     310        1141 :                     *pxCharStyles = new SwXStyleFamily(pDocShell, nType);
     311             :                 }
     312        6462 :                 aRef = *pxCharStyles;
     313             :             }
     314        6462 :             break;
     315             :             case SFX_STYLE_FAMILY_PARA:
     316             :             {
     317        5622 :                 if(!pxParaStyles)
     318             :                 {
     319        1495 :                     ((SwXStyleFamilies*)this)->pxParaStyles = new uno::Reference< container::XNameContainer > ();
     320        1495 :                     *pxParaStyles = new SwXStyleFamily(pDocShell, nType);
     321             :                 }
     322        5622 :                 aRef = *pxParaStyles;
     323             :             }
     324        5622 :             break;
     325             :             case SFX_STYLE_FAMILY_PAGE     :
     326             :             {
     327        2038 :                 if(!pxPageStyles)
     328             :                 {
     329        1334 :                     ((SwXStyleFamilies*)this)->pxPageStyles = new uno::Reference< container::XNameContainer > ();
     330        1334 :                     *pxPageStyles = new SwXStyleFamily(pDocShell, nType);
     331             :                 }
     332        2038 :                 aRef = *pxPageStyles;
     333             :             }
     334        2038 :             break;
     335             :             case SFX_STYLE_FAMILY_FRAME    :
     336             :             {
     337        1684 :                 if(!pxFrameStyles)
     338             :                 {
     339         576 :                     ((SwXStyleFamilies*)this)->pxFrameStyles = new uno::Reference< container::XNameContainer > ();
     340         576 :                     *pxFrameStyles = new SwXStyleFamily(pDocShell, nType);
     341             :                 }
     342        1684 :                 aRef = *pxFrameStyles;
     343             :             }
     344        1684 :             break;
     345             :             case SFX_STYLE_FAMILY_PSEUDO:
     346             :             {
     347        3462 :                 if(!pxNumberingStyles)
     348             :                 {
     349        1144 :                     ((SwXStyleFamilies*)this)->pxNumberingStyles = new uno::Reference< container::XNameContainer > ();
     350        1144 :                     *pxNumberingStyles = new SwXStyleFamily(pDocShell, nType);
     351             :                 }
     352        3462 :                 aRef = *pxNumberingStyles;
     353             :             }
     354        3462 :             break;
     355             :         }
     356       19268 :         aRet.setValue(&aRef, ::getCppuType((const uno::Reference<container::XNameContainer>*)0));
     357             :     }
     358             :     else
     359           0 :         throw uno::RuntimeException();
     360       19269 :     return aRet;
     361             : }
     362             : 
     363           1 : uno::Type SwXStyleFamilies::getElementType(void)
     364             :     throw( uno::RuntimeException, std::exception )
     365             : {
     366           1 :     return ::getCppuType((const uno::Reference<container::XNameContainer>*)0);
     367             : 
     368             : }
     369             : 
     370           1 : sal_Bool SwXStyleFamilies::hasElements(void) throw( uno::RuntimeException, std::exception )
     371             : {
     372           1 :     return sal_True;
     373             : }
     374             : 
     375           0 : void SwXStyleFamilies::loadStylesFromURL(const OUString& rURL,
     376             :     const uno::Sequence< beans::PropertyValue >& aOptions)
     377             :     throw (io::IOException, uno::RuntimeException,
     378             :            std::exception)
     379             : {
     380           0 :     SolarMutexGuard aGuard;
     381           0 :     sal_Bool    bLoadStyleText = sal_True;
     382           0 :     sal_Bool    bLoadStylePage = sal_True;
     383           0 :     sal_Bool    bLoadStyleOverwrite = sal_True;
     384           0 :     sal_Bool    bLoadStyleNumbering = sal_True;
     385           0 :     sal_Bool    bLoadStyleFrame = sal_True;
     386           0 :     if(IsValid() && !rURL.isEmpty())
     387             :     {
     388             :         const uno::Any* pVal;
     389           0 :         int nCount = aOptions.getLength();
     390           0 :         const beans::PropertyValue* pArray = aOptions.getConstArray();
     391           0 :         for(int i = 0; i < nCount; i++)
     392           0 :             if( ( pVal = &pArray[i].Value)->getValueType() ==
     393           0 :                     ::getBooleanCppuType() )
     394             :             {
     395           0 :                 const OUString sName = pArray[i].Name;
     396           0 :                 sal_Bool bVal = *(sal_Bool*)pVal->getValue();
     397           0 :                 if( sName == UNO_NAME_OVERWRITE_STYLES )
     398           0 :                     bLoadStyleOverwrite = bVal;
     399           0 :                 else if( sName == UNO_NAME_LOAD_NUMBERING_STYLES )
     400           0 :                     bLoadStyleNumbering = bVal;
     401           0 :                 else if( sName == UNO_NAME_LOAD_PAGE_STYLES )
     402           0 :                     bLoadStylePage = bVal;
     403           0 :                 else if( sName == UNO_NAME_LOAD_FRAME_STYLES )
     404           0 :                     bLoadStyleFrame = bVal;
     405           0 :                 else if( sName == UNO_NAME_LOAD_TEXT_STYLES )
     406           0 :                     bLoadStyleText = bVal;
     407             :             }
     408             : 
     409           0 :         SwgReaderOption aOpt;
     410           0 :         aOpt.SetFrmFmts( bLoadStyleFrame );
     411           0 :         aOpt.SetTxtFmts( bLoadStyleText );
     412           0 :         aOpt.SetPageDescs( bLoadStylePage );
     413           0 :         aOpt.SetNumRules( bLoadStyleNumbering );
     414           0 :         aOpt.SetMerge( !bLoadStyleOverwrite );
     415             : 
     416           0 :         sal_uLong nErr = pDocShell->LoadStylesFromFile( rURL, aOpt, sal_True );
     417           0 :         if( nErr )
     418           0 :             throw io::IOException();
     419             :     }
     420             :     else
     421           0 :         throw uno::RuntimeException();
     422           0 : }
     423             : 
     424           0 : uno::Sequence< beans::PropertyValue > SwXStyleFamilies::getStyleLoaderOptions(void)
     425             :         throw( uno::RuntimeException, std::exception )
     426             : {
     427           0 :     SolarMutexGuard aGuard;
     428           0 :     uno::Sequence< beans::PropertyValue > aSeq(5);
     429           0 :     beans::PropertyValue* pArray = aSeq.getArray();
     430           0 :     uno::Any aVal;
     431           0 :     sal_Bool bTemp = sal_True;
     432           0 :     aVal.setValue(&bTemp, ::getCppuBooleanType());
     433           0 :     pArray[0] = beans::PropertyValue(UNO_NAME_LOAD_TEXT_STYLES, -1, aVal, beans::PropertyState_DIRECT_VALUE);
     434           0 :     aVal.setValue(&bTemp, ::getCppuBooleanType());
     435           0 :     pArray[1] = beans::PropertyValue(UNO_NAME_LOAD_FRAME_STYLES, -1, aVal, beans::PropertyState_DIRECT_VALUE);
     436           0 :     aVal.setValue(&bTemp, ::getCppuBooleanType());
     437           0 :     pArray[2] = beans::PropertyValue(UNO_NAME_LOAD_PAGE_STYLES, -1, aVal, beans::PropertyState_DIRECT_VALUE);
     438           0 :     aVal.setValue(&bTemp, ::getCppuBooleanType());
     439           0 :     pArray[3] = beans::PropertyValue(UNO_NAME_LOAD_NUMBERING_STYLES, -1, aVal, beans::PropertyState_DIRECT_VALUE);
     440           0 :     aVal.setValue(&bTemp, ::getCppuBooleanType());
     441           0 :     pArray[4] = beans::PropertyValue(UNO_NAME_OVERWRITE_STYLES, -1, aVal, beans::PropertyState_DIRECT_VALUE);
     442           0 :     return aSeq;
     443             : }
     444             : 
     445             : /******************************************************************
     446             :  * SwXStyleFamily
     447             :  ******************************************************************/
     448           0 : OUString SwXStyleFamily::getImplementationName(void) throw( uno::RuntimeException, std::exception )
     449             : {
     450           0 :     return OUString("SwXStyleFamily");
     451             : }
     452             : 
     453           0 : sal_Bool SwXStyleFamily::supportsService(const OUString& rServiceName) throw( uno::RuntimeException, std::exception )
     454             : {
     455           0 :     return cppu::supportsService(this, rServiceName);
     456             : }
     457             : 
     458           0 : uno::Sequence< OUString > SwXStyleFamily::getSupportedServiceNames(void) throw( uno::RuntimeException, std::exception )
     459             : {
     460           0 :     uno::Sequence< OUString > aRet(1);
     461           0 :     OUString* pArray = aRet.getArray();
     462           0 :     pArray[0] = "com.sun.star.style.StyleFamily";
     463           0 :     return aRet;
     464             : }
     465             : 
     466        5690 : SwXStyleFamily::SwXStyleFamily(SwDocShell* pDocSh, sal_uInt16 nFamily) :
     467             :         eFamily((SfxStyleFamily)nFamily),
     468        5690 :         pBasePool(pDocSh->GetStyleSheetPool()),
     469       11380 :         pDocShell(pDocSh)
     470             : {
     471        5690 :     StartListening(*pBasePool);
     472        5690 : }
     473             : 
     474       11366 : SwXStyleFamily::~SwXStyleFamily()
     475             : {
     476             : 
     477       11366 : }
     478             : 
     479          81 : static sal_Int32 lcl_GetCountOrName(const SwDoc &rDoc,
     480             :     SfxStyleFamily eFamily, OUString *pString, sal_uInt16 nIndex = USHRT_MAX)
     481             : {
     482          81 :     sal_Int32 nCount = 0;
     483          81 :     switch( eFamily )
     484             :     {
     485             :         case SFX_STYLE_FAMILY_CHAR:
     486             :         {
     487             :             sal_uInt16 nBaseCount =  RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN  +
     488           3 :                                      RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN;
     489           3 :             nIndex = nIndex - nBaseCount;
     490           3 :             const sal_uInt16 nArrLen = rDoc.GetCharFmts()->size();
     491           8 :             for( sal_uInt16 i = 0; i < nArrLen; i++ )
     492             :             {
     493           6 :                 SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ];
     494           6 :                 if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() )
     495           0 :                     continue;
     496           6 :                 if ( IsPoolUserFmt ( pFmt->GetPoolFmtId() ) )
     497             :                 {
     498           6 :                     if ( nIndex == nCount )
     499             :                     {
     500             :                         // the default character format needs to be set to "Default!"
     501           1 :                         if(rDoc.GetDfltCharFmt() == pFmt)
     502             :                             SwStyleNameMapper::FillUIName(
     503           0 :                                 RES_POOLCOLL_STANDARD, *pString );
     504             :                         else
     505           1 :                             *pString = pFmt->GetName();
     506           1 :                         break;
     507             :                     }
     508           5 :                     nCount++;
     509             :                 }
     510             :             }
     511           3 :             nCount += nBaseCount;
     512             :         }
     513           3 :         break;
     514             :         case SFX_STYLE_FAMILY_PARA:
     515             :         {
     516             :             sal_uInt16 nBaseCount = RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN +
     517             :                                     RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
     518             :                                     RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
     519             :                                     RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
     520             :                                     RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
     521           0 :                                     RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN;
     522           0 :             nIndex = nIndex - nBaseCount;
     523           0 :             const sal_uInt16 nArrLen = rDoc.GetTxtFmtColls()->size();
     524           0 :             for ( sal_uInt16 i = 0; i < nArrLen; i++ )
     525             :             {
     526           0 :                 SwTxtFmtColl * pColl = (*rDoc.GetTxtFmtColls())[i];
     527           0 :                 if ( pColl->IsDefault() )
     528           0 :                     continue;
     529           0 :                 if ( IsPoolUserFmt ( pColl->GetPoolFmtId() ) )
     530             :                 {
     531           0 :                     if ( nIndex == nCount )
     532             :                     {
     533           0 :                         *pString = pColl->GetName();
     534           0 :                         break;
     535             :                     }
     536           0 :                     nCount++;
     537             :                 }
     538             :             }
     539           0 :             nCount += nBaseCount;
     540             :         }
     541           0 :         break;
     542             :         case SFX_STYLE_FAMILY_FRAME:
     543             :         {
     544           0 :             sal_uInt16 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN;
     545           0 :             nIndex = nIndex - nBaseCount;
     546           0 :             const sal_uInt16 nArrLen = rDoc.GetFrmFmts()->size();
     547           0 :             for( sal_uInt16 i = 0; i < nArrLen; i++ )
     548             :             {
     549           0 :                 SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ];
     550           0 :                 if(pFmt->IsDefault() || pFmt->IsAuto())
     551           0 :                     continue;
     552           0 :                 if ( IsPoolUserFmt ( pFmt->GetPoolFmtId() ) )
     553             :                 {
     554           0 :                     if ( nIndex == nCount )
     555             :                     {
     556           0 :                         *pString = pFmt->GetName();
     557           0 :                         break;
     558             :                     }
     559           0 :                     nCount++;
     560             :                 }
     561             :             }
     562           0 :             nCount += nBaseCount;
     563             :         }
     564           0 :         break;
     565             :         case SFX_STYLE_FAMILY_PAGE:
     566             :         {
     567          15 :             sal_uInt16 nBaseCount = RES_POOLPAGE_END - RES_POOLPAGE_BEGIN;
     568          15 :             nIndex = nIndex - nBaseCount;
     569          15 :             const sal_uInt16 nArrLen = rDoc.GetPageDescCnt();
     570         192 :             for(sal_uInt16 i = 0; i < nArrLen; ++i)
     571             :             {
     572         179 :                 const SwPageDesc& rDesc = rDoc.GetPageDesc(i);
     573             : 
     574         179 :                 if ( IsPoolUserFmt ( rDesc.GetPoolFmtId() ) )
     575             :                 {
     576          29 :                     if ( nIndex == nCount )
     577             :                     {
     578           2 :                         *pString = rDesc.GetName();
     579           2 :                         break;
     580             :                     }
     581          27 :                     nCount++;
     582             :                 }
     583             :             }
     584          15 :             nCount += nBaseCount;
     585             :         }
     586          15 :         break;
     587             :         case SFX_STYLE_FAMILY_PSEUDO:
     588             :         {
     589          63 :             sal_uInt16 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN;
     590          63 :             nIndex = nIndex - nBaseCount;
     591          63 :             const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl();
     592         510 :             for(sal_uInt16 i = 0; i < rNumTbl.size(); ++i)
     593             :             {
     594         489 :                 const SwNumRule& rRule = *rNumTbl[ i ];
     595         489 :                 if( rRule.IsAutoRule() )
     596          63 :                     continue;
     597         426 :                 if ( IsPoolUserFmt ( rRule.GetPoolFmtId() ) )
     598             :                 {
     599         426 :                     if ( nIndex == nCount )
     600             :                     {
     601          42 :                         *pString = rRule.GetName();
     602          42 :                         break;
     603             :                     }
     604         384 :                     nCount++;
     605             :                 }
     606             :             }
     607          63 :             nCount += nBaseCount;
     608             :         }
     609          63 :         break;
     610             : 
     611             :         default:
     612             :             ;
     613             :     }
     614          81 :     return nCount;
     615             : }
     616             : 
     617          35 : sal_Int32 SwXStyleFamily::getCount(void) throw( uno::RuntimeException, std::exception )
     618             : {
     619          35 :     SolarMutexGuard aGuard;
     620          35 :     return lcl_GetCountOrName ( *pDocShell->GetDoc(), eFamily, NULL );
     621             : }
     622             : 
     623         278 : uno::Any SwXStyleFamily::getByIndex(sal_Int32 nTempIndex)
     624             :     throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     625             : {
     626         278 :     SolarMutexGuard aGuard;
     627         278 :     uno::Any aRet;
     628         278 :     if ( nTempIndex >= 0 && nTempIndex < USHRT_MAX )
     629             :     {
     630         278 :         sal_uInt16 nIndex = static_cast < sal_uInt16 > ( nTempIndex );
     631         278 :         if(pBasePool)
     632             :         {
     633         278 :             OUString sStyleName;
     634         278 :             switch( eFamily )
     635             :             {
     636             :                 case SFX_STYLE_FAMILY_CHAR:
     637             :                 {
     638           8 :                     if ( nIndex < ( RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN ) )
     639           6 :                         SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCHR_NORMAL_BEGIN + nIndex), sStyleName );
     640           2 :                     else if ( nIndex < ( RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN  +
     641             :                                          RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN ) )
     642             :                         SwStyleNameMapper::FillUIName ( RES_POOLCHR_HTML_BEGIN
     643             :                                                         - RES_POOLCHR_NORMAL_END + RES_POOLCHR_NORMAL_BEGIN
     644           0 :                                                         + nIndex, sStyleName );
     645             :                 }
     646           8 :                 break;
     647             :                 case SFX_STYLE_FAMILY_PARA:
     648             :                 {
     649           3 :                     if ( nIndex < ( RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
     650           3 :                         SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCOLL_TEXT_BEGIN + nIndex), sStyleName );
     651           0 :                     else if ( nIndex < ( RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
     652             :                                          RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN ) )
     653             :                         SwStyleNameMapper::FillUIName ( RES_POOLCOLL_LISTS_BEGIN
     654             :                                                         - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
     655           0 :                                                         + nIndex, sStyleName );
     656           0 :                     else if ( nIndex < ( RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
     657             :                                          RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
     658             :                                          RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN ) )
     659             :                         SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCOLL_EXTRA_BEGIN
     660             :                                                          - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
     661             :                                                          - RES_POOLCOLL_TEXT_END  + RES_POOLCOLL_TEXT_BEGIN
     662           0 :                                                          + nIndex), sStyleName );
     663           0 :                     else if ( nIndex < ( RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
     664             :                                          RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
     665             :                                          RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
     666             :                                          RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN ) )
     667             :                         SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCOLL_REGISTER_BEGIN
     668             :                                                          - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
     669             :                                                          - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
     670             :                                                          - RES_POOLCOLL_TEXT_END  + RES_POOLCOLL_TEXT_BEGIN
     671           0 :                                                          + nIndex), sStyleName );
     672           0 :                     else if ( nIndex < ( RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
     673             :                                          RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
     674             :                                          RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
     675             :                                          RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
     676             :                                          RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN ) )
     677             :                         SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCOLL_DOC_BEGIN
     678             :                                                          - RES_POOLCOLL_REGISTER_END + RES_POOLCOLL_REGISTER_BEGIN
     679             :                                                          - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
     680             :                                                          - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
     681             :                                                          - RES_POOLCOLL_TEXT_END  + RES_POOLCOLL_TEXT_BEGIN
     682           0 :                                                          + nIndex), sStyleName );
     683           0 :                     else if ( nIndex < ( RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN +
     684             :                                          RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
     685             :                                          RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
     686             :                                          RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
     687             :                                          RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
     688             :                                          RES_POOLCOLL_TEXT_END  - RES_POOLCOLL_TEXT_BEGIN ) )
     689             :                         SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLCOLL_HTML_BEGIN
     690             :                                                          - RES_POOLCOLL_DOC_END + RES_POOLCOLL_DOC_BEGIN
     691             :                                                          - RES_POOLCOLL_REGISTER_END + RES_POOLCOLL_REGISTER_BEGIN
     692             :                                                          - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
     693             :                                                          - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
     694             :                                                          - RES_POOLCOLL_TEXT_END  + RES_POOLCOLL_TEXT_BEGIN
     695           0 :                                                          + nIndex), sStyleName );
     696             :                 }
     697           3 :                 break;
     698             :                 case SFX_STYLE_FAMILY_FRAME:
     699             :                 {
     700           0 :                     if ( nIndex < ( RES_POOLFRM_END - RES_POOLFRM_BEGIN ) )
     701             :                     {
     702           0 :                         SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLFRM_BEGIN + nIndex), sStyleName );
     703             :                     }
     704             :                 }
     705           0 :                 break;
     706             :                 case SFX_STYLE_FAMILY_PAGE:
     707             :                 {
     708          14 :                     if ( nIndex < ( RES_POOLPAGE_END - RES_POOLPAGE_BEGIN ) )
     709             :                     {
     710          12 :                         SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + nIndex), sStyleName );
     711             :                     }
     712             :                 }
     713          14 :                 break;
     714             :                 case SFX_STYLE_FAMILY_PSEUDO:
     715             :                 {
     716         253 :                     if ( nIndex < ( RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN ) )
     717             :                     {
     718         211 :                         SwStyleNameMapper::FillUIName ( static_cast< sal_uInt16 >(RES_POOLNUMRULE_BEGIN + nIndex), sStyleName );
     719             :                     }
     720             :                 }
     721         253 :                 break;
     722             : 
     723             :                 default:
     724             :                     ;
     725             :             }
     726         278 :             if (sStyleName.isEmpty())
     727          46 :                 lcl_GetCountOrName ( *pDocShell->GetDoc(), eFamily, &sStyleName, nIndex );
     728             : 
     729         278 :             if (!sStyleName.isEmpty())
     730             :             {
     731         277 :                 SfxStyleSheetBase* pBase = pBasePool->Find( sStyleName, eFamily );
     732         277 :                 if(pBase)
     733             :                 {
     734         277 :                     uno::Reference< style::XStyle >  xStyle = _FindStyle(sStyleName);
     735         277 :                     if(!xStyle.is())
     736             :                     {
     737        1076 :                         xStyle = eFamily == SFX_STYLE_FAMILY_PAGE ?
     738          14 :                             new SwXPageStyle(*pBasePool, pDocShell, eFamily, sStyleName) :
     739         262 :                                 eFamily == SFX_STYLE_FAMILY_FRAME ?
     740           0 :                                 new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), pBase->GetName()):
     741         800 :                                     new SwXStyle(*pBasePool, eFamily, pDocShell->GetDoc(), sStyleName);
     742             :                     }
     743         277 :                     aRet.setValue(&xStyle, ::getCppuType((uno::Reference<style::XStyle>*)0));
     744             :                 }
     745             :                 else
     746           0 :                     throw container::NoSuchElementException();
     747             :             }
     748             :             else
     749           1 :                 throw lang::IndexOutOfBoundsException();
     750             :         }
     751             :         else
     752           0 :             throw uno::RuntimeException();
     753             :     }
     754             :     else
     755           0 :         throw lang::IndexOutOfBoundsException();
     756             : 
     757         278 :     return aRet;
     758             : }
     759             : 
     760       41811 : uno::Any SwXStyleFamily::getByName(const OUString& rName)
     761             :     throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     762             : {
     763       41811 :     SolarMutexGuard aGuard;
     764       41811 :     uno::Any aRet;
     765       83622 :     OUString sStyleName;
     766       41811 :     SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), true );
     767       41811 :     if(pBasePool)
     768             :     {
     769       41811 :         pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
     770       41811 :         SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
     771       41811 :         if(pBase)
     772             :         {
     773       41712 :             uno::Reference< style::XStyle >  xStyle = _FindStyle(sStyleName);
     774       41712 :             if(!xStyle.is())
     775             :             {
     776       92086 :                 xStyle = eFamily == SFX_STYLE_FAMILY_PAGE ?
     777        3122 :                     new SwXPageStyle(*pBasePool, pDocShell, eFamily, sStyleName) :
     778       21118 :                         eFamily == SFX_STYLE_FAMILY_FRAME ?
     779        4110 :                         new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), pBase->GetName()):
     780       63736 :                             new SwXStyle(*pBasePool, eFamily, pDocShell->GetDoc(), sStyleName);
     781             :             }
     782       41712 :             aRet.setValue(&xStyle, ::getCppuType((uno::Reference<style::XStyle>*)0));
     783             :         }
     784             :         else
     785          99 :             throw container::NoSuchElementException();
     786             :     }
     787             :     else
     788           0 :         throw uno::RuntimeException();
     789       83523 :     return aRet;
     790             : 
     791             : }
     792             : 
     793         583 : uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::RuntimeException, std::exception )
     794             : {
     795         583 :     SolarMutexGuard aGuard;
     796         583 :     uno::Sequence< OUString > aRet;
     797         583 :     if(pBasePool)
     798             :     {
     799         583 :         SfxStyleSheetIteratorPtr pIterator = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL);
     800         583 :         sal_uInt16 nCount = pIterator->Count();
     801         583 :         aRet.realloc(nCount);
     802         583 :         OUString* pArray = aRet.getArray();
     803        1166 :         OUString aString;
     804       22817 :         for(sal_uInt16 i = 0; i < nCount; i++)
     805             :         {
     806       22234 :             SwStyleNameMapper::FillProgName((*pIterator)[i]->GetName(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true );
     807       22234 :             pArray[i] = aString;
     808         583 :         }
     809             :     }
     810             :     else
     811           0 :         throw uno::RuntimeException();
     812         583 :     return aRet;
     813             : }
     814             : 
     815       32655 : sal_Bool SwXStyleFamily::hasByName(const OUString& rName) throw( uno::RuntimeException, std::exception )
     816             : {
     817       32655 :     SolarMutexGuard aGuard;
     818       32655 :     sal_Bool bRet = sal_False;
     819       32655 :     if(pBasePool)
     820             :     {
     821       32655 :         OUString sStyleName;
     822       32655 :         SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), true );
     823       32655 :         pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
     824       32655 :         SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
     825       32655 :         bRet = 0 != pBase;
     826             :     }
     827             :     else
     828           0 :         throw uno::RuntimeException();
     829       32655 :     return bRet;
     830             : 
     831             : }
     832             : 
     833           1 : uno::Type SwXStyleFamily::getElementType(void) throw( uno::RuntimeException, std::exception )
     834             : {
     835           1 :     return ::getCppuType((const uno::Reference<style::XStyle>*)0);
     836             : 
     837             : }
     838             : 
     839           1 : sal_Bool SwXStyleFamily::hasElements(void) throw( uno::RuntimeException, std::exception )
     840             : {
     841           1 :     if(!pBasePool)
     842           0 :         throw uno::RuntimeException();
     843           1 :     return sal_True;
     844             : }
     845             : 
     846       23332 : void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement)
     847             :         throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     848             : {
     849       23332 :     SolarMutexGuard aGuard;
     850       23332 :     if(pBasePool)
     851             :     {
     852       23332 :         OUString sStyleName;
     853       23332 :         SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), true);
     854       23332 :         pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
     855       23332 :         SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
     856       23332 :         SfxStyleSheetBase* pUINameBase = pBasePool->Find( sStyleName );
     857       23332 :         if(pBase || pUINameBase)
     858           1 :             throw container::ElementExistException();
     859             :         else
     860             :         {
     861       23331 :             if(rElement.getValueType().getTypeClass() ==
     862             :                                             uno::TypeClass_INTERFACE)
     863             :             {
     864             :                 uno::Reference< uno::XInterface > * pxRef =
     865       23331 :                     (uno::Reference< uno::XInterface > *)rElement.getValue();
     866             : 
     867       23331 :                 uno::Reference<lang::XUnoTunnel> xStyleTunnel( *pxRef, uno::UNO_QUERY);
     868             : 
     869       23331 :                 SwXStyle* pNewStyle = 0;
     870       23331 :                 if(xStyleTunnel.is())
     871             :                 {
     872             :                     pNewStyle = reinterpret_cast< SwXStyle * >(
     873       23330 :                             sal::static_int_cast< sal_IntPtr >( xStyleTunnel->getSomething( SwXStyle::getUnoTunnelId()) ));
     874             :                 }
     875             : 
     876       23331 :                 if (!pNewStyle || !pNewStyle->IsDescriptor() || pNewStyle->GetFamily() != eFamily)
     877           1 :                     throw lang::IllegalArgumentException();
     878             : 
     879       23330 :                 sal_uInt16 nMask = SFXSTYLEBIT_ALL;
     880       23330 :                 if(eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional())
     881        3564 :                     nMask &= ~SWSTYLEBIT_CONDCOLL;
     882             : #if OSL_DEBUG_LEVEL > 1
     883             :                 SfxStyleSheetBase& rNewBase =
     884             : #endif
     885       23330 :                 pBasePool->Make(sStyleName, eFamily, nMask);
     886       23330 :                 pNewStyle->SetDoc(pDocShell->GetDoc(), pBasePool);
     887       23330 :                 pNewStyle->SetStyleName(sStyleName);
     888       46660 :                 const OUString sParentStyleName(pNewStyle->GetParentStyleName());
     889       23330 :                 if (!sParentStyleName.isEmpty())
     890             :                 {
     891        5662 :                     pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
     892        5662 :                     SfxStyleSheetBase* pParentBase = pBasePool->Find(sParentStyleName);
     893       11292 :                     if(pParentBase && pParentBase->GetFamily() == eFamily &&
     894        5630 :                         &pParentBase->GetPool() == pBasePool)
     895        5630 :                         pBasePool->SetParent( eFamily, sStyleName, sParentStyleName );
     896             : 
     897             :                 }
     898             : #if OSL_DEBUG_LEVEL > 1
     899             :                 (void)rNewBase;
     900             : #endif
     901             :                 //so, jetzt sollten noch die Properties des Descriptors angewandt werden
     902       46661 :                 pNewStyle->ApplyDescriptorProperties();
     903             :             }
     904             :             else
     905           0 :                 throw lang::IllegalArgumentException();
     906       23332 :         }
     907             :     }
     908             :     else
     909           0 :         throw uno::RuntimeException();
     910       23330 : }
     911             : 
     912           0 : void SwXStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement)
     913             :     throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     914             : {
     915           0 :     SolarMutexGuard aGuard;
     916           0 :     if(pBasePool)
     917             :     {
     918           0 :         pBasePool->SetSearchMask(eFamily);
     919           0 :         SfxStyleSheetBase* pBase = pBasePool->Find(rName);
     920             :         //Ersetzung geht nur fuer benutzerdefinierte Styles
     921           0 :         if(!pBase)
     922           0 :             throw container::NoSuchElementException();
     923           0 :         if(!pBase->IsUserDefined())
     924           0 :             throw lang::IllegalArgumentException();
     925             :         //if theres an object available to this style then it must be invalidated
     926           0 :         uno::Reference< style::XStyle >  xStyle = _FindStyle(pBase->GetName());
     927           0 :         if(xStyle.is())
     928             :         {
     929           0 :             uno::Reference<lang::XUnoTunnel> xTunnel( xStyle, uno::UNO_QUERY);
     930           0 :             if(xTunnel.is())
     931             :             {
     932             :                 SwXStyle* pStyle = reinterpret_cast< SwXStyle * >(
     933           0 :                         sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( SwXStyle::getUnoTunnelId()) ));
     934           0 :                 pStyle->Invalidate();
     935           0 :             }
     936             :         }
     937             : 
     938           0 :         pBasePool->Remove(pBase);
     939           0 :         insertByName(rName, rElement);
     940             :     }
     941             :     else
     942           0 :         throw uno::RuntimeException();
     943           0 : }
     944             : 
     945           2 : void SwXStyleFamily::removeByName(const OUString& rName) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     946             : {
     947           2 :     SolarMutexGuard aGuard;
     948           2 :     if(pBasePool)
     949             :     {
     950           2 :         pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
     951           2 :         OUString aString;
     952           2 :         SwStyleNameMapper::FillUIName(rName, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true );
     953             : 
     954           2 :         SfxStyleSheetBase* pBase = pBasePool->Find( aString );
     955           2 :         if(pBase)
     956           1 :             pBasePool->Remove(pBase);
     957             :         else
     958           1 :             throw container::NoSuchElementException();
     959             :     }
     960             :     else
     961           0 :         throw uno::RuntimeException();
     962           1 : }
     963             : 
     964           0 : uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXStyleFamily::getPropertySetInfo(  ) throw (uno::RuntimeException, std::exception)
     965             : {
     966           0 :     return uno::Reference< beans::XPropertySetInfo >();
     967             : }
     968             : 
     969           0 : void SAL_CALL SwXStyleFamily::setPropertyValue( const OUString&, const uno::Any& ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     970             : {
     971             :     OSL_FAIL( "###unexpected!" );
     972           0 : }
     973             : 
     974           0 : uno::Any SAL_CALL SwXStyleFamily::getPropertyValue( const OUString& sPropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
     975             : {
     976           0 :     uno::Any aRet;
     977             : 
     978           0 :     if ( sPropertyName == "DisplayName" )
     979             :     {
     980           0 :         SolarMutexGuard aGuard;
     981           0 :         sal_uInt32 nResId = 0;
     982           0 :         switch ( eFamily )
     983             :         {
     984             :             case SFX_STYLE_FAMILY_CHAR:
     985           0 :                 nResId = STR_STYLE_FAMILY_CHARACTER; break;
     986             :             case SFX_STYLE_FAMILY_PARA:
     987           0 :                 nResId = STR_STYLE_FAMILY_PARAGRAPH; break;
     988             :             case SFX_STYLE_FAMILY_FRAME:
     989           0 :                 nResId = STR_STYLE_FAMILY_FRAME; break;
     990             :             case SFX_STYLE_FAMILY_PAGE:
     991           0 :                 nResId = STR_STYLE_FAMILY_PAGE; break;
     992             :             case SFX_STYLE_FAMILY_PSEUDO:
     993           0 :                 nResId = STR_STYLE_FAMILY_NUMBERING; break;
     994             :             default:
     995             :                 OSL_FAIL( "SwXStyleFamily::getPropertyValue(): invalid family" );
     996             :         }
     997           0 :         if ( nResId > 0 )
     998             :         {
     999           0 :             aRet = uno::makeAny( SW_RESSTR( nResId ) );
    1000           0 :         }
    1001             :     }
    1002             :     else
    1003             :     {
    1004           0 :         throw beans::UnknownPropertyException( OUString("unknown property: ") + sPropertyName, static_cast<OWeakObject *>(this) );
    1005             :     }
    1006             : 
    1007           0 :     return aRet;
    1008             : }
    1009             : 
    1010           0 : void SAL_CALL SwXStyleFamily::addPropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    1011             : {
    1012             :     OSL_FAIL( "###unexpected!" );
    1013           0 : }
    1014             : 
    1015           0 : void SAL_CALL SwXStyleFamily::removePropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    1016             : {
    1017             :     OSL_FAIL( "###unexpected!" );
    1018           0 : }
    1019             : 
    1020           0 : void SAL_CALL SwXStyleFamily::addVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    1021             : {
    1022             :     OSL_FAIL( "###unexpected!" );
    1023           0 : }
    1024             : 
    1025           0 : void SAL_CALL SwXStyleFamily::removeVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    1026             : {
    1027             :     OSL_FAIL( "###unexpected!" );
    1028           0 : }
    1029             : 
    1030      116150 : void SwXStyleFamily::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
    1031             : {
    1032      116150 :     SfxSimpleHint *pHint = PTR_CAST( SfxSimpleHint, &rHint );
    1033      116150 :     if( pHint && ( pHint->GetId() & SFX_HINT_DYING ) )
    1034             :     {
    1035          34 :         pBasePool = 0;
    1036          34 :         pDocShell = 0;
    1037          34 :         EndListening(rBC);
    1038             :     }
    1039      116150 : }
    1040             : 
    1041       41989 : SwXStyle*   SwXStyleFamily::_FindStyle(const OUString& rStyleName)const
    1042             : {
    1043       41989 :     sal_uInt16  nLCount = pBasePool->GetListenerCount();
    1044       41989 :     SfxListener* pListener = 0;
    1045      289083 :     for( sal_uInt16 i = 0; i < nLCount; i++)
    1046             :     {
    1047      264567 :         pListener = pBasePool->GetListener( i );
    1048      264567 :         SwXStyle* pTempStyle = dynamic_cast<SwXStyle*>( pListener );
    1049      264567 :         if(pTempStyle && pTempStyle->GetFamily() == eFamily && pTempStyle->GetStyleName() == rStyleName)
    1050             :         {
    1051       17473 :             return pTempStyle;
    1052             :         }
    1053             :     }
    1054       24516 :     return 0;
    1055             : }
    1056             : 
    1057             : class SwStyleProperties_Impl
    1058             : {
    1059             :     const PropertyEntryVector_t aPropertyEntries;
    1060             :     uno::Any**                  pAnyArr;
    1061             :     sal_uInt32                  nArrLen;
    1062             : 
    1063             : public:
    1064             :     SwStyleProperties_Impl(const SfxItemPropertyMap& rMap);
    1065             :     ~SwStyleProperties_Impl();
    1066             : 
    1067             :     sal_Bool    SetProperty(const OUString& rName, uno::Any aVal);
    1068             :     sal_Bool    GetProperty(const OUString& rName, uno::Any*& rpAny);
    1069             :     sal_Bool    ClearProperty( const OUString& rPropertyName );
    1070             :     void    ClearAllProperties( );
    1071             :     void        GetProperty(const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any& rAny );
    1072             : 
    1073       23330 :     const PropertyEntryVector_t& GetPropertyVector() const {return aPropertyEntries; }
    1074             : 
    1075             : };
    1076             : 
    1077       23332 : SwStyleProperties_Impl::SwStyleProperties_Impl(const SfxItemPropertyMap& rMap) :
    1078             :     aPropertyEntries( rMap.getPropertyEntries() ),
    1079       23332 :     nArrLen(0)
    1080             : {
    1081       23332 :     nArrLen = aPropertyEntries.size();
    1082             : 
    1083       23332 :     pAnyArr = new uno::Any* [nArrLen];
    1084     1010191 :     for ( sal_uInt32 i =0 ; i < nArrLen; i++ )
    1085      986859 :         pAnyArr[i] = 0;
    1086       23332 : }
    1087             : 
    1088       46626 : SwStyleProperties_Impl::~SwStyleProperties_Impl()
    1089             : {
    1090     1008348 :     for ( sal_uInt16 i =0 ; i < nArrLen; i++ )
    1091      985035 :         delete pAnyArr[i];
    1092       23313 :     delete[] pAnyArr;
    1093       23313 : }
    1094             : 
    1095       42460 : sal_Bool SwStyleProperties_Impl::SetProperty(const OUString& rName, uno::Any aVal)
    1096             : {
    1097       42460 :     sal_uInt16 nPos = 0;
    1098       42460 :     sal_Bool bRet = sal_False;
    1099       42460 :     PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
    1100     2907239 :     while( aIt != aPropertyEntries.end() )
    1101             :     {
    1102     2864779 :         if(rName == aIt->sName)
    1103             :         {
    1104       42460 :             delete pAnyArr[nPos];
    1105       42460 :             pAnyArr[nPos] = new uno::Any ( aVal );
    1106       42460 :             bRet = sal_True;
    1107       42460 :             break;
    1108             :         }
    1109     2822319 :         ++nPos;
    1110     2822319 :         ++aIt;
    1111             :     }
    1112       42460 :     return bRet;
    1113             : }
    1114             : 
    1115           0 : sal_Bool SwStyleProperties_Impl::ClearProperty( const OUString& rName )
    1116             : {
    1117           0 :     sal_Bool bRet = sal_False;
    1118           0 :     sal_uInt16 nPos = 0;
    1119           0 :     PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
    1120           0 :     while( aIt != aPropertyEntries.end() )
    1121             :     {
    1122           0 :         if( rName == aIt->sName )
    1123             :         {
    1124           0 :             delete pAnyArr[nPos];
    1125           0 :             pAnyArr[ nPos ] = 0;
    1126           0 :             bRet = sal_True;
    1127           0 :             break;
    1128             :         }
    1129           0 :         ++nPos;
    1130           0 :         ++aIt;
    1131             :     }
    1132           0 :     return bRet;
    1133             : }
    1134             : 
    1135           0 : void SwStyleProperties_Impl::ClearAllProperties( )
    1136             : {
    1137           0 :     for ( sal_uInt16 i = 0; i < nArrLen; i++ )
    1138             :     {
    1139           0 :         delete pAnyArr[i];
    1140           0 :         pAnyArr[ i ] = 0;
    1141             :     }
    1142           0 : }
    1143             : 
    1144      986697 : sal_Bool SwStyleProperties_Impl::GetProperty(const OUString& rName, uno::Any*& rpAny )
    1145             : {
    1146      986697 :     sal_Bool bRet = sal_False;
    1147      986697 :     sal_uInt16 nPos = 0;
    1148      986697 :     PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
    1149    54498608 :     while( aIt != aPropertyEntries.end() )
    1150             :     {
    1151    53511911 :         if( rName == aIt->sName )
    1152             :         {
    1153      986697 :             rpAny = pAnyArr[nPos];
    1154      986697 :             bRet = sal_True;
    1155      986697 :             break;
    1156             :         }
    1157    52525214 :         ++nPos;
    1158    52525214 :         ++aIt;
    1159             :     }
    1160             : 
    1161      986697 :     return bRet;
    1162             : }
    1163             : 
    1164           0 : void SwStyleProperties_Impl::GetProperty( const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any & rAny )
    1165             : {
    1166           0 :     rAny = rxPropertySet->getPropertyValue( rPropertyName );
    1167           0 : }
    1168             : 
    1169             : namespace
    1170             : {
    1171             :     class theSwXStyleUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXStyleUnoTunnelId > {};
    1172             : }
    1173             : 
    1174       47138 : const uno::Sequence< sal_Int8 > & SwXStyle::getUnoTunnelId()
    1175             : {
    1176       47138 :     return theSwXStyleUnoTunnelId::get().getSeq();
    1177             : }
    1178             : 
    1179       23569 : sal_Int64 SAL_CALL SwXStyle::getSomething( const uno::Sequence< sal_Int8 >& rId )
    1180             :     throw(uno::RuntimeException, std::exception)
    1181             : {
    1182       47138 :     if( rId.getLength() == 16
    1183       70707 :         && 0 == memcmp( getUnoTunnelId().getConstArray(),
    1184       47138 :                                         rId.getConstArray(), 16 ) )
    1185             :     {
    1186       23569 :         return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
    1187             :     }
    1188           0 :     return 0;
    1189             : }
    1190             : 
    1191          96 : TYPEINIT1(SwXStyle, SfxListener);
    1192             : 
    1193           0 : OUString SwXStyle::getImplementationName(void) throw( uno::RuntimeException, std::exception )
    1194             : {
    1195           0 :     return OUString("SwXStyle");
    1196             : }
    1197             : 
    1198          13 : sal_Bool SwXStyle::supportsService(const OUString& rServiceName) throw( uno::RuntimeException, std::exception )
    1199             : {
    1200          13 :     return cppu::supportsService(this, rServiceName);
    1201             : }
    1202             : 
    1203          13 : uno::Sequence< OUString > SwXStyle::getSupportedServiceNames(void) throw( uno::RuntimeException, std::exception )
    1204             : {
    1205          13 :     long nCount = 1;
    1206          13 :     if(SFX_STYLE_FAMILY_PARA == eFamily)
    1207             :     {
    1208           8 :         nCount = 5;
    1209           8 :         if(bIsConditional)
    1210           4 :             nCount++;
    1211             :     }
    1212           5 :     else if(SFX_STYLE_FAMILY_CHAR == eFamily)
    1213           4 :         nCount = 5;
    1214           1 :     else if(SFX_STYLE_FAMILY_PAGE == eFamily)
    1215           1 :         nCount = 3;
    1216          13 :     uno::Sequence< OUString > aRet(nCount);
    1217          13 :     OUString* pArray = aRet.getArray();
    1218          13 :     pArray[0] = "com.sun.star.style.Style";
    1219          13 :     switch(eFamily)
    1220             :     {
    1221             :         case SFX_STYLE_FAMILY_CHAR:
    1222           4 :             pArray[1] = "com.sun.star.style.CharacterStyle";
    1223           4 :             pArray[2] = "com.sun.star.style.CharacterProperties";
    1224           4 :             pArray[3] = "com.sun.star.style.CharacterPropertiesAsian";
    1225           4 :             pArray[4] = "com.sun.star.style.CharacterPropertiesComplex";
    1226           4 :         break;
    1227             :         case SFX_STYLE_FAMILY_PAGE:
    1228           1 :             pArray[1] = "com.sun.star.style.PageStyle";
    1229           1 :             pArray[2] = "com.sun.star.style.PageProperties";
    1230           1 :         break;
    1231             :         case SFX_STYLE_FAMILY_PARA:
    1232           8 :             pArray[1] = "com.sun.star.style.ParagraphStyle";
    1233           8 :             pArray[2] = "com.sun.star.style.ParagraphProperties";
    1234           8 :             pArray[3] = "com.sun.star.style.ParagraphPropertiesAsian";
    1235           8 :             pArray[4] = "com.sun.star.style.ParagraphPropertiesComplex";
    1236           8 :         if(bIsConditional)
    1237           4 :             pArray[5] = "com.sun.star.style.ConditionalParagraphStyle";
    1238           8 :         break;
    1239             : 
    1240             :         default:
    1241             :             ;
    1242             :     }
    1243          13 :     return aRet;
    1244             : }
    1245             : 
    1246       23332 : SwXStyle::SwXStyle( SwDoc *pDoc, SfxStyleFamily eFam, sal_Bool bConditional) :
    1247             :     m_pDoc( pDoc ),
    1248             :     pBasePool(0),
    1249             :     eFamily(eFam),
    1250             :     bIsDescriptor(sal_True),
    1251       23332 :     bIsConditional(bConditional)
    1252             : {
    1253             :     // Register ourselves as a listener to the document (via the page descriptor)
    1254       23332 :     pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
    1255             :     // get the property set for the default style data
    1256             :     // First get the model
    1257       23332 :     uno::Reference < frame::XModel > xModel = pDoc->GetDocShell()->GetBaseModel();
    1258             :     // Ask the model for it's family supplier interface
    1259       46664 :     uno::Reference < style::XStyleFamiliesSupplier > xFamilySupplier ( xModel, uno::UNO_QUERY );
    1260             :     // Get the style families
    1261       46664 :     uno::Reference < container::XNameAccess > xFamilies = xFamilySupplier->getStyleFamilies();
    1262             : 
    1263       46664 :     uno::Any aAny;
    1264       23332 :     sal_uInt16 nMapId = PROPERTY_MAP_NUM_STYLE;
    1265       23332 :     switch( eFamily )
    1266             :     {
    1267             :         case SFX_STYLE_FAMILY_CHAR:
    1268             :         {
    1269        4543 :             nMapId = PROPERTY_MAP_CHAR_STYLE;
    1270        4543 :             aAny = xFamilies->getByName ("CharacterStyles");
    1271             :             // Get the Frame family (and keep it for later)
    1272        4543 :             aAny >>= mxStyleFamily;
    1273             :         }
    1274        4543 :         break;
    1275             :         case SFX_STYLE_FAMILY_PARA:
    1276             :         {
    1277        3566 :             nMapId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE;
    1278        3566 :             aAny = xFamilies->getByName ("ParagraphStyles");
    1279             :             // Get the Frame family (and keep it for later)
    1280        3566 :             aAny >>= mxStyleFamily;
    1281        3566 :             aAny = mxStyleFamily->getByName ("Standard");
    1282        3566 :             aAny >>= mxStyleData;
    1283             :         }
    1284        3566 :         break;
    1285             :         case SFX_STYLE_FAMILY_PAGE:
    1286             :         {
    1287         209 :             nMapId = PROPERTY_MAP_PAGE_STYLE;
    1288         209 :             aAny = xFamilies->getByName ("PageStyles");
    1289             :             // Get the Frame family (and keep it for later)
    1290         209 :             aAny >>= mxStyleFamily;
    1291         209 :             aAny = mxStyleFamily->getByName ("Standard");
    1292         209 :             aAny >>= mxStyleData;
    1293             :         }
    1294         209 :         break;
    1295             :         case SFX_STYLE_FAMILY_FRAME :
    1296             :         {
    1297         161 :             nMapId = PROPERTY_MAP_FRAME_STYLE;
    1298             :         }
    1299         161 :         break;
    1300             :         case SFX_STYLE_FAMILY_PSEUDO:
    1301             :         {
    1302       14853 :             nMapId = PROPERTY_MAP_NUM_STYLE;
    1303             :         }
    1304       14853 :         break;
    1305             : 
    1306             :         default:
    1307             :             ;
    1308             :     }
    1309       46664 :     pPropImpl = new SwStyleProperties_Impl(aSwMapProvider.GetPropertySet(nMapId)->getPropertyMap());
    1310       23332 : }
    1311             : 
    1312       24516 : SwXStyle::SwXStyle(SfxStyleSheetBasePool& rPool, SfxStyleFamily eFam,
    1313             :         SwDoc* pDoc, const OUString& rStyleName) :
    1314             :     m_pDoc(pDoc),
    1315             :     m_sStyleName(rStyleName),
    1316             :     pBasePool(&rPool),
    1317             :     eFamily(eFam),
    1318             :     bIsDescriptor(sal_False),
    1319             :     bIsConditional(sal_False),
    1320       24516 :     pPropImpl(0)
    1321             : {
    1322       24516 :     StartListening(rPool);
    1323       24516 :     if(eFam == SFX_STYLE_FAMILY_PARA)
    1324             :     {
    1325       15934 :         pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
    1326       15934 :         SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    1327             :         OSL_ENSURE(pBase, "where is the style?" );
    1328       15934 :         if(pBase)
    1329             :         {
    1330       15934 :             const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(m_sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
    1331       15934 :             if(nId != USHRT_MAX)
    1332       15449 :                 bIsConditional = ::IsConditionalByPoolId( nId );
    1333             :             else
    1334         485 :                 bIsConditional = RES_CONDTXTFMTCOLL == ((SwDocStyleSheet*)pBase)->GetCollection()->Which();
    1335             :         }
    1336             :     }
    1337       24516 : }
    1338             : 
    1339      138606 : SwXStyle::~SwXStyle()
    1340             : {
    1341       47821 :     if(pBasePool)
    1342       47791 :         EndListening(*pBasePool);
    1343       47821 :     delete pPropImpl;
    1344       90785 : }
    1345             : 
    1346           0 : void SwXStyle::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    1347             : {
    1348           0 :     ClientModify(this, pOld, pNew);
    1349           0 :     if(!GetRegisteredIn())
    1350             :     {
    1351           0 :         m_pDoc = 0;
    1352           0 :         mxStyleData.clear();
    1353           0 :         mxStyleFamily.clear();
    1354             :     }
    1355           0 : }
    1356             : 
    1357        5476 : OUString SwXStyle::getName(void) throw( uno::RuntimeException, std::exception )
    1358             : {
    1359        5476 :     SolarMutexGuard aGuard;
    1360        5476 :     if(pBasePool)
    1361             :     {
    1362        5476 :         pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
    1363        5476 :         SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    1364             :         OSL_ENSURE(pBase, "where is the style?" );
    1365        5476 :         if(!pBase)
    1366           0 :             throw uno::RuntimeException();
    1367        5476 :         OUString aString;
    1368        5476 :         SwStyleNameMapper::FillProgName(pBase->GetName(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true);
    1369        5476 :         return aString;
    1370             :     }
    1371           0 :     return m_sStyleName;
    1372             : }
    1373             : 
    1374           8 : void SwXStyle::setName(const OUString& rName) throw( uno::RuntimeException, std::exception )
    1375             : {
    1376           8 :     SolarMutexGuard aGuard;
    1377           8 :     if(pBasePool)
    1378             :     {
    1379           8 :         pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
    1380           8 :         SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    1381             :         OSL_ENSURE(pBase, "where is the style?" );
    1382           8 :         bool bExcept = true;
    1383           8 :         if(pBase && pBase->IsUserDefined())
    1384             :         {
    1385           8 :             rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
    1386           8 :             bExcept = !xTmp->SetName(rName);
    1387           8 :             if(!bExcept)
    1388           8 :                 m_sStyleName = rName;
    1389             :         }
    1390           8 :         if(bExcept)
    1391           0 :             throw uno::RuntimeException();
    1392             :     }
    1393             :     else
    1394           0 :         m_sStyleName = rName;
    1395           8 : }
    1396             : 
    1397         936 : sal_Bool SwXStyle::isUserDefined(void) throw( uno::RuntimeException, std::exception )
    1398             : {
    1399         936 :     SolarMutexGuard aGuard;
    1400         936 :     sal_Bool bRet = sal_False;
    1401         936 :     if(pBasePool)
    1402             :     {
    1403         936 :         pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
    1404         936 :         SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    1405             :         //if it is not found it must be non user defined
    1406         936 :         if(pBase)
    1407         936 :             bRet = pBase->IsUserDefined();
    1408             :     }
    1409             :     else
    1410           0 :         throw uno::RuntimeException();
    1411         936 :     return bRet;
    1412             : }
    1413             : 
    1414          15 : sal_Bool SwXStyle::isInUse(void) throw( uno::RuntimeException, std::exception )
    1415             : {
    1416          15 :     SolarMutexGuard aGuard;
    1417          15 :     sal_Bool bRet = sal_False;
    1418          15 :     if(pBasePool)
    1419             :     {
    1420          15 :         pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_USED);
    1421          15 :         SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    1422          15 :         if(pBase)
    1423          15 :             bRet = pBase->IsUsed();
    1424             :     }
    1425             :     else
    1426           0 :         throw uno::RuntimeException();
    1427          15 :     return bRet;
    1428             : }
    1429             : 
    1430        1756 : OUString SwXStyle::getParentStyle(void) throw( uno::RuntimeException, std::exception )
    1431             : {
    1432        1756 :     SolarMutexGuard aGuard;
    1433        1756 :     OUString aString;
    1434        1756 :     if(pBasePool)
    1435             :     {
    1436        1756 :         pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL);
    1437        1756 :         SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    1438        1756 :         if(pBase)
    1439        1756 :             aString = pBase->GetParent();
    1440             :     }
    1441           0 :     else if(bIsDescriptor)
    1442           0 :         aString = m_sParentStyleName;
    1443             :     else
    1444           0 :         throw uno::RuntimeException();
    1445        1756 :     SwStyleNameMapper::FillProgName(aString, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true );
    1446        1756 :     return aString;
    1447             : }
    1448             : 
    1449       12665 : void SwXStyle::setParentStyle(const OUString& rParentStyle)
    1450             :             throw( container::NoSuchElementException, uno::RuntimeException, std::exception )
    1451             : {
    1452       12665 :     SolarMutexGuard aGuard;
    1453       25330 :     OUString sParentStyle;
    1454       12665 :     SwStyleNameMapper::FillUIName(rParentStyle, sParentStyle, lcl_GetSwEnumFromSfxEnum ( eFamily ), true );
    1455       12665 :     if(pBasePool)
    1456             :     {
    1457        7003 :         pBasePool->SetSearchMask(eFamily);
    1458        7003 :         bool bExcept = false;
    1459        7003 :         SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    1460        7003 :         if(pBase)
    1461             :         {
    1462        7003 :             rtl::Reference< SwDocStyleSheet > xBase( new SwDocStyleSheet(*(SwDocStyleSheet*)pBase) );
    1463             :             //make it a 'real' style - necessary for pooled styles
    1464        7003 :             xBase->GetItemSet();
    1465        7003 :             if(xBase->GetParent() != sParentStyle)
    1466             :             {
    1467        3544 :                 bExcept = !xBase->SetParent(sParentStyle);
    1468        7003 :             }
    1469             :         }
    1470             :         else
    1471           0 :             bExcept = true;
    1472        7003 :         if(bExcept)
    1473           0 :             throw uno::RuntimeException();
    1474             :     }
    1475        5662 :     else if(bIsDescriptor)
    1476             :     {
    1477        5662 :         m_sParentStyleName = sParentStyle;
    1478             :         try
    1479             :         {
    1480        5662 :             uno::Any aAny = mxStyleFamily->getByName ( sParentStyle );
    1481        5630 :             aAny >>= mxStyleData;
    1482             :         }
    1483          32 :         catch ( container::NoSuchElementException& )
    1484             :         {
    1485             :         }
    1486           0 :         catch ( lang::WrappedTargetException& )
    1487             :         {
    1488             :         }
    1489           0 :         catch ( uno::RuntimeException& )
    1490             :         {
    1491             :         }
    1492             :     }
    1493             :     else
    1494       12665 :         throw uno::RuntimeException();
    1495       12665 : }
    1496             : 
    1497       13022 : static uno::Reference< beans::XPropertySetInfo > lcl_getPropertySetInfo( SfxStyleFamily eFamily, sal_Bool bIsConditional )
    1498             : {
    1499       13022 :     uno::Reference< beans::XPropertySetInfo >  xRet;
    1500       13022 :     switch( eFamily )
    1501             :     {
    1502             :         case SFX_STYLE_FAMILY_CHAR:
    1503             :         {
    1504        2085 :             static uno::Reference< beans::XPropertySetInfo >  xCharRef;
    1505        2085 :             if(!xCharRef.is())
    1506             :             {
    1507          13 :                 xCharRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_STYLE)->getPropertySetInfo();
    1508             :             }
    1509        2085 :             xRet = xCharRef;
    1510             :         }
    1511        2085 :         break;
    1512             :         case SFX_STYLE_FAMILY_PARA:
    1513             :         {
    1514        8335 :             static uno::Reference< beans::XPropertySetInfo > xCondParaRef;
    1515        8335 :             static uno::Reference< beans::XPropertySetInfo >  xParaRef;
    1516        8335 :             if(!xParaRef.is())
    1517             :             {
    1518          40 :                 xCondParaRef = aSwMapProvider.GetPropertySet(
    1519          20 :                     PROPERTY_MAP_CONDITIONAL_PARA_STYLE)->getPropertySetInfo();
    1520          40 :                 xParaRef = aSwMapProvider.GetPropertySet(
    1521          20 :                     PROPERTY_MAP_PARA_STYLE)->getPropertySetInfo();
    1522             :             }
    1523        8335 :             xRet = bIsConditional ? xCondParaRef : xParaRef;
    1524             :         }
    1525        8335 :         break;
    1526             :         case SFX_STYLE_FAMILY_PAGE     :
    1527             :         {
    1528        1262 :             static uno::Reference< beans::XPropertySetInfo >  xPageRef;
    1529        1262 :             if(!xPageRef.is())
    1530             :             {
    1531          20 :                 xPageRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE)->getPropertySetInfo();
    1532             :             }
    1533        1262 :             xRet = xPageRef;
    1534             :         }
    1535        1262 :         break;
    1536             :         case SFX_STYLE_FAMILY_FRAME    :
    1537             :         {
    1538        1037 :             static uno::Reference< beans::XPropertySetInfo >  xFrameRef;
    1539        1037 :             if(!xFrameRef.is())
    1540             :             {
    1541          16 :                 xFrameRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_FRAME_STYLE)->getPropertySetInfo();
    1542             :             }
    1543        1037 :             xRet = xFrameRef;
    1544             :         }
    1545        1037 :         break;
    1546             :         case SFX_STYLE_FAMILY_PSEUDO:
    1547             :         {
    1548         303 :             static uno::Reference< beans::XPropertySetInfo >  xNumRef;
    1549         303 :             if(!xNumRef.is())
    1550             :             {
    1551          13 :                 xNumRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_NUM_STYLE)->getPropertySetInfo();
    1552             :             }
    1553         303 :             xRet = xNumRef;
    1554             :         }
    1555         303 :         break;
    1556             : 
    1557             :         default:
    1558             :             ;
    1559             :     }
    1560       13022 :     return xRet;
    1561             : }
    1562             : 
    1563       13022 : uno::Reference< beans::XPropertySetInfo >  SwXStyle::getPropertySetInfo(void)
    1564             :     throw( uno::RuntimeException, std::exception )
    1565             : {
    1566       13022 :     return lcl_getPropertySetInfo( eFamily, bIsConditional );
    1567             : }
    1568             : 
    1569       23330 : void    SwXStyle::ApplyDescriptorProperties()
    1570             : {
    1571       23330 :     bIsDescriptor = sal_False;
    1572       23330 :     mxStyleData.clear();
    1573       23330 :     mxStyleFamily.clear();
    1574             : 
    1575       23330 :     const PropertyEntryVector_t& rPropertyVector = pPropImpl->GetPropertyVector();
    1576       23330 :     PropertyEntryVector_t::const_iterator aIt = rPropertyVector.begin();
    1577     1033357 :     while(aIt != rPropertyVector.end())
    1578             :     {
    1579             :         uno::Any* pAny;
    1580      986697 :         pPropImpl->GetProperty(aIt->sName, pAny);
    1581      986697 :         if(pAny)
    1582       42460 :             setPropertyValue(aIt->sName, *pAny);
    1583      986697 :         ++aIt;
    1584             :     }
    1585       23330 : }
    1586             : 
    1587             : struct SwStyleBase_Impl
    1588             : {
    1589             :     SwDoc&              rDoc;
    1590             : 
    1591             :     const SwPageDesc*   pOldPageDesc;
    1592             : 
    1593             :     rtl::Reference< SwDocStyleSheet > mxNewBase;
    1594             :     SfxItemSet*         pItemSet;
    1595             : 
    1596             :     OUString     rStyleName;
    1597             : 
    1598      251070 :     SwStyleBase_Impl(SwDoc& rSwDoc, const OUString& rName) :
    1599             :         rDoc(rSwDoc),
    1600             :         pOldPageDesc(0),
    1601             :         pItemSet(0),
    1602      251070 :         rStyleName(rName)
    1603      251070 :         {}
    1604             : 
    1605      251070 :     ~SwStyleBase_Impl(){ delete pItemSet; }
    1606             : 
    1607      217851 :     sal_Bool HasItemSet() {return mxNewBase.is();}
    1608      376837 :     SfxItemSet& GetItemSet()
    1609             :         {
    1610             :             OSL_ENSURE(mxNewBase.is(), "no SwDocStyleSheet available");
    1611      376837 :             if(!pItemSet)
    1612      214042 :                 pItemSet = new SfxItemSet(mxNewBase->GetItemSet());
    1613      376837 :             return *pItemSet;
    1614             :         }
    1615             : 
    1616             :         const SwPageDesc& GetOldPageDesc();
    1617             : };
    1618             : 
    1619        1167 : const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
    1620             : {
    1621        1167 :     if(!pOldPageDesc)
    1622             :     {
    1623             :         sal_uInt16 i;
    1624        1160 :         sal_uInt16 nPDescCount = rDoc.GetPageDescCnt();
    1625        2794 :         for(i = 0; i < nPDescCount; i++)
    1626             :         {
    1627        2794 :             const SwPageDesc& rDesc = rDoc.GetPageDesc( i );
    1628        2794 :             if(rDesc.GetName() == rStyleName)
    1629             :             {
    1630        1160 :                 pOldPageDesc = & rDesc;
    1631        1160 :                 break;
    1632             :             }
    1633             :         }
    1634        1160 :         if(!pOldPageDesc)
    1635             :         {
    1636           0 :             for(i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_LANDSCAPE; ++i)
    1637             :             {
    1638           0 :                 const OUString aFmtName(SW_RES(i));
    1639           0 :                 if(aFmtName == rStyleName)
    1640             :                 {
    1641           0 :                     pOldPageDesc = rDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) );
    1642           0 :                     break;
    1643             :                 }
    1644           0 :             }
    1645             :         }
    1646             :     }
    1647             :     assert(pOldPageDesc != 0);
    1648        1167 :     return *pOldPageDesc;
    1649             : }
    1650             : 
    1651      281154 : static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
    1652             :                         const SfxItemPropertySet& rPropSet,
    1653             :                         const uno::Any& rValue,
    1654             :                         SwStyleBase_Impl& rBase,
    1655             :                         SfxStyleSheetBasePool* pBasePool,
    1656             :                         SwDoc* pDoc,
    1657             :                         SfxStyleFamily eFamily)
    1658             :                             throw(beans::PropertyVetoException, lang::IllegalArgumentException,
    1659             :                                 lang::WrappedTargetException, uno::RuntimeException)
    1660             : 
    1661             : {
    1662             :     //UUUU adapted switch logic to a more readable state; removed goto's and made
    1663             :     // execution of standard setting of proerty in ItemSet dependent of this variable
    1664      281154 :     bool bDone(false);
    1665             : 
    1666             :     //UUUU
    1667      281154 :     const sal_uInt8 nMemberId(rEntry.nMemberId & (~SFX_METRIC_ITEM));
    1668      281154 :     uno::Any aValue(rValue);
    1669             : 
    1670             :     //UUUU check for needed metric translation
    1671      281154 :     if(rEntry.nMemberId & SFX_METRIC_ITEM)
    1672             :     {
    1673           0 :         bool bDoIt(true);
    1674             : 
    1675           0 :         if(XATTR_FILLBMP_SIZEX == rEntry.nWID || XATTR_FILLBMP_SIZEY == rEntry.nWID)
    1676             :         {
    1677             :             // exception: If these ItemTypes are used, do not convert when these are negative
    1678             :             // since this means they are intended as percent values
    1679           0 :             sal_Int32 nValue = 0;
    1680             : 
    1681           0 :             if(aValue >>= nValue)
    1682             :             {
    1683           0 :                 bDoIt = nValue > 0;
    1684             :             }
    1685             :         }
    1686             : 
    1687           0 :         if(bDoIt && pDoc)
    1688             :         {
    1689           0 :             const SfxItemPool& rPool = pDoc->GetAttrPool();
    1690           0 :             const SfxMapUnit eMapUnit(rPool.GetMetric(rEntry.nWID));
    1691             : 
    1692           0 :             if(eMapUnit != SFX_MAPUNIT_100TH_MM)
    1693             :             {
    1694           0 :                 SvxUnoConvertFromMM(eMapUnit, aValue);
    1695             :             }
    1696             :         }
    1697             :     }
    1698             : 
    1699      281154 :     switch(rEntry.nWID)
    1700             :     {
    1701             :         case FN_UNO_HIDDEN:
    1702             :         {
    1703        1735 :             sal_Bool bHidden = sal_False;
    1704        1735 :             if ( rValue >>= bHidden )
    1705             :             {
    1706             :                 //make it a 'real' style - necessary for pooled styles
    1707        1735 :                 rBase.mxNewBase->GetItemSet();
    1708        1735 :                 rBase.mxNewBase->SetHidden( bHidden );
    1709             :             }
    1710             :         }
    1711        1735 :         break;
    1712             : 
    1713             :         case FN_UNO_STYLE_INTEROP_GRAB_BAG:
    1714             :         {
    1715       23344 :             rBase.mxNewBase->GetItemSet();
    1716       23344 :             rBase.mxNewBase->SetGrabBagItem(rValue);
    1717             :         }
    1718       23344 :         break;
    1719             : 
    1720             :         case XATTR_FILLBITMAP:
    1721             :         case XATTR_FILLGRADIENT:
    1722             :         case XATTR_FILLHATCH:
    1723             :         case XATTR_FILLFLOATTRANSPARENCE:
    1724             :         // not yet needed; activate when LineStyle support may be added
    1725             :         // case XATTR_LINESTART:
    1726             :         // case XATTR_LINEEND:
    1727             :         // case XATTR_LINEDASH:
    1728             :         {
    1729             :             //UUUU add set commands for FillName items
    1730           0 :             if(MID_NAME == nMemberId)
    1731             :             {
    1732           0 :                 OUString aTempName;
    1733           0 :                 SfxItemSet& rStyleSet = rBase.GetItemSet();
    1734             : 
    1735           0 :                 if(!(aValue >>= aTempName))
    1736             :                 {
    1737           0 :                     throw lang::IllegalArgumentException();
    1738             :                 }
    1739             : 
    1740           0 :                 SvxShape::SetFillAttribute(rEntry.nWID, aTempName, rStyleSet);
    1741           0 :                 bDone = true;
    1742             :             }
    1743             : 
    1744           0 :             break;
    1745             :         }
    1746             :         case RES_BACKGROUND:
    1747             :         {
    1748         146 :             if (SFX_STYLE_FAMILY_FRAME == eFamily)
    1749             :             {
    1750             :                 //UUUU
    1751           0 :                 SfxItemSet& rStyleSet = rBase.GetItemSet();
    1752           0 :                 const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rStyleSet));
    1753           0 :                 SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
    1754             : 
    1755           0 :                 aChangedBrushItem.PutValue(aValue, nMemberId);
    1756             : 
    1757           0 :                 if(!(aChangedBrushItem == aOriginalBrushItem))
    1758             :                 {
    1759           0 :                     sw::setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet);
    1760             :                 }
    1761             : 
    1762           0 :                 bDone = true;
    1763             :             }
    1764         146 :             break;
    1765             :         }
    1766             :         case OWN_ATTR_FILLBMP_MODE:
    1767             :         {
    1768             :             //UUUU
    1769             :             drawing::BitmapMode eMode;
    1770             : 
    1771           0 :             if(!(aValue >>= eMode))
    1772             :             {
    1773           0 :                 sal_Int32 nMode = 0;
    1774             : 
    1775           0 :                 if(!(aValue >>= nMode))
    1776             :                 {
    1777           0 :                     throw lang::IllegalArgumentException();
    1778             :                 }
    1779             : 
    1780           0 :                 eMode = (drawing::BitmapMode)nMode;
    1781             :             }
    1782             : 
    1783           0 :             SfxItemSet& rStyleSet = rBase.GetItemSet();
    1784             : 
    1785           0 :             rStyleSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
    1786           0 :             rStyleSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
    1787             : 
    1788           0 :             bDone = true;
    1789           0 :             break;
    1790             :         }
    1791             :         case RES_PAPER_BIN:
    1792             :         {
    1793           1 :             SfxPrinter *pPrinter = pDoc->getPrinter( true );
    1794           1 :             OUString sTmp;
    1795           1 :             sal_uInt16 nBin = USHRT_MAX;
    1796           1 :             if ( !( aValue >>= sTmp ) )
    1797           0 :                 throw lang::IllegalArgumentException();
    1798           1 :             if ( sTmp == "[From printer settings]" )
    1799           1 :                 nBin = USHRT_MAX-1;
    1800           0 :             else if ( pPrinter )
    1801             :             {
    1802           0 :                 for (sal_uInt16 i=0, nEnd = pPrinter->GetPaperBinCount(); i < nEnd; i++ )
    1803             :                 {
    1804           0 :                     if (sTmp == pPrinter->GetPaperBinName ( i ) )
    1805             :                     {
    1806           0 :                         nBin = i;
    1807           0 :                         break;
    1808             :                     }
    1809             :                 }
    1810             :             }
    1811           1 :             if ( nBin == USHRT_MAX )
    1812           0 :                 throw lang::IllegalArgumentException();
    1813             :             else
    1814             :             {
    1815           1 :                 SfxItemSet& rStyleSet = rBase.GetItemSet();
    1816           1 :                 SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID);
    1817           1 :                 aSet.SetParent(&rStyleSet);
    1818           1 :                 rPropSet.setPropertyValue(rEntry, uno::makeAny ( static_cast < sal_Int8 > ( nBin == USHRT_MAX-1 ? -1 : nBin ) ), aSet);
    1819           1 :                 rStyleSet.Put(aSet);
    1820             :             }
    1821             : 
    1822           1 :             bDone = true;
    1823           1 :             break;
    1824             :         }
    1825             :         case  FN_UNO_NUM_RULES: //Sonderbehandlung fuer das SvxNumRuleItem:
    1826             :         {
    1827      130749 :             if(aValue.getValueType() == ::getCppuType((uno::Reference< container::XIndexReplace>*)0) )
    1828             :             {
    1829             :                 uno::Reference< container::XIndexReplace > * pxRulesRef =
    1830      130749 :                         (uno::Reference< container::XIndexReplace > *)aValue.getValue();
    1831             : 
    1832      130749 :                 uno::Reference<lang::XUnoTunnel> xNumberTunnel( *pxRulesRef, uno::UNO_QUERY);
    1833             : 
    1834      130749 :                 SwXNumberingRules* pSwXRules = 0;
    1835      130749 :                 if(xNumberTunnel.is())
    1836             :                 {
    1837             :                     pSwXRules = reinterpret_cast< SwXNumberingRules * >(
    1838      130749 :                             sal::static_int_cast< sal_IntPtr >(xNumberTunnel->getSomething( SwXNumberingRules::getUnoTunnelId()) ));
    1839             :                 }
    1840      130749 :                 if(pSwXRules)
    1841             :                 {
    1842      130749 :                     const OUString* pCharStyleNames = pSwXRules->GetNewCharStyleNames();
    1843      130749 :                     const OUString* pBulletFontNames = pSwXRules->GetBulletFontNames();
    1844             : 
    1845      130749 :                     SwNumRule aSetRule(*pSwXRules->GetNumRule());
    1846      130749 :                     const SwCharFmts* pFmts = pDoc->GetCharFmts();
    1847      130749 :                     sal_uInt16 nChCount = pFmts->size();
    1848     1438239 :                     for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
    1849             :                     {
    1850             : 
    1851     1307490 :                         const SwNumFmt* pFmt = aSetRule.GetNumFmt( i );
    1852     1307490 :                         if(pFmt)
    1853             :                         {
    1854      722241 :                             SwNumFmt aFmt(*pFmt);
    1855     3606563 :                             if (!pCharStyleNames[i].isEmpty() &&
    1856     1444482 :                                 !SwXNumberingRules::isInvalidStyle(pCharStyleNames[i]) &&
    1857      722241 :                                 (!pFmt->GetCharFmt() || pFmt->GetCharFmt()->GetName() != pCharStyleNames[i]) )
    1858             :                             {
    1859             : 
    1860           0 :                                 SwCharFmt* pCharFmt = 0;
    1861           0 :                                 for(sal_uInt16 j = 0; j< nChCount; j++)
    1862             :                                 {
    1863           0 :                                     SwCharFmt* pTmp = (*pFmts)[j];
    1864           0 :                                     if(pTmp->GetName() == pCharStyleNames[i])
    1865             :                                     {
    1866           0 :                                         pCharFmt = pTmp;
    1867           0 :                                         break;
    1868             :                                     }
    1869             :                                 }
    1870           0 :                                 if(!pCharFmt)
    1871             :                                 {
    1872             : 
    1873             :                                     SfxStyleSheetBase* pBase;
    1874           0 :                                     pBase = ((SfxStyleSheetBasePool*)pBasePool)->Find(pCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
    1875           0 :                                     if(!pBase)
    1876           0 :                                         pBase = &pBasePool->Make(pCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
    1877           0 :                                     pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
    1878             : 
    1879             :                                 }
    1880             : 
    1881           0 :                                 aFmt.SetCharFmt( pCharFmt );
    1882             :                             }
    1883             :                             //jetzt nochmal fuer Fonts
    1884     2166723 :                             if (!pBulletFontNames[i].isEmpty() &&
    1885      722241 :                                 !SwXNumberingRules::isInvalidStyle(pBulletFontNames[i]) &&
    1886           0 :                                 (!pFmt->GetBulletFont() || pFmt->GetBulletFont()->GetName() != pBulletFontNames[i]) )
    1887             :                             {
    1888             :                                 const SvxFontListItem* pFontListItem =
    1889           0 :                                         (const SvxFontListItem* )pDoc->GetDocShell()
    1890           0 :                                                             ->GetItem( SID_ATTR_CHAR_FONTLIST );
    1891           0 :                                 const FontList*  pList = pFontListItem->GetFontList();
    1892             :                                 FontInfo aInfo = pList->Get(
    1893           0 :                                     pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
    1894           0 :                                 Font aFont(aInfo);
    1895           0 :                                 aFmt.SetBulletFont(&aFont);
    1896             :                             }
    1897      722241 :                             aSetRule.Set( i, &aFmt );
    1898             :                         }
    1899             :                     }
    1900      130749 :                     rBase.mxNewBase->SetNumRule(aSetRule);
    1901      130749 :                 }
    1902             :             }
    1903             :             else
    1904           0 :                 throw lang::IllegalArgumentException();
    1905             : 
    1906      130749 :             bDone = true;
    1907      130749 :             break;
    1908             :         }
    1909             :         case RES_PARATR_OUTLINELEVEL:
    1910             :         {
    1911        8948 :             sal_Int16 nLevel = 0;
    1912        8948 :             aValue >>= nLevel;
    1913        8948 :             if( 0 <= nLevel && nLevel <= MAXLEVEL)
    1914        8948 :                 rBase.mxNewBase->GetCollection()->SetAttrOutlineLevel( nLevel );
    1915             : 
    1916        8948 :             bDone = true;
    1917        8948 :             break;
    1918             :         }
    1919             :         case FN_UNO_FOLLOW_STYLE:
    1920             :         {
    1921        2779 :             OUString sTmp;
    1922        2779 :             aValue >>= sTmp;
    1923        5558 :             OUString aString;
    1924        2779 :             SwStyleNameMapper::FillUIName(sTmp, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true ) ;
    1925        2779 :             rBase.mxNewBase->SetFollow( aString );
    1926             : 
    1927        2779 :             bDone = true;
    1928        5558 :             break;
    1929             :         }
    1930             :         case RES_PAGEDESC :
    1931             :         {
    1932             :             // Sonderbehandlung RES_PAGEDESC
    1933          48 :             if(aValue.getValueType() != ::getCppuType((const OUString*)0))
    1934          32 :                 throw lang::IllegalArgumentException();
    1935          16 :             SfxItemSet& rStyleSet = rBase.GetItemSet();
    1936             : 
    1937          16 :             SwFmtPageDesc* pNewDesc = 0;
    1938             :             const SfxPoolItem* pItem;
    1939          16 :             if(SFX_ITEM_SET == rStyleSet.GetItemState( RES_PAGEDESC, true, &pItem ) )
    1940             :             {
    1941           4 :                 pNewDesc = new SwFmtPageDesc(*((SwFmtPageDesc*)pItem));
    1942             :             }
    1943          16 :             if(!pNewDesc)
    1944          12 :                 pNewDesc = new SwFmtPageDesc();
    1945          16 :             OUString uDescName;
    1946          16 :             aValue >>= uDescName;
    1947          32 :             OUString sDescName;
    1948          16 :             SwStyleNameMapper::FillUIName(uDescName, sDescName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, true );
    1949          16 :             if(!pNewDesc->GetPageDesc() || pNewDesc->GetPageDesc()->GetName() != sDescName)
    1950             :             {
    1951          16 :                 sal_Bool bPut = sal_False;
    1952          16 :                 if (!sDescName.isEmpty())
    1953             :                 {
    1954           0 :                     SwPageDesc* pPageDesc = SwPageDesc::GetByName(*pDoc, sDescName);
    1955           0 :                     if(pPageDesc)
    1956             :                     {
    1957           0 :                         pNewDesc->RegisterToPageDesc( *pPageDesc );
    1958           0 :                         bPut = sal_True;
    1959             :                     }
    1960             :                     else
    1961             :                     {
    1962           0 :                         throw lang::IllegalArgumentException();
    1963             :                     }
    1964             :                 }
    1965          16 :                 if(!bPut)
    1966             :                 {
    1967          16 :                     rStyleSet.ClearItem(RES_BREAK);
    1968          16 :                     rStyleSet.Put(SwFmtPageDesc());
    1969             :                 }
    1970             :                 else
    1971           0 :                     rStyleSet.Put(*pNewDesc);
    1972             : 
    1973          16 :                 delete pNewDesc;
    1974          16 :                 bDone = true;
    1975             :             }
    1976             : 
    1977          32 :             break;
    1978             :         }
    1979             :         case FN_UNO_IS_AUTO_UPDATE:
    1980             :         {
    1981        1888 :             sal_Bool bAuto = *(sal_Bool*)aValue.getValue();
    1982        1888 :             if(SFX_STYLE_FAMILY_PARA == eFamily)
    1983        1671 :                 rBase.mxNewBase->GetCollection()->SetAutoUpdateFmt(bAuto);
    1984         217 :             else if(SFX_STYLE_FAMILY_FRAME == eFamily)
    1985         217 :                 rBase.mxNewBase->GetFrmFmt()->SetAutoUpdateFmt(bAuto);
    1986             : 
    1987        1888 :             bDone = true;
    1988        1888 :             break;
    1989             :         }
    1990             :         case FN_UNO_PARA_STYLE_CONDITIONS:
    1991             :         {
    1992           0 :             uno::Sequence< beans::NamedValue > aSeq;
    1993           0 :             if (!(aValue >>= aSeq))
    1994           0 :                 throw lang::IllegalArgumentException();
    1995             : 
    1996             :             OSL_ENSURE(COND_COMMAND_COUNT == 28,
    1997             :                     "invalid size of comman count?");
    1998           0 :             const beans::NamedValue *pSeq = aSeq.getConstArray();
    1999           0 :             sal_Int32 nLen = aSeq.getLength();
    2000             : 
    2001           0 :             sal_Bool bFailed = sal_False;
    2002           0 :             SwCondCollItem aCondItem;
    2003           0 :             for(sal_uInt16 i = 0; i < nLen; i++)
    2004             :             {
    2005           0 :                 OUString aTmp;
    2006           0 :                 if ((pSeq[i].Value >>= aTmp))
    2007             :                 {
    2008             :                     // get UI style name from programmatic style name
    2009           0 :                     OUString aStyleName;
    2010             :                     SwStyleNameMapper::FillUIName(aTmp, aStyleName,
    2011           0 :                             lcl_GetSwEnumFromSfxEnum(eFamily), true);
    2012             : 
    2013             :                     // check for correct context and style name
    2014             : 
    2015           0 :                     sal_Int16 nIdx = GetCommandContextIndex( pSeq[i].Name );
    2016             : 
    2017           0 :                     pBasePool->SetSearchMask( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
    2018           0 :                     sal_Bool bStyleFound = sal_False;
    2019           0 :                     const SfxStyleSheetBase* pBase = pBasePool->First();
    2020           0 :                     while (pBase && !bStyleFound)
    2021             :                     {
    2022           0 :                         if(pBase->GetName() == aStyleName)
    2023           0 :                             bStyleFound = sal_True;
    2024           0 :                         pBase = pBasePool->Next();
    2025             :                     }
    2026             : 
    2027           0 :                     if (nIdx == -1 || !bStyleFound)
    2028             :                     {
    2029           0 :                         bFailed = sal_True;
    2030           0 :                         break;
    2031             :                     }
    2032             : 
    2033           0 :                     aCondItem.SetStyle(&aStyleName, nIdx);
    2034             :                 }
    2035             :                 else
    2036           0 :                     bFailed = sal_True;
    2037           0 :             }
    2038           0 :             if (bFailed)
    2039           0 :                 throw lang::IllegalArgumentException();
    2040           0 :             rBase.GetItemSet().Put( aCondItem );
    2041           0 :             bDone = true;
    2042           0 :             break;
    2043             :         }
    2044             :         case FN_UNO_CATEGORY:
    2045             :         {
    2046           7 :             if(!rBase.mxNewBase->IsUserDefined())
    2047           0 :                 throw lang::IllegalArgumentException();
    2048           7 :             short nSet = 0;
    2049           7 :             aValue >>= nSet;
    2050             : 
    2051             :             sal_uInt16 nId;
    2052           7 :             switch( nSet )
    2053             :             {
    2054             :                 case style::ParagraphStyleCategory::TEXT:
    2055           6 :                     nId = SWSTYLEBIT_TEXT;
    2056           6 :                     break;
    2057             :                 case style::ParagraphStyleCategory::CHAPTER:
    2058           0 :                     nId = SWSTYLEBIT_CHAPTER;
    2059           0 :                     break;
    2060             :                 case style::ParagraphStyleCategory::LIST:
    2061           0 :                     nId = SWSTYLEBIT_LIST;
    2062           0 :                     break;
    2063             :                 case style::ParagraphStyleCategory::INDEX:
    2064           0 :                     nId = SWSTYLEBIT_IDX;
    2065           0 :                     break;
    2066             :                 case style::ParagraphStyleCategory::EXTRA:
    2067           1 :                     nId = SWSTYLEBIT_EXTRA;
    2068           1 :                     break;
    2069             :                 case style::ParagraphStyleCategory::HTML:
    2070           0 :                     nId = SWSTYLEBIT_HTML;
    2071           0 :                     break;
    2072           0 :                 default: throw lang::IllegalArgumentException();
    2073             :             }
    2074             : 
    2075           7 :             rBase.mxNewBase->SetMask( nId|SFXSTYLEBIT_USERDEF );
    2076           7 :             bDone = true;
    2077           7 :             break;
    2078             :         }
    2079             :         case SID_SWREGISTER_COLLECTION:
    2080             :         {
    2081           0 :             OUString sName;
    2082           0 :             aValue >>= sName;
    2083           0 :             SwRegisterItem aReg( !sName.isEmpty() );
    2084           0 :             aReg.SetWhich(SID_SWREGISTER_MODE);
    2085           0 :             rBase.GetItemSet().Put(aReg);
    2086           0 :             OUString aString;
    2087           0 :             SwStyleNameMapper::FillUIName(sName, aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true);
    2088             : 
    2089           0 :             rBase.GetItemSet().Put(SfxStringItem(SID_SWREGISTER_COLLECTION, aString ) );
    2090           0 :             bDone = true;
    2091           0 :             break;
    2092             :         }
    2093             :         case RES_TXTATR_CJK_RUBY:
    2094             :         {
    2095           0 :             if(MID_RUBY_CHARSTYLE == nMemberId )
    2096             :             {
    2097           0 :                 OUString sTmp;
    2098           0 :                 if(aValue >>= sTmp)
    2099             :                 {
    2100           0 :                     SfxItemSet& rStyleSet = rBase.GetItemSet();
    2101           0 :                     SwFmtRuby* pRuby = 0;
    2102             :                     const SfxPoolItem* pItem;
    2103           0 :                     if(SFX_ITEM_SET == rStyleSet.GetItemState( RES_TXTATR_CJK_RUBY, true, &pItem ) )
    2104           0 :                         pRuby = new SwFmtRuby(*((SwFmtRuby*)pItem));
    2105           0 :                     if(!pRuby)
    2106           0 :                         pRuby = new SwFmtRuby(OUString());
    2107           0 :                     OUString sStyle;
    2108           0 :                     SwStyleNameMapper::FillUIName(sTmp, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true );
    2109           0 :                     pRuby->SetCharFmtName( sTmp );
    2110           0 :                     pRuby->SetCharFmtId( 0 );
    2111           0 :                     if(!sTmp.isEmpty())
    2112             :                     {
    2113           0 :                         sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sTmp, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
    2114           0 :                         pRuby->SetCharFmtId(nId);
    2115             :                     }
    2116           0 :                     rStyleSet.Put(*pRuby);
    2117           0 :                     delete pRuby;
    2118             :                 }
    2119             :                 else
    2120           0 :                     throw lang::IllegalArgumentException();
    2121             :             }
    2122           0 :             break;
    2123             :         }
    2124             :         case RES_PARATR_DROP:
    2125             :         {
    2126           0 :             if( MID_DROPCAP_CHAR_STYLE_NAME == nMemberId)
    2127             :             {
    2128           0 :                 if(aValue.getValueType() == ::getCppuType((const OUString*)0))
    2129             :                 {
    2130           0 :                     SfxItemSet& rStyleSet = rBase.GetItemSet();
    2131             : 
    2132           0 :                     SwFmtDrop* pDrop = 0;
    2133             :                     const SfxPoolItem* pItem;
    2134           0 :                     if(SFX_ITEM_SET == rStyleSet.GetItemState( RES_PARATR_DROP, true, &pItem ) )
    2135           0 :                         pDrop = new SwFmtDrop(*((SwFmtDrop*)pItem));
    2136           0 :                     if(!pDrop)
    2137           0 :                         pDrop = new SwFmtDrop();
    2138           0 :                     OUString uStyle;
    2139           0 :                     aValue >>= uStyle;
    2140           0 :                     OUString sStyle;
    2141           0 :                     SwStyleNameMapper::FillUIName(uStyle, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true );
    2142             :                     SwDocStyleSheet* pStyle =
    2143           0 :                         (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR);
    2144           0 :                     if(pStyle)
    2145           0 :                         pDrop->SetCharFmt(pStyle->GetCharFmt());
    2146             :                     else
    2147           0 :                         throw lang::IllegalArgumentException();
    2148           0 :                     rStyleSet.Put(*pDrop);
    2149           0 :                     delete pDrop;
    2150             :                 }
    2151             :                 else
    2152           0 :                     throw lang::IllegalArgumentException();
    2153             : 
    2154           0 :                 bDone = true;
    2155             :             }
    2156           0 :             break;
    2157             :         }
    2158             :         default:
    2159             :         {
    2160             :             // nothing to do
    2161      111509 :             break;
    2162             :         }
    2163             :     }
    2164             : 
    2165      281122 :     if(!bDone)
    2166             :     {
    2167             :         // default ItemSet handling
    2168      136734 :         SfxItemSet& rStyleSet = rBase.GetItemSet();
    2169      136734 :         SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID);
    2170      136734 :         aSet.SetParent(&rStyleSet);
    2171      136734 :         rPropSet.setPropertyValue(rEntry, aValue, aSet);
    2172      136733 :         rStyleSet.Put(aSet);
    2173             : 
    2174             :         // --> OD 2006-10-18 #i70223#
    2175      210761 :         if ( SFX_STYLE_FAMILY_PARA == eFamily &&
    2176       74045 :                 rEntry.nWID == RES_PARATR_NUMRULE &&
    2177      136784 :                 rBase.mxNewBase.is() && rBase.mxNewBase->GetCollection() &&
    2178             :                 //rBase.mxNewBase->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei
    2179          17 :                 rBase.mxNewBase->GetCollection()->IsAssignedToListLevelOfOutlineStyle() )       ////<-end,add by zhaojianwei
    2180             :         {
    2181           0 :             OUString sNewNumberingRuleName;
    2182           0 :             aValue >>= sNewNumberingRuleName;
    2183           0 :             OUString sTmp( sNewNumberingRuleName );
    2184           0 :             if ( sNewNumberingRuleName.getLength() == 0 || sTmp != pDoc->GetOutlineNumRule()->GetName() )
    2185             :             {
    2186           0 :                 rBase.mxNewBase->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle();
    2187           0 :             }
    2188      136734 :         }
    2189      281154 :     }
    2190      281121 : }
    2191             : 
    2192      215013 : void SAL_CALL SwXStyle::SetPropertyValues_Impl(
    2193             :     const uno::Sequence< OUString >& rPropertyNames,
    2194             :     const uno::Sequence< uno::Any >& rValues )
    2195             :     throw (beans::UnknownPropertyException, beans::PropertyVetoException,
    2196             :            lang::IllegalArgumentException, lang::WrappedTargetException,
    2197             :            uno::RuntimeException, std::exception)
    2198             : {
    2199      215013 :     if ( !m_pDoc )
    2200           0 :         throw uno::RuntimeException();
    2201      215013 :     sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;
    2202      215013 :     switch(eFamily)
    2203             :     {
    2204       45245 :         case SFX_STYLE_FAMILY_PARA  : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
    2205         651 :         case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break;
    2206           0 :         case SFX_STYLE_FAMILY_PAGE  : nPropSetId = PROPERTY_MAP_PAGE_STYLE  ;break;
    2207      143686 :         case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE   ;break;
    2208             :         default:
    2209             :             ;
    2210             :     }
    2211      215013 :     const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    2212      215013 :     const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap();
    2213             : 
    2214      215013 :     if(rPropertyNames.getLength() != rValues.getLength())
    2215           0 :         throw lang::IllegalArgumentException();
    2216             : 
    2217      215013 :     const OUString* pNames = rPropertyNames.getConstArray();
    2218      215013 :     const uno::Any* pValues = rValues.getConstArray();
    2219             : 
    2220      215013 :     SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName);
    2221      215013 :     if(pBasePool)
    2222             :     {
    2223      207879 :         sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
    2224      207879 :         pBasePool->SetSearchMask(eFamily);
    2225      207879 :         SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    2226      207879 :         pBasePool->SetSearchMask(eFamily, nSaveMask );
    2227             :         OSL_ENSURE(pBase, "where is the style?" );
    2228      207879 :         if(pBase)
    2229      207879 :             aBaseImpl.mxNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase);
    2230             :         else
    2231           0 :             throw uno::RuntimeException();
    2232             :     }
    2233             : 
    2234      514723 :     for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
    2235             :     {
    2236      300130 :         const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp]);
    2237             : 
    2238      600260 :         if(!pEntry ||
    2239      596799 :            (!bIsConditional && pNames[nProp] == UNO_NAME_PARA_STYLE_CONDITIONS))
    2240         381 :             throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
    2241      299749 :         if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
    2242           6 :             throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
    2243      299743 :         if(aBaseImpl.mxNewBase.is())
    2244             :         {
    2245      257283 :             lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl,
    2246      514566 :                                  pBasePool, m_pDoc, eFamily);
    2247             :         }
    2248       42460 :         else if(bIsDescriptor)
    2249             :         {
    2250       42460 :             if(!pPropImpl->SetProperty(pNames[nProp], pValues[nProp]))
    2251           0 :                 throw lang::IllegalArgumentException();
    2252             :         }
    2253             :         else
    2254           0 :             throw uno::RuntimeException();
    2255             :     }
    2256      214593 :     if(aBaseImpl.HasItemSet())
    2257      208228 :         aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet());
    2258      214593 : }
    2259             : 
    2260       13282 : void SwXStyle::setPropertyValues(
    2261             :     const uno::Sequence< OUString >& rPropertyNames,
    2262             :     const uno::Sequence< uno::Any >& rValues )
    2263             :         throw(beans::PropertyVetoException, lang::IllegalArgumentException,
    2264             :                 lang::WrappedTargetException, uno::RuntimeException, std::exception)
    2265             : {
    2266       13282 :     SolarMutexGuard aGuard;
    2267             : 
    2268             :     // workaround for bad designed API
    2269             :     try
    2270             :     {
    2271       13282 :         SetPropertyValues_Impl( rPropertyNames, rValues );
    2272             :     }
    2273         257 :     catch (const beans::UnknownPropertyException &rException)
    2274             :     {
    2275             :         // wrap the original (here not allowed) exception in
    2276             :         // a lang::WrappedTargetException that gets thrown instead.
    2277         257 :         lang::WrappedTargetException aWExc;
    2278         257 :         aWExc.TargetException <<= rException;
    2279         257 :         throw aWExc;
    2280       13282 :     }
    2281       13009 : }
    2282             : 
    2283       31830 : static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
    2284             :                         const SfxItemPropertySet& rPropSet,
    2285             :                         SwStyleBase_Impl& rBase,
    2286             :                         SfxStyleSheetBase* pBase,
    2287             :                         SfxStyleFamily eFamily,
    2288             :                         SwDoc *pDoc) throw(uno::RuntimeException)
    2289             : {
    2290       31830 :     uno::Any aRet;
    2291             : 
    2292       31830 :     if(FN_UNO_IS_PHYSICAL == rEntry.nWID)
    2293             :     {
    2294        5330 :         sal_Bool bPhys = pBase != 0;
    2295        5330 :         if(pBase)
    2296             :         {
    2297        5330 :             bPhys = ((SwDocStyleSheet*)pBase)->IsPhysical();
    2298             :             // The standard character format is not existing physically
    2299        6171 :             if( bPhys && SFX_STYLE_FAMILY_CHAR == eFamily &&
    2300        5504 :                 ((SwDocStyleSheet*)pBase)->GetCharFmt() &&
    2301          87 :                 ((SwDocStyleSheet*)pBase)->GetCharFmt()->IsDefault() )
    2302          21 :                 bPhys = sal_False;
    2303             :         }
    2304        5330 :         aRet.setValue(&bPhys, ::getBooleanCppuType());
    2305             :     }
    2306       26500 :     else if (FN_UNO_HIDDEN == rEntry.nWID)
    2307             :     {
    2308         316 :         sal_Bool bHidden = sal_False;
    2309         316 :         if(pBase)
    2310             :         {
    2311         316 :             rtl::Reference< SwDocStyleSheet > xBase( new SwDocStyleSheet(*(SwDocStyleSheet*)pBase) );
    2312         316 :             bHidden = xBase->IsHidden();
    2313             :         }
    2314         316 :         aRet.setValue(&bHidden, ::getBooleanCppuType());
    2315             :     }
    2316       26184 :     else if (FN_UNO_STYLE_INTEROP_GRAB_BAG == rEntry.nWID)
    2317             :     {
    2318           9 :         if (pBase)
    2319             :         {
    2320           9 :             rtl::Reference<SwDocStyleSheet> xBase(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase));
    2321           9 :             xBase->GetGrabBagItem(aRet);
    2322             :         }
    2323             :     }
    2324       26175 :     else if(pBase)
    2325             :     {
    2326       26175 :         if(!rBase.mxNewBase.is())
    2327             :         {
    2328       22549 :             rBase.mxNewBase = new SwDocStyleSheet( *(SwDocStyleSheet*)pBase );
    2329             :         }
    2330             : 
    2331             :         //UUUU
    2332       26175 :         const sal_uInt8 nMemberId(rEntry.nMemberId & (~SFX_METRIC_ITEM));
    2333             : 
    2334             :         //UUUU adapted switch logic to a more readable state; removed goto's and made
    2335             :         // execution of standard setting of proerty in ItemSet dependent of this variable
    2336       26175 :         bool bDone(false);
    2337             : 
    2338       26175 :         switch(rEntry.nWID)
    2339             :         {
    2340             :             case RES_PAPER_BIN:
    2341             :             {
    2342           2 :                 SfxItemSet& rSet = rBase.GetItemSet();
    2343           2 :                 rPropSet.getPropertyValue(rEntry, rSet, aRet);
    2344           2 :                 sal_Int8 nBin = 0;
    2345           2 :                 aRet >>= nBin;
    2346           2 :                 if ( nBin == -1 )
    2347           2 :                     aRet <<= OUString( "[From printer settings]" );
    2348             :                 else
    2349             :                 {
    2350           0 :                     SfxPrinter *pPrinter = pDoc->getPrinter( false );
    2351           0 :                     OUString sTmp;
    2352           0 :                     if (pPrinter )
    2353           0 :                         sTmp = pPrinter->GetPaperBinName ( nBin );
    2354           0 :                     aRet <<= sTmp;
    2355             :                 }
    2356             : 
    2357           2 :                 bDone = true;
    2358           2 :                 break;
    2359             :             }
    2360             :             case  FN_UNO_NUM_RULES: //Sonderbehandlung fuer das SvxNumRuleItem:
    2361             :             {
    2362       14943 :                 const SwNumRule* pRule = rBase.mxNewBase->GetNumRule();
    2363             :                 OSL_ENSURE(pRule, "Wo ist die NumRule?");
    2364       14943 :                 uno::Reference< container::XIndexReplace >  xRules = new SwXNumberingRules(*pRule, pDoc);
    2365             : 
    2366       14943 :                 aRet.setValue(&xRules, ::getCppuType((uno::Reference<container::XIndexReplace>*)0));
    2367       14943 :                 bDone = true;
    2368       14943 :                 break;
    2369             :             }
    2370             :             break;
    2371             :             case RES_PARATR_OUTLINELEVEL:
    2372             :             {
    2373             :                 OSL_ENSURE( SFX_STYLE_FAMILY_PARA == eFamily, "only paras" );
    2374          45 :                 int nLevel = rBase.mxNewBase->GetCollection()->GetAttrOutlineLevel();
    2375          45 :                 aRet <<= static_cast<sal_Int16>( nLevel );
    2376          45 :                 bDone = true;
    2377          45 :                 break;
    2378             :             }
    2379             :             case FN_UNO_FOLLOW_STYLE:
    2380             :             {
    2381        1429 :                 OUString aString;
    2382        1429 :                 SwStyleNameMapper::FillProgName(rBase.mxNewBase->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true);
    2383        1429 :                 aRet <<= aString;
    2384        1429 :                 bDone = true;
    2385        1429 :                 break;
    2386             :             }
    2387             :             case RES_PAGEDESC :
    2388             :             {
    2389             :                 // Sonderbehandlung RES_PAGEDESC
    2390             :                 const SfxPoolItem* pItem;
    2391           4 :                 if(SFX_ITEM_SET == rBase.GetItemSet().GetItemState( RES_PAGEDESC, true, &pItem ) )
    2392             :                 {
    2393           0 :                     const SwPageDesc* pDesc = ((const SwFmtPageDesc*)pItem)->GetPageDesc();
    2394           0 :                     if(pDesc)
    2395             :                     {
    2396           0 :                         OUString aString;
    2397           0 :                         SwStyleNameMapper::FillProgName(pDesc->GetName(), aString,  nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, true );
    2398           0 :                         aRet <<= aString;
    2399             :                     }
    2400             : 
    2401           0 :                     bDone = true;
    2402             :                 }
    2403             : 
    2404           4 :                 break;
    2405             :             }
    2406             :             case FN_UNO_IS_AUTO_UPDATE:
    2407             :             {
    2408         183 :                 sal_Bool bAuto = sal_False;
    2409         183 :                 if(SFX_STYLE_FAMILY_PARA == eFamily)
    2410         172 :                     bAuto = rBase.mxNewBase->GetCollection()->IsAutoUpdateFmt();
    2411          11 :                 else if(SFX_STYLE_FAMILY_FRAME == eFamily)
    2412          11 :                     bAuto = rBase.mxNewBase->GetFrmFmt()->IsAutoUpdateFmt();
    2413         183 :                 aRet.setValue(&bAuto, ::getBooleanCppuType());
    2414             : 
    2415         183 :                 bDone = true;
    2416         183 :                 break;
    2417             :             }
    2418             :             case FN_UNO_DISPLAY_NAME:
    2419             :             {
    2420        2856 :                 OUString sName(rBase.mxNewBase->GetDisplayName());
    2421        2856 :                 aRet <<= sName;
    2422             : 
    2423        2856 :                 bDone = true;
    2424        2856 :                 break;
    2425             :             }
    2426             :             case FN_UNO_PARA_STYLE_CONDITIONS:
    2427             :             {
    2428             :                 OSL_ENSURE(COND_COMMAND_COUNT == 28,
    2429             :                         "invalid size of comman count?");
    2430           2 :                 uno::Sequence< beans::NamedValue > aSeq(COND_COMMAND_COUNT);
    2431           2 :                 beans::NamedValue *pSeq = aSeq.getArray();
    2432             : 
    2433           2 :                 SwFmt *pFmt = ((SwDocStyleSheet*)pBase)->GetCollection();
    2434           2 :                 const CommandStruct *pCmds = SwCondCollItem::GetCmds();
    2435          58 :                 for (sal_uInt16 n = 0;  n < COND_COMMAND_COUNT;  ++n)
    2436             :                 {
    2437          56 :                     OUString aStyleName;
    2438             : 
    2439          56 :                     const SwCollCondition* pCond = 0;
    2440         224 :                     if( pFmt && RES_CONDTXTFMTCOLL == pFmt->Which() &&
    2441             :                         0 != ( pCond = ((SwConditionTxtFmtColl*)pFmt)->
    2442         168 :                         HasCondition( SwCollCondition( 0, pCmds[n].nCnd, pCmds[n].nSubCond ) ) )
    2443          56 :                         && pCond->GetTxtFmtColl() )
    2444             :                     {
    2445             :                         // get programmatic style name from UI style name
    2446           0 :                         aStyleName = pCond->GetTxtFmtColl()->GetName();
    2447           0 :                         SwStyleNameMapper::FillProgName(aStyleName, aStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), true);
    2448             :                     }
    2449             : 
    2450          56 :                     pSeq[n].Name  = GetCommandContextByIndex(n);
    2451          56 :                     pSeq[n].Value <<= aStyleName;
    2452          56 :                 }
    2453           2 :                 aRet <<= aSeq;
    2454             : 
    2455           2 :                 bDone = true;
    2456           2 :                 break;
    2457             :             }
    2458             :             case FN_UNO_CATEGORY:
    2459             :             {
    2460         172 :                 sal_uInt16 nPoolId = rBase.mxNewBase->GetCollection()->GetPoolFmtId();
    2461         172 :                 short nRet = -1;
    2462             : 
    2463         172 :                 switch ( COLL_GET_RANGE_BITS & nPoolId )
    2464             :                 {
    2465             :                     case COLL_TEXT_BITS:
    2466          65 :                         nRet = style::ParagraphStyleCategory::TEXT;
    2467          65 :                         break;
    2468             :                     case COLL_DOC_BITS:
    2469           0 :                         nRet = style::ParagraphStyleCategory::CHAPTER;
    2470           0 :                         break;
    2471             :                     case COLL_LISTS_BITS:
    2472          20 :                         nRet = style::ParagraphStyleCategory::LIST;
    2473          20 :                         break;
    2474             :                     case COLL_REGISTER_BITS:
    2475          27 :                         nRet = style::ParagraphStyleCategory::INDEX;
    2476          27 :                         break;
    2477             :                     case COLL_EXTRA_BITS:
    2478          30 :                         nRet = style::ParagraphStyleCategory::EXTRA;
    2479          30 :                         break;
    2480             :                     case COLL_HTML_BITS:
    2481           0 :                         nRet = style::ParagraphStyleCategory::HTML;
    2482           0 :                         break;
    2483             :                 }
    2484             : 
    2485         172 :                 aRet <<= nRet;
    2486         172 :                 bDone = true;
    2487         172 :                 break;
    2488             :             }
    2489             :             case SID_SWREGISTER_COLLECTION:
    2490             :             {
    2491           2 :                 const SwPageDesc *pPageDesc = rBase.mxNewBase->GetPageDesc();
    2492           2 :                 const SwTxtFmtColl* pCol = 0;
    2493           2 :                 OUString aString;
    2494           2 :                 if( pPageDesc )
    2495           2 :                     pCol = pPageDesc->GetRegisterFmtColl();
    2496           2 :                 if( pCol )
    2497             :                     SwStyleNameMapper::FillProgName(
    2498           0 :                                 pCol->GetName(), aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true );
    2499           2 :                 aRet <<= aString;
    2500           2 :                 bDone = true;
    2501           2 :                 break;
    2502             :             }
    2503             :             case RES_BACKGROUND:
    2504             :             {
    2505          26 :                 if (SFX_STYLE_FAMILY_FRAME == eFamily)
    2506             :                 {
    2507             :                     //UUUU
    2508           0 :                     const SfxItemSet& rSet = rBase.GetItemSet();
    2509           0 :                     const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet));
    2510             : 
    2511           0 :                     if(!aOriginalBrushItem.QueryValue(aRet, nMemberId))
    2512             :                     {
    2513             :                         OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
    2514             :                     }
    2515             : 
    2516           0 :                     bDone = true;
    2517             :                 }
    2518          26 :                 break;
    2519             :             }
    2520             :             case OWN_ATTR_FILLBMP_MODE:
    2521             :             {
    2522             :                 //UUUU
    2523           0 :                 const SfxItemSet& rSet = rBase.GetItemSet();
    2524           0 :                 const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&rSet.Get(XATTR_FILLBMP_STRETCH));
    2525           0 :                 const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&rSet.Get(XATTR_FILLBMP_TILE));
    2526             : 
    2527           0 :                 if( pTileItem && pTileItem->GetValue() )
    2528             :                 {
    2529           0 :                     aRet <<= drawing::BitmapMode_REPEAT;
    2530             :                 }
    2531           0 :                 else if( pStretchItem && pStretchItem->GetValue() )
    2532             :                 {
    2533           0 :                     aRet <<= drawing::BitmapMode_STRETCH;
    2534             :                 }
    2535             :                 else
    2536             :                 {
    2537           0 :                     aRet <<= drawing::BitmapMode_NO_REPEAT;
    2538             :                 }
    2539             : 
    2540           0 :                 bDone = true;
    2541           0 :                 break;
    2542             :             }
    2543             :             default:
    2544             :             {
    2545             :                 // nothing to do as default
    2546        6511 :                 break;
    2547             :             }
    2548             :         }
    2549             : 
    2550       26175 :         if(!bDone)
    2551             :         {
    2552        6541 :             SfxItemSet& rSet = rBase.GetItemSet();
    2553        6541 :             rPropSet.getPropertyValue(rEntry, rSet, aRet);
    2554             : 
    2555             :             //UUUU
    2556        6541 :             if(rEntry.aType == ::getCppuType((const sal_Int16*)0) && rEntry.aType != aRet.getValueType())
    2557             :             {
    2558             :                 // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
    2559         396 :                 sal_Int32 nValue = 0;
    2560         396 :                 if (aRet >>= nValue)
    2561          16 :                     aRet <<= (sal_Int16)nValue;
    2562             :             }
    2563             : 
    2564             :             //UUUU check for needed metric translation
    2565        6541 :             if(rEntry.nMemberId & SFX_METRIC_ITEM)
    2566             :             {
    2567           0 :                 bool bDoIt(true);
    2568             : 
    2569           0 :                 if(XATTR_FILLBMP_SIZEX == rEntry.nWID || XATTR_FILLBMP_SIZEY == rEntry.nWID)
    2570             :                 {
    2571             :                     // exception: If these ItemTypes are used, do not convert when these are negative
    2572             :                     // since this means they are intended as percent values
    2573           0 :                     sal_Int32 nValue = 0;
    2574             : 
    2575           0 :                     if(aRet >>= nValue)
    2576             :                     {
    2577           0 :                         bDoIt = nValue > 0;
    2578             :                     }
    2579             :                 }
    2580             : 
    2581           0 :                 if(bDoIt && pDoc)
    2582             :                 {
    2583           0 :                     const SfxItemPool& rPool = pDoc->GetAttrPool();
    2584           0 :                     const SfxMapUnit eMapUnit(rPool.GetMetric(rEntry.nWID));
    2585             : 
    2586           0 :                     if(eMapUnit != SFX_MAPUNIT_100TH_MM)
    2587             :                     {
    2588           0 :                         SvxUnoConvertToMM(eMapUnit, aRet);
    2589             :                     }
    2590             :                 }
    2591             :             }
    2592             :         }
    2593             :     }
    2594             :     else
    2595             :     {
    2596           0 :         throw uno::RuntimeException();
    2597             :     }
    2598             : 
    2599       31830 :     return aRet;
    2600             : }
    2601             : 
    2602       27084 : uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl(
    2603             :         const uno::Sequence< OUString > & rPropertyNames )
    2604             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    2605             : {
    2606       27084 :     if ( !m_pDoc )
    2607           0 :         throw uno::RuntimeException();
    2608       27084 :     sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;
    2609       27084 :     switch(eFamily)
    2610             :     {
    2611        8552 :         case SFX_STYLE_FAMILY_PARA  : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
    2612        2031 :         case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break;
    2613           0 :         case SFX_STYLE_FAMILY_PAGE  : nPropSetId = PROPERTY_MAP_PAGE_STYLE  ;break;
    2614       15242 :         case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE   ;break;
    2615             :         default:
    2616             :             ;
    2617             :     }
    2618       27084 :     const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    2619       27084 :     const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap();
    2620             : 
    2621       27084 :     const OUString* pNames = rPropertyNames.getConstArray();
    2622       27084 :     uno::Sequence< uno::Any > aRet(rPropertyNames.getLength());
    2623       27084 :     uno::Any* pRet = aRet.getArray();
    2624       54168 :     SwStyleBase_Impl aBase(*m_pDoc, m_sStyleName);
    2625       27084 :     SfxStyleSheetBase* pBase = 0;
    2626       57408 :     for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
    2627             :     {
    2628       30325 :         const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp]);
    2629       60650 :         if(!pEntry ||
    2630       59443 :            (!bIsConditional && pNames[nProp] == UNO_NAME_PARA_STYLE_CONDITIONS))
    2631           1 :             throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
    2632       30324 :         if(pBasePool)
    2633             :         {
    2634       30324 :             if(!pBase)
    2635             :             {
    2636       27083 :                 sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
    2637       27083 :                 pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
    2638       27083 :                 pBase = pBasePool->Find(m_sStyleName);
    2639       27083 :                 pBasePool->SetSearchMask(eFamily, nSaveMask );
    2640             :             }
    2641       30324 :             pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, eFamily, GetDoc() );
    2642             :         }
    2643           0 :         else if(bIsDescriptor)
    2644             :         {
    2645           0 :             uno::Any *pAny = 0;
    2646           0 :             pPropImpl->GetProperty ( pNames[nProp], pAny );
    2647           0 :             if( !pAny )
    2648             :             {
    2649           0 :                 bool bExcept = false;
    2650           0 :                 switch( eFamily )
    2651             :                 {
    2652             :                     case SFX_STYLE_FAMILY_PSEUDO:
    2653           0 :                         bExcept = true;
    2654           0 :                     break;
    2655             :                     case SFX_STYLE_FAMILY_PARA:
    2656             :                     case SFX_STYLE_FAMILY_PAGE:
    2657           0 :                         pPropImpl->GetProperty ( pNames[nProp], mxStyleData, pRet[ nProp ] );
    2658           0 :                     break;
    2659             :                     case SFX_STYLE_FAMILY_CHAR:
    2660             :                     case SFX_STYLE_FAMILY_FRAME :
    2661             :                     {
    2662           0 :                         if (pEntry->nWID >= POOLATTR_BEGIN && pEntry->nWID < RES_UNKNOWNATR_END )
    2663             :                         {
    2664             :                             SwFmt * pFmt;
    2665           0 :                             if ( eFamily == SFX_STYLE_FAMILY_CHAR )
    2666           0 :                                 pFmt = m_pDoc->GetDfltCharFmt();
    2667             :                             else
    2668           0 :                                 pFmt = m_pDoc->GetDfltFrmFmt();
    2669           0 :                             const SwAttrPool * pPool = pFmt->GetAttrSet().GetPool();
    2670           0 :                             const SfxPoolItem & rItem = pPool->GetDefaultItem ( pEntry->nWID );
    2671           0 :                             rItem.QueryValue ( pRet[nProp], pEntry->nMemberId );
    2672             :                         }
    2673             :                         else
    2674           0 :                             bExcept = true;
    2675             :                     }
    2676           0 :                     break;
    2677             : 
    2678             :                     default:
    2679             :                         ;
    2680             :                 }
    2681           0 :                 if (bExcept )
    2682             :                 {
    2683           0 :                     uno::RuntimeException aExcept;
    2684           0 :                     aExcept.Message = "No default value for: " + pNames[nProp];
    2685           0 :                     throw aExcept;
    2686             :                 }
    2687             :             }
    2688             :             else
    2689           0 :                 pRet [ nProp ] = *pAny;
    2690             :         }
    2691             :         else
    2692           0 :             throw uno::RuntimeException();
    2693             :     }
    2694       54166 :     return aRet;
    2695             : }
    2696             : 
    2697         434 : uno::Sequence< uno::Any > SwXStyle::getPropertyValues(
    2698             :     const uno::Sequence< OUString >& rPropertyNames ) throw(uno::RuntimeException, std::exception)
    2699             : {
    2700         434 :     SolarMutexGuard aGuard;
    2701         434 :     uno::Sequence< uno::Any > aValues;
    2702             : 
    2703             :     // workaround for bad designed API
    2704             :     try
    2705             :     {
    2706         434 :         aValues = GetPropertyValues_Impl( rPropertyNames );
    2707             :     }
    2708           0 :     catch (beans::UnknownPropertyException &)
    2709             :     {
    2710           0 :         throw uno::RuntimeException("Unknown property exception caught", static_cast < cppu::OWeakObject * > ( this ) );
    2711             :     }
    2712           0 :     catch (lang::WrappedTargetException &)
    2713             :     {
    2714           0 :         throw uno::RuntimeException("WrappedTargetException caught", static_cast < cppu::OWeakObject * > ( this ) );
    2715             :     }
    2716             : 
    2717         434 :     return aValues;
    2718             : }
    2719             : 
    2720           3 : void SwXStyle::addPropertiesChangeListener(
    2721             :     const uno::Sequence< OUString >& /*aPropertyNames*/,
    2722             :     const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
    2723             :         throw(uno::RuntimeException, std::exception)
    2724             : {
    2725           3 : }
    2726             : 
    2727           0 : void SwXStyle::removePropertiesChangeListener(
    2728             :     const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
    2729             :         throw(uno::RuntimeException, std::exception)
    2730             : {
    2731           0 : }
    2732             : 
    2733           0 : void SwXStyle::firePropertiesChangeEvent(
    2734             :     const uno::Sequence< OUString >& /*aPropertyNames*/,
    2735             :     const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
    2736             :         throw(uno::RuntimeException, std::exception)
    2737             : {
    2738           0 : }
    2739             : 
    2740      201731 : void SwXStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue)
    2741             :     throw( beans::UnknownPropertyException,
    2742             :         beans::PropertyVetoException,
    2743             :         lang::IllegalArgumentException,
    2744             :         lang::WrappedTargetException,
    2745             :         uno::RuntimeException, std::exception)
    2746             : {
    2747      201731 :     SolarMutexGuard aGuard;
    2748      403462 :     const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
    2749      403462 :     const uno::Sequence<uno::Any> aValues(&rValue, 1);
    2750      403462 :     SetPropertyValues_Impl( aProperties, aValues );
    2751      201584 : }
    2752             : 
    2753       26650 : uno::Any SwXStyle::getPropertyValue(const OUString& rPropertyName)
    2754             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    2755             : {
    2756       26650 :     SolarMutexGuard aGuard;
    2757       53300 :     const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
    2758       53300 :     return GetPropertyValues_Impl(aProperties).getConstArray()[0];
    2759             : 
    2760             : }
    2761             : 
    2762           0 : void SwXStyle::addPropertyChangeListener(const OUString& /*rPropertyName*/,
    2763             :     const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
    2764             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    2765             : {
    2766             :     OSL_FAIL("not implemented");
    2767           0 : }
    2768             : 
    2769           0 : void SwXStyle::removePropertyChangeListener(const OUString& /*rPropertyName*/,
    2770             :     const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
    2771             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    2772             : {
    2773             :     OSL_FAIL("not implemented");
    2774           0 : }
    2775             : 
    2776           0 : void SwXStyle::addVetoableChangeListener(const OUString& /*rPropertyName*/,
    2777             :     const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
    2778             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    2779             : {
    2780             :     OSL_FAIL("not implemented");
    2781           0 : }
    2782             : 
    2783           0 : void SwXStyle::removeVetoableChangeListener(const OUString& /*rPropertyName*/,
    2784             :     const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
    2785             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    2786             : {
    2787             :     OSL_FAIL("not implemented");
    2788           0 : }
    2789             : 
    2790         584 : beans::PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName)
    2791             :         throw( beans::UnknownPropertyException, uno::RuntimeException, std::exception )
    2792             : {
    2793         584 :     SolarMutexGuard aGuard;
    2794             : 
    2795        1168 :     uno::Sequence< OUString > aNames(1);
    2796         584 :     OUString* pNames = aNames.getArray();
    2797         584 :     pNames[0] = rPropertyName;
    2798        1168 :     uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aNames);
    2799        1168 :     return aStates.getConstArray()[0];
    2800             : }
    2801             : 
    2802         859 : uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates(
    2803             :     const uno::Sequence< OUString >& rPropertyNames)
    2804             :         throw( beans::UnknownPropertyException, uno::RuntimeException, std::exception )
    2805             : {
    2806         859 :     SolarMutexGuard aGuard;
    2807         859 :     uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength());
    2808         859 :     beans::PropertyState* pStates = aRet.getArray();
    2809         859 :     if(pBasePool)
    2810             :     {
    2811         859 :         pBasePool->SetSearchMask(eFamily );
    2812         859 :         SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    2813             :         OSL_ENSURE(pBase, "where is the style?" );
    2814             : 
    2815         859 :         if(pBase)
    2816             :         {
    2817         859 :             const OUString* pNames = rPropertyNames.getConstArray();
    2818         859 :             rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
    2819         859 :             sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;
    2820         859 :             switch(eFamily)
    2821             :             {
    2822         755 :                 case SFX_STYLE_FAMILY_PARA  : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
    2823          11 :                 case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break;
    2824          27 :                 case SFX_STYLE_FAMILY_PAGE  : nPropSetId = PROPERTY_MAP_PAGE_STYLE;   break;
    2825           0 :                 case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE   ;break;
    2826             :                 default:
    2827             :                     ;
    2828             :             }
    2829         859 :             const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    2830         859 :             const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap();
    2831             : 
    2832         859 :             SfxItemSet aSet = xStyle->GetItemSet();
    2833       30895 :             for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
    2834             :             {
    2835       30036 :                 const OUString sPropName = pNames[i];
    2836       30036 :                 const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(sPropName);
    2837       30036 :                 if(!pEntry)
    2838           0 :                     throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) );
    2839       60072 :                 if( FN_UNO_NUM_RULES ==  pEntry->nWID ||
    2840       30036 :                     FN_UNO_FOLLOW_STYLE == pEntry->nWID )
    2841             :                 {
    2842           6 :                     pStates[i] = beans::PropertyState_DIRECT_VALUE;
    2843             :                 }
    2844       33367 :                 else if(SFX_STYLE_FAMILY_PAGE == eFamily &&
    2845        4044 :                         (sPropName.startsWith("Header") || sPropName.startsWith("Footer")))
    2846             :                 {
    2847        1052 :                     sal_uInt16 nResId = lcl_ConvertFNToRES(pEntry->nWID);
    2848        1052 :                     sal_Bool bFooter = sPropName.startsWith("Footer");
    2849             :                     const SvxSetItem* pSetItem;
    2850        1052 :                     if(SFX_ITEM_SET == aSet.GetItemState(
    2851             :                             bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
    2852        1052 :                             false, (const SfxPoolItem**)&pSetItem))
    2853             :                     {
    2854          80 :                         const SfxItemSet& rSet = pSetItem->GetItemSet();
    2855          80 :                         SfxItemState eState = rSet.GetItemState(nResId, false);
    2856          80 :                         if(SFX_ITEM_SET == eState)
    2857          20 :                             pStates[i] = beans::PropertyState_DIRECT_VALUE;
    2858             :                         else
    2859          60 :                             pStates[i] = beans::PropertyState_DEFAULT_VALUE;
    2860             :                     }
    2861             :                     else
    2862         972 :                         pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
    2863             :                 }
    2864             :                 else
    2865             :                 {
    2866       28978 :                     pStates[i] = pPropSet->getPropertyState(*pEntry, aSet);
    2867       30211 :                     if( SFX_STYLE_FAMILY_PAGE == eFamily &&
    2868        1287 :                         SID_ATTR_PAGE_SIZE == pEntry->nWID &&
    2869          54 :                         beans::PropertyState_DIRECT_VALUE == pStates[i] )
    2870             :                     {
    2871             :                         const SvxSizeItem& rSize =
    2872             :                             static_cast < const SvxSizeItem& >(
    2873          54 :                                     aSet.Get(SID_ATTR_PAGE_SIZE) );
    2874          54 :                         sal_uInt8 nMemberId = pEntry->nMemberId & 0x7f;
    2875         108 :                         if( ( LONG_MAX == rSize.GetSize().Width() &&
    2876           0 :                               (MID_SIZE_WIDTH == nMemberId ||
    2877         108 :                                MID_SIZE_SIZE == nMemberId ) ) ||
    2878          54 :                             ( LONG_MAX == rSize.GetSize().Height() &&
    2879             :                               MID_SIZE_HEIGHT == nMemberId ) )
    2880             :                         {
    2881           0 :                             pStates[i] = beans::PropertyState_DEFAULT_VALUE;
    2882             :                         }
    2883             :                     }
    2884             :                 }
    2885       30895 :             }
    2886             :         }
    2887             :         else
    2888           0 :             throw uno::RuntimeException();
    2889             :     }
    2890             :     else
    2891           0 :         throw uno::RuntimeException();
    2892         859 :     return aRet;
    2893             : }
    2894             : 
    2895        7893 : void SwXStyle::setPropertyToDefault(const OUString& rPropertyName)
    2896             :         throw( beans::UnknownPropertyException, uno::RuntimeException, std::exception )
    2897             : {
    2898        7893 :     const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );
    2899        7893 :     setPropertiesToDefault ( aSequence );
    2900        7893 : }
    2901             : 
    2902        7897 : void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames )
    2903             :     throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    2904             : {
    2905        7897 :     SolarMutexGuard aGuard;
    2906        7897 :     SwFmt *pTargetFmt = 0;
    2907             : 
    2908        7897 :     if(pBasePool)
    2909             :     {
    2910        7897 :         pBasePool->SetSearchMask(eFamily);
    2911        7897 :         SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    2912             :         OSL_ENSURE(pBase, "Where is the style?");
    2913             : 
    2914        7897 :         if(pBase)
    2915             :         {
    2916        7897 :             rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
    2917        7897 :             switch(eFamily)
    2918             :             {
    2919           1 :                 case SFX_STYLE_FAMILY_CHAR: pTargetFmt = xStyle->GetCharFmt(); break;
    2920        7895 :                 case SFX_STYLE_FAMILY_PARA: pTargetFmt = xStyle->GetCollection(); break;
    2921           0 :                 case SFX_STYLE_FAMILY_FRAME: pTargetFmt = xStyle->GetFrmFmt(); break;
    2922             :                 case SFX_STYLE_FAMILY_PAGE:
    2923             :                     {
    2924           1 :                         sal_uInt16 nPgDscPos = USHRT_MAX;
    2925           1 :                         SwPageDesc *pDesc = m_pDoc->FindPageDescByName( xStyle->GetPageDesc()->GetName(), &nPgDscPos );
    2926           1 :                         if( pDesc )
    2927           1 :                             pTargetFmt = &pDesc->GetMaster();
    2928             :                     }
    2929           1 :                     break;
    2930             :                 case SFX_STYLE_FAMILY_PSEUDO:
    2931           0 :                     break;
    2932             :                 default:
    2933             :                     ;
    2934        7897 :             }
    2935             :         }
    2936             :     }
    2937        7897 :     sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;
    2938        7897 :     switch(eFamily)
    2939             :     {
    2940        7895 :         case SFX_STYLE_FAMILY_PARA  : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
    2941           0 :         case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break;
    2942           1 :         case SFX_STYLE_FAMILY_PAGE  : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break;
    2943           0 :         case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break;
    2944             :         default:
    2945             :             ;
    2946             :     }
    2947        7897 :     const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    2948        7897 :     const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap();
    2949             : 
    2950        7897 :     const OUString* pNames = aPropertyNames.getConstArray();
    2951             : 
    2952        7897 :     if ( pTargetFmt )
    2953             :     {
    2954       15794 :         for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ )
    2955             :         {
    2956        7897 :             const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] );
    2957        7897 :             if( !pEntry )
    2958           0 :                 throw beans::UnknownPropertyException ( OUString( "Property is unknown: " ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
    2959        7897 :             if ( pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_NUM_RULES )
    2960           0 :                 throw uno::RuntimeException ("Cannot reset: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
    2961        7897 :             if ( pEntry->nFlags & beans::PropertyAttribute::READONLY )
    2962           0 :                 throw uno::RuntimeException("setPropertiesToDefault: property is read-only: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
    2963             : 
    2964        7897 :             if( pEntry->nWID == RES_PARATR_OUTLINELEVEL )
    2965           0 :                 static_cast<SwTxtFmtColl*>(pTargetFmt)->DeleteAssignmentToListLevelOfOutlineStyle();
    2966             :             else
    2967        7897 :                 pTargetFmt->ResetFmtAttr( pEntry->nWID );
    2968             :         }
    2969             :     }
    2970           0 :     else if ( bIsDescriptor )
    2971             :     {
    2972           0 :         for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ )
    2973           0 :             pPropImpl->ClearProperty ( pNames[ nProp ] );
    2974        7897 :     }
    2975        7897 : }
    2976             : 
    2977        1686 : void SAL_CALL SwXStyle::setAllPropertiesToDefault(  )
    2978             :     throw (uno::RuntimeException, std::exception)
    2979             : {
    2980        1686 :     SolarMutexGuard aGuard;
    2981        1686 :     if(pBasePool)
    2982             :     {
    2983        1686 :         pBasePool->SetSearchMask(eFamily);
    2984        1686 :         SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    2985             :         OSL_ENSURE(pBase, "where is the style, you fiend!?");
    2986             : 
    2987        1686 :         if(pBase)
    2988             :         {
    2989        1686 :             rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
    2990             : 
    2991        1686 :             SwFmt *pTargetFmt = 0;
    2992        1686 :             sal_uInt16 nPgDscPos = USHRT_MAX;
    2993        1686 :             switch( eFamily )
    2994             :             {
    2995             :             case SFX_STYLE_FAMILY_CHAR :
    2996         239 :                 pTargetFmt = xStyle->GetCharFmt();
    2997         239 :                 break;
    2998             :             case SFX_STYLE_FAMILY_PARA :
    2999             :                 {
    3000        1015 :                     pTargetFmt = xStyle->GetCollection();
    3001        1015 :                     if ( xStyle->GetCollection() )
    3002        1015 :                         xStyle->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle();
    3003             :                 }
    3004        1015 :                 break;
    3005             :             case SFX_STYLE_FAMILY_FRAME:
    3006         217 :                 pTargetFmt = xStyle->GetFrmFmt();
    3007         217 :                 break;
    3008             :             case SFX_STYLE_FAMILY_PAGE:
    3009             :                 {
    3010         215 :                     SwPageDesc *pDesc = m_pDoc->FindPageDescByName( xStyle->GetPageDesc()->GetName(), &nPgDscPos );
    3011         215 :                     if( pDesc )
    3012             :                     {
    3013         215 :                         pTargetFmt = &pDesc->GetMaster();
    3014         215 :                         pDesc->SetUseOn ( nsUseOnPage::PD_ALL );
    3015             :                     }
    3016             :                 }
    3017         215 :                 break;
    3018             :             case SFX_STYLE_FAMILY_PSEUDO:
    3019           0 :                 break;
    3020             : 
    3021             :             default:
    3022             :                 ;
    3023             :             }
    3024        1686 :             if( pTargetFmt )
    3025             :             {
    3026        1686 :                 if( USHRT_MAX != nPgDscPos )
    3027             :                 {
    3028         215 :                     SwPageDesc& rPageDesc = m_pDoc->GetPageDesc(nPgDscPos);
    3029         215 :                     rPageDesc.ResetAllMasterAttr();
    3030             : 
    3031         215 :                     SvxLRSpaceItem aLR(RES_LR_SPACE);
    3032         215 :                     sal_Int32 nSize = GetMetricVal ( CM_1) * 2;
    3033         215 :                     aLR.SetLeft ( nSize );
    3034         215 :                     aLR.SetLeft ( nSize );
    3035         430 :                     SvxULSpaceItem aUL( RES_UL_SPACE );
    3036         215 :                     aUL.SetUpper ( static_cast < sal_uInt16 > ( nSize ) );
    3037         215 :                     aUL.SetLower ( static_cast < sal_uInt16 > ( nSize ) );
    3038         215 :                     pTargetFmt->SetFmtAttr( aLR );
    3039         215 :                     pTargetFmt->SetFmtAttr( aUL );
    3040             : 
    3041         215 :                     SwPageDesc* pStdPgDsc = m_pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
    3042         430 :                     SwFmtFrmSize aFrmSz( ATT_FIX_SIZE );
    3043         215 :                     if( RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFmtId() )
    3044             :                     {
    3045         115 :                         if( m_pDoc->getPrinter( false ) )
    3046             :                         {
    3047             :                             const Size aPhysSize( SvxPaperInfo::GetPaperSize(
    3048           6 :                                         static_cast<Printer*>( m_pDoc->getPrinter( false ) )) );
    3049           6 :                             aFrmSz.SetSize( aPhysSize );
    3050             :                         }
    3051             :                         else
    3052         109 :                             aFrmSz.SetSize( SvxPaperInfo::GetDefaultPaperSize() );
    3053             : 
    3054             :                     }
    3055             :                     else
    3056             :                     {
    3057         100 :                         aFrmSz = pStdPgDsc->GetMaster().GetFrmSize();
    3058             :                     }
    3059         215 :                     if( pStdPgDsc->GetLandscape() )
    3060             :                     {
    3061           0 :                         SwTwips nTmp = aFrmSz.GetHeight();
    3062           0 :                         aFrmSz.SetHeight( aFrmSz.GetWidth() );
    3063           0 :                         aFrmSz.SetWidth( nTmp );
    3064             :                     }
    3065         430 :                     pTargetFmt->SetFmtAttr( aFrmSz );
    3066             :                 }
    3067             :                 else
    3068        1471 :                     pTargetFmt->ResetAllFmtAttr();
    3069             : 
    3070        1686 :                 if( USHRT_MAX != nPgDscPos )
    3071         215 :                     m_pDoc->ChgPageDesc( nPgDscPos, m_pDoc->GetPageDesc(nPgDscPos) );
    3072        1686 :             }
    3073             : 
    3074             :         }
    3075             :         else
    3076           0 :             throw uno::RuntimeException();
    3077             :     }
    3078           0 :     else if ( bIsDescriptor )
    3079           0 :         pPropImpl->ClearAllProperties();
    3080             :     else
    3081           0 :         throw uno::RuntimeException();
    3082        1686 : }
    3083             : 
    3084           4 : uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames )
    3085             :     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    3086             : {
    3087           4 :     SolarMutexGuard aGuard;
    3088           4 :     sal_Int32 nCount = aPropertyNames.getLength();
    3089           4 :     uno::Sequence < uno::Any > aRet ( nCount );
    3090           4 :     if ( nCount )
    3091             :     {
    3092           4 :         if( pBasePool)
    3093             :         {
    3094           4 :             pBasePool->SetSearchMask(eFamily);
    3095           4 :             SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName);
    3096             :             OSL_ENSURE(pBase, "Doesn't seem to be a style!");
    3097             : 
    3098           4 :             if(pBase)
    3099             :             {
    3100           4 :                 rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
    3101           4 :                 sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE;
    3102           4 :                 switch(eFamily)
    3103             :                 {
    3104           2 :                     case SFX_STYLE_FAMILY_PARA  : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break;
    3105           0 :                     case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break;
    3106           1 :                     case SFX_STYLE_FAMILY_PAGE  : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break;
    3107           0 :                     case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break;
    3108             :                     default:
    3109             :                         ;
    3110             :                 }
    3111           4 :                 const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    3112           4 :                 const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
    3113             : 
    3114           4 :                 const SfxItemSet &rSet = xStyle->GetItemSet(), *pParentSet = rSet.GetParent();
    3115           4 :                 const OUString *pNames = aPropertyNames.getConstArray();
    3116           4 :                 uno::Any *pRet = aRet.getArray();
    3117         463 :                 for ( sal_Int32 i = 0 ; i < nCount; i++)
    3118             :                 {
    3119         459 :                     const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[i] );
    3120         459 :                     if ( !pEntry )
    3121           0 :                         throw beans::UnknownPropertyException ( OUString( "Unknown property: " ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
    3122             : 
    3123         459 :                     if (pEntry->nWID >= RES_UNKNOWNATR_END)
    3124             :                     {
    3125             :                         // these cannot be in an item set, especially not the
    3126             :                         // parent set, so the default value is void
    3127          77 :                         continue;
    3128             :                     }
    3129         382 :                     if( pParentSet )
    3130         347 :                         aSwMapProvider.GetPropertySet(nPropSetId)->getPropertyValue(pNames[i], *pParentSet, pRet[i]);
    3131          35 :                     else if( pEntry->nWID != rSet.GetPool()->GetSlotId(pEntry->nWID) )
    3132             :                     {
    3133          23 :                         const SfxPoolItem& rItem = rSet.GetPool()->GetDefaultItem(pEntry->nWID);
    3134          23 :                         rItem.QueryValue(pRet[i], pEntry->nMemberId);
    3135             :                     }
    3136           4 :                 }
    3137             :             }
    3138             :             else
    3139           0 :                 throw uno::RuntimeException();
    3140             :         }
    3141             :         else
    3142           0 :             throw uno::RuntimeException();
    3143             :     }
    3144           4 :     return aRet;
    3145             : }
    3146             : 
    3147           0 : uno::Any SwXStyle::getPropertyDefault(const OUString& rPropertyName)
    3148             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    3149             : {
    3150           0 :     const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );
    3151           0 :     return getPropertyDefaults ( aSequence ).getConstArray()[0];
    3152             : }
    3153             : 
    3154      104210 : void SwXStyle::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
    3155             : {
    3156      104210 :     SfxSimpleHint *pHint = PTR_CAST( SfxSimpleHint, &rHint );
    3157      104210 :     if( pHint )
    3158             :     {
    3159          55 :         if(( pHint->GetId() & SFX_HINT_DYING ) || ( pHint->GetId() & SFX_STYLESHEET_ERASED))
    3160             :         {
    3161          55 :             pBasePool = 0;
    3162          55 :             EndListening(rBC);
    3163             :         }
    3164           0 :         else if( pHint->GetId() &(SFX_STYLESHEET_CHANGED|SFX_STYLESHEET_ERASED) )
    3165             :         {
    3166           0 :             ((SfxStyleSheetBasePool&)rBC).SetSearchMask(eFamily);
    3167           0 :             SfxStyleSheetBase* pOwnBase = ((SfxStyleSheetBasePool&)rBC).Find(m_sStyleName);
    3168           0 :             if(!pOwnBase)
    3169             :             {
    3170           0 :                 EndListening(rBC);
    3171           0 :                 Invalidate();
    3172             :             }
    3173             :         }
    3174             :     }
    3175      104210 : }
    3176             : 
    3177           0 : void SwXStyle::Invalidate()
    3178             : {
    3179           0 :     m_sStyleName = OUString();
    3180           0 :     pBasePool = 0;
    3181           0 :     m_pDoc = 0;
    3182           0 :     mxStyleData.clear();
    3183           0 :     mxStyleFamily.clear();
    3184           0 : }
    3185             : 
    3186             : /******************************************************************
    3187             :  * SwXPageStyle
    3188             :  ******************************************************************/
    3189        3136 : SwXPageStyle::SwXPageStyle(SfxStyleSheetBasePool& rPool,
    3190             :         SwDocShell* pDocSh, SfxStyleFamily eFam,
    3191             :         const OUString& rStyleName):
    3192        3136 :     SwXStyle(rPool, eFam, pDocSh->GetDoc(), rStyleName)
    3193             : {
    3194             : 
    3195        3136 : }
    3196             : 
    3197         209 : SwXPageStyle::SwXPageStyle(SwDocShell* pDocSh) :
    3198         209 :     SwXStyle(pDocSh->GetDoc(), SFX_STYLE_FAMILY_PAGE)
    3199             : {
    3200         209 : }
    3201             : 
    3202        6690 : SwXPageStyle::~SwXPageStyle()
    3203             : {
    3204             : 
    3205        6690 : }
    3206             : 
    3207        2557 : static void lcl_putItemToSet(const SvxSetItem* pSetItem, sal_uInt16 nRes, sal_uInt16 nItemType, const uno::Any& rVal, sal_uInt8 nMemberId, SwStyleBase_Impl& rBaseImpl)
    3208             : {
    3209        2557 :     SvxSetItem* pNewSetItem = (SvxSetItem*)pSetItem->Clone();
    3210        2557 :     SfxItemSet& rSetSet = pNewSetItem->GetItemSet();
    3211        2557 :     const SfxPoolItem* pItem = 0;
    3212        2557 :     SfxPoolItem* pNewItem = 0;
    3213        2557 :     rSetSet.GetItemState(nRes, true, &pItem);
    3214        2557 :     if(!pItem && nRes != rSetSet.GetPool()->GetSlotId(nRes))
    3215         554 :         pItem = &rSetSet.GetPool()->GetDefaultItem(nRes);
    3216        2557 :     if(pItem)
    3217             :     {
    3218        2557 :         pNewItem = pItem->Clone();
    3219             :     }
    3220             :     else
    3221             :     {
    3222           0 :         switch(nItemType)
    3223             :         {
    3224           0 :             case TYPE_BOOL: pNewItem = new SfxBoolItem(nRes);       break;
    3225           0 :             case TYPE_SIZE: pNewItem = new SvxSizeItem(nRes);       break;
    3226           0 :             case TYPE_BRUSH: pNewItem = new SvxBrushItem(nRes);     break;
    3227           0 :             case TYPE_ULSPACE: pNewItem = new SvxULSpaceItem(nRes); break;
    3228           0 :             case TYPE_SHADOW : pNewItem = new SvxShadowItem(nRes);  break;
    3229           0 :             case TYPE_LRSPACE: pNewItem = new SvxLRSpaceItem(nRes); break;
    3230           0 :             case TYPE_BOX: pNewItem = new SvxBoxItem(nRes);         break;
    3231             :         }
    3232             :     }
    3233             :     assert(pNewItem);
    3234        2557 :     if (pNewItem)
    3235             :     {
    3236        2557 :         pNewItem->PutValue(rVal, nMemberId);
    3237        2557 :         rSetSet.Put(*pNewItem);
    3238        2557 :         delete pNewItem;
    3239             :     }
    3240        2557 :     rBaseImpl.GetItemSet().Put(*pNewSetItem);
    3241        2557 :     delete pNewSetItem;
    3242        2557 : }
    3243             : 
    3244        3260 : void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
    3245             :     const uno::Sequence< OUString >& rPropertyNames,
    3246             :     const uno::Sequence< uno::Any >& rValues )
    3247             :     throw (beans::UnknownPropertyException, beans::PropertyVetoException,
    3248             :            lang::IllegalArgumentException, lang::WrappedTargetException,
    3249             :            uno::RuntimeException, std::exception)
    3250             : {
    3251        3260 :     if(!GetDoc())
    3252           0 :         throw uno::RuntimeException();
    3253             : 
    3254        3260 :     if(rPropertyNames.getLength() != rValues.getLength())
    3255           0 :         throw lang::IllegalArgumentException();
    3256             : 
    3257        3260 :     const OUString* pNames = rPropertyNames.getConstArray();
    3258        3260 :     const uno::Any* pValues = rValues.getConstArray();
    3259        3260 :     const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE);
    3260        3260 :     const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
    3261        3260 :     SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName());
    3262        3260 :     if(GetBasePool())
    3263             :     {
    3264        3260 :         sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
    3265        3260 :         GetBasePool()->SetSearchMask(GetFamily());
    3266        3260 :         SfxStyleSheetBase* pBase = GetBasePool()->Find(GetStyleName());
    3267        3260 :         GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
    3268             :         OSL_ENSURE(pBase, "where is the style?" );
    3269        3260 :         if(pBase)
    3270        3260 :             aBaseImpl.mxNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase);
    3271             :         else
    3272           0 :             throw uno::RuntimeException();
    3273             :     }
    3274             : 
    3275       42473 :     for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
    3276             :     {
    3277       39215 :         const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] );
    3278       39215 :         if (!pEntry)
    3279           0 :             throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
    3280       39215 :         if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
    3281           2 :             throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
    3282             : 
    3283       39213 :         if(GetBasePool())
    3284             :         {
    3285       39213 :             switch(pEntry->nWID)
    3286             :             {
    3287             :                 case FN_UNO_HEADER_ON:
    3288             :                 case FN_UNO_HEADER_BACKGROUND:
    3289             :                 case FN_UNO_HEADER_BOX:
    3290             :                 case FN_UNO_HEADER_LR_SPACE:
    3291             :                 case FN_UNO_HEADER_SHADOW:
    3292             :                 case FN_UNO_HEADER_BODY_DISTANCE:
    3293             :                 case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE:
    3294             :                 case FN_UNO_HEADER_SHARE_CONTENT:
    3295             :                 case FN_UNO_HEADER_HEIGHT:
    3296             :                 case FN_UNO_HEADER_EAT_SPACING:
    3297             : 
    3298             :                 case FN_UNO_FIRST_SHARE_CONTENT:
    3299             : 
    3300             :                 case FN_UNO_FOOTER_ON:
    3301             :                 case FN_UNO_FOOTER_BACKGROUND:
    3302             :                 case FN_UNO_FOOTER_BOX:
    3303             :                 case FN_UNO_FOOTER_LR_SPACE:
    3304             :                 case FN_UNO_FOOTER_SHADOW:
    3305             :                 case FN_UNO_FOOTER_BODY_DISTANCE:
    3306             :                 case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
    3307             :                 case FN_UNO_FOOTER_SHARE_CONTENT:
    3308             :                 case FN_UNO_FOOTER_HEIGHT:
    3309             :                 case FN_UNO_FOOTER_EAT_SPACING:
    3310             :                 {
    3311       12330 :                     bool bFooter = false;
    3312       12330 :                     sal_uInt16 nItemType = TYPE_BOOL;
    3313       12330 :                     sal_uInt16 nRes = 0;
    3314       12330 :                     switch(pEntry->nWID)
    3315             :                     {
    3316         390 :                         case FN_UNO_FOOTER_ON:                  bFooter = true;
    3317             :                         // no break
    3318         761 :                         case FN_UNO_HEADER_ON:                  nRes = SID_ATTR_PAGE_ON;
    3319         761 :                         break;
    3320           4 :                         case FN_UNO_FOOTER_BACKGROUND:          bFooter = true;
    3321             :                         // no break
    3322           8 :                         case FN_UNO_HEADER_BACKGROUND:          nRes = RES_BACKGROUND; nItemType = TYPE_BRUSH;
    3323           8 :                         break;
    3324           4 :                         case FN_UNO_FOOTER_BOX:                 bFooter = true;
    3325             :                         // no break
    3326          56 :                         case FN_UNO_HEADER_BOX:                 nRes = RES_BOX; nItemType = TYPE_BOX;
    3327          56 :                         break;
    3328          32 :                         case FN_UNO_FOOTER_LR_SPACE:            bFooter = true;
    3329             :                         // no break
    3330          64 :                         case FN_UNO_HEADER_LR_SPACE:            nRes = RES_LR_SPACE;nItemType = TYPE_LRSPACE;
    3331          64 :                         break;
    3332           1 :                         case FN_UNO_FOOTER_SHADOW:              bFooter = true;
    3333             :                         // no break
    3334           8 :                         case FN_UNO_HEADER_SHADOW:              nRes = RES_SHADOW;nItemType = TYPE_SHADOW;
    3335           8 :                         break;
    3336        1398 :                         case FN_UNO_FOOTER_BODY_DISTANCE:       bFooter = true;
    3337             :                         // no break
    3338        2797 :                         case FN_UNO_HEADER_BODY_DISTANCE:       nRes = RES_UL_SPACE;nItemType = TYPE_ULSPACE;
    3339        2797 :                         break;
    3340        1398 :                         case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = true;
    3341             :                         // no break
    3342        2797 :                         case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
    3343        2797 :                         break;
    3344          29 :                         case FN_UNO_FOOTER_SHARE_CONTENT:       bFooter = true;
    3345             :                         // no break
    3346          59 :                         case FN_UNO_HEADER_SHARE_CONTENT:       nRes = SID_ATTR_PAGE_SHARED;
    3347          59 :                         break;
    3348         202 :                         case FN_UNO_FIRST_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED_FIRST;
    3349         202 :                         break;
    3350        1398 :                         case FN_UNO_FOOTER_HEIGHT:              bFooter = true;
    3351             :                         // no break
    3352        2797 :                         case FN_UNO_HEADER_HEIGHT:              nRes = SID_ATTR_PAGE_SIZE;nItemType = TYPE_SIZE;
    3353        2797 :                         break;
    3354        1390 :                         case FN_UNO_FOOTER_EAT_SPACING:     bFooter = true;
    3355             :                         // no break
    3356        2781 :                         case FN_UNO_HEADER_EAT_SPACING:     nRes = RES_HEADER_FOOTER_EAT_SPACING;nItemType = TYPE_SIZE;
    3357        2781 :                         break;
    3358             :                     }
    3359             :                     const SvxSetItem* pSetItem;
    3360       24660 :                     if(SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState(
    3361             :                             bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
    3362       24660 :                             false, (const SfxPoolItem**)&pSetItem))
    3363             :                     {
    3364        2499 :                         lcl_putItemToSet(pSetItem, nRes, nItemType, pValues[nProp], pEntry->nMemberId, aBaseImpl);
    3365             : 
    3366        2499 :                         if (nRes == SID_ATTR_PAGE_SHARED_FIRST)
    3367             :                         {
    3368             :                             // Need to add this to the other as well
    3369         176 :                             if (SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState(
    3370             :                                         bFooter ? SID_ATTR_PAGE_HEADERSET : SID_ATTR_PAGE_FOOTERSET,
    3371         176 :                                         false, (const SfxPoolItem**)&pSetItem))
    3372          58 :                                 lcl_putItemToSet(pSetItem, nRes, nItemType, pValues[nProp], pEntry->nMemberId, aBaseImpl);
    3373             :                         }
    3374             :                     }
    3375        9831 :                     else if(SID_ATTR_PAGE_ON == nRes )
    3376             :                     {
    3377         737 :                         sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue();
    3378         737 :                         if(bVal)
    3379             :                         {
    3380         737 :                             SfxItemSet aTempSet(*aBaseImpl.GetItemSet().GetPool(),
    3381             :                                 RES_BACKGROUND, RES_SHADOW,
    3382             :                                 RES_LR_SPACE, RES_UL_SPACE,
    3383             :                                 nRes, nRes,
    3384             :                                 SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
    3385             :                                 SID_ATTR_PAGE_DYNAMIC, SID_ATTR_PAGE_DYNAMIC,
    3386             :                                 SID_ATTR_PAGE_SHARED, SID_ATTR_PAGE_SHARED,
    3387             :                                 SID_ATTR_PAGE_SHARED_FIRST, SID_ATTR_PAGE_SHARED_FIRST,
    3388        1474 :                                 0 );
    3389         737 :                             aTempSet.Put(SfxBoolItem(nRes, true));
    3390         737 :                             aTempSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(MM50, MM50)));
    3391         737 :                             aTempSet.Put(SvxLRSpaceItem(RES_LR_SPACE));
    3392         737 :                             aTempSet.Put(SvxULSpaceItem(RES_UL_SPACE));
    3393         737 :                             aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED, true));
    3394         737 :                             aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED_FIRST, true));
    3395         737 :                             aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, true));
    3396             : 
    3397             :                             SvxSetItem aNewSetItem( bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
    3398        1474 :                                     aTempSet);
    3399        1474 :                             aBaseImpl.GetItemSet().Put(aNewSetItem);
    3400             :                         }
    3401             :                     }
    3402             :                 }
    3403       12330 :                 break;
    3404             :                 case FN_PARAM_FTN_INFO :
    3405             :                 {
    3406        3012 :                     const SfxPoolItem& rItem = aBaseImpl.GetItemSet().Get(FN_PARAM_FTN_INFO);
    3407        3012 :                     SfxPoolItem* pNewFtnItem = rItem.Clone();
    3408        3012 :                     sal_Bool bPut = pNewFtnItem->PutValue(pValues[nProp], pEntry->nMemberId);
    3409        3012 :                     aBaseImpl.GetItemSet().Put(*pNewFtnItem);
    3410        3012 :                     delete pNewFtnItem;
    3411        3012 :                     if(!bPut)
    3412           0 :                         throw lang::IllegalArgumentException();
    3413             :                 }
    3414        3012 :                 break;
    3415             :                 case  FN_UNO_HEADER       :
    3416             :                 case  FN_UNO_HEADER_LEFT  :
    3417             :                 case  FN_UNO_HEADER_RIGHT :
    3418             :                 case  FN_UNO_HEADER_FIRST :
    3419             :                 case  FN_UNO_FOOTER       :
    3420             :                 case  FN_UNO_FOOTER_LEFT  :
    3421             :                 case  FN_UNO_FOOTER_RIGHT :
    3422             :                 case  FN_UNO_FOOTER_FIRST :
    3423           0 :                     throw lang::IllegalArgumentException();
    3424             :                 //break;
    3425             :                 default:
    3426       23871 :                     lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl,
    3427       47742 :                                         GetBasePool(), GetDoc(), GetFamily());
    3428             :             }
    3429             :         }
    3430           0 :         else if(IsDescriptor())
    3431             :         {
    3432           0 :             if(!GetPropImpl()->SetProperty(pNames[nProp], pValues[nProp]))
    3433           0 :                 throw lang::IllegalArgumentException();
    3434             :         }
    3435             :         else
    3436           0 :             throw uno::RuntimeException();
    3437             :     }
    3438        3258 :     if(aBaseImpl.HasItemSet())
    3439             :     {
    3440        3258 :         ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
    3441        3258 :         if (undoGuard.UndoWasEnabled())
    3442             :         {
    3443             :             // Fix i64460: as long as Undo of page styles with header/footer causes trouble...
    3444         131 :             GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
    3445             :         }
    3446        3258 :         aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet());
    3447        3260 :     }
    3448        3258 : }
    3449             : 
    3450        1596 : void SwXPageStyle::setPropertyValues(
    3451             :     const uno::Sequence< OUString >& rPropertyNames,
    3452             :     const uno::Sequence< uno::Any >& rValues )
    3453             :         throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    3454             : {
    3455        1596 :     SolarMutexGuard aGuard;
    3456             : 
    3457             :     // workaround for bad designed API
    3458             :     try
    3459             :     {
    3460        1596 :         SetPropertyValues_Impl( rPropertyNames, rValues );
    3461             :     }
    3462           0 :     catch (const beans::UnknownPropertyException &rException)
    3463             :     {
    3464             :         // wrap the original (here not allowed) exception in
    3465             :         // a lang::WrappedTargetException that gets thrown instead.
    3466           0 :         lang::WrappedTargetException aWExc;
    3467           0 :         aWExc.TargetException <<= rException;
    3468           0 :         throw aWExc;
    3469        1596 :     }
    3470        1596 : }
    3471             : 
    3472             : static uno::Reference<text::XText>
    3473        1167 : lcl_makeHeaderFooter(
    3474             :     const sal_uInt16 nRes, const bool bHeader, SwFrmFmt const*const pFrmFmt)
    3475             : {
    3476        1167 :     if (!pFrmFmt) { return 0; }
    3477             : 
    3478        1167 :     const SfxItemSet& rSet = pFrmFmt->GetAttrSet();
    3479             :     const SfxPoolItem* pItem;
    3480        1167 :     if (SFX_ITEM_SET == rSet.GetItemState(nRes, true, &pItem))
    3481             :     {
    3482             :         SwFrmFmt *const pHeadFootFmt = (bHeader)
    3483             :             ? static_cast<SwFmtHeader*>(const_cast<SfxPoolItem*>(pItem))->
    3484         533 :                     GetHeaderFmt()
    3485             :             : static_cast<SwFmtFooter*>(const_cast<SfxPoolItem*>(pItem))->
    3486        1624 :                     GetFooterFmt();
    3487        1091 :         if (pHeadFootFmt)
    3488             :         {
    3489         887 :             return SwXHeadFootText::CreateXHeadFootText(*pHeadFootFmt, bHeader);
    3490             :         }
    3491             :     }
    3492         280 :     return 0;
    3493             : }
    3494             : 
    3495        5713 : uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl(
    3496             :         const uno::Sequence< OUString >& rPropertyNames )
    3497             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    3498             : {
    3499        5713 :     if(!GetDoc())
    3500           0 :         throw uno::RuntimeException();
    3501             : 
    3502        5713 :     sal_Int32 nLength = rPropertyNames.getLength();
    3503        5713 :     const OUString* pNames = rPropertyNames.getConstArray();
    3504        5713 :     uno::Sequence< uno::Any > aRet ( nLength );
    3505             : 
    3506        5713 :     uno::Any* pRet = aRet.getArray();
    3507        5713 :     const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE);
    3508        5713 :     const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
    3509       11426 :     SwStyleBase_Impl aBase(*GetDoc(), GetStyleName());
    3510        5713 :     SfxStyleSheetBase* pBase = 0;
    3511       12094 :     for(sal_Int32 nProp = 0; nProp < nLength; nProp++)
    3512             :     {
    3513        6381 :         const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] );
    3514        6381 :         if (!pEntry)
    3515           0 :             throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
    3516             : 
    3517        6381 :         if(GetBasePool())
    3518             :         {
    3519        6381 :             if(!pBase)
    3520             :             {
    3521        5713 :                 sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
    3522        5713 :                 GetBasePool()->SetSearchMask(GetFamily(), SFXSTYLEBIT_ALL );
    3523        5713 :                 pBase = GetBasePool()->Find(GetStyleName());
    3524        5713 :                 GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
    3525             :             }
    3526        6381 :             sal_uInt16 nRes = 0;
    3527        6381 :             bool bHeader = false;
    3528        6381 :             bool bLeft = false;
    3529        6381 :             bool bFirst = false;
    3530        6381 :             switch(pEntry->nWID)
    3531             :             {
    3532             :                 case FN_UNO_HEADER_ON:
    3533             :                 case FN_UNO_HEADER_BACKGROUND:
    3534             :                 case FN_UNO_HEADER_BOX:
    3535             :                 case FN_UNO_HEADER_LR_SPACE:
    3536             :                 case FN_UNO_HEADER_SHADOW:
    3537             :                 case FN_UNO_HEADER_BODY_DISTANCE:
    3538             :                 case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE:
    3539             :                 case FN_UNO_HEADER_SHARE_CONTENT:
    3540             :                 case FN_UNO_HEADER_HEIGHT:
    3541             :                 case FN_UNO_HEADER_EAT_SPACING:
    3542             : 
    3543             :                 case FN_UNO_FIRST_SHARE_CONTENT:
    3544             : 
    3545             :                 case FN_UNO_FOOTER_ON:
    3546             :                 case FN_UNO_FOOTER_BACKGROUND:
    3547             :                 case FN_UNO_FOOTER_BOX:
    3548             :                 case FN_UNO_FOOTER_LR_SPACE:
    3549             :                 case FN_UNO_FOOTER_SHADOW:
    3550             :                 case FN_UNO_FOOTER_BODY_DISTANCE:
    3551             :                 case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
    3552             :                 case FN_UNO_FOOTER_SHARE_CONTENT:
    3553             :                 case FN_UNO_FOOTER_HEIGHT:
    3554             :                 case FN_UNO_FOOTER_EAT_SPACING:
    3555             :                 {
    3556        3496 :                     SfxStyleSheetBasePool* pBasePool2 = ((SwXPageStyle*)this)->GetBasePool();
    3557        3496 :                     pBasePool2->SetSearchMask(GetFamily());
    3558        3496 :                     SfxStyleSheetBase* pBase2 = pBasePool2->Find(GetStyleName());
    3559        3496 :                     if(pBase2)
    3560             :                     {
    3561        3496 :                         rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
    3562        3496 :                         const SfxItemSet& rSet = xStyle->GetItemSet();
    3563        3496 :                         bool bFooter = false;
    3564        3496 :                         switch(pEntry->nWID)
    3565             :                         {
    3566             :                             case FN_UNO_FOOTER_ON:
    3567        1641 :                                 bFooter = true;
    3568             :                             // no break
    3569             :                             case FN_UNO_HEADER_ON:
    3570             :                             {
    3571             :                                 //falls das SetItem nicht da ist, dann ist der Wert sal_False
    3572        3279 :                                 sal_Bool bRet = sal_False;
    3573        3279 :                                 pRet[nProp].setValue(&bRet, ::getCppuBooleanType());
    3574        3279 :                                 nRes = SID_ATTR_PAGE_ON;
    3575             :                             }
    3576        3279 :                             break;
    3577          10 :                             case FN_UNO_FOOTER_BACKGROUND:      bFooter = true;
    3578             :                             // no break
    3579          20 :                             case FN_UNO_HEADER_BACKGROUND:      nRes = RES_BACKGROUND;
    3580          20 :                             break;
    3581          18 :                             case FN_UNO_FOOTER_BOX:             bFooter = true;
    3582             :                             // no break
    3583          36 :                             case FN_UNO_HEADER_BOX:             nRes = RES_BOX;
    3584          36 :                             break;
    3585           8 :                             case FN_UNO_FOOTER_LR_SPACE:        bFooter = true;
    3586             :                             // no break
    3587          16 :                             case FN_UNO_HEADER_LR_SPACE:        nRes = RES_LR_SPACE;
    3588          16 :                             break;
    3589           2 :                             case FN_UNO_FOOTER_SHADOW:          bFooter = true;
    3590             :                             // no break
    3591           4 :                             case FN_UNO_HEADER_SHADOW:          nRes = RES_SHADOW;
    3592           4 :                             break;
    3593           4 :                             case FN_UNO_FOOTER_BODY_DISTANCE:   bFooter = true;
    3594             :                             // no break
    3595           8 :                             case FN_UNO_HEADER_BODY_DISTANCE:   nRes = RES_UL_SPACE;
    3596           8 :                             break;
    3597           4 :                             case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = true;
    3598             :                             // no break
    3599           8 :                             case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
    3600           8 :                             break;
    3601          47 :                             case FN_UNO_FOOTER_SHARE_CONTENT:   bFooter = true;
    3602             :                             // no break
    3603          92 :                             case FN_UNO_HEADER_SHARE_CONTENT:   nRes = SID_ATTR_PAGE_SHARED;
    3604          92 :                             break;
    3605          20 :                             case FN_UNO_FIRST_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED_FIRST;
    3606          20 :                             break;
    3607           4 :                             case FN_UNO_FOOTER_HEIGHT:          bFooter = true;
    3608             :                             // no break
    3609           9 :                             case FN_UNO_HEADER_HEIGHT:          nRes = SID_ATTR_PAGE_SIZE;
    3610           9 :                             break;
    3611           2 :                             case FN_UNO_FOOTER_EAT_SPACING: bFooter = true;
    3612             :                             // no break
    3613           4 :                             case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING;
    3614           4 :                             break;
    3615             :                         }
    3616             :                         const SvxSetItem* pSetItem;
    3617        3496 :                         if(SFX_ITEM_SET == rSet.GetItemState(
    3618             :                                 bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
    3619        3496 :                                 false, (const SfxPoolItem**)&pSetItem))
    3620             :                         {
    3621         803 :                             const SfxItemSet& rTmpSet = pSetItem->GetItemSet();
    3622         803 :                             const SfxPoolItem* pItem = 0;
    3623         803 :                             rTmpSet.GetItemState(nRes, true, &pItem);
    3624         803 :                             if(!pItem && nRes != rTmpSet.GetPool()->GetSlotId(nRes))
    3625           0 :                                 pItem = &rTmpSet.GetPool()->GetDefaultItem(nRes);
    3626         803 :                             if(pItem)
    3627         803 :                                 pItem->QueryValue(pRet[nProp], pEntry->nMemberId);
    3628        3496 :                         }
    3629             :                     }
    3630             :                 }
    3631        3496 :                 break;
    3632             :                 case  FN_UNO_HEADER       :
    3633         448 :                     goto Header;
    3634             :                 case  FN_UNO_HEADER_LEFT  :
    3635          64 :                     bLeft = true; goto Header;
    3636             :                 case  FN_UNO_HEADER_FIRST  :
    3637          57 :                     bFirst = true; goto Header;
    3638             :                 case  FN_UNO_HEADER_RIGHT :
    3639           2 :                     goto Header;
    3640             : Header:
    3641         571 :                     bHeader = true;
    3642         571 :                     nRes = RES_HEADER; goto MakeObject;
    3643             :                 case  FN_UNO_FOOTER       :
    3644         473 :                     goto Footer;
    3645             :                 case  FN_UNO_FOOTER_LEFT  :
    3646          65 :                     bLeft = true; goto Footer;
    3647             :                 case  FN_UNO_FOOTER_FIRST  :
    3648          56 :                     bFirst = true; goto Footer;
    3649             :                 case  FN_UNO_FOOTER_RIGHT :
    3650             : Footer:
    3651         596 :                     nRes = RES_FOOTER;
    3652             : MakeObject:
    3653             :                 {
    3654        1167 :                     const SwPageDesc& rDesc = aBase.GetOldPageDesc();
    3655        1167 :                     const SwFrmFmt* pFrmFmt = 0;
    3656        2889 :                     bool bShare = (bHeader && rDesc.IsHeaderShared())||
    3657        2403 :                                     (!bHeader && rDesc.IsFooterShared());
    3658        1167 :                     bool bShareFirst = rDesc.IsFirstShared();
    3659             :                     // TextLeft returns the left content if there is one,
    3660             :                     // Text and TextRight return the master content.
    3661             :                     // TextRight does the same as Text and is for
    3662             :                     // comptability only.
    3663        1167 :                     if( bLeft && !bShare )
    3664             :                     {
    3665          37 :                         pFrmFmt = &rDesc.GetLeft();
    3666             :                     }
    3667        1130 :                     else if (bFirst && !bShareFirst)
    3668             :                     {
    3669          21 :                         pFrmFmt = &rDesc.GetFirstMaster();
    3670             :                         // no need to make GetFirstLeft() accessible
    3671             :                         // since it is always shared
    3672             :                     }
    3673             :                     else
    3674             :                     {
    3675        1109 :                         pFrmFmt = &rDesc.GetMaster();
    3676             :                     }
    3677             :                     const uno::Reference< text::XText > xRet =
    3678        1167 :                         lcl_makeHeaderFooter(nRes, bHeader, pFrmFmt);
    3679        1167 :                     if (xRet.is())
    3680             :                     {
    3681         887 :                         pRet[nProp] <<= xRet;
    3682        1167 :                     }
    3683             :                 }
    3684        1167 :                 break;
    3685             :                 case FN_PARAM_FTN_INFO :
    3686             :                 {
    3687         212 :                     rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) );
    3688         212 :                     const SfxItemSet& rSet = xStyle->GetItemSet();
    3689         212 :                     const SfxPoolItem& rItem = rSet.Get(FN_PARAM_FTN_INFO);
    3690         212 :                     rItem.QueryValue(pRet[nProp], pEntry->nMemberId);
    3691             :                 }
    3692         212 :                 break;
    3693             :                 default:
    3694        1506 :                 pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() );
    3695             :             }
    3696             :         }
    3697           0 :         else if(IsDescriptor())
    3698             :         {
    3699           0 :             uno::Any* pAny = 0;
    3700           0 :             GetPropImpl()->GetProperty(pNames[nProp], pAny);
    3701           0 :             if ( !pAny )
    3702           0 :                 GetPropImpl()->GetProperty ( pNames[nProp], mxStyleData, pRet[ nProp ] );
    3703             :             else
    3704           0 :                 pRet[nProp] = *pAny;
    3705             :         }
    3706             :         else
    3707           0 :             throw uno::RuntimeException();
    3708             :     }
    3709       11426 :     return aRet;
    3710             : }
    3711             : 
    3712         134 : uno::Sequence< uno::Any > SwXPageStyle::getPropertyValues(
    3713             :     const uno::Sequence< OUString >& rPropertyNames )
    3714             :         throw(uno::RuntimeException, std::exception)
    3715             : {
    3716         134 :     SolarMutexGuard aGuard;
    3717         134 :     uno::Sequence< uno::Any > aValues;
    3718             : 
    3719             :     // workaround for bad designed API
    3720             :     try
    3721             :     {
    3722         134 :         aValues = GetPropertyValues_Impl( rPropertyNames );
    3723             :     }
    3724           0 :     catch (beans::UnknownPropertyException &)
    3725             :     {
    3726           0 :         throw uno::RuntimeException("Unknown property exception caught", static_cast < cppu::OWeakObject * > ( this ) );
    3727             :     }
    3728           0 :     catch (lang::WrappedTargetException &)
    3729             :     {
    3730           0 :         throw uno::RuntimeException("WrappedTargetException caught", static_cast < cppu::OWeakObject * > ( this ) );
    3731             :     }
    3732             : 
    3733         134 :     return aValues;
    3734             : }
    3735             : 
    3736        5579 : uno::Any SwXPageStyle::getPropertyValue(const OUString& rPropertyName) throw(
    3737             :     beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    3738             : {
    3739        5579 :     SolarMutexGuard aGuard;
    3740       11158 :     const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
    3741       11158 :     return GetPropertyValues_Impl(aProperties).getConstArray()[0];
    3742             : }
    3743             : 
    3744        1664 : void SwXPageStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue)
    3745             :     throw( beans::UnknownPropertyException,
    3746             :         beans::PropertyVetoException,
    3747             :         lang::IllegalArgumentException,
    3748             :         lang::WrappedTargetException,
    3749             :         uno::RuntimeException, std::exception)
    3750             : {
    3751        1664 :     SolarMutexGuard aGuard;
    3752        3328 :     const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
    3753        3328 :     const uno::Sequence<uno::Any> aValues(&rValue, 1);
    3754        3328 :     SetPropertyValues_Impl( aProperties, aValues );
    3755        1662 : }
    3756             : 
    3757         161 : SwXFrameStyle::SwXFrameStyle ( SwDoc *pDoc )
    3758         161 : : SwXStyle ( pDoc, SFX_STYLE_FAMILY_FRAME, sal_False)
    3759             : {
    3760         161 : }
    3761             : 
    3762        3024 : SwXFrameStyle::~SwXFrameStyle()
    3763             : {
    3764        3024 : }
    3765             : 
    3766           0 : uno::Sequence< uno::Type > SwXFrameStyle::getTypes(  ) throw(uno::RuntimeException, std::exception)
    3767             : {
    3768           0 :     uno::Sequence< uno::Type > aTypes = SwXStyle::getTypes();
    3769           0 :     sal_Int32 nLen = aTypes.getLength();
    3770           0 :     aTypes.realloc(nLen + 1);
    3771           0 :     aTypes.getArray()[nLen] = ::getCppuType((uno::Reference<XEventsSupplier>*)0);
    3772           0 :     return aTypes;
    3773             : }
    3774             : 
    3775        3407 : uno::Any SwXFrameStyle::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException, std::exception)
    3776             : {
    3777        3407 :     uno::Any aRet;
    3778        3407 :     if(rType == ::getCppuType((uno::Reference<XEventsSupplier>*)0))
    3779          11 :         aRet <<= uno::Reference<XEventsSupplier>(this);
    3780             :     else
    3781        3396 :         aRet = SwXStyle::queryInterface(rType);
    3782        3407 :     return aRet;
    3783             : }
    3784             : 
    3785          11 : uno::Reference< container::XNameReplace > SwXFrameStyle::getEvents(  ) throw(uno::RuntimeException, std::exception)
    3786             : {
    3787          11 :     return new SwFrameStyleEventDescriptor( *this );
    3788             : }
    3789             : 
    3790         128 : SwXAutoStyles::SwXAutoStyles(SwDocShell& rDocShell) :
    3791         128 :     SwUnoCollection(rDocShell.GetDoc()), pDocShell( &rDocShell )
    3792             : {
    3793         128 : }
    3794             : 
    3795         254 : SwXAutoStyles::~SwXAutoStyles()
    3796             : {
    3797         254 : }
    3798             : 
    3799           0 : sal_Int32 SwXAutoStyles::getCount(void) throw( uno::RuntimeException, std::exception )
    3800             : {
    3801           0 :     return AUTOSTYLE_FAMILY_COUNT;
    3802             : }
    3803             : 
    3804         262 : uno::Any SwXAutoStyles::getByIndex(sal_Int32 nIndex)
    3805             :         throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException,
    3806             :                 uno::RuntimeException, std::exception )
    3807             : {
    3808         262 :     SolarMutexGuard aGuard;
    3809         262 :     uno::Any aRet;
    3810         262 :     if(nIndex < 0 || nIndex >= AUTOSTYLE_FAMILY_COUNT)
    3811           0 :         throw lang::IndexOutOfBoundsException();
    3812         262 :     if(IsValid())
    3813             :     {
    3814         262 :         uno::Reference< style::XAutoStyleFamily >  aRef;
    3815         262 :         IStyleAccess::SwAutoStyleFamily nType = aAutoStyleByIndex[nIndex];
    3816         262 :         switch( nType )
    3817             :         {
    3818             :             case IStyleAccess::AUTO_STYLE_CHAR:
    3819             :             {
    3820          98 :                 if(!xAutoCharStyles.is())
    3821          93 :                     xAutoCharStyles = new SwXAutoStyleFamily(pDocShell, nType);
    3822          98 :                 aRef = xAutoCharStyles;
    3823             :             }
    3824          98 :             break;
    3825             :             case IStyleAccess::AUTO_STYLE_RUBY:
    3826             :             {
    3827          21 :                 if(!xAutoRubyStyles.is())
    3828          21 :                     xAutoRubyStyles = new SwXAutoStyleFamily(pDocShell, nType );
    3829          21 :                 aRef = xAutoRubyStyles;
    3830             :             }
    3831          21 :             break;
    3832             :             case IStyleAccess::AUTO_STYLE_PARA:
    3833             :             {
    3834         143 :                 if(!xAutoParaStyles.is())
    3835         126 :                     xAutoParaStyles = new SwXAutoStyleFamily(pDocShell, nType );
    3836         143 :                 aRef = xAutoParaStyles;
    3837             :             }
    3838         143 :             break;
    3839             : 
    3840             :             default:
    3841             :                 ;
    3842             :         }
    3843         262 :         aRet.setValue(&aRef, ::getCppuType((const uno::Reference<style::XAutoStyleFamily>*)0));
    3844             :     }
    3845             :     else
    3846           0 :         throw uno::RuntimeException();
    3847         262 :     return aRet;
    3848             : }
    3849             : 
    3850           0 : uno::Type SwXAutoStyles::getElementType(  ) throw(uno::RuntimeException, std::exception)
    3851             : {
    3852           0 :     return ::getCppuType((const uno::Reference<style::XAutoStyleFamily>*)0);
    3853             : }
    3854             : 
    3855           0 : sal_Bool SwXAutoStyles::hasElements(  ) throw(uno::RuntimeException, std::exception)
    3856             : {
    3857           0 :     return sal_True;
    3858             : }
    3859             : 
    3860         262 : uno::Any SwXAutoStyles::getByName(const OUString& Name)
    3861             :         throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    3862             : {
    3863         262 :     uno::Any aRet;
    3864         262 :     if(Name.equalsAscii("CharacterStyles") )
    3865          98 :         aRet = getByIndex(0);
    3866         164 :     else if(Name.equalsAscii("RubyStyles") )
    3867          21 :         aRet = getByIndex(1);
    3868         143 :     else if(Name.equalsAscii("ParagraphStyles") )
    3869         143 :         aRet = getByIndex(2);
    3870             :     else
    3871           0 :         throw container::NoSuchElementException();
    3872         262 :     return aRet;
    3873             : }
    3874             : 
    3875           0 : uno::Sequence< OUString > SwXAutoStyles::getElementNames(void)
    3876             :             throw( uno::RuntimeException, std::exception )
    3877             : {
    3878           0 :     uno::Sequence< OUString > aNames(AUTOSTYLE_FAMILY_COUNT);
    3879           0 :     OUString* pNames = aNames.getArray();
    3880           0 :     pNames[0] = "CharacterStyles";
    3881           0 :     pNames[1] = "RubyStyles";
    3882           0 :     pNames[2] = "ParagraphStyles";
    3883           0 :     return aNames;
    3884             : }
    3885             : 
    3886         197 : sal_Bool SwXAutoStyles::hasByName(const OUString& Name)
    3887             :             throw( uno::RuntimeException, std::exception )
    3888             : {
    3889         514 :     if( Name.equalsAscii("CharacterStyles") ||
    3890         317 :         Name.equalsAscii("RubyStyles") ||
    3891         120 :         Name.equalsAscii("ParagraphStyles") )
    3892         197 :         return sal_True;
    3893             :     else
    3894           0 :         return sal_False;
    3895             : }
    3896             : 
    3897         240 : SwXAutoStyleFamily::SwXAutoStyleFamily(SwDocShell* pDocSh, IStyleAccess::SwAutoStyleFamily nFamily) :
    3898         240 :     pDocShell( pDocSh ), eFamily(nFamily)
    3899             : {
    3900             :     // Register ourselves as a listener to the document (via the page descriptor)
    3901         240 :     pDocSh->GetDoc()->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
    3902         240 : }
    3903             : 
    3904         476 : SwXAutoStyleFamily::~SwXAutoStyleFamily()
    3905             : {
    3906         476 : }
    3907             : 
    3908           0 : void SwXAutoStyleFamily::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    3909             : {
    3910           0 :     ClientModify(this, pOld, pNew);
    3911           0 :     if(!GetRegisteredIn())
    3912           0 :         pDocShell = 0;
    3913           0 : }
    3914             : 
    3915        1099 : uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
    3916             :     const uno::Sequence< beans::PropertyValue >& Values )
    3917             :         throw (uno::RuntimeException, std::exception)
    3918             : {
    3919        1099 :     if( !pDocShell )
    3920           0 :         throw uno::RuntimeException();
    3921        1099 :     const sal_uInt16* pRange = 0;
    3922        1099 :     const SfxItemPropertySet* pPropSet = 0;
    3923        1099 :     switch( eFamily )
    3924             :     {
    3925             :         case IStyleAccess::AUTO_STYLE_CHAR:
    3926             :         {
    3927         486 :             pRange = aCharAutoFmtSetRange;
    3928         486 :             pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE);
    3929             :         }
    3930         486 :         break;
    3931             :         case IStyleAccess::AUTO_STYLE_RUBY:
    3932             :         {
    3933           0 :             pRange = 0;//aTxtNodeSetRange;
    3934           0 :             pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_RUBY_AUTO_STYLE);
    3935             :         }
    3936           0 :         break;
    3937             :         case IStyleAccess::AUTO_STYLE_PARA:
    3938             :         {
    3939         613 :             pRange = aTxtNodeSetRange;
    3940         613 :             pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARA_AUTO_STYLE);
    3941             :         }
    3942         613 :         break;
    3943             : 
    3944             :         default:
    3945             :             ;
    3946             :     }
    3947             : 
    3948        1099 :     if( !pPropSet)
    3949           0 :         throw uno::RuntimeException();
    3950             : 
    3951        1099 :     SwAttrSet aSet( pDocShell->GetDoc()->GetAttrPool(), pRange );
    3952        1099 :     const beans::PropertyValue* pSeq = Values.getConstArray();
    3953        1099 :     sal_Int32 nLen = Values.getLength();
    3954       16900 :     for( sal_Int32 i = 0; i < nLen; ++i )
    3955             :     {
    3956             :         try
    3957             :         {
    3958       15801 :             pPropSet->setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet );
    3959             :         }
    3960           0 :         catch (beans::UnknownPropertyException &)
    3961             :         {
    3962             :             OSL_FAIL( "Unknown property" );
    3963             :         }
    3964           0 :         catch (lang::IllegalArgumentException &)
    3965             :         {
    3966             :             OSL_FAIL( "Illegal argument" );
    3967             :         }
    3968             :     }
    3969             : 
    3970        2198 :     SfxItemSet_Pointer_t pSet = pDocShell->GetDoc()->GetIStyleAccess().cacheAutomaticStyle( aSet, eFamily );
    3971        2198 :     uno::Reference<style::XAutoStyle> xRet = new SwXAutoStyle(pDocShell->GetDoc(), pSet, eFamily);
    3972        2198 :     return xRet;
    3973             : }
    3974             : 
    3975          65 : uno::Reference< container::XEnumeration > SwXAutoStyleFamily::createEnumeration(  )
    3976             :         throw (uno::RuntimeException, std::exception)
    3977             : {
    3978          65 :     if( !pDocShell )
    3979           0 :         throw uno::RuntimeException();
    3980             :     return uno::Reference< container::XEnumeration >
    3981          65 :         (new SwXAutoStylesEnumerator( pDocShell->GetDoc(), eFamily ));
    3982             : }
    3983             : 
    3984           0 : uno::Type SwXAutoStyleFamily::getElementType(  ) throw(uno::RuntimeException, std::exception)
    3985             : {
    3986           0 :     return ::getCppuType((const uno::Reference<style::XAutoStyle>*)0);
    3987             : }
    3988             : 
    3989           0 : sal_Bool SwXAutoStyleFamily::hasElements(  ) throw(uno::RuntimeException, std::exception)
    3990             : {
    3991           0 :     return sal_False;
    3992             : }
    3993             : 
    3994          65 : SwAutoStylesEnumImpl::SwAutoStylesEnumImpl( SwDoc* pInitDoc, IStyleAccess::SwAutoStyleFamily eFam )
    3995          65 : : pDoc( pInitDoc ), eFamily( eFam )
    3996             : {
    3997             :     // special case for ruby auto styles:
    3998          65 :     if ( IStyleAccess::AUTO_STYLE_RUBY == eFam )
    3999             :     {
    4000          21 :         std::set< std::pair< sal_uInt16, sal_uInt16 > > aRubyMap;
    4001          21 :         SwAttrPool& rAttrPool = pDoc->GetAttrPool();
    4002          21 :         sal_uInt32 nCount = rAttrPool.GetItemCount2( RES_TXTATR_CJK_RUBY );
    4003             : 
    4004          30 :         for ( sal_uInt32 nI = 0; nI < nCount; ++nI )
    4005             :         {
    4006           9 :             const SwFmtRuby* pItem = static_cast<const SwFmtRuby*>(rAttrPool.GetItem2( RES_TXTATR_CJK_RUBY, nI ));
    4007           9 :             if ( pItem && pItem->GetTxtRuby() )
    4008             :             {
    4009           6 :                 std::pair< sal_uInt16, sal_uInt16 > aPair( pItem->GetPosition(), pItem->GetAdjustment() );
    4010           6 :                 if ( aRubyMap.find( aPair ) == aRubyMap.end() )
    4011             :                 {
    4012           1 :                     aRubyMap.insert( aPair );
    4013           1 :                     SfxItemSet_Pointer_t pItemSet( new SfxItemSet( rAttrPool, RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY ) );
    4014           1 :                     pItemSet->Put( *pItem );
    4015           1 :                     mAutoStyles.push_back( pItemSet );
    4016             :                 }
    4017             :             }
    4018          21 :         }
    4019             :     }
    4020             :     else
    4021             :     {
    4022          44 :         pDoc->GetIStyleAccess().getAllStyles( mAutoStyles, eFamily );
    4023             :     }
    4024             : 
    4025          65 :     aIter = mAutoStyles.begin();
    4026          65 : }
    4027             : 
    4028          65 : SwXAutoStylesEnumerator::SwXAutoStylesEnumerator( SwDoc* pDoc, IStyleAccess::SwAutoStyleFamily eFam )
    4029          65 : : pImpl( new SwAutoStylesEnumImpl( pDoc, eFam ) )
    4030             : {
    4031             :     // Register ourselves as a listener to the document (via the page descriptor)
    4032          65 :     pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
    4033          65 : }
    4034             : 
    4035         195 : SwXAutoStylesEnumerator::~SwXAutoStylesEnumerator()
    4036             : {
    4037          65 :     delete pImpl;
    4038         130 : }
    4039             : 
    4040           0 : void SwXAutoStylesEnumerator::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    4041             : {
    4042           0 :     ClientModify(this, pOld, pNew);
    4043           0 :     if(!GetRegisteredIn())
    4044             :     {
    4045           0 :         delete pImpl;
    4046           0 :         pImpl = 0;
    4047             :     }
    4048           0 : }
    4049             : 
    4050          89 : sal_Bool SwXAutoStylesEnumerator::hasMoreElements(  )
    4051             :     throw (uno::RuntimeException, std::exception)
    4052             : {
    4053          89 :     if( !pImpl )
    4054           0 :         throw uno::RuntimeException();
    4055          89 :     return pImpl->hasMoreElements();
    4056             : }
    4057             : 
    4058          26 : uno::Any SwXAutoStylesEnumerator::nextElement(  )
    4059             :     throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
    4060             : {
    4061          26 :     if( !pImpl )
    4062           0 :         throw uno::RuntimeException();
    4063          26 :     uno::Any aRet;
    4064          26 :     if( pImpl->hasMoreElements() )
    4065             :     {
    4066          26 :         SfxItemSet_Pointer_t pNextSet = pImpl->nextElement();
    4067          26 :         uno::Reference< style::XAutoStyle > xAutoStyle = new SwXAutoStyle(pImpl->getDoc(),
    4068          52 :                                                         pNextSet, pImpl->getFamily());
    4069          52 :         aRet.setValue(&xAutoStyle, ::getCppuType((uno::Reference<style::XAutoStyle>*)0));
    4070             :     }
    4071          26 :     return aRet;
    4072             : }
    4073             : 
    4074        1125 : SwXAutoStyle::SwXAutoStyle( SwDoc* pDoc, SfxItemSet_Pointer_t pInitSet, IStyleAccess::SwAutoStyleFamily eFam )
    4075        1125 : : pSet( pInitSet ), eFamily( eFam )
    4076             : {
    4077             :     // Register ourselves as a listener to the document (via the page descriptor)
    4078        1125 :     pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
    4079        1125 : }
    4080             : 
    4081        2250 : SwXAutoStyle::~SwXAutoStyle()
    4082             : {
    4083        2250 : }
    4084             : 
    4085           0 : void SwXAutoStyle::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    4086             : {
    4087           0 :     ClientModify(this, pOld, pNew);
    4088           0 :     if(!GetRegisteredIn())
    4089           0 :         pSet.reset();
    4090           0 : }
    4091             : 
    4092          47 : uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo(  )
    4093             :                 throw (uno::RuntimeException, std::exception)
    4094             : {
    4095          47 :     uno::Reference< beans::XPropertySetInfo >  xRet;
    4096          47 :     switch( eFamily )
    4097             :     {
    4098             :         case IStyleAccess::AUTO_STYLE_CHAR:
    4099             :         {
    4100           4 :             static uno::Reference< beans::XPropertySetInfo >  xCharRef;
    4101           4 :             if(!xCharRef.is())
    4102             :             {
    4103           1 :                 xCharRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE)->getPropertySetInfo();
    4104             :             }
    4105           4 :             xRet = xCharRef;
    4106             :         }
    4107           4 :         break;
    4108             :         case IStyleAccess::AUTO_STYLE_RUBY:
    4109             :         {
    4110           2 :             static uno::Reference< beans::XPropertySetInfo >  xRubyRef;
    4111           2 :             if(!xRubyRef.is())
    4112             :             {
    4113           1 :                 sal_uInt16 nMapId = PROPERTY_MAP_RUBY_AUTO_STYLE;
    4114           1 :                 xRubyRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo();
    4115             :             }
    4116           2 :             xRet = xRubyRef;
    4117             :         }
    4118           2 :         break;
    4119             :         case IStyleAccess::AUTO_STYLE_PARA:
    4120             :         {
    4121          41 :             static uno::Reference< beans::XPropertySetInfo >  xParaRef;
    4122          41 :             if(!xParaRef.is())
    4123             :             {
    4124           3 :                 sal_uInt16 nMapId = PROPERTY_MAP_PARA_AUTO_STYLE;
    4125           3 :                 xParaRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo();
    4126             :             }
    4127          41 :             xRet = xParaRef;
    4128             :         }
    4129          41 :         break;
    4130             : 
    4131             :         default:
    4132             :             ;
    4133             :     }
    4134             : 
    4135          47 :     return xRet;
    4136             : }
    4137             : 
    4138           0 : void SwXAutoStyle::setPropertyValue( const OUString& /*rPropertyName*/, const uno::Any& /*rValue*/ )
    4139             :      throw( beans::UnknownPropertyException,
    4140             :             beans::PropertyVetoException,
    4141             :             lang::IllegalArgumentException,
    4142             :             lang::WrappedTargetException,
    4143             :             uno::RuntimeException, std::exception)
    4144             : {
    4145           0 : }
    4146             : 
    4147          40 : uno::Any SwXAutoStyle::getPropertyValue( const OUString& rPropertyName )
    4148             :     throw( beans::UnknownPropertyException,
    4149             :            lang::WrappedTargetException,
    4150             :            uno::RuntimeException, std::exception )
    4151             : {
    4152          40 :     SolarMutexGuard aGuard;
    4153          80 :     const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
    4154          80 :     return GetPropertyValues_Impl(aProperties).getConstArray()[0];
    4155             : }
    4156             : 
    4157           0 : void SwXAutoStyle::addPropertyChangeListener( const OUString& /*aPropertyName*/,
    4158             :                                               const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
    4159             :     throw( beans::UnknownPropertyException,
    4160             :            lang::WrappedTargetException,
    4161             :            uno::RuntimeException, std::exception )
    4162             : {
    4163           0 : }
    4164             : 
    4165           0 : void SwXAutoStyle::removePropertyChangeListener( const OUString& /*aPropertyName*/,
    4166             :                                                  const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
    4167             :     throw( beans::UnknownPropertyException,
    4168             :            lang::WrappedTargetException,
    4169             :            uno::RuntimeException, std::exception )
    4170             : {
    4171           0 : }
    4172             : 
    4173           0 : void SwXAutoStyle::addVetoableChangeListener( const OUString& /*PropertyName*/,
    4174             :                                               const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
    4175             :     throw( beans::UnknownPropertyException,
    4176             :            lang::WrappedTargetException,
    4177             :            uno::RuntimeException, std::exception )
    4178             : {
    4179           0 : }
    4180             : 
    4181           0 : void SwXAutoStyle::removeVetoableChangeListener( const OUString& /*PropertyName*/,
    4182             :                                                  const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
    4183             :     throw( beans::UnknownPropertyException,
    4184             :            lang::WrappedTargetException,
    4185             :            uno::RuntimeException, std::exception )
    4186             : {
    4187           0 : }
    4188             : 
    4189           0 : void SwXAutoStyle::setPropertyValues(
    4190             :         const uno::Sequence< OUString >& /*aPropertyNames*/,
    4191             :         const uno::Sequence< uno::Any >& /*aValues*/ )
    4192             :             throw (beans::PropertyVetoException, lang::IllegalArgumentException,
    4193             :                 lang::WrappedTargetException, uno::RuntimeException, std::exception)
    4194             : {
    4195           0 : }
    4196             : 
    4197        1162 : uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl(
    4198             :         const uno::Sequence< OUString > & rPropertyNames )
    4199             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
    4200             : {
    4201        1162 :     if( !pSet.get() )
    4202           0 :         throw uno::RuntimeException();
    4203             :     // query_item
    4204             : 
    4205        1162 :     sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;
    4206        1162 :     switch(eFamily)
    4207             :     {
    4208         488 :         case IStyleAccess::AUTO_STYLE_CHAR  : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;  break;
    4209           1 :         case IStyleAccess::AUTO_STYLE_RUBY  : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE;  break;
    4210         673 :         case IStyleAccess::AUTO_STYLE_PARA  : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE;  break;
    4211             :         default:
    4212             :             ;
    4213             :     }
    4214             : 
    4215        1162 :     const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    4216        1162 :     const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
    4217        1162 :     const OUString* pNames = rPropertyNames.getConstArray();
    4218             : 
    4219        1162 :     sal_Int32 nLen = rPropertyNames.getLength();
    4220        1162 :     uno::Sequence< uno::Any > aRet( nLen );
    4221        1162 :     uno::Any* pValues = aRet.getArray();
    4222             : 
    4223        1162 :     SfxItemSet& rSet = *pSet.get();
    4224             : 
    4225        2388 :     for( sal_Int32 i = 0; i < nLen; ++i )
    4226             :     {
    4227        1226 :         const OUString sPropName = pNames[i];
    4228        1226 :         const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(sPropName);
    4229        1226 :         if(!pEntry)
    4230           0 :             throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) );
    4231        1226 :         else if ( RES_TXTATR_AUTOFMT == pEntry->nWID || RES_AUTO_STYLE == pEntry->nWID )
    4232             :         {
    4233        1099 :             pValues[i] <<= StylePool::nameOf( pSet );
    4234             :         }
    4235             :         else
    4236         127 :             pPropSet->getPropertyValue( *pEntry, rSet, pValues[i] );
    4237        1226 :     }
    4238        1162 :     return aRet;
    4239             : }
    4240             : 
    4241        1122 : uno::Sequence< uno::Any > SwXAutoStyle::getPropertyValues (
    4242             :         const uno::Sequence< OUString >& rPropertyNames )
    4243             :             throw (uno::RuntimeException, std::exception)
    4244             : {
    4245        1122 :     SolarMutexGuard aGuard;
    4246        1122 :     uno::Sequence< uno::Any > aValues;
    4247             : 
    4248             :     // workaround for bad designed API
    4249             :     try
    4250             :     {
    4251        1122 :         aValues = GetPropertyValues_Impl( rPropertyNames );
    4252             :     }
    4253           0 :     catch (beans::UnknownPropertyException &)
    4254             :     {
    4255           0 :         throw uno::RuntimeException("Unknown property exception caught", static_cast < cppu::OWeakObject * > ( this ) );
    4256             :     }
    4257           0 :     catch (lang::WrappedTargetException &)
    4258             :     {
    4259           0 :         throw uno::RuntimeException("WrappedTargetException caught", static_cast < cppu::OWeakObject * > ( this ) );
    4260             :     }
    4261             : 
    4262        1122 :     return aValues;
    4263             : }
    4264             : 
    4265           0 : void SwXAutoStyle::addPropertiesChangeListener(
    4266             :         const uno::Sequence< OUString >& /*aPropertyNames*/,
    4267             :         const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
    4268             :             throw (uno::RuntimeException, std::exception)
    4269             : {
    4270           0 : }
    4271             : 
    4272           0 : void SwXAutoStyle::removePropertiesChangeListener(
    4273             :         const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
    4274             :             throw (uno::RuntimeException, std::exception)
    4275             : {
    4276           0 : }
    4277             : 
    4278           0 : void SwXAutoStyle::firePropertiesChangeEvent(
    4279             :         const uno::Sequence< OUString >& /*aPropertyNames*/,
    4280             :         const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
    4281             :             throw (uno::RuntimeException, std::exception)
    4282             : {
    4283           0 : }
    4284             : 
    4285           0 : beans::PropertyState SwXAutoStyle::getPropertyState( const OUString& rPropertyName )
    4286             :     throw( beans::UnknownPropertyException,
    4287             :            uno::RuntimeException, std::exception)
    4288             : {
    4289           0 :     SolarMutexGuard aGuard;
    4290             : 
    4291           0 :     uno::Sequence< OUString > aNames(1);
    4292           0 :     OUString* pNames = aNames.getArray();
    4293           0 :     pNames[0] = rPropertyName;
    4294           0 :     uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aNames);
    4295           0 :     return aStates.getConstArray()[0];
    4296             : }
    4297             : 
    4298           0 : void SwXAutoStyle::setPropertyToDefault( const OUString& /*PropertyName*/ )
    4299             :     throw( beans::UnknownPropertyException,
    4300             :            uno::RuntimeException, std::exception )
    4301             : {
    4302           0 : }
    4303             : 
    4304           0 : uno::Any SwXAutoStyle::getPropertyDefault( const OUString& rPropertyName )
    4305             :     throw( beans::UnknownPropertyException,
    4306             :            lang::WrappedTargetException,
    4307             :            uno::RuntimeException, std::exception)
    4308             : {
    4309           0 :     const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );
    4310           0 :     return getPropertyDefaults ( aSequence ).getConstArray()[0];
    4311             : }
    4312             : 
    4313          24 : uno::Sequence< beans::PropertyState > SwXAutoStyle::getPropertyStates(
    4314             :         const uno::Sequence< OUString >& rPropertyNames )
    4315             :             throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    4316             : {
    4317          24 :     if( !pSet.get() )
    4318           0 :         throw uno::RuntimeException();
    4319          24 :     SolarMutexGuard aGuard;
    4320          24 :     uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength());
    4321          24 :     beans::PropertyState* pStates = aRet.getArray();
    4322          24 :     const OUString* pNames = rPropertyNames.getConstArray();
    4323             : 
    4324          24 :     sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;
    4325          24 :     switch(eFamily)
    4326             :     {
    4327           2 :         case IStyleAccess::AUTO_STYLE_CHAR  : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;  break;
    4328           1 :         case IStyleAccess::AUTO_STYLE_RUBY  : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE;  break;
    4329          21 :         case IStyleAccess::AUTO_STYLE_PARA  : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE;  break;
    4330             :         default:
    4331             :             ;
    4332             :     }
    4333             : 
    4334          24 :     const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    4335          24 :     const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
    4336          24 :     SfxItemSet& rSet = *pSet.get();
    4337        2638 :     for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
    4338             :     {
    4339        2614 :         const OUString sPropName = pNames[i];
    4340        2614 :         const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(sPropName);
    4341        2614 :         if(!pEntry)
    4342           0 :             throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) );
    4343        2614 :         pStates[i] = pPropSet->getPropertyState(*pEntry, rSet );
    4344        2614 :     }
    4345          24 :     return aRet;
    4346             : }
    4347             : 
    4348           0 : void SwXAutoStyle::setAllPropertiesToDefault(  )
    4349             :             throw (uno::RuntimeException, std::exception)
    4350             : {
    4351           0 : }
    4352             : 
    4353           0 : void SwXAutoStyle::setPropertiesToDefault(
    4354             :         const uno::Sequence< OUString >& /*aPropertyNames*/ )
    4355             :             throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
    4356             : {
    4357           0 : }
    4358             : 
    4359           0 : uno::Sequence< uno::Any > SwXAutoStyle::getPropertyDefaults(
    4360             :         const uno::Sequence< OUString >& /*aPropertyNames*/ )
    4361             :             throw (beans::UnknownPropertyException, lang::WrappedTargetException,
    4362             :                     uno::RuntimeException, std::exception)
    4363             : {
    4364           0 :     uno::Sequence< uno::Any > aRet(0);
    4365           0 :     return aRet;
    4366             : }
    4367             : 
    4368           0 : uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno::RuntimeException, std::exception)
    4369             : {
    4370           0 :     if( !pSet.get() )
    4371           0 :         throw uno::RuntimeException();
    4372           0 :     SolarMutexGuard aGuard;
    4373           0 :     std::vector< beans::PropertyValue > aPropertyVector;
    4374             : 
    4375           0 :     sal_Int8 nPropSetId = 0;
    4376           0 :     switch(eFamily)
    4377             :     {
    4378           0 :         case IStyleAccess::AUTO_STYLE_CHAR  : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE;  break;
    4379           0 :         case IStyleAccess::AUTO_STYLE_RUBY  : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE;  break;
    4380           0 :         case IStyleAccess::AUTO_STYLE_PARA  : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE;  break;
    4381             :         default:
    4382             :             ;
    4383             :     }
    4384             : 
    4385           0 :     const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
    4386           0 :     const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap();
    4387           0 :     PropertyEntryVector_t aPropVector = rMap.getPropertyEntries();
    4388             : 
    4389           0 :     SfxItemSet& rSet = *pSet.get();
    4390           0 :     SfxItemIter aIter(rSet);
    4391           0 :     const SfxPoolItem* pItem = aIter.FirstItem();
    4392             : 
    4393           0 :     while ( pItem )
    4394             :     {
    4395           0 :         const sal_uInt16 nWID = pItem->Which();
    4396             : 
    4397             :         // TODO: Optimize - and fix! the old iteration filled each WhichId
    4398             :         // only once but there are more properties than WhichIds
    4399           0 :         PropertyEntryVector_t::const_iterator aIt = aPropVector.begin();
    4400           0 :         while( aIt != aPropVector.end() )
    4401             :         {
    4402           0 :             if ( aIt->nWID == nWID )
    4403             :             {
    4404           0 :                 beans::PropertyValue aPropertyValue;
    4405           0 :                 aPropertyValue.Name = aIt->sName;
    4406           0 :                 pItem->QueryValue( aPropertyValue.Value, aIt->nMemberId );
    4407           0 :                 aPropertyVector.push_back( aPropertyValue );
    4408             :             }
    4409           0 :             ++aIt;
    4410             :         }
    4411           0 :         pItem = aIter.NextItem();
    4412             :     }
    4413             : 
    4414           0 :     const sal_Int32 nCount = aPropertyVector.size();
    4415           0 :     uno::Sequence< beans::PropertyValue > aRet( nCount );
    4416           0 :     beans::PropertyValue* pProps = aRet.getArray();
    4417             : 
    4418           0 :     for ( int i = 0; i < nCount; ++i, pProps++ )
    4419             :     {
    4420           0 :         *pProps = aPropertyVector[i];
    4421             :     }
    4422             : 
    4423           0 :     return aRet;
    4424         111 : }
    4425             : 
    4426             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10