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 $
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>
37 #include <hintids.hxx>
38 #include "poolfmt.hrc"
39 #include "poolfmt.hxx"
42 #include <unostyle.hxx>
43 #include <unosett.hxx>
44 #include <unoprnms.hxx>
45 #include <ftninfo.hxx>
47 #include <pagedesc.hxx>
48 #include <charfmt.hxx>
49 #include <lineinfo.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>
67 #include <com/sun/star/style/VerticalAlignment.hpp>
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>
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>
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
;
99 PropValData(void* pVal
, const char* cPropName
, uno::Type aType
) :
101 sPropName(OUString::createFromAscii(cPropName
))
103 PropValData(const uno::Any
& rVal
, const OUString
& rPropName
) :
109 typedef PropValData
* PropValDataPtr
;
110 SV_DECL_PTRARR(PropValDataArr
, PropValDataPtr
, 5, 5 )
111 SV_IMPL_PTRARR(PropValDataArr
, PropValDataPtr
)
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},
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},
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},
177 static SfxItemPropertySet
aNumberingRulesSet_Impl( aNumberingRulesMap_Impl
);
178 return &aNumberingRulesSet_Impl
;
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},
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
)
219 String
sStandard(SW_RES(STR_POOLCOLL_STANDARD
));
223 SwStyleNameMapper::FillUIName(uTmp
, sCharFmt
, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
, sal_True
);
224 if(sStandard
!= sCharFmt
)
226 pRet
= pDoc
->FindCharFmtByName( sCharFmt
);
230 sal_uInt16 nId
= SwStyleNameMapper::GetPoolIdFromUIName(sCharFmt
, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
);
232 pRet
= pDoc
->GetCharFmtFromPool( nId
);
236 /* -----------------05.05.98 08:30-------------------
238 * --------------------------------------------------*/
239 SwTxtFmtColl
* lcl_GetParaStyle(SwDoc
* pDoc
, const uno::Any
& aValue
)
244 SwStyleNameMapper::FillUIName(uTmp
, sParaStyle
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, sal_True
);
245 SwTxtFmtColl
* pRet
= pDoc
->FindTxtFmtCollByName( sParaStyle
);
248 sal_uInt16 nId
= SwStyleNameMapper::GetPoolIdFromUIName( sParaStyle
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
);
249 if( USHRT_MAX
!= nId
)
250 pRet
= pDoc
->GetTxtCollFromPool( nId
);
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();
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
)
269 if(rDesc
.GetName() == sPageDesc
)
271 pRet
= (SwPageDesc
*)&rDesc
;
277 sal_uInt16 nId
= SwStyleNameMapper::GetPoolIdFromUIName(sPageDesc
, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC
);
279 pRet
= pDoc
->GetPageDescFromPool( nId
);
283 /******************************************************************************
285 ******************************************************************************/
287 const unsigned short aSvxToUnoAdjust
[] =
289 text::HoriOrientation::LEFT
, //3
290 text::HoriOrientation::RIGHT
, //1
292 text::HoriOrientation::CENTER
, //2
297 const unsigned short aUnoToSvxAdjust
[] =
300 SVX_ADJUST_RIGHT
, // 1
301 SVX_ADJUST_CENTER
, // 3
302 SVX_ADJUST_LEFT
, // 0
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");
334 /*-- 14.12.98 14:03:20---------------------------------------------------
336 -----------------------------------------------------------------------*/
337 SwXFootnoteProperties::SwXFootnoteProperties(SwDoc
* 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();
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());
367 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropertySet
->getPropertyMap()->getByName( rPropertyName
);
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());
379 aFtnInfo
.SetPrefix(uTmp
);
386 aFtnInfo
.SetSuffix(uTmp
);
389 case WID_NUMBERING_TYPE
:
394 (nTmp
<= SVX_NUM_ARABIC
||
395 nTmp
> SVX_NUM_BITMAP
))
396 aFtnInfo
.aFmt
.SetNumberingType(nTmp
);
398 throw lang::IllegalArgumentException();
405 aFtnInfo
.nFtnOffset
= nTmp
;
408 case WID_FOOTNOTE_COUNTING
:
414 case FootnoteNumbering::PER_PAGE
:
415 aFtnInfo
.eNum
= FTNNUM_PAGE
;
417 case FootnoteNumbering::PER_CHAPTER
:
418 aFtnInfo
.eNum
= FTNNUM_CHAPTER
;
420 case FootnoteNumbering::PER_DOCUMENT
:
421 aFtnInfo
.eNum
= FTNNUM_DOC
;
426 case WID_PARAGRAPH_STYLE
:
428 SwTxtFmtColl
* pColl
= lcl_GetParaStyle(pDoc
, aValue
);
430 aFtnInfo
.SetFtnTxtColl(*pColl
);
433 case WID_PAGE_STYLE
:
435 SwPageDesc
* pDesc
= lcl_GetPageDesc(pDoc
, aValue
);
437 aFtnInfo
.ChgPageDesc( pDesc
);
440 case WID_ANCHOR_CHARACTER_STYLE
:
441 case WID_CHARACTER_STYLE
:
443 SwCharFmt
* pFmt
= lcl_getCharFmt(pDoc
, aValue
);
446 if(pEntry
->nWID
== WID_ANCHOR_CHARACTER_STYLE
)
447 aFtnInfo
.SetAnchorCharFmt(pFmt
);
449 aFtnInfo
.SetCharFmt(pFmt
);
453 case WID_POSITION_END_OF_DOC
:
455 sal_Bool bVal
= *(sal_Bool
*)aValue
.getValue();
456 aFtnInfo
.ePos
= bVal
? FTNPOS_CHAPTER
: FTNPOS_PAGE
;
459 case WID_END_NOTICE
:
463 aFtnInfo
.aQuoVadis
= String(uTmp
);
466 case WID_BEGIN_NOTICE
:
470 aFtnInfo
.aErgoSum
= String(uTmp
);
474 pDoc
->SetFtnInfo(aFtnInfo
);
477 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
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());
492 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropertySet
->getPropertyMap()->getByName( rPropertyName
);
495 const SwFtnInfo
& rFtnInfo
= pDoc
->GetFtnInfo();
500 aRet
<<= OUString(rFtnInfo
.GetPrefix());
505 aRet
<<= OUString(rFtnInfo
.GetSuffix());
508 case WID_NUMBERING_TYPE
:
510 aRet
<<= rFtnInfo
.aFmt
.GetNumberingType();
514 aRet
<<= (sal_Int16
)rFtnInfo
.nFtnOffset
;
516 case WID_FOOTNOTE_COUNTING
:
519 switch(rFtnInfo
.eNum
)
522 nRet
= FootnoteNumbering::PER_PAGE
;
525 nRet
= FootnoteNumbering::PER_CHAPTER
;
528 nRet
= FootnoteNumbering::PER_DOCUMENT
;
534 case WID_PARAGRAPH_STYLE
:
536 SwTxtFmtColl
* pColl
= rFtnInfo
.GetFtnTxtColl();
539 aString
= String ( pColl
->GetName() );
540 SwStyleNameMapper::FillProgName(aString
, aString
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, sal_True
);
541 aRet
<<= OUString ( aString
);
544 case WID_PAGE_STYLE
:
547 if( rFtnInfo
.GetPageDescDep()->GetRegisteredIn() )
549 SwStyleNameMapper::FillProgName(
550 rFtnInfo
.GetPageDesc( *pDoc
)->GetName(),
552 nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC
,
555 aRet
<<= OUString ( aString
);
558 case WID_ANCHOR_CHARACTER_STYLE
:
559 case WID_CHARACTER_STYLE
:
562 const SwCharFmt
* pCharFmt
= 0;
563 if( pEntry
->nWID
== WID_ANCHOR_CHARACTER_STYLE
)
565 if( rFtnInfo
.GetAnchorCharFmtDep()->GetRegisteredIn() )
566 pCharFmt
= rFtnInfo
.GetAnchorCharFmt(*pDoc
);
570 if( rFtnInfo
.GetCharFmtDep()->GetRegisteredIn() )
571 pCharFmt
= rFtnInfo
.GetCharFmt(*pDoc
);
575 SwStyleNameMapper::FillProgName(
578 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
,
581 aRet
<<= OUString ( aString
);
584 case WID_POSITION_END_OF_DOC
:
586 sal_Bool bTemp
= FTNPOS_CHAPTER
== rFtnInfo
.ePos
;
587 aRet
.setValue(&bTemp
, ::getCppuBooleanType());
590 case WID_END_NOTICE
:
591 aRet
<<= OUString(rFtnInfo
.aQuoVadis
);
593 case WID_BEGIN_NOTICE
:
594 aRet
<<= OUString(rFtnInfo
.aErgoSum
);
599 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
602 throw uno::RuntimeException();
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");
669 /*-- 14.12.98 14:27:39---------------------------------------------------
671 -----------------------------------------------------------------------*/
672 SwXEndnoteProperties::SwXEndnoteProperties(SwDoc
* 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();
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());
703 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropertySet
->getPropertyMap()->getByName( rPropertyName
);
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());
715 aEndInfo
.SetPrefix(uTmp
);
722 aEndInfo
.SetSuffix(uTmp
);
725 case WID_NUMBERING_TYPE
:
729 aEndInfo
.aFmt
.SetNumberingType(nTmp
);
736 aEndInfo
.nFtnOffset
= nTmp
;
739 case WID_PARAGRAPH_STYLE
:
741 SwTxtFmtColl
* pColl
= lcl_GetParaStyle(pDoc
, aValue
);
743 aEndInfo
.SetFtnTxtColl(*pColl
);
746 case WID_PAGE_STYLE
:
748 SwPageDesc
* pDesc
= lcl_GetPageDesc(pDoc
, aValue
);
750 aEndInfo
.ChgPageDesc( pDesc
);
753 case WID_ANCHOR_CHARACTER_STYLE
:
754 case WID_CHARACTER_STYLE
:
756 SwCharFmt
* pFmt
= lcl_getCharFmt(pDoc
, aValue
);
759 if(pEntry
->nWID
== WID_ANCHOR_CHARACTER_STYLE
)
760 aEndInfo
.SetAnchorCharFmt(pFmt
);
762 aEndInfo
.SetCharFmt(pFmt
);
767 pDoc
->SetEndNoteInfo(aEndInfo
);
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());
783 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropertySet
->getPropertyMap()->getByName( rPropertyName
);
786 const SwEndNoteInfo
& rEndInfo
= pDoc
->GetEndNoteInfo();
790 aRet
<<= OUString(rEndInfo
.GetPrefix());
793 aRet
<<= OUString(rEndInfo
.GetSuffix());
795 case WID_NUMBERING_TYPE
:
796 aRet
<<= rEndInfo
.aFmt
.GetNumberingType();
799 aRet
<<= (sal_Int16
)rEndInfo
.nFtnOffset
;
801 case WID_PARAGRAPH_STYLE
:
803 SwTxtFmtColl
* pColl
= rEndInfo
.GetFtnTxtColl();
806 aString
= pColl
->GetName();
807 SwStyleNameMapper::FillProgName(
810 nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
,
812 aRet
<<= OUString ( aString
);
816 case WID_PAGE_STYLE
:
819 if( rEndInfo
.GetPageDescDep()->GetRegisteredIn() )
821 SwStyleNameMapper::FillProgName(
822 rEndInfo
.GetPageDesc( *pDoc
)->GetName(),
824 nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC
,
827 aRet
<<= OUString ( aString
);
830 case WID_ANCHOR_CHARACTER_STYLE
:
831 case WID_CHARACTER_STYLE
:
834 const SwCharFmt
* pCharFmt
= 0;
835 if( pEntry
->nWID
== WID_ANCHOR_CHARACTER_STYLE
)
837 if( rEndInfo
.GetAnchorCharFmtDep()->GetRegisteredIn() )
838 pCharFmt
= rEndInfo
.GetAnchorCharFmt(*pDoc
);
842 if( rEndInfo
.GetCharFmtDep()->GetRegisteredIn() )
843 pCharFmt
= rEndInfo
.GetCharFmt(*pDoc
);
847 SwStyleNameMapper::FillProgName(
850 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
,
853 aRet
<<= OUString ( aString
);
859 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
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");
924 /*-- 14.12.98 14:33:36---------------------------------------------------
926 -----------------------------------------------------------------------*/
927 SwXLineNumberingProperties::SwXLineNumberingProperties(SwDoc
* 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();
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());
959 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropertySet
->getPropertyMap()->getByName( rPropertyName
);
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());
969 sal_Bool bVal
= *(sal_Bool
*)aValue
.getValue();
970 aInfo
.SetPaintLineNumbers(bVal
);
973 case WID_CHARACTER_STYLE
:
975 SwCharFmt
* pFmt
= lcl_getCharFmt(pDoc
, aValue
);
977 aInfo
.SetCharFmt(pFmt
);
980 case WID_NUMBERING_TYPE
:
982 SvxNumberType
aNumType(aInfo
.GetNumType());
985 aNumType
.SetNumberingType(nTmp
);
986 aInfo
.SetNumType(aNumType
);
989 case WID_NUMBER_POSITION
:
995 case style::LineNumberPosition::LEFT
:
996 aInfo
.SetPos(LINENUMBER_POS_LEFT
); ;
998 case style::LineNumberPosition::RIGHT
:
999 aInfo
.SetPos(LINENUMBER_POS_RIGHT
); ;
1001 case style::LineNumberPosition::INSIDE
:
1002 aInfo
.SetPos(LINENUMBER_POS_INSIDE
); ;
1004 case style::LineNumberPosition::OUTSIDE
:
1005 aInfo
.SetPos(LINENUMBER_POS_OUTSIDE
);
1014 INT32 nTmp
= MM100_TO_TWIP(nVal
);
1015 if (nTmp
> USHRT_MAX
)
1017 aInfo
.SetPosFromLeft( static_cast< USHORT
>(nTmp
) );
1025 aInfo
.SetCountBy(nTmp
);
1028 case WID_SEPARATOR_TEXT
:
1032 aInfo
.SetDivider(uTmp
);
1035 case WID_SEPARATOR_INTERVAL
:
1040 aInfo
.SetDividerCountBy(nTmp
);
1043 case WID_COUNT_EMPTY_LINES
:
1045 sal_Bool bVal
= *(sal_Bool
*)aValue
.getValue();
1046 aInfo
.SetCountBlankLines(bVal
);
1049 case WID_COUNT_LINES_IN_FRAMES
:
1051 sal_Bool bVal
= *(sal_Bool
*)aValue
.getValue();
1052 aInfo
.SetCountInFlys(bVal
);
1055 case WID_RESTART_AT_EACH_PAGE
:
1057 sal_Bool bVal
= *(sal_Bool
*)aValue
.getValue();
1058 aInfo
.SetRestartEachPage(bVal
);
1062 pDoc
->SetLineNumberInfo(aInfo
);
1065 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
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());
1080 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropertySet
->getPropertyMap()->getByName( rPropertyName
);
1083 const SwLineNumberInfo
& rInfo
= pDoc
->GetLineNumberInfo();
1084 switch(pEntry
->nWID
)
1088 sal_Bool bTemp
= rInfo
.IsPaintLineNumbers();
1089 aRet
.setValue(&bTemp
, ::getCppuBooleanType());
1092 case WID_CHARACTER_STYLE
:
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(),
1102 nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
,
1105 aRet
<<= OUString ( aString
);
1108 case WID_NUMBERING_TYPE
:
1109 aRet
<<= rInfo
.GetNumType().GetNumberingType();
1111 case WID_NUMBER_POSITION
:
1114 switch(rInfo
.GetPos())
1116 case LINENUMBER_POS_LEFT
:
1117 nRet
= style::LineNumberPosition::LEFT
;
1119 case LINENUMBER_POS_RIGHT
:
1120 nRet
= style::LineNumberPosition::RIGHT
;
1122 case LINENUMBER_POS_INSIDE
:
1123 nRet
= style::LineNumberPosition::INSIDE
;
1125 case LINENUMBER_POS_OUTSIDE
:
1126 nRet
= style::LineNumberPosition::OUTSIDE
;
1134 sal_uInt32 nPos
= rInfo
.GetPosFromLeft();
1135 if(USHRT_MAX
== nPos
)
1137 aRet
<<= static_cast < sal_Int32
>(TWIP_TO_MM100_UNSIGNED(nPos
));
1141 aRet
<<= (sal_Int16
)rInfo
.GetCountBy();
1143 case WID_SEPARATOR_TEXT
:
1144 aRet
<<= OUString(rInfo
.GetDivider());
1146 case WID_SEPARATOR_INTERVAL
:
1147 aRet
<<= (sal_Int16
)rInfo
.GetDividerCountBy();
1149 case WID_COUNT_EMPTY_LINES
:
1151 sal_Bool bTemp
= rInfo
.IsCountBlankLines();
1152 aRet
.setValue(&bTemp
, ::getCppuBooleanType());
1155 case WID_COUNT_LINES_IN_FRAMES
:
1157 sal_Bool bTemp
= rInfo
.IsCountInFlys();
1158 aRet
.setValue(&bTemp
, ::getCppuBooleanType());
1161 case WID_RESTART_AT_EACH_PAGE
:
1163 sal_Bool bTemp
= rInfo
.IsRestartEachPage();
1164 aRet
.setValue(&bTemp
, ::getCppuBooleanType());
1170 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
1173 throw uno::RuntimeException();
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 /******************************************************************
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();
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) );
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");
1262 /*-- 14.12.98 14:57:57---------------------------------------------------
1264 -----------------------------------------------------------------------*/
1265 SwXNumberingRules::SwXNumberingRules(const SwNumRule
& rRule
) :
1268 pNumRule(new SwNumRule(rRule
)),
1269 m_pPropertySet(GetNumberingRulesSet()),
1270 bOwnNumRuleCreated(TRUE
)
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();
1282 pDoc
= pCharFmt
->GetDoc();
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
) :
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
) :
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
1321 // --> OD 2008-02-11 #newlistlevelattrs#
1322 rDoc
.MakeNumRule( sCreatedNumRuleName
, 0, FALSE
,
1323 // --> OD 2008-06-06 #i89178#
1324 numfunc::GetDefaultPositionAndSpaceMode() );
1327 #if OSL_DEBUG_LEVEL > 1
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
)
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;
1359 SwXNumberingRules::SetNumberingRuleByIndex( *pNumRule
,
1360 rProperties
, nIndex
);
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()) );
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
])
1394 SfxStyleSheetBase
* pBase
;
1395 pBase
= pDocShell
->GetStyleSheetPool()->Find(sNewCharStyleNames
[i
],
1396 SFX_STYLE_FAMILY_CHAR
);
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
);
1417 throw uno::RuntimeException();
1420 /*-- 14.12.98 14:57:58---------------------------------------------------
1422 -----------------------------------------------------------------------*/
1423 sal_Int32
SwXNumberingRules::getCount(void) throw( uno::RuntimeException
)
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();
1439 const SwNumRule
* pRule
= pNumRule
;
1440 if(!pRule
&& pDoc
&& sCreatedNumRuleName
.Len())
1441 pRule
= pDoc
->FindNumRulePtr( sCreatedNumRuleName
);
1444 uno::Sequence
<beans::PropertyValue
> aRet
= GetNumberingRuleByIndex(
1446 aVal
.setValue(&aRet
, ::getCppuType((uno::Sequence
<beans::PropertyValue
>*)0));
1451 uno::Sequence
<beans::PropertyValue
> aRet
= GetNumberingRuleByIndex(
1452 *pDocShell
->GetDoc()->GetOutlineNumRule(), nIndex
);
1453 aVal
.setValue(&aRet
, ::getCppuType((uno::Sequence
<beans::PropertyValue
>*)0));
1456 throw uno::RuntimeException();
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
)
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
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());
1497 nINT16
= rFmt
.GetIncludeUpperLevels();
1498 pData
= new PropValData((void*)&nINT16
, "ParentNumbering", ::getCppuType((const sal_Int16
*)0));
1499 aPropertyValues
.Insert(pData
, aPropertyValues
.Count());
1502 OUString aUString
= rFmt
.GetPrefix();
1503 pData
= new PropValData((void*)&aUString
, "Prefix", ::getCppuType((const OUString
*)0));
1504 aPropertyValues
.Insert(pData
, aPropertyValues
.Count());
1507 aUString
= rFmt
.GetSuffix();
1508 pData
= new PropValData((void*)&aUString
, "Suffix", ::getCppuType((const OUString
*)0));
1509 aPropertyValues
.Insert(pData
, aPropertyValues
.Count());
1512 SwCharFmt
* pCharFmt
= rFmt
.GetCharFmt();
1513 String CharStyleName
;
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
];
1522 SwStyleNameMapper::FillProgName( CharStyleName
, aString
, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
, sal_True
);
1524 pData
= new PropValData((void*)&aUString
, "CharStyleName", ::getCppuType((const OUString
*)0));
1525 aPropertyValues
.Insert(pData
, aPropertyValues
.Count());
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
)
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());
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());
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());
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
)
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());
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());
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());
1605 nINT16
= rFmt
.GetNumberingType();
1606 pData
= new PropValData((void*)&nINT16
, "NumberingType", ::getCppuType((const sal_Int16
*)0));
1607 aPropertyValues
.Insert(pData
, aPropertyValues
.Count());
1611 if(SVX_NUM_CHAR_SPECIAL
== rFmt
.GetNumberingType())
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();
1621 aUString
= OUString(rFmt
.GetBulletChar());
1622 pData
= new PropValData((void*)&aUString
, "BulletChar", ::getCppuType((const OUString
*)0));
1623 aPropertyValues
.Insert(pData
, aPropertyValues
.Count());
1626 String sBulletFontName
;
1628 sBulletFontName
= pFont
->GetStyleName();
1629 aUString
= sBulletFontName
;
1630 pData
= new PropValData((void*)&aUString
, "BulletFontName", ::getCppuType((const OUString
*)0));
1631 aPropertyValues
.Insert(pData
, aPropertyValues
.Count());
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())
1645 const SvxBrushItem
* pBrush
= rFmt
.GetBrush();
1649 pBrush
->QueryValue( aAny
, MID_GRAPHIC_URL
);
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());
1658 const Graphic
* pGraphic
= 0;
1660 pGraphic
= pBrush
->GetGraphic();
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();
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());
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())
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.
1713 SwStyleNameMapper::FillProgName(sValue
, aName
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, sal_True
);
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());
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
)
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
[] =
1761 "ParentNumbering", //1
1764 "CharStyleName", //4
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
1776 "NumberingType", //14
1778 SW_PROP_NAME_STR(UNO_NAME_BULLET_FONT
), //16
1779 "BulletFontName", //17
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;
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
];
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
;
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
;
1824 SvxBrushItem
* pSetBrush
= 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
);
1838 sal_Int16 nValue
= 0;
1839 pData
->aVal
>>= nValue
;
1841 nValue
<= text::HoriOrientation::LEFT
&&
1842 USHRT_MAX
!= aUnoToSvxAdjust
[nValue
])
1844 aFmt
.SetNumAdjust((SvxAdjust
)aUnoToSvxAdjust
[nValue
]);
1847 bWrongArg
= sal_True
;
1850 case 1: //"ParentNumbering",
1853 pData
->aVal
>>= nSet
;
1854 if(nSet
>= 0 && MAXLEVEL
>= nSet
)
1855 aFmt
.SetIncludeUpperLevels( static_cast< BYTE
>(nSet
) );
1861 pData
->aVal
>>= uTmp
;
1862 aFmt
.SetPrefix(uTmp
);
1868 pData
->aVal
>>= uTmp
;
1869 aFmt
.SetSuffix(uTmp
);
1872 case 4: //"CharStyleName",
1874 bCharStyleNameSet
= TRUE
;
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();
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
)
1905 SfxStyleSheetBase
* pBase
;
1906 SfxStyleSheetBasePool
* pPool
= pLocalDoc
->GetDocShell()->GetStyleSheetPool();
1907 pBase
= ((SfxStyleSheetBasePool
*)pPool
)->Find(sCharFmtName
, SFX_STYLE_FAMILY_CHAR
);
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();
1921 sNewCharStyleNames
[(sal_uInt16
)nIndex
] = sCharFmtName
;
1924 case 5: //"StartWith",
1927 pData
->aVal
>>= nVal
;
1928 aFmt
.SetStart(nVal
);
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
));
1939 case 7: //UNO_NAME_SYMBOL_TEXT_DISTANCE,
1941 sal_Int32 nValue
= 0;
1942 pData
->aVal
>>= nValue
;
1944 aFmt
.SetCharTextDistance((sal_uInt16
) MM100_TO_TWIP(nValue
));
1946 bWrongArg
= sal_True
;
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
);
1958 // --> OD 2008-01-15 #newlistlevelattrs#
1959 case 9: // UNO_NAME_POSITION_AND_SPACE_MODE
1961 sal_Int16 nValue
= 0;
1962 pData
->aVal
>>= nValue
;
1965 aFmt
.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_WIDTH_AND_POSITION
);
1967 else if ( nValue
== 1 )
1969 aFmt
.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT
);
1973 bWrongArg
= sal_True
;
1977 case 10: // UNO_NAME_LABEL_FOLLOWED_BY
1979 sal_Int16 nValue
= 0;
1980 pData
->aVal
>>= nValue
;
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
);
1995 bWrongArg
= sal_True
;
1999 case 11: // UNO_NAME_LISTTAB_STOP_POSITION
2001 sal_Int32 nValue
= 0;
2002 pData
->aVal
>>= nValue
;
2003 nValue
= MM100_TO_TWIP(nValue
);
2006 aFmt
.SetListtabPos( nValue
);
2010 bWrongArg
= sal_True
;
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
);
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
);
2031 case 14: //"NumberingType"
2034 pData
->aVal
>>= nSet
;
2036 aFmt
.SetNumberingType(nSet
);
2038 bWrongArg
= sal_True
;
2041 case 15: //"BulletId",
2044 if( pData
->aVal
>>= nSet
)
2045 aFmt
.SetBulletChar(nSet
);
2047 bWrongArg
= sal_True
;
2050 case 16: //UNO_NAME_BULLET_FONT,
2052 awt::FontDescriptor
* pDesc
= (awt::FontDescriptor
*)pData
->aVal
.getValue();
2055 // --> OD 2008-09-11 #i93725#
2056 // do not accept "empty" font
2057 if ( pDesc
->Name
.getLength() > 0 )
2060 SvxUnoFontDescriptor::ConvertToFont( *pDesc
, aFont
);
2061 aFmt
.SetBulletFont(&aFont
);
2066 bWrongArg
= sal_True
;
2069 case 17: //"BulletFontName",
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
);
2084 aFmt
.SetBulletFont(&aFont
);
2087 sNewBulletFontNames
[(sal_uInt16
)nIndex
] = sBulletFontName
;
2090 case 18: //"BulletChar",
2093 pData
->aVal
>>= aChar
;
2094 if(aChar
.getLength() == 1)
2096 aFmt
.SetBulletChar(aChar
.toChar());
2099 bWrongArg
= sal_True
;
2102 case 19: //UNO_NAME_GRAPHIC_URL,
2105 pData
->aVal
>>= sBrushURL
;
2108 const SvxBrushItem
* pOrigBrush
= aFmt
.GetBrush();
2111 pSetBrush
= new SvxBrushItem(*pOrigBrush
);
2114 pSetBrush
= new SvxBrushItem(aEmptyStr
, aEmptyStr
, GPOS_AREA
, RES_BACKGROUND
);
2116 pSetBrush
->PutValue( pData
->aVal
, MID_GRAPHIC_URL
);
2119 case 20: //UNO_NAME_GRAPHIC_BITMAP,
2121 uno::Reference
< awt::XBitmap
>* pBitmap
= (uno::Reference
< awt::XBitmap
> *)pData
->aVal
.getValue();
2126 const SvxBrushItem
* pOrigBrush
= aFmt
.GetBrush();
2129 pSetBrush
= new SvxBrushItem(*pOrigBrush
);
2132 pSetBrush
= new SvxBrushItem(aEmptyStr
, aEmptyStr
, GPOS_AREA
, RES_BACKGROUND
);
2135 BitmapEx aBmp
= VCLUnoHelper::GetBitmap( *pBitmap
);
2136 Graphic
aNewGr(aBmp
);
2137 pSetBrush
->SetGraphic( aNewGr
);
2140 bWrongArg
= sal_True
;
2143 case 21: //UNO_NAME_GRAPHIC_SIZE,
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
;
2156 bWrongArg
= sal_True
;
2159 case 22: //VertOrient
2163 if(aFmt
.GetGraphicOrientation())
2164 pSetVOrient
= (SwFmtVertOrient
*)aFmt
.GetGraphicOrientation()->Clone();
2166 pSetVOrient
= new SwFmtVertOrient
;
2168 ((SfxPoolItem
*)pSetVOrient
)->PutValue(pData
->aVal
, MID_VERTORIENT_ORIENT
);
2171 case 23: //"HeadingStyleName"
2174 pData
->aVal
>>= uTmp
;
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())
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,
2202 case 24: // BulletRelSize - unsupported - only available in Impress
2206 if(!bExcept
&& !bWrongArg
&& (pSetBrush
|| pSetSize
|| pSetVOrient
))
2208 if(!pSetBrush
&& aFmt
.GetBrush())
2209 pSetBrush
= new SvxBrushItem(*aFmt
.GetBrush());
2213 if(!pSetVOrient
&& aFmt
.GetGraphicOrientation())
2214 pSetVOrient
= new SwFmtVertOrient(*aFmt
.GetGraphicOrientation());
2218 pSetSize
= new Size(aFmt
.GetGraphicSize());
2219 if(!pSetSize
->Width() || !pSetSize
->Height())
2221 const Graphic
* pGraphic
= pSetBrush
->GetGraphic();
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
] );
2241 aPropertyValues
.DeleteAndDestroy(0, aPropertyValues
.Count());
2244 throw lang::IllegalArgumentException();
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();
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
)
2267 SwNumRule
* pDocRule
= 0;
2268 SwNumRule
* pCreatedRule
= 0;
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();
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
)))
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
)))
2319 throw IllegalArgumentException();
2323 throw UnknownPropertyException();
2327 pDocShell
->GetDoc()->SetOutlineNumRule(*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
)
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
);
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());
2381 throw UnknownPropertyException();
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
)
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
);
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");
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
)
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");
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 /******************************************************************
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");
2529 /* -----------------------------24.10.00 16:45--------------------------------
2531 ---------------------------------------------------------------------------*/
2532 SwXTextColumns::SwXTextColumns(sal_uInt16 nColCount
) :
2534 bIsAutomaticWidth(sal_True
),
2536 m_pPropSet(aSwMapProvider
.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS
)),
2538 nSepLineColor(0), //black
2539 nSepLineHeightRelative(100),//full height
2540 nSepLineVertAlign(style::VerticalAlignment_MIDDLE
),
2541 bSepLineIsOn(sal_False
)
2544 setColumnCount(nColCount
);
2546 /*-- 16.12.98 14:06:53---------------------------------------------------
2548 -----------------------------------------------------------------------*/
2549 SwXTextColumns::SwXTextColumns(const SwFmtCol
& rFmtCol
) :
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
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;
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());
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());
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();
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
);
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
:
2686 throw IllegalArgumentException();
2687 nSepLineWidth
= MM100_TO_TWIP(nTmp
);
2690 case WID_TXTCOL_LINE_COLOR
:
2691 aValue
>>= nSepLineColor
;
2693 case WID_TXTCOL_LINE_REL_HGT
:
2698 throw IllegalArgumentException();
2699 nSepLineHeightRelative
= nTmp
;
2702 case WID_TXTCOL_LINE_ALIGN
:
2704 style::VerticalAlignment eAlign
;
2705 if(!(aValue
>>= eAlign
) )
2708 if (! ( aValue
>>= nTmp
) )
2709 throw IllegalArgumentException();
2711 nSepLineVertAlign
= nTmp
;
2714 nSepLineVertAlign
= static_cast< sal_Int8
>(eAlign
);
2717 case WID_TXTCOL_LINE_IS_ON
:
2718 bSepLineIsOn
= *(sal_Bool
*)aValue
.getValue();
2720 case WID_TXTCOL_AUTO_DISTANCE
:
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
;
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
);
2747 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( this ) );
2750 switch(pEntry
->nWID
)
2752 case WID_TXTCOL_LINE_WIDTH
:
2753 aRet
<<= static_cast < sal_Int32
>(TWIP_TO_MM100(nSepLineWidth
));
2755 case WID_TXTCOL_LINE_COLOR
:
2756 aRet
<<= nSepLineColor
;
2758 case WID_TXTCOL_LINE_REL_HGT
:
2759 aRet
<<= nSepLineHeightRelative
;
2761 case WID_TXTCOL_LINE_ALIGN
:
2762 aRet
<<= (style::VerticalAlignment
)nSepLineVertAlign
;
2764 case WID_TXTCOL_LINE_IS_ON
:
2765 aRet
.setValue(&bSepLineIsOn
, ::getBooleanCppuType());
2767 case WID_TXTCOL_IS_AUTOMATIC
:
2768 aRet
.setValue(&bIsAutomaticWidth
, ::getBooleanCppuType());
2770 case WID_TXTCOL_AUTO_DISTANCE
:
2771 aRet
<<= nAutoDistance
;
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();
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) );