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

Generated by: LCOV version 1.11