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