LCOV - code coverage report
Current view: top level - sw/source/core/unocore - unosett.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1340 0.0 %
Date: 2014-04-14 Functions: 0 109 0.0 %
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 <editeng/memberids.hrc>
      22             : #include <swtypes.hxx>
      23             : #include <cmdid.h>
      24             : #include <hintids.hxx>
      25             : #include "poolfmt.hrc"
      26             : #include "poolfmt.hxx"
      27             : #include <fmtcol.hxx>
      28             : #include <unomap.hxx>
      29             : #include <unostyle.hxx>
      30             : #include <unosett.hxx>
      31             : #include <unoprnms.hxx>
      32             : #include <ftninfo.hxx>
      33             : #include <doc.hxx>
      34             : #include <pagedesc.hxx>
      35             : #include <charfmt.hxx>
      36             : #include <lineinfo.hxx>
      37             : #include <docsh.hxx>
      38             : #include <docary.hxx>
      39             : #include <docstyle.hxx>
      40             : #include <fmtclds.hxx>
      41             : #include <editeng/brushitem.hxx>
      42             : #include <com/sun/star/text/XFootnotesSettingsSupplier.hpp>
      43             : #include <com/sun/star/text/XFootnote.hpp>
      44             : #include <com/sun/star/text/XFootnotesSupplier.hpp>
      45             : #include <com/sun/star/text/XEndnotesSupplier.hpp>
      46             : #include <com/sun/star/text/XEndnotesSettingsSupplier.hpp>
      47             : #include <com/sun/star/text/FootnoteNumbering.hpp>
      48             : #include <com/sun/star/text/HoriOrientation.hpp>
      49             : #include <com/sun/star/style/LineNumberPosition.hpp>
      50             : #include <com/sun/star/awt/XBitmap.hpp>
      51             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      52             : #include <com/sun/star/style/VerticalAlignment.hpp>
      53             : #include <vcl/font.hxx>
      54             : #include <editeng/flstitem.hxx>
      55             : #include <vcl/metric.hxx>
      56             : #include <svtools/ctrltool.hxx>
      57             : #include <osl/mutex.hxx>
      58             : #include <vcl/svapp.hxx>
      59             : #include <toolkit/helper/vclunohelper.hxx>
      60             : #include <editeng/unofdesc.hxx>
      61             : #include <fmtornt.hxx>
      62             : #include <SwStyleNameMapper.hxx>
      63             : #include <com/sun/star/text/PositionAndSpaceMode.hpp>
      64             : #include <com/sun/star/text/LabelFollow.hpp>
      65             : #include <numrule.hxx>
      66             : #include <comphelper/servicehelper.hxx>
      67             : #include <cppuhelper/supportsservice.hxx>
      68             : #include <paratr.hxx>
      69             : 
      70             : using namespace ::com::sun::star;
      71             : using namespace ::com::sun::star::uno;
      72             : using namespace ::com::sun::star::lang;
      73             : using namespace ::com::sun::star::beans;
      74             : using namespace ::com::sun::star::text;
      75             : using namespace ::com::sun::star::style;
      76             : 
      77           0 : struct PropValData
      78             : {
      79             :     uno::Any        aVal;
      80             :     OUString            sPropName;
      81           0 :     PropValData(void* pVal, const char* cPropName, uno::Type aType ) :
      82             :         aVal(pVal, aType),
      83           0 :         sPropName(OUString::createFromAscii(cPropName))
      84           0 :         {}
      85           0 :     PropValData(const uno::Any& rVal, const OUString& rPropName) :
      86             :         aVal(rVal),
      87           0 :         sPropName(rPropName)
      88           0 :         {}
      89             : };
      90             : 
      91             : // Constants for the css::text::ColumnSeparatorStyle
      92             : #define API_COL_LINE_NONE               0
      93             : #define API_COL_LINE_SOLID              1
      94             : #define API_COL_LINE_DOTTED             2
      95             : #define API_COL_LINE_DASHED             3
      96             : 
      97             : typedef std::vector<PropValData*> PropValDataArr;
      98             : 
      99             : #define WID_PREFIX                      0
     100             : #define WID_SUFFIX                      1
     101             : #define WID_NUMBERING_TYPE              2
     102             : #define WID_START_AT                    3
     103             : #define WID_FOOTNOTE_COUNTING           4
     104             : #define WID_PARAGRAPH_STYLE             5
     105             : #define WID_PAGE_STYLE                  6
     106             : #define WID_CHARACTER_STYLE             7
     107             : #define WID_POSITION_END_OF_DOC         8
     108             : #define WID_END_NOTICE                  9
     109             : #define WID_BEGIN_NOTICE                10
     110             : #define WID_ANCHOR_CHARACTER_STYLE      11
     111             : 
     112           0 : const SfxItemPropertySet* GetFootnoteSet()
     113             : {
     114             :     static const SfxItemPropertyMapEntry aFootnoteMap_Impl[] =
     115             :     {
     116           0 :         { OUString(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     117           0 :         { OUString(UNO_NAME_BEGIN_NOTICE),          WID_BEGIN_NOTICE,       ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     118           0 :         { OUString(UNO_NAME_CHAR_STYLE_NAME),       WID_CHARACTER_STYLE,    ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     119           0 :         { OUString(UNO_NAME_END_NOTICE),            WID_END_NOTICE ,        ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     120           0 :         { OUString(UNO_NAME_FOOTNOTE_COUNTING),     WID_FOOTNOTE_COUNTING,  ::getCppuType((const sal_Int16*)0), PROPERTY_NONE,     0},
     121           0 :         { OUString(UNO_NAME_NUMBERING_TYPE),        WID_NUMBERING_TYPE,     ::getCppuType((const sal_Int16*)0), PROPERTY_NONE,         0},
     122           0 :         { OUString(UNO_NAME_PAGE_STYLE_NAME),       WID_PAGE_STYLE,         ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     123           0 :         { OUString(UNO_NAME_PARA_STYLE_NAME),       WID_PARAGRAPH_STYLE,    ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     124           0 :         { OUString(UNO_NAME_POSITION_END_OF_DOC),   WID_POSITION_END_OF_DOC,::getBooleanCppuType(), PROPERTY_NONE,         0},
     125           0 :         { OUString(UNO_NAME_PREFIX),                WID_PREFIX,             ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     126           0 :         { OUString(UNO_NAME_START_AT),              WID_START_AT ,          ::getCppuType((const sal_Int16*)0), PROPERTY_NONE,         0},
     127           0 :         { OUString(UNO_NAME_SUFFIX),                WID_SUFFIX,             ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     128             :         { OUString(), 0, css::uno::Type(), 0, 0 }
     129           0 :     };
     130           0 :     static const SfxItemPropertySet aFootnoteSet_Impl(aFootnoteMap_Impl);
     131           0 :     return &aFootnoteSet_Impl;
     132             : }
     133             : 
     134           0 : const SfxItemPropertySet* GetEndnoteSet()
     135             : {
     136             :     static const SfxItemPropertyMapEntry aEndnoteMap_Impl[] =
     137             :     {
     138           0 :         { OUString(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     139           0 :         { OUString(UNO_NAME_CHAR_STYLE_NAME),       WID_CHARACTER_STYLE,    ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     140           0 :         { OUString(UNO_NAME_NUMBERING_TYPE),        WID_NUMBERING_TYPE,     ::getCppuType((const sal_Int16*)0), PROPERTY_NONE,         0},
     141           0 :         { OUString(UNO_NAME_PAGE_STYLE_NAME),       WID_PAGE_STYLE,         ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     142           0 :         { OUString(UNO_NAME_PARA_STYLE_NAME),       WID_PARAGRAPH_STYLE,    ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     143           0 :         { OUString(UNO_NAME_PREFIX),                WID_PREFIX,     ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     144           0 :         { OUString(UNO_NAME_START_AT),              WID_START_AT ,          ::getCppuType((const sal_Int16*)0), PROPERTY_NONE,         0},
     145           0 :         { OUString(UNO_NAME_SUFFIX),                WID_SUFFIX,     ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     146             :         { OUString(), 0, css::uno::Type(), 0, 0 }
     147           0 :     };
     148           0 :     static const SfxItemPropertySet aEndnoteSet_Impl(aEndnoteMap_Impl);
     149           0 :     return &aEndnoteSet_Impl;
     150             : }
     151             : 
     152           0 : const SfxItemPropertySet* GetNumberingRulesSet()
     153             : {
     154             :     static const SfxItemPropertyMapEntry aNumberingRulesMap_Impl[] =
     155             :     {
     156           0 :         { OUString(UNO_NAME_IS_ABSOLUTE_MARGINS),       WID_IS_ABS_MARGINS, ::getBooleanCppuType(),            PROPERTY_NONE,     0},
     157           0 :         { OUString(UNO_NAME_IS_AUTOMATIC),              WID_IS_AUTOMATIC,   ::getBooleanCppuType(),            PROPERTY_NONE,     0},
     158           0 :         { OUString(UNO_NAME_IS_CONTINUOUS_NUMBERING),   WID_CONTINUOUS,     ::getBooleanCppuType(),            PROPERTY_NONE,     0},
     159           0 :         { OUString(UNO_NAME_NAME),                      WID_RULE_NAME   ,   ::getCppuType((const OUString*)0), PropertyAttribute::READONLY,     0},
     160           0 :         { OUString(UNO_NAME_NUMBERING_IS_OUTLINE),      WID_IS_OUTLINE, ::getBooleanCppuType(),            PROPERTY_NONE,     0},
     161           0 :         { OUString(UNO_NAME_DEFAULT_LIST_ID),           WID_DEFAULT_LIST_ID, ::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0},
     162             :         { OUString(), 0, css::uno::Type(), 0, 0 }
     163           0 :     };
     164           0 :     static const SfxItemPropertySet  aNumberingRulesSet_Impl( aNumberingRulesMap_Impl );
     165           0 :     return &aNumberingRulesSet_Impl;
     166             : }
     167             : 
     168             : #define WID_NUM_ON                      0
     169             : #define WID_SEPARATOR_INTERVAL          1
     170             : #define WID_NUMBERING_TYPE              2
     171             : #define WID_NUMBER_POSITION             3
     172             : #define WID_DISTANCE                    4
     173             : #define WID_INTERVAL                    5
     174             : #define WID_SEPARATOR_TEXT              6
     175             : #define WID_COUNT_EMPTY_LINES           8
     176             : #define WID_COUNT_LINES_IN_FRAMES       9
     177             : #define WID_RESTART_AT_EACH_PAGE        10
     178             : 
     179           0 : const SfxItemPropertySet* GetLineNumberingSet()
     180             : {
     181             :     static const SfxItemPropertyMapEntry aLineNumberingMap_Impl[] =
     182             :     {
     183           0 :         { OUString(UNO_NAME_CHAR_STYLE_NAME),         WID_CHARACTER_STYLE,    ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     184           0 :         { OUString(UNO_NAME_COUNT_EMPTY_LINES),       WID_COUNT_EMPTY_LINES , ::getBooleanCppuType(),PROPERTY_NONE,     0},
     185           0 :         { OUString(UNO_NAME_COUNT_LINES_IN_FRAMES),   WID_COUNT_LINES_IN_FRAMES, ::getBooleanCppuType(),PROPERTY_NONE,     0},
     186           0 :         { OUString(UNO_NAME_DISTANCE),                WID_DISTANCE       ,    ::getCppuType((const sal_Int32*)0),PROPERTY_NONE,     0},
     187           0 :         { OUString(UNO_NAME_IS_ON),                   WID_NUM_ON,             ::getBooleanCppuType()  ,          PROPERTY_NONE,     0},
     188           0 :         { OUString(UNO_NAME_INTERVAL),                WID_INTERVAL  ,       ::getCppuType((const sal_Int16*)0),PROPERTY_NONE,     0},
     189           0 :         { OUString(UNO_NAME_SEPARATOR_TEXT),          WID_SEPARATOR_TEXT,   ::getCppuType((const OUString*)0), PROPERTY_NONE,     0},
     190           0 :         { OUString(UNO_NAME_NUMBER_POSITION),         WID_NUMBER_POSITION,    ::getCppuType((const sal_Int16*)0),PROPERTY_NONE,     0},
     191           0 :         { OUString(UNO_NAME_NUMBERING_TYPE),          WID_NUMBERING_TYPE ,    ::getCppuType((const sal_Int16*)0),PROPERTY_NONE,     0},
     192           0 :         { OUString(UNO_NAME_RESTART_AT_EACH_PAGE),    WID_RESTART_AT_EACH_PAGE, ::getBooleanCppuType()  ,          PROPERTY_NONE,     0},
     193           0 :         { OUString(UNO_NAME_SEPARATOR_INTERVAL),      WID_SEPARATOR_INTERVAL, ::getCppuType((const sal_Int16*)0),PROPERTY_NONE,     0},
     194             :         { OUString(), 0, css::uno::Type(), 0, 0 }
     195           0 :     };
     196           0 :     static const SfxItemPropertySet aLineNumberingSet_Impl(aLineNumberingMap_Impl);
     197           0 :     return &aLineNumberingSet_Impl;
     198             : }
     199             : 
     200           0 : static SwCharFmt* lcl_getCharFmt(SwDoc* pDoc, const uno::Any& aValue)
     201             : {
     202           0 :     SwCharFmt* pRet = 0;
     203           0 :     OUString uTmp;
     204           0 :     aValue >>= uTmp;
     205           0 :     OUString sCharFmt;
     206           0 :     SwStyleNameMapper::FillUIName(uTmp, sCharFmt, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true);
     207           0 :     if (sCharFmt != SW_RESSTR(STR_POOLCOLL_STANDARD))
     208             :     {
     209           0 :         pRet = pDoc->FindCharFmtByName( sCharFmt );
     210             :     }
     211           0 :     if(!pRet)
     212             :     {
     213           0 :         sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sCharFmt, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
     214           0 :         if(USHRT_MAX != nId)
     215           0 :             pRet = pDoc->GetCharFmtFromPool( nId );
     216             :     }
     217           0 :     return pRet;
     218             : }
     219             : 
     220           0 : static SwTxtFmtColl* lcl_GetParaStyle(SwDoc* pDoc, const uno::Any& aValue)
     221             : {
     222           0 :     OUString uTmp;
     223           0 :     aValue >>= uTmp;
     224           0 :     OUString sParaStyle;
     225           0 :     SwStyleNameMapper::FillUIName(uTmp, sParaStyle, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true );
     226           0 :     SwTxtFmtColl* pRet = pDoc->FindTxtFmtCollByName( sParaStyle );
     227           0 :     if( !pRet  )
     228             :     {
     229           0 :         sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sParaStyle, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
     230           0 :         if( USHRT_MAX != nId  )
     231           0 :             pRet = pDoc->GetTxtCollFromPool( nId );
     232             :     }
     233           0 :     return pRet;
     234             : }
     235             : 
     236           0 : static SwPageDesc* lcl_GetPageDesc(SwDoc* pDoc, const uno::Any& aValue)
     237             : {
     238           0 :     SwPageDesc* pRet = 0;
     239           0 :     sal_uInt16 nCount = pDoc->GetPageDescCnt();
     240           0 :     OUString uTmp;
     241           0 :     aValue >>= uTmp;
     242           0 :     OUString sPageDesc;
     243           0 :     SwStyleNameMapper::FillUIName(uTmp, sPageDesc, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, true );
     244           0 :     for( sal_uInt16 i = 0; i < nCount; i++)
     245             :     {
     246           0 :         const SwPageDesc& rDesc = pDoc->GetPageDesc( i );
     247           0 :         if(rDesc.GetName() == sPageDesc)
     248             :         {
     249           0 :             pRet = (SwPageDesc*)&rDesc;
     250           0 :             break;
     251             :         }
     252             :     }
     253           0 :     if(!pRet)
     254             :     {
     255           0 :         sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sPageDesc, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC);
     256           0 :         if(USHRT_MAX != nId)
     257           0 :             pRet = pDoc->GetPageDescFromPool( nId );
     258             :     }
     259           0 :     return pRet;
     260             : }
     261             : 
     262             : // Numbering
     263             : const unsigned short aSvxToUnoAdjust[] =
     264             : {
     265             :     text::HoriOrientation::LEFT,    //3
     266             :     text::HoriOrientation::RIGHT,  //1
     267             :     USHRT_MAX,
     268             :     text::HoriOrientation::CENTER, //2
     269             :     USHRT_MAX,
     270             :     USHRT_MAX
     271             : };
     272             : 
     273             : const unsigned short aUnoToSvxAdjust[] =
     274             : {
     275             :     USHRT_MAX,
     276             :     SVX_ADJUST_RIGHT,       // 1
     277             :     SVX_ADJUST_CENTER,      // 3
     278             :     SVX_ADJUST_LEFT,        // 0
     279             :     USHRT_MAX,
     280             :     USHRT_MAX
     281             : };
     282             : 
     283             : /******************************************************************
     284             :  * SwXFootnoteProperties
     285             :  ******************************************************************/
     286           0 : OUString SwXFootnoteProperties::getImplementationName(void) throw( RuntimeException, std::exception )
     287             : {
     288           0 :     return OUString("SwXFootnoteProperties");
     289             : }
     290             : 
     291           0 : sal_Bool SwXFootnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException, std::exception )
     292             : {
     293           0 :     return cppu::supportsService(this, rServiceName);
     294             : }
     295             : 
     296           0 : Sequence< OUString > SwXFootnoteProperties::getSupportedServiceNames(void) throw( RuntimeException, std::exception )
     297             : {
     298           0 :     Sequence< OUString > aRet(1);
     299           0 :     OUString* pArray = aRet.getArray();
     300           0 :     pArray[0] = "com.sun.star.text.FootnoteSettings";
     301           0 :     return aRet;
     302             : }
     303             : 
     304           0 : SwXFootnoteProperties::SwXFootnoteProperties(SwDoc* pDc) :
     305             :     pDoc(pDc),
     306           0 :     m_pPropertySet(GetFootnoteSet())
     307             : {
     308           0 : }
     309             : 
     310           0 : SwXFootnoteProperties::~SwXFootnoteProperties()
     311             : {
     312             : 
     313           0 : }
     314             : 
     315           0 : uno::Reference< beans::XPropertySetInfo >  SwXFootnoteProperties::getPropertySetInfo(void)
     316             :                                                                 throw( uno::RuntimeException, std::exception )
     317             : {
     318           0 :     static uno::Reference< beans::XPropertySetInfo >  aRef = m_pPropertySet->getPropertySetInfo();
     319           0 :     return aRef;
     320             : }
     321             : 
     322           0 : void SwXFootnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
     323             :     throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     324             : {
     325           0 :     SolarMutexGuard aGuard;
     326           0 :     if(pDoc)
     327             :     {
     328           0 :         const SfxItemPropertySimpleEntry*  pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
     329           0 :         if(pEntry)
     330             :         {
     331           0 :             if ( pEntry->nFlags & PropertyAttribute::READONLY)
     332           0 :                 throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     333           0 :             SwFtnInfo aFtnInfo(pDoc->GetFtnInfo());
     334           0 :             switch(pEntry->nWID)
     335             :             {
     336             :                 case WID_PREFIX:
     337             :                 {
     338           0 :                     OUString uTmp;
     339           0 :                     aValue >>= uTmp;
     340           0 :                     aFtnInfo.SetPrefix(uTmp);
     341             :                 }
     342           0 :                 break;
     343             :                 case WID_SUFFIX:
     344             :                 {
     345           0 :                     OUString uTmp;
     346           0 :                     aValue >>= uTmp;
     347           0 :                     aFtnInfo.SetSuffix(uTmp);
     348             :                 }
     349           0 :                 break;
     350             :                 case WID_NUMBERING_TYPE:
     351             :                 {
     352           0 :                     sal_Int16 nTmp = 0;
     353           0 :                     aValue >>= nTmp;
     354           0 :                     if(nTmp >= 0 &&
     355           0 :                         (nTmp <= SVX_NUM_ARABIC ||
     356           0 :                             nTmp > SVX_NUM_BITMAP))
     357           0 :                         aFtnInfo.aFmt.SetNumberingType(nTmp);
     358             :                     else
     359           0 :                         throw lang::IllegalArgumentException();
     360             :                 }
     361           0 :                 break;
     362             :                 case WID_START_AT:
     363             :                 {
     364           0 :                     sal_Int16 nTmp = 0;
     365           0 :                     aValue >>= nTmp;
     366           0 :                     aFtnInfo.nFtnOffset = nTmp;
     367             :                 }
     368           0 :                 break;
     369             :                 case WID_FOOTNOTE_COUNTING:
     370             :                 {
     371           0 :                     sal_Int16 nTmp = 0;
     372           0 :                     aValue >>= nTmp;
     373           0 :                     switch(nTmp)
     374             :                     {
     375             :                         case  FootnoteNumbering::PER_PAGE:
     376           0 :                             aFtnInfo.eNum = FTNNUM_PAGE;
     377           0 :                         break;
     378             :                         case  FootnoteNumbering::PER_CHAPTER:
     379           0 :                             aFtnInfo.eNum = FTNNUM_CHAPTER;
     380           0 :                         break;
     381             :                         case  FootnoteNumbering::PER_DOCUMENT:
     382           0 :                             aFtnInfo.eNum = FTNNUM_DOC;
     383           0 :                         break;
     384             :                     }
     385             :                 }
     386           0 :                 break;
     387             :                 case WID_PARAGRAPH_STYLE:
     388             :                 {
     389           0 :                     SwTxtFmtColl* pColl = lcl_GetParaStyle(pDoc, aValue);
     390           0 :                     if(pColl)
     391           0 :                         aFtnInfo.SetFtnTxtColl(*pColl);
     392             :                 }
     393           0 :                 break;
     394             :                 case WID_PAGE_STYLE:
     395             :                 {
     396           0 :                     SwPageDesc* pDesc = lcl_GetPageDesc(pDoc, aValue);
     397           0 :                     if(pDesc)
     398           0 :                         aFtnInfo.ChgPageDesc( pDesc );
     399             :                 }
     400           0 :                 break;
     401             :                 case WID_ANCHOR_CHARACTER_STYLE:
     402             :                 case WID_CHARACTER_STYLE:
     403             :                 {
     404           0 :                     SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
     405           0 :                     if(pFmt)
     406             :                     {
     407           0 :                         if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE)
     408           0 :                             aFtnInfo.SetAnchorCharFmt(pFmt);
     409             :                         else
     410           0 :                             aFtnInfo.SetCharFmt(pFmt);
     411             :                     }
     412             :                 }
     413           0 :                 break;
     414             :                 case WID_POSITION_END_OF_DOC:
     415             :                 {
     416           0 :                     sal_Bool bVal = *(sal_Bool*)aValue.getValue();
     417           0 :                     aFtnInfo.ePos = bVal ? FTNPOS_CHAPTER : FTNPOS_PAGE;
     418             :                 }
     419           0 :                 break;
     420             :                 case WID_END_NOTICE:
     421             :                 {
     422           0 :                     OUString uTmp;
     423           0 :                     aValue >>= uTmp;
     424           0 :                     aFtnInfo.aQuoVadis = uTmp;
     425             :                 }
     426           0 :                 break;
     427             :                 case WID_BEGIN_NOTICE:
     428             :                 {
     429           0 :                     OUString uTmp;
     430           0 :                     aValue >>= uTmp;
     431           0 :                     aFtnInfo.aErgoSum = uTmp;
     432             :                 }
     433           0 :                 break;
     434             :             }
     435           0 :             pDoc->SetFtnInfo(aFtnInfo);
     436             :         }
     437             :         else
     438           0 :             throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     439             :     }
     440             :     else
     441           0 :         throw uno::RuntimeException();
     442           0 : }
     443             : 
     444           0 : uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName)
     445             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     446             : {
     447           0 :     SolarMutexGuard aGuard;
     448           0 :     uno::Any aRet;
     449           0 :     if(pDoc)
     450             :     {
     451           0 :         const SfxItemPropertySimpleEntry*  pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
     452           0 :         if(pEntry)
     453             :         {
     454           0 :             const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo();
     455           0 :             switch(pEntry->nWID)
     456             :             {
     457             :                 case WID_PREFIX:
     458             :                 {
     459           0 :                     aRet <<= OUString(rFtnInfo.GetPrefix());
     460             :                 }
     461           0 :                 break;
     462             :                 case WID_SUFFIX:
     463             :                 {
     464           0 :                     aRet <<= OUString(rFtnInfo.GetSuffix());
     465             :                 }
     466           0 :                 break;
     467             :                 case  WID_NUMBERING_TYPE :
     468             :                 {
     469           0 :                     aRet <<= rFtnInfo.aFmt.GetNumberingType();
     470             :                 }
     471           0 :                 break;
     472             :                 case  WID_START_AT:
     473           0 :                     aRet <<= (sal_Int16)rFtnInfo.nFtnOffset;
     474           0 :                 break;
     475             :                 case  WID_FOOTNOTE_COUNTING  :
     476             :                 {
     477           0 :                     sal_Int16 nRet = 0;
     478           0 :                     switch(rFtnInfo.eNum)
     479             :                     {
     480             :                         case  FTNNUM_PAGE:
     481           0 :                             nRet = FootnoteNumbering::PER_PAGE;
     482           0 :                         break;
     483             :                         case  FTNNUM_CHAPTER:
     484           0 :                             nRet = FootnoteNumbering::PER_CHAPTER;
     485           0 :                         break;
     486             :                         case  FTNNUM_DOC:
     487           0 :                             nRet = FootnoteNumbering::PER_DOCUMENT;
     488           0 :                         break;
     489             :                     }
     490           0 :                     aRet <<= nRet;
     491             :                 }
     492           0 :                 break;
     493             :                 case  WID_PARAGRAPH_STYLE    :
     494             :                 {
     495           0 :                     SwTxtFmtColl* pColl = rFtnInfo.GetFtnTxtColl();
     496           0 :                     OUString aString;
     497           0 :                     if(pColl)
     498           0 :                         aString = pColl->GetName();
     499           0 :                     SwStyleNameMapper::FillProgName(aString, aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true);
     500           0 :                     aRet <<= aString;
     501             :                 }
     502           0 :                 break;
     503             :                 case  WID_PAGE_STYLE :
     504             :                 {
     505           0 :                     OUString aString;
     506           0 :                     if( rFtnInfo.KnowsPageDesc() )
     507             :                     {
     508             :                         SwStyleNameMapper::FillProgName(
     509             :                                 rFtnInfo.GetPageDesc( *pDoc )->GetName(),
     510             :                                 aString,
     511             :                                 nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC,
     512           0 :                                 true);
     513             :                     }
     514           0 :                     aRet <<= aString;
     515             :                 }
     516           0 :                 break;
     517             :                 case WID_ANCHOR_CHARACTER_STYLE:
     518             :                 case WID_CHARACTER_STYLE:
     519             :                 {
     520           0 :                     OUString aString;
     521           0 :                     const SwCharFmt* pCharFmt = 0;
     522           0 :                     if( pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE )
     523             :                     {
     524           0 :                         if( rFtnInfo.GetAnchorCharFmtDep()->GetRegisteredIn() )
     525           0 :                             pCharFmt = rFtnInfo.GetAnchorCharFmt(*pDoc);
     526             :                     }
     527             :                     else
     528             :                     {
     529           0 :                         if( rFtnInfo.GetCharFmtDep()->GetRegisteredIn() )
     530           0 :                             pCharFmt = rFtnInfo.GetCharFmt(*pDoc);
     531             :                     }
     532           0 :                     if( pCharFmt )
     533             :                     {
     534             :                         SwStyleNameMapper::FillProgName(
     535             :                                 pCharFmt->GetName(),
     536             :                                 aString,
     537             :                                 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
     538           0 :                                 true);
     539             :                     }
     540           0 :                     aRet <<= aString;
     541             :                 }
     542           0 :                 break;
     543             :                 case  WID_POSITION_END_OF_DOC:
     544             :                 {
     545           0 :                     sal_Bool bTemp = FTNPOS_CHAPTER == rFtnInfo.ePos;
     546           0 :                     aRet.setValue(&bTemp, ::getCppuBooleanType());
     547             :                 }
     548           0 :                 break;
     549             :                 case  WID_END_NOTICE         :
     550           0 :                     aRet <<= OUString(rFtnInfo.aQuoVadis);
     551           0 :                 break;
     552             :                 case  WID_BEGIN_NOTICE       :
     553           0 :                     aRet <<= OUString(rFtnInfo.aErgoSum);
     554           0 :                 break;
     555             :             }
     556             :         }
     557             :         else
     558           0 :             throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     559             :     }
     560             :     else
     561           0 :         throw uno::RuntimeException();
     562           0 :     return aRet;
     563             : }
     564             : 
     565           0 : void SwXFootnoteProperties::addPropertyChangeListener(
     566             :     const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
     567             :         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     568             : {
     569             :     OSL_FAIL("not implemented");
     570           0 : }
     571             : 
     572           0 : void SwXFootnoteProperties::removePropertyChangeListener(
     573             :     const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
     574             :         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     575             : {
     576             :     OSL_FAIL("not implemented");
     577           0 : }
     578             : 
     579           0 : void SwXFootnoteProperties::addVetoableChangeListener(
     580             :     const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
     581             :         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     582             : {
     583             :     OSL_FAIL("not implemented");
     584           0 : }
     585             : 
     586           0 : void SwXFootnoteProperties::removeVetoableChangeListener(
     587             :     const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
     588             :         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     589             : {
     590             :     OSL_FAIL("not implemented");
     591           0 : }
     592             : 
     593             : /******************************************************************
     594             :  * SwXEndnoteProperties
     595             :  ******************************************************************/
     596           0 : OUString SwXEndnoteProperties::getImplementationName(void) throw( RuntimeException, std::exception )
     597             : {
     598           0 :     return OUString("SwXEndnoteProperties");
     599             : }
     600             : 
     601           0 : sal_Bool SwXEndnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException, std::exception )
     602             : {
     603           0 :     return cppu::supportsService(this, rServiceName);
     604             : }
     605             : 
     606           0 : Sequence< OUString > SwXEndnoteProperties::getSupportedServiceNames(void) throw( RuntimeException, std::exception )
     607             : {
     608           0 :     Sequence< OUString > aRet(1);
     609           0 :     OUString* pArray = aRet.getArray();
     610           0 :     pArray[0] = "com.sun.star.text.FootnoteSettings";
     611           0 :     return aRet;
     612             : }
     613             : 
     614           0 : SwXEndnoteProperties::SwXEndnoteProperties(SwDoc* pDc) :
     615             :     pDoc(pDc),
     616           0 :     m_pPropertySet(GetEndnoteSet())
     617             : {
     618           0 : }
     619             : 
     620           0 : SwXEndnoteProperties::~SwXEndnoteProperties()
     621             : {
     622           0 : }
     623             : 
     624           0 : uno::Reference< beans::XPropertySetInfo >  SwXEndnoteProperties::getPropertySetInfo(void) throw( uno::RuntimeException, std::exception )
     625             : {
     626           0 :     static uno::Reference< beans::XPropertySetInfo >  aRef = m_pPropertySet->getPropertySetInfo();
     627           0 :     return aRef;
     628             : }
     629             : 
     630           0 : void SwXEndnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
     631             :     throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
     632             :         lang::WrappedTargetException, uno::RuntimeException, std::exception )
     633             : {
     634           0 :     SolarMutexGuard aGuard;
     635           0 :     if(pDoc)
     636             :     {
     637           0 :         const SfxItemPropertySimpleEntry*  pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
     638           0 :         if(pEntry)
     639             :         {
     640           0 :             if ( pEntry->nFlags & PropertyAttribute::READONLY)
     641           0 :                 throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     642           0 :             SwEndNoteInfo aEndInfo(pDoc->GetEndNoteInfo());
     643           0 :             switch(pEntry->nWID)
     644             :             {
     645             :                 case WID_PREFIX:
     646             :                 {
     647           0 :                     OUString uTmp;
     648           0 :                     aValue >>= uTmp;
     649           0 :                     aEndInfo.SetPrefix(uTmp);
     650             :                 }
     651           0 :                 break;
     652             :                 case WID_SUFFIX:
     653             :                 {
     654           0 :                     OUString uTmp;
     655           0 :                     aValue >>= uTmp;
     656           0 :                     aEndInfo.SetSuffix(uTmp);
     657             :                 }
     658           0 :                 break;
     659             :                 case  WID_NUMBERING_TYPE :
     660             :                 {
     661           0 :                     sal_Int16 nTmp = 0;
     662           0 :                     aValue >>= nTmp;
     663           0 :                     aEndInfo.aFmt.SetNumberingType(nTmp);
     664             :                 }
     665           0 :                 break;
     666             :                 case  WID_START_AT:
     667             :                 {
     668           0 :                     sal_Int16 nTmp = 0;
     669           0 :                     aValue >>= nTmp;
     670           0 :                     aEndInfo.nFtnOffset = nTmp;
     671             :                 }
     672           0 :                 break;
     673             :                 case  WID_PARAGRAPH_STYLE    :
     674             :                 {
     675           0 :                     SwTxtFmtColl* pColl = lcl_GetParaStyle(pDoc, aValue);
     676           0 :                     if(pColl)
     677           0 :                         aEndInfo.SetFtnTxtColl(*pColl);
     678             :                 }
     679           0 :                 break;
     680             :                 case  WID_PAGE_STYLE :
     681             :                 {
     682           0 :                     SwPageDesc* pDesc = lcl_GetPageDesc(pDoc, aValue);
     683           0 :                     if(pDesc)
     684           0 :                         aEndInfo.ChgPageDesc( pDesc );
     685             :                 }
     686           0 :                 break;
     687             :                 case WID_ANCHOR_CHARACTER_STYLE:
     688             :                 case  WID_CHARACTER_STYLE    :
     689             :                 {
     690           0 :                     SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
     691           0 :                     if(pFmt)
     692             :                     {
     693           0 :                         if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE)
     694           0 :                             aEndInfo.SetAnchorCharFmt(pFmt);
     695             :                         else
     696           0 :                             aEndInfo.SetCharFmt(pFmt);
     697             :                     }
     698             :                 }
     699           0 :                 break;
     700             :             }
     701           0 :             pDoc->SetEndNoteInfo(aEndInfo);
     702             :         }
     703             :         else
     704           0 :             throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     705           0 :     }
     706           0 : }
     707             : 
     708           0 : uno::Any SwXEndnoteProperties::getPropertyValue(const OUString& rPropertyName)
     709             :     throw( UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception )
     710             : {
     711           0 :     SolarMutexGuard aGuard;
     712           0 :     uno::Any aRet;
     713           0 :     if(pDoc)
     714             :     {
     715           0 :         const SfxItemPropertySimpleEntry*  pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
     716           0 :         if(pEntry)
     717             :         {
     718           0 :             const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
     719           0 :             switch(pEntry->nWID)
     720             :             {
     721             :                 case WID_PREFIX:
     722           0 :                     aRet <<= rEndInfo.GetPrefix();
     723           0 :                 break;
     724             :                 case WID_SUFFIX:
     725           0 :                     aRet <<= rEndInfo.GetSuffix();
     726           0 :                 break;
     727             :                 case  WID_NUMBERING_TYPE :
     728           0 :                     aRet <<= rEndInfo.aFmt.GetNumberingType();
     729           0 :                 break;
     730             :                 case  WID_START_AT:
     731           0 :                     aRet <<= (sal_Int16)rEndInfo.nFtnOffset;
     732           0 :                 break;
     733             :                 case  WID_PARAGRAPH_STYLE    :
     734             :                 {
     735           0 :                     SwTxtFmtColl* pColl = rEndInfo.GetFtnTxtColl();
     736           0 :                     OUString aString;
     737           0 :                     if(pColl)
     738           0 :                         aString = pColl->GetName();
     739             :                     SwStyleNameMapper::FillProgName(
     740             :                             aString,
     741             :                             aString,
     742             :                             nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
     743           0 :                             true);
     744           0 :                     aRet <<= aString;
     745             : 
     746             :                 }
     747           0 :                 break;
     748             :                 case  WID_PAGE_STYLE :
     749             :                 {
     750           0 :                     OUString aString;
     751           0 :                     if( rEndInfo.KnowsPageDesc() )
     752             :                     {
     753             :                         SwStyleNameMapper::FillProgName(
     754             :                             rEndInfo.GetPageDesc( *pDoc )->GetName(),
     755             :                             aString,
     756             :                             nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC,
     757           0 :                             true );
     758             :                     }
     759           0 :                     aRet <<= aString;
     760             :                 }
     761           0 :                 break;
     762             :                 case WID_ANCHOR_CHARACTER_STYLE:
     763             :                 case WID_CHARACTER_STYLE:
     764             :                 {
     765           0 :                     OUString aString;
     766           0 :                     const SwCharFmt* pCharFmt = 0;
     767           0 :                     if( pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE )
     768             :                     {
     769           0 :                         if( rEndInfo.GetAnchorCharFmtDep()->GetRegisteredIn() )
     770           0 :                             pCharFmt = rEndInfo.GetAnchorCharFmt(*pDoc);
     771             :                     }
     772             :                     else
     773             :                     {
     774           0 :                         if( rEndInfo.GetCharFmtDep()->GetRegisteredIn() )
     775           0 :                             pCharFmt = rEndInfo.GetCharFmt(*pDoc);
     776             :                     }
     777           0 :                     if( pCharFmt )
     778             :                     {
     779             :                         SwStyleNameMapper::FillProgName(
     780             :                                 pCharFmt->GetName(),
     781             :                                 aString,
     782             :                                 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
     783           0 :                                 true );
     784             :                     }
     785           0 :                     aRet <<= aString;
     786             :                 }
     787           0 :                 break;
     788             :             }
     789             :         }
     790             :         else
     791           0 :             throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     792             :     }
     793           0 :     return aRet;
     794             : }
     795             : 
     796           0 : void SwXEndnoteProperties::addPropertyChangeListener(
     797             :     const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     798             : {
     799             :     OSL_FAIL("not implemented");
     800           0 : }
     801             : 
     802           0 : void SwXEndnoteProperties::removePropertyChangeListener(const OUString& /*PropertyName*/,
     803             :         const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/)
     804             :         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     805             : {
     806             :     OSL_FAIL("not implemented");
     807           0 : }
     808             : 
     809           0 : void SwXEndnoteProperties::addVetoableChangeListener(const OUString& /*PropertyName*/,
     810             :     const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
     811             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     812             : {
     813             :     OSL_FAIL("not implemented");
     814           0 : }
     815             : 
     816           0 : void SwXEndnoteProperties::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
     817             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
     818             : {
     819             :     OSL_FAIL("not implemented");
     820           0 : }
     821             : 
     822             : /******************************************************************
     823             :  * SwXLineNumberingProperties
     824             :  ******************************************************************/
     825           0 : OUString SwXLineNumberingProperties::getImplementationName(void) throw( RuntimeException, std::exception )
     826             : {
     827           0 :     return OUString("SwXLineNumberingProperties");
     828             : }
     829             : 
     830           0 : sal_Bool SwXLineNumberingProperties::supportsService(const OUString& rServiceName) throw( RuntimeException, std::exception )
     831             : {
     832           0 :     return cppu::supportsService(this, rServiceName);
     833             : }
     834             : 
     835           0 : Sequence< OUString > SwXLineNumberingProperties::getSupportedServiceNames(void) throw( RuntimeException, std::exception )
     836             : {
     837           0 :     Sequence< OUString > aRet(1);
     838           0 :     OUString* pArray = aRet.getArray();
     839           0 :     pArray[0] = "com.sun.star.text.LineNumberingProperties";
     840           0 :     return aRet;
     841             : }
     842             : 
     843           0 : SwXLineNumberingProperties::SwXLineNumberingProperties(SwDoc* pDc) :
     844             :     pDoc(pDc),
     845           0 :     m_pPropertySet(GetLineNumberingSet())
     846             : {
     847           0 : }
     848             : 
     849           0 : SwXLineNumberingProperties::~SwXLineNumberingProperties()
     850             : {
     851           0 : }
     852             : 
     853           0 : uno::Reference< beans::XPropertySetInfo >  SwXLineNumberingProperties::getPropertySetInfo(void) throw( uno::RuntimeException, std::exception )
     854             : {
     855           0 :     static uno::Reference< beans::XPropertySetInfo >  aRef = m_pPropertySet->getPropertySetInfo();
     856           0 :     return aRef;
     857             : }
     858             : 
     859           0 : void SwXLineNumberingProperties::setPropertyValue(
     860             :     const OUString& rPropertyName, const Any& aValue)
     861             :         throw( UnknownPropertyException, PropertyVetoException,
     862             :                 IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception )
     863             : {
     864           0 :     SolarMutexGuard aGuard;
     865           0 :     if(pDoc)
     866             :     {
     867           0 :         const SfxItemPropertySimpleEntry*  pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
     868           0 :         if(pEntry)
     869             :         {
     870           0 :             if ( pEntry->nFlags & PropertyAttribute::READONLY)
     871           0 :                 throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     872           0 :             SwLineNumberInfo  aInfo(pDoc->GetLineNumberInfo());
     873           0 :             switch(pEntry->nWID)
     874             :             {
     875             :                 case WID_NUM_ON:
     876             :                 {
     877           0 :                     sal_Bool bVal = *(sal_Bool*)aValue.getValue();
     878           0 :                     aInfo.SetPaintLineNumbers(bVal);
     879             :                 }
     880           0 :                 break;
     881             :                 case WID_CHARACTER_STYLE :
     882             :                 {
     883           0 :                     SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
     884           0 :                     if(pFmt)
     885           0 :                         aInfo.SetCharFmt(pFmt);
     886             :                 }
     887           0 :                 break;
     888             :                 case WID_NUMBERING_TYPE  :
     889             :                 {
     890           0 :                     SvxNumberType aNumType(aInfo.GetNumType());
     891           0 :                     sal_Int16 nTmp = 0;
     892           0 :                     aValue >>= nTmp;
     893           0 :                     aNumType.SetNumberingType(nTmp);
     894           0 :                     aInfo.SetNumType(aNumType);
     895             :                 }
     896           0 :                 break;
     897             :                 case WID_NUMBER_POSITION :
     898             :                 {
     899           0 :                     sal_Int16 nTmp = 0;
     900           0 :                     aValue >>= nTmp;
     901           0 :                     switch(nTmp)
     902             :                     {
     903             :                         case  style::LineNumberPosition::LEFT:
     904           0 :                              aInfo.SetPos(LINENUMBER_POS_LEFT); ;
     905           0 :                         break;
     906             :                         case style::LineNumberPosition::RIGHT :
     907           0 :                              aInfo.SetPos(LINENUMBER_POS_RIGHT);       ;
     908           0 :                         break;
     909             :                         case  style::LineNumberPosition::INSIDE:
     910           0 :                             aInfo.SetPos(LINENUMBER_POS_INSIDE);      ;
     911           0 :                         break;
     912             :                         case  style::LineNumberPosition::OUTSIDE:
     913           0 :                             aInfo.SetPos(LINENUMBER_POS_OUTSIDE);
     914           0 :                         break;
     915             :                     }
     916             :                 }
     917           0 :                 break;
     918             :                 case WID_DISTANCE        :
     919             :                 {
     920           0 :                     sal_Int32 nVal = 0;
     921           0 :                     aValue >>= nVal;
     922           0 :                     sal_Int32 nTmp = convertMm100ToTwip(nVal);
     923           0 :                     if (nTmp > USHRT_MAX)
     924           0 :                         nTmp = USHRT_MAX;
     925           0 :                     aInfo.SetPosFromLeft( static_cast< sal_uInt16 >(nTmp) );
     926             :                 }
     927           0 :                 break;
     928             :                 case WID_INTERVAL   :
     929             :                 {
     930           0 :                     sal_Int16 nTmp = 0;
     931           0 :                     aValue >>= nTmp;
     932           0 :                     if( nTmp > 0)
     933           0 :                         aInfo.SetCountBy(nTmp);
     934             :                 }
     935           0 :                 break;
     936             :                 case WID_SEPARATOR_TEXT  :
     937             :                 {
     938           0 :                     OUString uTmp;
     939           0 :                     aValue >>= uTmp;
     940           0 :                     aInfo.SetDivider(uTmp);
     941             :                 }
     942           0 :                 break;
     943             :                 case WID_SEPARATOR_INTERVAL:
     944             :                 {
     945           0 :                     sal_Int16 nTmp = 0;
     946           0 :                     aValue >>= nTmp;
     947           0 :                     if( nTmp >= 0)
     948           0 :                         aInfo.SetDividerCountBy(nTmp);
     949             :                 }
     950           0 :                 break;
     951             :                 case WID_COUNT_EMPTY_LINES :
     952             :                 {
     953           0 :                     sal_Bool bVal = *(sal_Bool*)aValue.getValue();
     954           0 :                     aInfo.SetCountBlankLines(bVal);
     955             :                 }
     956           0 :                 break;
     957             :                 case WID_COUNT_LINES_IN_FRAMES :
     958             :                 {
     959           0 :                     sal_Bool bVal = *(sal_Bool*)aValue.getValue();
     960           0 :                     aInfo.SetCountInFlys(bVal);
     961             :                 }
     962           0 :                 break;
     963             :                 case WID_RESTART_AT_EACH_PAGE :
     964             :                 {
     965           0 :                     sal_Bool bVal = *(sal_Bool*)aValue.getValue();
     966           0 :                     aInfo.SetRestartEachPage(bVal);
     967             :                 }
     968           0 :                 break;
     969             :             }
     970           0 :             pDoc->SetLineNumberInfo(aInfo);
     971             :         }
     972             :         else
     973           0 :             throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
     974             :     }
     975             :     else
     976           0 :         throw uno::RuntimeException();
     977           0 : }
     978             : 
     979           0 : Any SwXLineNumberingProperties::getPropertyValue(const OUString& rPropertyName)
     980             :     throw( UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception )
     981             : {
     982           0 :     SolarMutexGuard aGuard;
     983           0 :     Any aRet;
     984           0 :     if(pDoc)
     985             :     {
     986           0 :         const SfxItemPropertySimpleEntry*  pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
     987           0 :         if(pEntry)
     988             :         {
     989           0 :             const SwLineNumberInfo& rInfo = pDoc->GetLineNumberInfo();
     990           0 :             switch(pEntry->nWID)
     991             :             {
     992             :                 case WID_NUM_ON:
     993             :                 {
     994           0 :                     sal_Bool bTemp = rInfo.IsPaintLineNumbers();
     995           0 :                     aRet.setValue(&bTemp, ::getCppuBooleanType());
     996             :                 }
     997           0 :                 break;
     998             :                 case WID_CHARACTER_STYLE :
     999             :                 {
    1000           0 :                     OUString aString;
    1001             :                     // return empty string if no char format is set
    1002             :                     // otherwise it would be created here
    1003           0 :                     if(rInfo.HasCharFormat())
    1004             :                     {
    1005             :                         SwStyleNameMapper::FillProgName(
    1006           0 :                                     rInfo.GetCharFmt(*pDoc)->GetName(),
    1007             :                                     aString,
    1008             :                                     nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
    1009           0 :                                     true);
    1010             :                     }
    1011           0 :                     aRet <<= aString;
    1012             :                 }
    1013           0 :                 break;
    1014             :                 case WID_NUMBERING_TYPE  :
    1015           0 :                     aRet <<= rInfo.GetNumType().GetNumberingType();
    1016           0 :                 break;
    1017             :                 case WID_NUMBER_POSITION :
    1018             :                 {
    1019           0 :                     sal_Int16 nRet = 0;
    1020           0 :                     switch(rInfo.GetPos())
    1021             :                     {
    1022             :                         case  LINENUMBER_POS_LEFT:
    1023           0 :                             nRet = style::LineNumberPosition::LEFT;
    1024           0 :                         break;
    1025             :                         case LINENUMBER_POS_RIGHT :
    1026           0 :                             nRet = style::LineNumberPosition::RIGHT      ;
    1027           0 :                         break;
    1028             :                         case  LINENUMBER_POS_INSIDE:
    1029           0 :                             nRet = style::LineNumberPosition::INSIDE     ;
    1030           0 :                         break;
    1031             :                         case LINENUMBER_POS_OUTSIDE :
    1032           0 :                             nRet = style::LineNumberPosition::OUTSIDE    ;
    1033           0 :                         break;
    1034             :                     }
    1035           0 :                     aRet <<= nRet;
    1036             :                 }
    1037           0 :                 break;
    1038             :                 case WID_DISTANCE        :
    1039             :                 {
    1040           0 :                     sal_uInt32 nPos = rInfo.GetPosFromLeft();
    1041           0 :                     if(USHRT_MAX == nPos)
    1042           0 :                         nPos = 0;
    1043           0 :                     aRet <<= static_cast < sal_Int32 >(convertTwipToMm100(nPos));
    1044             :                 }
    1045           0 :                 break;
    1046             :                 case WID_INTERVAL   :
    1047           0 :                     aRet <<= (sal_Int16)rInfo.GetCountBy();
    1048           0 :                 break;
    1049             :                 case WID_SEPARATOR_TEXT  :
    1050           0 :                     aRet <<= rInfo.GetDivider();
    1051           0 :                 break;
    1052             :                 case WID_SEPARATOR_INTERVAL:
    1053           0 :                     aRet <<= (sal_Int16)rInfo.GetDividerCountBy();
    1054           0 :                 break;
    1055             :                 case WID_COUNT_EMPTY_LINES :
    1056             :                 {
    1057           0 :                     sal_Bool bTemp = rInfo.IsCountBlankLines();
    1058           0 :                     aRet.setValue(&bTemp, ::getCppuBooleanType());
    1059             :                 }
    1060           0 :                 break;
    1061             :                 case WID_COUNT_LINES_IN_FRAMES :
    1062             :                 {
    1063           0 :                     sal_Bool bTemp = rInfo.IsCountInFlys();
    1064           0 :                     aRet.setValue(&bTemp, ::getCppuBooleanType());
    1065             :                 }
    1066           0 :                 break;
    1067             :                 case WID_RESTART_AT_EACH_PAGE :
    1068             :                 {
    1069           0 :                     sal_Bool bTemp = rInfo.IsRestartEachPage();
    1070           0 :                     aRet.setValue(&bTemp, ::getCppuBooleanType());
    1071             :                 }
    1072           0 :                 break;
    1073             :             }
    1074             :         }
    1075             :         else
    1076           0 :             throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
    1077             :     }
    1078             :     else
    1079           0 :         throw uno::RuntimeException();
    1080           0 :     return aRet;
    1081             : }
    1082             : 
    1083           0 : void SwXLineNumberingProperties::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    1084             : {
    1085             : OSL_FAIL("not implemented");
    1086           0 : }
    1087             : 
    1088           0 : void SwXLineNumberingProperties::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    1089             : {
    1090             : OSL_FAIL("not implemented");
    1091           0 : }
    1092             : 
    1093           0 : void SwXLineNumberingProperties::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    1094             : {
    1095             : OSL_FAIL("not implemented");
    1096           0 : }
    1097             : 
    1098           0 : void SwXLineNumberingProperties::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
    1099             :     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
    1100             : {
    1101             : OSL_FAIL("not implemented");
    1102           0 : }
    1103             : 
    1104             : /******************************************************************
    1105             :  * SwXNumberingRules
    1106             :  ******************************************************************/
    1107             : const char aInvalidStyle[] = "__XXX___invalid";
    1108             : 
    1109           0 : bool SwXNumberingRules::isInvalidStyle(const OUString &rName)
    1110             : {
    1111           0 :     return rName == aInvalidStyle;
    1112             : }
    1113             : 
    1114             : namespace
    1115             : {
    1116             :     class theSwXNumberingRulesUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXNumberingRulesUnoTunnelId > {};
    1117             : }
    1118             : 
    1119           0 : const uno::Sequence< sal_Int8 > & SwXNumberingRules::getUnoTunnelId()
    1120             : {
    1121           0 :     return theSwXNumberingRulesUnoTunnelId::get().getSeq();
    1122             : }
    1123             : 
    1124             : // return implementation specific data
    1125           0 : sal_Int64 SwXNumberingRules::getSomething( const uno::Sequence< sal_Int8 > & rId ) throw(uno::RuntimeException, std::exception)
    1126             : {
    1127           0 :     if( rId.getLength() == 16
    1128           0 :         && 0 == memcmp( getUnoTunnelId().getConstArray(),
    1129           0 :                                         rId.getConstArray(), 16 ) )
    1130             :     {
    1131           0 :         return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
    1132             :     }
    1133           0 :     return 0;
    1134             : }
    1135             : 
    1136           0 : OUString SwXNumberingRules::getImplementationName(void) throw( RuntimeException, std::exception )
    1137             : {
    1138           0 :     return OUString("SwXNumberingRules");
    1139             : }
    1140             : 
    1141           0 : sal_Bool SwXNumberingRules::supportsService(const OUString& rServiceName) throw( RuntimeException, std::exception )
    1142             : {
    1143           0 :     return cppu::supportsService(this, rServiceName);
    1144             : }
    1145             : 
    1146           0 : Sequence< OUString > SwXNumberingRules::getSupportedServiceNames(void) throw( RuntimeException, std::exception )
    1147             : {
    1148           0 :     Sequence< OUString > aRet(1);
    1149           0 :     OUString* pArray = aRet.getArray();
    1150           0 :     pArray[0] = "com.sun.star.text.NumberingRules";
    1151           0 :     return aRet;
    1152             : }
    1153             : 
    1154           0 : SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc) :
    1155             :     pDoc(doc),
    1156             :     pDocShell(0),
    1157           0 :     pNumRule(new SwNumRule(rRule)),
    1158           0 :     m_pPropertySet(GetNumberingRulesSet()),
    1159           0 :     bOwnNumRuleCreated(sal_True)
    1160             : {
    1161             :     sal_uInt16 i;
    1162             : 
    1163             :     // first organize the document - it is dependent on the set character formats
    1164             :     // if no format is set, it should work as well
    1165           0 :     for( i = 0; i < MAXLEVEL; i++)
    1166             :     {
    1167           0 :         SwNumFmt rFmt(pNumRule->Get(i));
    1168           0 :         SwCharFmt* pCharFmt = rFmt.GetCharFmt();
    1169           0 :         if(pCharFmt)
    1170             :         {
    1171           0 :             pDoc = pCharFmt->GetDoc();
    1172           0 :             break;
    1173             :         }
    1174           0 :     }
    1175           0 :     if(pDoc)
    1176           0 :         pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
    1177           0 :     for(i = 0; i < MAXLEVEL; i++)
    1178             :     {
    1179           0 :         m_sNewCharStyleNames[i] = aInvalidStyle;
    1180           0 :         m_sNewBulletFontNames[i] = aInvalidStyle;
    1181             :     }
    1182           0 : }
    1183             : 
    1184           0 : SwXNumberingRules::SwXNumberingRules(SwDocShell& rDocSh) :
    1185             :     pDoc(0),
    1186             :     pDocShell(&rDocSh),
    1187             :     pNumRule(0),
    1188           0 :     m_pPropertySet(GetNumberingRulesSet()),
    1189           0 :     bOwnNumRuleCreated(sal_False)
    1190             : {
    1191           0 :     pDocShell->GetDoc()->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
    1192           0 : }
    1193             : 
    1194           0 : SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) :
    1195             :     pDoc(&rDoc),
    1196             :     pDocShell(0),
    1197             :     pNumRule(0),
    1198           0 :     m_pPropertySet(GetNumberingRulesSet()),
    1199           0 :     bOwnNumRuleCreated(sal_False)
    1200             : {
    1201           0 :     rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
    1202           0 :     m_sCreatedNumRuleName = rDoc.GetUniqueNumRuleName();
    1203             : #if OSL_DEBUG_LEVEL > 1
    1204             :     sal_uInt16 nIndex =
    1205             : #endif
    1206             :     rDoc.MakeNumRule( m_sCreatedNumRuleName, 0, false,
    1207             :                       // #i89178#
    1208           0 :                       numfunc::GetDefaultPositionAndSpaceMode() );
    1209             : #if OSL_DEBUG_LEVEL > 1
    1210             :     (void)nIndex;
    1211             : #endif
    1212           0 : }
    1213             : 
    1214           0 : SwXNumberingRules::~SwXNumberingRules()
    1215             : {
    1216           0 :     SolarMutexGuard aGuard;
    1217           0 :     if(pDoc && !m_sCreatedNumRuleName.isEmpty())
    1218           0 :         pDoc->DelNumRule( m_sCreatedNumRuleName );
    1219           0 :     if( bOwnNumRuleCreated )
    1220           0 :         delete pNumRule;
    1221           0 : }
    1222             : 
    1223           0 : void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElement)
    1224             :     throw( lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
    1225             :                   lang::WrappedTargetException, uno::RuntimeException, std::exception)
    1226             : {
    1227           0 :     SolarMutexGuard aGuard;
    1228           0 :     if(nIndex < 0 || MAXLEVEL <= nIndex)
    1229           0 :         throw lang::IndexOutOfBoundsException();
    1230             : 
    1231           0 :     if(rElement.getValueType().getTypeClass() != uno::TypeClass_SEQUENCE)
    1232           0 :         throw lang::IllegalArgumentException();
    1233             :     const uno::Sequence<beans::PropertyValue>& rProperties =
    1234           0 :                     *(const uno::Sequence<beans::PropertyValue>*)rElement.getValue();
    1235           0 :     SwNumRule* pRule = 0;
    1236           0 :     if(pNumRule)
    1237             :         SwXNumberingRules::SetNumberingRuleByIndex( *pNumRule,
    1238           0 :                             rProperties, nIndex);
    1239           0 :     else if(pDocShell)
    1240             :     {
    1241             :         // #i87650# - correction of cws swwarnings:
    1242           0 :         SwNumRule aNumRule( *(pDocShell->GetDoc()->GetOutlineNumRule()) );
    1243             :         SwXNumberingRules::SetNumberingRuleByIndex( aNumRule,
    1244           0 :                             rProperties, nIndex);
    1245             :         // set character format if needed
    1246           0 :         const SwCharFmts* pFmts = pDocShell->GetDoc()->GetCharFmts();
    1247           0 :         sal_uInt16 nChCount = pFmts->size();
    1248           0 :         for(sal_uInt16 i = 0; i < MAXLEVEL;i++)
    1249             :         {
    1250           0 :             SwNumFmt aFmt(aNumRule.Get( i ));
    1251           0 :             if (!m_sNewCharStyleNames[i].isEmpty() &&
    1252           0 :                 m_sNewCharStyleNames[i] != UNO_NAME_CHARACTER_FORMAT_NONE &&
    1253           0 :                 (!aFmt.GetCharFmt() || aFmt.GetCharFmt()->GetName()!= m_sNewCharStyleNames[i]))
    1254             :             {
    1255           0 :                 SwCharFmt* pCharFmt = 0;
    1256           0 :                 for(sal_uInt16 j = 0; j< nChCount; j++)
    1257             :                 {
    1258           0 :                     SwCharFmt* pTmp = (*pFmts)[j];
    1259           0 :                     if(pTmp->GetName() == m_sNewCharStyleNames[i])
    1260             :                     {
    1261           0 :                         pCharFmt = pTmp;
    1262           0 :                         break;
    1263             :                     }
    1264             :                 }
    1265           0 :                 if(!pCharFmt)
    1266             :                 {
    1267             :                     SfxStyleSheetBase* pBase;
    1268           0 :                     pBase = pDocShell->GetStyleSheetPool()->Find(m_sNewCharStyleNames[i],
    1269           0 :                                                                     SFX_STYLE_FAMILY_CHAR);
    1270           0 :                     if(!pBase)
    1271           0 :                         pBase = &pDocShell->GetStyleSheetPool()->Make(m_sNewCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
    1272           0 :                     pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
    1273             : 
    1274             :                 }
    1275           0 :                 aFmt.SetCharFmt( pCharFmt );
    1276           0 :                 aNumRule.Set( i, aFmt );
    1277             :             }
    1278           0 :         }
    1279           0 :         pDocShell->GetDoc()->SetOutlineNumRule( aNumRule );
    1280             :     }
    1281           0 :     else if(!pNumRule && pDoc && !m_sCreatedNumRuleName.isEmpty() &&
    1282           0 :         0 != (pRule = pDoc->FindNumRulePtr( m_sCreatedNumRuleName )))
    1283             :     {
    1284             :         SwXNumberingRules::SetNumberingRuleByIndex( *pRule,
    1285           0 :                             rProperties, nIndex);
    1286             : 
    1287           0 :         pRule->Validate();
    1288             :     }
    1289             :     else
    1290           0 :         throw uno::RuntimeException();
    1291           0 : }
    1292             : 
    1293           0 : sal_Int32 SwXNumberingRules::getCount(void) throw( uno::RuntimeException, std::exception )
    1294             : {
    1295           0 :     return MAXLEVEL;
    1296             : }
    1297             : 
    1298           0 : uno::Any SwXNumberingRules::getByIndex(sal_Int32 nIndex)
    1299             :     throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException,
    1300             :             uno::RuntimeException, std::exception )
    1301             : {
    1302           0 :     SolarMutexGuard aGuard;
    1303           0 :     if(nIndex < 0 || MAXLEVEL <= nIndex)
    1304           0 :         throw lang::IndexOutOfBoundsException();
    1305             : 
    1306           0 :     uno::Any aVal;
    1307           0 :     const SwNumRule* pRule = pNumRule;
    1308           0 :     if(!pRule && pDoc && !m_sCreatedNumRuleName.isEmpty())
    1309           0 :         pRule = pDoc->FindNumRulePtr( m_sCreatedNumRuleName );
    1310           0 :     if(pRule)
    1311             :     {
    1312             :         uno::Sequence<beans::PropertyValue> aRet = GetNumberingRuleByIndex(
    1313           0 :                                         *pRule, nIndex);
    1314           0 :         aVal.setValue(&aRet, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
    1315             : 
    1316             :     }
    1317           0 :     else if(pDocShell)
    1318             :     {
    1319             :         uno::Sequence<beans::PropertyValue> aRet = GetNumberingRuleByIndex(
    1320           0 :                 *pDocShell->GetDoc()->GetOutlineNumRule(), nIndex);
    1321           0 :         aVal.setValue(&aRet, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
    1322             :     }
    1323             :     else
    1324           0 :         throw uno::RuntimeException();
    1325           0 :     return aVal;
    1326             : }
    1327             : 
    1328           0 : uno::Type SwXNumberingRules::getElementType(void)
    1329             :     throw( uno::RuntimeException, std::exception )
    1330             : {
    1331           0 :     return ::getCppuType((uno::Sequence<beans::PropertyValue>*)0);
    1332             : }
    1333             : 
    1334           0 : sal_Bool SwXNumberingRules::hasElements(void) throw( uno::RuntimeException, std::exception )
    1335             : {
    1336           0 :     return sal_True;
    1337             : }
    1338             : 
    1339           0 : uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
    1340             :                 const SwNumRule& rNumRule, sal_Int32 nIndex) const
    1341             : {
    1342           0 :     SolarMutexGuard aGuard;
    1343             :     OSL_ENSURE( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" );
    1344             : 
    1345           0 :     const SwNumFmt& rFmt = rNumRule.Get( (sal_uInt16)nIndex );
    1346             : 
    1347           0 :     bool bChapterNum = pDocShell != 0;
    1348             : 
    1349           0 :     PropValDataArr  aPropertyValues;
    1350             :     //fill all properties into the array
    1351             : 
    1352             :     //adjust
    1353           0 :     SvxAdjust eAdj = rFmt.GetNumAdjust();
    1354           0 :     sal_Int16 nINT16 = aSvxToUnoAdjust[(sal_uInt16)eAdj];
    1355           0 :     PropValData* pData = new PropValData((void*)&nINT16, "Adjust", ::getCppuType((const sal_Int16*)0) );
    1356           0 :     aPropertyValues.push_back(pData);
    1357             : 
    1358             :     //parentnumbering
    1359           0 :     nINT16 = rFmt.GetIncludeUpperLevels();
    1360           0 :     pData = new PropValData((void*)&nINT16, "ParentNumbering", ::getCppuType((const sal_Int16*)0));
    1361           0 :     aPropertyValues.push_back(pData);
    1362             : 
    1363             :     //prefix
    1364           0 :     OUString aUString = rFmt.GetPrefix();
    1365           0 :     pData = new PropValData((void*)&aUString, "Prefix", ::getCppuType((const OUString*)0));
    1366           0 :     aPropertyValues.push_back(pData);
    1367             : 
    1368             :     //suffix
    1369           0 :     aUString = rFmt.GetSuffix();
    1370           0 :     pData = new PropValData((void*)&aUString, "Suffix", ::getCppuType((const OUString*)0));
    1371           0 :     aPropertyValues.push_back(pData);
    1372             : 
    1373             :     //char style name
    1374           0 :     SwCharFmt* pCharFmt = rFmt.GetCharFmt();
    1375           0 :     OUString CharStyleName;
    1376           0 :     if(pCharFmt)
    1377           0 :         CharStyleName = pCharFmt->GetName();
    1378             :     //egal ob ein Style vorhanden ist oder nicht ueberschreibt der Array-Eintrag diesen String
    1379           0 :     if (!m_sNewCharStyleNames[(sal_uInt16)nIndex].isEmpty() &&
    1380           0 :         !SwXNumberingRules::isInvalidStyle(m_sNewCharStyleNames[(sal_uInt16)nIndex]))
    1381             :     {
    1382           0 :         CharStyleName = m_sNewCharStyleNames[(sal_uInt16)nIndex];
    1383             :     }
    1384             : 
    1385           0 :     aUString = OUString();
    1386           0 :     SwStyleNameMapper::FillProgName( CharStyleName, aUString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true );
    1387           0 :     pData = new PropValData((void*)&aUString, "CharStyleName", ::getCppuType((const OUString*)0));
    1388           0 :     aPropertyValues.push_back(pData);
    1389             : 
    1390             :     //startvalue
    1391           0 :     nINT16 = rFmt.GetStart();
    1392           0 :     pData = new PropValData((void*)&nINT16, "StartWith", ::getCppuType((const sal_Int16*)0));
    1393           0 :     aPropertyValues.push_back(pData);
    1394             : 
    1395           0 :     if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
    1396             :     {
    1397             :         //leftmargin
    1398           0 :         sal_Int32 nINT32 = convertTwipToMm100(rFmt.GetAbsLSpace());
    1399           0 :         pData = new PropValData((void*)&nINT32, UNO_NAME_LEFT_MARGIN, ::getCppuType((const sal_Int32*)0));
    1400           0 :         aPropertyValues.push_back(pData);
    1401             : 
    1402             :         //chartextoffset
    1403           0 :         nINT32 = convertTwipToMm100(rFmt.GetCharTextDistance());
    1404           0 :         pData = new PropValData((void*)&nINT32, UNO_NAME_SYMBOL_TEXT_DISTANCE, ::getCppuType((const sal_Int32*)0));
    1405           0 :         aPropertyValues.push_back(pData);
    1406             : 
    1407             :         //firstlineoffset
    1408           0 :         nINT32 = convertTwipToMm100(rFmt.GetFirstLineOffset());
    1409           0 :         pData = new PropValData((void*)&nINT32, UNO_NAME_FIRST_LINE_OFFSET, ::getCppuType((const sal_Int32*)0));
    1410           0 :         aPropertyValues.push_back(pData);
    1411             :     }
    1412             : 
    1413             :     // PositionAndSpaceMode
    1414           0 :     nINT16 = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
    1415           0 :     if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
    1416             :     {
    1417           0 :         nINT16 = PositionAndSpaceMode::LABEL_ALIGNMENT;
    1418             :     }
    1419             :     pData = new PropValData( (void*)&nINT16,
    1420             :                              UNO_NAME_POSITION_AND_SPACE_MODE,
    1421           0 :                              ::getCppuType((const sal_Int16*)0) );
    1422           0 :     aPropertyValues.push_back(pData);
    1423             : 
    1424           0 :     if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
    1425             :     {
    1426             :         // LabelFollowedBy
    1427           0 :         nINT16 = LabelFollow::LISTTAB;
    1428           0 :         if ( rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
    1429             :         {
    1430           0 :             nINT16 = LabelFollow::SPACE;
    1431             :         }
    1432           0 :         else if ( rFmt.GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
    1433             :         {
    1434           0 :             nINT16 = LabelFollow::NOTHING;
    1435             :         }
    1436             :         pData = new PropValData( (void*)&nINT16,
    1437             :                                  UNO_NAME_LABEL_FOLLOWED_BY,
    1438           0 :                                  ::getCppuType((const sal_Int16*)0) );
    1439           0 :         aPropertyValues.push_back(pData);
    1440             : 
    1441             :         // ListtabStopPosition
    1442           0 :         sal_Int32 nINT32 = convertTwipToMm100(rFmt.GetListtabPos());
    1443             :         pData = new PropValData( (void*)&nINT32,
    1444             :                                  UNO_NAME_LISTTAB_STOP_POSITION,
    1445           0 :                                  ::getCppuType((const sal_Int32*)0));
    1446           0 :         aPropertyValues.push_back(pData);
    1447             : 
    1448             :         // FirstLineIndent
    1449           0 :         nINT32 = convertTwipToMm100(rFmt.GetFirstLineIndent());
    1450             :         pData = new PropValData( (void*)&nINT32,
    1451             :                                  UNO_NAME_FIRST_LINE_INDENT,
    1452           0 :                                  ::getCppuType((const sal_Int32*)0));
    1453           0 :         aPropertyValues.push_back(pData);
    1454             : 
    1455             :         // IndentAt
    1456           0 :         nINT32 = convertTwipToMm100(rFmt.GetIndentAt());
    1457             :         pData = new PropValData( (void*)&nINT32,
    1458             :                                  UNO_NAME_INDENT_AT,
    1459           0 :                                  ::getCppuType((const sal_Int32*)0));
    1460           0 :         aPropertyValues.push_back(pData);
    1461             :     }
    1462             : 
    1463             :     //numberingtype
    1464           0 :     nINT16 = rFmt.GetNumberingType();
    1465           0 :     pData = new PropValData((void*)&nINT16, "NumberingType", ::getCppuType((const sal_Int16*)0));
    1466           0 :     aPropertyValues.push_back(pData);
    1467             : 
    1468           0 :     if(!bChapterNum)
    1469             :     {
    1470           0 :         if(SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
    1471             :         {
    1472             :             //BulletId
    1473           0 :             nINT16 = rFmt.GetBulletChar();
    1474           0 :             pData = new PropValData((void*)&nINT16, "BulletId", ::getCppuType((const sal_Int16*)0));
    1475           0 :             aPropertyValues.push_back(pData);
    1476             : 
    1477           0 :             const Font* pFont = rFmt.GetBulletFont();
    1478             : 
    1479             :             //BulletChar
    1480           0 :             aUString = OUString(rFmt.GetBulletChar());
    1481           0 :             pData = new PropValData((void*)&aUString, "BulletChar", ::getCppuType((const OUString*)0));
    1482           0 :             aPropertyValues.push_back(pData);
    1483             : 
    1484             :             //BulletFontName
    1485           0 :             aUString = pFont ? pFont->GetStyleName() : OUString();
    1486           0 :             pData = new PropValData((void*)&aUString, "BulletFontName", ::getCppuType((const OUString*)0));
    1487           0 :             aPropertyValues.push_back(pData);
    1488             : 
    1489             :             //BulletFont
    1490           0 :             if(pFont)
    1491             :             {
    1492           0 :                  awt::FontDescriptor aDesc;
    1493           0 :                 SvxUnoFontDescriptor::ConvertFromFont( *pFont, aDesc );
    1494           0 :                 pData = new PropValData((void*)&aDesc, UNO_NAME_BULLET_FONT, ::getCppuType((const awt::FontDescriptor*)0));
    1495           0 :                 aPropertyValues.push_back(pData);
    1496             :             }
    1497             :         }
    1498           0 :         if(SVX_NUM_BITMAP == rFmt.GetNumberingType())
    1499             :         {
    1500             :             //GraphicURL
    1501           0 :             const SvxBrushItem* pBrush = rFmt.GetBrush();
    1502           0 :             if(pBrush)
    1503             :             {
    1504           0 :                 Any aAny;
    1505           0 :                 pBrush->QueryValue( aAny, MID_GRAPHIC_URL );
    1506           0 :                 aAny >>= aUString;
    1507             :             }
    1508             :             else
    1509           0 :                 aUString = OUString();
    1510           0 :             pData = new PropValData((void*)&aUString, UNO_NAME_GRAPHIC_URL, ::getCppuType((const OUString*)0));
    1511           0 :             aPropertyValues.push_back(pData);
    1512             : 
    1513             :             //graphicbitmap
    1514           0 :             const Graphic* pGraphic = 0;
    1515           0 :             if(pBrush )
    1516           0 :                 pGraphic = pBrush->GetGraphic();
    1517           0 :             if(pGraphic)
    1518             :             {
    1519           0 :                 uno::Reference<awt::XBitmap> xBmp = VCLUnoHelper::CreateBitmap( pGraphic->GetBitmapEx() );
    1520             :                 pData = new PropValData((void*)&xBmp, UNO_NAME_GRAPHIC_BITMAP,
    1521           0 :                                 ::getCppuType((const uno::Reference<awt::XBitmap>*)0));
    1522           0 :                 aPropertyValues.push_back(pData);
    1523             :             }
    1524           0 :              Size aSize = rFmt.GetGraphicSize();
    1525             :             // #i101131#
    1526             :             // adjust conversion due to type mismatch between <Size> and <awt::Size>
    1527           0 :             awt::Size aAwtSize(convertTwipToMm100(aSize.Width()), convertTwipToMm100(aSize.Height()));
    1528           0 :             pData = new PropValData((void*)&aAwtSize, UNO_NAME_GRAPHIC_SIZE, ::getCppuType((const awt::Size*)0));
    1529           0 :             aPropertyValues.push_back(pData);
    1530             : 
    1531           0 :             const SwFmtVertOrient* pOrient = rFmt.GetGraphicOrientation();
    1532           0 :             if(pOrient)
    1533             :             {
    1534           0 :                 pData = new PropValData((void*)0, UNO_NAME_VERT_ORIENT, ::getCppuType((const sal_Int16*)0));
    1535           0 :                 ((const SfxPoolItem*)pOrient)->QueryValue(pData->aVal, MID_VERTORIENT_ORIENT);
    1536           0 :                 aPropertyValues.push_back(pData);
    1537             :             }
    1538             :         }
    1539             :     }
    1540             :     else
    1541             :     {
    1542             :         // template name
    1543           0 :         OUString sValue(SW_RES(STR_POOLCOLL_HEADLINE1 + nIndex));
    1544           0 :         const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
    1545           0 :         const sal_uInt16 nCount = pColls->size();
    1546           0 :         for(sal_uInt16 i = 0; i < nCount;++i)
    1547             :         {
    1548           0 :             SwTxtFmtColl &rTxtColl = *pColls->operator[](i);
    1549           0 :             if(rTxtColl.IsDefault())
    1550           0 :                 continue;
    1551             : 
    1552           0 :             const sal_Int16 nOutLevel = rTxtColl.IsAssignedToListLevelOfOutlineStyle()
    1553           0 :                                         ? static_cast<sal_Int16>(rTxtColl.GetAssignedOutlineStyleLevel())
    1554           0 :                                         : MAXLEVEL;
    1555           0 :             if ( nOutLevel == nIndex )
    1556             :             {
    1557           0 :                 sValue = rTxtColl.GetName();
    1558           0 :                 break; // the style for the level in question has been found
    1559             :             }
    1560           0 :             else if( sValue==rTxtColl.GetName() )
    1561             :             {
    1562             :                 // if the default for the level is existing, but its
    1563             :                 // level is different, then it cannot be the default.
    1564           0 :                 sValue = OUString();
    1565             :             }
    1566             :         }
    1567           0 :         aUString = OUString();
    1568           0 :         SwStyleNameMapper::FillProgName(sValue, aUString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true);
    1569             : 
    1570           0 :         pData = new PropValData((void*)&aUString, UNO_NAME_HEADING_STYLE_NAME, ::getCppuType((const OUString*)0));
    1571           0 :         aPropertyValues.push_back(pData);
    1572             :     }
    1573             : 
    1574           0 :     uno::Sequence<beans::PropertyValue> aSeq(aPropertyValues.size());
    1575           0 :     beans::PropertyValue* pArray = aSeq.getArray();
    1576             : 
    1577           0 :     for(sal_uInt16 i = 0; i < aPropertyValues.size(); i++)
    1578             :     {
    1579           0 :         pData = aPropertyValues[i];
    1580           0 :         pArray[i].Value = pData->aVal;
    1581           0 :         pArray[i].Name = pData->sPropName;
    1582           0 :         pArray[i].Handle = -1;
    1583             :     }
    1584           0 :     for (PropValDataArr::const_iterator it = aPropertyValues.begin(); it != aPropertyValues.end(); ++it)
    1585           0 :       delete *it;
    1586           0 :     aPropertyValues.clear();
    1587           0 :     return aSeq;
    1588             : }
    1589             : 
    1590           0 : static PropValData* lcl_FindProperty(const char* cName, PropValDataArr&    rPropertyValues)
    1591             : {
    1592           0 :     OUString sCmp = OUString::createFromAscii(cName);
    1593           0 :     for(sal_uInt16 i = 0; i < rPropertyValues.size(); i++)
    1594             :     {
    1595           0 :         PropValData* pTemp = rPropertyValues[i];
    1596           0 :         if(sCmp == pTemp->sPropName)
    1597           0 :             return pTemp;
    1598             :     }
    1599           0 :     return 0;
    1600             : }
    1601             : 
    1602           0 : void SwXNumberingRules::SetNumberingRuleByIndex(
    1603             :             SwNumRule& rNumRule,
    1604             :             const uno::Sequence<beans::PropertyValue>& rProperties, sal_Int32 nIndex)
    1605             :     throw( uno::RuntimeException, lang::IllegalArgumentException )
    1606             : {
    1607           0 :     SolarMutexGuard aGuard;
    1608             :     OSL_ENSURE( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" );
    1609             : 
    1610             :     // the order of the names is important!
    1611             :     static const char* aNumPropertyNames[] =
    1612             :     {
    1613             :         "Adjust",                               //0
    1614             :         "ParentNumbering",                      //1
    1615             :         "Prefix",                               //2
    1616             :         "Suffix",                               //3
    1617             :         "CharStyleName",                        //4
    1618             :         "StartWith",                            //5
    1619             :         UNO_NAME_LEFT_MARGIN,                   //6
    1620             :         UNO_NAME_SYMBOL_TEXT_DISTANCE,          //7
    1621             :         UNO_NAME_FIRST_LINE_OFFSET,             //8
    1622             :         UNO_NAME_POSITION_AND_SPACE_MODE, //9
    1623             :         UNO_NAME_LABEL_FOLLOWED_BY,       //10
    1624             :         UNO_NAME_LISTTAB_STOP_POSITION,   //11
    1625             :         UNO_NAME_FIRST_LINE_INDENT,       //12
    1626             :         UNO_NAME_INDENT_AT,               //13
    1627             :         "NumberingType",                        //14
    1628             :         UNO_NAME_PARAGRAPH_STYLE_NAME, //15
    1629             :         // these are not in chapter numbering
    1630             :         "BulletId",                             //16
    1631             :         UNO_NAME_BULLET_FONT, //17
    1632             :         "BulletFontName",                       //18
    1633             :         "BulletChar",                           //19
    1634             :         UNO_NAME_GRAPHIC_URL,    //20
    1635             :         UNO_NAME_GRAPHIC_BITMAP, //21
    1636             :         UNO_NAME_GRAPHIC_SIZE,   //22
    1637             :         UNO_NAME_VERT_ORIENT,    //23
    1638             :         // these are only in chapter numbering
    1639             :         UNO_NAME_HEADING_STYLE_NAME, //24
    1640             :         // these two are accepted but ignored for some reason
    1641             :         "BulletRelSize",                         // 25
    1642             :         "BulletColor"                            // 26
    1643             :     };
    1644           0 :     const sal_uInt16 NotInChapterFirst = 16;
    1645           0 :     const sal_uInt16 NotInChapterLast = 23;
    1646           0 :     const sal_uInt16 InChapterFirst = 24;
    1647           0 :     const sal_uInt16 InChapterLast = 24;
    1648             : 
    1649           0 :     const beans::PropertyValue* pPropArray = rProperties.getConstArray();
    1650           0 :     PropValDataArr aPropertyValues;
    1651           0 :     bool bExcept = false;
    1652           0 :     for(int i = 0; i < rProperties.getLength() && !bExcept; i++)
    1653             :     {
    1654           0 :         const beans::PropertyValue& rProp = pPropArray[i];
    1655           0 :         bExcept = true;
    1656           0 :         for(sal_uInt16 j = 0; j < SAL_N_ELEMENTS( aNumPropertyNames ); j++)
    1657             :         {
    1658           0 :             if (pDocShell && j >= NotInChapterFirst && j <= NotInChapterLast)
    1659           0 :                 continue;
    1660           0 :             if (!pDocShell && j >= InChapterFirst && j <= InChapterLast)
    1661           0 :                 continue;
    1662           0 :             if (rProp.Name.equalsAscii(aNumPropertyNames[j]))
    1663             :             {
    1664           0 :                 bExcept = false;
    1665           0 :                 break;
    1666             :             }
    1667             :         }
    1668             :         SAL_WARN_IF( bExcept, "sw.uno", "Unknown/incorrect property " << rProp.Name << ", failing" );
    1669           0 :         PropValData* pData = new PropValData(rProp.Value, rProp.Name );
    1670           0 :         aPropertyValues.push_back(pData);
    1671             :     }
    1672             : 
    1673           0 :     SwNumFmt aFmt(rNumRule.Get( (sal_uInt16)nIndex ));
    1674           0 :     bool bWrongArg = false;
    1675           0 :     if(!bExcept)
    1676             :        {
    1677           0 :         SvxBrushItem* pSetBrush = 0;
    1678           0 :         Size* pSetSize = 0;
    1679           0 :         SwFmtVertOrient* pSetVOrient = 0;
    1680           0 :         bool bCharStyleNameSet = false;
    1681             : 
    1682           0 :         for(sal_uInt16 i = 0; i < SAL_N_ELEMENTS( aNumPropertyNames ) && !bExcept && !bWrongArg; i++)
    1683             :         {
    1684           0 :             PropValData* pData = lcl_FindProperty(aNumPropertyNames[i], aPropertyValues);
    1685           0 :             if(!pData)
    1686           0 :                 continue;
    1687           0 :             switch(i)
    1688             :             {
    1689             :                 case 0: //"Adjust"
    1690             :                 {
    1691           0 :                     sal_Int16 nValue = 0;
    1692           0 :                     pData->aVal >>= nValue;
    1693           0 :                     if(nValue > 0 &&
    1694           0 :                         nValue <= text::HoriOrientation::LEFT &&
    1695           0 :                             USHRT_MAX != aUnoToSvxAdjust[nValue])
    1696             :                     {
    1697           0 :                         aFmt.SetNumAdjust((SvxAdjust)aUnoToSvxAdjust[nValue]);
    1698             :                     }
    1699             :                     else
    1700           0 :                         bWrongArg = true;
    1701             :                 }
    1702           0 :                 break;
    1703             :                 case 1: //"ParentNumbering",
    1704             :                 {
    1705           0 :                     sal_Int16 nSet = 0;
    1706           0 :                     pData->aVal >>= nSet;
    1707           0 :                     if(nSet >= 0 && MAXLEVEL >= nSet)
    1708           0 :                         aFmt.SetIncludeUpperLevels( static_cast< sal_uInt8 >(nSet) );
    1709             :                 }
    1710           0 :                 break;
    1711             :                 case 2: //"Prefix",
    1712             :                 {
    1713           0 :                     OUString uTmp;
    1714           0 :                     pData->aVal >>= uTmp;
    1715           0 :                     aFmt.SetPrefix(uTmp);
    1716             :                 }
    1717           0 :                 break;
    1718             :                 case 3: //"Suffix",
    1719             :                 {
    1720           0 :                     OUString uTmp;
    1721           0 :                     pData->aVal >>= uTmp;
    1722           0 :                     aFmt.SetSuffix(uTmp);
    1723             :                 }
    1724           0 :                 break;
    1725             :                 case 4: //"CharStyleName",
    1726             :                 {
    1727           0 :                     bCharStyleNameSet = true;
    1728           0 :                     OUString uTmp;
    1729           0 :                     pData->aVal >>= uTmp;
    1730           0 :                     OUString sCharFmtName;
    1731           0 :                     SwStyleNameMapper::FillUIName( uTmp, sCharFmtName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true );
    1732           0 :                     if (sCharFmtName == UNO_NAME_CHARACTER_FORMAT_NONE)
    1733             :                     {
    1734           0 :                         m_sNewCharStyleNames[(sal_uInt16)nIndex] = aInvalidStyle;
    1735           0 :                         aFmt.SetCharFmt(0);
    1736             :                     }
    1737           0 :                     else if(pDocShell || pDoc)
    1738             :                     {
    1739           0 :                         SwDoc* pLocalDoc = pDoc ? pDoc : pDocShell->GetDoc();
    1740           0 :                         const SwCharFmts* pFmts = pLocalDoc->GetCharFmts();
    1741           0 :                         sal_uInt16 nChCount = pFmts->size();
    1742             : 
    1743           0 :                         SwCharFmt* pCharFmt = 0;
    1744           0 :                         if (!sCharFmtName.isEmpty())
    1745             :                         {
    1746           0 :                             for(sal_uInt16 j = 0; j< nChCount; j++)
    1747             :                             {
    1748           0 :                                 SwCharFmt* pTmp = (*pFmts)[j];
    1749           0 :                                 if(pTmp->GetName() == sCharFmtName)
    1750             :                                 {
    1751           0 :                                     pCharFmt = pTmp;
    1752           0 :                                     break;
    1753             :                                 }
    1754             :                             }
    1755           0 :                             if(!pCharFmt)
    1756             :                             {
    1757             : 
    1758             :                                 SfxStyleSheetBase* pBase;
    1759           0 :                                 SfxStyleSheetBasePool* pPool = pLocalDoc->GetDocShell()->GetStyleSheetPool();
    1760           0 :                                 pBase = ((SfxStyleSheetBasePool*)pPool)->Find(sCharFmtName, SFX_STYLE_FAMILY_CHAR);
    1761           0 :                                 if(!pBase)
    1762           0 :                                     pBase = &pPool->Make(sCharFmtName, SFX_STYLE_FAMILY_CHAR);
    1763           0 :                                 pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
    1764             :                             }
    1765             :                         }
    1766           0 :                         aFmt.SetCharFmt( pCharFmt );
    1767             :                         // #i51842#
    1768             :                         // If the character format has been found its name should not be in the
    1769             :                         // char style names array
    1770           0 :                         m_sNewCharStyleNames[(sal_uInt16)nIndex] = OUString();
    1771             :                      }
    1772             :                     else
    1773           0 :                         m_sNewCharStyleNames[(sal_uInt16)nIndex] = sCharFmtName;
    1774             :                 }
    1775           0 :                 break;
    1776             :                 case 5: //"StartWith",
    1777             :                 {
    1778           0 :                     sal_Int16 nVal = 0;
    1779           0 :                     pData->aVal >>= nVal;
    1780           0 :                     aFmt.SetStart(nVal);
    1781             :                 }
    1782           0 :                 break;
    1783             :                 case 6: //UNO_NAME_LEFT_MARGIN,
    1784             :                 {
    1785           0 :                     sal_Int32 nValue = 0;
    1786           0 :                     pData->aVal >>= nValue;
    1787             :                     // #i23727# nValue can be negative
    1788           0 :                     aFmt.SetAbsLSpace((sal_uInt16) convertMm100ToTwip(nValue));
    1789             :                 }
    1790           0 :                 break;
    1791             :                 case 7: //UNO_NAME_SYMBOL_TEXT_DISTANCE,
    1792             :                 {
    1793           0 :                     sal_Int32 nValue = 0;
    1794           0 :                     pData->aVal >>= nValue;
    1795           0 :                     if(nValue >= 0)
    1796           0 :                         aFmt.SetCharTextDistance((sal_uInt16) convertMm100ToTwip(nValue));
    1797             :                     else
    1798           0 :                         bWrongArg = true;
    1799             :                 }
    1800           0 :                 break;
    1801             :                 case 8: //UNO_NAME_FIRST_LINE_OFFSET,
    1802             :                 {
    1803           0 :                     sal_Int32 nValue = 0;
    1804           0 :                     pData->aVal >>= nValue;
    1805             :                     // #i23727# nValue can be positive
    1806           0 :                     nValue = convertMm100ToTwip(nValue);
    1807           0 :                     aFmt.SetFirstLineOffset((short)nValue);
    1808             :                 }
    1809           0 :                 break;
    1810             :                 case 9: // UNO_NAME_POSITION_AND_SPACE_MODE
    1811             :                 {
    1812           0 :                     sal_Int16 nValue = 0;
    1813           0 :                     pData->aVal >>= nValue;
    1814           0 :                     if ( nValue == 0 )
    1815             :                     {
    1816           0 :                         aFmt.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
    1817             :                     }
    1818           0 :                     else if ( nValue == 1 )
    1819             :                     {
    1820           0 :                         aFmt.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT );
    1821             :                     }
    1822             :                     else
    1823             :                     {
    1824           0 :                         bWrongArg = true;
    1825             :                     }
    1826             :                 }
    1827           0 :                 break;
    1828             :                 case 10: // UNO_NAME_LABEL_FOLLOWED_BY
    1829             :                 {
    1830           0 :                     sal_Int16 nValue = 0;
    1831           0 :                     pData->aVal >>= nValue;
    1832           0 :                     if ( nValue == 0 )
    1833             :                     {
    1834           0 :                         aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
    1835             :                     }
    1836           0 :                     else if ( nValue == 1 )
    1837             :                     {
    1838           0 :                         aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
    1839             :                     }
    1840           0 :                     else if ( nValue == 2 )
    1841             :                     {
    1842           0 :                         aFmt.SetLabelFollowedBy( SvxNumberFormat::NOTHING );
    1843             :                     }
    1844             :                     else
    1845             :                     {
    1846           0 :                         bWrongArg = true;
    1847             :                     }
    1848             :                 }
    1849           0 :                 break;
    1850             :                 case 11: // UNO_NAME_LISTTAB_STOP_POSITION
    1851             :                 {
    1852           0 :                     sal_Int32 nValue = 0;
    1853           0 :                     pData->aVal >>= nValue;
    1854           0 :                     nValue = convertMm100ToTwip(nValue);
    1855           0 :                     if ( nValue >= 0 )
    1856             :                     {
    1857           0 :                         aFmt.SetListtabPos( nValue );
    1858             :                     }
    1859             :                     else
    1860             :                     {
    1861           0 :                         bWrongArg = true;
    1862             :                     }
    1863             :                 }
    1864           0 :                 break;
    1865             :                 case 12: // UNO_NAME_FIRST_LINE_INDENT
    1866             :                 {
    1867           0 :                     sal_Int32 nValue = 0;
    1868           0 :                     pData->aVal >>= nValue;
    1869           0 :                     nValue = convertMm100ToTwip(nValue);
    1870           0 :                     aFmt.SetFirstLineIndent( nValue );
    1871             :                 }
    1872           0 :                 break;
    1873             :                 case 13: // UNO_NAME_INDENT_AT
    1874             :                 {
    1875           0 :                     sal_Int32 nValue = 0;
    1876           0 :                     pData->aVal >>= nValue;
    1877           0 :                     nValue = convertMm100ToTwip(nValue);
    1878           0 :                     aFmt.SetIndentAt( nValue );
    1879             :                 }
    1880           0 :                 break;
    1881             :                 case 14: //"NumberingType"
    1882             :                 {
    1883           0 :                     sal_Int16 nSet = 0;
    1884           0 :                     pData->aVal >>= nSet;
    1885           0 :                     if(nSet >= 0)
    1886           0 :                         aFmt.SetNumberingType(nSet);
    1887             :                     else
    1888           0 :                         bWrongArg = true;
    1889             :                 }
    1890           0 :                 break;
    1891             :                 case 15: //"ParagraphStyleName"
    1892             :                 {
    1893           0 :                     if( pDoc )
    1894             :                     {
    1895           0 :                         OUString uTmp;
    1896           0 :                         pData->aVal >>= uTmp;
    1897           0 :                         OUString sStyleName;
    1898           0 :                         SwStyleNameMapper::FillUIName(uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true );
    1899           0 :                         const SwTxtFmtColls* pColls = pDoc->GetTxtFmtColls();
    1900           0 :                         const sal_uInt16 nCount = pColls->size();
    1901           0 :                         for(sal_uInt16 k = 0; k < nCount; ++k)
    1902             :                         {
    1903           0 :                             SwTxtFmtColl &rTxtColl = *((*pColls)[k]);
    1904           0 :                             if ( rTxtColl.GetName() == sStyleName )
    1905           0 :                                 rTxtColl.SetFmtAttr( SwNumRuleItem( rNumRule.GetName()));
    1906           0 :                         }
    1907             :                     }
    1908             :                 }
    1909           0 :                 break;
    1910             :                 case 16: //"BulletId",
    1911             :                 {
    1912             :                     assert( !pDocShell );
    1913           0 :                     sal_Int16 nSet = 0;
    1914           0 :                     if( pData->aVal >>= nSet )
    1915           0 :                         aFmt.SetBulletChar(nSet);
    1916             :                     else
    1917           0 :                         bWrongArg = true;
    1918             :                 }
    1919           0 :                 break;
    1920             :                 case 17: //UNO_NAME_BULLET_FONT,
    1921             :                 {
    1922             :                     assert( !pDocShell );
    1923           0 :                     awt::FontDescriptor* pDesc =  (awt::FontDescriptor*)pData->aVal.getValue();
    1924           0 :                     if(pDesc)
    1925             :                     {
    1926             :                         // #i93725#
    1927             :                         // do not accept "empty" font
    1928           0 :                         if ( !pDesc->Name.isEmpty() )
    1929             :                         {
    1930           0 :                             Font aFont;
    1931           0 :                             SvxUnoFontDescriptor::ConvertToFont( *pDesc, aFont );
    1932           0 :                             aFmt.SetBulletFont(&aFont);
    1933             :                         }
    1934             :                     }
    1935             :                     else
    1936           0 :                         bWrongArg = true;
    1937             :                 }
    1938           0 :                 break;
    1939             :                 case 18: //"BulletFontName",
    1940             :                 {
    1941             :                     assert( !pDocShell );
    1942           0 :                     OUString sBulletFontName;
    1943           0 :                     pData->aVal >>= sBulletFontName;
    1944           0 :                     SwDocShell* pLclDocShell = pDocShell ? pDocShell : pDoc ? pDoc->GetDocShell() : 0;
    1945           0 :                     if( !sBulletFontName.isEmpty() && pLclDocShell )
    1946             :                     {
    1947             :                         const SvxFontListItem* pFontListItem =
    1948             :                                 (const SvxFontListItem* )pLclDocShell
    1949           0 :                                                     ->GetItem( SID_ATTR_CHAR_FONTLIST );
    1950           0 :                         const FontList*  pList = pFontListItem->GetFontList();
    1951             :                         FontInfo aInfo = pList->Get(
    1952           0 :                             sBulletFontName, WEIGHT_NORMAL, ITALIC_NONE);
    1953           0 :                         Font aFont(aInfo);
    1954           0 :                         aFmt.SetBulletFont(&aFont);
    1955             :                     }
    1956             :                     else
    1957           0 :                         m_sNewBulletFontNames[(sal_uInt16)nIndex] = sBulletFontName;
    1958             :                 }
    1959           0 :                 break;
    1960             :                 case 19: //"BulletChar",
    1961             :                 {
    1962             :                     assert( !pDocShell );
    1963           0 :                     OUString aChar;
    1964           0 :                     pData->aVal >>= aChar;
    1965           0 :                     if(aChar.getLength() == 1)
    1966             :                     {
    1967           0 :                         aFmt.SetBulletChar(aChar.toChar());
    1968             :                     }
    1969           0 :                     else if(aChar.getLength() == 0)
    1970             :                     {
    1971             :                         // If w:lvlText's value is null - set bullet char to zero
    1972           0 :                         aFmt.SetBulletChar(sal_Unicode(0x0));
    1973             :                     }
    1974             :                     else
    1975             :                     {
    1976           0 :                         bWrongArg = true;
    1977           0 :                     }
    1978             :                 }
    1979           0 :                 break;
    1980             :                 case 20: //UNO_NAME_GRAPHIC_URL,
    1981             :                 {
    1982             :                     assert( !pDocShell );
    1983           0 :                     OUString sBrushURL;
    1984           0 :                     pData->aVal >>= sBrushURL;
    1985           0 :                     if(!pSetBrush)
    1986             :                     {
    1987           0 :                         const SvxBrushItem* pOrigBrush = aFmt.GetBrush();
    1988           0 :                         if(pOrigBrush)
    1989             :                         {
    1990           0 :                             pSetBrush = new SvxBrushItem(*pOrigBrush);
    1991             :                         }
    1992             :                         else
    1993           0 :                             pSetBrush = new SvxBrushItem(OUString(), OUString(), GPOS_AREA, RES_BACKGROUND);
    1994             :                     }
    1995           0 :                     pSetBrush->PutValue( pData->aVal, MID_GRAPHIC_URL );
    1996             :                 }
    1997           0 :                 break;
    1998             :                 case 21: //UNO_NAME_GRAPHIC_BITMAP,
    1999             :                 {
    2000             :                     assert( !pDocShell );
    2001           0 :                     uno::Reference< awt::XBitmap >* pBitmap = (uno::Reference< awt::XBitmap > *)pData->aVal.getValue();
    2002           0 :                     if(pBitmap)
    2003             :                     {
    2004           0 :                         if(!pSetBrush)
    2005             :                         {
    2006           0 :                             const SvxBrushItem* pOrigBrush = aFmt.GetBrush();
    2007           0 :                             if(pOrigBrush)
    2008             :                             {
    2009           0 :                                 pSetBrush = new SvxBrushItem(*pOrigBrush);
    2010             :                             }
    2011             :                             else
    2012           0 :                                 pSetBrush = new SvxBrushItem(OUString(), OUString(), GPOS_AREA, RES_BACKGROUND);
    2013             :                         }
    2014             : 
    2015           0 :                         BitmapEx aBmp = VCLUnoHelper::GetBitmap( *pBitmap );
    2016           0 :                         Graphic aNewGr(aBmp);
    2017           0 :                         pSetBrush->SetGraphic( aNewGr );
    2018             :                     }
    2019             :                     else
    2020           0 :                         bWrongArg = true;
    2021             :                 }
    2022           0 :                 break;
    2023             :                 case 22: //UNO_NAME_GRAPHIC_SIZE,
    2024             :                 {
    2025             :                     assert( !pDocShell );
    2026           0 :                     if(!pSetSize)
    2027           0 :                         pSetSize = new Size;
    2028           0 :                     if(pData->aVal.getValueType() == ::getCppuType((awt::Size*)0))
    2029             :                     {
    2030           0 :                          awt::Size* pSize =  (awt::Size*)pData->aVal.getValue();
    2031           0 :                         pSize->Width = convertMm100ToTwip(pSize->Width);
    2032           0 :                         pSize->Height = convertMm100ToTwip(pSize->Height);
    2033           0 :                         pSetSize->Width() = pSize->Width;
    2034           0 :                         pSetSize->Height() = pSize->Height;
    2035             :                     }
    2036             :                     else
    2037           0 :                         bWrongArg = true;
    2038             :                 }
    2039           0 :                 break;
    2040             :                 case 23: //VertOrient
    2041             :                 {
    2042             :                     assert( !pDocShell );
    2043           0 :                     if(!pSetVOrient)
    2044             :                     {
    2045           0 :                         if(aFmt.GetGraphicOrientation())
    2046           0 :                             pSetVOrient = (SwFmtVertOrient*)aFmt.GetGraphicOrientation()->Clone();
    2047             :                         else
    2048           0 :                             pSetVOrient = new SwFmtVertOrient;
    2049             :                     }
    2050           0 :                     ((SfxPoolItem*)pSetVOrient)->PutValue(pData->aVal, MID_VERTORIENT_ORIENT);
    2051             :                 }
    2052           0 :                 break;
    2053             :                 case 24: //"HeadingStyleName"
    2054             :                 {
    2055             :                     assert( pDocShell );
    2056           0 :                     OUString uTmp;
    2057           0 :                     pData->aVal >>= uTmp;
    2058           0 :                     OUString sStyleName;
    2059           0 :                     SwStyleNameMapper::FillUIName(uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true );
    2060           0 :                     const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
    2061           0 :                     const sal_uInt16 nCount = pColls->size();
    2062           0 :                     for(sal_uInt16 k = 0; k < nCount; ++k)
    2063             :                     {
    2064           0 :                         SwTxtFmtColl &rTxtColl = *((*pColls)[k]);
    2065           0 :                         if(rTxtColl.IsDefault())
    2066           0 :                             continue;
    2067           0 :                         if ( rTxtColl.IsAssignedToListLevelOfOutlineStyle() &&
    2068           0 :                              rTxtColl.GetAssignedOutlineStyleLevel() == nIndex &&
    2069           0 :                              rTxtColl.GetName() != sStyleName )
    2070             :                         {
    2071           0 :                             rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle();
    2072             :                         }
    2073           0 :                         else if ( rTxtColl.GetName() == sStyleName )
    2074             :                         {
    2075           0 :                             rTxtColl.AssignToListLevelOfOutlineStyle( nIndex );
    2076             :                         }
    2077           0 :                     }
    2078             :                 }
    2079           0 :                 break;
    2080             :                 case 25: // BulletRelSize - unsupported - only available in Impress
    2081           0 :                 break;
    2082             :                 case 26: // BulletColor - ignored too
    2083           0 :                 break;
    2084             :             }
    2085             :         }
    2086           0 :         if(!bExcept && !bWrongArg && (pSetBrush || pSetSize || pSetVOrient))
    2087             :         {
    2088           0 :             if(!pSetBrush && aFmt.GetBrush())
    2089           0 :                 pSetBrush = new SvxBrushItem(*aFmt.GetBrush());
    2090             : 
    2091           0 :             if(pSetBrush)
    2092             :             {
    2093           0 :                 if(!pSetVOrient && aFmt.GetGraphicOrientation())
    2094           0 :                     pSetVOrient = new SwFmtVertOrient(*aFmt.GetGraphicOrientation());
    2095             : 
    2096           0 :                 if(!pSetSize)
    2097             :                 {
    2098           0 :                     pSetSize = new Size(aFmt.GetGraphicSize());
    2099           0 :                     if(!pSetSize->Width() || !pSetSize->Height())
    2100             :                     {
    2101           0 :                         const Graphic* pGraphic = pSetBrush->GetGraphic();
    2102           0 :                         if(pGraphic)
    2103           0 :                             *pSetSize = ::GetGraphicSizeTwip(*pGraphic, 0);
    2104             :                     }
    2105             :                 }
    2106             :                 sal_Int16 eOrient = pSetVOrient ?
    2107           0 :                     (sal_Int16)pSetVOrient->GetVertOrient() : text::VertOrientation::NONE;
    2108           0 :                 aFmt.SetGraphicBrush( pSetBrush, pSetSize, text::VertOrientation::NONE == eOrient ? 0 : &eOrient );
    2109             :             }
    2110             :         }
    2111           0 :         if((!bCharStyleNameSet || m_sNewCharStyleNames[(sal_uInt16)nIndex].isEmpty()) &&
    2112           0 :                 aFmt.GetNumberingType() == NumberingType::BITMAP && !aFmt.GetCharFmt()
    2113           0 :                     && !SwXNumberingRules::isInvalidStyle(m_sNewCharStyleNames[(sal_uInt16)nIndex]))
    2114             :         {
    2115           0 :             OUString tmp;
    2116           0 :             SwStyleNameMapper::FillProgName(RES_POOLCHR_BUL_LEVEL, tmp);
    2117           0 :             m_sNewCharStyleNames[static_cast<sal_uInt16>(nIndex)] = tmp;
    2118             :         }
    2119           0 :         delete pSetBrush;
    2120           0 :         delete pSetSize;
    2121           0 :         delete pSetVOrient;
    2122             :       }
    2123           0 :     for (PropValDataArr::const_iterator it = aPropertyValues.begin(); it != aPropertyValues.end(); ++it)
    2124           0 :       delete *it;
    2125           0 :     aPropertyValues.clear();
    2126             : 
    2127           0 :     if(bWrongArg)
    2128           0 :         throw lang::IllegalArgumentException();
    2129           0 :     else if(bExcept)
    2130           0 :         throw uno::RuntimeException();
    2131           0 :     rNumRule.Set( (sal_uInt16)nIndex, aFmt );
    2132           0 : }
    2133             : 
    2134           0 : uno::Reference< XPropertySetInfo > SwXNumberingRules::getPropertySetInfo()
    2135             :     throw(RuntimeException, std::exception)
    2136             : {
    2137           0 :     static uno::Reference< beans::XPropertySetInfo >  aRef = m_pPropertySet->getPropertySetInfo();
    2138           0 :     return aRef;
    2139             : }
    2140             : 
    2141           0 : void SwXNumberingRules::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
    2142             :     throw(UnknownPropertyException, PropertyVetoException,
    2143             :         IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception)
    2144             : {
    2145           0 :     SwNumRule* pDocRule = 0;
    2146           0 :     SwNumRule* pCreatedRule = 0;
    2147           0 :     if(!pNumRule)
    2148             :     {
    2149           0 :         if(!pNumRule && pDocShell)
    2150             :         {
    2151           0 :             pDocRule = new SwNumRule(*pDocShell->GetDoc()->GetOutlineNumRule());
    2152             :         }
    2153           0 :         else if(pDoc && !m_sCreatedNumRuleName.isEmpty())
    2154             :         {
    2155           0 :             pCreatedRule = pDoc->FindNumRulePtr(m_sCreatedNumRuleName);
    2156             :         }
    2157             : 
    2158             :     }
    2159           0 :     if(!pNumRule && !pDocRule && !pCreatedRule)
    2160           0 :         throw RuntimeException();
    2161             : 
    2162           0 :     if(rPropertyName == UNO_NAME_IS_AUTOMATIC)
    2163             :     {
    2164           0 :         sal_Bool bVal = *(sal_Bool*)rValue.getValue();
    2165           0 :         if(!pCreatedRule)
    2166           0 :             pDocRule ? pDocRule->SetAutoRule(bVal) : pNumRule->SetAutoRule(bVal);
    2167             :     }
    2168           0 :     else if(rPropertyName == UNO_NAME_IS_CONTINUOUS_NUMBERING)
    2169             :     {
    2170           0 :         sal_Bool bVal = *(sal_Bool*)rValue.getValue();
    2171           0 :         pDocRule ? pDocRule->SetContinusNum(bVal) :
    2172           0 :             pCreatedRule ? pCreatedRule->SetContinusNum(bVal) : pNumRule->SetContinusNum(bVal);
    2173             :     }
    2174           0 :     else if(rPropertyName == UNO_NAME_NAME)
    2175             :     {
    2176           0 :         delete pDocRule;
    2177           0 :         throw IllegalArgumentException();
    2178             :     }
    2179           0 :     else if(rPropertyName == UNO_NAME_IS_ABSOLUTE_MARGINS)
    2180             :     {
    2181           0 :         sal_Bool bVal = *(sal_Bool*)rValue.getValue();
    2182           0 :         pDocRule ? pDocRule->SetAbsSpaces(bVal) :
    2183           0 :             pCreatedRule ? pCreatedRule->SetAbsSpaces(bVal) : pNumRule->SetAbsSpaces(bVal);
    2184             :     }
    2185           0 :     else if(rPropertyName == UNO_NAME_NUMBERING_IS_OUTLINE)
    2186             :     {
    2187           0 :         sal_Bool bVal = *(sal_Bool*)rValue.getValue();
    2188           0 :         SwNumRuleType eNumRuleType = bVal ? OUTLINE_RULE : NUM_RULE;
    2189           0 :         pDocRule ? pDocRule->SetRuleType(eNumRuleType) :
    2190           0 :             pCreatedRule ? pCreatedRule->SetRuleType(eNumRuleType) : pNumRule->SetRuleType(eNumRuleType);
    2191             :     }
    2192           0 :     else if(rPropertyName == UNO_NAME_DEFAULT_LIST_ID)
    2193             :     {
    2194           0 :         delete pDocRule;
    2195           0 :         throw IllegalArgumentException();
    2196             :     }
    2197             :     else
    2198           0 :         throw UnknownPropertyException();
    2199             : 
    2200           0 :     if(pDocRule)
    2201             :     {
    2202           0 :         pDocShell->GetDoc()->SetOutlineNumRule(*pDocRule);
    2203           0 :         delete pDocRule;
    2204             :     }
    2205           0 :     else if(pCreatedRule)
    2206             :     {
    2207           0 :         pCreatedRule->Validate();
    2208             :     }
    2209           0 : }
    2210             : 
    2211           0 : Any SwXNumberingRules::getPropertyValue( const OUString& rPropertyName )
    2212             :     throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
    2213             : {
    2214           0 :     Any aRet;
    2215           0 :     const SwNumRule* pRule = pNumRule;
    2216           0 :     if(!pRule && pDocShell)
    2217           0 :         pRule = pDocShell->GetDoc()->GetOutlineNumRule();
    2218           0 :     else if(pDoc && !m_sCreatedNumRuleName.isEmpty())
    2219           0 :         pRule = pDoc->FindNumRulePtr( m_sCreatedNumRuleName );
    2220           0 :     if(!pRule)
    2221           0 :         throw RuntimeException();
    2222             : 
    2223           0 :     if(rPropertyName == UNO_NAME_IS_AUTOMATIC)
    2224             :     {
    2225           0 :         sal_Bool bVal = pRule->IsAutoRule();
    2226           0 :         aRet.setValue(&bVal, ::getBooleanCppuType());
    2227             :     }
    2228           0 :     else if(rPropertyName == UNO_NAME_IS_CONTINUOUS_NUMBERING)
    2229             :     {
    2230           0 :         sal_Bool bVal = pRule->IsContinusNum();
    2231           0 :         aRet.setValue(&bVal, ::getBooleanCppuType());
    2232             :     }
    2233           0 :     else if(rPropertyName == UNO_NAME_NAME)
    2234           0 :         aRet <<= OUString(pRule->GetName());
    2235           0 :     else if(rPropertyName == UNO_NAME_IS_ABSOLUTE_MARGINS)
    2236             :     {
    2237           0 :         sal_Bool bVal = pRule->IsAbsSpaces();
    2238           0 :         aRet.setValue(&bVal, ::getBooleanCppuType());
    2239             :     }
    2240           0 :     else if(rPropertyName == UNO_NAME_NUMBERING_IS_OUTLINE)
    2241             :     {
    2242           0 :         sal_Bool bVal = pRule->IsOutlineRule();
    2243           0 :         aRet.setValue(&bVal, ::getBooleanCppuType());
    2244             :     }
    2245           0 :     else if(rPropertyName == UNO_NAME_DEFAULT_LIST_ID)
    2246             :     {
    2247             :         OSL_ENSURE( !pRule->GetDefaultListId().isEmpty(),
    2248             :                 "<SwXNumberingRules::getPropertyValue(..)> - no default list id found. Serious defect -> please inform OD." );
    2249           0 :         aRet <<= pRule->GetDefaultListId();
    2250             :     }
    2251             :     else
    2252           0 :         throw UnknownPropertyException();
    2253           0 :     return aRet;
    2254             : }
    2255             : 
    2256           0 : void SwXNumberingRules::addPropertyChangeListener(
    2257             :     const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
    2258             :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
    2259             : {
    2260           0 : }
    2261             : 
    2262           0 : void SwXNumberingRules::removePropertyChangeListener(
    2263             :     const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
    2264             :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
    2265             : {
    2266           0 : }
    2267             : 
    2268           0 : void SwXNumberingRules::addVetoableChangeListener(
    2269             :     const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
    2270             :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
    2271             : {
    2272           0 : }
    2273             : 
    2274           0 : void SwXNumberingRules::removeVetoableChangeListener(
    2275             :     const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
    2276             :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
    2277             : {
    2278           0 : }
    2279             : 
    2280           0 : OUString SwXNumberingRules::getName() throw( RuntimeException, std::exception )
    2281             : {
    2282           0 :     OUString aString;
    2283           0 :     if(pNumRule)
    2284             :     {
    2285           0 :         SwStyleNameMapper::FillProgName(pNumRule->GetName(), aString, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, true );
    2286           0 :         return aString;
    2287             :     }
    2288             :     // consider chapter numbering <SwXNumberingRules>
    2289           0 :     if ( pDocShell )
    2290             :     {
    2291             :         SwStyleNameMapper::FillProgName( pDocShell->GetDoc()->GetOutlineNumRule()->GetName(),
    2292           0 :                                          aString, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, true );
    2293           0 :         return aString;
    2294             :     }
    2295           0 :     return m_sCreatedNumRuleName;
    2296             : }
    2297             : 
    2298           0 : void SwXNumberingRules::setName(const OUString& /*rName*/) throw( RuntimeException, std::exception )
    2299             : {
    2300           0 :     RuntimeException aExcept;
    2301           0 :     aExcept.Message = "readonly";
    2302           0 :     throw aExcept;
    2303             : }
    2304             : 
    2305           0 : void SwXNumberingRules::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
    2306             : {
    2307           0 :     ClientModify(this, pOld, pNew);
    2308           0 :     if(!GetRegisteredIn())
    2309             :     {
    2310           0 :         if(bOwnNumRuleCreated)
    2311           0 :             delete pNumRule;
    2312           0 :         pNumRule = 0;
    2313           0 :         pDoc = 0;
    2314             :     }
    2315           0 : }
    2316             : 
    2317           0 : OUString SwXChapterNumbering::getImplementationName(void) throw( RuntimeException, std::exception )
    2318             : {
    2319           0 :     return OUString("SwXChapterNumbering");
    2320             : }
    2321             : 
    2322           0 : sal_Bool SwXChapterNumbering::supportsService(const OUString& rServiceName) throw( RuntimeException, std::exception )
    2323             : {
    2324           0 :     return cppu::supportsService(this, rServiceName);
    2325             : }
    2326             : 
    2327           0 : Sequence< OUString > SwXChapterNumbering::getSupportedServiceNames(void) throw( RuntimeException, std::exception )
    2328             : {
    2329           0 :     Sequence< OUString > aRet(2);
    2330           0 :     OUString* pArray = aRet.getArray();
    2331           0 :     pArray[0] = "com.sun.star.text.ChapterNumbering";
    2332           0 :     pArray[1] = "com.sun.star.text.NumberingRules";
    2333           0 :     return aRet;
    2334             : }
    2335             : 
    2336           0 : SwXChapterNumbering::SwXChapterNumbering(SwDocShell& rDocSh) :
    2337           0 :     SwXNumberingRules(rDocSh)
    2338             : {
    2339           0 : }
    2340             : 
    2341           0 : SwXChapterNumbering::~SwXChapterNumbering()
    2342             : {
    2343           0 : }
    2344             : 
    2345             : /******************************************************************
    2346             :  * SwXTextColumns
    2347             :  ******************************************************************/
    2348           0 : OUString SwXTextColumns::getImplementationName(void) throw( RuntimeException, std::exception )
    2349             : {
    2350           0 :     return OUString("SwXTextColumns");
    2351             : }
    2352             : 
    2353           0 : sal_Bool SwXTextColumns::supportsService(const OUString& rServiceName) throw( RuntimeException, std::exception )
    2354             : {
    2355           0 :     return cppu::supportsService(this, rServiceName);
    2356             : }
    2357             : 
    2358           0 : Sequence< OUString > SwXTextColumns::getSupportedServiceNames(void) throw( RuntimeException, std::exception )
    2359             : {
    2360           0 :     Sequence< OUString > aRet(1);
    2361           0 :     OUString* pArray = aRet.getArray();
    2362           0 :     pArray[0] = "com.sun.star.text.TextColumns";
    2363           0 :     return aRet;
    2364             : }
    2365             : 
    2366           0 : SwXTextColumns::SwXTextColumns(sal_uInt16 nColCount) :
    2367             :     nReference(0),
    2368             :     bIsAutomaticWidth(sal_True),
    2369             :     nAutoDistance(0),
    2370           0 :     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS)),
    2371             :     nSepLineWidth(0),
    2372             :     nSepLineColor(0), //black
    2373             :     nSepLineHeightRelative(100),//full height
    2374             :     nSepLineVertAlign(style::VerticalAlignment_MIDDLE),
    2375             :     bSepLineIsOn(sal_False),
    2376           0 :     nSepLineStyle(API_COL_LINE_NONE) // None
    2377             : {
    2378           0 :     if(nColCount)
    2379           0 :         setColumnCount(nColCount);
    2380           0 : }
    2381             : 
    2382           0 : SwXTextColumns::SwXTextColumns(const SwFmtCol& rFmtCol) :
    2383             :     nReference(0),
    2384           0 :     aTextColumns(rFmtCol.GetNumCols()),
    2385           0 :     bIsAutomaticWidth(rFmtCol.IsOrtho()),
    2386           0 :     m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS))
    2387             : {
    2388           0 :     sal_uInt16 nItemGutterWidth = rFmtCol.GetGutterWidth();
    2389             :     nAutoDistance = bIsAutomaticWidth ?
    2390             :                         USHRT_MAX == nItemGutterWidth ? DEF_GUTTER_WIDTH : (sal_Int32)nItemGutterWidth
    2391           0 :                         : 0;
    2392           0 :     nAutoDistance = convertTwipToMm100(nAutoDistance);
    2393             : 
    2394           0 :     TextColumn* pColumns = aTextColumns.getArray();
    2395           0 :     const SwColumns& rCols = rFmtCol.GetColumns();
    2396           0 :     for(sal_uInt16 i = 0; i < aTextColumns.getLength(); i++)
    2397             :     {
    2398           0 :         const SwColumn* pCol = &rCols[i];
    2399             : 
    2400           0 :         pColumns[i].Width = pCol->GetWishWidth();
    2401           0 :         nReference += pColumns[i].Width;
    2402           0 :         pColumns[i].LeftMargin =    convertTwipToMm100(pCol->GetLeft ());
    2403           0 :         pColumns[i].RightMargin =   convertTwipToMm100(pCol->GetRight());
    2404             :     }
    2405           0 :     if(!aTextColumns.getLength())
    2406           0 :         nReference = USHRT_MAX;
    2407             : 
    2408           0 :     nSepLineWidth = rFmtCol.GetLineWidth();
    2409           0 :     nSepLineColor = rFmtCol.GetLineColor().GetColor();
    2410           0 :     nSepLineHeightRelative = rFmtCol.GetLineHeight();
    2411           0 :     bSepLineIsOn = rFmtCol.GetLineAdj() != COLADJ_NONE;
    2412           0 :     sal_Int8 nStyle = API_COL_LINE_NONE;
    2413           0 :     switch (rFmtCol.GetLineStyle())
    2414             :     {
    2415           0 :         case table::BorderLineStyle::SOLID: nStyle = API_COL_LINE_SOLID; break;
    2416           0 :         case table::BorderLineStyle::DOTTED: nStyle= API_COL_LINE_DOTTED; break;
    2417           0 :         case table::BorderLineStyle::DASHED: nStyle= API_COL_LINE_DASHED; break;
    2418           0 :         default: break;
    2419             :     }
    2420           0 :     nSepLineStyle = nStyle;
    2421           0 :     switch(rFmtCol.GetLineAdj())
    2422             :     {
    2423           0 :         case COLADJ_TOP:    nSepLineVertAlign = style::VerticalAlignment_TOP;   break;
    2424           0 :         case COLADJ_BOTTOM: nSepLineVertAlign = style::VerticalAlignment_BOTTOM;    break;
    2425             :         case COLADJ_CENTER:
    2426           0 :         case COLADJ_NONE:   nSepLineVertAlign = style::VerticalAlignment_MIDDLE;
    2427             :     }
    2428           0 : }
    2429             : 
    2430           0 : SwXTextColumns::~SwXTextColumns()
    2431             : {
    2432           0 : }
    2433             : 
    2434           0 : sal_Int32 SwXTextColumns::getReferenceValue(void) throw( uno::RuntimeException, std::exception )
    2435             : {
    2436           0 :     SolarMutexGuard aGuard;
    2437           0 :     return nReference;
    2438             : }
    2439             : 
    2440           0 : sal_Int16 SwXTextColumns::getColumnCount(void) throw( uno::RuntimeException, std::exception )
    2441             : {
    2442           0 :     SolarMutexGuard aGuard;
    2443           0 :     return static_cast< sal_Int16>( aTextColumns.getLength() );
    2444             : }
    2445             : 
    2446           0 : void SwXTextColumns::setColumnCount(sal_Int16 nColumns) throw( uno::RuntimeException, std::exception )
    2447             : {
    2448           0 :     SolarMutexGuard aGuard;
    2449           0 :     if(nColumns <= 0)
    2450           0 :         throw uno::RuntimeException();
    2451           0 :     bIsAutomaticWidth = sal_True;
    2452           0 :     aTextColumns.realloc(nColumns);
    2453           0 :      TextColumn* pCols = aTextColumns.getArray();
    2454           0 :     nReference = USHRT_MAX;
    2455           0 :     sal_Int32 nWidth = nReference / nColumns;
    2456           0 :     sal_Int32 nDiff = nReference - nWidth * nColumns;
    2457           0 :     sal_Int32 nDist = nAutoDistance / 2;
    2458           0 :     for(sal_Int16 i = 0; i < nColumns; i++)
    2459             :     {
    2460           0 :         pCols[i].Width = nWidth;
    2461           0 :         pCols[i].LeftMargin = i == 0 ? 0 : nDist;
    2462           0 :         pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
    2463             :     }
    2464           0 :     pCols[nColumns - 1].Width += nDiff;
    2465           0 : }
    2466             : 
    2467           0 : uno::Sequence< TextColumn > SwXTextColumns::getColumns(void) throw( uno::RuntimeException, std::exception )
    2468             : {
    2469           0 :     SolarMutexGuard aGuard;
    2470           0 :     return aTextColumns;
    2471             : }
    2472             : 
    2473           0 : void SwXTextColumns::setColumns(const uno::Sequence< TextColumn >& rColumns)
    2474             :             throw( uno::RuntimeException, std::exception )
    2475             : {
    2476           0 :     SolarMutexGuard aGuard;
    2477           0 :     sal_Int32 nReferenceTemp = 0;
    2478           0 :     const TextColumn* prCols = rColumns.getConstArray();
    2479           0 :     for(long i = 0; i < rColumns.getLength(); i++)
    2480             :     {
    2481           0 :         nReferenceTemp += prCols[i].Width;
    2482             :     }
    2483           0 :     bIsAutomaticWidth = sal_False;
    2484           0 :     nReference = !nReferenceTemp ? USHRT_MAX : nReferenceTemp;
    2485           0 :     aTextColumns = rColumns;
    2486           0 : }
    2487             : 
    2488           0 : uno::Reference< XPropertySetInfo > SwXTextColumns::getPropertySetInfo(  ) throw(RuntimeException, std::exception)
    2489             : {
    2490           0 :     static uno::Reference< beans::XPropertySetInfo >  aRef = m_pPropSet->getPropertySetInfo();
    2491           0 :     return aRef;
    2492             : }
    2493             : 
    2494           0 : void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
    2495             :         throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException,
    2496             :             WrappedTargetException, RuntimeException, std::exception)
    2497             : {
    2498           0 :     const SfxItemPropertySimpleEntry*  pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
    2499           0 :     if (!pEntry)
    2500           0 :         throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
    2501           0 :     if ( pEntry->nFlags & PropertyAttribute::READONLY)
    2502           0 :         throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
    2503             : 
    2504           0 :     switch(pEntry->nWID)
    2505             :     {
    2506             :         case WID_TXTCOL_LINE_WIDTH:
    2507             :         {
    2508           0 :             sal_Int32 nTmp = 0;
    2509           0 :             aValue >>= nTmp;
    2510           0 :             if(nTmp < 0)
    2511           0 :                 throw IllegalArgumentException();
    2512           0 :             nSepLineWidth = convertMm100ToTwip(nTmp);
    2513             :         }
    2514           0 :         break;
    2515             :         case WID_TXTCOL_LINE_COLOR:
    2516           0 :             aValue >>= nSepLineColor;
    2517           0 :         break;
    2518             :         case WID_TXTCOL_LINE_STYLE:
    2519             :         {
    2520           0 :             aValue >>= nSepLineStyle;
    2521             :         }
    2522           0 :         break;
    2523             :         case WID_TXTCOL_LINE_REL_HGT:
    2524             :         {
    2525           0 :             sal_Int8 nTmp = 0;
    2526           0 :             aValue >>= nTmp;
    2527           0 :             if(nTmp < 0)
    2528           0 :                 throw IllegalArgumentException();
    2529           0 :             nSepLineHeightRelative = nTmp;
    2530             :         }
    2531           0 :         break;
    2532             :         case WID_TXTCOL_LINE_ALIGN:
    2533             :         {
    2534             :             style::VerticalAlignment eAlign;
    2535           0 :             if(!(aValue >>= eAlign) )
    2536             :             {
    2537           0 :                 sal_Int8 nTmp = 0;
    2538           0 :                 if (! ( aValue >>= nTmp ) )
    2539           0 :                     throw IllegalArgumentException();
    2540             :                 else
    2541           0 :                     nSepLineVertAlign = nTmp;
    2542             :             }
    2543             :             else
    2544           0 :                 nSepLineVertAlign = static_cast< sal_Int8 >(eAlign);
    2545             :         }
    2546           0 :         break;
    2547             :         case WID_TXTCOL_LINE_IS_ON:
    2548           0 :             bSepLineIsOn = *(sal_Bool*)aValue.getValue();
    2549           0 :         break;
    2550             :         case WID_TXTCOL_AUTO_DISTANCE:
    2551             :         {
    2552           0 :             sal_Int32 nTmp = 0;
    2553           0 :             aValue >>= nTmp;
    2554           0 :             if(nTmp < 0 || nTmp >= nReference)
    2555           0 :                 throw IllegalArgumentException();
    2556           0 :             nAutoDistance = nTmp;
    2557           0 :             sal_Int32 nColumns = aTextColumns.getLength();
    2558           0 :             TextColumn* pCols = aTextColumns.getArray();
    2559           0 :             sal_Int32 nDist = nAutoDistance / 2;
    2560           0 :             for(sal_Int32 i = 0; i < nColumns; i++)
    2561             :             {
    2562           0 :                 pCols[i].LeftMargin = i == 0 ? 0 : nDist;
    2563           0 :                 pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
    2564             :             }
    2565             :         }
    2566           0 :         break;
    2567             :     }
    2568           0 : }
    2569             : 
    2570           0 : Any SwXTextColumns::getPropertyValue( const OUString& rPropertyName )
    2571             :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
    2572             : {
    2573           0 :     const SfxItemPropertySimpleEntry*  pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
    2574           0 :     if (!pEntry)
    2575           0 :         throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
    2576             : 
    2577           0 :     Any aRet;
    2578           0 :     switch(pEntry->nWID)
    2579             :     {
    2580             :         case WID_TXTCOL_LINE_WIDTH:
    2581           0 :             aRet <<= static_cast < sal_Int32 >(convertTwipToMm100(nSepLineWidth));
    2582           0 :         break;
    2583             :         case WID_TXTCOL_LINE_COLOR:
    2584           0 :             aRet <<= nSepLineColor;
    2585           0 :         break;
    2586             :         case WID_TXTCOL_LINE_STYLE:
    2587           0 :             aRet <<= nSepLineStyle;
    2588           0 :         break;
    2589             :         case WID_TXTCOL_LINE_REL_HGT:
    2590           0 :             aRet <<= nSepLineHeightRelative;
    2591           0 :         break;
    2592             :         case WID_TXTCOL_LINE_ALIGN:
    2593           0 :             aRet <<= (style::VerticalAlignment)nSepLineVertAlign;
    2594           0 :         break;
    2595             :         case WID_TXTCOL_LINE_IS_ON:
    2596           0 :             aRet.setValue(&bSepLineIsOn, ::getBooleanCppuType());
    2597           0 :         break;
    2598             :         case WID_TXTCOL_IS_AUTOMATIC :
    2599           0 :             aRet.setValue(&bIsAutomaticWidth, ::getBooleanCppuType());
    2600           0 :         break;
    2601             :         case WID_TXTCOL_AUTO_DISTANCE:
    2602           0 :             aRet <<= nAutoDistance;
    2603           0 :         break;
    2604             :     }
    2605           0 :     return aRet;
    2606             : }
    2607             : 
    2608           0 : void SwXTextColumns::addPropertyChangeListener(
    2609             :     const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
    2610             :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
    2611             : {
    2612           0 : }
    2613             : 
    2614           0 : void SwXTextColumns::removePropertyChangeListener(
    2615             :     const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
    2616             :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
    2617             : {
    2618           0 : }
    2619             : 
    2620           0 : void SwXTextColumns::addVetoableChangeListener(
    2621             :     const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
    2622             :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
    2623             : {
    2624           0 : }
    2625             : 
    2626           0 : void SwXTextColumns::removeVetoableChangeListener(
    2627             :     const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
    2628             :         throw(UnknownPropertyException, WrappedTargetException, RuntimeException, std::exception)
    2629             : {
    2630           0 : }
    2631             : 
    2632             : namespace
    2633             : {
    2634             :     class theSwXTextColumnsUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXTextColumnsUnoTunnelId > {};
    2635             : }
    2636             : 
    2637           0 : const uno::Sequence< sal_Int8 > & SwXTextColumns::getUnoTunnelId()
    2638             : {
    2639           0 :     return theSwXTextColumnsUnoTunnelId::get().getSeq();
    2640             : }
    2641             : 
    2642           0 : sal_Int64 SAL_CALL SwXTextColumns::getSomething( const uno::Sequence< sal_Int8 >& rId )
    2643             :     throw(uno::RuntimeException, std::exception)
    2644             : {
    2645           0 :     if( rId.getLength() == 16
    2646           0 :         && 0 == memcmp( getUnoTunnelId().getConstArray(),
    2647           0 :                                         rId.getConstArray(), 16 ) )
    2648             :     {
    2649           0 :         return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
    2650             :     }
    2651           0 :     return 0;
    2652             : }
    2653             : 
    2654             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10