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