update dev300-m58
[ooovba.git] / sw / source / core / unocore / unosett.cxx
blob4caa5a735e514054636f9e69e5cc3b6636ed1873
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unosett.cxx,v $
10 * $Revision: 1.59 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <swtypes.hxx>
36 #include <cmdid.h>
37 #include <hintids.hxx>
38 #include "poolfmt.hrc"
39 #include "poolfmt.hxx"
40 #include <fmtcol.hxx>
41 #include <unomap.hxx>
42 #include <unostyle.hxx>
43 #include <unosett.hxx>
44 #include <unoprnms.hxx>
45 #include <ftninfo.hxx>
46 #include <doc.hxx>
47 #include <pagedesc.hxx>
48 #include <charfmt.hxx>
49 #include <lineinfo.hxx>
50 #include <docsh.hxx>
51 #include <docary.hxx>
52 #include <docstyle.hxx>
53 #include <fmtclds.hxx>
54 #include <svx/brshitem.hxx>
55 #include <com/sun/star/text/XFootnotesSettingsSupplier.hpp>
56 #include <com/sun/star/text/XFootnote.hpp>
57 #include <com/sun/star/text/XFootnotesSupplier.hpp>
58 #include <com/sun/star/text/XEndnotesSupplier.hpp>
59 #include <com/sun/star/text/XEndnotesSettingsSupplier.hpp>
60 #include <com/sun/star/text/FootnoteNumbering.hpp>
61 #include <com/sun/star/text/HoriOrientation.hpp>
62 #include <com/sun/star/style/LineNumberPosition.hpp>
63 #include <com/sun/star/awt/XBitmap.hpp>
64 #ifndef _COM_SUN_STAR_BEANS_PropertyAttribute_HPP_
65 #include <com/sun/star/beans/PropertyAttribute.hpp>
66 #endif
67 #include <com/sun/star/style/VerticalAlignment.hpp>
68 #include <unoobj.hxx>
69 #include <vcl/font.hxx>
70 #include <svx/flstitem.hxx>
71 #include <vcl/metric.hxx>
72 #include <svtools/ctrltool.hxx>
73 #include <vos/mutex.hxx>
74 #include <vcl/svapp.hxx>
75 #ifndef _TOOLKIT_UNOHLP_HXX
76 #include <toolkit/helper/vclunohelper.hxx>
77 #endif
78 #include <svx/unofdesc.hxx>
79 #include <fmtornt.hxx>
80 #include <SwStyleNameMapper.hxx>
81 // --> OD 2008-01-15 #newlistlevelattrs#
82 #include <com/sun/star/text/PositionAndSpaceMode.hpp>
83 #include <com/sun/star/text/LabelFollow.hpp>
84 // <--
85 #include <numrule.hxx>
87 using ::rtl::OUString;
88 using namespace ::com::sun::star;
89 using namespace ::com::sun::star::uno;
90 using namespace ::com::sun::star::lang;
91 using namespace ::com::sun::star::beans;
92 using namespace ::com::sun::star::text;
93 using namespace ::com::sun::star::style;
95 struct PropValData
97 uno::Any aVal;
98 OUString sPropName;
99 PropValData(void* pVal, const char* cPropName, uno::Type aType ) :
100 aVal(pVal, aType),
101 sPropName(OUString::createFromAscii(cPropName))
103 PropValData(const uno::Any& rVal, const OUString& rPropName) :
104 aVal(rVal),
105 sPropName(rPropName)
109 typedef PropValData* PropValDataPtr;
110 SV_DECL_PTRARR(PropValDataArr, PropValDataPtr, 5, 5 )
111 SV_IMPL_PTRARR(PropValDataArr, PropValDataPtr)
114 #define WID_PREFIX 0
115 #define WID_SUFFIX 1
116 #define WID_NUMBERING_TYPE 2
117 #define WID_START_AT 3
118 #define WID_FOOTNOTE_COUNTING 4
119 #define WID_PARAGRAPH_STYLE 5
120 #define WID_PAGE_STYLE 6
121 #define WID_CHARACTER_STYLE 7
122 #define WID_POSITION_END_OF_DOC 8
123 #define WID_END_NOTICE 9
124 #define WID_BEGIN_NOTICE 10
125 #define WID_ANCHOR_CHARACTER_STYLE 11
127 const SfxItemPropertySet* GetFootnoteSet()
129 static SfxItemPropertyMapEntry aFootnoteMap_Impl[] =
131 { SW_PROP_NAME(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
132 { SW_PROP_NAME(UNO_NAME_BEGIN_NOTICE), WID_BEGIN_NOTICE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
133 { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
134 { SW_PROP_NAME(UNO_NAME_END_NOTICE), WID_END_NOTICE , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
135 { SW_PROP_NAME(UNO_NAME_FOOTNOTE_COUNTING), WID_FOOTNOTE_COUNTING, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
136 { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
137 { SW_PROP_NAME(UNO_NAME_PAGE_STYLE_NAME), WID_PAGE_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
138 { SW_PROP_NAME(UNO_NAME_PARA_STYLE_NAME), WID_PARAGRAPH_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
139 { SW_PROP_NAME(UNO_NAME_POSITION_END_OF_DOC), WID_POSITION_END_OF_DOC,&::getBooleanCppuType(), PROPERTY_NONE, 0},
140 { SW_PROP_NAME(UNO_NAME_PREFIX), WID_PREFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
141 { SW_PROP_NAME(UNO_NAME_START_AT), WID_START_AT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
142 { SW_PROP_NAME(UNO_NAME_SUFFIX), WID_SUFFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
143 {0,0,0,0,0,0}
145 static SfxItemPropertySet aFootnoteSet_Impl(aFootnoteMap_Impl);
146 return &aFootnoteSet_Impl;
148 const SfxItemPropertySet* GetEndnoteSet()
150 static SfxItemPropertyMapEntry aEndnoteMap_Impl[] =
152 { SW_PROP_NAME(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
153 { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
154 { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
155 { SW_PROP_NAME(UNO_NAME_PAGE_STYLE_NAME), WID_PAGE_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
156 { SW_PROP_NAME(UNO_NAME_PARA_STYLE_NAME), WID_PARAGRAPH_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
157 { SW_PROP_NAME(UNO_NAME_PREFIX), WID_PREFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
158 { SW_PROP_NAME(UNO_NAME_START_AT), WID_START_AT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
159 { SW_PROP_NAME(UNO_NAME_SUFFIX), WID_SUFFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
160 {0,0,0,0,0,0}
162 static SfxItemPropertySet aEndnoteSet_Impl(aEndnoteMap_Impl);
163 return &aEndnoteSet_Impl;
165 const SfxItemPropertySet* GetNumberingRulesSet()
167 static SfxItemPropertyMapEntry aNumberingRulesMap_Impl[] =
169 { SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS), WID_IS_ABS_MARGINS, &::getBooleanCppuType(), PROPERTY_NONE, 0},
170 { SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC), WID_IS_AUTOMATIC, &::getBooleanCppuType(), PROPERTY_NONE, 0},
171 { SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING), WID_CONTINUOUS, &::getBooleanCppuType(), PROPERTY_NONE, 0},
172 { SW_PROP_NAME(UNO_NAME_NAME), WID_RULE_NAME , &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0},
173 { SW_PROP_NAME(UNO_NAME_NUMBERING_IS_OUTLINE), WID_IS_OUTLINE, &::getBooleanCppuType(), PROPERTY_NONE, 0},
174 { SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID), WID_DEFAULT_LIST_ID, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0},
175 {0,0,0,0,0,0}
177 static SfxItemPropertySet aNumberingRulesSet_Impl( aNumberingRulesMap_Impl );
178 return &aNumberingRulesSet_Impl;
180 #define WID_NUM_ON 0
181 #define WID_SEPARATOR_INTERVAL 1
182 #define WID_NUMBERING_TYPE 2
183 #define WID_NUMBER_POSITION 3
184 #define WID_DISTANCE 4
185 #define WID_INTERVAL 5
186 #define WID_SEPARATOR_TEXT 6
187 //#define WID_CHARACTER_STYLE 7
188 #define WID_COUNT_EMPTY_LINES 8
189 #define WID_COUNT_LINES_IN_FRAMES 9
190 #define WID_RESTART_AT_EACH_PAGE 10
192 const SfxItemPropertySet* GetLineNumberingSet()
194 static SfxItemPropertyMapEntry aLineNumberingMap_Impl[] =
196 { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
197 { SW_PROP_NAME(UNO_NAME_COUNT_EMPTY_LINES), WID_COUNT_EMPTY_LINES , &::getBooleanCppuType(),PROPERTY_NONE, 0},
198 { SW_PROP_NAME(UNO_NAME_COUNT_LINES_IN_FRAMES), WID_COUNT_LINES_IN_FRAMES, &::getBooleanCppuType(),PROPERTY_NONE, 0},
199 { SW_PROP_NAME(UNO_NAME_DISTANCE ), WID_DISTANCE , &::getCppuType((const sal_Int32*)0),PROPERTY_NONE, 0},
200 { SW_PROP_NAME(UNO_NAME_IS_ON), WID_NUM_ON, &::getBooleanCppuType() , PROPERTY_NONE, 0},
201 { SW_PROP_NAME(UNO_NAME_INTERVAL ), WID_INTERVAL , &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
202 { SW_PROP_NAME(UNO_NAME_SEPARATOR_TEXT ), WID_SEPARATOR_TEXT, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
203 { SW_PROP_NAME(UNO_NAME_NUMBER_POSITION), WID_NUMBER_POSITION, &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
204 { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE , &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
205 { SW_PROP_NAME(UNO_NAME_RESTART_AT_EACH_PAGE), WID_RESTART_AT_EACH_PAGE, &::getBooleanCppuType() , PROPERTY_NONE, 0},
206 { SW_PROP_NAME(UNO_NAME_SEPARATOR_INTERVAL), WID_SEPARATOR_INTERVAL, &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
207 {0,0,0,0,0,0}
209 static SfxItemPropertySet aLineNumberingSet_Impl(aLineNumberingMap_Impl);
210 return &aLineNumberingSet_Impl;
213 /* -----------------05.05.98 08:30-------------------
215 * --------------------------------------------------*/
216 SwCharFmt* lcl_getCharFmt(SwDoc* pDoc, const uno::Any& aValue)
218 SwCharFmt* pRet = 0;
219 String sStandard(SW_RES(STR_POOLCOLL_STANDARD));
220 OUString uTmp;
221 aValue >>= uTmp;
222 String sCharFmt;
223 SwStyleNameMapper::FillUIName(uTmp, sCharFmt, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True);
224 if(sStandard != sCharFmt)
226 pRet = pDoc->FindCharFmtByName( sCharFmt );
228 if(!pRet)
230 sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sCharFmt, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
231 if(USHRT_MAX != nId)
232 pRet = pDoc->GetCharFmtFromPool( nId );
234 return pRet;
236 /* -----------------05.05.98 08:30-------------------
238 * --------------------------------------------------*/
239 SwTxtFmtColl* lcl_GetParaStyle(SwDoc* pDoc, const uno::Any& aValue)
241 OUString uTmp;
242 aValue >>= uTmp;
243 String sParaStyle;
244 SwStyleNameMapper::FillUIName(uTmp, sParaStyle, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
245 SwTxtFmtColl* pRet = pDoc->FindTxtFmtCollByName( sParaStyle );
246 if( !pRet )
248 sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sParaStyle, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
249 if( USHRT_MAX != nId )
250 pRet = pDoc->GetTxtCollFromPool( nId );
252 return pRet;
254 /* -----------------05.05.98 08:30-------------------
256 * --------------------------------------------------*/
257 SwPageDesc* lcl_GetPageDesc(SwDoc* pDoc, const uno::Any& aValue)
259 SwPageDesc* pRet = 0;
260 sal_uInt16 nCount = pDoc->GetPageDescCnt();
261 OUString uTmp;
262 aValue >>= uTmp;
263 String sPageDesc;
264 SwStyleNameMapper::FillUIName(uTmp, sPageDesc, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
265 for( sal_uInt16 i = 0; i < nCount; i++)
267 const SwPageDesc& rDesc = const_cast<const SwDoc *>(pDoc)
268 ->GetPageDesc( i );
269 if(rDesc.GetName() == sPageDesc)
271 pRet = (SwPageDesc*)&rDesc;
272 break;
275 if(!pRet)
277 sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sPageDesc, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC);
278 if(USHRT_MAX != nId)
279 pRet = pDoc->GetPageDescFromPool( nId );
281 return pRet;
283 /******************************************************************************
285 ******************************************************************************/
286 // Numerierung
287 const unsigned short aSvxToUnoAdjust[] =
289 text::HoriOrientation::LEFT, //3
290 text::HoriOrientation::RIGHT, //1
291 USHRT_MAX,
292 text::HoriOrientation::CENTER, //2
293 USHRT_MAX,
294 USHRT_MAX
297 const unsigned short aUnoToSvxAdjust[] =
299 USHRT_MAX,
300 SVX_ADJUST_RIGHT, // 1
301 SVX_ADJUST_CENTER, // 3
302 SVX_ADJUST_LEFT, // 0
303 USHRT_MAX,
304 USHRT_MAX
307 /******************************************************************
308 * SwXFootnoteProperties
309 ******************************************************************/
310 /* -----------------------------06.04.00 11:43--------------------------------
312 ---------------------------------------------------------------------------*/
313 OUString SwXFootnoteProperties::getImplementationName(void) throw( RuntimeException )
315 return C2U("SwXFootnoteProperties");
317 /* -----------------------------06.04.00 11:43--------------------------------
319 ---------------------------------------------------------------------------*/
320 BOOL SwXFootnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
322 return C2U("com.sun.star.text.FootnoteSettings") == rServiceName;
324 /* -----------------------------06.04.00 11:43--------------------------------
326 ---------------------------------------------------------------------------*/
327 Sequence< OUString > SwXFootnoteProperties::getSupportedServiceNames(void) throw( RuntimeException )
329 Sequence< OUString > aRet(1);
330 OUString* pArray = aRet.getArray();
331 pArray[0] = C2U("com.sun.star.text.FootnoteSettings");
332 return aRet;
334 /*-- 14.12.98 14:03:20---------------------------------------------------
336 -----------------------------------------------------------------------*/
337 SwXFootnoteProperties::SwXFootnoteProperties(SwDoc* pDc) :
338 pDoc(pDc),
339 m_pPropertySet(GetFootnoteSet())
342 /*-- 14.12.98 14:03:20---------------------------------------------------
344 -----------------------------------------------------------------------*/
345 SwXFootnoteProperties::~SwXFootnoteProperties()
349 /*-- 14.12.98 14:03:20---------------------------------------------------
351 -----------------------------------------------------------------------*/
352 uno::Reference< beans::XPropertySetInfo > SwXFootnoteProperties::getPropertySetInfo(void)
353 throw( uno::RuntimeException )
355 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
356 return aRef;
358 /*-- 14.12.98 14:03:20---------------------------------------------------
360 -----------------------------------------------------------------------*/
361 void SwXFootnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
362 throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
364 vos::OGuard aGuard(Application::GetSolarMutex());
365 if(pDoc)
367 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
368 if(pEntry)
370 if ( pEntry->nFlags & PropertyAttribute::READONLY)
371 throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
372 SwFtnInfo aFtnInfo(pDoc->GetFtnInfo());
373 switch(pEntry->nWID)
375 case WID_PREFIX:
377 OUString uTmp;
378 aValue >>= uTmp;
379 aFtnInfo.SetPrefix(uTmp);
381 break;
382 case WID_SUFFIX:
384 OUString uTmp;
385 aValue >>= uTmp;
386 aFtnInfo.SetSuffix(uTmp);
388 break;
389 case WID_NUMBERING_TYPE :
391 INT16 nTmp = 0;
392 aValue >>= nTmp;
393 if(nTmp >= 0 &&
394 (nTmp <= SVX_NUM_ARABIC ||
395 nTmp > SVX_NUM_BITMAP))
396 aFtnInfo.aFmt.SetNumberingType(nTmp);
397 else
398 throw lang::IllegalArgumentException();
400 break;
401 case WID_START_AT:
403 INT16 nTmp = 0;
404 aValue >>= nTmp;
405 aFtnInfo.nFtnOffset = nTmp;
407 break;
408 case WID_FOOTNOTE_COUNTING :
410 INT16 nTmp = 0;
411 aValue >>= nTmp;
412 switch(nTmp)
414 case FootnoteNumbering::PER_PAGE:
415 aFtnInfo.eNum = FTNNUM_PAGE;
416 break;
417 case FootnoteNumbering::PER_CHAPTER:
418 aFtnInfo.eNum = FTNNUM_CHAPTER;
419 break;
420 case FootnoteNumbering::PER_DOCUMENT:
421 aFtnInfo.eNum = FTNNUM_DOC;
422 break;
425 break;
426 case WID_PARAGRAPH_STYLE :
428 SwTxtFmtColl* pColl = lcl_GetParaStyle(pDoc, aValue);
429 if(pColl)
430 aFtnInfo.SetFtnTxtColl(*pColl);
432 break;
433 case WID_PAGE_STYLE :
435 SwPageDesc* pDesc = lcl_GetPageDesc(pDoc, aValue);
436 if(pDesc)
437 aFtnInfo.ChgPageDesc( pDesc );
439 break;
440 case WID_ANCHOR_CHARACTER_STYLE:
441 case WID_CHARACTER_STYLE :
443 SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
444 if(pFmt)
446 if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE)
447 aFtnInfo.SetAnchorCharFmt(pFmt);
448 else
449 aFtnInfo.SetCharFmt(pFmt);
452 break;
453 case WID_POSITION_END_OF_DOC:
455 sal_Bool bVal = *(sal_Bool*)aValue.getValue();
456 aFtnInfo.ePos = bVal ? FTNPOS_CHAPTER : FTNPOS_PAGE;
458 break;
459 case WID_END_NOTICE :
461 OUString uTmp;
462 aValue >>= uTmp;
463 aFtnInfo.aQuoVadis = String(uTmp);
465 break;
466 case WID_BEGIN_NOTICE :
468 OUString uTmp;
469 aValue >>= uTmp;
470 aFtnInfo.aErgoSum = String(uTmp);
472 break;
474 pDoc->SetFtnInfo(aFtnInfo);
476 else
477 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
479 else
480 throw uno::RuntimeException();
482 /*-- 14.12.98 14:03:21---------------------------------------------------
484 -----------------------------------------------------------------------*/
485 uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName)
486 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
488 vos::OGuard aGuard(Application::GetSolarMutex());
489 uno::Any aRet;
490 if(pDoc)
492 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
493 if(pEntry)
495 const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo();
496 switch(pEntry->nWID)
498 case WID_PREFIX:
500 aRet <<= OUString(rFtnInfo.GetPrefix());
502 break;
503 case WID_SUFFIX:
505 aRet <<= OUString(rFtnInfo.GetSuffix());
507 break;
508 case WID_NUMBERING_TYPE :
510 aRet <<= rFtnInfo.aFmt.GetNumberingType();
512 break;
513 case WID_START_AT:
514 aRet <<= (sal_Int16)rFtnInfo.nFtnOffset;
515 break;
516 case WID_FOOTNOTE_COUNTING :
518 sal_Int16 nRet = 0;
519 switch(rFtnInfo.eNum)
521 case FTNNUM_PAGE:
522 nRet = FootnoteNumbering::PER_PAGE;
523 break;
524 case FTNNUM_CHAPTER:
525 nRet = FootnoteNumbering::PER_CHAPTER;
526 break;
527 case FTNNUM_DOC:
528 nRet = FootnoteNumbering::PER_DOCUMENT;
529 break;
531 aRet <<= nRet;
533 break;
534 case WID_PARAGRAPH_STYLE :
536 SwTxtFmtColl* pColl = rFtnInfo.GetFtnTxtColl();
537 String aString;
538 if(pColl)
539 aString = String ( pColl->GetName() );
540 SwStyleNameMapper::FillProgName(aString, aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
541 aRet <<= OUString ( aString );
543 break;
544 case WID_PAGE_STYLE :
546 String aString;
547 if( rFtnInfo.GetPageDescDep()->GetRegisteredIn() )
549 SwStyleNameMapper::FillProgName(
550 rFtnInfo.GetPageDesc( *pDoc )->GetName(),
551 aString,
552 nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC,
553 sal_True);
555 aRet <<= OUString ( aString );
557 break;
558 case WID_ANCHOR_CHARACTER_STYLE:
559 case WID_CHARACTER_STYLE:
561 String aString;
562 const SwCharFmt* pCharFmt = 0;
563 if( pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE )
565 if( rFtnInfo.GetAnchorCharFmtDep()->GetRegisteredIn() )
566 pCharFmt = rFtnInfo.GetAnchorCharFmt(*pDoc);
568 else
570 if( rFtnInfo.GetCharFmtDep()->GetRegisteredIn() )
571 pCharFmt = rFtnInfo.GetCharFmt(*pDoc);
573 if( pCharFmt )
575 SwStyleNameMapper::FillProgName(
576 pCharFmt->GetName(),
577 aString,
578 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
579 sal_True);
581 aRet <<= OUString ( aString );
583 break;
584 case WID_POSITION_END_OF_DOC:
586 sal_Bool bTemp = FTNPOS_CHAPTER == rFtnInfo.ePos;
587 aRet.setValue(&bTemp, ::getCppuBooleanType());
589 break;
590 case WID_END_NOTICE :
591 aRet <<= OUString(rFtnInfo.aQuoVadis);
592 break;
593 case WID_BEGIN_NOTICE :
594 aRet <<= OUString(rFtnInfo.aErgoSum);
595 break;
598 else
599 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
601 else
602 throw uno::RuntimeException();
603 return aRet;
605 /*-- 14.12.98 14:03:21---------------------------------------------------
607 -----------------------------------------------------------------------*/
608 void SwXFootnoteProperties::addPropertyChangeListener(
609 const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
610 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
612 DBG_WARNING("not implemented");
614 /*-- 14.12.98 14:03:21---------------------------------------------------
616 -----------------------------------------------------------------------*/
617 void SwXFootnoteProperties::removePropertyChangeListener(
618 const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
619 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
621 DBG_WARNING("not implemented");
623 /*-- 14.12.98 14:03:21---------------------------------------------------
625 -----------------------------------------------------------------------*/
626 void SwXFootnoteProperties::addVetoableChangeListener(
627 const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
628 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
630 DBG_WARNING("not implemented");
632 /*-- 14.12.98 14:03:22---------------------------------------------------
634 -----------------------------------------------------------------------*/
635 void SwXFootnoteProperties::removeVetoableChangeListener(
636 const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
637 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
639 DBG_WARNING("not implemented");
642 /******************************************************************
643 * SwXEndnoteProperties
644 ******************************************************************/
645 /* -----------------------------06.04.00 11:45--------------------------------
647 ---------------------------------------------------------------------------*/
648 OUString SwXEndnoteProperties::getImplementationName(void) throw( RuntimeException )
650 return C2U("SwXEndnoteProperties");
652 /* -----------------------------06.04.00 11:45--------------------------------
654 ---------------------------------------------------------------------------*/
655 BOOL SwXEndnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
657 return C2U("com.sun.star.text.FootnoteSettings") == rServiceName;
659 /* -----------------------------06.04.00 11:45--------------------------------
661 ---------------------------------------------------------------------------*/
662 Sequence< OUString > SwXEndnoteProperties::getSupportedServiceNames(void) throw( RuntimeException )
664 Sequence< OUString > aRet(1);
665 OUString* pArray = aRet.getArray();
666 pArray[0] = C2U("com.sun.star.text.FootnoteSettings");
667 return aRet;
669 /*-- 14.12.98 14:27:39---------------------------------------------------
671 -----------------------------------------------------------------------*/
672 SwXEndnoteProperties::SwXEndnoteProperties(SwDoc* pDc) :
673 pDoc(pDc),
674 m_pPropertySet(GetEndnoteSet())
678 /*-- 14.12.98 14:27:39---------------------------------------------------
680 -----------------------------------------------------------------------*/
681 SwXEndnoteProperties::~SwXEndnoteProperties()
685 /*-- 14.12.98 14:27:40---------------------------------------------------
687 -----------------------------------------------------------------------*/
688 uno::Reference< beans::XPropertySetInfo > SwXEndnoteProperties::getPropertySetInfo(void) throw( uno::RuntimeException )
690 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
691 return aRef;
693 /*-- 14.12.98 14:27:40---------------------------------------------------
695 -----------------------------------------------------------------------*/
696 void SwXEndnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
697 throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
698 lang::WrappedTargetException, uno::RuntimeException )
700 vos::OGuard aGuard(Application::GetSolarMutex());
701 if(pDoc)
703 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
704 if(pEntry)
706 if ( pEntry->nFlags & PropertyAttribute::READONLY)
707 throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
708 SwEndNoteInfo aEndInfo(pDoc->GetEndNoteInfo());
709 switch(pEntry->nWID)
711 case WID_PREFIX:
713 OUString uTmp;
714 aValue >>= uTmp;
715 aEndInfo.SetPrefix(uTmp);
717 break;
718 case WID_SUFFIX:
720 OUString uTmp;
721 aValue >>= uTmp;
722 aEndInfo.SetSuffix(uTmp);
724 break;
725 case WID_NUMBERING_TYPE :
727 INT16 nTmp = 0;
728 aValue >>= nTmp;
729 aEndInfo.aFmt.SetNumberingType(nTmp);
731 break;
732 case WID_START_AT:
734 INT16 nTmp = 0;
735 aValue >>= nTmp;
736 aEndInfo.nFtnOffset = nTmp;
738 break;
739 case WID_PARAGRAPH_STYLE :
741 SwTxtFmtColl* pColl = lcl_GetParaStyle(pDoc, aValue);
742 if(pColl)
743 aEndInfo.SetFtnTxtColl(*pColl);
745 break;
746 case WID_PAGE_STYLE :
748 SwPageDesc* pDesc = lcl_GetPageDesc(pDoc, aValue);
749 if(pDesc)
750 aEndInfo.ChgPageDesc( pDesc );
752 break;
753 case WID_ANCHOR_CHARACTER_STYLE:
754 case WID_CHARACTER_STYLE :
756 SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
757 if(pFmt)
759 if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE)
760 aEndInfo.SetAnchorCharFmt(pFmt);
761 else
762 aEndInfo.SetCharFmt(pFmt);
765 break;
767 pDoc->SetEndNoteInfo(aEndInfo);
769 else
770 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
773 /*-- 14.12.98 14:27:41---------------------------------------------------
775 -----------------------------------------------------------------------*/
776 uno::Any SwXEndnoteProperties::getPropertyValue(const OUString& rPropertyName)
777 throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
779 vos::OGuard aGuard(Application::GetSolarMutex());
780 uno::Any aRet;
781 if(pDoc)
783 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
784 if(pEntry)
786 const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
787 switch(pEntry->nWID)
789 case WID_PREFIX:
790 aRet <<= OUString(rEndInfo.GetPrefix());
791 break;
792 case WID_SUFFIX:
793 aRet <<= OUString(rEndInfo.GetSuffix());
794 break;
795 case WID_NUMBERING_TYPE :
796 aRet <<= rEndInfo.aFmt.GetNumberingType();
797 break;
798 case WID_START_AT:
799 aRet <<= (sal_Int16)rEndInfo.nFtnOffset;
800 break;
801 case WID_PARAGRAPH_STYLE :
803 SwTxtFmtColl* pColl = rEndInfo.GetFtnTxtColl();
804 String aString;
805 if(pColl)
806 aString = pColl->GetName();
807 SwStyleNameMapper::FillProgName(
808 aString,
809 aString,
810 nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
811 sal_True);
812 aRet <<= OUString ( aString );
815 break;
816 case WID_PAGE_STYLE :
818 String aString;
819 if( rEndInfo.GetPageDescDep()->GetRegisteredIn() )
821 SwStyleNameMapper::FillProgName(
822 rEndInfo.GetPageDesc( *pDoc )->GetName(),
823 aString,
824 nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC,
825 sal_True );
827 aRet <<= OUString ( aString );
829 break;
830 case WID_ANCHOR_CHARACTER_STYLE:
831 case WID_CHARACTER_STYLE:
833 String aString;
834 const SwCharFmt* pCharFmt = 0;
835 if( pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE )
837 if( rEndInfo.GetAnchorCharFmtDep()->GetRegisteredIn() )
838 pCharFmt = rEndInfo.GetAnchorCharFmt(*pDoc);
840 else
842 if( rEndInfo.GetCharFmtDep()->GetRegisteredIn() )
843 pCharFmt = rEndInfo.GetCharFmt(*pDoc);
845 if( pCharFmt )
847 SwStyleNameMapper::FillProgName(
848 pCharFmt->GetName(),
849 aString,
850 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
851 sal_True );
853 aRet <<= OUString ( aString );
855 break;
858 else
859 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
861 return aRet;
863 /*-- 14.12.98 14:27:41---------------------------------------------------
865 -----------------------------------------------------------------------*/
866 void SwXEndnoteProperties::addPropertyChangeListener(
867 const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
869 DBG_WARNING("not implemented");
871 /*-- 14.12.98 14:27:41---------------------------------------------------
873 -----------------------------------------------------------------------*/
874 void SwXEndnoteProperties::removePropertyChangeListener(const OUString& /*PropertyName*/,
875 const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/)
876 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
878 DBG_WARNING("not implemented");
880 /*-- 14.12.98 14:27:41---------------------------------------------------
882 -----------------------------------------------------------------------*/
883 void SwXEndnoteProperties::addVetoableChangeListener(const OUString& /*PropertyName*/,
884 const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
885 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
887 DBG_WARNING("not implemented");
889 /*-- 14.12.98 14:27:42---------------------------------------------------
891 -----------------------------------------------------------------------*/
892 void SwXEndnoteProperties::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
893 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
895 DBG_WARNING("not implemented");
897 /******************************************************************
898 * SwXLineNumberingProperties
899 ******************************************************************/
900 /* -----------------------------06.04.00 11:47--------------------------------
902 ---------------------------------------------------------------------------*/
903 OUString SwXLineNumberingProperties::getImplementationName(void) throw( RuntimeException )
905 return C2U("SwXLineNumberingProperties");
907 /* -----------------------------06.04.00 11:47--------------------------------
909 ---------------------------------------------------------------------------*/
910 BOOL SwXLineNumberingProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
912 return C2U("com.sun.star.text.LineNumberingProperties") == rServiceName;
914 /* -----------------------------06.04.00 11:47--------------------------------
916 ---------------------------------------------------------------------------*/
917 Sequence< OUString > SwXLineNumberingProperties::getSupportedServiceNames(void) throw( RuntimeException )
919 Sequence< OUString > aRet(1);
920 OUString* pArray = aRet.getArray();
921 pArray[0] = C2U("com.sun.star.text.LineNumberingProperties");
922 return aRet;
924 /*-- 14.12.98 14:33:36---------------------------------------------------
926 -----------------------------------------------------------------------*/
927 SwXLineNumberingProperties::SwXLineNumberingProperties(SwDoc* pDc) :
928 pDoc(pDc),
929 m_pPropertySet(GetLineNumberingSet())
933 /*-- 14.12.98 14:33:37---------------------------------------------------
935 -----------------------------------------------------------------------*/
936 SwXLineNumberingProperties::~SwXLineNumberingProperties()
940 /*-- 14.12.98 14:33:37---------------------------------------------------
942 -----------------------------------------------------------------------*/
943 uno::Reference< beans::XPropertySetInfo > SwXLineNumberingProperties::getPropertySetInfo(void) throw( uno::RuntimeException )
945 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
946 return aRef;
948 /*-- 14.12.98 14:33:37---------------------------------------------------
950 -----------------------------------------------------------------------*/
951 void SwXLineNumberingProperties::setPropertyValue(
952 const OUString& rPropertyName, const Any& aValue)
953 throw( UnknownPropertyException, PropertyVetoException,
954 IllegalArgumentException, WrappedTargetException, RuntimeException )
956 vos::OGuard aGuard(Application::GetSolarMutex());
957 if(pDoc)
959 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
960 if(pEntry)
962 if ( pEntry->nFlags & PropertyAttribute::READONLY)
963 throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
964 SwLineNumberInfo aInfo(pDoc->GetLineNumberInfo());
965 switch(pEntry->nWID)
967 case WID_NUM_ON:
969 sal_Bool bVal = *(sal_Bool*)aValue.getValue();
970 aInfo.SetPaintLineNumbers(bVal);
972 break;
973 case WID_CHARACTER_STYLE :
975 SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
976 if(pFmt)
977 aInfo.SetCharFmt(pFmt);
979 break;
980 case WID_NUMBERING_TYPE :
982 SvxNumberType aNumType(aInfo.GetNumType());
983 INT16 nTmp = 0;
984 aValue >>= nTmp;
985 aNumType.SetNumberingType(nTmp);
986 aInfo.SetNumType(aNumType);
988 break;
989 case WID_NUMBER_POSITION :
991 INT16 nTmp = 0;
992 aValue >>= nTmp;
993 switch(nTmp)
995 case style::LineNumberPosition::LEFT:
996 aInfo.SetPos(LINENUMBER_POS_LEFT); ;
997 break;
998 case style::LineNumberPosition::RIGHT :
999 aInfo.SetPos(LINENUMBER_POS_RIGHT); ;
1000 break;
1001 case style::LineNumberPosition::INSIDE:
1002 aInfo.SetPos(LINENUMBER_POS_INSIDE); ;
1003 break;
1004 case style::LineNumberPosition::OUTSIDE:
1005 aInfo.SetPos(LINENUMBER_POS_OUTSIDE);
1006 break;
1009 break;
1010 case WID_DISTANCE :
1012 INT32 nVal = 0;
1013 aValue >>= nVal;
1014 INT32 nTmp = MM100_TO_TWIP(nVal);
1015 if (nTmp > USHRT_MAX)
1016 nTmp = USHRT_MAX;
1017 aInfo.SetPosFromLeft( static_cast< USHORT >(nTmp) );
1019 break;
1020 case WID_INTERVAL :
1022 INT16 nTmp = 0;
1023 aValue >>= nTmp;
1024 if( nTmp > 0)
1025 aInfo.SetCountBy(nTmp);
1027 break;
1028 case WID_SEPARATOR_TEXT :
1030 OUString uTmp;
1031 aValue >>= uTmp;
1032 aInfo.SetDivider(uTmp);
1034 break;
1035 case WID_SEPARATOR_INTERVAL:
1037 INT16 nTmp = 0;
1038 aValue >>= nTmp;
1039 if( nTmp >= 0)
1040 aInfo.SetDividerCountBy(nTmp);
1042 break;
1043 case WID_COUNT_EMPTY_LINES :
1045 sal_Bool bVal = *(sal_Bool*)aValue.getValue();
1046 aInfo.SetCountBlankLines(bVal);
1048 break;
1049 case WID_COUNT_LINES_IN_FRAMES :
1051 sal_Bool bVal = *(sal_Bool*)aValue.getValue();
1052 aInfo.SetCountInFlys(bVal);
1054 break;
1055 case WID_RESTART_AT_EACH_PAGE :
1057 sal_Bool bVal = *(sal_Bool*)aValue.getValue();
1058 aInfo.SetRestartEachPage(bVal);
1060 break;
1062 pDoc->SetLineNumberInfo(aInfo);
1064 else
1065 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1067 else
1068 throw uno::RuntimeException();
1070 /*-- 14.12.98 14:33:38---------------------------------------------------
1072 -----------------------------------------------------------------------*/
1073 Any SwXLineNumberingProperties::getPropertyValue(const OUString& rPropertyName)
1074 throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
1076 vos::OGuard aGuard(Application::GetSolarMutex());
1077 Any aRet;
1078 if(pDoc)
1080 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName );
1081 if(pEntry)
1083 const SwLineNumberInfo& rInfo = pDoc->GetLineNumberInfo();
1084 switch(pEntry->nWID)
1086 case WID_NUM_ON:
1088 sal_Bool bTemp = rInfo.IsPaintLineNumbers();
1089 aRet.setValue(&bTemp, ::getCppuBooleanType());
1091 break;
1092 case WID_CHARACTER_STYLE :
1094 String aString;
1095 // return empty string if no char format is set
1096 // otherwise it would be created here
1097 if(rInfo.GetRegisteredIn())
1099 SwStyleNameMapper::FillProgName(
1100 rInfo.GetCharFmt(*pDoc)->GetName(),
1101 aString,
1102 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
1103 sal_True);
1105 aRet <<= OUString ( aString );
1107 break;
1108 case WID_NUMBERING_TYPE :
1109 aRet <<= rInfo.GetNumType().GetNumberingType();
1110 break;
1111 case WID_NUMBER_POSITION :
1113 sal_Int16 nRet = 0;
1114 switch(rInfo.GetPos())
1116 case LINENUMBER_POS_LEFT:
1117 nRet = style::LineNumberPosition::LEFT;
1118 break;
1119 case LINENUMBER_POS_RIGHT :
1120 nRet = style::LineNumberPosition::RIGHT ;
1121 break;
1122 case LINENUMBER_POS_INSIDE:
1123 nRet = style::LineNumberPosition::INSIDE ;
1124 break;
1125 case LINENUMBER_POS_OUTSIDE :
1126 nRet = style::LineNumberPosition::OUTSIDE ;
1127 break;
1129 aRet <<= nRet;
1131 break;
1132 case WID_DISTANCE :
1134 sal_uInt32 nPos = rInfo.GetPosFromLeft();
1135 if(USHRT_MAX == nPos)
1136 nPos = 0;
1137 aRet <<= static_cast < sal_Int32 >(TWIP_TO_MM100_UNSIGNED(nPos));
1139 break;
1140 case WID_INTERVAL :
1141 aRet <<= (sal_Int16)rInfo.GetCountBy();
1142 break;
1143 case WID_SEPARATOR_TEXT :
1144 aRet <<= OUString(rInfo.GetDivider());
1145 break;
1146 case WID_SEPARATOR_INTERVAL:
1147 aRet <<= (sal_Int16)rInfo.GetDividerCountBy();
1148 break;
1149 case WID_COUNT_EMPTY_LINES :
1151 sal_Bool bTemp = rInfo.IsCountBlankLines();
1152 aRet.setValue(&bTemp, ::getCppuBooleanType());
1154 break;
1155 case WID_COUNT_LINES_IN_FRAMES :
1157 sal_Bool bTemp = rInfo.IsCountInFlys();
1158 aRet.setValue(&bTemp, ::getCppuBooleanType());
1160 break;
1161 case WID_RESTART_AT_EACH_PAGE :
1163 sal_Bool bTemp = rInfo.IsRestartEachPage();
1164 aRet.setValue(&bTemp, ::getCppuBooleanType());
1166 break;
1169 else
1170 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
1172 else
1173 throw uno::RuntimeException();
1174 return aRet;
1176 /*-- 14.12.98 14:33:38---------------------------------------------------
1178 -----------------------------------------------------------------------*/
1179 void SwXLineNumberingProperties::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1181 DBG_WARNING("not implemented");
1183 /*-- 14.12.98 14:33:38---------------------------------------------------
1185 -----------------------------------------------------------------------*/
1186 void SwXLineNumberingProperties::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1188 DBG_WARNING("not implemented");
1190 /*-- 14.12.98 14:33:39---------------------------------------------------
1192 -----------------------------------------------------------------------*/
1193 void SwXLineNumberingProperties::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1195 DBG_WARNING("not implemented");
1197 /*-- 14.12.98 14:33:39---------------------------------------------------
1199 -----------------------------------------------------------------------*/
1200 void SwXLineNumberingProperties::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
1201 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
1203 DBG_WARNING("not implemented");
1205 /******************************************************************
1206 * SwXNumberingRules
1207 ******************************************************************/
1208 String SwXNumberingRules::sInvalidStyle(String::CreateFromAscii("__XXX___invalid"));
1210 const String& SwXNumberingRules::GetInvalidStyle()
1212 return sInvalidStyle;
1214 /* -----------------------------10.03.00 17:05--------------------------------
1216 ---------------------------------------------------------------------------*/
1217 const uno::Sequence< sal_Int8 > & SwXNumberingRules::getUnoTunnelId()
1219 static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
1220 return aSeq;
1222 /* -----------------------------10.03.00 17:05--------------------------------
1224 ---------------------------------------------------------------------------*/
1225 // return implementation specific data
1226 sal_Int64 SwXNumberingRules::getSomething( const uno::Sequence< sal_Int8 > & rId ) throw(uno::RuntimeException)
1228 if( rId.getLength() == 16
1229 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
1230 rId.getConstArray(), 16 ) )
1232 return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
1234 return 0;
1237 /* -----------------------------06.04.00 11:47--------------------------------
1239 ---------------------------------------------------------------------------*/
1240 OUString SwXNumberingRules::getImplementationName(void) throw( RuntimeException )
1242 return C2U("SwXNumberingRules");
1244 /* -----------------------------06.04.00 11:47--------------------------------
1246 ---------------------------------------------------------------------------*/
1247 BOOL SwXNumberingRules::supportsService(const OUString& rServiceName) throw( RuntimeException )
1249 return C2U("com.sun.star.text.NumberingRules") == rServiceName;
1251 /* -----------------------------06.04.00 11:47--------------------------------
1253 ---------------------------------------------------------------------------*/
1254 Sequence< OUString > SwXNumberingRules::getSupportedServiceNames(void) throw( RuntimeException )
1256 Sequence< OUString > aRet(1);
1257 OUString* pArray = aRet.getArray();
1258 pArray[0] = C2U("com.sun.star.text.NumberingRules");
1259 return aRet;
1262 /*-- 14.12.98 14:57:57---------------------------------------------------
1264 -----------------------------------------------------------------------*/
1265 SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule) :
1266 pDoc(0),
1267 pDocShell(0),
1268 pNumRule(new SwNumRule(rRule)),
1269 m_pPropertySet(GetNumberingRulesSet()),
1270 bOwnNumRuleCreated(TRUE)
1272 sal_uInt16 i;
1274 //erstmal das Doc organisieren; es haengt an den gesetzten Zeichenvorlagen - wenn
1275 // keine gesetzt sind, muss es auch ohne gehen
1276 for( i = 0; i < MAXLEVEL; i++)
1278 SwNumFmt rFmt(pNumRule->Get(i));
1279 SwCharFmt* pCharFmt = rFmt.GetCharFmt();
1280 if(pCharFmt)
1282 pDoc = pCharFmt->GetDoc();
1283 break;
1286 if(pDoc)
1287 pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
1288 for(i = 0; i < MAXLEVEL; i++)
1290 sNewCharStyleNames[i] = SwXNumberingRules::GetInvalidStyle();
1291 sNewBulletFontNames[i] = SwXNumberingRules::GetInvalidStyle();
1294 /* -----------------22.02.99 16:35-------------------
1296 * --------------------------------------------------*/
1297 SwXNumberingRules::SwXNumberingRules(SwDocShell& rDocSh) :
1298 pDoc(0),
1299 pDocShell(&rDocSh),
1300 pNumRule(0),
1301 m_pPropertySet(GetNumberingRulesSet()),
1302 bOwnNumRuleCreated(FALSE)
1304 pDocShell->GetDoc()->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
1306 /* -----------------------------24.08.00 11:36--------------------------------
1308 ---------------------------------------------------------------------------*/
1309 SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) :
1310 pDoc(&rDoc),
1311 pDocShell(0),
1312 pNumRule(0),
1313 m_pPropertySet(GetNumberingRulesSet()),
1314 bOwnNumRuleCreated(FALSE)
1316 rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
1317 sCreatedNumRuleName = rDoc.GetUniqueNumRuleName();
1318 #if OSL_DEBUG_LEVEL > 1
1319 sal_uInt16 nIndex =
1320 #endif
1321 // --> OD 2008-02-11 #newlistlevelattrs#
1322 rDoc.MakeNumRule( sCreatedNumRuleName, 0, FALSE,
1323 // --> OD 2008-06-06 #i89178#
1324 numfunc::GetDefaultPositionAndSpaceMode() );
1325 // <--
1326 // <--
1327 #if OSL_DEBUG_LEVEL > 1
1328 (void)nIndex;
1329 #endif
1331 /*-- 14.12.98 14:57:57---------------------------------------------------
1333 -----------------------------------------------------------------------*/
1334 SwXNumberingRules::~SwXNumberingRules()
1336 vos::OGuard aGuard(Application::GetSolarMutex());
1337 if(pDoc && sCreatedNumRuleName.Len())
1338 pDoc->DelNumRule( sCreatedNumRuleName );
1339 if( pNumRule && bOwnNumRuleCreated )
1340 delete pNumRule;
1342 /*-- 14.12.98 14:57:58---------------------------------------------------
1344 -----------------------------------------------------------------------*/
1345 void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElement)
1346 throw( lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
1347 lang::WrappedTargetException, uno::RuntimeException)
1349 vos::OGuard aGuard(Application::GetSolarMutex());
1350 if(nIndex < 0 || MAXLEVEL <= nIndex)
1351 throw lang::IndexOutOfBoundsException();
1353 if(rElement.getValueType().getTypeClass() != uno::TypeClass_SEQUENCE)
1354 throw lang::IllegalArgumentException();
1355 const uno::Sequence<beans::PropertyValue>& rProperties =
1356 *(const uno::Sequence<beans::PropertyValue>*)rElement.getValue();
1357 SwNumRule* pRule = 0;
1358 if(pNumRule)
1359 SwXNumberingRules::SetNumberingRuleByIndex( *pNumRule,
1360 rProperties, nIndex);
1361 else if(pDocShell)
1363 // --> OD 2008-04-21 #i87650# - correction of cws swwarnings:
1364 // Do not set member <pNumRule>
1365 // pNumRule = pDocShell->GetDoc()->GetOutlineNumRule();
1366 // SwNumRule aNumRule(*pNumRule);
1367 SwNumRule aNumRule( *(pDocShell->GetDoc()->GetOutlineNumRule()) );
1368 // <--
1369 SwXNumberingRules::SetNumberingRuleByIndex( aNumRule,
1370 rProperties, nIndex);
1371 //hier noch die Zeichenformate bei Bedarf setzen
1372 const SwCharFmts* pFmts = pDocShell->GetDoc()->GetCharFmts();
1373 sal_uInt16 nChCount = pFmts->Count();
1374 for(sal_uInt16 i = 0; i < MAXLEVEL;i++)
1376 SwNumFmt aFmt(aNumRule.Get( i ));
1377 if(sNewCharStyleNames[i].Len() &&
1378 !sNewCharStyleNames[i].EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_CHARACTER_FORMAT_NONE)) &&
1379 (!aFmt.GetCharFmt() ||
1380 aFmt.GetCharFmt()->GetName()!= sNewCharStyleNames[i] ))
1382 SwCharFmt* pCharFmt = 0;
1383 for(sal_uInt16 j = 0; j< nChCount; j++)
1385 SwCharFmt* pTmp = (*pFmts)[j];
1386 if(pTmp->GetName() == sNewCharStyleNames[i])
1388 pCharFmt = pTmp;
1389 break;
1392 if(!pCharFmt)
1394 SfxStyleSheetBase* pBase;
1395 pBase = pDocShell->GetStyleSheetPool()->Find(sNewCharStyleNames[i],
1396 SFX_STYLE_FAMILY_CHAR);
1397 if(!pBase)
1398 pBase = &pDocShell->GetStyleSheetPool()->Make(sNewCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
1399 pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
1402 aFmt.SetCharFmt( pCharFmt );
1403 aNumRule.Set( i, aFmt );
1406 pDocShell->GetDoc()->SetOutlineNumRule( aNumRule );
1408 else if(!pNumRule && pDoc && sCreatedNumRuleName.Len() &&
1409 0 != (pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName )))
1411 SwXNumberingRules::SetNumberingRuleByIndex( *pRule,
1412 rProperties, nIndex);
1414 pRule->Validate();
1416 else
1417 throw uno::RuntimeException();
1420 /*-- 14.12.98 14:57:58---------------------------------------------------
1422 -----------------------------------------------------------------------*/
1423 sal_Int32 SwXNumberingRules::getCount(void) throw( uno::RuntimeException )
1425 return MAXLEVEL;
1427 /*-- 14.12.98 14:57:58---------------------------------------------------
1429 -----------------------------------------------------------------------*/
1430 uno::Any SwXNumberingRules::getByIndex(sal_Int32 nIndex)
1431 throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException,
1432 uno::RuntimeException )
1434 vos::OGuard aGuard(Application::GetSolarMutex());
1435 if(nIndex < 0 || MAXLEVEL <= nIndex)
1436 throw lang::IndexOutOfBoundsException();
1438 uno::Any aVal;
1439 const SwNumRule* pRule = pNumRule;
1440 if(!pRule && pDoc && sCreatedNumRuleName.Len())
1441 pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName );
1442 if(pRule)
1444 uno::Sequence<beans::PropertyValue> aRet = GetNumberingRuleByIndex(
1445 *pRule, nIndex);
1446 aVal.setValue(&aRet, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
1449 else if(pDocShell)
1451 uno::Sequence<beans::PropertyValue> aRet = GetNumberingRuleByIndex(
1452 *pDocShell->GetDoc()->GetOutlineNumRule(), nIndex);
1453 aVal.setValue(&aRet, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
1455 else
1456 throw uno::RuntimeException();
1457 return aVal;
1459 /*-- 14.12.98 14:57:59---------------------------------------------------
1461 -----------------------------------------------------------------------*/
1462 uno::Type SwXNumberingRules::getElementType(void)
1463 throw( uno::RuntimeException )
1465 return ::getCppuType((uno::Sequence<beans::PropertyValue>*)0);
1467 /*-- 14.12.98 14:57:59---------------------------------------------------
1469 -----------------------------------------------------------------------*/
1470 sal_Bool SwXNumberingRules::hasElements(void) throw( uno::RuntimeException )
1472 return sal_True;
1474 /*-- 14.12.98 14:57:59---------------------------------------------------
1476 -----------------------------------------------------------------------*/
1477 uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
1478 const SwNumRule& rNumRule, sal_Int32 nIndex) const
1480 vos::OGuard aGuard(Application::GetSolarMutex());
1481 DBG_ASSERT( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" );
1483 const SwNumFmt& rFmt = rNumRule.Get( (sal_uInt16)nIndex );
1485 sal_Bool bChapterNum = pDocShell != 0;
1487 PropValDataArr aPropertyValues;
1488 //fill all properties into the array
1490 //adjust
1491 SvxAdjust eAdj = rFmt.GetNumAdjust();
1492 sal_Int16 nINT16 = aSvxToUnoAdjust[(sal_uInt16)eAdj];
1493 PropValData* pData = new PropValData((void*)&nINT16, "Adjust", ::getCppuType((const sal_Int16*)0) );
1494 aPropertyValues.Insert(pData, aPropertyValues.Count());
1496 //parentnumbering
1497 nINT16 = rFmt.GetIncludeUpperLevels();
1498 pData = new PropValData((void*)&nINT16, "ParentNumbering", ::getCppuType((const sal_Int16*)0));
1499 aPropertyValues.Insert(pData, aPropertyValues.Count());
1501 //prefix
1502 OUString aUString = rFmt.GetPrefix();
1503 pData = new PropValData((void*)&aUString, "Prefix", ::getCppuType((const OUString*)0));
1504 aPropertyValues.Insert(pData, aPropertyValues.Count());
1506 //suffix
1507 aUString = rFmt.GetSuffix();
1508 pData = new PropValData((void*)&aUString, "Suffix", ::getCppuType((const OUString*)0));
1509 aPropertyValues.Insert(pData, aPropertyValues.Count());
1511 //char style name
1512 SwCharFmt* pCharFmt = rFmt.GetCharFmt();
1513 String CharStyleName;
1514 if(pCharFmt)
1515 CharStyleName = pCharFmt->GetName();
1516 //egal ob ein Style vorhanden ist oder nicht ueberschreibt der Array-Eintrag diesen String
1517 if(sNewCharStyleNames[(sal_uInt16)nIndex].Len() &&
1518 SwXNumberingRules::sInvalidStyle != sNewCharStyleNames[(sal_uInt16)nIndex])
1519 CharStyleName = sNewCharStyleNames[(sal_uInt16)nIndex];
1521 String aString;
1522 SwStyleNameMapper::FillProgName( CharStyleName, aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
1523 aUString = aString;
1524 pData = new PropValData((void*)&aUString, "CharStyleName", ::getCppuType((const OUString*)0));
1525 aPropertyValues.Insert(pData, aPropertyValues.Count());
1527 //startvalue
1528 nINT16 = rFmt.GetStart();
1529 pData = new PropValData((void*)&nINT16, "StartWith", ::getCppuType((const sal_Int16*)0));
1530 aPropertyValues.Insert(pData, aPropertyValues.Count());
1532 // --> OD 2008-01-23 #newlistlevelattrs#
1533 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1535 //leftmargin
1536 sal_Int32 nINT32 = TWIP_TO_MM100(rFmt.GetAbsLSpace());
1537 pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_LEFT_MARGIN), ::getCppuType((const sal_Int32*)0));
1538 aPropertyValues.Insert(pData, aPropertyValues.Count());
1540 //chartextoffset
1541 nINT32 = TWIP_TO_MM100(rFmt.GetCharTextDistance());
1542 pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_SYMBOL_TEXT_DISTANCE), ::getCppuType((const sal_Int32*)0));
1543 aPropertyValues.Insert(pData, aPropertyValues.Count());
1545 //firstlineoffset
1546 nINT32 = TWIP_TO_MM100(rFmt.GetFirstLineOffset());
1547 pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_OFFSET), ::getCppuType((const sal_Int32*)0));
1548 aPropertyValues.Insert(pData, aPropertyValues.Count());
1550 // <--
1552 // --> OD 2008-01-15 #newlistlevelattrs#
1553 // PositionAndSpaceMode
1554 nINT16 = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
1555 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1557 nINT16 = PositionAndSpaceMode::LABEL_ALIGNMENT;
1559 pData = new PropValData( (void*)&nINT16,
1560 SW_PROP_NAME_STR(UNO_NAME_POSITION_AND_SPACE_MODE),
1561 ::getCppuType((const sal_Int16*)0) );
1562 aPropertyValues.Insert(pData, aPropertyValues.Count());
1564 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1566 // LabelFollowedBy
1567 nINT16 = LabelFollow::LISTTAB;
1568 if ( rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
1570 nINT16 = LabelFollow::SPACE;
1572 else if ( rFmt.GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
1574 nINT16 = LabelFollow::NOTHING;
1576 pData = new PropValData( (void*)&nINT16,
1577 SW_PROP_NAME_STR(UNO_NAME_LABEL_FOLLOWED_BY),
1578 ::getCppuType((const sal_Int16*)0) );
1579 aPropertyValues.Insert(pData, aPropertyValues.Count());
1581 // ListtabStopPosition
1582 sal_Int32 nINT32 = TWIP_TO_MM100(rFmt.GetListtabPos());
1583 pData = new PropValData( (void*)&nINT32,
1584 SW_PROP_NAME_STR(UNO_NAME_LISTTAB_STOP_POSITION),
1585 ::getCppuType((const sal_Int32*)0));
1586 aPropertyValues.Insert(pData, aPropertyValues.Count());
1588 // FirstLineIndent
1589 nINT32 = TWIP_TO_MM100(rFmt.GetFirstLineIndent());
1590 pData = new PropValData( (void*)&nINT32,
1591 SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_INDENT),
1592 ::getCppuType((const sal_Int32*)0));
1593 aPropertyValues.Insert(pData, aPropertyValues.Count());
1595 // IndentAt
1596 nINT32 = TWIP_TO_MM100(rFmt.GetIndentAt());
1597 pData = new PropValData( (void*)&nINT32,
1598 SW_PROP_NAME_STR(UNO_NAME_INDENT_AT),
1599 ::getCppuType((const sal_Int32*)0));
1600 aPropertyValues.Insert(pData, aPropertyValues.Count());
1602 // <--
1604 //numberingtype
1605 nINT16 = rFmt.GetNumberingType();
1606 pData = new PropValData((void*)&nINT16, "NumberingType", ::getCppuType((const sal_Int16*)0));
1607 aPropertyValues.Insert(pData, aPropertyValues.Count());
1609 if(!bChapterNum)
1611 if(SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
1613 //BulletId
1614 nINT16 = rFmt.GetBulletChar();
1615 pData = new PropValData((void*)&nINT16, "BulletId", ::getCppuType((const sal_Int16*)0));
1616 aPropertyValues.Insert(pData, aPropertyValues.Count());
1618 const Font* pFont = rFmt.GetBulletFont();
1620 //BulletChar
1621 aUString = OUString(rFmt.GetBulletChar());
1622 pData = new PropValData((void*)&aUString, "BulletChar", ::getCppuType((const OUString*)0));
1623 aPropertyValues.Insert(pData, aPropertyValues.Count());
1625 //BulletFontName
1626 String sBulletFontName;
1627 if(pFont)
1628 sBulletFontName = pFont->GetStyleName();
1629 aUString = sBulletFontName;
1630 pData = new PropValData((void*)&aUString, "BulletFontName", ::getCppuType((const OUString*)0));
1631 aPropertyValues.Insert(pData, aPropertyValues.Count());
1633 //BulletFont
1634 if(pFont)
1636 awt::FontDescriptor aDesc;
1637 SvxUnoFontDescriptor::ConvertFromFont( *pFont, aDesc );
1638 pData = new PropValData((void*)&aDesc, SW_PROP_NAME_STR(UNO_NAME_BULLET_FONT), ::getCppuType((const awt::FontDescriptor*)0));
1639 aPropertyValues.Insert(pData, aPropertyValues.Count());
1642 if(SVX_NUM_BITMAP == rFmt.GetNumberingType())
1644 //GraphicURL
1645 const SvxBrushItem* pBrush = rFmt.GetBrush();
1646 if(pBrush)
1648 Any aAny;
1649 pBrush->QueryValue( aAny, MID_GRAPHIC_URL );
1650 aAny >>= aUString;
1652 else
1653 aUString = aEmptyStr;
1654 pData = new PropValData((void*)&aUString, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_URL), ::getCppuType((const OUString*)0));
1655 aPropertyValues.Insert(pData, aPropertyValues.Count());
1657 //graphicbitmap
1658 const Graphic* pGraphic = 0;
1659 if(pBrush )
1660 pGraphic = pBrush->GetGraphic();
1661 if(pGraphic)
1663 uno::Reference<awt::XBitmap> xBmp = VCLUnoHelper::CreateBitmap( pGraphic->GetBitmapEx() );
1664 pData = new PropValData((void*)&xBmp, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_BITMAP),
1665 ::getCppuType((const uno::Reference<awt::XBitmap>*)0));
1666 aPropertyValues.Insert(pData, aPropertyValues.Count());
1668 Size aSize = rFmt.GetGraphicSize();
1669 aSize.Width() = TWIP_TO_MM100( aSize.Width() );
1670 aSize.Height() = TWIP_TO_MM100( aSize.Height() );
1671 pData = new PropValData((void*)&aSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0));
1672 aPropertyValues.Insert(pData, aPropertyValues.Count());
1674 const SwFmtVertOrient* pOrient = rFmt.GetGraphicOrientation();
1675 if(pOrient)
1677 pData = new PropValData((void*)0, SW_PROP_NAME_STR(UNO_NAME_VERT_ORIENT), ::getCppuType((const sal_Int16*)0));
1678 ((const SfxPoolItem*)pOrient)->QueryValue(pData->aVal, MID_VERTORIENT_ORIENT);
1679 aPropertyValues.Insert(pData, aPropertyValues.Count());
1684 else
1686 //Vorlagenname
1687 String sValue(SW_RES(STR_POOLCOLL_HEADLINE1 + nIndex));
1688 const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
1689 const sal_uInt16 nCount = pColls->Count();
1690 for(sal_uInt16 i = 0; i < nCount;++i)
1692 SwTxtFmtColl &rTxtColl = *pColls->operator[](i);
1693 if(rTxtColl.IsDefault())
1694 continue;
1696 //sal_Int8 nOutLevel = rTxtColl.GetOutlineLevel(); //#outline level,zhaojianwei
1697 const sal_Int16 nOutLevel = rTxtColl.IsAssignedToListLevelOfOutlineStyle()
1698 ? static_cast<sal_Int16>(rTxtColl.GetAssignedOutlineStyleLevel())
1699 : MAXLEVEL; //<-end,zhaojianwei
1700 if ( nOutLevel == nIndex )
1702 sValue = rTxtColl.GetName();
1703 break; // the style for the level in question has been found
1705 else if( sValue==rTxtColl.GetName() )
1707 // if the default for the level is existing, but its
1708 // level is different, then it cannot be the default.
1709 sValue.Erase();
1712 String aName;
1713 SwStyleNameMapper::FillProgName(sValue, aName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
1714 aUString = aName;
1716 pData = new PropValData((void*)&aUString, SW_PROP_NAME_STR(UNO_NAME_HEADING_STYLE_NAME), ::getCppuType((const OUString*)0));
1717 aPropertyValues.Insert(pData, aPropertyValues.Count());
1720 uno::Sequence<beans::PropertyValue> aSeq(aPropertyValues.Count());
1721 beans::PropertyValue* pArray = aSeq.getArray();
1723 for(sal_uInt16 i = 0; i < aPropertyValues.Count(); i++)
1725 pData = aPropertyValues.GetObject(i);
1726 pArray[i].Value = pData->aVal;
1727 pArray[i].Name = pData->sPropName;
1728 pArray[i].Handle = -1;
1730 aPropertyValues.DeleteAndDestroy(0, aPropertyValues.Count());
1731 return aSeq;
1733 /*-- 14.12.98 14:57:59---------------------------------------------------
1735 -----------------------------------------------------------------------*/
1736 PropValData* lcl_FindProperty(const char* cName, PropValDataArr& rPropertyValues)
1738 OUString sCmp = C2U(cName);
1739 for(sal_uInt16 i = 0; i < rPropertyValues.Count(); i++)
1741 PropValData* pTemp = rPropertyValues.GetObject(i);
1742 if(sCmp == pTemp->sPropName)
1743 return pTemp;
1745 return 0;
1747 //-----------------------------------------------------------------------
1749 void SwXNumberingRules::SetNumberingRuleByIndex(
1750 SwNumRule& rNumRule,
1751 const uno::Sequence<beans::PropertyValue>& rProperties, sal_Int32 nIndex)
1752 throw( uno::RuntimeException, lang::IllegalArgumentException )
1754 vos::OGuard aGuard(Application::GetSolarMutex());
1755 DBG_ASSERT( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" );
1757 // the order of the names is important!
1758 static const char* aNumPropertyNames[] =
1760 "Adjust", //0
1761 "ParentNumbering", //1
1762 "Prefix", //2
1763 "Suffix", //3
1764 "CharStyleName", //4
1765 "StartWith", //5
1766 SW_PROP_NAME_STR(UNO_NAME_LEFT_MARGIN), //6
1767 SW_PROP_NAME_STR(UNO_NAME_SYMBOL_TEXT_DISTANCE), //7
1768 SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_OFFSET), //8
1769 // --> OD 2008-01-15 #newlistlevelattrs#
1770 SW_PROP_NAME_STR(UNO_NAME_POSITION_AND_SPACE_MODE), //9
1771 SW_PROP_NAME_STR(UNO_NAME_LABEL_FOLLOWED_BY), //10
1772 SW_PROP_NAME_STR(UNO_NAME_LISTTAB_STOP_POSITION), //11
1773 SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_INDENT), //12
1774 SW_PROP_NAME_STR(UNO_NAME_INDENT_AT), //13
1775 // <--
1776 "NumberingType", //14
1777 "BulletId", //15
1778 SW_PROP_NAME_STR(UNO_NAME_BULLET_FONT), //16
1779 "BulletFontName", //17
1780 "BulletChar", //18
1781 SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_URL), //19
1782 SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_BITMAP), //20
1783 SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), //21
1784 SW_PROP_NAME_STR(UNO_NAME_VERT_ORIENT), //22
1785 SW_PROP_NAME_STR(UNO_NAME_HEADING_STYLE_NAME) //23
1787 // --> OD 2008-01-15 #newlistlevelattrs#
1788 const sal_uInt16 nPropNameCount = 24;
1789 const sal_uInt16 nNotInChapter = 15;
1790 // <--
1792 const beans::PropertyValue* pPropArray = rProperties.getConstArray();
1793 PropValDataArr aPropertyValues;
1794 sal_Bool bExcept = sal_False;
1795 for(int i = 0; i < rProperties.getLength() && !bExcept; i++)
1797 const beans::PropertyValue& rProp = pPropArray[i];
1798 bExcept = sal_True;
1799 for(sal_uInt16 j = 0; j < (pDocShell ? nPropNameCount : nPropNameCount - 1); j++)
1801 //some values not in chapter numbering
1802 if(pDocShell && j == nNotInChapter)
1803 j = nPropNameCount - 1;
1804 if(COMPARE_EQUAL == rProp.Name.compareToAscii(aNumPropertyNames[j]))
1806 bExcept = sal_False;
1807 break;
1810 if(bExcept &&
1811 (rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("BulletRelSize")) ||
1812 rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("BulletColor")) ) )
1814 bExcept = sal_False;
1816 PropValData* pData = new PropValData(rProp.Value, rProp.Name );
1817 aPropertyValues.Insert(pData, aPropertyValues.Count());
1820 SwNumFmt aFmt(rNumRule.Get( (sal_uInt16)nIndex ));
1821 sal_Bool bWrongArg = sal_False;
1822 if(!bExcept)
1824 SvxBrushItem* pSetBrush = 0;
1825 Size* pSetSize = 0;
1826 SwFmtVertOrient* pSetVOrient = 0;
1827 BOOL bCharStyleNameSet = FALSE;
1829 for(sal_uInt16 i = 0; i < nPropNameCount && !bExcept && !bWrongArg; i++)
1831 PropValData* pData = lcl_FindProperty(aNumPropertyNames[i], aPropertyValues);
1832 if(!pData)
1833 continue;
1834 switch(i)
1836 case 0: //"Adjust"
1838 sal_Int16 nValue = 0;
1839 pData->aVal >>= nValue;
1840 if(nValue > 0 &&
1841 nValue <= text::HoriOrientation::LEFT &&
1842 USHRT_MAX != aUnoToSvxAdjust[nValue])
1844 aFmt.SetNumAdjust((SvxAdjust)aUnoToSvxAdjust[nValue]);
1846 else
1847 bWrongArg = sal_True;
1849 break;
1850 case 1: //"ParentNumbering",
1852 sal_Int16 nSet = 0;
1853 pData->aVal >>= nSet;
1854 if(nSet >= 0 && MAXLEVEL >= nSet)
1855 aFmt.SetIncludeUpperLevels( static_cast< BYTE >(nSet) );
1857 break;
1858 case 2: //"Prefix",
1860 OUString uTmp;
1861 pData->aVal >>= uTmp;
1862 aFmt.SetPrefix(uTmp);
1864 break;
1865 case 3: //"Suffix",
1867 OUString uTmp;
1868 pData->aVal >>= uTmp;
1869 aFmt.SetSuffix(uTmp);
1871 break;
1872 case 4: //"CharStyleName",
1874 bCharStyleNameSet = TRUE;
1875 OUString uTmp;
1876 pData->aVal >>= uTmp;
1877 String sCharFmtName;
1878 SwStyleNameMapper::FillUIName( uTmp, sCharFmtName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
1879 if(sCharFmtName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_CHARACTER_FORMAT_NONE)))
1881 sNewCharStyleNames[(sal_uInt16)nIndex] = SwXNumberingRules::GetInvalidStyle();
1882 aFmt.SetCharFmt(0);
1884 else if(pDocShell || pDoc)
1886 SwDoc* pLocalDoc = pDoc ? pDoc : pDocShell->GetDoc();
1887 const SwCharFmts* pFmts = pLocalDoc->GetCharFmts();
1888 sal_uInt16 nChCount = pFmts->Count();
1890 SwCharFmt* pCharFmt = 0;
1891 if(sCharFmtName.Len())
1893 for(sal_uInt16 j = 0; j< nChCount; j++)
1895 SwCharFmt* pTmp = (*pFmts)[j];
1896 if(pTmp->GetName() == sCharFmtName)
1898 pCharFmt = pTmp;
1899 break;
1902 if(!pCharFmt)
1905 SfxStyleSheetBase* pBase;
1906 SfxStyleSheetBasePool* pPool = pLocalDoc->GetDocShell()->GetStyleSheetPool();
1907 pBase = ((SfxStyleSheetBasePool*)pPool)->Find(sCharFmtName, SFX_STYLE_FAMILY_CHAR);
1908 if(!pBase)
1909 pBase = &pPool->Make(sCharFmtName, SFX_STYLE_FAMILY_CHAR);
1910 pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
1913 aFmt.SetCharFmt( pCharFmt );
1914 // os 2005-08-22 #i51842#
1915 // If the character format has been found it's name should not be in the
1916 // char style names array
1917 //sNewCharStyleNames[(sal_uInt16)nIndex] = sCharFmtName;
1918 sNewCharStyleNames[(sal_uInt16)nIndex].Erase();
1920 else
1921 sNewCharStyleNames[(sal_uInt16)nIndex] = sCharFmtName;
1923 break;
1924 case 5: //"StartWith",
1926 INT16 nVal = 0;
1927 pData->aVal >>= nVal;
1928 aFmt.SetStart(nVal);
1930 break;
1931 case 6: //UNO_NAME_LEFT_MARGIN,
1933 sal_Int32 nValue = 0;
1934 pData->aVal >>= nValue;
1935 // #i23727# nValue can be negative
1936 aFmt.SetAbsLSpace((sal_uInt16) MM100_TO_TWIP(nValue));
1938 break;
1939 case 7: //UNO_NAME_SYMBOL_TEXT_DISTANCE,
1941 sal_Int32 nValue = 0;
1942 pData->aVal >>= nValue;
1943 if(nValue >= 0)
1944 aFmt.SetCharTextDistance((sal_uInt16) MM100_TO_TWIP(nValue));
1945 else
1946 bWrongArg = sal_True;
1948 break;
1949 case 8: //UNO_NAME_FIRST_LINE_OFFSET,
1951 sal_Int32 nValue = 0;
1952 pData->aVal >>= nValue;
1953 // #i23727# nValue can be positive
1954 nValue = MM100_TO_TWIP(nValue);
1955 aFmt.SetFirstLineOffset((short)nValue);
1957 break;
1958 // --> OD 2008-01-15 #newlistlevelattrs#
1959 case 9: // UNO_NAME_POSITION_AND_SPACE_MODE
1961 sal_Int16 nValue = 0;
1962 pData->aVal >>= nValue;
1963 if ( nValue == 0 )
1965 aFmt.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
1967 else if ( nValue == 1 )
1969 aFmt.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT );
1971 else
1973 bWrongArg = sal_True;
1976 break;
1977 case 10: // UNO_NAME_LABEL_FOLLOWED_BY
1979 sal_Int16 nValue = 0;
1980 pData->aVal >>= nValue;
1981 if ( nValue == 0 )
1983 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1985 else if ( nValue == 1 )
1987 aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
1989 else if ( nValue == 2 )
1991 aFmt.SetLabelFollowedBy( SvxNumberFormat::NOTHING );
1993 else
1995 bWrongArg = sal_True;
1998 break;
1999 case 11: // UNO_NAME_LISTTAB_STOP_POSITION
2001 sal_Int32 nValue = 0;
2002 pData->aVal >>= nValue;
2003 nValue = MM100_TO_TWIP(nValue);
2004 if ( nValue >= 0 )
2006 aFmt.SetListtabPos( nValue );
2008 else
2010 bWrongArg = sal_True;
2013 break;
2014 case 12: // UNO_NAME_FIRST_LINE_INDENT
2016 sal_Int32 nValue = 0;
2017 pData->aVal >>= nValue;
2018 nValue = MM100_TO_TWIP(nValue);
2019 aFmt.SetFirstLineIndent( nValue );
2021 break;
2022 case 13: // UNO_NAME_INDENT_AT
2024 sal_Int32 nValue = 0;
2025 pData->aVal >>= nValue;
2026 nValue = MM100_TO_TWIP(nValue);
2027 aFmt.SetIndentAt( nValue );
2029 break;
2030 // <--
2031 case 14: //"NumberingType"
2033 sal_Int16 nSet = 0;
2034 pData->aVal >>= nSet;
2035 if(nSet >= 0)
2036 aFmt.SetNumberingType(nSet);
2037 else
2038 bWrongArg = sal_True;
2040 break;
2041 case 15: //"BulletId",
2043 sal_Int16 nSet = 0;
2044 if( pData->aVal >>= nSet )
2045 aFmt.SetBulletChar(nSet);
2046 else
2047 bWrongArg = sal_True;
2049 break;
2050 case 16: //UNO_NAME_BULLET_FONT,
2052 awt::FontDescriptor* pDesc = (awt::FontDescriptor*)pData->aVal.getValue();
2053 if(pDesc)
2055 // --> OD 2008-09-11 #i93725#
2056 // do not accept "empty" font
2057 if ( pDesc->Name.getLength() > 0 )
2059 Font aFont;
2060 SvxUnoFontDescriptor::ConvertToFont( *pDesc, aFont );
2061 aFmt.SetBulletFont(&aFont);
2063 // <--
2065 else
2066 bWrongArg = sal_True;
2068 break;
2069 case 17: //"BulletFontName",
2071 OUString uTmp;
2072 pData->aVal >>= uTmp;
2073 String sBulletFontName(uTmp);
2074 SwDocShell* pLclDocShell = pDocShell ? pDocShell : pDoc ? pDoc->GetDocShell() : 0;
2075 if( sBulletFontName.Len() && pLclDocShell )
2077 const SvxFontListItem* pFontListItem =
2078 (const SvxFontListItem* )pLclDocShell
2079 ->GetItem( SID_ATTR_CHAR_FONTLIST );
2080 const FontList* pList = pFontListItem->GetFontList();
2081 FontInfo aInfo = pList->Get(
2082 sBulletFontName, WEIGHT_NORMAL, ITALIC_NONE);
2083 Font aFont(aInfo);
2084 aFmt.SetBulletFont(&aFont);
2086 else
2087 sNewBulletFontNames[(sal_uInt16)nIndex] = sBulletFontName;
2089 break;
2090 case 18: //"BulletChar",
2092 OUString aChar;
2093 pData->aVal >>= aChar;
2094 if(aChar.getLength() == 1)
2096 aFmt.SetBulletChar(aChar.toChar());
2098 else
2099 bWrongArg = sal_True;
2101 break;
2102 case 19: //UNO_NAME_GRAPHIC_URL,
2104 OUString sBrushURL;
2105 pData->aVal >>= sBrushURL;
2106 if(!pSetBrush)
2108 const SvxBrushItem* pOrigBrush = aFmt.GetBrush();
2109 if(pOrigBrush)
2111 pSetBrush = new SvxBrushItem(*pOrigBrush);
2113 else
2114 pSetBrush = new SvxBrushItem(aEmptyStr, aEmptyStr, GPOS_AREA, RES_BACKGROUND);
2116 pSetBrush->PutValue( pData->aVal, MID_GRAPHIC_URL );
2118 break;
2119 case 20: //UNO_NAME_GRAPHIC_BITMAP,
2121 uno::Reference< awt::XBitmap >* pBitmap = (uno::Reference< awt::XBitmap > *)pData->aVal.getValue();
2122 if(pBitmap)
2124 if(!pSetBrush)
2126 const SvxBrushItem* pOrigBrush = aFmt.GetBrush();
2127 if(pOrigBrush)
2129 pSetBrush = new SvxBrushItem(*pOrigBrush);
2131 else
2132 pSetBrush = new SvxBrushItem(aEmptyStr, aEmptyStr, GPOS_AREA, RES_BACKGROUND);
2135 BitmapEx aBmp = VCLUnoHelper::GetBitmap( *pBitmap );
2136 Graphic aNewGr(aBmp);
2137 pSetBrush->SetGraphic( aNewGr );
2139 else
2140 bWrongArg = sal_True;
2142 break;
2143 case 21: //UNO_NAME_GRAPHIC_SIZE,
2145 if(!pSetSize)
2146 pSetSize = new Size;
2147 if(pData->aVal.getValueType() == ::getCppuType((awt::Size*)0))
2149 awt::Size* pSize = (awt::Size*)pData->aVal.getValue();
2150 pSize->Width = MM100_TO_TWIP(pSize->Width);
2151 pSize->Height = MM100_TO_TWIP(pSize->Height);
2152 pSetSize->Width() = pSize->Width;
2153 pSetSize->Height() = pSize->Height;
2155 else
2156 bWrongArg = sal_True;
2158 break;
2159 case 22: //VertOrient
2161 if(!pSetVOrient)
2163 if(aFmt.GetGraphicOrientation())
2164 pSetVOrient = (SwFmtVertOrient*)aFmt.GetGraphicOrientation()->Clone();
2165 else
2166 pSetVOrient = new SwFmtVertOrient;
2168 ((SfxPoolItem*)pSetVOrient)->PutValue(pData->aVal, MID_VERTORIENT_ORIENT);
2170 break;
2171 case 23: //"HeadingStyleName"
2173 OUString uTmp;
2174 pData->aVal >>= uTmp;
2175 String sStyleName;
2176 SwStyleNameMapper::FillUIName(uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
2177 const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
2178 const sal_uInt16 nCount = pColls->Count();
2179 for(sal_uInt16 k = 0; k < nCount; ++k)
2181 SwTxtFmtColl &rTxtColl = *((*pColls)[k]);
2182 if(rTxtColl.IsDefault())
2183 continue;
2184 //if(rTxtColl.GetOutlineLevel() == nIndex && //#outline level,removed by zhaojianwei
2185 // rTxtColl.GetName() != sStyleName)
2186 // rTxtColl..SetOutlineLevel(NO_NUMBERING);
2187 //else if(rTxtColl.GetName() == sStyleName)
2188 // rTxtColl.SetOutlineLevel(sal_Int8(nIndex));
2189 if ( rTxtColl.IsAssignedToListLevelOfOutlineStyle() && //add by zhaojianwei
2190 rTxtColl.GetAssignedOutlineStyleLevel() == nIndex &&
2191 rTxtColl.GetName() != sStyleName )
2193 rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle();
2195 else if ( rTxtColl.GetName() == sStyleName )
2197 rTxtColl.AssignToListLevelOfOutlineStyle( nIndex );
2198 } //<-end,,zhaojianwei,
2201 break;
2202 case 24: // BulletRelSize - unsupported - only available in Impress
2203 break;
2206 if(!bExcept && !bWrongArg && (pSetBrush || pSetSize || pSetVOrient))
2208 if(!pSetBrush && aFmt.GetBrush())
2209 pSetBrush = new SvxBrushItem(*aFmt.GetBrush());
2211 if(pSetBrush)
2213 if(!pSetVOrient && aFmt.GetGraphicOrientation())
2214 pSetVOrient = new SwFmtVertOrient(*aFmt.GetGraphicOrientation());
2216 if(!pSetSize)
2218 pSetSize = new Size(aFmt.GetGraphicSize());
2219 if(!pSetSize->Width() || !pSetSize->Height())
2221 const Graphic* pGraphic = pSetBrush->GetGraphic();
2222 if(pGraphic)
2223 *pSetSize = ::GetGraphicSizeTwip(*pGraphic, 0);
2226 sal_Int16 eOrient = pSetVOrient ?
2227 (sal_Int16)pSetVOrient->GetVertOrient() : text::VertOrientation::NONE;
2228 aFmt.SetGraphicBrush( pSetBrush, pSetSize, text::VertOrientation::NONE == eOrient ? 0 : &eOrient );
2231 if((!bCharStyleNameSet || !sNewCharStyleNames[(sal_uInt16)nIndex].Len()) &&
2232 aFmt.GetNumberingType() == NumberingType::BITMAP && !aFmt.GetCharFmt()
2233 && SwXNumberingRules::GetInvalidStyle() != sNewCharStyleNames[(sal_uInt16)nIndex])
2235 SwStyleNameMapper::FillProgName ( RES_POOLCHR_BUL_LEVEL, sNewCharStyleNames[(sal_uInt16)nIndex] );
2237 delete pSetBrush;
2238 delete pSetSize;
2239 delete pSetVOrient;
2241 aPropertyValues.DeleteAndDestroy(0, aPropertyValues.Count());
2243 if(bWrongArg)
2244 throw lang::IllegalArgumentException();
2245 else if(bExcept)
2246 throw uno::RuntimeException();
2247 rNumRule.Set( (sal_uInt16)nIndex, aFmt );
2250 /*-- 19.07.00 07:49:17---------------------------------------------------
2252 -----------------------------------------------------------------------*/
2253 uno::Reference< XPropertySetInfo > SwXNumberingRules::getPropertySetInfo()
2254 throw(RuntimeException)
2256 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
2257 return aRef;
2259 /*-- 19.07.00 07:49:17---------------------------------------------------
2261 -----------------------------------------------------------------------*/
2262 void SwXNumberingRules::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
2263 throw(UnknownPropertyException, PropertyVetoException,
2264 IllegalArgumentException, WrappedTargetException, RuntimeException)
2266 Any aRet;
2267 SwNumRule* pDocRule = 0;
2268 SwNumRule* pCreatedRule = 0;
2269 if(!pNumRule)
2271 if(!pNumRule && pDocShell)
2273 pDocRule = new SwNumRule(*pDocShell->GetDoc()->GetOutlineNumRule());
2275 else if(pDoc && sCreatedNumRuleName.Len())
2277 pCreatedRule = pDoc->FindNumRulePtr( sCreatedNumRuleName);
2281 if(!pNumRule && !pDocRule && !pCreatedRule)
2282 throw RuntimeException();
2285 if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC)))
2287 BOOL bVal = *(sal_Bool*)rValue.getValue();
2288 if(!pCreatedRule)
2289 pDocRule ? pDocRule->SetAutoRule(bVal) : pNumRule->SetAutoRule(bVal);
2291 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING)))
2293 BOOL bVal = *(sal_Bool*)rValue.getValue();
2294 pDocRule ? pDocRule->SetContinusNum(bVal) :
2295 pCreatedRule ? pCreatedRule->SetContinusNum(bVal) : pNumRule->SetContinusNum(bVal);
2297 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME)))
2299 delete pDocRule;
2300 throw IllegalArgumentException();
2302 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS)))
2304 BOOL bVal = *(sal_Bool*)rValue.getValue();
2305 pDocRule ? pDocRule->SetAbsSpaces(bVal) :
2306 pCreatedRule ? pCreatedRule->SetAbsSpaces(bVal) : pNumRule->SetAbsSpaces(bVal);
2308 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NUMBERING_IS_OUTLINE)))
2310 BOOL bVal = *(sal_Bool*)rValue.getValue();
2311 SwNumRuleType eNumRuleType = bVal ? OUTLINE_RULE : NUM_RULE;
2312 pDocRule ? pDocRule->SetRuleType(eNumRuleType) :
2313 pCreatedRule ? pCreatedRule->SetRuleType(eNumRuleType) : pNumRule->SetRuleType(eNumRuleType);
2315 // --> OD 2008-04-23 #refactorlists#
2316 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID)))
2318 delete pDocRule;
2319 throw IllegalArgumentException();
2321 // <--
2322 else
2323 throw UnknownPropertyException();
2325 if(pDocRule)
2327 pDocShell->GetDoc()->SetOutlineNumRule(*pDocRule);
2328 delete pDocRule;
2330 else if(pCreatedRule)
2332 pCreatedRule->Validate();
2335 /*-- 19.07.00 07:49:18---------------------------------------------------
2337 -----------------------------------------------------------------------*/
2338 Any SwXNumberingRules::getPropertyValue( const OUString& rPropertyName )
2339 throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
2341 Any aRet;
2342 const SwNumRule* pRule = pNumRule;
2343 if(!pRule && pDocShell)
2344 pRule = pDocShell->GetDoc()->GetOutlineNumRule();
2345 else if(pDoc && sCreatedNumRuleName.Len())
2346 pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName );
2347 if(!pRule)
2348 throw RuntimeException();
2350 if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC)))
2352 BOOL bVal = pRule->IsAutoRule();
2353 aRet.setValue(&bVal, ::getBooleanCppuType());
2355 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING)))
2357 BOOL bVal = pRule->IsContinusNum();
2358 aRet.setValue(&bVal, ::getBooleanCppuType());
2360 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME)))
2361 aRet <<= OUString(pRule->GetName());
2362 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS)))
2364 BOOL bVal = pRule->IsAbsSpaces();
2365 aRet.setValue(&bVal, ::getBooleanCppuType());
2367 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NUMBERING_IS_OUTLINE)))
2369 BOOL bVal = pRule->IsOutlineRule();
2370 aRet.setValue(&bVal, ::getBooleanCppuType());
2372 // --> OD 2008-04-23 #refactorlists#
2373 else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID)))
2375 ASSERT( pRule->GetDefaultListId().Len() != 0,
2376 "<SwXNumberingRules::getPropertyValue(..)> - no default list id found. Serious defect -> please inform OD." );
2377 aRet <<= OUString(pRule->GetDefaultListId());
2379 // <--
2380 else
2381 throw UnknownPropertyException();
2382 return aRet;
2384 /*-- 19.07.00 07:49:18---------------------------------------------------
2386 -----------------------------------------------------------------------*/
2387 void SwXNumberingRules::addPropertyChangeListener(
2388 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
2389 throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
2392 /*-- 19.07.00 07:49:18---------------------------------------------------
2394 -----------------------------------------------------------------------*/
2395 void SwXNumberingRules::removePropertyChangeListener(
2396 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
2397 throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
2400 /*-- 19.07.00 07:49:18---------------------------------------------------
2402 -----------------------------------------------------------------------*/
2403 void SwXNumberingRules::addVetoableChangeListener(
2404 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
2405 throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
2408 /*-- 19.07.00 07:49:18---------------------------------------------------
2410 -----------------------------------------------------------------------*/
2411 void SwXNumberingRules::removeVetoableChangeListener(
2412 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
2413 throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
2416 /* -----------------------------17.10.00 14:23--------------------------------
2418 ---------------------------------------------------------------------------*/
2419 OUString SwXNumberingRules::getName() throw( RuntimeException )
2421 String aString;
2422 if(pNumRule)
2424 SwStyleNameMapper::FillProgName(pNumRule->GetName(), aString, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, sal_True );
2425 return OUString ( aString );
2427 // --> OD 2005-10-25 #126347# - consider chapter numbering <SwXNumberingRules>
2428 else if ( pDocShell )
2430 SwStyleNameMapper::FillProgName( pDocShell->GetDoc()->GetOutlineNumRule()->GetName(),
2431 aString, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, sal_True );
2432 return OUString ( aString );
2434 // <--
2435 else
2436 return sCreatedNumRuleName;
2438 /* -----------------------------17.10.00 14:23--------------------------------
2440 ---------------------------------------------------------------------------*/
2441 void SwXNumberingRules::setName(const OUString& /*rName*/) throw( RuntimeException )
2443 RuntimeException aExcept;
2444 aExcept.Message = C2U("readonly");
2445 throw aExcept;
2447 /*-- 14.12.98 14:58:00---------------------------------------------------
2449 -----------------------------------------------------------------------*/
2450 void SwXNumberingRules::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
2452 ClientModify(this, pOld, pNew);
2453 if(!GetRegisteredIn())
2455 if(bOwnNumRuleCreated)
2456 delete pNumRule;
2457 pNumRule = 0;
2458 pDoc = 0;
2461 /* -----------------------------06.04.00 11:47--------------------------------
2463 ---------------------------------------------------------------------------*/
2464 OUString SwXChapterNumbering::getImplementationName(void) throw( RuntimeException )
2466 return C2U("SwXChapterNumbering");
2468 /* -----------------------------06.04.00 11:47--------------------------------
2470 ---------------------------------------------------------------------------*/
2471 BOOL SwXChapterNumbering::supportsService(const OUString& rServiceName) throw( RuntimeException )
2473 String sServiceName(rServiceName);
2474 return sServiceName.EqualsAscii("com.sun.star.text.ChapterNumbering") ||
2475 sServiceName.EqualsAscii("com.sun.star.text.NumberingRules");
2477 /* -----------------------------06.04.00 11:47--------------------------------
2479 ---------------------------------------------------------------------------*/
2480 Sequence< OUString > SwXChapterNumbering::getSupportedServiceNames(void) throw( RuntimeException )
2482 Sequence< OUString > aRet(2);
2483 OUString* pArray = aRet.getArray();
2484 pArray[0] = C2U("com.sun.star.text.ChapterNumbering");
2485 pArray[1] = C2U("com.sun.star.text.NumberingRules");
2486 return aRet;
2488 /* -----------------22.02.99 16:33-------------------
2490 * --------------------------------------------------*/
2491 SwXChapterNumbering::SwXChapterNumbering(SwDocShell& rDocSh) :
2492 SwXNumberingRules(rDocSh)
2495 /* -----------------22.02.99 16:33-------------------
2497 * --------------------------------------------------*/
2498 SwXChapterNumbering::~SwXChapterNumbering()
2502 /******************************************************************
2503 * SwXTextColumns
2504 ******************************************************************/
2505 /* -----------------------------06.04.00 11:47--------------------------------
2507 ---------------------------------------------------------------------------*/
2508 OUString SwXTextColumns::getImplementationName(void) throw( RuntimeException )
2510 return C2U("SwXTextColumns");
2512 /* -----------------------------06.04.00 11:47--------------------------------
2514 ---------------------------------------------------------------------------*/
2515 BOOL SwXTextColumns::supportsService(const OUString& rServiceName) throw( RuntimeException )
2517 return C2U("com.sun.star.text.TextColumns") == rServiceName;
2519 /* -----------------------------06.04.00 11:47--------------------------------
2521 ---------------------------------------------------------------------------*/
2522 Sequence< OUString > SwXTextColumns::getSupportedServiceNames(void) throw( RuntimeException )
2524 Sequence< OUString > aRet(1);
2525 OUString* pArray = aRet.getArray();
2526 pArray[0] = C2U("com.sun.star.text.TextColumns");
2527 return aRet;
2529 /* -----------------------------24.10.00 16:45--------------------------------
2531 ---------------------------------------------------------------------------*/
2532 SwXTextColumns::SwXTextColumns(sal_uInt16 nColCount) :
2533 nReference(0),
2534 bIsAutomaticWidth(sal_True),
2535 nAutoDistance(0),
2536 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS)),
2537 nSepLineWidth(0),
2538 nSepLineColor(0), //black
2539 nSepLineHeightRelative(100),//full height
2540 nSepLineVertAlign(style::VerticalAlignment_MIDDLE),
2541 bSepLineIsOn(sal_False)
2543 if(nColCount)
2544 setColumnCount(nColCount);
2546 /*-- 16.12.98 14:06:53---------------------------------------------------
2548 -----------------------------------------------------------------------*/
2549 SwXTextColumns::SwXTextColumns(const SwFmtCol& rFmtCol) :
2550 nReference(0),
2551 aTextColumns(rFmtCol.GetNumCols()),
2552 bIsAutomaticWidth(rFmtCol.IsOrtho()),
2553 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS))
2555 USHORT nItemGutterWidth = rFmtCol.GetGutterWidth();
2556 nAutoDistance = bIsAutomaticWidth ?
2557 USHRT_MAX == nItemGutterWidth ? DEF_GUTTER_WIDTH : (sal_Int32)nItemGutterWidth
2558 : 0;
2559 nAutoDistance = TWIP_TO_MM100(nAutoDistance);
2561 TextColumn* pColumns = aTextColumns.getArray();
2562 const SwColumns& rCols = rFmtCol.GetColumns();
2563 for(sal_uInt16 i = 0; i < aTextColumns.getLength(); i++)
2565 SwColumn* pCol = rCols[i];
2567 pColumns[i].Width = pCol->GetWishWidth();
2568 nReference += pColumns[i].Width;
2569 pColumns[i].LeftMargin = TWIP_TO_MM100_UNSIGNED(pCol->GetLeft ());
2570 pColumns[i].RightMargin = TWIP_TO_MM100_UNSIGNED(pCol->GetRight());
2572 if(!aTextColumns.getLength())
2573 nReference = USHRT_MAX;
2575 nSepLineWidth = rFmtCol.GetLineWidth();
2576 nSepLineColor = rFmtCol.GetLineColor().GetColor();
2577 nSepLineHeightRelative = rFmtCol.GetLineHeight();
2578 bSepLineIsOn = rFmtCol.GetLineAdj() != COLADJ_NONE;
2579 switch(rFmtCol.GetLineAdj())
2581 case COLADJ_TOP: nSepLineVertAlign = style::VerticalAlignment_TOP; break;
2582 case COLADJ_BOTTOM: nSepLineVertAlign = style::VerticalAlignment_BOTTOM; break;
2583 case COLADJ_CENTER:
2584 case COLADJ_NONE: nSepLineVertAlign = style::VerticalAlignment_MIDDLE;
2587 /*-- 16.12.98 14:06:54---------------------------------------------------
2589 -----------------------------------------------------------------------*/
2590 SwXTextColumns::~SwXTextColumns()
2594 /*-- 16.12.98 14:06:54---------------------------------------------------
2596 -----------------------------------------------------------------------*/
2597 sal_Int32 SwXTextColumns::getReferenceValue(void) throw( uno::RuntimeException )
2599 vos::OGuard aGuard(Application::GetSolarMutex());
2600 return nReference;
2602 /*-- 16.12.98 14:06:55---------------------------------------------------
2604 -----------------------------------------------------------------------*/
2605 sal_Int16 SwXTextColumns::getColumnCount(void) throw( uno::RuntimeException )
2607 vos::OGuard aGuard(Application::GetSolarMutex());
2608 return static_cast< sal_Int16>( aTextColumns.getLength() );
2610 /*-- 16.12.98 14:06:55---------------------------------------------------
2612 -----------------------------------------------------------------------*/
2613 void SwXTextColumns::setColumnCount(sal_Int16 nColumns) throw( uno::RuntimeException )
2615 vos::OGuard aGuard(Application::GetSolarMutex());
2616 if(nColumns <= 0)
2617 throw uno::RuntimeException();
2618 bIsAutomaticWidth = sal_True;
2619 aTextColumns.realloc(nColumns);
2620 TextColumn* pCols = aTextColumns.getArray();
2621 nReference = USHRT_MAX;
2622 sal_Int32 nWidth = nReference / nColumns;
2623 sal_Int32 nDiff = nReference - nWidth * nColumns;
2624 sal_Int32 nDist = nAutoDistance / 2;
2625 for(sal_Int16 i = 0; i < nColumns; i++)
2627 pCols[i].Width = nWidth;
2628 pCols[i].LeftMargin = i == 0 ? 0 : nDist;
2629 pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
2631 pCols[nColumns - 1].Width += nDiff;
2633 /*-- 16.12.98 14:06:55---------------------------------------------------
2635 -----------------------------------------------------------------------*/
2636 uno::Sequence< TextColumn > SwXTextColumns::getColumns(void) throw( uno::RuntimeException )
2638 vos::OGuard aGuard(Application::GetSolarMutex());
2639 return aTextColumns;
2641 /*-- 16.12.98 14:06:56---------------------------------------------------
2643 -----------------------------------------------------------------------*/
2644 void SwXTextColumns::setColumns(const uno::Sequence< TextColumn >& rColumns)
2645 throw( uno::RuntimeException )
2647 vos::OGuard aGuard(Application::GetSolarMutex());
2648 sal_Int32 nReferenceTemp = 0;
2649 const TextColumn* prCols = rColumns.getConstArray();
2650 for(long i = 0; i < rColumns.getLength(); i++)
2652 nReferenceTemp += prCols[i].Width;
2654 bIsAutomaticWidth = sal_False;
2655 nReference = !nReferenceTemp ? USHRT_MAX : nReferenceTemp;
2656 aTextColumns = rColumns;
2658 /*-- 25.10.00 10:15:39---------------------------------------------------
2660 -----------------------------------------------------------------------*/
2661 uno::Reference< XPropertySetInfo > SwXTextColumns::getPropertySetInfo( ) throw(RuntimeException)
2663 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
2664 return aRef;
2666 /*-- 25.10.00 10:15:39---------------------------------------------------
2668 -----------------------------------------------------------------------*/
2669 void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
2670 throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException,
2671 WrappedTargetException, RuntimeException)
2673 const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
2674 if (!pEntry)
2675 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2676 if ( pEntry->nFlags & PropertyAttribute::READONLY)
2677 throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2679 switch(pEntry->nWID)
2681 case WID_TXTCOL_LINE_WIDTH:
2683 sal_Int32 nTmp = 0;
2684 aValue >>= nTmp;
2685 if(nTmp < 0)
2686 throw IllegalArgumentException();
2687 nSepLineWidth = MM100_TO_TWIP(nTmp);
2689 break;
2690 case WID_TXTCOL_LINE_COLOR:
2691 aValue >>= nSepLineColor;
2692 break;
2693 case WID_TXTCOL_LINE_REL_HGT:
2695 sal_Int8 nTmp = 0;
2696 aValue >>= nTmp;
2697 if(nTmp < 0)
2698 throw IllegalArgumentException();
2699 nSepLineHeightRelative = nTmp;
2701 break;
2702 case WID_TXTCOL_LINE_ALIGN:
2704 style::VerticalAlignment eAlign;
2705 if(!(aValue >>= eAlign) )
2707 sal_Int8 nTmp = 0;
2708 if (! ( aValue >>= nTmp ) )
2709 throw IllegalArgumentException();
2710 else
2711 nSepLineVertAlign = nTmp;
2713 else
2714 nSepLineVertAlign = static_cast< sal_Int8 >(eAlign);
2716 break;
2717 case WID_TXTCOL_LINE_IS_ON:
2718 bSepLineIsOn = *(sal_Bool*)aValue.getValue();
2719 break;
2720 case WID_TXTCOL_AUTO_DISTANCE:
2722 sal_Int32 nTmp = 0;
2723 aValue >>= nTmp;
2724 if(nTmp < 0 || nTmp >= nReference)
2725 throw IllegalArgumentException();
2726 nAutoDistance = nTmp;
2727 sal_Int32 nColumns = aTextColumns.getLength();
2728 TextColumn* pCols = aTextColumns.getArray();
2729 sal_Int32 nDist = nAutoDistance / 2;
2730 for(sal_Int32 i = 0; i < nColumns; i++)
2732 pCols[i].LeftMargin = i == 0 ? 0 : nDist;
2733 pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
2736 break;
2739 /*-- 25.10.00 10:15:40---------------------------------------------------
2741 -----------------------------------------------------------------------*/
2742 Any SwXTextColumns::getPropertyValue( const OUString& rPropertyName )
2743 throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
2745 const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
2746 if (!pEntry)
2747 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2749 Any aRet;
2750 switch(pEntry->nWID)
2752 case WID_TXTCOL_LINE_WIDTH:
2753 aRet <<= static_cast < sal_Int32 >(TWIP_TO_MM100(nSepLineWidth));
2754 break;
2755 case WID_TXTCOL_LINE_COLOR:
2756 aRet <<= nSepLineColor;
2757 break;
2758 case WID_TXTCOL_LINE_REL_HGT:
2759 aRet <<= nSepLineHeightRelative;
2760 break;
2761 case WID_TXTCOL_LINE_ALIGN:
2762 aRet <<= (style::VerticalAlignment)nSepLineVertAlign;
2763 break;
2764 case WID_TXTCOL_LINE_IS_ON:
2765 aRet.setValue(&bSepLineIsOn, ::getBooleanCppuType());
2766 break;
2767 case WID_TXTCOL_IS_AUTOMATIC :
2768 aRet.setValue(&bIsAutomaticWidth, ::getBooleanCppuType());
2769 break;
2770 case WID_TXTCOL_AUTO_DISTANCE:
2771 aRet <<= nAutoDistance;
2772 break;
2774 return aRet;
2776 /*-- 25.10.00 10:15:40---------------------------------------------------
2778 -----------------------------------------------------------------------*/
2779 void SwXTextColumns::addPropertyChangeListener(
2780 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
2781 throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
2784 /*-- 25.10.00 10:15:40---------------------------------------------------
2786 -----------------------------------------------------------------------*/
2787 void SwXTextColumns::removePropertyChangeListener(
2788 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
2789 throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
2792 /*-- 25.10.00 10:15:40---------------------------------------------------
2794 -----------------------------------------------------------------------*/
2795 void SwXTextColumns::addVetoableChangeListener(
2796 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
2797 throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
2800 /*-- 25.10.00 10:15:40---------------------------------------------------
2802 -----------------------------------------------------------------------*/
2803 void SwXTextColumns::removeVetoableChangeListener(
2804 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
2805 throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
2808 /* -----------------------------25.10.00 11:04--------------------------------
2810 ---------------------------------------------------------------------------*/
2811 const uno::Sequence< sal_Int8 > & SwXTextColumns::getUnoTunnelId()
2813 static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
2814 return aSeq;
2816 /* -----------------------------10.03.00 18:04--------------------------------
2818 ---------------------------------------------------------------------------*/
2819 sal_Int64 SAL_CALL SwXTextColumns::getSomething( const uno::Sequence< sal_Int8 >& rId )
2820 throw(uno::RuntimeException)
2822 if( rId.getLength() == 16
2823 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
2824 rId.getConstArray(), 16 ) )
2826 return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
2828 return 0;