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