tdf#94628: sw: allow setting for bullet for outline paragraphs
[LibreOffice.git] / sw / source / core / unocore / unosett.cxx
blob8f0d95005a2af5bdad359c2219dab9b42673e7f1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svx/svxids.hrc>
21 #include <editeng/memberids.h>
22 #include <swtypes.hxx>
23 #include <cmdid.h>
24 #include <unomid.h>
25 #include <hintids.hxx>
26 #include <strings.hrc>
27 #include <poolfmt.hxx>
28 #include <fmtcol.hxx>
29 #include <unomap.hxx>
30 #include <unostyle.hxx>
31 #include <unosett.hxx>
32 #include <unoprnms.hxx>
33 #include <ftninfo.hxx>
34 #include <doc.hxx>
35 #include <pagedesc.hxx>
36 #include <IDocumentStylePoolAccess.hxx>
37 #include <charfmt.hxx>
38 #include <lineinfo.hxx>
39 #include <docsh.hxx>
40 #include <docary.hxx>
41 #include <docstyle.hxx>
42 #include <fmtclds.hxx>
43 #include <editeng/brushitem.hxx>
44 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
45 #include <com/sun/star/text/XFootnotesSettingsSupplier.hpp>
46 #include <com/sun/star/text/XFootnote.hpp>
47 #include <com/sun/star/text/XFootnotesSupplier.hpp>
48 #include <com/sun/star/text/XEndnotesSupplier.hpp>
49 #include <com/sun/star/text/XEndnotesSettingsSupplier.hpp>
50 #include <com/sun/star/text/FootnoteNumbering.hpp>
51 #include <com/sun/star/text/HoriOrientation.hpp>
52 #include <com/sun/star/style/LineNumberPosition.hpp>
53 #include <com/sun/star/awt/FontDescriptor.hpp>
54 #include <com/sun/star/awt/XBitmap.hpp>
55 #include <com/sun/star/graphic/XGraphic.hpp>
56 #include <com/sun/star/beans/PropertyAttribute.hpp>
57 #include <com/sun/star/style/VerticalAlignment.hpp>
58 #include <o3tl/any.hxx>
59 #include <o3tl/enumarray.hxx>
60 #include <vcl/font.hxx>
61 #include <editeng/flstitem.hxx>
62 #include <vcl/metric.hxx>
63 #include <vcl/graph.hxx>
64 #include <vcl/GraphicLoader.hxx>
65 #include <sfx2/docfile.hxx>
66 #include <svtools/ctrltool.hxx>
67 #include <vcl/svapp.hxx>
68 #include <editeng/unofdesc.hxx>
69 #include <fmtornt.hxx>
70 #include <SwStyleNameMapper.hxx>
71 #include <com/sun/star/text/PositionAndSpaceMode.hpp>
72 #include <com/sun/star/text/LabelFollow.hpp>
73 #include <numrule.hxx>
74 #include <comphelper/servicehelper.hxx>
75 #include <comphelper/sequence.hxx>
76 #include <cppuhelper/supportsservice.hxx>
77 #include <comphelper/propertyvalue.hxx>
78 #include <svl/itemprop.hxx>
79 #include <svl/listener.hxx>
80 #include <paratr.hxx>
81 #include <sal/log.hxx>
82 #include <numeric>
84 using namespace ::com::sun::star;
85 using namespace ::com::sun::star::uno;
86 using namespace ::com::sun::star::lang;
87 using namespace ::com::sun::star::beans;
88 using namespace ::com::sun::star::text;
89 using namespace ::com::sun::star::style;
92 namespace
94 SvtBroadcaster& GetPageDescNotifier(SwDoc* pDoc)
96 return pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->GetNotifier();
99 // Constants for the css::text::ColumnSeparatorStyle
100 #define API_COL_LINE_NONE 0
101 #define API_COL_LINE_SOLID 1
102 #define API_COL_LINE_DOTTED 2
103 #define API_COL_LINE_DASHED 3
105 #define WID_PREFIX 0
106 #define WID_SUFFIX 1
107 #define WID_NUMBERING_TYPE 2
108 #define WID_START_AT 3
109 #define WID_FOOTNOTE_COUNTING 4
110 #define WID_PARAGRAPH_STYLE 5
111 #define WID_PAGE_STYLE 6
112 #define WID_CHARACTER_STYLE 7
113 #define WID_POSITION_END_OF_DOC 8
114 #define WID_END_NOTICE 9
115 #define WID_BEGIN_NOTICE 10
116 #define WID_ANCHOR_CHARACTER_STYLE 11
118 static const SfxItemPropertySet* GetFootnoteSet()
120 static const SfxItemPropertyMapEntry aFootnoteMap_Impl[] =
122 { OUString(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
123 { OUString(UNO_NAME_BEGIN_NOTICE), WID_BEGIN_NOTICE, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
124 { OUString(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
125 { OUString(UNO_NAME_END_NOTICE), WID_END_NOTICE , ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
126 { OUString(UNO_NAME_FOOTNOTE_COUNTING), WID_FOOTNOTE_COUNTING, ::cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0},
127 { OUString(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE, ::cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0},
128 { OUString(UNO_NAME_PAGE_STYLE_NAME), WID_PAGE_STYLE, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
129 { OUString(UNO_NAME_PARA_STYLE_NAME), WID_PARAGRAPH_STYLE, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
130 { OUString(UNO_NAME_POSITION_END_OF_DOC), WID_POSITION_END_OF_DOC,cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
131 { OUString(UNO_NAME_PREFIX), WID_PREFIX, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
132 { OUString(UNO_NAME_START_AT), WID_START_AT , ::cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0},
133 { OUString(UNO_NAME_SUFFIX), WID_SUFFIX, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
134 { OUString(), 0, css::uno::Type(), 0, 0 }
136 static const SfxItemPropertySet aFootnoteSet_Impl(aFootnoteMap_Impl);
137 return &aFootnoteSet_Impl;
140 static const SfxItemPropertySet* GetEndnoteSet()
142 static const SfxItemPropertyMapEntry aEndnoteMap_Impl[] =
144 { OUString(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
145 { OUString(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
146 { OUString(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE, ::cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0},
147 { OUString(UNO_NAME_PAGE_STYLE_NAME), WID_PAGE_STYLE, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
148 { OUString(UNO_NAME_PARA_STYLE_NAME), WID_PARAGRAPH_STYLE, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
149 { OUString(UNO_NAME_PREFIX), WID_PREFIX, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
150 { OUString(UNO_NAME_START_AT), WID_START_AT , ::cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0},
151 { OUString(UNO_NAME_SUFFIX), WID_SUFFIX, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
152 { OUString(), 0, css::uno::Type(), 0, 0 }
154 static const SfxItemPropertySet aEndnoteSet_Impl(aEndnoteMap_Impl);
155 return &aEndnoteSet_Impl;
158 static const SfxItemPropertySet* GetNumberingRulesSet()
160 static const SfxItemPropertyMapEntry aNumberingRulesMap_Impl[] =
162 { OUString(UNO_NAME_IS_ABSOLUTE_MARGINS), WID_IS_ABS_MARGINS, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
163 { OUString(UNO_NAME_IS_AUTOMATIC), WID_IS_AUTOMATIC, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
164 { OUString(UNO_NAME_IS_CONTINUOUS_NUMBERING), WID_CONTINUOUS, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
165 { OUString(UNO_NAME_NAME), WID_RULE_NAME , ::cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY, 0},
166 { OUString(UNO_NAME_NUMBERING_IS_OUTLINE), WID_IS_OUTLINE, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
167 { OUString(UNO_NAME_DEFAULT_LIST_ID), WID_DEFAULT_LIST_ID, ::cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY, 0},
168 { OUString(), 0, css::uno::Type(), 0, 0 }
170 static const SfxItemPropertySet aNumberingRulesSet_Impl( aNumberingRulesMap_Impl );
171 return &aNumberingRulesSet_Impl;
174 #define WID_NUM_ON 0
175 #define WID_SEPARATOR_INTERVAL 1
176 #define WID_NUMBERING_TYPE 2
177 #define WID_NUMBER_POSITION 3
178 #define WID_DISTANCE 4
179 #define WID_INTERVAL 5
180 #define WID_SEPARATOR_TEXT 6
181 #define WID_COUNT_EMPTY_LINES 8
182 #define WID_COUNT_LINES_IN_FRAMES 9
183 #define WID_RESTART_AT_EACH_PAGE 10
185 static const SfxItemPropertySet* GetLineNumberingSet()
187 static const SfxItemPropertyMapEntry aLineNumberingMap_Impl[] =
189 { OUString(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
190 { OUString(UNO_NAME_COUNT_EMPTY_LINES), WID_COUNT_EMPTY_LINES , cppu::UnoType<bool>::get(),PROPERTY_NONE, 0},
191 { OUString(UNO_NAME_COUNT_LINES_IN_FRAMES), WID_COUNT_LINES_IN_FRAMES, cppu::UnoType<bool>::get(),PROPERTY_NONE, 0},
192 { OUString(UNO_NAME_DISTANCE), WID_DISTANCE , ::cppu::UnoType<sal_Int32>::get(),PROPERTY_NONE, 0},
193 { OUString(UNO_NAME_IS_ON), WID_NUM_ON, cppu::UnoType<bool>::get() , PROPERTY_NONE, 0},
194 { OUString(UNO_NAME_INTERVAL), WID_INTERVAL , ::cppu::UnoType<sal_Int16>::get(),PROPERTY_NONE, 0},
195 { OUString(UNO_NAME_SEPARATOR_TEXT), WID_SEPARATOR_TEXT, ::cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0},
196 { OUString(UNO_NAME_NUMBER_POSITION), WID_NUMBER_POSITION, ::cppu::UnoType<sal_Int16>::get(),PROPERTY_NONE, 0},
197 { OUString(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE , ::cppu::UnoType<sal_Int16>::get(),PROPERTY_NONE, 0},
198 { OUString(UNO_NAME_RESTART_AT_EACH_PAGE), WID_RESTART_AT_EACH_PAGE, cppu::UnoType<bool>::get() , PROPERTY_NONE, 0},
199 { OUString(UNO_NAME_SEPARATOR_INTERVAL), WID_SEPARATOR_INTERVAL, ::cppu::UnoType<sal_Int16>::get(),PROPERTY_NONE, 0},
200 { OUString(), 0, css::uno::Type(), 0, 0 }
202 static const SfxItemPropertySet aLineNumberingSet_Impl(aLineNumberingMap_Impl);
203 return &aLineNumberingSet_Impl;
206 static SwCharFormat* lcl_getCharFormat(SwDoc* pDoc, const uno::Any& aValue)
208 SwCharFormat* pRet = nullptr;
209 OUString uTmp;
210 aValue >>= uTmp;
211 OUString sCharFormat;
212 SwStyleNameMapper::FillUIName(uTmp, sCharFormat, SwGetPoolIdFromName::ChrFmt);
213 if (sCharFormat != SwResId(STR_POOLCOLL_STANDARD))
215 pRet = pDoc->FindCharFormatByName( sCharFormat );
217 if(!pRet)
219 const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sCharFormat, SwGetPoolIdFromName::ChrFmt);
220 if(USHRT_MAX != nId)
221 pRet = pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool( nId );
223 return pRet;
226 static SwTextFormatColl* lcl_GetParaStyle(SwDoc* pDoc, const uno::Any& aValue)
228 OUString uTmp;
229 aValue >>= uTmp;
230 OUString sParaStyle;
231 SwStyleNameMapper::FillUIName(uTmp, sParaStyle, SwGetPoolIdFromName::TxtColl );
232 SwTextFormatColl* pRet = pDoc->FindTextFormatCollByName( sParaStyle );
233 if( !pRet )
235 const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sParaStyle, SwGetPoolIdFromName::TxtColl );
236 if( USHRT_MAX != nId )
237 pRet = pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( nId );
239 return pRet;
242 static SwPageDesc* lcl_GetPageDesc(SwDoc* pDoc, const uno::Any& aValue)
244 OUString uTmp;
245 aValue >>= uTmp;
246 OUString sPageDesc;
247 SwStyleNameMapper::FillUIName(uTmp, sPageDesc, SwGetPoolIdFromName::PageDesc );
248 SwPageDesc* pRet = pDoc->FindPageDesc( sPageDesc );
249 if(!pRet)
251 const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sPageDesc, SwGetPoolIdFromName::PageDesc);
252 if(USHRT_MAX != nId)
253 pRet = pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( nId );
255 return pRet;
258 // Numbering
259 const o3tl::enumarray<SvxAdjust, unsigned short> aSvxToUnoAdjust
261 text::HoriOrientation::LEFT, //3
262 text::HoriOrientation::RIGHT, //1
263 USHRT_MAX,
264 text::HoriOrientation::CENTER, //2
265 USHRT_MAX,
266 USHRT_MAX
269 const unsigned short aUnoToSvxAdjust[] =
271 USHRT_MAX,
272 static_cast<unsigned short>(SvxAdjust::Right), // 1
273 static_cast<unsigned short>(SvxAdjust::Center), // 3
274 static_cast<unsigned short>(SvxAdjust::Left), // 0
275 USHRT_MAX,
276 USHRT_MAX
279 OUString SwXFootnoteProperties::getImplementationName()
281 return "SwXFootnoteProperties";
284 sal_Bool SwXFootnoteProperties::supportsService(const OUString& rServiceName)
286 return cppu::supportsService(this, rServiceName);
289 Sequence< OUString > SwXFootnoteProperties::getSupportedServiceNames()
291 Sequence<OUString> aRet { "com.sun.star.text.FootnoteSettings" };
292 return aRet;
295 SwXFootnoteProperties::SwXFootnoteProperties(SwDoc* pDc) :
296 m_pDoc(pDc),
297 m_pPropertySet(GetFootnoteSet())
301 SwXFootnoteProperties::~SwXFootnoteProperties()
306 uno::Reference< beans::XPropertySetInfo > SwXFootnoteProperties::getPropertySetInfo()
308 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
309 return aRef;
312 void SwXFootnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
314 SolarMutexGuard aGuard;
315 if(!m_pDoc)
316 throw uno::RuntimeException();
318 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
319 if(!pEntry)
320 throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
322 if ( pEntry->nFlags & PropertyAttribute::READONLY)
323 throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
324 SwFootnoteInfo aFootnoteInfo(m_pDoc->GetFootnoteInfo());
325 switch(pEntry->nWID)
327 case WID_PREFIX:
329 OUString uTmp;
330 aValue >>= uTmp;
331 aFootnoteInfo.SetPrefix(uTmp);
333 break;
334 case WID_SUFFIX:
336 OUString uTmp;
337 aValue >>= uTmp;
338 aFootnoteInfo.SetSuffix(uTmp);
340 break;
341 case WID_NUMBERING_TYPE:
343 sal_Int16 nTmp = 0;
344 aValue >>= nTmp;
345 if(!(nTmp >= 0 &&
346 (nTmp <= SVX_NUM_ARABIC ||
347 nTmp > SVX_NUM_BITMAP)))
348 throw lang::IllegalArgumentException();
350 aFootnoteInfo.aFormat.SetNumberingType(static_cast<SvxNumType>(nTmp));
353 break;
354 case WID_START_AT:
356 sal_Int16 nTmp = 0;
357 aValue >>= nTmp;
358 aFootnoteInfo.nFootnoteOffset = nTmp;
360 break;
361 case WID_FOOTNOTE_COUNTING:
363 sal_Int16 nTmp = 0;
364 aValue >>= nTmp;
365 switch(nTmp)
367 case FootnoteNumbering::PER_PAGE:
368 aFootnoteInfo.eNum = FTNNUM_PAGE;
369 break;
370 case FootnoteNumbering::PER_CHAPTER:
371 aFootnoteInfo.eNum = FTNNUM_CHAPTER;
372 break;
373 case FootnoteNumbering::PER_DOCUMENT:
374 aFootnoteInfo.eNum = FTNNUM_DOC;
375 break;
378 break;
379 case WID_PARAGRAPH_STYLE:
381 SwTextFormatColl* pColl = lcl_GetParaStyle(m_pDoc, aValue);
382 if(pColl)
383 aFootnoteInfo.SetFootnoteTextColl(*pColl);
385 break;
386 case WID_PAGE_STYLE:
388 SwPageDesc* pDesc = lcl_GetPageDesc(m_pDoc, aValue);
389 if(pDesc)
390 aFootnoteInfo.ChgPageDesc( pDesc );
392 break;
393 case WID_ANCHOR_CHARACTER_STYLE:
394 case WID_CHARACTER_STYLE:
396 SwCharFormat* pFormat = lcl_getCharFormat(m_pDoc, aValue);
397 if(pFormat)
399 if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE)
400 aFootnoteInfo.SetAnchorCharFormat(pFormat);
401 else
402 aFootnoteInfo.SetCharFormat(pFormat);
405 break;
406 case WID_POSITION_END_OF_DOC:
408 bool bVal = *o3tl::doAccess<bool>(aValue);
409 aFootnoteInfo.ePos = bVal ? FTNPOS_CHAPTER : FTNPOS_PAGE;
411 break;
412 case WID_END_NOTICE:
414 OUString uTmp;
415 aValue >>= uTmp;
416 aFootnoteInfo.aQuoVadis = uTmp;
418 break;
419 case WID_BEGIN_NOTICE:
421 OUString uTmp;
422 aValue >>= uTmp;
423 aFootnoteInfo.aErgoSum = uTmp;
425 break;
427 m_pDoc->SetFootnoteInfo(aFootnoteInfo);
432 uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName)
434 SolarMutexGuard aGuard;
435 uno::Any aRet;
436 if(!m_pDoc)
437 throw uno::RuntimeException();
439 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
440 if(!pEntry)
441 throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
443 const SwFootnoteInfo& rFootnoteInfo = m_pDoc->GetFootnoteInfo();
444 switch(pEntry->nWID)
446 case WID_PREFIX:
448 aRet <<= rFootnoteInfo.GetPrefix();
450 break;
451 case WID_SUFFIX:
453 aRet <<= rFootnoteInfo.GetSuffix();
455 break;
456 case WID_NUMBERING_TYPE :
458 aRet <<= static_cast<sal_Int16>(rFootnoteInfo.aFormat.GetNumberingType());
460 break;
461 case WID_START_AT:
462 aRet <<= static_cast<sal_Int16>(rFootnoteInfo.nFootnoteOffset);
463 break;
464 case WID_FOOTNOTE_COUNTING :
466 sal_Int16 nRet = 0;
467 switch(rFootnoteInfo.eNum)
469 case FTNNUM_PAGE:
470 nRet = FootnoteNumbering::PER_PAGE;
471 break;
472 case FTNNUM_CHAPTER:
473 nRet = FootnoteNumbering::PER_CHAPTER;
474 break;
475 case FTNNUM_DOC:
476 nRet = FootnoteNumbering::PER_DOCUMENT;
477 break;
479 aRet <<= nRet;
481 break;
482 case WID_PARAGRAPH_STYLE :
484 SwTextFormatColl* pColl = rFootnoteInfo.GetFootnoteTextColl();
485 OUString aString;
486 if(pColl)
487 aString = pColl->GetName();
488 SwStyleNameMapper::FillProgName(aString, aString, SwGetPoolIdFromName::TxtColl);
489 aRet <<= aString;
491 break;
492 case WID_PAGE_STYLE :
494 OUString aString;
495 if( rFootnoteInfo.KnowsPageDesc() )
497 SwStyleNameMapper::FillProgName(
498 rFootnoteInfo.GetPageDesc( *m_pDoc )->GetName(),
499 aString,
500 SwGetPoolIdFromName::PageDesc);
502 aRet <<= aString;
504 break;
505 case WID_ANCHOR_CHARACTER_STYLE:
506 case WID_CHARACTER_STYLE:
508 OUString aString;
509 const SwCharFormat* pCharFormat = rFootnoteInfo.GetCurrentCharFormat(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE);
510 if( pCharFormat )
512 SwStyleNameMapper::FillProgName(
513 pCharFormat->GetName(),
514 aString,
515 SwGetPoolIdFromName::ChrFmt);
517 aRet <<= aString;
519 break;
520 case WID_POSITION_END_OF_DOC:
521 aRet <<= FTNPOS_CHAPTER == rFootnoteInfo.ePos;
522 break;
523 case WID_END_NOTICE :
524 aRet <<= rFootnoteInfo.aQuoVadis;
525 break;
526 case WID_BEGIN_NOTICE :
527 aRet <<= rFootnoteInfo.aErgoSum;
528 break;
532 return aRet;
535 void SwXFootnoteProperties::addPropertyChangeListener(
536 const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
538 OSL_FAIL("not implemented");
541 void SwXFootnoteProperties::removePropertyChangeListener(
542 const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
544 OSL_FAIL("not implemented");
547 void SwXFootnoteProperties::addVetoableChangeListener(
548 const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
550 OSL_FAIL("not implemented");
553 void SwXFootnoteProperties::removeVetoableChangeListener(
554 const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
556 OSL_FAIL("not implemented");
559 OUString SwXEndnoteProperties::getImplementationName()
561 return "SwXEndnoteProperties";
564 sal_Bool SwXEndnoteProperties::supportsService(const OUString& rServiceName)
566 return cppu::supportsService(this, rServiceName);
569 Sequence< OUString > SwXEndnoteProperties::getSupportedServiceNames()
571 Sequence<OUString> aRet { "com.sun.star.text.FootnoteSettings" };
572 return aRet;
575 SwXEndnoteProperties::SwXEndnoteProperties(SwDoc* pDc) :
576 m_pDoc(pDc),
577 m_pPropertySet(GetEndnoteSet())
581 SwXEndnoteProperties::~SwXEndnoteProperties()
585 uno::Reference< beans::XPropertySetInfo > SwXEndnoteProperties::getPropertySetInfo()
587 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
588 return aRef;
591 void SwXEndnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
593 SolarMutexGuard aGuard;
594 if(m_pDoc)
596 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
597 if(!pEntry)
598 throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
600 if ( pEntry->nFlags & PropertyAttribute::READONLY)
601 throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
602 SwEndNoteInfo aEndInfo(m_pDoc->GetEndNoteInfo());
603 switch(pEntry->nWID)
605 case WID_PREFIX:
607 OUString uTmp;
608 aValue >>= uTmp;
609 aEndInfo.SetPrefix(uTmp);
611 break;
612 case WID_SUFFIX:
614 OUString uTmp;
615 aValue >>= uTmp;
616 aEndInfo.SetSuffix(uTmp);
618 break;
619 case WID_NUMBERING_TYPE :
621 sal_Int16 nTmp = 0;
622 aValue >>= nTmp;
623 aEndInfo.aFormat.SetNumberingType(static_cast<SvxNumType>(nTmp));
625 break;
626 case WID_START_AT:
628 sal_Int16 nTmp = 0;
629 aValue >>= nTmp;
630 aEndInfo.nFootnoteOffset = nTmp;
632 break;
633 case WID_PARAGRAPH_STYLE :
635 SwTextFormatColl* pColl = lcl_GetParaStyle(m_pDoc, aValue);
636 if(pColl)
637 aEndInfo.SetFootnoteTextColl(*pColl);
639 break;
640 case WID_PAGE_STYLE :
642 SwPageDesc* pDesc = lcl_GetPageDesc(m_pDoc, aValue);
643 if(pDesc)
644 aEndInfo.ChgPageDesc( pDesc );
646 break;
647 case WID_ANCHOR_CHARACTER_STYLE:
648 case WID_CHARACTER_STYLE :
650 SwCharFormat* pFormat = lcl_getCharFormat(m_pDoc, aValue);
651 if(pFormat)
653 if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE)
654 aEndInfo.SetAnchorCharFormat(pFormat);
655 else
656 aEndInfo.SetCharFormat(pFormat);
659 break;
661 m_pDoc->SetEndNoteInfo(aEndInfo);
666 uno::Any SwXEndnoteProperties::getPropertyValue(const OUString& rPropertyName)
668 SolarMutexGuard aGuard;
669 uno::Any aRet;
670 if(m_pDoc)
672 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
673 if(!pEntry)
674 throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
676 const SwEndNoteInfo& rEndInfo = m_pDoc->GetEndNoteInfo();
677 switch(pEntry->nWID)
679 case WID_PREFIX:
680 aRet <<= rEndInfo.GetPrefix();
681 break;
682 case WID_SUFFIX:
683 aRet <<= rEndInfo.GetSuffix();
684 break;
685 case WID_NUMBERING_TYPE :
686 aRet <<= static_cast<sal_Int16>(rEndInfo.aFormat.GetNumberingType());
687 break;
688 case WID_START_AT:
689 aRet <<= static_cast<sal_Int16>(rEndInfo.nFootnoteOffset);
690 break;
691 case WID_PARAGRAPH_STYLE :
693 SwTextFormatColl* pColl = rEndInfo.GetFootnoteTextColl();
694 OUString aString;
695 if(pColl)
696 aString = pColl->GetName();
697 SwStyleNameMapper::FillProgName(
698 aString,
699 aString,
700 SwGetPoolIdFromName::TxtColl);
701 aRet <<= aString;
704 break;
705 case WID_PAGE_STYLE :
707 OUString aString;
708 if( rEndInfo.KnowsPageDesc() )
710 SwStyleNameMapper::FillProgName(
711 rEndInfo.GetPageDesc( *m_pDoc )->GetName(),
712 aString,
713 SwGetPoolIdFromName::PageDesc);
715 aRet <<= aString;
717 break;
718 case WID_ANCHOR_CHARACTER_STYLE:
719 case WID_CHARACTER_STYLE:
721 OUString aString;
722 const SwCharFormat* pCharFormat = rEndInfo.GetCurrentCharFormat( pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE );
723 if( pCharFormat )
725 SwStyleNameMapper::FillProgName(
726 pCharFormat->GetName(),
727 aString,
728 SwGetPoolIdFromName::ChrFmt);
730 aRet <<= aString;
732 break;
736 return aRet;
739 void SwXEndnoteProperties::addPropertyChangeListener(
740 const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
742 OSL_FAIL("not implemented");
745 void SwXEndnoteProperties::removePropertyChangeListener(const OUString& /*PropertyName*/,
746 const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/)
748 OSL_FAIL("not implemented");
751 void SwXEndnoteProperties::addVetoableChangeListener(const OUString& /*PropertyName*/,
752 const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
754 OSL_FAIL("not implemented");
757 void SwXEndnoteProperties::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
759 OSL_FAIL("not implemented");
762 OUString SwXLineNumberingProperties::getImplementationName()
764 return "SwXLineNumberingProperties";
767 sal_Bool SwXLineNumberingProperties::supportsService(const OUString& rServiceName)
769 return cppu::supportsService(this, rServiceName);
772 Sequence< OUString > SwXLineNumberingProperties::getSupportedServiceNames()
774 Sequence<OUString> aRet { "com.sun.star.text.LineNumberingProperties" };
775 return aRet;
778 SwXLineNumberingProperties::SwXLineNumberingProperties(SwDoc* pDc) :
779 m_pDoc(pDc),
780 m_pPropertySet(GetLineNumberingSet())
784 SwXLineNumberingProperties::~SwXLineNumberingProperties()
788 uno::Reference< beans::XPropertySetInfo > SwXLineNumberingProperties::getPropertySetInfo()
790 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
791 return aRef;
794 void SwXLineNumberingProperties::setPropertyValue(
795 const OUString& rPropertyName, const Any& aValue)
797 SolarMutexGuard aGuard;
798 if(!m_pDoc)
799 throw uno::RuntimeException();
801 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
802 if(!pEntry)
803 throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
805 if ( pEntry->nFlags & PropertyAttribute::READONLY)
806 throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
807 SwLineNumberInfo aFontMetric(m_pDoc->GetLineNumberInfo());
808 switch(pEntry->nWID)
810 case WID_NUM_ON:
812 bool bVal = *o3tl::doAccess<bool>(aValue);
813 aFontMetric.SetPaintLineNumbers(bVal);
815 break;
816 case WID_CHARACTER_STYLE :
818 SwCharFormat* pFormat = lcl_getCharFormat(m_pDoc, aValue);
819 if(pFormat)
820 aFontMetric.SetCharFormat(pFormat);
822 break;
823 case WID_NUMBERING_TYPE :
825 SvxNumberType aNumType(aFontMetric.GetNumType());
826 sal_Int16 nTmp = 0;
827 aValue >>= nTmp;
828 aNumType.SetNumberingType(static_cast<SvxNumType>(nTmp));
829 aFontMetric.SetNumType(aNumType);
831 break;
832 case WID_NUMBER_POSITION :
834 sal_Int16 nTmp = 0;
835 aValue >>= nTmp;
836 switch(nTmp)
838 case style::LineNumberPosition::LEFT:
839 aFontMetric.SetPos(LINENUMBER_POS_LEFT);
840 break;
841 case style::LineNumberPosition::RIGHT :
842 aFontMetric.SetPos(LINENUMBER_POS_RIGHT);
843 break;
844 case style::LineNumberPosition::INSIDE:
845 aFontMetric.SetPos(LINENUMBER_POS_INSIDE);
846 break;
847 case style::LineNumberPosition::OUTSIDE:
848 aFontMetric.SetPos(LINENUMBER_POS_OUTSIDE);
849 break;
852 break;
853 case WID_DISTANCE :
855 sal_Int32 nVal = 0;
856 aValue >>= nVal;
857 sal_Int32 nTmp = convertMm100ToTwip(nVal);
858 if (nTmp > SAL_MAX_UINT16)
859 nTmp = SAL_MAX_UINT16;
860 aFontMetric.SetPosFromLeft( static_cast< sal_uInt16 >(nTmp) );
862 break;
863 case WID_INTERVAL :
865 sal_Int16 nTmp = 0;
866 aValue >>= nTmp;
867 if( nTmp > 0)
868 aFontMetric.SetCountBy(nTmp);
870 break;
871 case WID_SEPARATOR_TEXT :
873 OUString uTmp;
874 aValue >>= uTmp;
875 aFontMetric.SetDivider(uTmp);
877 break;
878 case WID_SEPARATOR_INTERVAL:
880 sal_Int16 nTmp = 0;
881 aValue >>= nTmp;
882 if( nTmp >= 0)
883 aFontMetric.SetDividerCountBy(nTmp);
885 break;
886 case WID_COUNT_EMPTY_LINES :
888 bool bVal = *o3tl::doAccess<bool>(aValue);
889 aFontMetric.SetCountBlankLines(bVal);
891 break;
892 case WID_COUNT_LINES_IN_FRAMES :
894 bool bVal = *o3tl::doAccess<bool>(aValue);
895 aFontMetric.SetCountInFlys(bVal);
897 break;
898 case WID_RESTART_AT_EACH_PAGE :
900 bool bVal = *o3tl::doAccess<bool>(aValue);
901 aFontMetric.SetRestartEachPage(bVal);
903 break;
905 m_pDoc->SetLineNumberInfo(aFontMetric);
908 Any SwXLineNumberingProperties::getPropertyValue(const OUString& rPropertyName)
910 SolarMutexGuard aGuard;
911 Any aRet;
912 if(!m_pDoc)
913 throw uno::RuntimeException();
915 const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
916 if(!pEntry)
917 throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
919 const SwLineNumberInfo& rInfo = m_pDoc->GetLineNumberInfo();
920 switch(pEntry->nWID)
922 case WID_NUM_ON:
923 aRet <<= rInfo.IsPaintLineNumbers();
924 break;
925 case WID_CHARACTER_STYLE :
927 OUString aString;
928 // return empty string if no char format is set
929 // otherwise it would be created here
930 if(rInfo.HasCharFormat())
932 SwStyleNameMapper::FillProgName(
933 rInfo.GetCharFormat(m_pDoc->getIDocumentStylePoolAccess())->GetName(),
934 aString,
935 SwGetPoolIdFromName::ChrFmt);
937 aRet <<= aString;
939 break;
940 case WID_NUMBERING_TYPE :
941 aRet <<= static_cast<sal_Int16>(rInfo.GetNumType().GetNumberingType());
942 break;
943 case WID_NUMBER_POSITION :
945 sal_Int16 nRet = 0;
946 switch(rInfo.GetPos())
948 case LINENUMBER_POS_LEFT:
949 nRet = style::LineNumberPosition::LEFT;
950 break;
951 case LINENUMBER_POS_RIGHT :
952 nRet = style::LineNumberPosition::RIGHT ;
953 break;
954 case LINENUMBER_POS_INSIDE:
955 nRet = style::LineNumberPosition::INSIDE ;
956 break;
957 case LINENUMBER_POS_OUTSIDE :
958 nRet = style::LineNumberPosition::OUTSIDE ;
959 break;
961 aRet <<= nRet;
963 break;
964 case WID_DISTANCE :
966 sal_uInt32 nPos = rInfo.GetPosFromLeft();
967 if(USHRT_MAX == nPos)
968 nPos = 0;
969 aRet <<= static_cast < sal_Int32 >(convertTwipToMm100(nPos));
971 break;
972 case WID_INTERVAL :
973 aRet <<= static_cast<sal_Int16>(rInfo.GetCountBy());
974 break;
975 case WID_SEPARATOR_TEXT :
976 aRet <<= rInfo.GetDivider();
977 break;
978 case WID_SEPARATOR_INTERVAL:
979 aRet <<= static_cast<sal_Int16>(rInfo.GetDividerCountBy());
980 break;
981 case WID_COUNT_EMPTY_LINES :
982 aRet <<= rInfo.IsCountBlankLines();
983 break;
984 case WID_COUNT_LINES_IN_FRAMES :
985 aRet <<= rInfo.IsCountInFlys();
986 break;
987 case WID_RESTART_AT_EACH_PAGE :
988 aRet <<= rInfo.IsRestartEachPage();
989 break;
991 return aRet;
994 void SwXLineNumberingProperties::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/)
996 OSL_FAIL("not implemented");
999 void SwXLineNumberingProperties::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XPropertyChangeListener > & /*xListener*/)
1001 OSL_FAIL("not implemented");
1004 void SwXLineNumberingProperties::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
1006 OSL_FAIL("not implemented");
1009 void SwXLineNumberingProperties::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno:: Reference< beans::XVetoableChangeListener > & /*xListener*/)
1011 OSL_FAIL("not implemented");
1014 static const char aInvalidStyle[] = "__XXX___invalid";
1016 class SwXNumberingRules::Impl
1017 : public SvtListener
1019 SwXNumberingRules& m_rParent;
1020 virtual void Notify(const SfxHint&) override;
1021 public:
1022 explicit Impl(SwXNumberingRules& rParent) : m_rParent(rParent) {}
1025 bool SwXNumberingRules::isInvalidStyle(const OUString &rName)
1027 return rName == aInvalidStyle;
1030 namespace
1032 class theSwXNumberingRulesUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXNumberingRulesUnoTunnelId > {};
1035 const uno::Sequence< sal_Int8 > & SwXNumberingRules::getUnoTunnelId()
1037 return theSwXNumberingRulesUnoTunnelId::get().getSeq();
1040 // return implementation specific data
1041 sal_Int64 SwXNumberingRules::getSomething( const uno::Sequence< sal_Int8 > & rId )
1043 if( isUnoTunnelId<SwXNumberingRules>(rId) )
1045 return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
1047 return 0;
1050 OUString SwXNumberingRules::getImplementationName()
1052 return "SwXNumberingRules";
1055 sal_Bool SwXNumberingRules::supportsService(const OUString& rServiceName)
1057 return cppu::supportsService(this, rServiceName);
1060 Sequence< OUString > SwXNumberingRules::getSupportedServiceNames()
1062 Sequence<OUString> aRet { "com.sun.star.text.NumberingRules" };
1063 return aRet;
1066 SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc) :
1067 m_pImpl(new SwXNumberingRules::Impl(*this)),
1068 m_pDoc(doc),
1069 m_pDocShell(nullptr),
1070 m_pNumRule(new SwNumRule(rRule)),
1071 m_pPropertySet(GetNumberingRulesSet()),
1072 m_bOwnNumRuleCreated(true)
1074 // first organize the document - it is dependent on the set character formats
1075 // if no format is set, it should work as well
1076 for( sal_uInt16 i = 0; i < MAXLEVEL; ++i)
1078 SwNumFormat rFormat(m_pNumRule->Get(i));
1079 SwCharFormat* pCharFormat = rFormat.GetCharFormat();
1080 if(pCharFormat)
1082 m_pDoc = pCharFormat->GetDoc();
1083 break;
1086 if(m_pDoc)
1087 m_pImpl->StartListening(GetPageDescNotifier(m_pDoc));
1088 for(sal_uInt16 i = 0; i < MAXLEVEL; ++i)
1090 m_sNewCharStyleNames[i] = aInvalidStyle;
1091 m_sNewBulletFontNames[i] = aInvalidStyle;
1095 SwXNumberingRules::SwXNumberingRules(SwDocShell& rDocSh) :
1096 m_pImpl(new SwXNumberingRules::Impl(*this)),
1097 m_pDoc(nullptr),
1098 m_pDocShell(&rDocSh),
1099 m_pNumRule(nullptr),
1100 m_pPropertySet(GetNumberingRulesSet()),
1101 m_bOwnNumRuleCreated(false)
1103 m_pImpl->StartListening(GetPageDescNotifier(m_pDocShell->GetDoc()));
1106 SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) :
1107 m_pImpl(new SwXNumberingRules::Impl(*this)),
1108 m_pDoc(&rDoc),
1109 m_pDocShell(nullptr),
1110 m_pNumRule(nullptr),
1111 m_pPropertySet(GetNumberingRulesSet()),
1112 m_bOwnNumRuleCreated(false)
1114 m_pImpl->StartListening(GetPageDescNotifier(&rDoc));
1115 m_sCreatedNumRuleName = rDoc.GetUniqueNumRuleName();
1116 rDoc.MakeNumRule( m_sCreatedNumRuleName, nullptr, false,
1117 // #i89178#
1118 numfunc::GetDefaultPositionAndSpaceMode() );
1121 SwXNumberingRules::~SwXNumberingRules()
1123 SolarMutexGuard aGuard;
1124 if(m_pDoc && !m_sCreatedNumRuleName.isEmpty())
1125 m_pDoc->DelNumRule( m_sCreatedNumRuleName );
1126 if( m_bOwnNumRuleCreated )
1127 delete m_pNumRule;
1130 void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElement)
1132 SolarMutexGuard aGuard;
1133 if(nIndex < 0 || MAXLEVEL <= nIndex)
1134 throw lang::IndexOutOfBoundsException();
1136 auto rProperties = o3tl::tryAccess<uno::Sequence<beans::PropertyValue>>(
1137 rElement);
1138 if(!rProperties)
1139 throw lang::IllegalArgumentException();
1140 SwNumRule* pRule = nullptr;
1141 if(m_pNumRule)
1142 SwXNumberingRules::SetNumberingRuleByIndex( *m_pNumRule,
1143 *rProperties, nIndex);
1144 else if(m_pDocShell)
1146 // #i87650# - correction of cws warnings:
1147 SwNumRule aNumRule( *(m_pDocShell->GetDoc()->GetOutlineNumRule()) );
1148 SwXNumberingRules::SetNumberingRuleByIndex( aNumRule,
1149 *rProperties, nIndex);
1150 // set character format if needed
1151 const SwCharFormats* pFormats = m_pDocShell->GetDoc()->GetCharFormats();
1152 const size_t nChCount = pFormats->size();
1153 for(sal_uInt16 i = 0; i < MAXLEVEL;i++)
1155 SwNumFormat aFormat(aNumRule.Get( i ));
1156 if (!m_sNewCharStyleNames[i].isEmpty() &&
1157 m_sNewCharStyleNames[i] != UNO_NAME_CHARACTER_FORMAT_NONE &&
1158 (!aFormat.GetCharFormat() || aFormat.GetCharFormat()->GetName()!= m_sNewCharStyleNames[i]))
1160 SwCharFormat* pCharFormat = nullptr;
1161 for(size_t j = 0; j< nChCount; ++j)
1163 SwCharFormat* pTmp = (*pFormats)[j];
1164 if(pTmp->GetName() == m_sNewCharStyleNames[i])
1166 pCharFormat = pTmp;
1167 break;
1170 if(!pCharFormat)
1172 SfxStyleSheetBase* pBase;
1173 pBase = m_pDocShell->GetStyleSheetPool()->Find(m_sNewCharStyleNames[i],
1174 SfxStyleFamily::Char);
1175 if(!pBase)
1176 pBase = &m_pDocShell->GetStyleSheetPool()->Make(m_sNewCharStyleNames[i], SfxStyleFamily::Char);
1177 pCharFormat = static_cast<SwDocStyleSheet*>(pBase)->GetCharFormat();
1180 aFormat.SetCharFormat( pCharFormat );
1181 aNumRule.Set( i, aFormat );
1184 m_pDocShell->GetDoc()->SetOutlineNumRule( aNumRule );
1186 else if(m_pDoc && !m_sCreatedNumRuleName.isEmpty() &&
1187 nullptr != (pRule = m_pDoc->FindNumRulePtr( m_sCreatedNumRuleName )))
1189 SwXNumberingRules::SetNumberingRuleByIndex( *pRule,
1190 *rProperties, nIndex);
1192 pRule->Validate();
1194 else
1195 throw uno::RuntimeException();
1198 sal_Int32 SwXNumberingRules::getCount()
1200 return MAXLEVEL;
1203 uno::Any SwXNumberingRules::getByIndex(sal_Int32 nIndex)
1205 SolarMutexGuard aGuard;
1206 if(nIndex < 0 || MAXLEVEL <= nIndex)
1207 throw lang::IndexOutOfBoundsException();
1209 uno::Any aVal;
1210 const SwNumRule* pRule = m_pNumRule;
1211 if(!pRule && m_pDoc && !m_sCreatedNumRuleName.isEmpty())
1212 pRule = m_pDoc->FindNumRulePtr( m_sCreatedNumRuleName );
1213 if(pRule)
1215 uno::Sequence<beans::PropertyValue> aRet = GetNumberingRuleByIndex(
1216 *pRule, nIndex);
1217 aVal <<= aRet;
1220 else if(m_pDocShell)
1222 uno::Sequence<beans::PropertyValue> aRet = GetNumberingRuleByIndex(
1223 *m_pDocShell->GetDoc()->GetOutlineNumRule(), nIndex);
1224 aVal <<= aRet;
1226 else
1227 throw uno::RuntimeException();
1228 return aVal;
1231 uno::Type SwXNumberingRules::getElementType()
1233 return cppu::UnoType<uno::Sequence<beans::PropertyValue>>::get();
1236 sal_Bool SwXNumberingRules::hasElements()
1238 return true;
1241 static const char* STR_POOLCOLL_HEADLINE_ARY[]
1243 STR_POOLCOLL_HEADLINE1,
1244 STR_POOLCOLL_HEADLINE2,
1245 STR_POOLCOLL_HEADLINE3,
1246 STR_POOLCOLL_HEADLINE4,
1247 STR_POOLCOLL_HEADLINE5,
1248 STR_POOLCOLL_HEADLINE6,
1249 STR_POOLCOLL_HEADLINE7,
1250 STR_POOLCOLL_HEADLINE8,
1251 STR_POOLCOLL_HEADLINE9,
1252 STR_POOLCOLL_HEADLINE10
1255 uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
1256 const SwNumRule& rNumRule, sal_Int32 nIndex) const
1258 SolarMutexGuard aGuard;
1259 OSL_ENSURE( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" );
1261 const SwNumFormat& rFormat = rNumRule.Get( static_cast<sal_uInt16>(nIndex) );
1263 SwCharFormat* pCharFormat = rFormat.GetCharFormat();
1264 OUString CharStyleName;
1265 if (pCharFormat)
1266 CharStyleName = pCharFormat->GetName();
1268 // Whether or not a style is present: the array entry overwrites this string
1269 if (!m_sNewCharStyleNames[nIndex].isEmpty() &&
1270 !SwXNumberingRules::isInvalidStyle(m_sNewCharStyleNames[nIndex]))
1272 CharStyleName = m_sNewCharStyleNames[nIndex];
1275 OUString aUString;
1276 if (m_pDocShell) // -> Chapter Numbering
1278 // template name
1279 OUString sValue(SwResId(STR_POOLCOLL_HEADLINE_ARY[nIndex]));
1280 const SwTextFormatColls* pColls = m_pDocShell->GetDoc()->GetTextFormatColls();
1281 const size_t nCount = pColls->size();
1282 for(size_t i = 0; i < nCount; ++i)
1284 SwTextFormatColl &rTextColl = *pColls->operator[](i);
1285 if(rTextColl.IsDefault())
1286 continue;
1288 const sal_Int16 nOutLevel = rTextColl.IsAssignedToListLevelOfOutlineStyle()
1289 ? static_cast<sal_Int16>(rTextColl.GetAssignedOutlineStyleLevel())
1290 : MAXLEVEL;
1291 if ( nOutLevel == nIndex )
1293 sValue = rTextColl.GetName();
1294 break; // the style for the level in question has been found
1296 else if( sValue==rTextColl.GetName() )
1298 // if the default for the level is existing, but its
1299 // level is different, then it cannot be the default.
1300 sValue.clear();
1303 SwStyleNameMapper::FillProgName(sValue, aUString, SwGetPoolIdFromName::TxtColl);
1306 OUString referer;
1307 if (m_pDoc != nullptr) {
1308 auto const sh = m_pDoc->GetPersist();
1309 if (sh != nullptr && sh->HasName()) {
1310 referer = sh->GetMedium()->GetName();
1313 return GetPropertiesForNumFormat(
1314 rFormat, CharStyleName, m_pDocShell ? & aUString : nullptr, referer);
1318 uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat(
1319 const SwNumFormat& rFormat, OUString const& rCharFormatName,
1320 OUString const*const pHeadingStyleName, OUString const & referer)
1322 bool bChapterNum = pHeadingStyleName != nullptr;
1324 std::vector<PropertyValue> aPropertyValues;
1325 aPropertyValues.reserve(32);
1326 //fill all properties into the array
1328 //adjust
1329 SvxAdjust eAdj = rFormat.GetNumAdjust();
1330 sal_Int16 nINT16 = aSvxToUnoAdjust[eAdj];
1331 aPropertyValues.push_back(comphelper::makePropertyValue("Adjust", nINT16));
1333 //parentnumbering
1334 nINT16 = rFormat.GetIncludeUpperLevels();
1335 aPropertyValues.push_back(comphelper::makePropertyValue("ParentNumbering", nINT16));
1337 //prefix
1338 OUString aUString = rFormat.GetPrefix();
1339 aPropertyValues.push_back(comphelper::makePropertyValue("Prefix", aUString));
1341 //suffix
1342 aUString = rFormat.GetSuffix();
1343 aPropertyValues.push_back(comphelper::makePropertyValue("Suffix", aUString));
1345 //listformat
1346 aUString = rFormat.GetListFormat();
1347 aPropertyValues.push_back(comphelper::makePropertyValue("ListFormat", aUString));
1349 //char style name
1351 aUString.clear();
1352 SwStyleNameMapper::FillProgName( rCharFormatName, aUString, SwGetPoolIdFromName::ChrFmt);
1353 aPropertyValues.push_back(comphelper::makePropertyValue("CharStyleName", aUString));
1355 //startvalue
1356 nINT16 = rFormat.GetStart();
1357 aPropertyValues.push_back(comphelper::makePropertyValue("StartWith", nINT16));
1359 if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1361 //leftmargin
1362 sal_Int32 nINT32 = convertTwipToMm100(rFormat.GetAbsLSpace());
1363 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_LEFT_MARGIN, nINT32));
1365 //chartextoffset
1366 nINT32 = convertTwipToMm100(rFormat.GetCharTextDistance());
1367 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_SYMBOL_TEXT_DISTANCE, nINT32));
1369 //firstlineoffset
1370 nINT32 = convertTwipToMm100(rFormat.GetFirstLineOffset());
1371 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_FIRST_LINE_OFFSET, nINT32));
1374 // PositionAndSpaceMode
1375 nINT16 = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
1376 if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1378 nINT16 = PositionAndSpaceMode::LABEL_ALIGNMENT;
1380 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_POSITION_AND_SPACE_MODE, nINT16));
1382 if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1384 // LabelFollowedBy
1385 nINT16 = LabelFollow::LISTTAB;
1386 if ( rFormat.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
1388 nINT16 = LabelFollow::SPACE;
1390 else if ( rFormat.GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
1392 nINT16 = LabelFollow::NOTHING;
1394 else if ( rFormat.GetLabelFollowedBy() == SvxNumberFormat::NEWLINE )
1396 nINT16 = LabelFollow::NEWLINE;
1398 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_LABEL_FOLLOWED_BY, nINT16));
1400 // ListtabStopPosition
1401 sal_Int32 nINT32 = convertTwipToMm100(rFormat.GetListtabPos());
1402 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_LISTTAB_STOP_POSITION, nINT32));
1404 // FirstLineIndent
1405 nINT32 = convertTwipToMm100(rFormat.GetFirstLineIndent());
1406 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_FIRST_LINE_INDENT, nINT32));
1408 // IndentAt
1409 nINT32 = convertTwipToMm100(rFormat.GetIndentAt());
1410 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_INDENT_AT, nINT32));
1413 //numberingtype
1414 nINT16 = rFormat.GetNumberingType();
1415 aPropertyValues.push_back(comphelper::makePropertyValue("NumberingType", nINT16));
1417 if(!bChapterNum)
1419 if(SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType())
1421 //BulletId
1422 nINT16 = rFormat.GetBulletChar();
1423 aPropertyValues.push_back(comphelper::makePropertyValue("BulletId", nINT16));
1425 const vcl::Font* pFont = rFormat.GetBulletFont();
1427 //BulletChar
1428 aUString = OUString(rFormat.GetBulletChar());
1429 aPropertyValues.push_back(comphelper::makePropertyValue("BulletChar", aUString));
1431 //BulletFontName
1432 aUString = pFont ? pFont->GetStyleName() : OUString();
1433 aPropertyValues.push_back(comphelper::makePropertyValue("BulletFontName", aUString));
1435 //BulletFont
1436 if(pFont)
1438 awt::FontDescriptor aDesc;
1439 SvxUnoFontDescriptor::ConvertFromFont( *pFont, aDesc );
1440 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_BULLET_FONT, aDesc));
1443 if (SVX_NUM_BITMAP == rFormat.GetNumberingType())
1445 const SvxBrushItem* pBrush = rFormat.GetBrush();
1446 const Graphic* pGraphic = pBrush ? pBrush->GetGraphic(referer) : nullptr;
1447 if (pGraphic)
1449 //GraphicBitmap
1450 uno::Reference<awt::XBitmap> xBitmap(pGraphic->GetXGraphic(), uno::UNO_QUERY);
1451 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_GRAPHIC_BITMAP, xBitmap));
1454 Size aSize = rFormat.GetGraphicSize();
1455 // #i101131#
1456 // adjust conversion due to type mismatch between <Size> and <awt::Size>
1457 awt::Size aAwtSize(convertTwipToMm100(aSize.Width()), convertTwipToMm100(aSize.Height()));
1458 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_GRAPHIC_SIZE, aAwtSize));
1460 const SwFormatVertOrient* pOrient = rFormat.GetGraphicOrientation();
1461 if(pOrient)
1463 uno::Any any;
1464 pOrient->QueryValue(any);
1465 aPropertyValues.emplace_back(
1466 UNO_NAME_VERT_ORIENT, -1, any, PropertyState_DIRECT_VALUE);
1470 else
1472 aUString = *pHeadingStyleName;
1473 aPropertyValues.push_back(comphelper::makePropertyValue(UNO_NAME_HEADING_STYLE_NAME, aUString));
1476 return ::comphelper::containerToSequence(aPropertyValues);
1479 void SwXNumberingRules::SetNumberingRuleByIndex(
1480 SwNumRule& rNumRule,
1481 const uno::Sequence<beans::PropertyValue>& rProperties, sal_Int32 nIndex)
1483 SolarMutexGuard aGuard;
1484 OSL_ENSURE( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" );
1486 SwNumFormat aFormat(rNumRule.Get( static_cast<sal_uInt16>(nIndex) ));
1488 OUString sHeadingStyleName;
1489 OUString sParagraphStyleName;
1491 SetPropertiesToNumFormat(aFormat, m_sNewCharStyleNames[nIndex],
1492 &m_sNewBulletFontNames[nIndex],
1493 &sHeadingStyleName, &sParagraphStyleName,
1494 m_pDoc, rProperties);
1497 if (m_pDoc && !sParagraphStyleName.isEmpty())
1499 const SwTextFormatColls* pColls = m_pDoc->GetTextFormatColls();
1500 const size_t nCount = pColls->size();
1501 for (size_t k = 0; k < nCount; ++k)
1503 SwTextFormatColl &rTextColl = *((*pColls)[k]);
1504 if (rTextColl.GetName() == sParagraphStyleName)
1505 rTextColl.SetFormatAttr( SwNumRuleItem( rNumRule.GetName()));
1509 if (!sHeadingStyleName.isEmpty())
1511 assert(m_pDocShell);
1512 const SwTextFormatColls* pColls = m_pDocShell->GetDoc()->GetTextFormatColls();
1513 const size_t nCount = pColls->size();
1514 for (size_t k = 0; k < nCount; ++k)
1516 SwTextFormatColl &rTextColl = *((*pColls)[k]);
1517 if (rTextColl.IsDefault())
1518 continue;
1519 if (rTextColl.IsAssignedToListLevelOfOutlineStyle() &&
1520 rTextColl.GetAssignedOutlineStyleLevel() == nIndex &&
1521 rTextColl.GetName() != sHeadingStyleName)
1523 rTextColl.DeleteAssignmentToListLevelOfOutlineStyle();
1525 else if (rTextColl.GetName() == sHeadingStyleName)
1527 rTextColl.AssignToListLevelOfOutlineStyle( nIndex );
1532 rNumRule.Set(static_cast<sal_uInt16>(nIndex), aFormat);
1535 void SwXNumberingRules::SetPropertiesToNumFormat(
1536 SwNumFormat & aFormat,
1537 OUString & rCharStyleName, OUString *const pBulletFontName,
1538 OUString *const pHeadingStyleName,
1539 OUString *const pParagraphStyleName,
1540 SwDoc *const pDoc,
1541 const uno::Sequence<beans::PropertyValue>& rProperties)
1543 bool bWrongArg = false;
1544 std::unique_ptr<SvxBrushItem> pSetBrush;
1545 std::unique_ptr<Size> pSetSize;
1546 std::unique_ptr<SwFormatVertOrient> pSetVOrient;
1547 bool bCharStyleNameSet = false;
1549 for (const beans::PropertyValue& rProp : rProperties)
1551 if (rProp.Name == UNO_NAME_ADJUST)
1553 sal_Int16 nValue = text::HoriOrientation::NONE;
1554 rProp.Value >>= nValue;
1555 if (nValue > text::HoriOrientation::NONE &&
1556 nValue <= text::HoriOrientation::LEFT &&
1557 USHRT_MAX != aUnoToSvxAdjust[nValue])
1559 aFormat.SetNumAdjust(static_cast<SvxAdjust>(aUnoToSvxAdjust[nValue]));
1561 else
1562 bWrongArg = true;
1564 else if (rProp.Name == UNO_NAME_PARENT_NUMBERING)
1566 sal_Int16 nSet = 0;
1567 rProp.Value >>= nSet;
1568 if(nSet >= 0 && MAXLEVEL >= nSet)
1569 aFormat.SetIncludeUpperLevels( static_cast< sal_uInt8 >(nSet) );
1571 else if (rProp.Name == UNO_NAME_PREFIX)
1573 OUString uTmp;
1574 rProp.Value >>= uTmp;
1575 aFormat.SetPrefix(uTmp);
1577 else if (rProp.Name == UNO_NAME_SUFFIX)
1579 OUString uTmp;
1580 rProp.Value >>= uTmp;
1581 aFormat.SetSuffix(uTmp);
1583 else if (rProp.Name == UNO_NAME_CHAR_STYLE_NAME)
1585 bCharStyleNameSet = true;
1586 OUString uTmp;
1587 rProp.Value >>= uTmp;
1588 OUString sCharFormatName;
1589 SwStyleNameMapper::FillUIName( uTmp, sCharFormatName, SwGetPoolIdFromName::ChrFmt );
1590 if (sCharFormatName == UNO_NAME_CHARACTER_FORMAT_NONE)
1592 rCharStyleName = aInvalidStyle;
1593 aFormat.SetCharFormat(nullptr);
1595 else if(pDoc)
1597 const SwCharFormats* pFormats = pDoc->GetCharFormats();
1598 const size_t nChCount = pFormats->size();
1600 SwCharFormat* pCharFormat = nullptr;
1601 if (!sCharFormatName.isEmpty())
1603 for(size_t j = 0; j< nChCount; ++j)
1605 SwCharFormat* pTmp = (*pFormats)[j];
1606 if(pTmp->GetName() == sCharFormatName)
1608 pCharFormat = pTmp;
1609 break;
1612 if(!pCharFormat)
1615 SfxStyleSheetBase* pBase;
1616 SfxStyleSheetBasePool* pPool = pDoc->GetDocShell()->GetStyleSheetPool();
1617 pBase = pPool->Find(sCharFormatName, SfxStyleFamily::Char);
1618 if(!pBase)
1619 pBase = &pPool->Make(sCharFormatName, SfxStyleFamily::Char);
1620 pCharFormat = static_cast<SwDocStyleSheet*>(pBase)->GetCharFormat();
1623 aFormat.SetCharFormat( pCharFormat );
1624 // #i51842#
1625 // If the character format has been found its name should not be in the
1626 // char style names array
1627 rCharStyleName.clear();
1629 else
1630 rCharStyleName = sCharFormatName;
1632 else if (rProp.Name == UNO_NAME_START_WITH)
1634 sal_Int16 nVal = 0;
1635 rProp.Value >>= nVal;
1636 aFormat.SetStart(nVal);
1638 else if (rProp.Name == UNO_NAME_LEFT_MARGIN)
1640 sal_Int32 nValue = 0;
1641 rProp.Value >>= nValue;
1642 // #i23727# nValue can be negative
1643 aFormat.SetAbsLSpace(convertMm100ToTwip(nValue));
1645 else if (rProp.Name == UNO_NAME_SYMBOL_TEXT_DISTANCE)
1647 sal_Int32 nValue = 0;
1648 rProp.Value >>= nValue;
1649 if (nValue >= 0)
1650 aFormat.SetCharTextDistance(static_cast<short>(convertMm100ToTwip(nValue)));
1651 else
1652 bWrongArg = true;
1654 else if (rProp.Name == UNO_NAME_FIRST_LINE_OFFSET)
1656 sal_Int32 nValue = 0;
1657 rProp.Value >>= nValue;
1658 // #i23727# nValue can be positive
1659 nValue = convertMm100ToTwip(nValue);
1660 aFormat.SetFirstLineOffset(nValue);
1662 else if (rProp.Name == UNO_NAME_POSITION_AND_SPACE_MODE)
1664 sal_Int16 nValue = 0;
1665 rProp.Value >>= nValue;
1666 if ( nValue == 0 )
1668 aFormat.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
1670 else if ( nValue == 1 )
1672 aFormat.SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT );
1674 else
1676 bWrongArg = true;
1679 else if (rProp.Name == UNO_NAME_LABEL_FOLLOWED_BY)
1681 sal_Int16 nValue = 0;
1682 rProp.Value >>= nValue;
1683 if ( nValue == LabelFollow::LISTTAB )
1685 aFormat.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1687 else if ( nValue == LabelFollow::SPACE )
1689 aFormat.SetLabelFollowedBy( SvxNumberFormat::SPACE );
1691 else if ( nValue == LabelFollow::NOTHING )
1693 aFormat.SetLabelFollowedBy( SvxNumberFormat::NOTHING );
1695 else if ( nValue == LabelFollow::NEWLINE )
1697 aFormat.SetLabelFollowedBy( SvxNumberFormat::NEWLINE );
1699 else
1701 bWrongArg = true;
1704 else if (rProp.Name == UNO_NAME_LISTTAB_STOP_POSITION)
1706 sal_Int32 nValue = 0;
1707 rProp.Value >>= nValue;
1708 nValue = convertMm100ToTwip(nValue);
1709 if ( nValue >= 0 )
1711 aFormat.SetListtabPos( nValue );
1713 else
1715 bWrongArg = true;
1718 else if (rProp.Name == UNO_NAME_FIRST_LINE_INDENT)
1720 sal_Int32 nValue = 0;
1721 rProp.Value >>= nValue;
1722 nValue = convertMm100ToTwip(nValue);
1723 aFormat.SetFirstLineIndent( nValue );
1725 else if (rProp.Name == UNO_NAME_INDENT_AT)
1727 sal_Int32 nValue = 0;
1728 rProp.Value >>= nValue;
1729 nValue = convertMm100ToTwip(nValue);
1730 aFormat.SetIndentAt( nValue );
1732 else if (rProp.Name == UNO_NAME_NUMBERING_TYPE)
1734 sal_Int16 nSet = 0;
1735 rProp.Value >>= nSet;
1736 if(nSet >= 0)
1737 aFormat.SetNumberingType(static_cast<SvxNumType>(nSet));
1738 else
1739 bWrongArg = true;
1741 else if (rProp.Name == UNO_NAME_PARAGRAPH_STYLE_NAME)
1743 if (pParagraphStyleName)
1745 OUString uTmp;
1746 rProp.Value >>= uTmp;
1747 OUString sStyleName;
1748 SwStyleNameMapper::FillUIName(uTmp, sStyleName, SwGetPoolIdFromName::TxtColl );
1749 *pParagraphStyleName = sStyleName;
1752 else if (rProp.Name == UNO_NAME_BULLET_ID)
1754 sal_Int16 nSet = 0;
1755 if( rProp.Value >>= nSet )
1756 aFormat.SetBulletChar(nSet);
1757 else
1758 bWrongArg = true;
1760 else if (rProp.Name == UNO_NAME_BULLET_FONT)
1762 awt::FontDescriptor desc;
1763 if (rProp.Value >>= desc)
1765 // #i93725#
1766 // do not accept "empty" font
1767 if (!desc.Name.isEmpty())
1769 vcl::Font aFont;
1770 SvxUnoFontDescriptor::ConvertToFont(desc, aFont);
1771 aFormat.SetBulletFont(&aFont);
1774 else
1775 bWrongArg = true;
1777 else if (rProp.Name == UNO_NAME_BULLET_FONT_NAME)
1779 OUString sBulletFontName;
1780 rProp.Value >>= sBulletFontName;
1781 SwDocShell* pLclDocShell = pDoc->GetDocShell();
1782 if( !sBulletFontName.isEmpty() && pLclDocShell )
1784 const SvxFontListItem* pFontListItem =
1785 static_cast<const SvxFontListItem* >(pLclDocShell
1786 ->GetItem( SID_ATTR_CHAR_FONTLIST ));
1787 const FontList* pList = pFontListItem->GetFontList();
1788 FontMetric aFontMetric = pList->Get(
1789 sBulletFontName, WEIGHT_NORMAL, ITALIC_NONE);
1790 vcl::Font aFont(aFontMetric);
1791 aFormat.SetBulletFont(&aFont);
1793 else if (pBulletFontName)
1794 *pBulletFontName = sBulletFontName;
1796 else if (rProp.Name == UNO_NAME_BULLET_CHAR)
1798 OUString aChar;
1799 rProp.Value >>= aChar;
1800 if(aChar.getLength() == 1)
1802 aFormat.SetBulletChar(aChar.toChar());
1804 else if(aChar.isEmpty())
1806 // If w:lvlText's value is null - set bullet char to zero
1807 aFormat.SetBulletChar(u'\0');
1809 else
1811 bWrongArg = true;
1814 else if (rProp.Name == UNO_NAME_GRAPHIC)
1816 uno::Reference<graphic::XGraphic> xGraphic;
1817 if (rProp.Value >>= xGraphic)
1819 if (!pSetBrush)
1821 const SvxBrushItem* pOrigBrush = aFormat.GetBrush();
1822 if(pOrigBrush)
1823 pSetBrush.reset(new SvxBrushItem(*pOrigBrush));
1824 else
1825 pSetBrush.reset(new SvxBrushItem(OUString(), OUString(), GPOS_AREA, RES_BACKGROUND));
1827 Graphic aGraphic(xGraphic);
1828 pSetBrush->SetGraphic(aGraphic);
1830 else
1831 bWrongArg = true;
1833 else if (rProp.Name == UNO_NAME_GRAPHIC_BITMAP)
1835 uno::Reference<awt::XBitmap> xBitmap;
1836 if (rProp.Value >>= xBitmap)
1838 if(!pSetBrush)
1840 const SvxBrushItem* pOrigBrush = aFormat.GetBrush();
1841 if(pOrigBrush)
1842 pSetBrush.reset(new SvxBrushItem(*pOrigBrush));
1843 else
1844 pSetBrush.reset(new SvxBrushItem(OUString(), OUString(), GPOS_AREA, RES_BACKGROUND));
1847 uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
1848 Graphic aGraphic(xGraphic);
1849 pSetBrush->SetGraphic(aGraphic);
1851 else
1852 bWrongArg = true;
1854 else if (rProp.Name == UNO_NAME_GRAPHIC_SIZE)
1856 if(!pSetSize)
1857 pSetSize.reset(new Size);
1858 awt::Size size;
1859 if (rProp.Value >>= size)
1861 size.Width = convertMm100ToTwip(size.Width);
1862 size.Height = convertMm100ToTwip(size.Height);
1863 pSetSize->setWidth( size.Width );
1864 pSetSize->setHeight( size.Height );
1866 else
1867 bWrongArg = true;
1869 else if (rProp.Name == UNO_NAME_VERT_ORIENT)
1871 if(!pSetVOrient)
1873 if(aFormat.GetGraphicOrientation())
1874 pSetVOrient.reset( static_cast<SwFormatVertOrient*>(aFormat.GetGraphicOrientation()->Clone()) );
1875 else
1876 pSetVOrient.reset(new SwFormatVertOrient);
1878 pSetVOrient->PutValue(rProp.Value, MID_VERTORIENT_ORIENT);
1880 else if (rProp.Name == UNO_NAME_HEADING_STYLE_NAME)
1882 if (pHeadingStyleName)
1884 OUString uTmp;
1885 rProp.Value >>= uTmp;
1886 OUString sStyleName;
1887 SwStyleNameMapper::FillUIName(uTmp, sStyleName, SwGetPoolIdFromName::TxtColl );
1888 *pHeadingStyleName = sStyleName;
1891 else if (rProp.Name == UNO_NAME_BULLET_REL_SIZE)
1893 // BulletRelSize - unsupported - only available in Impress
1895 else if (rProp.Name == UNO_NAME_BULLET_COLOR)
1897 // BulletColor - ignored too
1899 else if (rProp.Name == UNO_NAME_GRAPHIC_URL)
1901 OUString aURL;
1902 if (rProp.Value >>= aURL)
1904 if(!pSetBrush)
1906 const SvxBrushItem* pOrigBrush = aFormat.GetBrush();
1907 if(pOrigBrush)
1908 pSetBrush.reset(new SvxBrushItem(*pOrigBrush));
1909 else
1910 pSetBrush.reset(new SvxBrushItem(OUString(), OUString(), GPOS_AREA, RES_BACKGROUND));
1913 Graphic aGraphic = vcl::graphic::loadFromURL(aURL);
1914 if (!aGraphic.IsNone())
1915 pSetBrush->SetGraphic(aGraphic);
1917 else
1918 bWrongArg = true;
1920 else if (rProp.Name == UNO_NAME_LIST_FORMAT)
1922 OUString uTmp;
1923 rProp.Value >>= uTmp;
1924 aFormat.SetListFormat(uTmp);
1926 else
1928 // Invalid property name
1929 SAL_WARN("sw.uno", "Unknown/incorrect property " << rProp.Name << ", failing");
1930 throw uno::RuntimeException("Unknown/incorrect property " + rProp.Name);
1933 if(!bWrongArg && (pSetBrush || pSetSize || pSetVOrient))
1935 if(!pSetBrush && aFormat.GetBrush())
1936 pSetBrush.reset(new SvxBrushItem(*aFormat.GetBrush()));
1938 if(pSetBrush)
1940 if(!pSetVOrient && aFormat.GetGraphicOrientation())
1941 pSetVOrient.reset( new SwFormatVertOrient(*aFormat.GetGraphicOrientation()) );
1943 if(!pSetSize)
1945 pSetSize.reset(new Size(aFormat.GetGraphicSize()));
1946 if(!pSetSize->Width() || !pSetSize->Height())
1948 const Graphic* pGraphic = pSetBrush->GetGraphic();
1949 if(pGraphic)
1950 *pSetSize = ::GetGraphicSizeTwip(*pGraphic, nullptr);
1953 sal_Int16 eOrient = pSetVOrient ?
1954 pSetVOrient->GetVertOrient() : text::VertOrientation::NONE;
1955 aFormat.SetGraphicBrush( pSetBrush.get(), pSetSize.get(), text::VertOrientation::NONE == eOrient ? nullptr : &eOrient );
1958 if ((!bCharStyleNameSet || rCharStyleName.isEmpty())
1959 && aFormat.GetNumberingType() == NumberingType::BITMAP
1960 && !aFormat.GetCharFormat()
1961 && !SwXNumberingRules::isInvalidStyle(rCharStyleName))
1963 OUString tmp;
1964 SwStyleNameMapper::FillProgName(RES_POOLCHR_BUL_LEVEL, tmp);
1965 rCharStyleName = tmp;
1968 if(bWrongArg)
1969 throw lang::IllegalArgumentException();
1972 uno::Reference< XPropertySetInfo > SwXNumberingRules::getPropertySetInfo()
1974 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo();
1975 return aRef;
1978 void SwXNumberingRules::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
1980 SolarMutexGuard aGuard;
1981 std::unique_ptr<SwNumRule> pDocRule;
1982 SwNumRule* pCreatedRule = nullptr;
1983 if(!m_pNumRule)
1985 if(m_pDocShell)
1987 pDocRule.reset(new SwNumRule(*m_pDocShell->GetDoc()->GetOutlineNumRule()));
1989 else if(m_pDoc && !m_sCreatedNumRuleName.isEmpty())
1991 pCreatedRule = m_pDoc->FindNumRulePtr(m_sCreatedNumRuleName);
1995 if(!m_pNumRule && !pDocRule && !pCreatedRule)
1996 throw RuntimeException();
1998 if(rPropertyName == UNO_NAME_IS_AUTOMATIC)
2000 bool bVal = *o3tl::doAccess<bool>(rValue);
2001 if(!pCreatedRule)
2002 pDocRule ? pDocRule->SetAutoRule(bVal) : m_pNumRule->SetAutoRule(bVal);
2004 else if(rPropertyName == UNO_NAME_IS_CONTINUOUS_NUMBERING)
2006 bool bVal = *o3tl::doAccess<bool>(rValue);
2007 pDocRule ? pDocRule->SetContinusNum(bVal) :
2008 pCreatedRule ? pCreatedRule->SetContinusNum(bVal) : m_pNumRule->SetContinusNum(bVal);
2010 else if(rPropertyName == UNO_NAME_NAME)
2012 throw IllegalArgumentException();
2014 else if(rPropertyName == UNO_NAME_IS_ABSOLUTE_MARGINS)
2016 bool bVal = *o3tl::doAccess<bool>(rValue);
2017 pDocRule ? pDocRule->SetAbsSpaces(bVal) :
2018 pCreatedRule ? pCreatedRule->SetAbsSpaces(bVal) : m_pNumRule->SetAbsSpaces(bVal);
2020 else if(rPropertyName == UNO_NAME_NUMBERING_IS_OUTLINE)
2022 bool bVal = *o3tl::doAccess<bool>(rValue);
2023 SwNumRuleType eNumRuleType = bVal ? OUTLINE_RULE : NUM_RULE;
2024 pDocRule ? pDocRule->SetRuleType(eNumRuleType) :
2025 pCreatedRule ? pCreatedRule->SetRuleType(eNumRuleType) : m_pNumRule->SetRuleType(eNumRuleType);
2027 else if(rPropertyName == UNO_NAME_DEFAULT_LIST_ID)
2029 throw IllegalArgumentException();
2031 else
2032 throw UnknownPropertyException(rPropertyName);
2034 if(pDocRule)
2036 assert(m_pDocShell);
2037 m_pDocShell->GetDoc()->SetOutlineNumRule(*pDocRule);
2038 pDocRule.reset();
2040 else if(pCreatedRule)
2042 pCreatedRule->Validate();
2046 Any SwXNumberingRules::getPropertyValue( const OUString& rPropertyName )
2048 Any aRet;
2049 const SwNumRule* pRule = m_pNumRule;
2050 if(!pRule && m_pDocShell)
2051 pRule = m_pDocShell->GetDoc()->GetOutlineNumRule();
2052 else if(m_pDoc && !m_sCreatedNumRuleName.isEmpty())
2053 pRule = m_pDoc->FindNumRulePtr( m_sCreatedNumRuleName );
2054 if(!pRule)
2055 throw RuntimeException();
2057 if(rPropertyName == UNO_NAME_IS_AUTOMATIC)
2059 aRet <<= pRule->IsAutoRule();
2061 else if(rPropertyName == UNO_NAME_IS_CONTINUOUS_NUMBERING)
2063 aRet <<= pRule->IsContinusNum();
2065 else if(rPropertyName == UNO_NAME_NAME)
2066 aRet <<= pRule->GetName();
2067 else if(rPropertyName == UNO_NAME_IS_ABSOLUTE_MARGINS)
2069 aRet <<= pRule->IsAbsSpaces();
2071 else if(rPropertyName == UNO_NAME_NUMBERING_IS_OUTLINE)
2073 aRet <<= pRule->IsOutlineRule();
2075 else if(rPropertyName == UNO_NAME_DEFAULT_LIST_ID)
2077 OSL_ENSURE( !pRule->GetDefaultListId().isEmpty(),
2078 "<SwXNumberingRules::getPropertyValue(..)> - no default list id found. Serious defect." );
2079 aRet <<= pRule->GetDefaultListId();
2081 else
2082 throw UnknownPropertyException(rPropertyName);
2083 return aRet;
2086 void SwXNumberingRules::addPropertyChangeListener(
2087 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
2091 void SwXNumberingRules::removePropertyChangeListener(
2092 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
2096 void SwXNumberingRules::addVetoableChangeListener(
2097 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
2101 void SwXNumberingRules::removeVetoableChangeListener(
2102 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
2106 OUString SwXNumberingRules::getName()
2108 if(m_pNumRule)
2110 OUString aString;
2111 SwStyleNameMapper::FillProgName(m_pNumRule->GetName(), aString, SwGetPoolIdFromName::NumRule );
2112 return aString;
2114 // consider chapter numbering <SwXNumberingRules>
2115 if ( m_pDocShell )
2117 OUString aString;
2118 SwStyleNameMapper::FillProgName( m_pDocShell->GetDoc()->GetOutlineNumRule()->GetName(),
2119 aString, SwGetPoolIdFromName::NumRule );
2120 return aString;
2122 return m_sCreatedNumRuleName;
2125 void SwXNumberingRules::setName(const OUString& /*rName*/)
2127 RuntimeException aExcept;
2128 aExcept.Message = "readonly";
2129 throw aExcept;
2132 void SwXNumberingRules::Impl::Notify(const SfxHint& rHint)
2134 if(rHint.GetId() == SfxHintId::Dying)
2136 if(m_rParent.m_bOwnNumRuleCreated)
2137 delete m_rParent.m_pNumRule;
2138 m_rParent.m_pNumRule = nullptr;
2139 m_rParent.m_pDoc = nullptr;
2143 OUString SwXChapterNumbering::getImplementationName()
2145 return "SwXChapterNumbering";
2148 sal_Bool SwXChapterNumbering::supportsService(const OUString& rServiceName)
2150 return cppu::supportsService(this, rServiceName);
2153 Sequence< OUString > SwXChapterNumbering::getSupportedServiceNames()
2155 return { "com.sun.star.text.ChapterNumbering", "com.sun.star.text.NumberingRules" };
2158 SwXChapterNumbering::SwXChapterNumbering(SwDocShell& rDocSh) :
2159 SwXNumberingRules(rDocSh)
2163 SwXChapterNumbering::~SwXChapterNumbering()
2167 OUString SwXTextColumns::getImplementationName()
2169 return "SwXTextColumns";
2172 sal_Bool SwXTextColumns::supportsService(const OUString& rServiceName)
2174 return cppu::supportsService(this, rServiceName);
2177 Sequence< OUString > SwXTextColumns::getSupportedServiceNames()
2179 Sequence<OUString> aRet { "com.sun.star.text.TextColumns" };
2180 return aRet;
2183 SwXTextColumns::SwXTextColumns() :
2184 m_nReference(0),
2185 m_bIsAutomaticWidth(true),
2186 m_nAutoDistance(0),
2187 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS)),
2188 m_nSepLineWidth(0),
2189 m_nSepLineColor(0), //black
2190 m_nSepLineHeightRelative(100),//full height
2191 m_nSepLineVertAlign(style::VerticalAlignment_MIDDLE),
2192 m_bSepLineIsOn(false),
2193 m_nSepLineStyle(API_COL_LINE_NONE) // None
2197 SwXTextColumns::SwXTextColumns(const SwFormatCol& rFormatCol) :
2198 m_nReference(0),
2199 m_aTextColumns(rFormatCol.GetNumCols()),
2200 m_bIsAutomaticWidth(rFormatCol.IsOrtho()),
2201 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS))
2203 const sal_uInt16 nItemGutterWidth = rFormatCol.GetGutterWidth();
2204 m_nAutoDistance = m_bIsAutomaticWidth ?
2205 USHRT_MAX == nItemGutterWidth ? DEF_GUTTER_WIDTH : static_cast<sal_Int32>(nItemGutterWidth)
2206 : 0;
2207 m_nAutoDistance = convertTwipToMm100(m_nAutoDistance);
2209 TextColumn* pColumns = m_aTextColumns.getArray();
2210 const SwColumns& rCols = rFormatCol.GetColumns();
2211 for(sal_Int32 i = 0; i < m_aTextColumns.getLength(); ++i)
2213 const SwColumn* pCol = &rCols[i];
2215 pColumns[i].Width = pCol->GetWishWidth();
2216 m_nReference += pColumns[i].Width;
2217 pColumns[i].LeftMargin = convertTwipToMm100(pCol->GetLeft ());
2218 pColumns[i].RightMargin = convertTwipToMm100(pCol->GetRight());
2220 if(!m_aTextColumns.hasElements())
2221 m_nReference = USHRT_MAX;
2223 m_nSepLineWidth = rFormatCol.GetLineWidth();
2224 m_nSepLineColor = rFormatCol.GetLineColor();
2225 m_nSepLineHeightRelative = rFormatCol.GetLineHeight();
2226 m_bSepLineIsOn = rFormatCol.GetLineAdj() != COLADJ_NONE;
2227 sal_Int8 nStyle = API_COL_LINE_NONE;
2228 switch (rFormatCol.GetLineStyle())
2230 case SvxBorderLineStyle::SOLID: nStyle = API_COL_LINE_SOLID; break;
2231 case SvxBorderLineStyle::DOTTED: nStyle= API_COL_LINE_DOTTED; break;
2232 case SvxBorderLineStyle::DASHED: nStyle= API_COL_LINE_DASHED; break;
2233 default: break;
2235 m_nSepLineStyle = nStyle;
2236 switch(rFormatCol.GetLineAdj())
2238 case COLADJ_TOP: m_nSepLineVertAlign = style::VerticalAlignment_TOP; break;
2239 case COLADJ_BOTTOM: m_nSepLineVertAlign = style::VerticalAlignment_BOTTOM; break;
2240 case COLADJ_CENTER:
2241 case COLADJ_NONE: m_nSepLineVertAlign = style::VerticalAlignment_MIDDLE;
2245 SwXTextColumns::~SwXTextColumns()
2249 sal_Int32 SwXTextColumns::getReferenceValue()
2251 SolarMutexGuard aGuard;
2252 return m_nReference;
2255 sal_Int16 SwXTextColumns::getColumnCount()
2257 SolarMutexGuard aGuard;
2258 return static_cast< sal_Int16>( m_aTextColumns.getLength() );
2261 void SwXTextColumns::setColumnCount(sal_Int16 nColumns)
2263 SolarMutexGuard aGuard;
2264 if(nColumns <= 0)
2265 throw uno::RuntimeException();
2266 m_bIsAutomaticWidth = true;
2267 m_aTextColumns.realloc(nColumns);
2268 TextColumn* pCols = m_aTextColumns.getArray();
2269 m_nReference = USHRT_MAX;
2270 sal_Int32 nWidth = m_nReference / nColumns;
2271 sal_Int32 nDiff = m_nReference - nWidth * nColumns;
2272 sal_Int32 nDist = m_nAutoDistance / 2;
2273 for(sal_Int16 i = 0; i < nColumns; i++)
2275 pCols[i].Width = nWidth;
2276 pCols[i].LeftMargin = i == 0 ? 0 : nDist;
2277 pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
2279 pCols[nColumns - 1].Width += nDiff;
2282 uno::Sequence< TextColumn > SwXTextColumns::getColumns()
2284 SolarMutexGuard aGuard;
2285 return m_aTextColumns;
2288 void SwXTextColumns::setColumns(const uno::Sequence< TextColumn >& rColumns)
2290 SolarMutexGuard aGuard;
2291 sal_Int32 nReferenceTemp = std::accumulate(rColumns.begin(), rColumns.end(), sal_Int32(0),
2292 [](const sal_Int32 nSum, const TextColumn& rCol) { return nSum + rCol.Width; });
2293 m_bIsAutomaticWidth = false;
2294 m_nReference = !nReferenceTemp ? USHRT_MAX : nReferenceTemp;
2295 m_aTextColumns = rColumns;
2298 uno::Reference< XPropertySetInfo > SwXTextColumns::getPropertySetInfo( )
2300 static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
2301 return aRef;
2304 void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
2306 const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
2307 if (!pEntry)
2308 throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2309 if ( pEntry->nFlags & PropertyAttribute::READONLY)
2310 throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2312 switch(pEntry->nWID)
2314 case WID_TXTCOL_LINE_WIDTH:
2316 sal_Int32 nTmp = 0;
2317 aValue >>= nTmp;
2318 if(nTmp < 0)
2319 throw IllegalArgumentException();
2320 m_nSepLineWidth = convertMm100ToTwip(nTmp);
2322 break;
2323 case WID_TXTCOL_LINE_COLOR:
2324 aValue >>= m_nSepLineColor;
2325 break;
2326 case WID_TXTCOL_LINE_STYLE:
2328 aValue >>= m_nSepLineStyle;
2330 break;
2331 case WID_TXTCOL_LINE_REL_HGT:
2333 sal_Int8 nTmp = 0;
2334 aValue >>= nTmp;
2335 if(nTmp < 0)
2336 throw IllegalArgumentException();
2337 m_nSepLineHeightRelative = nTmp;
2339 break;
2340 case WID_TXTCOL_LINE_ALIGN:
2342 style::VerticalAlignment eAlign;
2343 if(!(aValue >>= eAlign) )
2345 sal_Int8 nTmp = 0;
2346 if (! ( aValue >>= nTmp ) )
2347 throw IllegalArgumentException();
2348 m_nSepLineVertAlign = static_cast<style::VerticalAlignment>(nTmp);
2350 else
2351 m_nSepLineVertAlign = eAlign;
2353 break;
2354 case WID_TXTCOL_LINE_IS_ON:
2355 m_bSepLineIsOn = *o3tl::doAccess<bool>(aValue);
2356 break;
2357 case WID_TXTCOL_AUTO_DISTANCE:
2359 sal_Int32 nTmp = 0;
2360 aValue >>= nTmp;
2361 if(nTmp < 0 || nTmp >= m_nReference)
2362 throw IllegalArgumentException();
2363 m_nAutoDistance = nTmp;
2364 sal_Int32 nColumns = m_aTextColumns.getLength();
2365 TextColumn* pCols = m_aTextColumns.getArray();
2366 sal_Int32 nDist = m_nAutoDistance / 2;
2367 for(sal_Int32 i = 0; i < nColumns; i++)
2369 pCols[i].LeftMargin = i == 0 ? 0 : nDist;
2370 pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
2373 break;
2377 Any SwXTextColumns::getPropertyValue( const OUString& rPropertyName )
2379 const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
2380 if (!pEntry)
2381 throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
2383 Any aRet;
2384 switch(pEntry->nWID)
2386 case WID_TXTCOL_LINE_WIDTH:
2387 aRet <<= static_cast < sal_Int32 >(convertTwipToMm100(m_nSepLineWidth));
2388 break;
2389 case WID_TXTCOL_LINE_COLOR:
2390 aRet <<= m_nSepLineColor;
2391 break;
2392 case WID_TXTCOL_LINE_STYLE:
2393 aRet <<= m_nSepLineStyle;
2394 break;
2395 case WID_TXTCOL_LINE_REL_HGT:
2396 aRet <<= m_nSepLineHeightRelative;
2397 break;
2398 case WID_TXTCOL_LINE_ALIGN:
2399 aRet <<= m_nSepLineVertAlign;
2400 break;
2401 case WID_TXTCOL_LINE_IS_ON:
2402 aRet <<= m_bSepLineIsOn;
2403 break;
2404 case WID_TXTCOL_IS_AUTOMATIC :
2405 aRet <<= m_bIsAutomaticWidth;
2406 break;
2407 case WID_TXTCOL_AUTO_DISTANCE:
2408 aRet <<= m_nAutoDistance;
2409 break;
2411 return aRet;
2414 void SwXTextColumns::addPropertyChangeListener(
2415 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
2419 void SwXTextColumns::removePropertyChangeListener(
2420 const OUString& /*rPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
2424 void SwXTextColumns::addVetoableChangeListener(
2425 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
2429 void SwXTextColumns::removeVetoableChangeListener(
2430 const OUString& /*rPropertyName*/, const uno::Reference< XVetoableChangeListener >& /*xListener*/ )
2434 namespace
2436 class theSwXTextColumnsUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXTextColumnsUnoTunnelId > {};
2439 const uno::Sequence< sal_Int8 > & SwXTextColumns::getUnoTunnelId()
2441 return theSwXTextColumnsUnoTunnelId::get().getSeq();
2444 sal_Int64 SAL_CALL SwXTextColumns::getSomething( const uno::Sequence< sal_Int8 >& rId )
2446 if( isUnoTunnelId<SwXTextColumns>(rId) )
2448 return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
2450 return 0;
2453 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */