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