LibreOffice Module sw (master) 1
unostyle.cxx
Go to the documentation of this file.
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 <sal/config.h>
21
22#include <o3tl/safeint.hxx>
23#include <o3tl/string_view.hxx>
25#include <hintids.hxx>
26#include <utility>
27#include <vcl/svapp.hxx>
28#include <svl/hint.hxx>
29#include <svtools/ctrltool.hxx>
30#include <svl/style.hxx>
31#include <svl/itemiter.hxx>
32#include <svl/listener.hxx>
33#include <svl/numformat.hxx>
34#include <svl/zforlist.hxx>
35#include <svl/zformat.hxx>
36#include <svx/pageitem.hxx>
37#include <editeng/colritem.hxx>
40#include <editeng/fontitem.hxx>
41#include <editeng/sizeitem.hxx>
42#include <editeng/udlnitem.hxx>
43#include <editeng/ulspitem.hxx>
44#include <editeng/lrspitem.hxx>
45#include <editeng/boxitem.hxx>
46#include <editeng/postitem.hxx>
47#include <editeng/shdditem.hxx>
48#include <editeng/brushitem.hxx>
49#include <editeng/flstitem.hxx>
50#include <editeng/fhgtitem.hxx>
51#include <editeng/paperinf.hxx>
52#include <editeng/wghtitem.hxx>
53
54#include <autostyle_helper.hxx>
55#include <pagedesc.hxx>
56#include <doc.hxx>
57#include <IDocumentUndoRedo.hxx>
60#include <docary.hxx>
61#include <charfmt.hxx>
62#include <cmdid.h>
63#include <unomid.h>
64#include <unomap.hxx>
65#include <unostyle.hxx>
66#include <unosett.hxx>
67#include <docsh.hxx>
68#include <paratr.hxx>
69#include <unoprnms.hxx>
70#include <shellio.hxx>
71#include <docstyle.hxx>
72#include <unotextbodyhf.hxx>
73#include <fmthdft.hxx>
74#include <fmtpdsc.hxx>
75#include <strings.hrc>
76#include <poolfmt.hxx>
77#include <unoevent.hxx>
78#include <fmtruby.hxx>
79#include <SwStyleNameMapper.hxx>
80#include <sfx2/printer.hxx>
81#include <com/sun/star/frame/XModel.hpp>
82#include <com/sun/star/io/IOException.hpp>
83#include <com/sun/star/style/ParagraphStyleCategory.hpp>
84#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
85#include <com/sun/star/beans/PropertyAttribute.hpp>
86#include <com/sun/star/beans/NamedValue.hpp>
87#include <com/sun/star/drawing/BitmapMode.hpp>
88#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
89#include <com/sun/star/lang/IllegalArgumentException.hpp>
90#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
91#include <com/sun/star/document/XEventsSupplier.hpp>
92#include <com/sun/star/io/XInputStream.hpp>
93#include <istyleaccess.hxx>
94#include <fmtfsize.hxx>
95#include <numrule.hxx>
96#include <tblafmt.hxx>
97#include <frameformats.hxx>
98
100#include <cppuhelper/exc_hlp.hxx>
104#include <sal/log.hxx>
105
106#include <svl/stylepool.hxx>
108#include <editeng/unoipset.hxx>
109#include <editeng/memberids.h>
110#include <svx/unomid.hxx>
111#include <svx/unoshape.hxx>
112#include <svx/xflbstit.hxx>
113#include <svx/xflbmtit.hxx>
114#include <swunohelper.hxx>
115#include <svx/xbtmpit.hxx>
116
117#include <ccoll.hxx>
118#include <hints.hxx>
119#include <uiitems.hxx>
120
121#include <cassert>
122#include <memory>
123#include <set>
124#include <string_view>
125#include <limits>
126
127using namespace css;
128using namespace css::io;
129using namespace css::lang;
130using namespace css::uno;
131
132namespace {
133
134 // these should really be constexprs, but MSVC still is apparently too stupid for them
135 #define nPoolChrNormalRange (RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN)
136 #define nPoolChrHtmlRange (RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN)
137 #define nPoolCollTextRange ( RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN)
138 #define nPoolCollListsRange ( RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN)
139 #define nPoolCollExtraRange ( RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN)
140 #define nPoolCollRegisterRange ( RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN)
141 #define nPoolCollDocRange ( RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN)
142 #define nPoolCollHtmlRange ( RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN)
143 #define nPoolFrameRange ( RES_POOLFRM_END - RES_POOLFRM_BEGIN)
144 #define nPoolPageRange ( RES_POOLPAGE_END - RES_POOLPAGE_BEGIN)
145 #define nPoolNumRange ( RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN)
146 #define nPoolCollListsStackedStart ( nPoolCollTextRange)
147 #define nPoolCollExtraStackedStart ( nPoolCollListsStackedStart + nPoolCollListsRange)
148 #define nPoolCollRegisterStackedStart ( nPoolCollExtraStackedStart + nPoolCollExtraRange)
149 #define nPoolCollDocStackedStart ( nPoolCollRegisterStackedStart + nPoolCollRegisterRange)
150 #define nPoolCollHtmlStackedStart ( nPoolCollDocStackedStart + nPoolCollDocRange)
151 using paragraphstyle_t = std::remove_const<decltype(style::ParagraphStyleCategory::TEXT)>::type;
152 using collectionbits_t = sal_uInt16;
153 struct ParagraphStyleCategoryEntry
154 {
155 paragraphstyle_t m_eCategory;
156 SfxStyleSearchBits m_nSwStyleBits;
157 collectionbits_t m_nCollectionBits;
158 constexpr ParagraphStyleCategoryEntry(paragraphstyle_t eCategory, SfxStyleSearchBits nSwStyleBits, collectionbits_t nCollectionBits)
159 : m_eCategory(eCategory)
160 , m_nSwStyleBits(nSwStyleBits)
161 , m_nCollectionBits(nCollectionBits)
162 { }
163 };
164
165constexpr ParagraphStyleCategoryEntry sParagraphStyleCategoryEntries[]
166{
167 { style::ParagraphStyleCategory::TEXT, SfxStyleSearchBits::SwText, COLL_TEXT_BITS },
168 { style::ParagraphStyleCategory::CHAPTER, SfxStyleSearchBits::SwChapter, COLL_DOC_BITS },
169 { style::ParagraphStyleCategory::LIST, SfxStyleSearchBits::SwList, COLL_LISTS_BITS },
170 { style::ParagraphStyleCategory::INDEX, SfxStyleSearchBits::SwIndex, COLL_REGISTER_BITS },
171 { style::ParagraphStyleCategory::EXTRA, SfxStyleSearchBits::SwExtra, COLL_EXTRA_BITS },
172 { style::ParagraphStyleCategory::HTML, SfxStyleSearchBits::SwHtml, COLL_HTML_BITS }
173};
174
175class StyleFamilyEntry
176{
177public:
178 template <SfxStyleFamily f> static StyleFamilyEntry Create(sal_uInt16 nPropMapType, SwGetPoolIdFromName aPoolId, OUString sName, TranslateId pResId)
179 {
180 return StyleFamilyEntry(f, nPropMapType, aPoolId, sName, pResId, GetCountOrName<f>, CreateStyle<f>, TranslateIndex<f>);
181 }
182
183 SfxStyleFamily family() const { return m_eFamily; }
184 sal_uInt16 propMapType() const { return m_nPropMapType; }
185 const uno::Reference<beans::XPropertySetInfo>& xPSInfo() const { return m_xPSInfo; }
186 SwGetPoolIdFromName poolId() const { return m_aPoolId; }
187 const OUString& name() const { return m_sName; }
188 const TranslateId& resId() const { return m_pResId; }
189
190 sal_Int32 getCountOrName(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex) const { return m_fGetCountOrName(rDoc, pString, nIndex); }
191 css::uno::Reference<css::style::XStyle> createStyle(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& sStyleName) const { return m_fCreateStyle(pBasePool, pDocShell, sStyleName); }
192 sal_uInt16 translateIndex(const sal_uInt16 nIndex) const { return m_fTranslateIndex(nIndex); }
193
194private:
195 using GetCountOrName_t = sal_Int32 (*)(const SwDoc&, OUString*, sal_Int32);
196 using CreateStyle_t = uno::Reference<css::style::XStyle>(*)(SfxStyleSheetBasePool*, SwDocShell*, const OUString&);
197 using TranslateIndex_t = sal_uInt16(*)(const sal_uInt16);
198 SfxStyleFamily m_eFamily;
199 sal_uInt16 m_nPropMapType;
200 uno::Reference<beans::XPropertySetInfo> m_xPSInfo;
201 SwGetPoolIdFromName m_aPoolId;
202 OUString m_sName;
203 TranslateId m_pResId;
204 GetCountOrName_t m_fGetCountOrName;
205 CreateStyle_t m_fCreateStyle;
206 TranslateIndex_t m_fTranslateIndex;
207 StyleFamilyEntry(SfxStyleFamily eFamily, sal_uInt16 nPropMapType, SwGetPoolIdFromName aPoolId, OUString sName, TranslateId pResId, GetCountOrName_t fGetCountOrName, CreateStyle_t fCreateStyle, TranslateIndex_t fTranslateIndex)
208 : m_eFamily(eFamily)
209 , m_nPropMapType(nPropMapType)
210 , m_xPSInfo(aSwMapProvider.GetPropertySet(nPropMapType)->getPropertySetInfo())
211 , m_aPoolId(aPoolId)
212 , m_sName(std::move(sName))
213 , m_pResId(pResId)
214 , m_fGetCountOrName(fGetCountOrName)
215 , m_fCreateStyle(fCreateStyle)
216 , m_fTranslateIndex(fTranslateIndex)
217 { }
218 template<SfxStyleFamily> static inline sal_Int32 GetCountOrName(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex);
219 template<SfxStyleFamily> static inline css::uno::Reference<css::style::XStyle> CreateStyle(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& sStyleName);
220 template<SfxStyleFamily> static inline sal_uInt16 TranslateIndex(const sal_uInt16 nIndex) { return nIndex; }
221};
222
223template<>
224sal_Int32 StyleFamilyEntry::GetCountOrName<SfxStyleFamily::Char>(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex)
225{
226 const sal_uInt16 nBaseCount = nPoolChrHtmlRange + nPoolChrNormalRange;
227 nIndex -= nBaseCount;
228 sal_Int32 nCount = 0;
229 for(auto pFormat : *rDoc.GetCharFormats())
230 {
231 if(pFormat->IsDefault() && pFormat != rDoc.GetDfltCharFormat())
232 continue;
233 if(!IsPoolUserFormat(pFormat->GetPoolFormatId()))
234 continue;
235 if(nIndex == nCount)
236 {
237 // the default character format needs to be set to "Default!"
238 if(rDoc.GetDfltCharFormat() == pFormat)
239 *pString = SwResId(STR_POOLCHR_STANDARD);
240 else
241 *pString = pFormat->GetName();
242 break;
243 }
244 ++nCount;
245 }
246 return nCount + nBaseCount;
247}
248
249template<>
250sal_Int32 StyleFamilyEntry::GetCountOrName<SfxStyleFamily::Para>(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex)
251{
252 const sal_uInt16 nBaseCount = nPoolCollHtmlStackedStart + nPoolCollHtmlRange;
253 nIndex -= nBaseCount;
254 sal_Int32 nCount = 0;
255 for(auto pColl : *rDoc.GetTextFormatColls())
256 {
257 if(pColl->IsDefault())
258 continue;
259 if(!IsPoolUserFormat(pColl->GetPoolFormatId()))
260 continue;
261 if(nIndex == nCount)
262 {
263 *pString = pColl->GetName();
264 break;
265 }
266 ++nCount;
267 }
268 return nCount + nBaseCount;
269}
270
271template<>
272sal_Int32 StyleFamilyEntry::GetCountOrName<SfxStyleFamily::Frame>(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex)
273{
275 sal_Int32 nCount = 0;
276 for(const auto pFormat : *rDoc.GetFrameFormats())
277 {
278 if(pFormat->IsDefault() || pFormat->IsAuto())
279 continue;
280 if(!IsPoolUserFormat(pFormat->GetPoolFormatId()))
281 continue;
282 if(nIndex == nCount)
283 {
284 *pString = pFormat->GetName();
285 break;
286 }
287 ++nCount;
288 }
289 return nCount + nPoolFrameRange;
290}
291
292template<>
293sal_Int32 StyleFamilyEntry::GetCountOrName<SfxStyleFamily::Page>(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex)
294{
296 sal_Int32 nCount = 0;
297 const size_t nArrLen = rDoc.GetPageDescCnt();
298 for(size_t i = 0; i < nArrLen; ++i)
299 {
300 const SwPageDesc& rDesc = rDoc.GetPageDesc(i);
302 continue;
303 if(nIndex == nCount)
304 {
305 *pString = rDesc.GetName();
306 break;
307 }
308 ++nCount;
309 }
311 return nCount;
312}
313
314template<>
315sal_Int32 StyleFamilyEntry::GetCountOrName<SfxStyleFamily::Pseudo>(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex)
316{
318 sal_Int32 nCount = 0;
319 for(const auto pRule : rDoc.GetNumRuleTable())
320 {
321 if(pRule->IsAutoRule())
322 continue;
323 if(!IsPoolUserFormat(pRule->GetPoolFormatId()))
324 continue;
325 if(nIndex == nCount)
326 {
327 *pString = pRule->GetName();
328 break;
329 }
330 ++nCount;
331 }
332 return nCount + nPoolNumRange;
333}
334
335template<>
336sal_Int32 StyleFamilyEntry::GetCountOrName<SfxStyleFamily::Table>(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex)
337{
338 if (!rDoc.HasTableStyles())
339 return 0;
340
341 const auto pAutoFormats = &rDoc.GetTableStyles();
342 const sal_Int32 nCount = pAutoFormats->size();
343 if (0 <= nIndex && nIndex < nCount)
344 *pString = pAutoFormats->operator[](nIndex).GetName();
345
346 return nCount;
347}
348
349template<>
350sal_Int32 StyleFamilyEntry::GetCountOrName<SfxStyleFamily::Cell>(const SwDoc& rDoc, OUString* pString, sal_Int32 nIndex)
351{
352 const auto& rAutoFormats = rDoc.GetTableStyles();
353 const auto& rTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
354 const sal_Int32 nUsedCellStylesCount = rAutoFormats.size() * rTableTemplateMap.size();
355 const sal_Int32 nCount = nUsedCellStylesCount + rDoc.GetCellStyles().size();
356 if (0 <= nIndex && nIndex < nCount)
357 {
358 if (nUsedCellStylesCount > nIndex)
359 {
360 const sal_Int32 nAutoFormat = nIndex / rTableTemplateMap.size();
361 const sal_Int32 nBoxFormat = rTableTemplateMap[nIndex % rTableTemplateMap.size()];
362 const SwTableAutoFormat& rTableFormat = rAutoFormats[nAutoFormat];
364 *pString += rTableFormat.GetTableTemplateCellSubName(rTableFormat.GetBoxFormat(nBoxFormat));
365 }
366 else
367 *pString = rDoc.GetCellStyles()[nIndex-nUsedCellStylesCount].GetName();
368 }
369 return nCount;
370}
371
372template<>
373sal_uInt16 StyleFamilyEntry::TranslateIndex<SfxStyleFamily::Char>(const sal_uInt16 nIndex)
374{
375 static_assert(nPoolChrNormalRange > 0 && nPoolChrHtmlRange > 0, "invalid pool range");
376 if (nIndex < nPoolChrNormalRange)
378 else if (nIndex < (nPoolChrHtmlRange + nPoolChrNormalRange))
380 throw lang::IndexOutOfBoundsException();
381}
382
383template<>
384sal_uInt16 StyleFamilyEntry::TranslateIndex<SfxStyleFamily::Para>(const sal_uInt16 nIndex)
385{
386 static_assert(nPoolCollTextRange > 0 && nPoolCollListsRange > 0 && nPoolCollExtraRange > 0 && nPoolCollRegisterRange > 0 && nPoolCollDocRange > 0 && nPoolCollHtmlRange > 0, "weird pool range");
387 if (nIndex < nPoolCollListsStackedStart)
389 else if (nIndex < nPoolCollExtraStackedStart)
391 else if (nIndex < nPoolCollRegisterStackedStart)
393 else if (nIndex < nPoolCollDocStackedStart)
395 else if (nIndex < nPoolCollHtmlStackedStart)
399 throw lang::IndexOutOfBoundsException();
400}
401
402template<>
403sal_uInt16 StyleFamilyEntry::TranslateIndex<SfxStyleFamily::Page>(const sal_uInt16 nIndex)
404{
405 if (nIndex < nPoolPageRange)
406 return nIndex + RES_POOLPAGE_BEGIN;
407 throw lang::IndexOutOfBoundsException();
408}
409
410template<>
411sal_uInt16 StyleFamilyEntry::TranslateIndex<SfxStyleFamily::Frame>(const sal_uInt16 nIndex)
412{
413 if (nIndex < nPoolFrameRange)
414 return nIndex + RES_POOLFRM_BEGIN;
415 throw lang::IndexOutOfBoundsException();
416}
417
418template<>
419sal_uInt16 StyleFamilyEntry::TranslateIndex<SfxStyleFamily::Pseudo>(const sal_uInt16 nIndex)
420{
421 if (nIndex < nPoolNumRange)
423 throw lang::IndexOutOfBoundsException();
424}
425
426const std::vector<StyleFamilyEntry>& lcl_GetStyleFamilyEntries()
427{
428 static const std::vector<StyleFamilyEntry> our_pStyleFamilyEntries{
429 StyleFamilyEntry::Create<SfxStyleFamily::Char> (PROPERTY_MAP_CHAR_STYLE, SwGetPoolIdFromName::ChrFmt, "CharacterStyles", STR_STYLE_FAMILY_CHARACTER),
430 StyleFamilyEntry::Create<SfxStyleFamily::Para> (PROPERTY_MAP_PARA_STYLE, SwGetPoolIdFromName::TxtColl, "ParagraphStyles", STR_STYLE_FAMILY_PARAGRAPH),
431 StyleFamilyEntry::Create<SfxStyleFamily::Page> (PROPERTY_MAP_PAGE_STYLE, SwGetPoolIdFromName::PageDesc, "PageStyles", STR_STYLE_FAMILY_PAGE),
432 StyleFamilyEntry::Create<SfxStyleFamily::Frame> (PROPERTY_MAP_FRAME_STYLE, SwGetPoolIdFromName::FrmFmt, "FrameStyles", STR_STYLE_FAMILY_FRAME),
433 StyleFamilyEntry::Create<SfxStyleFamily::Pseudo>(PROPERTY_MAP_NUM_STYLE, SwGetPoolIdFromName::NumRule, "NumberingStyles", STR_STYLE_FAMILY_NUMBERING),
434 StyleFamilyEntry::Create<SfxStyleFamily::Table> (PROPERTY_MAP_TABLE_STYLE, SwGetPoolIdFromName::TabStyle, "TableStyles", STR_STYLE_FAMILY_TABLE),
435 StyleFamilyEntry::Create<SfxStyleFamily::Cell> (PROPERTY_MAP_CELL_STYLE, SwGetPoolIdFromName::CellStyle, "CellStyles", STR_STYLE_FAMILY_CELL),
436 };
437 return our_pStyleFamilyEntries;
438}
439
440class SwStyleBase_Impl
441{
442private:
443 SwDoc& m_rDoc;
444 const SwPageDesc* m_pOldPageDesc;
446 SfxItemSet* m_pItemSet;
447 std::unique_ptr<SfxItemSet> m_pMyItemSet;
448 OUString m_rStyleName;
449 const SwAttrSet* m_pParentStyle;
450public:
451 SwStyleBase_Impl(SwDoc& rSwDoc, OUString aName, const SwAttrSet* pParentStyle)
452 : m_rDoc(rSwDoc)
453 , m_pOldPageDesc(nullptr)
454 , m_pItemSet(nullptr)
455 , m_rStyleName(std::move(aName))
456 , m_pParentStyle(pParentStyle)
457 { }
458
460 {
461 return m_xNewBase;
462 }
463
464 void setNewBase(SwDocStyleSheet* pNew)
465 {
466 m_xNewBase = pNew;
467 }
468
469 bool HasItemSet() const
470 {
471 return m_xNewBase.is();
472 }
473
475 {
476 assert(m_xNewBase.is());
477 if(!m_pItemSet)
478 {
479 m_pMyItemSet.reset(new SfxItemSet(m_xNewBase->GetItemSet()));
480 m_pItemSet = m_pMyItemSet.get();
481
482 // set parent style to have the correct XFillStyle setting as XFILL_NONE
483 if(!m_pItemSet->GetParent() && m_pParentStyle)
484 m_pItemSet->SetParent(m_pParentStyle);
485 }
486 return *m_pItemSet;
487 }
488
489 const SwPageDesc* GetOldPageDesc();
490
491 // still a hack, but a bit more explicit and with a proper scope
492 struct ItemSetOverrider
493 {
494 SwStyleBase_Impl& m_rStyleBase;
495 SfxItemSet* m_pOldSet;
496 ItemSetOverrider(SwStyleBase_Impl& rStyleBase, SfxItemSet* pTemp)
497 : m_rStyleBase(rStyleBase)
498 , m_pOldSet(m_rStyleBase.m_pItemSet)
499 { m_rStyleBase.m_pItemSet = pTemp; }
500 ~ItemSetOverrider()
501 { m_rStyleBase.m_pItemSet = m_pOldSet; };
502 };
503};
504
505class SwStyleProperties_Impl;
506class SwXStyle : public cppu::WeakImplHelper
507 <
508 css::style::XStyle,
509 css::beans::XPropertySet,
510 css::beans::XMultiPropertySet,
511 css::lang::XServiceInfo,
512 css::lang::XUnoTunnel,
513 css::beans::XPropertyState,
514 css::beans::XMultiPropertyStates
515 >
516 , public SfxListener
517 , public SvtListener
518{
519 SwDoc* m_pDoc;
520 OUString m_sStyleName;
521 const StyleFamilyEntry& m_rEntry;
522 bool m_bIsDescriptor;
523 bool m_bIsConditional;
524 OUString m_sParentStyleName;
525
526protected:
527 SfxStyleSheetBasePool* m_pBasePool;
528 std::unique_ptr<SwStyleProperties_Impl> m_pPropertiesImpl;
529 css::uno::Reference<css::container::XNameAccess> m_xStyleFamily;
530 css::uno::Reference<css::beans::XPropertySet> m_xStyleData;
531
532 template<sal_uInt16>
533 void SetPropertyValue(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any&, SwStyleBase_Impl&);
534 void SetPropertyValues_Impl( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues );
535 SfxStyleSheetBase* GetStyleSheetBase();
536 void PrepareStyleBase(SwStyleBase_Impl& rBase);
537 template<sal_uInt16>
538 uno::Any GetStyleProperty(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, SwStyleBase_Impl& rBase);
539 uno::Any GetStyleProperty_Impl(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, SwStyleBase_Impl& rBase);
540 uno::Any GetPropertyValue_Impl(const SfxItemPropertySet* pPropSet, SwStyleBase_Impl& rBase, const OUString& rPropertyName);
541
542public:
543 SwXStyle(SwDoc* pDoc, SfxStyleFamily eFam, bool bConditional = false);
544 SwXStyle(SfxStyleSheetBasePool* pPool, SfxStyleFamily eFamily, SwDoc* pDoc, const OUString& rStyleName);
545 virtual ~SwXStyle() override;
546
547
548 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
549
550 //XUnoTunnel
551 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
552
553 //XNamed
554 virtual OUString SAL_CALL getName() override;
555 virtual void SAL_CALL setName(const OUString& Name_) override;
556
557 //XStyle
558 virtual sal_Bool SAL_CALL isUserDefined() override;
559 virtual sal_Bool SAL_CALL isInUse() override;
560 virtual OUString SAL_CALL getParentStyle() override;
561 virtual void SAL_CALL setParentStyle(const OUString& aParentStyle) override;
562
563 //XPropertySet
564 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
565 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
566 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
567 virtual void SAL_CALL addPropertyChangeListener( const OUString&, const css::uno::Reference< css::beans::XPropertyChangeListener >& ) override
568 { OSL_FAIL("not implemented"); };
569 virtual void SAL_CALL removePropertyChangeListener( const OUString&, const css::uno::Reference< css::beans::XPropertyChangeListener >& ) override
570 { OSL_FAIL("not implemented"); };
571 virtual void SAL_CALL addVetoableChangeListener( const OUString&, const css::uno::Reference< css::beans::XVetoableChangeListener >& ) override
572 { OSL_FAIL("not implemented"); };
573 virtual void SAL_CALL removeVetoableChangeListener( const OUString&, const css::uno::Reference< css::beans::XVetoableChangeListener >& ) override
574 { OSL_FAIL("not implemented"); };
575
576 //XMultiPropertySet
577 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
578 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
579 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >&, const css::uno::Reference< css::beans::XPropertiesChangeListener >& ) override
580 {};
581 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& ) override
582 {};
583 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >&, const css::uno::Reference< css::beans::XPropertiesChangeListener >& ) override
584 {};
585
586 //XPropertyState
587 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
588 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
589 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
590 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
591
592 //XMultiPropertyStates
593 virtual void SAL_CALL setAllPropertiesToDefault( ) override;
594 virtual void SAL_CALL setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override;
595 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override;
596
597 //XServiceInfo
598 virtual OUString SAL_CALL getImplementationName() override
599 { return {"SwXStyle"}; };
600 virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override
601 { return cppu::supportsService(this, rServiceName); };
602 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
603
604 //SfxListener
605 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
606 //SvtListener
607 virtual void Notify(const SfxHint&) override;
608 const OUString& GetStyleName() const { return m_sStyleName;}
609 SfxStyleFamily GetFamily() const {return m_rEntry.family();}
610
611 bool IsDescriptor() const {return m_bIsDescriptor;}
612 bool IsConditional() const { return m_bIsConditional;}
613 const OUString& GetParentStyleName() const { return m_sParentStyleName;}
614 void SetDoc(SwDoc* pDc, SfxStyleSheetBasePool* pPool)
615 {
616 m_bIsDescriptor = false; m_pDoc = pDc;
617 m_pBasePool = pPool;
618 SfxListener::StartListening(*m_pBasePool);
619 }
620 SwDoc* GetDoc() const { return m_pDoc; }
621 void Invalidate();
622 void ApplyDescriptorProperties();
623 void SetStyleName(const OUString& rSet){ m_sStyleName = rSet;}
628 void SetStyleProperty(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& rBase);
629 void PutItemToSet(const SvxSetItem* pSetItem, const SfxItemPropertySet& rPropSet, const SfxItemPropertyMapEntry& rEntry, const uno::Any& rVal, SwStyleBase_Impl& rBaseImpl);
630};
631
632typedef cppu::ImplInheritanceHelper< SwXStyle, css::document::XEventsSupplier> SwXFrameStyle_Base;
633class SwXFrameStyle
634 : public SwXFrameStyle_Base
635 , public sw::ICoreFrameStyle
636{
637public:
638 SwXFrameStyle(SfxStyleSheetBasePool& rPool,
639 SwDoc* pDoc,
640 const OUString& rStyleName) :
641 SwXFrameStyle_Base(&rPool, SfxStyleFamily::Frame, pDoc, rStyleName){}
642 explicit SwXFrameStyle(SwDoc *pDoc);
643
644 virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents( ) override;
645
646 //ICoreStyle
647 virtual void SetItem(sal_uInt16 eAtr, const SfxPoolItem& rItem) override;
648 virtual const SfxPoolItem* GetItem(sal_uInt16 eAtr) override;
649 virtual css::document::XEventsSupplier& GetEventsSupplier() override
650 { return *this; };
651};
652
653class SwXPageStyle
654 : public SwXStyle
655{
656protected:
657 void SetPropertyValues_Impl( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues );
658 css::uno::Sequence< css::uno::Any > GetPropertyValues_Impl( const css::uno::Sequence< OUString >& aPropertyNames );
659
660public:
661 SwXPageStyle(SfxStyleSheetBasePool& rPool, SwDocShell* pDocSh, const OUString& rStyleName);
662 explicit SwXPageStyle(SwDocShell* pDocSh);
663
664 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
665 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
666
667 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
668 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
669};
670
671class SwStyleProperties_Impl
672{
673 const SfxItemPropertyMap& mrMap;
674 std::map<OUString, uno::Any> m_vPropertyValues;
675public:
676 explicit SwStyleProperties_Impl(const SfxItemPropertyMap& rMap)
677 : mrMap(rMap)
678 { }
679
680 bool AllowsKey(std::u16string_view rName)
681 {
682 return mrMap.hasPropertyByName(rName);
683 }
684 bool SetProperty(const OUString& rName, const uno::Any& rValue)
685 {
686 if(!AllowsKey(rName))
687 return false;
688 m_vPropertyValues[rName] = rValue;
689 return true;
690 }
691 void GetProperty(const OUString& rName, const uno::Any*& pAny)
692 {
693 if(!AllowsKey(rName))
694 {
695 pAny = nullptr;
696 return;
697 }
698 pAny = &m_vPropertyValues[rName];
699 return;
700 }
701 bool ClearProperty( const OUString& rName )
702 {
703 if(!AllowsKey(rName))
704 return false;
705 m_vPropertyValues[rName] = uno::Any();
706 return true;
707 }
708 void ClearAllProperties( )
709 { m_vPropertyValues.clear(); }
710 void Apply(SwXStyle& rStyle)
711 {
712 for(const auto& rPropertyPair : m_vPropertyValues)
713 {
714 if(rPropertyPair.second.hasValue())
715 rStyle.setPropertyValue(rPropertyPair.first, rPropertyPair.second);
716 }
717 }
718};
719
720template<SfxStyleFamily eFamily>
721css::uno::Reference<css::style::XStyle> StyleFamilyEntry::CreateStyle(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& sStyleName)
722{
723 return pBasePool ? new SwXStyle(pBasePool, eFamily, pDocShell->GetDoc(), sStyleName) : new SwXStyle(pDocShell->GetDoc(), eFamily, false);
724}
725
726template<>
727css::uno::Reference<css::style::XStyle> StyleFamilyEntry::CreateStyle<SfxStyleFamily::Frame>(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& sStyleName)
728{
729 return pBasePool ? new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), sStyleName) : new SwXFrameStyle(pDocShell->GetDoc());
730}
731
732template<>
733css::uno::Reference<css::style::XStyle> StyleFamilyEntry::CreateStyle<SfxStyleFamily::Page>(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& sStyleName)
734{
735 return pBasePool ? new SwXPageStyle(*pBasePool, pDocShell, sStyleName) : new SwXPageStyle(pDocShell);
736}
737
738template<>
739css::uno::Reference<css::style::XStyle> StyleFamilyEntry::CreateStyle<SfxStyleFamily::Table>(SfxStyleSheetBasePool* /*pBasePool*/, SwDocShell* pDocShell, const OUString& sStyleName)
740{
741 return SwXTextTableStyle::CreateXTextTableStyle(pDocShell, sStyleName);
742}
743
744template<>
745css::uno::Reference<css::style::XStyle> StyleFamilyEntry::CreateStyle<SfxStyleFamily::Cell>(SfxStyleSheetBasePool* /*pBasePool*/, SwDocShell* pDocShell, const OUString& sStyleName)
746{
747 return SwXTextCellStyle::CreateXTextCellStyle(pDocShell, sStyleName);
748}
749
750class XStyleFamily : public cppu::WeakImplHelper
751<
752 container::XNameContainer,
753 lang::XServiceInfo,
754 container::XIndexAccess,
755 beans::XPropertySet
756>
757, public SfxListener
758{
759 const StyleFamilyEntry& m_rEntry;
760 SfxStyleSheetBasePool* m_pBasePool;
761 SwDocShell* m_pDocShell;
762
763 SwXStyle* FindStyle(std::u16string_view rStyleName) const;
764 sal_Int32 GetCountOrName(OUString* pString, sal_Int32 nIndex = SAL_MAX_INT32)
765 { return m_rEntry.getCountOrName(*m_pDocShell->GetDoc(), pString, nIndex); };
766 static const StyleFamilyEntry& InitEntry(SfxStyleFamily eFamily)
767 {
768 auto& entries = lcl_GetStyleFamilyEntries();
769 const auto pEntry = std::find_if(entries.begin(), entries.end(),
770 [eFamily] (const StyleFamilyEntry& e) { return e.family() == eFamily; });
771 assert(pEntry != entries.end());
772 return *pEntry;
773 }
774public:
775 XStyleFamily(SwDocShell* pDocShell, const SfxStyleFamily eFamily)
776 : m_rEntry(InitEntry(eFamily))
777 , m_pBasePool(pDocShell->GetStyleSheetPool())
778 , m_pDocShell(pDocShell)
779 {
780 if (m_pBasePool) //tdf#124142 html docs can have no styles
781 StartListening(*m_pBasePool);
782 }
783
784 //XIndexAccess
785 virtual sal_Int32 SAL_CALL getCount() override
786 {
787 SolarMutexGuard aGuard;
788 return GetCountOrName(nullptr);
789 };
790 virtual uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override;
791
792 //XElementAccess
793 virtual uno::Type SAL_CALL getElementType( ) override
795 virtual sal_Bool SAL_CALL hasElements( ) override
796 {
797 if(!m_pBasePool)
798 throw uno::RuntimeException();
799 return true;
800 }
801
802 //XNameAccess
803 virtual uno::Any SAL_CALL getByName(const OUString& Name) override;
804 virtual uno::Sequence< OUString > SAL_CALL getElementNames() override;
805 virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override;
806
807 //XNameContainer
808 virtual void SAL_CALL insertByName(const OUString& Name, const uno::Any& Element) override;
809 virtual void SAL_CALL replaceByName(const OUString& Name, const uno::Any& Element) override;
810 virtual void SAL_CALL removeByName(const OUString& Name) override;
811
812 //XPropertySet
813 virtual uno::Reference< beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override
814 { return {}; };
815 virtual void SAL_CALL setPropertyValue( const OUString&, const uno::Any&) override
816 { SAL_WARN("sw.uno", "###unexpected!"); };
817 virtual uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
818 virtual void SAL_CALL addPropertyChangeListener( const OUString&, const uno::Reference<beans::XPropertyChangeListener>&) override
819 { SAL_WARN("sw.uno", "###unexpected!"); };
820 virtual void SAL_CALL removePropertyChangeListener( const OUString&, const uno::Reference<beans::XPropertyChangeListener>&) override
821 { SAL_WARN("sw.uno", "###unexpected!"); };
822 virtual void SAL_CALL addVetoableChangeListener(const OUString&, const uno::Reference<beans::XVetoableChangeListener>&) override
823 { SAL_WARN("sw.uno", "###unexpected!"); };
824 virtual void SAL_CALL removeVetoableChangeListener(const OUString&, const uno::Reference<beans::XVetoableChangeListener>&) override
825 { SAL_WARN("sw.uno", "###unexpected!"); };
826
827 //SfxListener
828 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override
829 {
830 if(rHint.GetId() == SfxHintId::Dying)
831 {
832 m_pBasePool = nullptr;
833 m_pDocShell = nullptr;
834 EndListening(rBC);
835 }
836 }
837
838 //XServiceInfo
839 virtual OUString SAL_CALL getImplementationName() override
840 { return {"XStyleFamily"}; };
841 virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override
842 { return cppu::supportsService(this, rServiceName); };
843 virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
844 { return { "com.sun.star.style.StyleFamily" }; }
845};
846}
847
849 { return {"SwXStyleFamilies"}; }
850
851sal_Bool SwXStyleFamilies::supportsService(const OUString& rServiceName)
852{
853 return cppu::supportsService(this, rServiceName);
854}
855
857 { return { "com.sun.star.style.StyleFamilies" }; }
858
860 SwUnoCollection(rDocShell.GetDoc()),
861 m_pDocShell(&rDocShell)
862 { }
863
865 { }
866
867uno::Any SAL_CALL SwXStyleFamilies::getByName(const OUString& Name)
868{
869 SolarMutexGuard aGuard;
870 if(!IsValid())
871 throw uno::RuntimeException();
872 auto& entries(lcl_GetStyleFamilyEntries());
873 const auto pEntry = std::find_if(entries.begin(), entries.end(),
874 [&Name] (const StyleFamilyEntry& e) { return e.name() == Name; });
875 if(pEntry == entries.end())
876 throw container::NoSuchElementException();
877 return getByIndex(pEntry - entries.begin());
878}
879
880uno::Sequence< OUString > SwXStyleFamilies::getElementNames()
881{
882 auto& entries(lcl_GetStyleFamilyEntries());
883 uno::Sequence<OUString> aNames(entries.size());
884 std::transform(entries.begin(), entries.end(),
885 aNames.getArray(), [] (const StyleFamilyEntry& e) { return e.name(); });
886 return aNames;
887}
888
890{
891 auto& entries(lcl_GetStyleFamilyEntries());
892 return std::any_of(entries.begin(), entries.end(),
893 [&Name] (const StyleFamilyEntry& e) { return e.name() == Name; });
894}
895
897{
898 return lcl_GetStyleFamilyEntries().size();
899}
900
902{
903 auto& entries(lcl_GetStyleFamilyEntries());
904 SolarMutexGuard aGuard;
905 if(nIndex < 0 || o3tl::make_unsigned(nIndex) >= entries.size())
906 throw lang::IndexOutOfBoundsException();
907 if(!IsValid())
908 throw uno::RuntimeException();
909 auto eFamily = entries[nIndex].family();
910 assert(eFamily != SfxStyleFamily::All);
911 auto& rxFamily = m_vFamilies[eFamily];
912 if(!rxFamily.is())
913 rxFamily = new XStyleFamily(m_pDocShell, eFamily);
914 return uno::Any(rxFamily);
915}
916
918{
920}
921
923 { return true; }
924
925void SwXStyleFamilies::loadStylesFromURL(const OUString& rURL,
926 const uno::Sequence< beans::PropertyValue >& aOptions)
927{
928 SolarMutexGuard aGuard;
929 if(!IsValid() || rURL.isEmpty())
930 throw uno::RuntimeException();
931 SwgReaderOption aOpt;
932 aOpt.SetFrameFormats(true);
933 aOpt.SetTextFormats(true);
934 aOpt.SetPageDescs(true);
935 aOpt.SetNumRules(true);
936 aOpt.SetMerge(false);
937 for(const auto& rProperty: aOptions)
938 {
939 bool bValue = false;
940 if(rProperty.Value.getValueType() == cppu::UnoType<bool>::get())
941 bValue = rProperty.Value.get<bool>();
942
943 if(rProperty.Name == UNO_NAME_OVERWRITE_STYLES)
944 aOpt.SetMerge(!bValue);
945 else if(rProperty.Name == UNO_NAME_LOAD_NUMBERING_STYLES)
946 aOpt.SetNumRules(bValue);
947 else if(rProperty.Name == UNO_NAME_LOAD_PAGE_STYLES)
948 aOpt.SetPageDescs(bValue);
949 else if(rProperty.Name == UNO_NAME_LOAD_FRAME_STYLES)
950 aOpt.SetFrameFormats(bValue);
951 else if(rProperty.Name == UNO_NAME_LOAD_TEXT_STYLES)
952 aOpt.SetTextFormats(bValue);
953 else if(rProperty.Name == "InputStream")
954 {
955 Reference<XInputStream> xInputStream;
956 if (!(rProperty.Value >>= xInputStream))
957 throw IllegalArgumentException("Parameter 'InputStream' could not be converted to "
958 "type 'com::sun::star::io::XInputStream'",
959 nullptr, 0);
960
961 aOpt.SetInputStream(xInputStream);
962
963 }
964 }
965 const ErrCode nErr = m_pDocShell->LoadStylesFromFile( rURL, aOpt, true );
966 if(nErr)
967 throw io::IOException();
968}
969
970uno::Sequence< beans::PropertyValue > SwXStyleFamilies::getStyleLoaderOptions()
971{
972 const uno::Any aVal(true);
979 });
980}
981
983 SfxItemSet const& rSet, std::u16string_view rPropName, bool const bFooter,
984 SvxSetItem const*& o_rpItem)
985{
986 o_rpItem = rSet.GetItemIfSet(
987 bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
988 false);
989 if (!o_rpItem &&
990 rPropName == UNO_NAME_FIRST_IS_SHARED)
991 { // fdo#79269 header may not exist, check footer then
992 o_rpItem = rSet.GetItemIfSet(
993 (!bFooter) ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
994 false);
995 }
996 return o_rpItem;
997}
998
999uno::Reference<css::style::XStyle> SwXStyleFamilies::CreateStyle(SfxStyleFamily eFamily, SwDoc& rDoc)
1000{
1001 auto& entries(lcl_GetStyleFamilyEntries());
1002 const auto pEntry = std::find_if(entries.begin(), entries.end(),
1003 [eFamily] (const StyleFamilyEntry& e) { return e.family() == eFamily; });
1004 return pEntry == entries.end() ? nullptr : pEntry->createStyle(nullptr, rDoc.GetDocShell(), "");
1005}
1006
1007// FIXME: Ugly special casing that should die.
1008uno::Reference<css::style::XStyle> SwXStyleFamilies::CreateStyleCondParagraph(SwDoc& rDoc)
1009 { return new SwXStyle(&rDoc, SfxStyleFamily::Para, true); };
1010
1011uno::Any XStyleFamily::getByIndex(sal_Int32 nIndex)
1012{
1013 SolarMutexGuard aGuard;
1014 if(nIndex < 0)
1015 throw lang::IndexOutOfBoundsException();
1016 if(!m_pBasePool)
1017 throw uno::RuntimeException();
1018 OUString sStyleName;
1019 try
1020 {
1021 SwStyleNameMapper::FillUIName(m_rEntry.translateIndex(nIndex), sStyleName);
1022 } catch(...) {}
1023 if (sStyleName.isEmpty())
1024 GetCountOrName(&sStyleName, nIndex);
1025 if(sStyleName.isEmpty())
1026 throw lang::IndexOutOfBoundsException();
1027 return getByName(sStyleName);
1028}
1029
1030uno::Any XStyleFamily::getByName(const OUString& rName)
1031{
1032 SolarMutexGuard aGuard;
1033 OUString sStyleName;
1034 SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.poolId());
1035 if(!m_pBasePool)
1036 throw uno::RuntimeException();
1037 SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_rEntry.family());
1038 if(!pBase)
1039 throw container::NoSuchElementException(rName);
1040 uno::Reference<style::XStyle> xStyle = FindStyle(sStyleName);
1041 if(!xStyle.is())
1042 xStyle = m_rEntry.createStyle(m_pBasePool, m_pDocShell, m_rEntry.family() == SfxStyleFamily::Frame ? pBase->GetName() : sStyleName);
1043 return uno::Any(xStyle);
1044}
1045
1046uno::Sequence<OUString> XStyleFamily::getElementNames()
1047{
1048 SolarMutexGuard aGuard;
1049 if(!m_pBasePool)
1050 throw uno::RuntimeException();
1051 std::vector<OUString> vRet;
1052 std::unique_ptr<SfxStyleSheetIterator> pIt = m_pBasePool->CreateIterator(m_rEntry.family());
1053 for (SfxStyleSheetBase* pStyle = pIt->First(); pStyle; pStyle = pIt->Next())
1054 {
1055 OUString sName;
1056 SwStyleNameMapper::FillProgName(pStyle->GetName(), sName, m_rEntry.poolId());
1057 vRet.push_back(sName);
1058 }
1060}
1061
1062sal_Bool XStyleFamily::hasByName(const OUString& rName)
1063{
1064 SolarMutexGuard aGuard;
1065 if(!m_pBasePool)
1066 throw uno::RuntimeException();
1067 OUString sStyleName;
1068 SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.poolId());
1069 SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_rEntry.family());
1070 return nullptr != pBase;
1071}
1072
1073void XStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement)
1074{
1075 SolarMutexGuard aGuard;
1076 if(!m_pBasePool)
1077 throw uno::RuntimeException();
1078 OUString sStyleName;
1079 SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.poolId());
1080 SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_rEntry.family());
1081 if (pBase)
1082 throw container::ElementExistException();
1083 if(rElement.getValueType().getTypeClass() != uno::TypeClass_INTERFACE)
1084 throw lang::IllegalArgumentException();
1085 if (SwGetPoolIdFromName::CellStyle == m_rEntry.poolId())
1086 {
1087 // handle cell style
1088 uno::Reference<style::XStyle> xStyle = rElement.get<uno::Reference<style::XStyle>>();
1089 SwXTextCellStyle* pNewStyle = dynamic_cast<SwXTextCellStyle*>(xStyle.get());
1090 if (!pNewStyle)
1091 throw lang::IllegalArgumentException();
1092
1093 pNewStyle->setName(sStyleName); // insertByName sets the element name
1094 m_pDocShell->GetDoc()->GetCellStyles().AddBoxFormat(*pNewStyle->GetBoxFormat(), sStyleName);
1095 pNewStyle->SetPhysical();
1096 }
1097 else if (SwGetPoolIdFromName::TabStyle == m_rEntry.poolId())
1098 {
1099 // handle table style
1100 uno::Reference<style::XStyle> xStyle = rElement.get<uno::Reference<style::XStyle>>();
1101 SwXTextTableStyle* pNewStyle = dynamic_cast<SwXTextTableStyle*>(xStyle.get());
1102 if (!pNewStyle)
1103 throw lang::IllegalArgumentException();
1104
1105 pNewStyle->setName(sStyleName); // insertByName sets the element name
1106 m_pDocShell->GetDoc()->GetTableStyles().AddAutoFormat(*pNewStyle->GetTableFormat());
1107 pNewStyle->SetPhysical();
1108 }
1109 else
1110 {
1111 uno::Reference<lang::XUnoTunnel> xStyleTunnel = rElement.get<uno::Reference<lang::XUnoTunnel>>();
1112 SwXStyle* pNewStyle = comphelper::getFromUnoTunnel<SwXStyle>(xStyleTunnel);
1113 if (!pNewStyle || !pNewStyle->IsDescriptor() || pNewStyle->GetFamily() != m_rEntry.family())
1114 throw lang::IllegalArgumentException();
1115
1116 SfxStyleSearchBits nMask = SfxStyleSearchBits::All;
1117 if(m_rEntry.family() == SfxStyleFamily::Para && !pNewStyle->IsConditional())
1118 nMask &= ~SfxStyleSearchBits::SwCondColl;
1119 auto pStyle = &m_pBasePool->Make(sStyleName, m_rEntry.family(), nMask);
1120 pNewStyle->SetDoc(m_pDocShell->GetDoc(), m_pBasePool);
1121 pNewStyle->SetStyleName(sStyleName);
1122 pStyle->SetParent(pNewStyle->GetParentStyleName());
1123 // after all, we still need to apply the properties of the descriptor
1124 pNewStyle->ApplyDescriptorProperties();
1125 }
1126}
1127
1128void XStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement)
1129{
1130 SolarMutexGuard aGuard;
1131 if(!m_pBasePool)
1132 throw uno::RuntimeException();
1133 OUString sStyleName;
1134 SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.poolId());
1135 SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_rEntry.family());
1136 // replacements only for userdefined styles
1137 if(!pBase)
1138 throw container::NoSuchElementException();
1139 if (SwGetPoolIdFromName::CellStyle == m_rEntry.poolId())
1140 {
1141 // handle cell styles, don't call on assigned cell styles (TableStyle child)
1142 OUString sParent;
1143 SwBoxAutoFormat* pBoxAutoFormat = SwXTextCellStyle::GetBoxAutoFormat(m_pDocShell, sStyleName, &sParent);
1144 if (pBoxAutoFormat && sParent.isEmpty())// if parent exists then this style is assigned to a table style. Don't replace.
1145 {
1146 uno::Reference<style::XStyle> xStyle = rElement.get<uno::Reference<style::XStyle>>();
1147 SwXTextCellStyle* pStyleToReplaceWith = dynamic_cast<SwXTextCellStyle*>(xStyle.get());
1148 if (!pStyleToReplaceWith)
1149 throw lang::IllegalArgumentException();
1150
1151 pStyleToReplaceWith->setName(sStyleName);
1152 *pBoxAutoFormat = *pStyleToReplaceWith->GetBoxFormat();
1153 pStyleToReplaceWith->SetPhysical();
1154 }
1155 }
1156 else if (SwGetPoolIdFromName::TabStyle == m_rEntry.poolId())
1157 {
1158 // handle table styles
1159 SwTableAutoFormat* pTableAutoFormat = SwXTextTableStyle::GetTableAutoFormat(m_pDocShell, sStyleName);
1160 if (pTableAutoFormat)
1161 {
1162 uno::Reference<style::XStyle> xStyle = rElement.get<uno::Reference<style::XStyle>>();
1163 SwXTextTableStyle* pStyleToReplaceWith = dynamic_cast<SwXTextTableStyle*>(xStyle.get());
1164 if (!pStyleToReplaceWith)
1165 throw lang::IllegalArgumentException();
1166
1167 pStyleToReplaceWith->setName(sStyleName);
1168 *pTableAutoFormat = *pStyleToReplaceWith->GetTableFormat();
1169 pStyleToReplaceWith->SetPhysical();
1170 }
1171 }
1172 else
1173 {
1174 if(!pBase->IsUserDefined())
1175 throw lang::IllegalArgumentException();
1176 //if there's an object available to this style then it must be invalidated
1177 uno::Reference<style::XStyle> xStyle = FindStyle(pBase->GetName());
1178 if(xStyle.is())
1179 {
1180 SwXStyle* pStyle = comphelper::getFromUnoTunnel<SwXStyle>(xStyle);
1181 if(pStyle)
1182 pStyle->Invalidate();
1183 }
1184 m_pBasePool->Remove(pBase);
1185 insertByName(rName, rElement);
1186 }
1187}
1188
1189void XStyleFamily::removeByName(const OUString& rName)
1190{
1191 SolarMutexGuard aGuard;
1192 if(!m_pBasePool)
1193 throw uno::RuntimeException();
1194 OUString sName;
1195 SwStyleNameMapper::FillUIName(rName, sName, m_rEntry.poolId());
1196 SfxStyleSheetBase* pBase = m_pBasePool->Find(sName, m_rEntry.family());
1197 if(!pBase)
1198 throw container::NoSuchElementException();
1199 if (SwGetPoolIdFromName::CellStyle == m_rEntry.poolId())
1200 {
1201 // handle cell style
1202 m_pDocShell->GetDoc()->GetCellStyles().RemoveBoxFormat(rName);
1203 }
1204 else if (SwGetPoolIdFromName::TabStyle == m_rEntry.poolId())
1205 {
1206 // handle table style
1207 m_pDocShell->GetDoc()->GetTableStyles().EraseAutoFormat(rName);
1208 }
1209 else
1210 m_pBasePool->Remove(pBase);
1211}
1212
1213uno::Any SAL_CALL XStyleFamily::getPropertyValue( const OUString& sPropertyName )
1214{
1215 if(sPropertyName != "DisplayName")
1216 throw beans::UnknownPropertyException( "unknown property: " + sPropertyName, static_cast<OWeakObject *>(this) );
1217 SolarMutexGuard aGuard;
1218 return uno::Any(SwResId(m_rEntry.resId()));
1219}
1220
1221
1222SwXStyle* XStyleFamily::FindStyle(std::u16string_view rStyleName) const
1223{
1224 SwXStyle* pFoundStyle = nullptr;
1225 m_pBasePool->ForAllListeners(
1226 [this, &pFoundStyle, &rStyleName] (SfxListener* pListener)
1227 {
1228 SwXStyle* pTempStyle = dynamic_cast<SwXStyle*>(pListener);
1229 if(pTempStyle && pTempStyle->GetFamily() == m_rEntry.family() && pTempStyle->GetStyleName() == rStyleName)
1230 {
1231 pFoundStyle = pTempStyle;
1232 return true; // break
1233 }
1234 return false;
1235 });
1236 return pFoundStyle;
1237}
1238
1240{
1241 auto& entries(lcl_GetStyleFamilyEntries());
1242 const auto pEntry = std::find_if(entries.begin(), entries.end(),
1243 [eFamily] (const StyleFamilyEntry& e) { return e.family() == eFamily; });
1244 if(pEntry != entries.end())
1245 return pEntry->poolId();
1246 SAL_WARN("sw.uno", "someone asking for all styles in unostyle.cxx!" );
1248}
1249
1250const uno::Sequence<sal_Int8>& SwXStyle::getUnoTunnelId()
1251{
1252 static const comphelper::UnoIdInit theSwXStyleUnoTunnelId;
1253 return theSwXStyleUnoTunnelId.getSeq();
1254}
1255
1256sal_Int64 SAL_CALL SwXStyle::getSomething(const uno::Sequence<sal_Int8>& rId)
1257{
1258 return comphelper::getSomethingImpl(rId, this);
1259}
1260
1261
1262uno::Sequence< OUString > SwXStyle::getSupportedServiceNames()
1263{
1264 tools::Long nCount = 1;
1265 if(SfxStyleFamily::Para == m_rEntry.family())
1266 {
1267 nCount = 5;
1268 if(m_bIsConditional)
1269 nCount++;
1270 }
1271 else if(SfxStyleFamily::Char == m_rEntry.family())
1272 nCount = 5;
1273 else if(SfxStyleFamily::Page == m_rEntry.family())
1274 nCount = 3;
1275 uno::Sequence< OUString > aRet(nCount);
1276 OUString* pArray = aRet.getArray();
1277 pArray[0] = "com.sun.star.style.Style";
1278 switch(m_rEntry.family())
1279 {
1280 case SfxStyleFamily::Char:
1281 pArray[1] = "com.sun.star.style.CharacterStyle";
1282 pArray[2] = "com.sun.star.style.CharacterProperties";
1283 pArray[3] = "com.sun.star.style.CharacterPropertiesAsian";
1284 pArray[4] = "com.sun.star.style.CharacterPropertiesComplex";
1285 break;
1286 case SfxStyleFamily::Page:
1287 pArray[1] = "com.sun.star.style.PageStyle";
1288 pArray[2] = "com.sun.star.style.PageProperties";
1289 break;
1290 case SfxStyleFamily::Para:
1291 pArray[1] = "com.sun.star.style.ParagraphStyle";
1292 pArray[2] = "com.sun.star.style.ParagraphProperties";
1293 pArray[3] = "com.sun.star.style.ParagraphPropertiesAsian";
1294 pArray[4] = "com.sun.star.style.ParagraphPropertiesComplex";
1295 if(m_bIsConditional)
1296 pArray[5] = "com.sun.star.style.ConditionalParagraphStyle";
1297 break;
1298
1299 default:
1300 ;
1301 }
1302 return aRet;
1303}
1304
1305static uno::Reference<beans::XPropertySet> lcl_InitStandardStyle(const SfxStyleFamily eFamily, uno::Reference<container::XNameAccess> const & rxStyleFamily)
1306{
1307 using return_t = decltype(lcl_InitStandardStyle(eFamily, rxStyleFamily));
1308 if(eFamily != SfxStyleFamily::Para && eFamily != SfxStyleFamily::Page)
1309 return {};
1310 auto aResult(rxStyleFamily->getByName("Standard"));
1311 if(!aResult.has<return_t>())
1312 return {};
1313 return aResult.get<return_t>();
1314}
1315
1316static uno::Reference<container::XNameAccess> lcl_InitStyleFamily(SwDoc* pDoc, const StyleFamilyEntry& rEntry)
1317{
1318 using return_t = decltype(lcl_InitStyleFamily(pDoc, rEntry));
1319 if(rEntry.family() != SfxStyleFamily::Char
1320 && rEntry.family() != SfxStyleFamily::Para
1321 && rEntry.family() != SfxStyleFamily::Page)
1322 return {};
1323 auto xModel(pDoc->GetDocShell()->GetBaseModel());
1324 uno::Reference<style::XStyleFamiliesSupplier> xFamilySupplier(xModel, uno::UNO_QUERY);
1325 auto xFamilies = xFamilySupplier->getStyleFamilies();
1326 auto aResult(xFamilies->getByName(rEntry.name()));
1327 if(!aResult.has<return_t>())
1328 return {};
1329 return aResult.get<return_t>();
1330}
1331
1332static bool lcl_InitConditional(SfxStyleSheetBasePool* pBasePool, const SfxStyleFamily eFamily, const OUString& rStyleName)
1333{
1334 if(!pBasePool || eFamily != SfxStyleFamily::Para)
1335 return false;
1336 SfxStyleSheetBase* pBase = pBasePool->Find(rStyleName, eFamily);
1337 SAL_WARN_IF(!pBase, "sw.uno", "where is the style?" );
1338 if(!pBase)
1339 return false;
1341 if(nId != USHRT_MAX)
1343 return RES_CONDTXTFMTCOLL == static_cast<SwDocStyleSheet*>(pBase)->GetCollection()->Which();
1344}
1345
1346static const StyleFamilyEntry& lcl_GetStyleEntry(const SfxStyleFamily eFamily)
1347{
1348 auto& entries = lcl_GetStyleFamilyEntries();
1349 const auto pEntry = std::find_if(entries.begin(), entries.end(),
1350 [eFamily] (const StyleFamilyEntry& e) { return e.family() == eFamily; });
1351 assert(pEntry != entries.end());
1352 return *pEntry;
1353}
1354
1355SwXStyle::SwXStyle(SwDoc* pDoc, SfxStyleFamily eFamily, bool bConditional)
1356 : m_pDoc(pDoc)
1357 , m_rEntry(lcl_GetStyleEntry(eFamily))
1358 , m_bIsDescriptor(true)
1359 , m_bIsConditional(bConditional)
1360 , m_pBasePool(nullptr)
1361 , m_xStyleFamily(lcl_InitStyleFamily(pDoc, m_rEntry))
1362 , m_xStyleData(lcl_InitStandardStyle(eFamily, m_xStyleFamily))
1363{
1364 assert(!m_bIsConditional || m_rEntry.family() == SfxStyleFamily::Para); // only paragraph styles are conditional
1365 // Register ourselves as a listener to the document (via the page descriptor)
1367 m_pPropertiesImpl = std::make_unique<SwStyleProperties_Impl>(
1368 aSwMapProvider.GetPropertySet(m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.propMapType())->getPropertyMap());
1369}
1370
1371SwXStyle::SwXStyle(SfxStyleSheetBasePool* pPool, SfxStyleFamily eFamily, SwDoc* pDoc, const OUString& rStyleName)
1372 : m_pDoc(pDoc)
1373 , m_sStyleName(rStyleName)
1374 , m_rEntry(lcl_GetStyleEntry(eFamily))
1375 , m_bIsDescriptor(false)
1376 , m_bIsConditional(lcl_InitConditional(pPool, eFamily, rStyleName))
1377 , m_pBasePool(pPool)
1378{ }
1379
1380SwXStyle::~SwXStyle()
1381{
1382 SolarMutexGuard aGuard;
1383 if(m_pBasePool)
1384 SfxListener::EndListening(*m_pBasePool);
1385 m_pPropertiesImpl.reset();
1387}
1388
1389void SwXStyle::Notify(const SfxHint& rHint)
1390{
1391 if(rHint.GetId() == SfxHintId::Dying)
1392 {
1393 m_pDoc = nullptr;
1394 m_xStyleData.clear();
1395 m_xStyleFamily.clear();
1396 }
1397}
1398
1399OUString SwXStyle::getName()
1400{
1401 SolarMutexGuard aGuard;
1402 if(!m_pBasePool)
1403 return m_sStyleName;
1404 SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family());
1405 SAL_WARN_IF(!pBase, "sw.uno", "where is the style?");
1406 if(!pBase)
1407 throw uno::RuntimeException();
1408 OUString aString;
1409 SwStyleNameMapper::FillProgName(pBase->GetName(), aString, lcl_GetSwEnumFromSfxEnum ( m_rEntry.family()));
1410 return aString;
1411}
1412
1413void SwXStyle::setName(const OUString& rName)
1414{
1415 SolarMutexGuard aGuard;
1416 if(!m_pBasePool)
1417 {
1418 m_sStyleName = rName;
1419 return;
1420 }
1421 SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family());
1422 SAL_WARN_IF(!pBase, "sw.uno", "where is the style?");
1423 if(!pBase || !pBase->IsUserDefined())
1424 throw uno::RuntimeException();
1425 rtl::Reference<SwDocStyleSheet> xTmp(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
1426 if(!xTmp->SetName(rName))
1427 throw uno::RuntimeException();
1428 m_sStyleName = rName;
1429}
1430
1431sal_Bool SwXStyle::isUserDefined()
1432{
1433 SolarMutexGuard aGuard;
1434 if(!m_pBasePool)
1435 throw uno::RuntimeException();
1436 SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family());
1437 //if it is not found it must be non user defined
1438 return pBase && pBase->IsUserDefined();
1439}
1440
1441sal_Bool SwXStyle::isInUse()
1442{
1443 SolarMutexGuard aGuard;
1444 if(!m_pBasePool)
1445 throw uno::RuntimeException();
1446 SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family(), SfxStyleSearchBits::Used);
1447 return pBase && pBase->IsUsed();
1448}
1449
1450OUString SwXStyle::getParentStyle()
1451{
1452 SolarMutexGuard aGuard;
1453 if(!m_pBasePool)
1454 {
1455 if(!m_bIsDescriptor)
1456 throw uno::RuntimeException();
1457 return m_sParentStyleName;
1458 }
1459 SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family());
1460 OUString aString;
1461 if(pBase)
1462 aString = pBase->GetParent();
1463 SwStyleNameMapper::FillProgName(aString, aString, lcl_GetSwEnumFromSfxEnum(m_rEntry.family()));
1464 return aString;
1465}
1466
1467void SwXStyle::setParentStyle(const OUString& rParentStyle)
1468{
1469 SolarMutexGuard aGuard;
1470 OUString sParentStyle;
1471 SwStyleNameMapper::FillUIName(rParentStyle, sParentStyle, lcl_GetSwEnumFromSfxEnum ( m_rEntry.family()) );
1472 if(!m_pBasePool)
1473 {
1474 if(!m_bIsDescriptor)
1475 throw uno::RuntimeException();
1476 m_sParentStyleName = sParentStyle;
1477 try
1478 {
1479 const auto aAny = m_xStyleFamily->getByName(sParentStyle);
1480 m_xStyleData = aAny.get<decltype(m_xStyleData)>();
1481 }
1482 catch(...)
1483 { }
1484 return;
1485 }
1486 SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family());
1487 if(!pBase)
1488 throw uno::RuntimeException();
1489 rtl::Reference<SwDocStyleSheet> xBase(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
1490 //make it a 'real' style - necessary for pooled styles
1491 xBase->GetItemSet();
1492 if(xBase->GetParent() != sParentStyle)
1493 {
1494 if(!xBase->SetParent(sParentStyle))
1495 throw uno::RuntimeException();
1496 }
1497}
1498
1499uno::Reference<beans::XPropertySetInfo> SwXStyle::getPropertySetInfo()
1500{
1501 if(m_bIsConditional)
1502 {
1503 assert(m_rEntry.family() == SfxStyleFamily::Para);
1505 return xCondParaRef;
1506 }
1507 return m_rEntry.xPSInfo();
1508}
1509
1510void SwXStyle::ApplyDescriptorProperties()
1511{
1512 m_bIsDescriptor = false;
1513 m_xStyleData.clear();
1514 m_xStyleFamily.clear();
1515 m_pPropertiesImpl->Apply(*this);
1516}
1517
1518namespace {
1520 {
1521 // Page styles
1522 STR_POOLPAGE_STANDARD,
1523 STR_POOLPAGE_FIRST,
1524 STR_POOLPAGE_LEFT,
1525 STR_POOLPAGE_RIGHT,
1526 STR_POOLPAGE_ENVELOPE,
1527 STR_POOLPAGE_REGISTER,
1528 STR_POOLPAGE_HTML,
1529 STR_POOLPAGE_FOOTNOTE,
1530 STR_POOLPAGE_ENDNOTE,
1531 STR_POOLPAGE_LANDSCAPE
1532 };
1533}
1534
1535const SwPageDesc* SwStyleBase_Impl::GetOldPageDesc()
1536{
1537 if(!m_pOldPageDesc)
1538 {
1539 SwPageDesc *pd = m_rDoc.FindPageDesc(m_rStyleName);
1540 if(pd)
1541 m_pOldPageDesc = pd;
1542
1543 if(!m_pOldPageDesc)
1544 {
1545 for (size_t i = 0; i < SAL_N_ELEMENTS(STR_POOLPAGE_ARY); ++i)
1546 {
1547 if (SwResId(STR_POOLPAGE_ARY[i]) == m_rStyleName)
1548 {
1550 break;
1551 }
1552 }
1553 }
1554 }
1555 return m_pOldPageDesc;
1556}
1557
1558
1559
1561{
1562 // check for needed metric translation
1563 if(!(rEntry.nMoreFlags & PropertyMoreFlags::METRIC_ITEM))
1564 return rEntry.nMemberId;
1565 // exception: If these ItemTypes are used, do not convert when these are negative
1566 // since this means they are intended as percent values
1567 if((XATTR_FILLBMP_SIZEX == rEntry.nWID || XATTR_FILLBMP_SIZEY == rEntry.nWID)
1568 && o_aValue.has<sal_Int32>()
1569 && o_aValue.get<sal_Int32>() < 0)
1570 return rEntry.nMemberId;
1571 if(!pDoc)
1572 return rEntry.nMemberId;
1573
1574 const SfxItemPool& rPool = pDoc->GetAttrPool();
1575 const MapUnit eMapUnit(rPool.GetMetric(rEntry.nWID));
1576 if(eMapUnit != MapUnit::Map100thMM)
1577 SvxUnoConvertFromMM(eMapUnit, o_aValue);
1578 return rEntry.nMemberId;
1579}
1580template<>
1581void SwXStyle::SetPropertyValue<HINT_BEGIN>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1582{
1583 // default ItemSet handling
1584 SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
1585 SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID);
1586 aSet.SetParent(&rStyleSet);
1587 rPropSet.setPropertyValue(rEntry, rValue, aSet);
1588 rStyleSet.Put(aSet);
1589}
1590template<>
1591void SwXStyle::SetPropertyValue<FN_UNO_HIDDEN>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1592{
1593 bool bHidden = false;
1594 if(rValue >>= bHidden)
1595 {
1596 //make it a 'real' style - necessary for pooled styles
1597 o_rStyleBase.getNewBase()->GetItemSet();
1598 o_rStyleBase.getNewBase()->SetHidden(bHidden);
1599 }
1600 SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, rValue, o_rStyleBase);
1601}
1602template<>
1603void SwXStyle::SetPropertyValue<FN_UNO_STYLE_INTEROP_GRAB_BAG>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1604{
1605 o_rStyleBase.getNewBase()->GetItemSet();
1606 o_rStyleBase.getNewBase()->SetGrabBagItem(rValue);
1607 SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, rValue, o_rStyleBase);
1608}
1609template<>
1610void SwXStyle::SetPropertyValue<sal_uInt16(XATTR_FILLGRADIENT)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1611{
1612 uno::Any aValue(rValue);
1613 const auto nMemberId(lcl_TranslateMetric(rEntry, m_pDoc, aValue));
1614 if(MID_NAME == nMemberId)
1615 {
1616 // add set commands for FillName items
1617 SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
1618 if(!aValue.has<OUString>())
1619 throw lang::IllegalArgumentException();
1620 SvxShape::SetFillAttribute(rEntry.nWID, aValue.get<OUString>(), rStyleSet);
1621 }
1622 else if(MID_BITMAP == nMemberId)
1623 {
1624 if(sal_uInt16(XATTR_FILLBITMAP) == rEntry.nWID)
1625 {
1626 Graphic aNullGraphic;
1627 SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
1628 XFillBitmapItem aXFillBitmapItem(std::move(aNullGraphic));
1629 aXFillBitmapItem.PutValue(aValue, nMemberId);
1630 rStyleSet.Put(aXFillBitmapItem);
1631 }
1632 }
1633 else
1634 SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, aValue, o_rStyleBase);
1635}
1636template<>
1637void SwXStyle::SetPropertyValue<sal_uInt16(RES_BACKGROUND)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1638{
1639 SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
1640 const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, m_pDoc->IsInXMLImport()));
1641 std::unique_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
1642
1643 uno::Any aValue(rValue);
1644 const auto nMemberId(lcl_TranslateMetric(rEntry, m_pDoc, aValue));
1645 aChangedBrushItem->PutValue(aValue, nMemberId);
1646
1647 // 0xff is already the default - but if BackTransparent is set
1648 // to true, it must be applied in the item set on ODF import
1649 // to potentially override parent style, which is unknown yet
1650 if(*aChangedBrushItem == *aOriginalBrushItem && (MID_GRAPHIC_TRANSPARENT != nMemberId || !aValue.has<bool>() || !aValue.get<bool>()))
1651 return;
1652
1653 setSvxBrushItemAsFillAttributesToTargetSet(*aChangedBrushItem, rStyleSet);
1654}
1655template<>
1656void SwXStyle::SetPropertyValue<OWN_ATTR_FILLBMP_MODE>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1657{
1658 drawing::BitmapMode eMode;
1659 if(!(rValue >>= eMode))
1660 {
1661 if(!rValue.has<sal_Int32>())
1662 throw lang::IllegalArgumentException();
1663 eMode = static_cast<drawing::BitmapMode>(rValue.get<sal_Int32>());
1664 }
1665 SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
1666 rStyleSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
1667 rStyleSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
1668}
1669template<>
1670void SwXStyle::SetPropertyValue<sal_uInt16(RES_PAPER_BIN)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1671{
1672 if(!rValue.has<OUString>())
1673 throw lang::IllegalArgumentException();
1674 SfxPrinter* pPrinter = m_pDoc->getIDocumentDeviceAccess().getPrinter(true);
1675 OUString sValue(rValue.get<OUString>());
1676 using printeridx_t = decltype(pPrinter->GetPaperBinCount());
1677 printeridx_t nBin = std::numeric_limits<printeridx_t>::max();
1678 if(sValue == "[From printer settings]")
1679 nBin = std::numeric_limits<printeridx_t>::max()-1;
1680 else if(pPrinter)
1681 {
1682 for(sal_uInt16 i=0, nEnd = pPrinter->GetPaperBinCount(); i < nEnd; ++i)
1683 {
1684 if (sValue == pPrinter->GetPaperBinName(i))
1685 {
1686 nBin = i;
1687 break;
1688 }
1689 }
1690 }
1691 if(nBin == std::numeric_limits<printeridx_t>::max())
1692 throw lang::IllegalArgumentException();
1693 SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
1694 SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID);
1695 aSet.SetParent(&rStyleSet);
1696 rPropSet.setPropertyValue(rEntry, uno::Any(static_cast<sal_Int8>(nBin == std::numeric_limits<printeridx_t>::max()-1 ? -1 : nBin)), aSet);
1697 rStyleSet.Put(aSet);
1698}
1699template<>
1700void SwXStyle::SetPropertyValue<FN_UNO_NUM_RULES>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1701{
1702 auto xNumberTunnel(rValue.get<uno::Reference<container::XIndexReplace>>());
1703 if(!xNumberTunnel)
1704 throw lang::IllegalArgumentException();
1705 SwXNumberingRules* pSwXRules = dynamic_cast<SwXNumberingRules*>(xNumberTunnel.get());
1706 if(!pSwXRules)
1707 return;
1708 SwNumRule aSetRule(*pSwXRules->GetNumRule());
1709 for(sal_uInt16 i = 0; i < MAXLEVEL; ++i)
1710 {
1711 const SwNumFormat* pFormat = aSetRule.GetNumFormat(i);
1712 if(!pFormat)
1713 continue;
1714 SwNumFormat aFormat(*pFormat);
1715 const auto& rCharName(pSwXRules->GetNewCharStyleNames()[i]);
1716 if(!rCharName.isEmpty()
1718 && (!pFormat->GetCharFormat() || pFormat->GetCharFormat()->GetName() != rCharName))
1719 {
1720 auto pCharFormatIt(std::find_if(m_pDoc->GetCharFormats()->begin(), m_pDoc->GetCharFormats()->end(),
1721 [&rCharName] (SwCharFormat* pF) { return pF->GetName() == rCharName; }));
1722 if(pCharFormatIt != m_pDoc->GetCharFormats()->end())
1723 aFormat.SetCharFormat(*pCharFormatIt);
1724 else if(m_pBasePool)
1725 {
1726 auto pBase(m_pBasePool->Find(rCharName, SfxStyleFamily::Char));
1727 if(!pBase)
1728 pBase = &m_pBasePool->Make(rCharName, SfxStyleFamily::Char);
1729 aFormat.SetCharFormat(static_cast<SwDocStyleSheet*>(pBase)->GetCharFormat());
1730 }
1731 else
1732 aFormat.SetCharFormat(nullptr);
1733 }
1734 // same for fonts:
1735 const auto& rBulletName(pSwXRules->GetBulletFontNames()[i]);
1736 if(!rBulletName.isEmpty()
1737 && !SwXNumberingRules::isInvalidStyle(rBulletName)
1738 && (!pFormat->GetBulletFont() || pFormat->GetBulletFont()->GetFamilyName() != rBulletName))
1739 {
1740 const auto pFontListItem(static_cast<const SvxFontListItem*>(m_pDoc->GetDocShell()->GetItem(SID_ATTR_CHAR_FONTLIST)));
1741 const auto pList(pFontListItem->GetFontList());
1742 FontMetric aFontInfo(pList->Get(rBulletName, WEIGHT_NORMAL, ITALIC_NONE));
1743 vcl::Font aFont(aFontInfo);
1744 aFormat.SetBulletFont(&aFont);
1745 }
1746 aSetRule.Set(i, &aFormat);
1747 }
1748 o_rStyleBase.getNewBase()->SetNumRule(aSetRule);
1749}
1750template<>
1751void SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_OUTLINELEVEL)>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1752{
1753 if(!rValue.has<sal_Int16>())
1754 return;
1755 const auto nLevel(rValue.get<sal_Int16>());
1756 if(0 <= nLevel && nLevel <= MAXLEVEL)
1757 o_rStyleBase.getNewBase()->GetCollection()->SetAttrOutlineLevel(nLevel);
1758}
1759template<>
1760void SwXStyle::SetPropertyValue<FN_UNO_FOLLOW_STYLE>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1761{
1762 if(!rValue.has<OUString>())
1763 return;
1764 const auto sValue(rValue.get<OUString>());
1765 OUString aString;
1766 SwStyleNameMapper::FillUIName(sValue, aString, m_rEntry.poolId());
1767 o_rStyleBase.getNewBase()->SetFollow(aString);
1768}
1769
1770template <>
1771void SwXStyle::SetPropertyValue<FN_UNO_LINK_STYLE>(const SfxItemPropertyMapEntry&,
1772 const SfxItemPropertySet&,
1773 const uno::Any& rValue,
1774 SwStyleBase_Impl& o_rStyleBase)
1775{
1776 if (!rValue.has<OUString>())
1777 return;
1778 const auto sValue(rValue.get<OUString>());
1779 OUString aString;
1780 SwStyleNameMapper::FillUIName(sValue, aString, m_rEntry.poolId());
1781 o_rStyleBase.getNewBase()->SetLink(aString);
1782}
1783
1784template<>
1785void SwXStyle::SetPropertyValue<sal_uInt16(RES_PAGEDESC)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1786{
1788 {
1789 SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, rValue, o_rStyleBase);
1790 return;
1791 }
1792 if(!rValue.has<OUString>())
1793 throw lang::IllegalArgumentException();
1794 // special handling for RES_PAGEDESC
1795 SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
1796 std::unique_ptr<SwFormatPageDesc> pNewDesc;
1797 if(const SwFormatPageDesc* pItem = rStyleSet.GetItemIfSet(RES_PAGEDESC))
1798 pNewDesc.reset(new SwFormatPageDesc(*pItem));
1799 else
1800 pNewDesc.reset(new SwFormatPageDesc);
1801 const auto sValue(rValue.get<OUString>());
1802 OUString sDescName;
1804 if(pNewDesc->GetPageDesc() && pNewDesc->GetPageDesc()->GetName() == sDescName)
1805 return;
1806 if(sDescName.isEmpty())
1807 {
1808 rStyleSet.ClearItem(RES_BREAK);
1809 rStyleSet.Put(SwFormatPageDesc());
1810 }
1811 else
1812 {
1813 SwPageDesc* pPageDesc(SwPageDesc::GetByName(*m_pDoc, sDescName));
1814 if(!pPageDesc)
1815 throw lang::IllegalArgumentException();
1816 pNewDesc->RegisterToPageDesc(*pPageDesc);
1817 rStyleSet.Put(std::move(pNewDesc));
1818 }
1819}
1820template<>
1821void SwXStyle::SetPropertyValue<sal_uInt16(RES_TEXT_VERT_ADJUST)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1822{
1823 if(m_rEntry.family() != SfxStyleFamily::Page)
1824 {
1825 SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, rValue, o_rStyleBase);
1826 return;
1827 }
1828 if(!m_pDoc || !rValue.has<drawing::TextVerticalAdjust>() || !o_rStyleBase.GetOldPageDesc())
1829 return;
1830 SwPageDesc* pPageDesc = m_pDoc->FindPageDesc(o_rStyleBase.GetOldPageDesc()->GetName());
1831 if(pPageDesc)
1832 pPageDesc->SetVerticalAdjustment(rValue.get<drawing::TextVerticalAdjust>());
1833}
1834template<>
1835void SwXStyle::SetPropertyValue<FN_UNO_IS_AUTO_UPDATE>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1836{
1837 if(!rValue.has<bool>())
1838 throw lang::IllegalArgumentException();
1839 const bool bAuto(rValue.get<bool>());
1840 if(SfxStyleFamily::Para == m_rEntry.family())
1841 o_rStyleBase.getNewBase()->GetCollection()->SetAutoUpdateOnDirectFormat(bAuto);
1842 else if(SfxStyleFamily::Frame == m_rEntry.family())
1843 o_rStyleBase.getNewBase()->GetFrameFormat()->SetAutoUpdateOnDirectFormat(bAuto);
1844}
1845template<>
1846void SwXStyle::SetPropertyValue<FN_UNO_PARA_STYLE_CONDITIONS>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1847{
1848 static_assert(COND_COMMAND_COUNT == 28, "invalid size of command count?");
1849 using expectedarg_t = uno::Sequence<beans::NamedValue>;
1850 if(!rValue.has<expectedarg_t>() || !m_pBasePool)
1851 throw lang::IllegalArgumentException();
1852 SwCondCollItem aCondItem;
1853 const auto aNamedValues = rValue.get<expectedarg_t>();
1854 for(const auto& rNamedValue : aNamedValues)
1855 {
1856 if(!rNamedValue.Value.has<OUString>())
1857 throw lang::IllegalArgumentException();
1858
1859 const OUString sValue(rNamedValue.Value.get<OUString>());
1860 // get UI style name from programmatic style name
1861 OUString aStyleName;
1862 SwStyleNameMapper::FillUIName(sValue, aStyleName, lcl_GetSwEnumFromSfxEnum(m_rEntry.family()));
1863
1864 // check for correct context and style name
1865 const auto nIdx(GetCommandContextIndex(rNamedValue.Name));
1866 if (nIdx == -1)
1867 throw lang::IllegalArgumentException();
1868 bool bStyleFound = false;
1869 for(auto pBase = m_pBasePool->First(SfxStyleFamily::Para); pBase; pBase = m_pBasePool->Next())
1870 {
1871 bStyleFound = pBase->GetName() == aStyleName;
1872 if (bStyleFound)
1873 break;
1874 }
1875 if (!bStyleFound)
1876 throw lang::IllegalArgumentException();
1877 aCondItem.SetStyle(&aStyleName, nIdx);
1878 }
1879 o_rStyleBase.GetItemSet().Put(aCondItem);
1880}
1881template<>
1882void SwXStyle::SetPropertyValue<FN_UNO_CATEGORY>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1883{
1884 if(!o_rStyleBase.getNewBase()->IsUserDefined() || !rValue.has<paragraphstyle_t>())
1885 throw lang::IllegalArgumentException();
1886 static const std::map<paragraphstyle_t, SfxStyleSearchBits> aUnoToCore = []{
1887 std::map<paragraphstyle_t, SfxStyleSearchBits> map;
1888 std::transform(std::begin(sParagraphStyleCategoryEntries), std::end(sParagraphStyleCategoryEntries), std::inserter(map, map.end()),
1889 [] (const ParagraphStyleCategoryEntry& rEntry) { return std::make_pair(rEntry.m_eCategory, rEntry.m_nSwStyleBits); });
1890 return map;
1891 }();
1892 const auto pUnoToCoreIt(aUnoToCore.find(rValue.get<paragraphstyle_t>()));
1893 if (pUnoToCoreIt == aUnoToCore.end())
1894 throw lang::IllegalArgumentException();
1895 o_rStyleBase.getNewBase()->SetMask( pUnoToCoreIt->second|SfxStyleSearchBits::UserDefined );
1896}
1897template<>
1898void SwXStyle::SetPropertyValue<SID_SWREGISTER_COLLECTION>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1899{
1900 OUString sName;
1901 rValue >>= sName;
1902 SwRegisterItem aReg(!sName.isEmpty());
1903 aReg.SetWhich(SID_SWREGISTER_MODE);
1904 o_rStyleBase.GetItemSet().Put(aReg);
1905 OUString aString;
1907 o_rStyleBase.GetItemSet().Put(SfxStringItem(SID_SWREGISTER_COLLECTION, aString ) );
1908}
1909template<>
1910void SwXStyle::SetPropertyValue<sal_uInt16(RES_TXTATR_CJK_RUBY)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1911{
1912 if(MID_RUBY_CHARSTYLE != rEntry.nMemberId)
1913 return;
1914 if(!rValue.has<OUString>())
1915 throw lang::IllegalArgumentException();
1916 const auto sValue(rValue.get<OUString>());
1917 SfxItemSet& rStyleSet(o_rStyleBase.GetItemSet());
1918 std::unique_ptr<SwFormatRuby> pRuby;
1919 if(const SwFormatRuby* pRubyItem = rStyleSet.GetItemIfSet(RES_TXTATR_CJK_RUBY))
1920 pRuby.reset(new SwFormatRuby(*pRubyItem));
1921 else
1922 pRuby.reset(new SwFormatRuby(OUString()));
1923 OUString sStyle;
1925 pRuby->SetCharFormatName(sValue);
1926 pRuby->SetCharFormatId(0);
1927 if(!sValue.isEmpty())
1928 {
1930 pRuby->SetCharFormatId(nId);
1931 }
1932 rStyleSet.Put(std::move(pRuby));
1933 SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, rValue, o_rStyleBase);
1934}
1935template<>
1936void SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_DROP)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1937{
1939 {
1940 SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, rValue, o_rStyleBase);
1941 return;
1942 }
1943 if(!rValue.has<OUString>())
1944 throw lang::IllegalArgumentException();
1945 SfxItemSet& rStyleSet(o_rStyleBase.GetItemSet());
1946 std::unique_ptr<SwFormatDrop> pDrop;
1947 if(const SwFormatDrop* pDropItem = rStyleSet.GetItemIfSet(RES_PARATR_DROP))
1948 pDrop.reset(new SwFormatDrop(*pDropItem));
1949 else
1950 pDrop.reset(new SwFormatDrop);
1951 const auto sValue(rValue.get<OUString>());
1952 OUString sStyle;
1954 auto pStyle(static_cast<SwDocStyleSheet*>(m_pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SfxStyleFamily::Char)));
1955 //default character style must not be set as default format
1956 if(!pStyle || pStyle->GetCharFormat() == m_pDoc->GetDfltCharFormat() )
1957 {
1958 throw lang::IllegalArgumentException();
1959 }
1960 pDrop->SetCharFormat(pStyle->GetCharFormat());
1961 rStyleSet.Put(std::move(pDrop));
1962}
1963template<>
1964void SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_NUMRULE)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
1965{
1966 uno::Any aValue(rValue);
1967 lcl_TranslateMetric(rEntry, m_pDoc, aValue);
1968 SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, aValue, o_rStyleBase);
1969 // --> OD 2006-10-18 #i70223#
1970 if(SfxStyleFamily::Para == m_rEntry.family() &&
1971 o_rStyleBase.getNewBase().is() && o_rStyleBase.getNewBase()->GetCollection() &&
1972 //rBase.getNewBase()->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei
1973 o_rStyleBase.getNewBase()->GetCollection()->IsAssignedToListLevelOfOutlineStyle())
1974 {
1975 OUString sNewNumberingRuleName;
1976 aValue >>= sNewNumberingRuleName;
1977 if(sNewNumberingRuleName.isEmpty() || sNewNumberingRuleName != m_pDoc->GetOutlineNumRule()->GetName())
1978 o_rStyleBase.getNewBase()->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle();
1979 }
1980}
1981
1982void SwXStyle::SetStyleProperty(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& rBase)
1983{
1984 using propertytype_t = decltype(rEntry.nWID);
1985 using coresetter_t = std::function<void(SwXStyle&, const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any&, SwStyleBase_Impl&)>;
1986 static const std::map<propertytype_t, coresetter_t> aUnoToCore{
1987 // these explicit std::mem_fn() calls shouldn't be needed, but apparently MSVC is currently too stupid for C++11 again
1988 { FN_UNO_HIDDEN, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_HIDDEN>) },
1989 { FN_UNO_STYLE_INTEROP_GRAB_BAG, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_STYLE_INTEROP_GRAB_BAG>) },
1990 { XATTR_FILLGRADIENT, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(XATTR_FILLGRADIENT)>) },
1991 { XATTR_FILLHATCH, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(XATTR_FILLGRADIENT)>) },
1992 { XATTR_FILLBITMAP, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(XATTR_FILLGRADIENT)>) },
1993 { XATTR_FILLFLOATTRANSPARENCE, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(XATTR_FILLGRADIENT)>) },
1994 { RES_BACKGROUND, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_BACKGROUND)>) },
1995 { OWN_ATTR_FILLBMP_MODE, std::mem_fn(&SwXStyle::SetPropertyValue<OWN_ATTR_FILLBMP_MODE>) },
1996 { RES_PAPER_BIN, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_PAPER_BIN)>) },
1997 { FN_UNO_NUM_RULES, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_NUM_RULES>) },
1999 { FN_UNO_FOLLOW_STYLE, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_FOLLOW_STYLE>) },
2000 { FN_UNO_LINK_STYLE, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_LINK_STYLE>) },
2001 { RES_PAGEDESC, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_PAGEDESC)>) },
2003 { FN_UNO_IS_AUTO_UPDATE, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_IS_AUTO_UPDATE>) },
2004 { FN_UNO_PARA_STYLE_CONDITIONS, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_PARA_STYLE_CONDITIONS>) },
2005 { FN_UNO_CATEGORY, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_CATEGORY>) },
2006 { SID_SWREGISTER_COLLECTION, std::mem_fn(&SwXStyle::SetPropertyValue<SID_SWREGISTER_COLLECTION>) },
2008 { RES_PARATR_DROP, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_DROP)>) },
2010 };
2011 const auto pUnoToCoreIt(aUnoToCore.find(rEntry.nWID));
2012 if(pUnoToCoreIt != aUnoToCore.end())
2013 pUnoToCoreIt->second(*this, rEntry, rPropSet, rValue, rBase);
2014 else
2015 {
2016 // adapted switch logic to a more readable state; removed goto's and made
2017 // execution of standard setting of property in ItemSet dependent of this variable
2018 uno::Any aValue(rValue);
2019 lcl_TranslateMetric(rEntry, m_pDoc, aValue);
2020 SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, aValue, rBase);
2021 }
2022}
2023
2024void SwXStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNames, const uno::Sequence<uno::Any>& rValues)
2025{
2026 if(!m_pDoc)
2027 throw uno::RuntimeException();
2028 sal_Int8 nPropSetId = m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.propMapType();
2029 const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
2030 const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap();
2031 if(rPropertyNames.getLength() != rValues.getLength())
2032 throw lang::IllegalArgumentException();
2033
2034 SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName, &GetDoc()->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent
2035 if(m_pBasePool)
2036 {
2037 SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family());
2038 SAL_WARN_IF(!pBase, "sw.uno", "where is the style?");
2039 if(!pBase)
2040 throw uno::RuntimeException();
2041 aBaseImpl.setNewBase(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
2042 }
2043 if(!aBaseImpl.getNewBase().is() && !m_bIsDescriptor)
2044 throw uno::RuntimeException();
2045
2046 const OUString* pNames = rPropertyNames.getConstArray();
2047 const uno::Any* pValues = rValues.getConstArray();
2048 for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); ++nProp)
2049 {
2050 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(pNames[nProp]);
2051 if(!pEntry || (!m_bIsConditional && pNames[nProp] == UNO_NAME_PARA_STYLE_CONDITIONS))
2052 throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast<cppu::OWeakObject*>(this));
2053 if(pEntry->nFlags & beans::PropertyAttribute::READONLY)
2054 throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast<cppu::OWeakObject*>(this));
2055 if(aBaseImpl.getNewBase().is())
2056 SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl);
2057 else if(!m_pPropertiesImpl->SetProperty(pNames[nProp], pValues[nProp]))
2058 throw lang::IllegalArgumentException();
2059 }
2060
2061 if(aBaseImpl.HasItemSet())
2062 aBaseImpl.getNewBase()->SetItemSet(aBaseImpl.GetItemSet());
2063}
2064
2065void SwXStyle::setPropertyValues(const uno::Sequence<OUString>& rPropertyNames, const uno::Sequence<uno::Any>& rValues)
2066{
2067 SolarMutexGuard aGuard;
2068 // workaround for bad designed API
2069 try
2070 {
2071 SetPropertyValues_Impl( rPropertyNames, rValues );
2072 }
2073 catch (const beans::UnknownPropertyException &rException)
2074 {
2075 // wrap the original (here not allowed) exception in
2076 // a lang::WrappedTargetException that gets thrown instead.
2077 lang::WrappedTargetException aWExc;
2078 aWExc.TargetException <<= rException;
2079 throw aWExc;
2080 }
2081}
2082
2083SfxStyleSheetBase* SwXStyle::GetStyleSheetBase()
2084{
2085 if(!m_pBasePool)
2086 return nullptr;
2087 SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family());
2088 return pBase;
2089}
2090void SwXStyle::PrepareStyleBase(SwStyleBase_Impl& rBase)
2091{
2092 SfxStyleSheetBase* pBase(GetStyleSheetBase());
2093 if(!pBase)
2094 throw uno::RuntimeException();
2095 if(!rBase.getNewBase().is())
2096 rBase.setNewBase(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
2097}
2098
2099template<>
2100uno::Any SwXStyle::GetStyleProperty<HINT_BEGIN>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, SwStyleBase_Impl& rBase);
2101template<>
2102uno::Any SwXStyle::GetStyleProperty<FN_UNO_IS_PHYSICAL>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl&)
2103{
2104 SfxStyleSheetBase* pBase(GetStyleSheetBase());
2105 if(!pBase)
2106 return uno::Any(false);
2107 bool bPhys = static_cast<SwDocStyleSheet*>(pBase)->IsPhysical();
2108 // The standard character format is not existing physically
2109 if( bPhys && SfxStyleFamily::Char == GetFamily() &&
2110 static_cast<SwDocStyleSheet*>(pBase)->GetCharFormat() &&
2111 static_cast<SwDocStyleSheet*>(pBase)->GetCharFormat()->IsDefault() )
2112 bPhys = false;
2113 return uno::Any(bool(bPhys));
2114}
2115template<>
2116uno::Any SwXStyle::GetStyleProperty<FN_UNO_HIDDEN>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl&)
2117{
2118 SfxStyleSheetBase* pBase(GetStyleSheetBase());
2119 if(!pBase)
2120 return uno::Any(false);
2121 rtl::Reference<SwDocStyleSheet> xBase(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
2122 return uno::Any(xBase->IsHidden());
2123}
2124template<>
2125uno::Any SwXStyle::GetStyleProperty<FN_UNO_STYLE_INTEROP_GRAB_BAG>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl&)
2126{
2127 SfxStyleSheetBase* pBase(GetStyleSheetBase());
2128 if(!pBase)
2129 return uno::Any();
2130 uno::Any aRet;
2131 rtl::Reference<SwDocStyleSheet> xBase(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
2132 xBase->GetGrabBagItem(aRet);
2133 return aRet;
2134}
2135template<>
2136uno::Any SwXStyle::GetStyleProperty<sal_uInt16(RES_PAPER_BIN)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, SwStyleBase_Impl& rBase)
2137{
2138 PrepareStyleBase(rBase);
2139 SfxItemSet& rSet = rBase.GetItemSet();
2140 uno::Any aValue;
2141 rPropSet.getPropertyValue(rEntry, rSet, aValue);
2142 sal_Int8 nBin(aValue.get<sal_Int8>());
2143 if(nBin == -1)
2144 return uno::Any(OUString("[From printer settings]"));
2145 SfxPrinter* pPrinter = GetDoc()->getIDocumentDeviceAccess().getPrinter(false);
2146 if(!pPrinter)
2147 return uno::Any();
2148 return uno::Any(pPrinter->GetPaperBinName(nBin));
2149}
2150template<>
2151uno::Any SwXStyle::GetStyleProperty<FN_UNO_NUM_RULES>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
2152{
2153 PrepareStyleBase(rBase);
2154 const SwNumRule* pRule = rBase.getNewBase()->GetNumRule();
2155 assert(pRule && "Where is the NumRule?");
2156 uno::Reference<container::XIndexReplace> xRules(new SwXNumberingRules(*pRule, GetDoc()));
2157 return uno::Any(xRules);
2158}
2159template<>
2160uno::Any SwXStyle::GetStyleProperty<sal_uInt16(RES_PARATR_OUTLINELEVEL)>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
2161{
2162 PrepareStyleBase(rBase);
2163 SAL_WARN_IF(SfxStyleFamily::Para != GetFamily(), "sw.uno", "only paras");
2164 return uno::Any(sal_Int16(rBase.getNewBase()->GetCollection()->GetAttrOutlineLevel()));
2165}
2166template<>
2167uno::Any SwXStyle::GetStyleProperty<FN_UNO_FOLLOW_STYLE>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
2168{
2169 PrepareStyleBase(rBase);
2170 OUString aString;
2171 SwStyleNameMapper::FillProgName(rBase.getNewBase()->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum(GetFamily()));
2172 return uno::Any(aString);
2173}
2174
2175template <>
2176uno::Any SwXStyle::GetStyleProperty<FN_UNO_LINK_STYLE>(const SfxItemPropertyMapEntry&,
2177 const SfxItemPropertySet&,
2178 SwStyleBase_Impl& rBase)
2179{
2180 PrepareStyleBase(rBase);
2181 OUString aString;
2182 SwStyleNameMapper::FillProgName(rBase.getNewBase()->GetLink(), aString,
2183 lcl_GetSwEnumFromSfxEnum(GetFamily()));
2184 return uno::Any(aString);
2185}
2186
2187template<>
2188uno::Any SwXStyle::GetStyleProperty<sal_uInt16(RES_PAGEDESC)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, SwStyleBase_Impl& rBase)
2189{
2190 PrepareStyleBase(rBase);
2192 return GetStyleProperty<HINT_BEGIN>(rEntry, rPropSet, rBase);
2193 // special handling for RES_PAGEDESC
2194 const SwFormatPageDesc* pItem =
2195 rBase.GetItemSet().GetItemIfSet(RES_PAGEDESC);
2196 if(!pItem)
2197 return uno::Any();
2198 const SwPageDesc* pDesc = pItem->GetPageDesc();
2199 if(!pDesc)
2200 return uno::Any();
2201 OUString aString;
2203 return uno::Any(aString);
2204}
2205template<>
2206uno::Any SwXStyle::GetStyleProperty<FN_UNO_IS_AUTO_UPDATE>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
2207{
2208 PrepareStyleBase(rBase);
2209 switch(GetFamily())
2210 {
2211 case SfxStyleFamily::Para : return uno::Any(rBase.getNewBase()->GetCollection()->IsAutoUpdateOnDirectFormat());
2212 case SfxStyleFamily::Frame: return uno::Any(rBase.getNewBase()->GetFrameFormat()->IsAutoUpdateOnDirectFormat());
2213 default: return uno::Any();
2214 }
2215}
2216template<>
2217uno::Any SwXStyle::GetStyleProperty<FN_UNO_DISPLAY_NAME>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
2218{
2219 PrepareStyleBase(rBase);
2220 return uno::Any(rBase.getNewBase()->GetName());
2221}
2222template<>
2223uno::Any SwXStyle::GetStyleProperty<FN_UNO_PARA_STYLE_CONDITIONS>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
2224{
2225 PrepareStyleBase(rBase);
2226 static_assert(COND_COMMAND_COUNT == 28, "invalid size of command count?");
2227 uno::Sequence<beans::NamedValue> aSeq(COND_COMMAND_COUNT);
2228 sal_uInt16 nIndex = 0;
2229 for(auto& rNV : asNonConstRange(aSeq))
2230 {
2231 rNV.Name = GetCommandContextByIndex(nIndex++);
2232 rNV.Value <<= OUString();
2233 }
2234 SwFormat* pFormat = static_cast<SwDocStyleSheet*>(GetStyleSheetBase())->GetCollection();
2235 if(pFormat && RES_CONDTXTFMTCOLL == pFormat->Which())
2236 {
2237 const CommandStruct* pCmds = SwCondCollItem::GetCmds();
2238 beans::NamedValue* pSeq = aSeq.getArray();
2239 for(sal_uInt16 n = 0; n < COND_COMMAND_COUNT; ++n)
2240 {
2241 const SwCollCondition* pCond = static_cast<SwConditionTextFormatColl*>(pFormat)->HasCondition(SwCollCondition(nullptr, pCmds[n].nCnd, pCmds[n].nSubCond));
2242 if(!pCond || !pCond->GetTextFormatColl())
2243 continue;
2244 // get programmatic style name from UI style name
2245 OUString aStyleName = pCond->GetTextFormatColl()->GetName();
2246 SwStyleNameMapper::FillProgName(aStyleName, aStyleName, lcl_GetSwEnumFromSfxEnum(GetFamily()));
2247 pSeq[n].Value <<= aStyleName;
2248 }
2249 }
2250 return uno::Any(aSeq);
2251}
2252template<>
2253uno::Any SwXStyle::GetStyleProperty<FN_UNO_CATEGORY>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
2254{
2255 PrepareStyleBase(rBase);
2256 static const std::map<collectionbits_t, paragraphstyle_t> aUnoToCore = []{
2257 std::map<collectionbits_t, paragraphstyle_t> map;
2258 std::transform(std::begin(sParagraphStyleCategoryEntries), std::end(sParagraphStyleCategoryEntries), std::inserter(map, map.end()),
2259 [] (const ParagraphStyleCategoryEntry& rEntry) { return std::make_pair(rEntry.m_nCollectionBits, rEntry.m_eCategory); });
2260 return map;
2261 }();
2262 const sal_uInt16 nPoolId = rBase.getNewBase()->GetCollection()->GetPoolFormatId();
2263 const auto pUnoToCoreIt(aUnoToCore.find(COLL_GET_RANGE_BITS & nPoolId));
2264 if(pUnoToCoreIt == aUnoToCore.end())
2265 return uno::Any(sal_Int16(-1));
2266 return uno::Any(pUnoToCoreIt->second);
2267}
2268template<>
2269uno::Any SwXStyle::GetStyleProperty<SID_SWREGISTER_COLLECTION>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
2270{
2271 PrepareStyleBase(rBase);
2272 const SwPageDesc *pPageDesc = rBase.getNewBase()->GetPageDesc();
2273 if(!pPageDesc)
2274 return uno::Any(OUString());
2275 const SwTextFormatColl* pCol = pPageDesc->GetRegisterFormatColl();
2276 if(!pCol)
2277 return uno::Any(OUString());
2278 OUString aName;
2280 return uno::Any(aName);
2281}
2282template<>
2283uno::Any SwXStyle::GetStyleProperty<sal_uInt16(RES_BACKGROUND)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
2284{
2285 PrepareStyleBase(rBase);
2286 const SfxItemSet& rSet = rBase.GetItemSet();
2287 const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
2288 uno::Any aResult;
2289 if(!aOriginalBrushItem->QueryValue(aResult, rEntry.nMemberId))
2290 SAL_WARN("sw.uno", "error getting attribute from RES_BACKGROUND.");
2291 return aResult;
2292}
2293template<>
2294uno::Any SwXStyle::GetStyleProperty<OWN_ATTR_FILLBMP_MODE>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
2295{
2296 PrepareStyleBase(rBase);
2297 const SfxItemSet& rSet = rBase.GetItemSet();
2298 if (rSet.Get(XATTR_FILLBMP_TILE).GetValue())
2299 return uno::Any(drawing::BitmapMode_REPEAT);
2300 if (rSet.Get(XATTR_FILLBMP_STRETCH).GetValue())
2301 return uno::Any(drawing::BitmapMode_STRETCH);
2302 return uno::Any(drawing::BitmapMode_NO_REPEAT);
2303}
2304template<>
2305uno::Any SwXStyle::GetStyleProperty<HINT_BEGIN>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, SwStyleBase_Impl& rBase)
2306{
2307 PrepareStyleBase(rBase);
2308 SfxItemSet& rSet = rBase.GetItemSet();
2309 uno::Any aResult;
2310 rPropSet.getPropertyValue(rEntry, rSet, aResult);
2311 //
2312 // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
2313 if(rEntry.aType == cppu::UnoType<sal_Int16>::get() && aResult.getValueType() == cppu::UnoType<sal_Int32>::get())
2314 aResult <<= static_cast<sal_Int16>(aResult.get<sal_Int32>());
2315 // check for needed metric translation
2316 if(rEntry.nMoreFlags & PropertyMoreFlags::METRIC_ITEM && GetDoc())
2317 {
2318 const SfxItemPool& rPool = GetDoc()->GetAttrPool();
2319 const MapUnit eMapUnit(rPool.GetMetric(rEntry.nWID));
2320 bool bAllowedConvert(true);
2321 // exception: If these ItemTypes are used, do not convert when these are negative
2322 // since this means they are intended as percent values
2323 if(XATTR_FILLBMP_SIZEX == rEntry.nWID || XATTR_FILLBMP_SIZEY == rEntry.nWID)
2324 bAllowedConvert = !aResult.has<sal_Int32>() || aResult.get<sal_Int32>() > 0;
2325 if(eMapUnit != MapUnit::Map100thMM && bAllowedConvert)
2326 SvxUnoConvertToMM(eMapUnit, aResult);
2327 }
2328 return aResult;
2329}
2330
2331uno::Any SwXStyle::GetStyleProperty_Impl(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, SwStyleBase_Impl& rBase)
2332{
2333 using propertytype_t = decltype(rEntry.nWID);
2334 using coresetter_t = std::function<uno::Any(SwXStyle&, const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl&)>;
2335 static const std::map<propertytype_t, coresetter_t> aUnoToCore{
2336 // these explicit std::mem_fn() calls shouldn't be needed, but apparently MSVC is currently too stupid for C++11 again
2337 { FN_UNO_IS_PHYSICAL, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_IS_PHYSICAL>) },
2338 { FN_UNO_HIDDEN, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_HIDDEN>) },
2339 { FN_UNO_STYLE_INTEROP_GRAB_BAG, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_STYLE_INTEROP_GRAB_BAG>) },
2340 { RES_PAPER_BIN, std::mem_fn(&SwXStyle::GetStyleProperty<sal_uInt16(RES_PAPER_BIN)>) },
2341 { FN_UNO_NUM_RULES, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_NUM_RULES>) },
2342 { RES_PARATR_OUTLINELEVEL, std::mem_fn(&SwXStyle::GetStyleProperty<sal_uInt16(RES_PARATR_OUTLINELEVEL)>) },
2343 { FN_UNO_FOLLOW_STYLE, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_FOLLOW_STYLE>) },
2344 { FN_UNO_LINK_STYLE, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_LINK_STYLE>) },
2345 { RES_PAGEDESC, std::mem_fn(&SwXStyle::GetStyleProperty<sal_uInt16(RES_PAGEDESC)>) },
2346 { FN_UNO_IS_AUTO_UPDATE, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_IS_AUTO_UPDATE>) },
2347 { FN_UNO_DISPLAY_NAME, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_DISPLAY_NAME>) },
2348 { FN_UNO_PARA_STYLE_CONDITIONS, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_PARA_STYLE_CONDITIONS>) },
2349 { FN_UNO_CATEGORY, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_CATEGORY>) },
2350 { SID_SWREGISTER_COLLECTION, std::mem_fn(&SwXStyle::GetStyleProperty<SID_SWREGISTER_COLLECTION>) },
2351 { RES_BACKGROUND, std::mem_fn(&SwXStyle::GetStyleProperty<sal_uInt16(RES_BACKGROUND)>) },
2352 { OWN_ATTR_FILLBMP_MODE, std::mem_fn(&SwXStyle::GetStyleProperty<OWN_ATTR_FILLBMP_MODE>) }
2353 };
2354 const auto pUnoToCoreIt(aUnoToCore.find(rEntry.nWID));
2355 if(pUnoToCoreIt != aUnoToCore.end())
2356 return pUnoToCoreIt->second(*this, rEntry, rPropSet, rBase);
2357 return GetStyleProperty<HINT_BEGIN>(rEntry, rPropSet, rBase);
2358}
2359
2360uno::Any SwXStyle::GetPropertyValue_Impl(const SfxItemPropertySet* pPropSet, SwStyleBase_Impl& rBase, const OUString& rPropertyName)
2361{
2362 const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
2363 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(rPropertyName);
2364 if(!pEntry || (!m_bIsConditional && rPropertyName == UNO_NAME_PARA_STYLE_CONDITIONS))
2365 throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this));
2366 if(m_pBasePool)
2367 return GetStyleProperty_Impl(*pEntry, *pPropSet, rBase);
2368 const uno::Any* pAny = nullptr;
2369 m_pPropertiesImpl->GetProperty(rPropertyName, pAny);
2370 if(pAny->hasValue())
2371 return *pAny;
2372 uno::Any aValue;
2373 switch(m_rEntry.family())
2374 {
2375 case SfxStyleFamily::Pseudo:
2376 throw uno::RuntimeException("No default value for: " + rPropertyName);
2377 break;
2378 case SfxStyleFamily::Para:
2379 case SfxStyleFamily::Page:
2380 aValue = m_xStyleData->getPropertyValue(rPropertyName);
2381 break;
2382 case SfxStyleFamily::Char:
2383 case SfxStyleFamily::Frame:
2384 {
2385 if(pEntry->nWID < POOLATTR_BEGIN || pEntry->nWID >= RES_UNKNOWNATR_END)
2386 throw uno::RuntimeException("No default value for: " + rPropertyName);
2387 SwFormat* pFormat;
2388 if(m_rEntry.family() == SfxStyleFamily::Char)
2389 pFormat = m_pDoc->GetDfltCharFormat();
2390 else
2391 pFormat = m_pDoc->GetDfltFrameFormat();
2392 const SwAttrPool* pPool = pFormat->GetAttrSet().GetPool();
2393 const SfxPoolItem& rItem = pPool->GetDefaultItem(pEntry->nWID);
2394 rItem.QueryValue(aValue, pEntry->nMemberId);
2395 }
2396 break;
2397 default:
2398 ;
2399 }
2400 return aValue;
2401}
2402
2403uno::Any SwXStyle::getPropertyValue(const OUString& rPropertyName)
2404{
2405 SolarMutexGuard aGuard;
2406 if(!m_pDoc)
2407 throw uno::RuntimeException();
2408 if(!m_pBasePool && !m_bIsDescriptor)
2409 throw uno::RuntimeException();
2410 sal_Int8 nPropSetId = m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.propMapType();
2411 const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
2412 SwStyleBase_Impl aBase(*m_pDoc, m_sStyleName, &m_pDoc->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent
2413 return GetPropertyValue_Impl(pPropSet, aBase, rPropertyName);
2414}
2415
2416uno::Sequence<uno::Any> SwXStyle::getPropertyValues(const uno::Sequence<OUString>& rPropertyNames)
2417{
2418 SolarMutexGuard aGuard;
2419 if(!m_pDoc)
2420 throw uno::RuntimeException();
2421 if(!m_pBasePool && !m_bIsDescriptor)
2422 throw uno::RuntimeException();
2423 sal_Int8 nPropSetId = m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.propMapType();
2424 const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
2425 SwStyleBase_Impl aBase(*m_pDoc, m_sStyleName, &m_pDoc->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent
2426 uno::Sequence<uno::Any> aValues(rPropertyNames.getLength());
2427 auto aValuesRange = asNonConstRange(aValues);
2428 // workaround for bad designed API
2429 try
2430 {
2431 for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); ++nProp)
2432 aValuesRange[nProp] = GetPropertyValue_Impl(pPropSet, aBase, rPropertyNames[nProp]);
2433 }
2434 catch(beans::UnknownPropertyException&)
2435 {
2436 css::uno::Any anyEx = cppu::getCaughtException();
2437 throw css::lang::WrappedTargetRuntimeException("Unknown property exception caught",
2438 static_cast < cppu::OWeakObject * > ( this ), anyEx );
2439 }
2440 catch(lang::WrappedTargetException&)
2441 {
2442 css::uno::Any anyEx = cppu::getCaughtException();
2443 throw lang::WrappedTargetRuntimeException("WrappedTargetException caught",
2444 static_cast < cppu::OWeakObject * > ( this ), anyEx );
2445 }
2446 return aValues;
2447}
2448
2449void SwXStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue)
2450{
2451 SolarMutexGuard aGuard;
2452 const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
2453 const uno::Sequence<uno::Any> aValues(&rValue, 1);
2454 SetPropertyValues_Impl(aProperties, aValues);
2455}
2456
2457beans::PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName)
2458{
2459 SolarMutexGuard aGuard;
2460 uno::Sequence<OUString> aNames{rPropertyName};
2461 uno::Sequence<beans::PropertyState> aStates = getPropertyStates(aNames);
2462 return aStates.getConstArray()[0];
2463}
2464
2465// allow to retarget the SfxItemSet working on, default correctly. Only
2466// use pSourceSet below this point (except in header/footer processing)
2467static const SfxItemSet* lcl_GetItemsetForProperty(const SfxItemSet& rSet, SfxStyleFamily eFamily, std::u16string_view rPropertyName)
2468{
2469 if(eFamily != SfxStyleFamily::Page)
2470 return &rSet;
2471 const bool isFooter = o3tl::starts_with(rPropertyName, u"Footer");
2472 if(!isFooter && !o3tl::starts_with(rPropertyName, u"Header") && rPropertyName != UNO_NAME_FIRST_IS_SHARED)
2473 return &rSet;
2474 const SvxSetItem* pSetItem;
2475 if(!lcl_GetHeaderFooterItem(rSet, rPropertyName, isFooter, pSetItem))
2476 return nullptr;
2477 return &pSetItem->GetItemSet();
2478}
2479uno::Sequence<beans::PropertyState> SwXStyle::getPropertyStates(const uno::Sequence<OUString>& rPropertyNames)
2480{
2481 SolarMutexGuard aGuard;
2482 uno::Sequence<beans::PropertyState> aRet(rPropertyNames.getLength());
2483 beans::PropertyState* pStates = aRet.getArray();
2484
2485 if(!m_pBasePool)
2486 throw uno::RuntimeException();
2487 SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_rEntry.family());
2488
2489 SAL_WARN_IF(!pBase, "sw.uno", "where is the style?");
2490 if(!pBase)
2491 throw uno::RuntimeException();
2492
2493 const OUString* pNames = rPropertyNames.getConstArray();
2494 rtl::Reference<SwDocStyleSheet> xStyle(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
2495 sal_Int8 nPropSetId = m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.propMapType();
2496
2497 const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
2498 const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
2499 const SfxItemSet& rSet = xStyle->GetItemSet();
2500
2501 for(sal_Int32 i = 0; i < rPropertyNames.getLength(); ++i)
2502 {
2503 const OUString sPropName = pNames[i];
2504 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(sPropName);
2505
2506 if(!pEntry)
2507 throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast<cppu::OWeakObject*>(this));
2508
2509 if (FN_UNO_NUM_RULES == pEntry->nWID || FN_UNO_FOLLOW_STYLE == pEntry->nWID
2510 || pEntry->nWID == FN_UNO_LINK_STYLE)
2511 {
2512 // handle NumRules first, done
2513 pStates[i] = beans::PropertyState_DIRECT_VALUE;
2514 continue;
2515 }
2516 const SfxItemSet* pSourceSet = lcl_GetItemsetForProperty(rSet, m_rEntry.family(), sPropName);
2517 if(!pSourceSet)
2518 {
2519 // if no SetItem, value is ambiguous and we are done
2520 pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
2521 continue;
2522 }
2523 switch(pEntry->nWID)
2524 {
2526 {
2527 if(SfxItemState::SET == pSourceSet->GetItemState(XATTR_FILLBMP_STRETCH, false)
2528 || SfxItemState::SET == pSourceSet->GetItemState(XATTR_FILLBMP_TILE, false))
2529 {
2530 pStates[i] = beans::PropertyState_DIRECT_VALUE;
2531 }
2532 else
2533 {
2534 pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
2535 }
2536 }
2537 break;
2538 case XATTR_FILLSTYLE:
2539 {
2540 if (m_rEntry.family() == SfxStyleFamily::Frame
2541 && xStyle->GetFrameFormat()->DerivedFrom() == GetDoc()->GetDfltFrameFormat())
2542 { // tdf#156155 mpDfltFrameFormat is the parent, but because
2543 // it IsDefault() it is not enumerated/exported as a style
2544 // to ODF, so export its one important value here.
2545 pStates[i] = beans::PropertyState_DIRECT_VALUE;
2546 }
2547 else
2548 {
2549 pStates[i] = pPropSet->getPropertyState(*pEntry, *pSourceSet);
2550 }
2551 }
2552 break;
2553 case RES_BACKGROUND:
2554 {
2555 // for FlyFrames we need to mark the used properties from type RES_BACKGROUND
2556 // as beans::PropertyState_DIRECT_VALUE to let users of this property call
2557 // getPropertyValue where the member properties will be mapped from the
2558 // fill attributes to the according SvxBrushItem entries
2560 {
2561 pStates[i] = beans::PropertyState_DIRECT_VALUE;
2562 }
2563 else
2564 {
2565 pStates[i] = beans::PropertyState_DEFAULT_VALUE;
2566 }
2567 }
2568 break;
2569 default:
2570 {
2571 pStates[i] = pPropSet->getPropertyState(*pEntry, *pSourceSet);
2572
2573 if(SfxStyleFamily::Page == m_rEntry.family() && SID_ATTR_PAGE_SIZE == pEntry->nWID && beans::PropertyState_DIRECT_VALUE == pStates[i])
2574 {
2575 const SvxSizeItem& rSize = rSet.Get(SID_ATTR_PAGE_SIZE);
2576 sal_uInt8 nMemberId = pEntry->nMemberId & 0x7f;
2577
2578 if((LONG_MAX == rSize.GetSize().Width() && (MID_SIZE_WIDTH == nMemberId || MID_SIZE_SIZE == nMemberId)) ||
2579 (LONG_MAX == rSize.GetSize().Height() && MID_SIZE_HEIGHT == nMemberId))
2580 {
2581 pStates[i] = beans::PropertyState_DEFAULT_VALUE;
2582 }
2583 }
2584 }
2585 }
2586 }
2587 return aRet;
2588}
2589
2590void SwXStyle::setPropertyToDefault(const OUString& rPropertyName)
2591{
2592 const uno::Sequence<OUString> aSequence(&rPropertyName, 1);
2593 setPropertiesToDefault(aSequence);
2594}
2595
2596static SwFormat* lcl_GetFormatForStyle(SwDoc const * pDoc, const rtl::Reference<SwDocStyleSheet>& xStyle, const SfxStyleFamily eFamily)
2597{
2598 if(!xStyle.is())
2599 return nullptr;
2600 switch(eFamily)
2601 {
2602 case SfxStyleFamily::Char: return xStyle->GetCharFormat();
2603 case SfxStyleFamily::Para: return xStyle->GetCollection();
2604 case SfxStyleFamily::Frame: return xStyle->GetFrameFormat();
2605 case SfxStyleFamily::Page:
2606 {
2607 SwPageDesc* pDesc(pDoc->FindPageDesc(xStyle->GetPageDesc()->GetName()));
2608 if(pDesc)
2609 return &pDesc->GetMaster();
2610 }
2611 break;
2612 default: ;
2613 }
2614 return nullptr;
2615}
2616
2617void SAL_CALL SwXStyle::setPropertiesToDefault(const uno::Sequence<OUString>& aPropertyNames)
2618{
2619 SolarMutexGuard aGuard;
2620 const rtl::Reference<SwDocStyleSheet> xStyle(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(GetStyleSheetBase())));
2621 SwFormat* pTargetFormat = lcl_GetFormatForStyle(m_pDoc, xStyle, m_rEntry.family());
2622 if(!pTargetFormat)
2623 {
2624 if(!m_bIsDescriptor)
2625 return;
2626 for(const auto& rName : aPropertyNames)
2627 m_pPropertiesImpl->ClearProperty(rName);
2628 return;
2629 }
2630 const sal_Int8 nPropSetId = m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.propMapType();
2631 const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
2632 const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap();
2633 for(const auto& rName : aPropertyNames)
2634 {
2635 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(rName);
2636 if(!pEntry)
2637 throw beans::UnknownPropertyException("Unknown property: " + rName, static_cast<cppu::OWeakObject*>(this));
2638 if (pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_LINK_STYLE
2639 || pEntry->nWID == FN_UNO_NUM_RULES)
2640 throw uno::RuntimeException("Cannot reset: " + rName, static_cast<cppu::OWeakObject*>(this));
2641 if(pEntry->nFlags & beans::PropertyAttribute::READONLY)
2642 throw uno::RuntimeException("setPropertiesToDefault: property is read-only: " + rName, static_cast<cppu::OWeakObject*>(this));
2643 if(pEntry->nWID == RES_PARATR_OUTLINELEVEL)
2644 {
2645 static_cast<SwTextFormatColl*>(pTargetFormat)->DeleteAssignmentToListLevelOfOutlineStyle();
2646 continue;
2647 }
2648 pTargetFormat->ResetFormatAttr(pEntry->nWID);
2649 if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
2650 {
2651 //
2652 SwDoc* pDoc = pTargetFormat->GetDoc();
2654 aSet.SetParent(&pTargetFormat->GetAttrSet());
2655
2656 aSet.ClearItem(XATTR_FILLBMP_STRETCH);
2657 aSet.ClearItem(XATTR_FILLBMP_TILE);
2658
2659 pTargetFormat->SetFormatAttr(aSet);
2660 }
2661 }
2662}
2663
2664void SAL_CALL SwXStyle::setAllPropertiesToDefault()
2665{
2666 SolarMutexGuard aGuard;
2667 if(!m_pBasePool)
2668 {
2669 if(!m_bIsDescriptor)
2670 throw uno::RuntimeException();
2671 m_pPropertiesImpl->ClearAllProperties();
2672 return;
2673 }
2674 const rtl::Reference<SwDocStyleSheet> xStyle(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(GetStyleSheetBase())));
2675 if(!xStyle.is())
2676 throw uno::RuntimeException();
2677 if(SfxStyleFamily::Page == m_rEntry.family())
2678 {
2679 size_t nPgDscPos(0);
2680 SwPageDesc* pDesc = m_pDoc->FindPageDesc(xStyle->GetPageDesc()->GetName(), &nPgDscPos);
2681 SwFormat* pPageFormat(nullptr);
2682 if(pDesc)
2683 {
2684 pPageFormat = &pDesc->GetMaster();
2685 pDesc->SetUseOn(UseOnPage::All);
2686 }
2687 else
2688 pPageFormat = lcl_GetFormatForStyle(m_pDoc, xStyle, m_rEntry.family());
2689 SwPageDesc& rPageDesc = m_pDoc->GetPageDesc(nPgDscPos);
2690 rPageDesc.ResetAllMasterAttr();
2691
2692 pPageFormat->SetPageFormatToDefault();
2694 std::shared_ptr<SwFormatFrameSize> aFrameSz(std::make_shared<SwFormatFrameSize>(SwFrameSize::Fixed));
2695
2696 if(RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFormatId())
2697 {
2698 if(m_pDoc->getIDocumentDeviceAccess().getPrinter(false))
2699 {
2700 const Size aPhysSize( SvxPaperInfo::GetPaperSize(
2701 static_cast<Printer*>(m_pDoc->getIDocumentDeviceAccess().getPrinter(false))));
2702 aFrameSz->SetSize(aPhysSize);
2703 }
2704 else
2705 {
2706 aFrameSz->SetSize(SvxPaperInfo::GetDefaultPaperSize());
2707 }
2708
2709 }
2710 else
2711 {
2712 aFrameSz.reset(pStdPgDsc->GetMaster().GetFrameSize().Clone());
2713 }
2714
2715 if(pStdPgDsc->GetLandscape())
2716 {
2717 SwTwips nTmp = aFrameSz->GetHeight();
2718 aFrameSz->SetHeight(aFrameSz->GetWidth());
2719 aFrameSz->SetWidth(nTmp);
2720 }
2721
2722 pPageFormat->SetFormatAttr(*aFrameSz);
2723 m_pDoc->ChgPageDesc(nPgDscPos, m_pDoc->GetPageDesc(nPgDscPos));
2724 return;
2725 }
2726 if(SfxStyleFamily::Para == m_rEntry.family())
2727 {
2728 if(xStyle->GetCollection())
2729 xStyle->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle();
2730 }
2731 SwFormat* const pTargetFormat = lcl_GetFormatForStyle(m_pDoc, xStyle, m_rEntry.family());
2732 if(!pTargetFormat)
2733 return;
2734 pTargetFormat->ResetAllFormatAttr();
2735}
2736
2737uno::Sequence<uno::Any> SAL_CALL SwXStyle::getPropertyDefaults(const uno::Sequence<OUString>& aPropertyNames)
2738{
2739 SolarMutexGuard aGuard;
2740 sal_Int32 nCount = aPropertyNames.getLength();
2741 uno::Sequence<uno::Any> aRet(nCount);
2742 if(!nCount)
2743 return aRet;
2744 auto pRet = aRet.getArray();
2745 SfxStyleSheetBase* pBase = GetStyleSheetBase();
2746 if(!pBase)
2747 throw uno::RuntimeException();
2748 rtl::Reference<SwDocStyleSheet> xStyle(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
2749 const sal_Int8 nPropSetId = m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.propMapType();
2750 const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
2751 const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
2752
2753 const SfxItemSet &rSet = xStyle->GetItemSet(), *pParentSet = rSet.GetParent();
2754 for(sal_Int32 i = 0; i < nCount; ++i)
2755 {
2756 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(aPropertyNames[i]);
2757
2758 if(!pEntry)
2759 throw beans::UnknownPropertyException("Unknown property: " + aPropertyNames[i], static_cast < cppu::OWeakObject * >(this));
2760 // these cannot be in an item set, especially not the
2761 // parent set, so the default value is void
2762 if (pEntry->nWID >= RES_UNKNOWNATR_END)
2763 continue;
2764
2765 if(pParentSet)
2766 {
2767 aSwMapProvider.GetPropertySet(nPropSetId)->getPropertyValue(aPropertyNames[i], *pParentSet, pRet[i]);
2768 }
2769 else if(pEntry->nWID != rSet.GetPool()->GetSlotId(pEntry->nWID))
2770 {
2771 const SfxPoolItem& rItem = rSet.GetPool()->GetDefaultItem(pEntry->nWID);
2772 rItem.QueryValue(pRet[i], pEntry->nMemberId);
2773 }
2774 }
2775 return aRet;
2776}
2777
2778uno::Any SwXStyle::getPropertyDefault(const OUString& rPropertyName)
2779{
2780 const uno::Sequence<OUString> aSequence(&rPropertyName, 1);
2781 return getPropertyDefaults(aSequence)[0];
2782}
2783
2784void SwXStyle::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
2785{
2786 if((rHint.GetId() == SfxHintId::Dying) || (rHint.GetId() == SfxHintId::StyleSheetErased))
2787 {
2788 m_pBasePool = nullptr;
2790 }
2791 else if(rHint.GetId() == SfxHintId::StyleSheetChanged)
2792 {
2793 SfxStyleSheetBasePool& rBP = static_cast<SfxStyleSheetBasePool&>(rBC);
2794 SfxStyleSheetBase* pOwnBase = rBP.Find(m_sStyleName, m_rEntry.family());
2795 if(!pOwnBase)
2796 {
2798 Invalidate();
2799 }
2800 }
2801}
2802
2803void SwXStyle::Invalidate()
2804{
2805 m_sStyleName.clear();
2806 m_pBasePool = nullptr;
2807 m_pDoc = nullptr;
2808 m_xStyleData.clear();
2809 m_xStyleFamily.clear();
2810}
2811
2812SwXPageStyle::SwXPageStyle(SfxStyleSheetBasePool& rPool, SwDocShell* pDocSh, const OUString& rStyleName)
2813 : SwXStyle(&rPool, SfxStyleFamily::Page, pDocSh->GetDoc(), rStyleName)
2814{ }
2815
2816SwXPageStyle::SwXPageStyle(SwDocShell* pDocSh)
2817 : SwXStyle(pDocSh->GetDoc(), SfxStyleFamily::Page)
2818{ }
2819
2820void SwXStyle::PutItemToSet(const SvxSetItem* pSetItem, const SfxItemPropertySet& rPropSet, const SfxItemPropertyMapEntry& rEntry, const uno::Any& rVal, SwStyleBase_Impl& rBaseImpl)
2821{
2822 // create a new SvxSetItem and get it's ItemSet as new target
2823 std::unique_ptr<SvxSetItem> pNewSetItem(pSetItem->Clone());
2824 SfxItemSet& rSetSet = pNewSetItem->GetItemSet();
2825
2826 // set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem
2827 rSetSet.SetParent(&m_pDoc->GetDfltFrameFormat()->GetAttrSet());
2828
2829 // replace the used SfxItemSet at the SwStyleBase_Impl temporarily and use the
2830 // default method to set the property
2831 {
2832 SwStyleBase_Impl::ItemSetOverrider o(rBaseImpl, &rSetSet);
2833 SetStyleProperty(rEntry, rPropSet, rVal, rBaseImpl);
2834 }
2835
2836 // reset parent at ItemSet from SetItem
2837 rSetSet.SetParent(nullptr);
2838
2839 // set the new SvxSetItem at the real target and delete it
2840 rBaseImpl.GetItemSet().Put(std::move(pNewSetItem));
2841}
2842
2843void SwXPageStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNames, const uno::Sequence<uno::Any>& rValues)
2844{
2845 if(!GetDoc())
2846 throw uno::RuntimeException();
2847
2848 if(rPropertyNames.getLength() != rValues.getLength())
2849 throw lang::IllegalArgumentException();
2850
2852 const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
2853 SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName(), &GetDoc()->GetDfltFrameFormat()->GetAttrSet()); // add pDfltFrameFormat as parent
2854 if(!m_pBasePool)
2855 {
2856 if(!IsDescriptor())
2857 throw uno::RuntimeException();
2858 for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); ++nProp)
2859 if(!m_pPropertiesImpl->SetProperty(rPropertyNames[nProp], rValues[nProp]))
2860 throw lang::IllegalArgumentException();
2861 return;
2862 }
2863 SfxStyleSheetBase* pBase = GetStyleSheetBase();
2864 if(!pBase)
2865 throw uno::RuntimeException();
2866 aBaseImpl.setNewBase(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
2867 for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); ++nProp)
2868 {
2869 const OUString& rPropName = rPropertyNames[nProp];
2870 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(rPropName);
2871
2872 if(!pEntry)
2873 throw beans::UnknownPropertyException("Unknown property: " + rPropName, static_cast<cppu::OWeakObject*>(this));
2874 if(pEntry->nFlags & beans::PropertyAttribute::READONLY)
2875 throw beans::PropertyVetoException("Property is read-only: " + rPropName, static_cast<cppu::OWeakObject*>(this));
2876
2877 const bool bHeader(rPropName.startsWith("Header"));
2878 const bool bFooter(rPropName.startsWith("Footer"));
2879 const bool bFirstIsShared(rPropName == UNO_NAME_FIRST_IS_SHARED);
2880 if(bHeader || bFooter || bFirstIsShared)
2881 {
2882 switch(pEntry->nWID)
2883 {
2884 case SID_ATTR_PAGE_ON:
2885 case RES_BACKGROUND:
2886 case RES_BOX:
2887 case RES_LR_SPACE:
2888 case RES_SHADOW:
2889 case RES_UL_SPACE:
2890 case SID_ATTR_PAGE_DYNAMIC:
2891 case SID_ATTR_PAGE_SHARED:
2892 case SID_ATTR_PAGE_SHARED_FIRST:
2893 case SID_ATTR_PAGE_SIZE:
2895 {
2896 // it is a Header/Footer entry, access the SvxSetItem containing it's information
2897 const SvxSetItem* pSetItem = nullptr;
2898 if (lcl_GetHeaderFooterItem(aBaseImpl.GetItemSet(), rPropName, bFooter, pSetItem))
2899 {
2900 PutItemToSet(pSetItem, *pPropSet, *pEntry, rValues[nProp], aBaseImpl);
2901
2902 if (pEntry->nWID == SID_ATTR_PAGE_SHARED_FIRST)
2903 {
2904 // Need to add this to the other as well
2905 pSetItem = aBaseImpl.GetItemSet().GetItemIfSet(
2906 bFooter ? SID_ATTR_PAGE_HEADERSET : SID_ATTR_PAGE_FOOTERSET,
2907 false);
2908 if (pSetItem)
2909 {
2910 PutItemToSet(pSetItem, *pPropSet, *pEntry, rValues[nProp], aBaseImpl);
2911 }
2912 }
2913 }
2914 else if(pEntry->nWID == SID_ATTR_PAGE_ON && rValues[nProp].get<bool>())
2915 {
2916 // Header/footer gets switched on, create defaults and the needed SfxSetItem
2918 <RES_FRMATR_BEGIN,RES_FRMATR_END - 1, // [82
2919
2920 // FillAttribute support
2922
2923 SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER, // [10023
2924 SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE, // [10051
2925 SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED, // [10060
2926 SID_ATTR_PAGE_SHARED_FIRST,SID_ATTR_PAGE_SHARED_FIRST>
2927 aTempSet(*aBaseImpl.GetItemSet().GetPool());
2928
2929 // set correct parent to get the XFILL_NONE FillStyle as needed
2930 aTempSet.SetParent(&GetDoc()->GetDfltFrameFormat()->GetAttrSet());
2931
2932 aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_ON, true));
2934 aTempSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(constTwips_5mm, constTwips_5mm)));
2935 aTempSet.Put(SvxLRSpaceItem(RES_LR_SPACE));
2936 aTempSet.Put(SvxULSpaceItem(RES_UL_SPACE));
2937 aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED, true));
2938 aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED_FIRST, true));
2939 aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, true));
2940
2941 SvxSetItem aNewSetItem(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, aTempSet);
2942 aBaseImpl.GetItemSet().Put(aNewSetItem);
2943 }
2944 }
2945 continue;
2951 case XATTR_FILLBMP_POS:
2955 case XATTR_FILLBMP_TILE:
2957 case XATTR_FILLCOLOR:
2959 case XATTR_FILLBITMAP:
2961 case XATTR_FILLGRADIENT:
2962 case XATTR_FILLHATCH:
2963 case XATTR_FILLSTYLE:
2967 if(bFirstIsShared) // only special handling for headers/footers here
2968 break;
2969 {
2970 const SvxSetItem* pSetItem =
2971 aBaseImpl.GetItemSet().GetItemIfSet(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, false);
2972
2973 if(pSetItem)
2974 {
2975 // create a new SvxSetItem and get it's ItemSet as new target
2976 std::unique_ptr<SvxSetItem> pNewSetItem(pSetItem->Clone());
2977 SfxItemSet& rSetSet = pNewSetItem->GetItemSet();
2978
2979 // set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem
2980 rSetSet.SetParent(&GetDoc()->GetDfltFrameFormat()->GetAttrSet());
2981
2982 // replace the used SfxItemSet at the SwStyleBase_Impl temporarily and use the
2983 // default method to set the property
2984 {
2985 SwStyleBase_Impl::ItemSetOverrider o(aBaseImpl, &rSetSet);
2986 SetStyleProperty(*pEntry, *pPropSet, rValues[nProp], aBaseImpl);
2987 }
2988
2989 // reset parent at ItemSet from SetItem
2990 rSetSet.SetParent(nullptr);
2991
2992 // set the new SvxSetItem at the real target and delete it
2993 aBaseImpl.GetItemSet().Put(std::move(pNewSetItem));
2994 }
2995 }
2996 continue;
2997 default: ;
2998 }
2999 }
3000 switch(pEntry->nWID)
3001 {
3002 case SID_ATTR_PAGE_DYNAMIC:
3003 case SID_ATTR_PAGE_SHARED:
3004 case SID_ATTR_PAGE_SHARED_FIRST:
3005 case SID_ATTR_PAGE_ON:
3007 // these slots are exclusive to Header/Footer, thus this is an error
3008 throw beans::UnknownPropertyException("Unknown property: " + rPropName, static_cast<cppu::OWeakObject*>(this));
3009 case FN_UNO_HEADER:
3010 case FN_UNO_HEADER_LEFT:
3013 case FN_UNO_FOOTER:
3014 case FN_UNO_FOOTER_LEFT:
3017 throw lang::IllegalArgumentException();
3018 case FN_PARAM_FTN_INFO:
3019 {
3020 const SwPageFootnoteInfoItem& rItem = aBaseImpl.GetItemSet().Get(FN_PARAM_FTN_INFO);
3021 std::unique_ptr<SfxPoolItem> pNewFootnoteItem(rItem.Clone());
3022 if(!pNewFootnoteItem->PutValue(rValues[nProp], pEntry->nMemberId))
3023 throw lang::IllegalArgumentException();
3024 aBaseImpl.GetItemSet().Put(std::move(pNewFootnoteItem));
3025 break;
3026 }
3027 default:
3028 {
3029 SetStyleProperty(*pEntry, *pPropSet, rValues[nProp], aBaseImpl);
3030 break;
3031 }
3032 }
3033 }
3034
3035 if(aBaseImpl.HasItemSet())
3036 {
3037 ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
3038
3039 if (undoGuard.UndoWasEnabled())
3040 {
3041 // Fix i64460: as long as Undo of page styles with header/footer causes trouble...
3042 GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
3043 }
3044
3045 aBaseImpl.getNewBase()->SetItemSet(aBaseImpl.GetItemSet());
3046 }
3047}
3048
3049void SwXPageStyle::setPropertyValues(const uno::Sequence<OUString>& rPropertyNames, const uno::Sequence<uno::Any>& rValues)
3050{
3051 SolarMutexGuard aGuard;
3052
3053 // workaround for bad designed API
3054 try
3055 {
3056 SetPropertyValues_Impl(rPropertyNames, rValues);
3057 }
3058 catch (const beans::UnknownPropertyException &rException)
3059 {
3060 // wrap the original (here not allowed) exception in
3061 // a lang::WrappedTargetException that gets thrown instead.
3062 lang::WrappedTargetException aWExc;
3063 aWExc.TargetException <<= rException;
3064 throw aWExc;
3065 }
3066}
3067
3068static uno::Reference<text::XText> lcl_makeHeaderFooter(const sal_uInt16 nRes, const bool bHeader, SwFrameFormat const*const pFrameFormat)
3069{
3070 if (!pFrameFormat)
3071 return nullptr;
3072 const SfxItemSet& rSet = pFrameFormat->GetAttrSet();
3073 const SfxPoolItem* pItem;
3074 if(SfxItemState::SET != rSet.GetItemState(nRes, true, &pItem))
3075 return nullptr;
3076 SwFrameFormat* const pHeadFootFormat = bHeader
3077 ? static_cast<SwFormatHeader*>(const_cast<SfxPoolItem*>(pItem))->GetHeaderFormat()
3078 : static_cast<SwFormatFooter*>(const_cast<SfxPoolItem*>(pItem))->GetFooterFormat();
3079 if(!pHeadFootFormat)
3080 return nullptr;
3081 return SwXHeadFootText::CreateXHeadFootText(*pHeadFootFormat, bHeader);
3082}
3083
3084uno::Sequence<uno::Any> SwXPageStyle::GetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNames)
3085{
3086 if(!GetDoc())
3087 throw uno::RuntimeException();
3088
3089 sal_Int32 nLength = rPropertyNames.getLength();
3090 uno::Sequence<uno::Any> aRet (nLength);
3091 auto aRetRange = asNonConstRange(aRet);
3092 if(!m_pBasePool)
3093 {
3094 if(!IsDescriptor())
3095 throw uno::RuntimeException();
3096 for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); ++nProp)
3097 {
3098 const uno::Any* pAny = nullptr;
3099 m_pPropertiesImpl->GetProperty(rPropertyNames[nProp], pAny);
3100 if (!pAny->hasValue())
3101 aRetRange[nProp] = m_xStyleData->getPropertyValue(rPropertyNames[nProp]);
3102 else
3103 aRetRange[nProp] = *pAny;
3104 }
3105 return aRet;
3106 }
3108 const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
3109 SwStyleBase_Impl aBase(*GetDoc(), GetStyleName(), &GetDoc()->GetDfltFrameFormat()->GetAttrSet()); // add pDfltFrameFormat as parent
3110 SfxStyleSheetBase* pBase = GetStyleSheetBase();
3111 if(!pBase)
3112 throw uno::RuntimeException();
3113 for(sal_Int32 nProp = 0; nProp < nLength; ++nProp)
3114 {
3115 const OUString& rPropName = rPropertyNames[nProp];
3116 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(rPropName);
3117
3118 if (!pEntry)
3119 throw beans::UnknownPropertyException("Unknown property: " + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
3120 const bool bHeader(rPropName.startsWith("Header"));
3121 const bool bFooter(rPropName.startsWith("Footer"));
3122 const bool bFirstIsShared(rPropName == UNO_NAME_FIRST_IS_SHARED);
3123 if(bHeader || bFooter || bFirstIsShared)
3124 {
3125 switch(pEntry->nWID)
3126 {
3127 case SID_ATTR_PAGE_ON:
3128 case RES_BACKGROUND:
3129 case RES_BOX:
3130 case RES_LR_SPACE:
3131 case RES_SHADOW:
3132 case RES_UL_SPACE:
3133 case SID_ATTR_PAGE_DYNAMIC:
3134 case SID_ATTR_PAGE_SHARED:
3135 case SID_ATTR_PAGE_SHARED_FIRST:
3136 case SID_ATTR_PAGE_SIZE:
3138 {
3139 // slot is a Header/Footer slot
3140 rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pBase) ) );
3141 const SfxItemSet& rSet = xStyle->GetItemSet();
3142 const SvxSetItem* pSetItem;
3143
3144 if (lcl_GetHeaderFooterItem(rSet, rPropName, bFooter, pSetItem))
3145 {
3146 // get from SfxItemSet of the corresponding SfxSetItem
3147 const SfxItemSet& rSetSet = pSetItem->GetItemSet();
3148 {
3149 SwStyleBase_Impl::ItemSetOverrider o(aBase, &const_cast< SfxItemSet& >(rSetSet));
3150 aRetRange[nProp] = GetStyleProperty_Impl(*pEntry, *pPropSet, aBase);
3151 }
3152 }
3153 else if(pEntry->nWID == SID_ATTR_PAGE_ON)
3154 {
3155 // header/footer is not available, thus off. Default is <false>, though
3156 aRetRange[nProp] <<= false;
3157 }
3158 }
3159 continue;
3165 case XATTR_FILLBMP_POS:
3169 case XATTR_FILLBMP_TILE:
3171 case XATTR_FILLCOLOR:
3173 case XATTR_FILLBITMAP:
3175 case XATTR_FILLGRADIENT:
3176 case XATTR_FILLHATCH:
3177 case XATTR_FILLSTYLE:
3181 if(bFirstIsShared) // only special handling for headers/footers here
3182 break;
3183 {
3184 rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *static_cast<SwDocStyleSheet*>(pBase) ) );
3185 const SfxItemSet& rSet = xStyle->GetItemSet();
3186 const SvxSetItem* pSetItem =
3187 rSet.GetItemIfSet(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, false);
3188 if(pSetItem)
3189 {
3190 // set at SfxItemSet of the corresponding SfxSetItem
3191 const SfxItemSet& rSetSet = pSetItem->GetItemSet();
3192 {
3193 SwStyleBase_Impl::ItemSetOverrider o(aBase, &const_cast<SfxItemSet&>(rSetSet));
3194 aRetRange[nProp] = GetStyleProperty_Impl(*pEntry, *pPropSet, aBase);
3195 }
3196 }
3197 }
3198 continue;
3199 default: ;
3200 }
3201 }
3202 switch(pEntry->nWID)
3203 {
3204 // these slots are exclusive to Header/Footer, thus this is an error
3205 case SID_ATTR_PAGE_DYNAMIC:
3206 case SID_ATTR_PAGE_SHARED:
3207 case SID_ATTR_PAGE_SHARED_FIRST:
3208 case SID_ATTR_PAGE_ON:
3210 throw beans::UnknownPropertyException( "Unknown property: " + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
3211 case FN_UNO_HEADER:
3212 case FN_UNO_HEADER_LEFT:
3215 case FN_UNO_FOOTER:
3216 case FN_UNO_FOOTER_LEFT:
3219 {
3220 bool bLeft(false);
3221 bool bFirst(false);
3222 sal_uInt16 nRes = 0;
3223 switch(pEntry->nWID)
3224 {
3225 case FN_UNO_HEADER: nRes = RES_HEADER; break;
3226 case FN_UNO_HEADER_LEFT: nRes = RES_HEADER; bLeft = true; break;
3227 case FN_UNO_HEADER_FIRST: nRes = RES_HEADER; bFirst = true; break;
3228 case FN_UNO_HEADER_RIGHT: nRes = RES_HEADER; break;
3229 case FN_UNO_FOOTER: nRes = RES_FOOTER; break;
3230 case FN_UNO_FOOTER_LEFT: nRes = RES_FOOTER; bLeft = true; break;
3231 case FN_UNO_FOOTER_FIRST: nRes = RES_FOOTER; bFirst = true; break;
3232 case FN_UNO_FOOTER_RIGHT: nRes = RES_FOOTER; break;
3233 default: ;
3234 }
3235
3236 const SwPageDesc* pDesc = aBase.GetOldPageDesc();
3237 assert(pDesc);
3238 const SwFrameFormat* pFrameFormat = nullptr;
3239 bool bShare = (nRes == RES_HEADER && pDesc->IsHeaderShared()) || (nRes == RES_FOOTER && pDesc->IsFooterShared());
3240 bool bShareFirst = pDesc->IsFirstShared();
3241 // TextLeft returns the left content if there is one,
3242 // Text and TextRight return the master content.
3243 // TextRight does the same as Text and is for
3244 // compatibility only.
3245 if(bLeft && !bShare)
3246 pFrameFormat = &pDesc->GetLeft();
3247 else if(bFirst && !bShareFirst)
3248 {
3249 pFrameFormat = &pDesc->GetFirstMaster();
3250 // no need to make GetFirstLeft() accessible
3251 // since it is always shared
3252 }
3253 else
3254 pFrameFormat = &pDesc->GetMaster();
3255 const uno::Reference<text::XText> xRet = lcl_makeHeaderFooter(nRes, nRes == RES_HEADER, pFrameFormat);
3256 if (xRet.is())
3257 aRetRange[nProp] <<= xRet;
3258 }
3259 break;
3260 case FN_PARAM_FTN_INFO:
3261 {
3262 rtl::Reference<SwDocStyleSheet> xStyle(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
3263 const SfxItemSet& rSet = xStyle->GetItemSet();
3264 const SfxPoolItem& rItem = rSet.Get(FN_PARAM_FTN_INFO);
3265 rItem.QueryValue(aRetRange[nProp], pEntry->nMemberId);
3266 }
3267 break;
3268 default:
3269 aRetRange[nProp] = GetStyleProperty_Impl(*pEntry, *pPropSet, aBase);
3270 }
3271 }
3272 return aRet;
3273}
3274
3275uno::Sequence<uno::Any> SwXPageStyle::getPropertyValues(const uno::Sequence<OUString>& rPropertyNames)
3276{
3277 SolarMutexGuard aGuard;
3278 uno::Sequence<uno::Any> aValues;
3279
3280 // workaround for bad designed API
3281 try
3282 {
3283 aValues = GetPropertyValues_Impl(rPropertyNames);
3284 }
3285 catch(beans::UnknownPropertyException &)
3286 {
3287 css::uno::Any anyEx = cppu::getCaughtException();
3288 throw lang::WrappedTargetRuntimeException("Unknown property exception caught",
3289 static_cast < cppu::OWeakObject * > ( this ), anyEx );
3290 }
3291 catch(lang::WrappedTargetException &)
3292 {
3293 css::uno::Any anyEx = cppu::getCaughtException();
3294 throw lang::WrappedTargetRuntimeException("WrappedTargetException caught",
3295 static_cast < cppu::OWeakObject * > ( this ), anyEx );
3296 }
3297
3298 return aValues;
3299}
3300
3301uno::Any SwXPageStyle::getPropertyValue(const OUString& rPropertyName)
3302{
3303 SolarMutexGuard aGuard;
3304 const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
3305 return GetPropertyValues_Impl(aProperties)[0];
3306}
3307
3308void SwXPageStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue)
3309{
3310 SolarMutexGuard aGuard;
3311 const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
3312 const uno::Sequence<uno::Any> aValues(&rValue, 1);
3313
3314 // Trick: if the Domain Mapper changes the props of shared header/footer,
3315 // store the old ones in time for later use.
3316 const bool bIsHeader = rPropertyName == UNO_NAME_HEADER_IS_SHARED;
3317 const bool bIsFooter = rPropertyName == UNO_NAME_FOOTER_IS_SHARED;
3318 if ((bIsFooter || bIsHeader) && rValue == uno::Any(true))
3319 {
3320 // Find the matching page descriptor
3321 for (size_t i = 0; i < GetDoc()->GetPageDescCnt(); i++)
3322 {
3323 auto pPageDesc = &GetDoc()->GetPageDesc(i);
3324 // If we have the right page descriptor stash the necessary formats in import time.
3325 if (pPageDesc->GetName() == GetStyleName())
3326 {
3327 auto pLeftHeader = pPageDesc->GetLeft().GetHeader().GetHeaderFormat();
3328 if (bIsHeader && pLeftHeader)
3329 {
3330 pPageDesc->StashFrameFormat(pPageDesc->GetLeft(), true, true, false);
3331 pPageDesc->StashFrameFormat(pPageDesc->GetFirstMaster(), true, false, true);
3332 pPageDesc->StashFrameFormat(pPageDesc->GetFirstLeft(), true, true, true);
3333 }
3334 auto pLeftFooter = pPageDesc->GetLeft().GetFooter().GetFooterFormat();
3335 if (bIsFooter && pLeftFooter)
3336 {
3337 pPageDesc->StashFrameFormat(pPageDesc->GetLeft(), false, true, false);
3338 pPageDesc->StashFrameFormat(pPageDesc->GetFirstMaster(), false, false, true);
3339 pPageDesc->StashFrameFormat(pPageDesc->GetFirstLeft(), false, true, true);
3340 }
3341 }
3342 }
3343 }
3344 // And set the props... as we did it before.
3345 SetPropertyValues_Impl(aProperties, aValues);
3346}
3347
3348SwXFrameStyle::SwXFrameStyle(SwDoc *pDoc)
3349 : SwXFrameStyle_Base(pDoc, SfxStyleFamily::Frame, false)
3350{ }
3351
3352void SwXFrameStyle::SetItem(sal_uInt16 eAtr, const SfxPoolItem& rItem)
3353{
3354 assert(eAtr >= RES_FRMATR_BEGIN && eAtr < RES_FRMATR_END);
3355 SfxStyleSheetBase* pBase = GetStyleSheetBase();
3356 if(!pBase)
3357 return;
3358 rtl::Reference<SwDocStyleSheet> xStyle(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
3359 SfxItemSet& rStyleSet = xStyle->GetItemSet();
3360 SfxItemSet aSet(*rStyleSet.GetPool(), sal_uInt16(eAtr), sal_uInt16(eAtr));
3361 aSet.Put(rItem);
3362 xStyle->SetItemSet(aSet);
3363}
3364
3365const SfxPoolItem* SwXFrameStyle::GetItem(sal_uInt16 eAtr)
3366{
3367 assert(eAtr >= RES_FRMATR_BEGIN && eAtr < RES_FRMATR_END);
3368 SfxStyleSheetBase* pBase = GetStyleSheetBase();
3369 if(!pBase)
3370 return nullptr;
3371 rtl::Reference<SwDocStyleSheet> xStyle(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase)));
3372 return &xStyle->GetItemSet().Get(eAtr);
3373}
3374
3375uno::Reference<container::XNameReplace> SwXFrameStyle::getEvents()
3376{
3377 return new SwFrameStyleEventDescriptor(*this);
3378}
3379
3380// Already implemented autostyle families: 3
3381#define AUTOSTYLE_FAMILY_COUNT 3
3383{
3387};
3388
3390{
3391 std::vector<std::shared_ptr<SfxItemSet>> mAutoStyles;
3392 std::vector<std::shared_ptr<SfxItemSet>>::iterator m_aIter;
3395public:
3397 bool hasMoreElements() { return m_aIter != mAutoStyles.end(); }
3398 std::shared_ptr<SfxItemSet> const & nextElement() { return *(m_aIter++); }
3400 SwDoc& getDoc() const { return m_rDoc; }
3401};
3402
3404 SwUnoCollection(rDocShell.GetDoc()), m_pDocShell( &rDocShell )
3405{
3406}
3407
3409{
3410}
3411
3413{
3415}
3416
3418{
3419 SolarMutexGuard aGuard;
3420 uno::Any aRet;
3421 if(nIndex < 0 || nIndex >= AUTOSTYLE_FAMILY_COUNT)
3422 throw lang::IndexOutOfBoundsException();
3423 if(!IsValid())
3424 throw uno::RuntimeException();
3425
3426 uno::Reference< style::XAutoStyleFamily > aRef;
3428 switch( nType )
3429 {
3431 {
3432 if(!m_xAutoCharStyles.is())
3434 aRef = m_xAutoCharStyles;
3435 }
3436 break;
3438 {
3439 if(!m_xAutoRubyStyles.is())
3441 aRef = m_xAutoRubyStyles;
3442 }
3443 break;
3445 {
3446 if(!m_xAutoParaStyles.is())
3448 aRef = m_xAutoParaStyles;
3449 }
3450 break;
3451
3452 default:
3453 ;
3454 }
3455 aRet <<= aRef;
3456
3457 return aRet;
3458}
3459
3461{
3463}
3464
3466{
3467 return true;
3468}
3469
3471{
3472 uno::Any aRet;
3473 if(Name == "CharacterStyles")
3474 aRet = getByIndex(0);
3475 else if(Name == "RubyStyles")
3476 aRet = getByIndex(1);
3477 else if(Name == "ParagraphStyles")
3478 aRet = getByIndex(2);
3479 else
3480 throw container::NoSuchElementException();
3481 return aRet;
3482}
3483
3484uno::Sequence< OUString > SwXAutoStyles::getElementNames()
3485{
3486 uno::Sequence< OUString > aNames(AUTOSTYLE_FAMILY_COUNT);
3487 OUString* pNames = aNames.getArray();
3488 pNames[0] = "CharacterStyles";
3489 pNames[1] = "RubyStyles";
3490 pNames[2] = "ParagraphStyles";
3491 return aNames;
3492}
3493
3495{
3496 if( Name == "CharacterStyles" ||
3497 Name == "RubyStyles" ||
3498 Name == "ParagraphStyles" )
3499 return true;
3500 else
3501 return false;
3502}
3503
3505 m_pDocShell( pDocSh ), m_eFamily(nFamily)
3506{
3507 // Register ourselves as a listener to the document (via the page descriptor)
3509}
3510
3512{
3513}
3514
3516{
3517 if(rHint.GetId() == SfxHintId::Dying)
3518 m_pDocShell = nullptr;
3519}
3520
3521std::shared_ptr<SfxItemSet>
3523 const uno::Sequence<beans::PropertyValue>& Values, SwAttrSet& aSet)
3524{
3525 const SfxItemPropertySet* pPropSet = nullptr;
3526 switch( eFamily )
3527 {
3529 {
3531 break;
3532 }
3534 {
3536 break;
3537 }
3539 {
3541 break;
3542 }
3543 default: ;
3544 }
3545
3546 if( !pPropSet)
3547 throw uno::RuntimeException();
3548
3549 const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == eFamily);
3550
3551 if(!bTakeCareOfDrawingLayerFillStyle)
3552 {
3553 for( const beans::PropertyValue& rValue : Values )
3554 {
3555 try
3556 {
3557 pPropSet->setPropertyValue( rValue.Name, rValue.Value, aSet );
3558 }
3559 catch (const beans::UnknownPropertyException &)
3560 {
3561 OSL_FAIL( "Unknown property" );
3562 }
3563 catch (const lang::IllegalArgumentException &)
3564 {
3565 OSL_FAIL( "Illegal argument" );
3566 }
3567 }
3568 }
3569 else
3570 {
3571 // set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem
3572 // to make cases in RES_BACKGROUND work correct; target *is* a style
3573 // where this is the case
3575
3576 // here the used DrawingLayer FillStyles are imported when family is
3577 // equal to IStyleAccess::AUTO_STYLE_PARA, thus we will need to serve the
3578 // used slots functionality here to do this correctly
3579 const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
3580
3581 for( const beans::PropertyValue& rValue : Values )
3582 {
3583 const OUString& rPropName = rValue.Name;
3584 uno::Any aValue(rValue.Value);
3585 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(rPropName);
3586
3587 if (!pEntry)
3588 {
3589 SAL_WARN("sw.core", "SwXAutoStyleFamily::insertStyle: Unknown property: " << rPropName);
3590 continue;
3591 }
3592
3593 const sal_uInt8 nMemberId(pEntry->nMemberId);
3594 bool bDone(false);
3595
3596 // check for needed metric translation
3597 if(pEntry->nMoreFlags & PropertyMoreFlags::METRIC_ITEM)
3598 {
3599 bool bDoIt(true);
3600
3601 if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
3602 {
3603 // exception: If these ItemTypes are used, do not convert when these are negative
3604 // since this means they are intended as percent values
3605 sal_Int32 nValue = 0;
3606
3607 if(aValue >>= nValue)
3608 {
3609 bDoIt = nValue > 0;
3610 }
3611 }
3612
3613 if(bDoIt)
3614 {
3615 const SfxItemPool& rPool = rDoc.GetAttrPool();
3616 const MapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));
3617
3618 if(eMapUnit != MapUnit::Map100thMM)
3619 {
3620 SvxUnoConvertFromMM(eMapUnit, aValue);
3621 }
3622 }
3623 }
3624
3625 switch(pEntry->nWID)
3626 {
3627 case XATTR_FILLGRADIENT:
3628 case XATTR_FILLHATCH:
3629 case XATTR_FILLBITMAP:
3631 // not yet needed; activate when LineStyle support may be added
3632 // case XATTR_LINESTART:
3633 // case XATTR_LINEEND:
3634 // case XATTR_LINEDASH:
3635 {
3636 if(MID_NAME == nMemberId)
3637 {
3638 // add set commands for FillName items
3639 OUString aTempName;
3640
3641 if(!(aValue >>= aTempName))
3642 {
3643 throw lang::IllegalArgumentException();
3644 }
3645
3646 SvxShape::SetFillAttribute(pEntry->nWID, aTempName, aSet);
3647 bDone = true;
3648 }
3649 else if (MID_BITMAP == nMemberId)
3650 {
3651 if(XATTR_FILLBITMAP == pEntry->nWID)
3652 {
3653 Graphic aNullGraphic;
3654 XFillBitmapItem aXFillBitmapItem(std::move(aNullGraphic));
3655
3656 aXFillBitmapItem.PutValue(aValue, nMemberId);
3657 aSet.Put(aXFillBitmapItem);
3658 bDone = true;
3659 }
3660 }
3661
3662 break;
3663 }
3664 case RES_BACKGROUND:
3665 {
3666 const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, true, rDoc.IsInXMLImport()));
3667 std::unique_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
3668
3669 aChangedBrushItem->PutValue(aValue, nMemberId);
3670
3671 if(*aChangedBrushItem != *aOriginalBrushItem)
3672 {
3673 setSvxBrushItemAsFillAttributesToTargetSet(*aChangedBrushItem, aSet);
3674 }
3675
3676 bDone = true;
3677 break;
3678 }
3680 {
3681 drawing::BitmapMode eMode;
3682
3683 if(!(aValue >>= eMode))
3684 {
3685 sal_Int32 nMode = 0;
3686
3687 if(!(aValue >>= nMode))
3688 {
3689 throw lang::IllegalArgumentException();
3690 }
3691
3692 eMode = static_cast<drawing::BitmapMode>(nMode);
3693 }
3694
3695 aSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode));
3696 aSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode));
3697
3698 bDone = true;
3699 break;
3700 }
3701 default: break;
3702 }
3703
3704 if(!bDone)
3705 {
3706 try
3707 {
3708 pPropSet->setPropertyValue( rPropName, aValue, aSet );
3709 }
3710 catch (const beans::UnknownPropertyException &)
3711 {
3712 OSL_FAIL( "Unknown property" );
3713 }
3714 catch (const lang::IllegalArgumentException &)
3715 {
3716 OSL_FAIL( "Illegal argument" );
3717 }
3718 }
3719 }
3720
3721 // clear parent again
3722 aSet.SetParent(nullptr);
3723 }
3724
3725 // need to ensure uniqueness of evtl. added NameOrIndex items
3726 // currently in principle only needed when bTakeCareOfDrawingLayerFillStyle,
3727 // but does not hurt and is easily forgotten later eventually, so keep it
3728 // as common case
3730
3731 return rDoc.GetIStyleAccess().cacheAutomaticStyle(aSet, eFamily);
3732}
3733
3734uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
3735 const uno::Sequence< beans::PropertyValue >& Values )
3736{
3737 if (!m_pDocShell)
3738 {
3739 throw uno::RuntimeException();
3740 }
3741
3742 WhichRangesContainer pRange;
3743 switch (m_eFamily)
3744 {
3746 {
3747 pRange = aCharAutoFormatSetRange;
3748 break;
3749 }
3751 {
3753 break;
3754 }
3756 {
3757 pRange = aTextNodeSetRange; // checked, already added support for [XATTR_FILL_FIRST, XATTR_FILL_LAST]
3758 break;
3759 }
3760 default:
3761 throw uno::RuntimeException();
3762 }
3763
3764 SwAttrSet aEmptySet(m_pDocShell->GetDoc()->GetAttrPool(), pRange);
3765 auto pSet = PropValuesToAutoStyleItemSet(*m_pDocShell->GetDoc(), m_eFamily, Values, aEmptySet);
3766
3767 uno::Reference<style::XAutoStyle> xRet = new SwXAutoStyle(m_pDocShell->GetDoc(), pSet, m_eFamily);
3768
3769 return xRet;
3770}
3771
3772uno::Reference< container::XEnumeration > SwXAutoStyleFamily::createEnumeration( )
3773{
3774 if( !m_pDocShell )
3775 throw uno::RuntimeException();
3776 return uno::Reference< container::XEnumeration >
3778}
3779
3781{
3783}
3784
3786{
3787 return false;
3788}
3789
3791: m_rDoc( rInitDoc ), m_eFamily( eFam )
3792{
3793 // special case for ruby auto styles:
3794 if ( IStyleAccess::AUTO_STYLE_RUBY == eFam )
3795 {
3796 std::set< std::pair< sal_uInt16, text::RubyAdjust > > aRubyMap;
3797 SwAttrPool& rAttrPool = m_rDoc.GetAttrPool();
3798
3799 // do this in two phases otherwise we invalidate the iterators when we insert into the pool
3800 std::vector<const SwFormatRuby*> vRubyItems;
3801 for (const SfxPoolItem* pItem : rAttrPool.GetItemSurrogates(RES_TXTATR_CJK_RUBY))
3802 {
3803 auto pRubyItem = dynamic_cast<const SwFormatRuby*>(pItem);
3804 if ( pRubyItem && pRubyItem->GetTextRuby() )
3805 vRubyItems.push_back(pRubyItem);
3806 }
3807 for (const SwFormatRuby* pRubyItem : vRubyItems)
3808 {
3809 std::pair< sal_uInt16, text::RubyAdjust > aPair( pRubyItem->GetPosition(), pRubyItem->GetAdjustment() );
3810 if ( aRubyMap.insert( aPair ).second )
3811 {
3812 auto pItemSet = std::make_shared<SfxItemSetFixed<RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY>>( rAttrPool );
3813 pItemSet->Put( *pRubyItem );
3814 mAutoStyles.push_back( pItemSet );
3815 }
3816 }
3817 }
3818 else
3819 {
3821 }
3822
3823 m_aIter = mAutoStyles.begin();
3824}
3825
3827: m_pImpl( new SwAutoStylesEnumImpl( rDoc, eFam ) )
3828{
3829 // Register ourselves as a listener to the document (via the page descriptor)
3831}
3832
3834{
3835}
3836
3838{
3839 if(rHint.GetId() == SfxHintId::Dying)
3840 m_pImpl.reset();
3841}
3842
3844{
3845 if( !m_pImpl )
3846 throw uno::RuntimeException();
3847 return m_pImpl->hasMoreElements();
3848}
3849
3851{
3852 if( !m_pImpl )
3853 throw uno::RuntimeException();
3854 uno::Any aRet;
3855 if( m_pImpl->hasMoreElements() )
3856 {
3857 std::shared_ptr<SfxItemSet> pNextSet = m_pImpl->nextElement();
3858 uno::Reference< style::XAutoStyle > xAutoStyle = new SwXAutoStyle(&m_pImpl->getDoc(),
3859 pNextSet, m_pImpl->getFamily());
3860 aRet <<= xAutoStyle;
3861 }
3862 return aRet;
3863}
3864
3865// SwXAutoStyle with the family IStyleAccess::AUTO_STYLE_PARA (or
3866// PROPERTY_MAP_PARA_AUTO_STYLE) now uses DrawingLayer FillStyles to allow
3867// unified paragraph background fill, thus the UNO API implementation has to
3868// support the needed slots for these. This seems to be used only for reading
3869// (no setPropertyValue implementation here), so maybe specialized for saving
3870// the Writer Doc to ODF
3871
3873 SwDoc* pDoc,
3874 std::shared_ptr<SfxItemSet> pInitSet,
3876: mpSet(std::move(pInitSet)),
3877 meFamily(eFam),
3878 mrDoc(*pDoc)
3879{
3880 // Register ourselves as a listener to the document (via the page descriptor)
3881 //StartListening(mrDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->GetNotifier());
3882}
3883
3885{
3886}
3887
3889{
3890 if(rHint.GetId() == SfxHintId::Dying)
3891 mpSet.reset();
3892}
3893
3894uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( )
3895{
3896 uno::Reference< beans::XPropertySetInfo > xRet;
3897 switch( meFamily )
3898 {
3900 {
3902 xRet = xCharRef;
3903 }
3904 break;
3906 {
3908 xRet = xRubyRef;
3909 }
3910 break;
3912 {
3914 xRet = xParaRef;
3915 }
3916 break;
3917
3918 default:
3919 ;
3920 }
3921
3922 return xRet;
3923}
3924
3925void SwXAutoStyle::setPropertyValue( const OUString& /*rPropertyName*/, const uno::Any& /*rValue*/ )
3926{
3927}
3928
3929uno::Any SwXAutoStyle::getPropertyValue( const OUString& rPropertyName )
3930{
3931 SolarMutexGuard aGuard;
3932 const uno::Sequence<OUString> aProperties(&rPropertyName, 1);
3933 return GetPropertyValues_Impl(aProperties).getConstArray()[0];
3934}
3935
3936void SwXAutoStyle::addPropertyChangeListener( const OUString& /*aPropertyName*/,
3937 const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
3938{
3939}
3940
3941void SwXAutoStyle::removePropertyChangeListener( const OUString& /*aPropertyName*/,
3942 const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
3943{
3944}
3945
3946void SwXAutoStyle::addVetoableChangeListener( const OUString& /*PropertyName*/,
3947 const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
3948{
3949}
3950
3951void SwXAutoStyle::removeVetoableChangeListener( const OUString& /*PropertyName*/,
3952 const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
3953{
3954}
3955
3957 const uno::Sequence< OUString >& /*aPropertyNames*/,
3958 const uno::Sequence< uno::Any >& /*aValues*/ )
3959{
3960}
3961
3963 const uno::Sequence< OUString > & rPropertyNames )
3964{
3965 if( !mpSet )
3966 {
3967 throw uno::RuntimeException();
3968 }
3969
3970 // query_item
3972 switch(meFamily)
3973 {
3977 default: ;
3978 }
3979
3980 const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
3981 const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
3982 const OUString* pNames = rPropertyNames.getConstArray();
3983
3984 const sal_Int32 nLen(rPropertyNames.getLength());
3985 uno::Sequence< uno::Any > aRet( nLen );
3986 uno::Any* pValues = aRet.getArray();
3987 const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily);
3988
3989 for( sal_Int32 i = 0; i < nLen; ++i )
3990 {
3991 const OUString sPropName = pNames[i];
3992 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(sPropName);
3993 if(!pEntry)
3994 {
3995 throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) );
3996 }
3997
3998 uno::Any aTarget;
3999 bool bDone(false);
4000
4001 if ( RES_TXTATR_AUTOFMT == pEntry->nWID || RES_AUTO_STYLE == pEntry->nWID )
4002 {
4003 OUString sName(StylePool::nameOf( mpSet ));
4004 aTarget <<= sName;
4005 bDone = true;
4006 }
4007 else if(bTakeCareOfDrawingLayerFillStyle)
4008 {
4009 // add support for DrawingLayer FillStyle slots
4010 switch(pEntry->nWID)
4011 {
4012 case RES_BACKGROUND:
4013 {
4014 const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND));
4015
4016 if(!aOriginalBrushItem->QueryValue(aTarget, pEntry->nMemberId))
4017 {
4018 OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)");
4019 }
4020
4021 bDone = true;
4022 break;
4023 }
4025 {
4026 if (mpSet->Get(XATTR_FILLBMP_TILE).GetValue())
4027 {
4028 aTarget <<= drawing::BitmapMode_REPEAT;
4029 }
4030 else if (mpSet->Get(XATTR_FILLBMP_STRETCH).GetValue())
4031 {
4032 aTarget <<= drawing::BitmapMode_STRETCH;
4033 }
4034 else
4035 {
4036 aTarget <<= drawing::BitmapMode_NO_REPEAT;
4037 }
4038
4039 bDone = true;
4040 break;
4041 }
4042 }
4043 }
4044
4045 if(!bDone)
4046 {
4047 pPropSet->getPropertyValue( *pEntry, *mpSet, aTarget );
4048 }
4049
4050 if(bTakeCareOfDrawingLayerFillStyle)
4051 {
4052 if(pEntry->aType == cppu::UnoType<sal_Int16>::get() && pEntry->aType != aTarget.getValueType())
4053 {
4054 // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
4055 sal_Int32 nValue = 0;
4056 if (aTarget >>= nValue)
4057 {
4058 aTarget <<= static_cast<sal_Int16>(nValue);
4059 }
4060 }
4061
4062 // check for needed metric translation
4063 if(pEntry->nMoreFlags & PropertyMoreFlags::METRIC_ITEM)
4064 {
4065 bool bDoIt(true);
4066
4067 if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID)
4068 {
4069 // exception: If these ItemTypes are used, do not convert when these are negative
4070 // since this means they are intended as percent values
4071 sal_Int32 nValue = 0;
4072
4073 if(aTarget >>= nValue)
4074 {
4075 bDoIt = nValue > 0;
4076 }
4077 }
4078
4079 if(bDoIt)
4080 {
4081 const SfxItemPool& rPool = mrDoc.GetAttrPool();
4082 const MapUnit eMapUnit(rPool.GetMetric(pEntry->nWID));
4083
4084 if(eMapUnit != MapUnit::Map100thMM)
4085 {
4086 SvxUnoConvertToMM(eMapUnit, aTarget);
4087 }
4088 }
4089 }
4090 }
4091
4092 // add value
4093 pValues[i] = aTarget;
4094 }
4095
4096 return aRet;
4097}
4098
4099uno::Sequence< uno::Any > SwXAutoStyle::getPropertyValues (
4100 const uno::Sequence< OUString >& rPropertyNames )
4101{
4102 SolarMutexGuard aGuard;
4103 uno::Sequence< uno::Any > aValues;
4104
4105 // workaround for bad designed API
4106 try
4107 {
4108 aValues = GetPropertyValues_Impl( rPropertyNames );
4109 }
4110 catch (beans::UnknownPropertyException &)
4111 {
4112 css::uno::Any exc = cppu::getCaughtException();
4113 throw lang::WrappedTargetRuntimeException("Unknown property exception caught", static_cast < cppu::OWeakObject * > ( this ), exc );
4114 }
4115 catch (lang::WrappedTargetException &)
4116 {
4117 css::uno::Any exc = cppu::getCaughtException();
4118 throw lang::WrappedTargetRuntimeException("WrappedTargetException caught", static_cast < cppu::OWeakObject * > ( this ), exc );
4119 }
4120
4121 return aValues;
4122}
4123
4125 const uno::Sequence< OUString >& /*aPropertyNames*/,
4126 const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
4127{
4128}
4129
4131 const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
4132{
4133}
4134
4136 const uno::Sequence< OUString >& /*aPropertyNames*/,
4137 const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
4138{
4139}
4140
4141beans::PropertyState SwXAutoStyle::getPropertyState( const OUString& rPropertyName )
4142{
4143 SolarMutexGuard aGuard;
4144
4145 uno::Sequence< OUString > aNames { rPropertyName };
4146 uno::Sequence< beans::PropertyState > aStates = getPropertyStates(aNames);
4147 return aStates.getConstArray()[0];
4148}
4149
4150void SwXAutoStyle::setPropertyToDefault( const OUString& /*PropertyName*/ )
4151{
4152}
4153
4154uno::Any SwXAutoStyle::getPropertyDefault( const OUString& rPropertyName )
4155{
4156 const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 );
4157 return getPropertyDefaults ( aSequence ).getConstArray()[0];
4158}
4159
4160uno::Sequence< beans::PropertyState > SwXAutoStyle::getPropertyStates(
4161 const uno::Sequence< OUString >& rPropertyNames )
4162{
4163 if (!mpSet)
4164 {
4165 throw uno::RuntimeException();
4166 }
4167
4168 SolarMutexGuard aGuard;
4169 uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength());
4170 beans::PropertyState* pStates = aRet.getArray();
4171 const OUString* pNames = rPropertyNames.getConstArray();
4172
4174 switch(meFamily)
4175 {
4179 default: ;
4180 }
4181
4182 const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
4183 const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
4184 const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily);
4185
4186 for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
4187 {
4188 const OUString sPropName = pNames[i];
4189 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(sPropName);
4190 if(!pEntry)
4191 {
4192 throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) );
4193 }
4194
4195 bool bDone(false);
4196
4197 if(bTakeCareOfDrawingLayerFillStyle)
4198 {
4199 // DrawingLayer PropertyStyle support
4200 switch(pEntry->nWID)
4201 {
4203 {
4204 if(SfxItemState::SET == mpSet->GetItemState(XATTR_FILLBMP_STRETCH, false)
4205 || SfxItemState::SET == mpSet->GetItemState(XATTR_FILLBMP_TILE, false))
4206 {
4207 pStates[i] = beans::PropertyState_DIRECT_VALUE;
4208 }
4209 else
4210 {
4211 pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE;
4212 }
4213
4214 bDone = true;
4215 break;
4216 }
4217 case RES_BACKGROUND:
4218 {
4220 pEntry->nMemberId))
4221 {
4222 pStates[i] = beans::PropertyState_DIRECT_VALUE;
4223 }
4224 else
4225 {
4226 pStates[i] = beans::PropertyState_DEFAULT_VALUE;
4227 }
4228 bDone = true;
4229
4230 break;
4231 }
4232 }
4233 }
4234
4235 if(!bDone)
4236 {
4237 pStates[i] = pPropSet->getPropertyState(*pEntry, *mpSet );
4238 }
4239 }
4240
4241 return aRet;
4242}
4243
4245{
4246}
4247
4249 const uno::Sequence< OUString >& /*rPropertyNames*/ )
4250{
4251}
4252
4253uno::Sequence< uno::Any > SwXAutoStyle::getPropertyDefaults(
4254 const uno::Sequence< OUString >& /*aPropertyNames*/ )
4255{
4256 return { };
4257}
4258
4259uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties()
4260{
4261 if( !mpSet )
4262 throw uno::RuntimeException();
4263 SolarMutexGuard aGuard;
4264 std::vector< beans::PropertyValue > aPropertyVector;
4265
4266 sal_Int8 nPropSetId = 0;
4267 switch(meFamily)
4268 {
4272 default: ;
4273 }
4274
4275 const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
4276 const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap();
4277
4278 SfxItemSet& rSet = *mpSet;
4279 SfxItemIter aIter(rSet);
4280
4281 for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
4282 {
4283 const sal_uInt16 nWID = pItem->Which();
4284
4285 // TODO: Optimize - and fix! the old iteration filled each WhichId
4286 // only once but there are more properties than WhichIds
4287 for( const auto pEntry : rMap.getPropertyEntries() )
4288 {
4289 if ( pEntry->nWID == nWID )
4290 {
4291 beans::PropertyValue aPropertyValue;
4292 aPropertyValue.Name = pEntry->aName;
4293 pItem->QueryValue( aPropertyValue.Value, pEntry->nMemberId );
4294 aPropertyVector.push_back( aPropertyValue );
4295 }
4296 }
4297 }
4298
4299 const sal_Int32 nCount = aPropertyVector.size();
4300 uno::Sequence< beans::PropertyValue > aRet( nCount );
4301 beans::PropertyValue* pProps = aRet.getArray();
4302
4303 for ( int i = 0; i < nCount; ++i, pProps++ )
4304 {
4305 *pProps = aPropertyVector[i];
4306 }
4307
4308 return aRet;
4309}
4310
4312 m_pDocShell(pDocShell), m_pTableAutoFormat(pTableAutoFormat), m_bPhysical(true)
4313{
4315}
4316
4317SwXTextTableStyle::SwXTextTableStyle(SwDocShell* pDocShell, const OUString& rTableAutoFormatName) :
4318 m_pDocShell(pDocShell), m_pTableAutoFormat_Impl(new SwTableAutoFormat(rTableAutoFormatName)), m_bPhysical(false)
4319{
4322}
4323
4324uno::Reference<style::XStyle> SwXTextTableStyle::CreateXTextTableStyle(SwDocShell* pDocShell, const OUString& rTableAutoFormatName)
4325{
4326 SolarMutexGuard aGuard;
4327 rtl::Reference<SwXTextTableStyle> xTextTableStyle;
4328 SwTableAutoFormat* pAutoFormat = GetTableAutoFormat(pDocShell, rTableAutoFormatName);
4329 if (pAutoFormat && pAutoFormat->GetName() == rTableAutoFormatName)
4330 {
4331 xTextTableStyle = pAutoFormat->GetXObject();
4332 if (!xTextTableStyle.is())
4333 {
4334 xTextTableStyle.set(new SwXTextTableStyle(pDocShell, pAutoFormat));
4335 pAutoFormat->SetXObject(xTextTableStyle);
4336 }
4337 }
4338
4339 // If corresponding AutoFormat doesn't exist create a non physical style.
4340 if (!xTextTableStyle.is())
4341 {
4342 xTextTableStyle.set(new SwXTextTableStyle(pDocShell, rTableAutoFormatName));
4343 SAL_INFO("sw.uno", "creating SwXTextTableStyle for non existing SwTableAutoFormat");
4344 }
4345
4346 return xTextTableStyle;
4347}
4348
4350{
4351 const std::vector<sal_Int32> aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
4352 assert(aTableTemplateMap.size() == STYLE_COUNT && "can not map SwTableAutoFormat to a SwXTextTableStyle");
4353 for (sal_Int32 i=0; i<STYLE_COUNT; ++i)
4354 {
4355 SwBoxAutoFormat* pBoxFormat = &m_pTableAutoFormat->GetBoxFormat(aTableTemplateMap[i]);
4356 rtl::Reference<SwXTextCellStyle> xCellStyle(pBoxFormat->GetXObject());
4357 if (!xCellStyle.is())
4358 {
4359 xCellStyle.set(new SwXTextCellStyle(m_pDocShell, pBoxFormat, m_pTableAutoFormat->GetName()));
4360 pBoxFormat->SetXObject(xCellStyle);
4361 }
4362 m_aCellStyles[i] = xCellStyle;
4363 }
4364}
4365
4367{
4368 static CellStyleNameMap const aMap
4369 {
4370 { "first-row" , FIRST_ROW_STYLE },
4371 { "last-row" , LAST_ROW_STYLE },
4372 { "first-column" , FIRST_COLUMN_STYLE },
4373 { "last-column" , LAST_COLUMN_STYLE },
4374 { "body" , BODY_STYLE },
4375 { "even-rows" , EVEN_ROWS_STYLE },
4376 { "odd-rows" , ODD_ROWS_STYLE },
4377 { "even-columns" , EVEN_COLUMNS_STYLE },
4378 { "odd-columns" , ODD_COLUMNS_STYLE },
4379 { "background" , BACKGROUND_STYLE },
4380 // loext namespace
4381 { "first-row-start-column" , FIRST_ROW_START_COLUMN_STYLE },
4382 { "first-row-end-column" , FIRST_ROW_END_COLUMN_STYLE },
4383 { "last-row-start-column" , LAST_ROW_START_COLUMN_STYLE },
4384 { "last-row-end-column" , LAST_ROW_END_COLUMN_STYLE },
4385 { "first-row-even-column" , FIRST_ROW_EVEN_COLUMN_STYLE },
4386 { "last-row-even-column" , LAST_ROW_EVEN_COLUMN_STYLE },
4387 };
4388 return aMap;
4389}
4390
4392{
4393 return m_pTableAutoFormat;
4394}
4395
4397{
4398 const size_t nStyles = pDocShell->GetDoc()->GetTableStyles().size();
4399 for(size_t i=0; i < nStyles; ++i)
4400 {
4401 SwTableAutoFormat* pAutoFormat = &pDocShell->GetDoc()->GetTableStyles()[i];
4402 if (pAutoFormat->GetName() == sName)
4403 {
4404 return pAutoFormat;
4405 }
4406 }
4407 // not found
4408 return nullptr;
4409}
4410
4412{
4413 if (!m_bPhysical)
4414 {
4415 // find table format in doc
4417 if (pTableAutoFormat)
4418 {
4419 m_bPhysical = true;
4421 const std::vector<sal_Int32> aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
4422 for (size_t i=0; i<aTableTemplateMap.size(); ++i)
4423 {
4424 SwBoxAutoFormat* pOldBoxFormat = &m_pTableAutoFormat->GetBoxFormat(aTableTemplateMap[i]);
4425 rtl::Reference<SwXTextCellStyle> xCellStyle(pOldBoxFormat->GetXObject());
4426 if (!xCellStyle.is())
4427 continue;
4428 SwBoxAutoFormat& rNewBoxFormat = pTableAutoFormat->GetBoxFormat(aTableTemplateMap[i]);
4429 xCellStyle->SetBoxFormat(&rNewBoxFormat);
4430 rNewBoxFormat.SetXObject(xCellStyle);
4431 }
4432 m_pTableAutoFormat_Impl = nullptr;
4433 m_pTableAutoFormat = pTableAutoFormat;
4435 }
4436 else
4437 SAL_WARN("sw.uno", "setting style physical, but SwTableAutoFormat in document not found");
4438 }
4439 else
4440 SAL_WARN("sw.uno", "calling SetPhysical on a physical SwXTextTableStyle");
4441}
4442
4443// XStyle
4445{
4446 SolarMutexGuard aGuard;
4447 // only first style is not user defined
4448 if (m_pDocShell->GetDoc()->GetTableStyles()[0].GetName() == m_pTableAutoFormat->GetName())
4449 return false;
4450
4451 return true;
4452}
4453
4455{
4456 SolarMutexGuard aGuard;
4457 if (!m_bPhysical)
4458 return false;
4459
4461
4462 for (const SwTableFormat* pFormat : *m_pDocShell->GetDoc()->GetTableFrameFormats())
4463 {
4464 if (!pFormat->GetInfo(aGetHt))
4465 {
4466 SwTable* pTable = SwTable::FindTable(pFormat);
4467 if (pTable->GetTableStyleName() == m_pTableAutoFormat->GetName())
4468 return true;
4469 }
4470 }
4471
4472 return false;
4473}
4474
4476{
4477 return OUString();
4478}
4479
4480void SAL_CALL SwXTextTableStyle::setParentStyle(const OUString& /*aParentStyle*/)
4481{ }
4482
4483//XNamed
4485{
4486 SolarMutexGuard aGuard;
4487 OUString sProgName;
4489 return sProgName;
4490}
4491
4492void SAL_CALL SwXTextTableStyle::setName(const OUString& rName)
4493{
4494 SolarMutexGuard aGuard;
4496}
4497
4498//XPropertySet
4499css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL SwXTextTableStyle::getPropertySetInfo()
4500{
4501 static uno::Reference<beans::XPropertySetInfo> xRef(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_STYLE)->getPropertySetInfo());
4502 return xRef;
4503}
4504
4505void SAL_CALL SwXTextTableStyle::setPropertyValue(const OUString& /*rPropertyName*/, const css::uno::Any& /*aValue*/)
4506{
4507 SAL_WARN("sw.uno", "not implemented");
4508}
4509
4510css::uno::Any SAL_CALL SwXTextTableStyle::getPropertyValue(const OUString& rPropertyName)
4511{
4512 SolarMutexGuard aGuard;
4513 bool bIsRow = false;
4514
4515 if (rPropertyName == UNO_NAME_TABLE_FIRST_ROW_END_COLUMN)
4517 else if (rPropertyName == UNO_NAME_TABLE_FIRST_ROW_START_COLUMN)
4519 else if (rPropertyName == UNO_NAME_TABLE_LAST_ROW_END_COLUMN)
4521 else if (rPropertyName == UNO_NAME_TABLE_LAST_ROW_START_COLUMN)
4523 else if (rPropertyName == UNO_NAME_DISPLAY_NAME)
4525 else
4526 throw css::beans::UnknownPropertyException(rPropertyName);
4527
4528 return uno::Any(bIsRow ? OUString("row") : OUString("column"));
4529}
4530
4531void SAL_CALL SwXTextTableStyle::addPropertyChangeListener( const OUString& /*aPropertyName*/, const css::uno::Reference< css::beans::XPropertyChangeListener >& /*xListener*/ )
4532{
4533 SAL_WARN("sw.uno", "not implemented");
4534}
4535
4536void SAL_CALL SwXTextTableStyle::removePropertyChangeListener( const OUString& /*aPropertyName*/, const css::uno::Reference< css::beans::XPropertyChangeListener >& /*aListener*/ )
4537{
4538 SAL_WARN("sw.uno", "not implemented");
4539}
4540
4541void SAL_CALL SwXTextTableStyle::addVetoableChangeListener( const OUString& /*PropertyName*/, const css::uno::Reference< css::beans::XVetoableChangeListener >& /*aListener*/ )
4542{
4543 SAL_WARN("sw.uno", "not implemented");
4544}
4545
4546void SAL_CALL SwXTextTableStyle::removeVetoableChangeListener( const OUString& /*PropertyName*/, const css::uno::Reference< css::beans::XVetoableChangeListener >& /*aListener*/ )
4547{
4548 SAL_WARN("sw.uno", "not implemented");
4549}
4550
4551//XNameAccess
4552uno::Any SAL_CALL SwXTextTableStyle::getByName(const OUString& rName)
4553{
4554 SolarMutexGuard aGuard;
4555 const CellStyleNameMap& rMap = GetCellStyleNameMap();
4556 CellStyleNameMap::const_iterator iter = rMap.find(rName);
4557 if(iter == rMap.end())
4558 throw css::container::NoSuchElementException();
4559
4560 auto nIdx = (*iter).second;
4561 return css::uno::Any(uno::Reference<XInterface>(static_cast<cppu::OWeakObject*>(m_aCellStyles[nIdx].get())));
4562}
4563
4564css::uno::Sequence<OUString> SAL_CALL SwXTextTableStyle::getElementNames()
4565{
4567}
4568
4569sal_Bool SAL_CALL SwXTextTableStyle::hasByName(const OUString& rName)
4570{
4571 const CellStyleNameMap& rMap = GetCellStyleNameMap();
4572 CellStyleNameMap::const_iterator iter = rMap.find(rName);
4573 return iter != rMap.end();
4574}
4575
4576//XNameContainer
4577void SAL_CALL SwXTextTableStyle::insertByName(const OUString& /*Name*/, const uno::Any& /*Element*/)
4578{
4579 SAL_WARN("sw.uno", "not implemented");
4580}
4581
4582void SAL_CALL SwXTextTableStyle::replaceByName(const OUString& rName, const uno::Any& rElement)
4583{
4584 SolarMutexGuard aGuard;
4585 const CellStyleNameMap& rMap = GetCellStyleNameMap();
4586 CellStyleNameMap::const_iterator iter = rMap.find(rName);
4587 if(iter == rMap.end())
4588 throw container::NoSuchElementException();
4589 const sal_Int32 nCellStyle = iter->second;
4590
4591 rtl::Reference<SwXTextCellStyle> xStyleToReplaceWith = dynamic_cast<SwXTextCellStyle*>(rElement.get<uno::Reference<style::XStyle>>().get());
4592 if (!xStyleToReplaceWith.is())
4593 throw lang::IllegalArgumentException();
4594
4595 // replace only with physical ...
4596 if (!xStyleToReplaceWith->IsPhysical())
4597 throw lang::IllegalArgumentException();
4598
4599 const auto& rTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
4600 const sal_Int32 nBoxFormat = rTableTemplateMap[nCellStyle];
4601
4602 // move SwBoxAutoFormat to dest. SwTableAutoFormat
4603 m_pTableAutoFormat->SetBoxFormat(*xStyleToReplaceWith->GetBoxFormat(), nBoxFormat);
4604 // remove unassigned SwBoxAutoFormat, which is not anymore in use anyways
4605 m_pDocShell->GetDoc()->GetCellStyles().RemoveBoxFormat(xStyleToReplaceWith->getName());
4606 // make SwXTextCellStyle use new, moved SwBoxAutoFormat
4607 xStyleToReplaceWith->SetBoxFormat(&m_pTableAutoFormat->GetBoxFormat(nBoxFormat));
4608 m_pTableAutoFormat->GetBoxFormat(nBoxFormat).SetXObject(xStyleToReplaceWith);
4609 // make this SwXTextTableStyle use new SwXTextCellStyle
4610 m_aCellStyles[nCellStyle] = xStyleToReplaceWith;
4611}
4612
4613void SAL_CALL SwXTextTableStyle::removeByName(const OUString& /*Name*/)
4614{
4615 SAL_WARN("sw.uno", "not implemented");
4616}
4617
4618//XElementAccess
4620{
4622}
4623
4625{
4626 return true;
4627}
4628
4629//XServiceInfo
4631{
4632 return {"SwXTextTableStyle"};
4633}
4634
4635sal_Bool SAL_CALL SwXTextTableStyle::supportsService(const OUString& rServiceName)
4636{
4637 return cppu::supportsService(this, rServiceName);
4638}
4639
4640css::uno::Sequence<OUString> SAL_CALL SwXTextTableStyle::getSupportedServiceNames()
4641{
4642 return {"com.sun.star.style.Style"};
4643}
4644
4645// SwXTextCellStyle
4646SwXTextCellStyle::SwXTextCellStyle(SwDocShell* pDocShell, SwBoxAutoFormat* pBoxAutoFormat, OUString sParentStyle) :
4647 m_pDocShell(pDocShell),
4648 m_pBoxAutoFormat(pBoxAutoFormat),
4649 m_sParentStyle(std::move(sParentStyle)),
4650 m_bPhysical(true)
4651{ }
4652
4654 m_pDocShell(pDocShell),
4655 m_pBoxAutoFormat_Impl(std::make_shared<SwBoxAutoFormat>()),
4656 m_sName(std::move(sName)),
4657 m_bPhysical(false)
4658{
4660}
4661
4663{
4664 return m_pBoxAutoFormat;
4665}
4666
4668{
4669 if (m_bPhysical)
4670 m_pBoxAutoFormat = pBoxFormat;
4671 else
4672 SAL_INFO("sw.uno", "trying to call SwXTextCellStyle::SetBoxFormat on non physical style");
4673}
4674
4676{
4677 if (!m_bPhysical)
4678 {
4680 if (pBoxAutoFormat)
4681 {
4682 m_bPhysical = true;
4683 m_pBoxAutoFormat_Impl = nullptr;
4684 m_pBoxAutoFormat = pBoxAutoFormat;
4686 }
4687 else
4688 SAL_WARN("sw.uno", "setting style physical, but SwBoxAutoFormat in document not found");
4689 }
4690 else
4691 SAL_WARN("sw.uno", "calling SetPhysical on a physical SwXTextCellStyle");
4692}
4693
4695{
4696 return m_bPhysical;
4697}
4698
4699SwBoxAutoFormat* SwXTextCellStyle::GetBoxAutoFormat(SwDocShell* pDocShell, std::u16string_view sName, OUString* pParentName)
4700{
4701 if (sName.empty())
4702 return nullptr;
4703
4704 SwBoxAutoFormat* pBoxAutoFormat = pDocShell->GetDoc()->GetCellStyles().GetBoxFormat(sName);
4705 if (!pBoxAutoFormat)
4706 {
4707 sal_Int32 nTemplateIndex;
4708 OUString sParentName;
4709 std::u16string_view sCellSubName;
4710
4711 size_t nSeparatorIndex = sName.rfind('.');
4712 if (nSeparatorIndex == std::u16string_view::npos)
4713 return nullptr;
4714
4715 sParentName = sName.substr(0, nSeparatorIndex);
4716 sCellSubName = sName.substr(nSeparatorIndex+1);
4717 nTemplateIndex = o3tl::toInt32(sCellSubName)-1; // -1 because cell styles names start from 1, but internally are indexed from 0
4718 if (0 > nTemplateIndex)
4719 return nullptr;
4720
4721 const auto& rTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
4722 if (rTableTemplateMap.size() <= o3tl::make_unsigned(nTemplateIndex))
4723 return nullptr;
4724
4726 SwTableAutoFormat* pTableAutoFormat = pDocShell->GetDoc()->GetTableStyles().FindAutoFormat(sParentName);
4727 if (!pTableAutoFormat)
4728 return nullptr;
4729
4730 if (pParentName)
4731 *pParentName = sParentName;
4732 sal_uInt32 nBoxIndex = rTableTemplateMap[nTemplateIndex];
4733 pBoxAutoFormat = &pTableAutoFormat->GetBoxFormat(nBoxIndex);
4734 }
4735
4736 return pBoxAutoFormat;
4737}
4738
4739css::uno::Reference<css::style::XStyle> SwXTextCellStyle::CreateXTextCellStyle(SwDocShell* pDocShell, const OUString& sName)
4740{
4741 rtl::Reference<SwXTextCellStyle> xTextCellStyle;
4742
4743 if (!sName.isEmpty()) // create a cell style for a physical box
4744 {
4745 OUString sParentName;
4746 SwBoxAutoFormat* pBoxFormat = GetBoxAutoFormat(pDocShell, sName, &sParentName);
4747
4748 // something went wrong but we don't want a crash
4749 if (!pBoxFormat)
4750 {
4751 // return a default-dummy style to prevent crash
4752 static SwBoxAutoFormat aDefaultBoxFormat;
4753 pBoxFormat = &aDefaultBoxFormat;
4754 }
4755
4756 xTextCellStyle = pBoxFormat->GetXObject();
4757 if (!xTextCellStyle.is())
4758 {
4759 xTextCellStyle.set(new SwXTextCellStyle(pDocShell, pBoxFormat, sParentName));
4760 pBoxFormat->SetXObject(xTextCellStyle);
4761 }
4762 }
4763 else // create a non physical style
4764 xTextCellStyle.set(new SwXTextCellStyle(pDocShell, sName));
4765
4766 return xTextCellStyle;
4767}
4768
4769// XStyle
4771{
4772 SolarMutexGuard aGuard;
4773 // if this cell belong to first table style then its default style
4775 return false;
4776
4777 return true;
4778}
4779
4781{
4782 SolarMutexGuard aGuard;
4783 uno::Reference<style::XStyleFamiliesSupplier> xFamiliesSupplier(m_pDocShell->GetModel(), uno::UNO_QUERY);
4784 if (!xFamiliesSupplier.is())
4785 return false;
4786
4787 uno::Reference<container::XNameAccess> xFamilies = xFamiliesSupplier->getStyleFamilies();
4788 if (!xFamilies.is())
4789 return false;
4790
4791 uno::Reference<container::XNameAccess> xTableStyles;
4792 xFamilies->getByName("TableStyles") >>= xTableStyles;
4793 if (!xTableStyles.is())
4794 return false;
4795
4796 uno::Reference<style::XStyle> xStyle;
4797 xTableStyles->getByName(m_sParentStyle) >>= xStyle;
4798 if (!xStyle.is())
4799 return false;
4800
4801 return xStyle->isInUse();
4802}
4803
4805{
4806 // Do not return name of the parent (which is a table style) because the parent should be a cell style.
4807 return OUString();
4808}
4809
4810void SAL_CALL SwXTextCellStyle::setParentStyle(const OUString& /*sParentStyle*/)
4811{
4812 // Changing parent to one which is unaware of it will lead to a something unexpected. getName() rely on a parent.
4813 SAL_INFO("sw.uno", "Changing SwXTextCellStyle parent");
4814}
4815
4816//XNamed
4817OUString SAL_CALL SwXTextCellStyle::getName()
4818{
4819 SolarMutexGuard aGuard;
4820 OUString sName;
4821
4822 // if style is physical then we request a name from doc
4823 if (m_bPhysical)
4824 {
4826 if (!pTableFormat)
4827 {
4828 // if auto format is not found as a child of table formats, look in SwDoc cellstyles
4830 }
4831 else
4832 {
4833 OUString sParentStyle;
4835 sName = sParentStyle + pTableFormat->GetTableTemplateCellSubName(*m_pBoxAutoFormat);
4836 }
4837 }
4838 else
4839 sName = m_sName;
4840
4841 return sName;
4842}
4843
4844void SAL_CALL SwXTextCellStyle::setName(const OUString& sName)
4845{
4846 SolarMutexGuard aGuard;
4847 // if style is physical then we can not rename it.
4848 if (!m_bPhysical)
4849 m_sName = sName;
4850 // change name if style is unassigned (name is not generated automatically)
4852}
4853
4854//XPropertySet
4855css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL SwXTextCellStyle::getPropertySetInfo()
4856{
4857 static uno::Reference<beans::XPropertySetInfo> xRef(aSwMapProvider.GetPropertySet(PROPERTY_MAP_CELL_STYLE)->getPropertySetInfo());
4858 return xRef;
4859}
4860
4861void SAL_CALL SwXTextCellStyle::setPropertyValue(const OUString& rPropertyName, const css::uno::Any& aValue)
4862{
4863 SolarMutexGuard aGuard;
4865 if(pEntry)
4866 {
4867 switch(pEntry->nWID)
4868 {
4869 case RES_BACKGROUND:
4870 {
4872 rBrush.PutValue(aValue, 0);
4874 return;
4875 }
4876 case RES_BOX:
4877 {
4879 rBox.PutValue(aValue, pEntry->nMemberId);
4880 m_pBoxAutoFormat->SetBox(rBox);
4881 return;
4882 }
4883 case RES_VERT_ORIENT:
4884 {
4886 rVertOrient.PutValue(aValue, pEntry->nMemberId);
4888 return;
4889 }
4890 case RES_FRAMEDIR:
4891 {
4893 rDirItem.PutValue(aValue, pEntry->nMemberId);
4895 return;
4896 }
4897 case RES_BOXATR_FORMAT:
4898 {
4899 sal_uInt32 nKey;
4900 if (aValue >>= nKey)
4901 {
4902 // FIXME: It's not working for old "automatic" currency formats, which are still in use by autotbl.fmt.
4903 // Scenario:
4904 // 1) Mark all styles present by default in autotbl.fmt as default.
4905 // 2) convert all currencies present in autotbl.fmt before calling this code
4906 const SvNumberformat* pNumFormat = m_pDocShell->GetDoc()->GetNumberFormatter()->GetEntry(nKey);
4907 if (pNumFormat)
4909 }
4910 return;
4911 }
4912 // Paragraph attributes
4913 case RES_PARATR_ADJUST:
4914 {
4915 SvxAdjustItem rAdjustItem = m_pBoxAutoFormat->GetAdjust();
4916 rAdjustItem.PutValue(aValue, pEntry->nMemberId);
4917 m_pBoxAutoFormat->SetAdjust(rAdjustItem);
4918 return;
4919 }
4920 case RES_CHRATR_COLOR:
4921 {
4922 SvxColorItem rColorItem = m_pBoxAutoFormat->GetColor();
4923 rColorItem.PutValue(aValue, pEntry->nMemberId);
4924 m_pBoxAutoFormat->SetColor(rColorItem);
4925 return;
4926 }
4928 {
4929 SvxShadowedItem rShadowedItem = m_pBoxAutoFormat->GetShadowed();
4930 bool bValue = false; aValue >>= bValue;
4931 rShadowedItem.SetValue(bValue);
4932 m_pBoxAutoFormat->SetShadowed(rShadowedItem);
4933 return;
4934 }
4935 case RES_CHRATR_CONTOUR:
4936 {
4937 SvxContourItem rContourItem = m_pBoxAutoFormat->GetContour();
4938 bool bValue = false; aValue >>= bValue;
4939 rContourItem.SetValue(bValue);
4940 m_pBoxAutoFormat->SetContour(rContourItem);
4941 return;
4942 }
4944 {
4946 rCrossedOutItem.PutValue(aValue, pEntry->nMemberId);
4947 m_pBoxAutoFormat->SetCrossedOut(rCrossedOutItem);
4948 return;
4949 }
4951 {
4953 rUnderlineItem.PutValue(aValue, pEntry->nMemberId);
4954 m_pBoxAutoFormat->SetUnderline(rUnderlineItem);
4955 return;
4956 }
4958 {
4959 SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetHeight();
4960 rFontHeightItem.PutValue(aValue, pEntry->nMemberId);
4961 m_pBoxAutoFormat->SetHeight(rFontHeightItem);
4962 return;
4963 }
4964 case RES_CHRATR_WEIGHT:
4965 {
4966 SvxWeightItem rWeightItem = m_pBoxAutoFormat->GetWeight();
4967 rWeightItem.PutValue(aValue, pEntry->nMemberId);
4968 m_pBoxAutoFormat->SetWeight(rWeightItem);
4969 return;
4970 }
4971 case RES_CHRATR_POSTURE:
4972 {
4973 SvxPostureItem rPostureItem = m_pBoxAutoFormat->GetPosture();
4974 rPostureItem.PutValue(aValue, pEntry->nMemberId);
4975 m_pBoxAutoFormat->SetPosture(rPostureItem);
4976 return;
4977 }
4978 case RES_CHRATR_FONT:
4979 {
4980 SvxFontItem rFontItem = m_pBoxAutoFormat->GetFont();
4981 rFontItem.PutValue(aValue, pEntry->nMemberId);
4982 m_pBoxAutoFormat->SetFont(rFontItem);
4983 return;
4984 }
4986 {
4987 SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCJKHeight();
4988 rFontHeightItem.PutValue(aValue, pEntry->nMemberId);
4989 m_pBoxAutoFormat->SetCJKHeight(rFontHeightItem);
4990 return;
4991 }
4993 {
4995 rWeightItem.PutValue(aValue, pEntry->nMemberId);
4996 m_pBoxAutoFormat->SetCJKWeight(rWeightItem);
4997 return;
4998 }
5000 {
5002 rPostureItem.PutValue(aValue, pEntry->nMemberId);
5003 m_pBoxAutoFormat->SetCJKPosture(rPostureItem);
5004 return;
5005 }
5007 {
5009 rFontItem.PutValue(aValue, pEntry->nMemberId);
5010 m_pBoxAutoFormat->SetCJKFont(rFontItem);
5011 return;
5012 }
5014 {
5015 SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCTLHeight();
5016 rFontHeightItem.PutValue(aValue, pEntry->nMemberId);
5017 m_pBoxAutoFormat->SetCTLHeight(rFontHeightItem);
5018 return;
5019 }
5021 {
5023 rWeightItem.PutValue(aValue, pEntry->nMemberId);
5024 m_pBoxAutoFormat->SetCTLWeight(rWeightItem);
5025 return;
5026 }
5028 {
5030 rPostureItem.PutValue(aValue, pEntry->nMemberId);
5031 m_pBoxAutoFormat->SetCTLPosture(rPostureItem);
5032 return;
5033 }
5035 {
5037 rFontItem.PutValue(aValue, pEntry->nMemberId);
5038 m_pBoxAutoFormat->SetCTLFont(rFontItem);
5039 return;
5040 }
5041 default:
5042 SAL_WARN("sw.uno", "SwXTextCellStyle unknown nWID");
5043 throw css::uno::RuntimeException();
5044 }
5045 }
5046
5047 throw css::beans::UnknownPropertyException(rPropertyName);
5048}
5049
5050css::uno::Any SAL_CALL SwXTextCellStyle::getPropertyValue(const OUString& rPropertyName)
5051{
5052 SolarMutexGuard aGuard;
5053 uno::Any aRet;
5055 if(pEntry)
5056 {
5057 switch(pEntry->nWID)
5058 {
5059 case RES_BACKGROUND:
5060 {
5061 const SvxBrushItem& rBrush = m_pBoxAutoFormat->GetBackground();
5062 rBrush.QueryValue(aRet);
5063 return aRet;
5064 }
5065 case RES_BOX:
5066 {
5067 const SvxBoxItem& rBox = m_pBoxAutoFormat->GetBox();
5068 rBox.QueryValue(aRet, pEntry->nMemberId);
5069 return aRet;
5070 }
5071 case RES_VERT_ORIENT:
5072 {
5074 rVertOrient.QueryValue(aRet, pEntry->nMemberId);
5075 return aRet;
5076 }
5077 case RES_FRAMEDIR:
5078 {
5080 rDirItem.QueryValue(aRet, pEntry->nMemberId);
5081 return aRet;
5082 }
5083 case RES_BOXATR_FORMAT:
5084 {
5085 OUString sFormat;
5086 LanguageType eLng, eSys;
5087 m_pBoxAutoFormat->GetValueFormat(sFormat, eLng, eSys);
5088 if(!sFormat.isEmpty())
5089 {
5090 SvNumFormatType nType; bool bNew; sal_Int32 nCheckPos;
5091 sal_uInt32 nKey = m_pDocShell->GetDoc()->GetNumberFormatter()->GetIndexPuttingAndConverting(sFormat, eLng, eSys, nType, bNew, nCheckPos);
5092 aRet <<= nKey;
5093 }
5094 return aRet;
5095 }
5096 // Paragraph attributes
5097 case RES_PARATR_ADJUST:
5098 {
5099 const SvxAdjustItem& rAdjustItem = m_pBoxAutoFormat->GetAdjust();
5100 rAdjustItem.QueryValue(aRet, pEntry->nMemberId);
5101 return aRet;
5102 }
5103 case RES_CHRATR_COLOR:
5104 {
5105 const SvxColorItem& rColorItem = m_pBoxAutoFormat->GetColor();
5106 rColorItem.QueryValue(aRet, pEntry->nMemberId);
5107 return aRet;
5108 }
5110 {
5111 const SvxShadowedItem& rShadowedItem = m_pBoxAutoFormat->GetShadowed();
5112 aRet <<= rShadowedItem.GetValue();
5113 return aRet;
5114 }
5115 case RES_CHRATR_CONTOUR:
5116 {
5117 const SvxContourItem& rContourItem = m_pBoxAutoFormat->GetContour();
5118 aRet <<= rContourItem.GetValue();
5119 return aRet;
5120 }
5122 {
5123 const SvxCrossedOutItem& rCrossedOutItem = m_pBoxAutoFormat->GetCrossedOut();
5124 rCrossedOutItem.QueryValue(aRet, pEntry->nMemberId);
5125 return aRet;
5126 }
5128 {
5129 const SvxUnderlineItem& rUnderlineItem = m_pBoxAutoFormat->GetUnderline();
5130 rUnderlineItem.QueryValue(aRet, pEntry->nMemberId);
5131 return aRet;
5132 }
5134 {
5135 const SvxFontHeightItem& rFontHeightItem = m_pBoxAutoFormat->GetHeight();
5136 rFontHeightItem.QueryValue(aRet, pEntry->nMemberId);
5137 return aRet;
5138 }
5139 case RES_CHRATR_WEIGHT:
5140 {
5141 const SvxWeightItem& rWeightItem = m_pBoxAutoFormat->GetWeight();
5142 rWeightItem.QueryValue(aRet, pEntry->nMemberId);
5143 return aRet;
5144 }
5145 case RES_CHRATR_POSTURE:
5146 {
5147 const SvxPostureItem& rPostureItem = m_pBoxAutoFormat->GetPosture();
5148 rPostureItem.QueryValue(aRet, pEntry->nMemberId);
5149 return aRet;
5150 }
5151 case RES_CHRATR_FONT:
5152 {
5153 const SvxFontItem rFontItem = m_pBoxAutoFormat->GetFont();
5154 rFontItem.QueryValue(aRet, pEntry->nMemberId);
5155 return aRet;
5156 }
5158 {
5159 const SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCJKHeight();
5160 rFontHeightItem.QueryValue(aRet, pEntry->nMemberId);
5161 return aRet;
5162 }
5164 {
5165 const SvxWeightItem& rWeightItem = m_pBoxAutoFormat->GetCJKWeight();
5166 rWeightItem.QueryValue(aRet, pEntry->nMemberId);
5167 return aRet;
5168 }
5170 {
5171 const SvxPostureItem& rPostureItem = m_pBoxAutoFormat->GetCJKPosture();
5172 rPostureItem.QueryValue(aRet, pEntry->nMemberId);
5173 return aRet;
5174 }
5176 {
5177 const SvxFontItem rFontItem = m_pBoxAutoFormat->GetCJKFont();
5178 rFontItem.QueryValue(aRet, pEntry->nMemberId);
5179 return aRet;
5180 }
5182 {
5183 const SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCTLHeight();
5184 rFontHeightItem.QueryValue(aRet, pEntry->nMemberId);
5185 return aRet;
5186 }
5188 {
5189 const SvxWeightItem& rWeightItem = m_pBoxAutoFormat->GetCTLWeight();
5190 rWeightItem.QueryValue(aRet, pEntry->nMemberId);
5191 return aRet;
5192 }
5194 {
5195 const SvxPostureItem& rPostureItem = m_pBoxAutoFormat->GetCTLPosture();
5196 rPostureItem.QueryValue(aRet, pEntry->nMemberId);
5197 return aRet;
5198 }
5200 {
5201 const SvxFontItem rFontItem = m_pBoxAutoFormat->GetCTLFont();
5202 rFontItem.QueryValue(aRet, pEntry->nMemberId);
5203 return aRet;
5204 }
5205 default:
5206 SAL_WARN("sw.uno", "SwXTextCellStyle unknown nWID");
5207 throw css::uno::RuntimeException();
5208 }
5209 }
5210
5211 throw css::beans::UnknownPropertyException(rPropertyName);
5212}
5213
5214void SAL_CALL SwXTextCellStyle::addPropertyChangeListener( const OUString& /*aPropertyName*/, const css::uno::Reference< css::beans::XPropertyChangeListener >& /*xListener*/ )
5215{
5216 SAL_WARN("sw.uno", "not implemented");
5217}
5218
5219void SAL_CALL SwXTextCellStyle::removePropertyChangeListener( const OUString& /*aPropertyName*/, const css::uno::Reference< css::beans::XPropertyChangeListener >& /*aListener*/ )
5220{
5221 SAL_WARN("sw.uno", "not implemented");
5222}
5223
5224void SAL_CALL SwXTextCellStyle::addVetoableChangeListener( const OUString& /*PropertyName*/, const css::uno::Reference< css::beans::XVetoableChangeListener >& /*aListener*/ )
5225{
5226 SAL_WARN("sw.uno", "not implemented");
5227}
5228
5229void SAL_CALL SwXTextCellStyle::removeVetoableChangeListener( const OUString& /*PropertyName*/, const css::uno::Reference< css::beans::XVetoableChangeListener >& /*aListener*/ )
5230{
5231 SAL_WARN("sw.uno", "not implemented");
5232}
5233
5234//XPropertyState
5235css::beans::PropertyState SAL_CALL SwXTextCellStyle::getPropertyState(const OUString& rPropertyName)
5236{
5237 SolarMutexGuard aGuard;
5238 uno::Sequence<OUString> aNames { rPropertyName };
5239 uno::Sequence<beans::PropertyState> aStates = getPropertyStates(aNames);
5240 return aStates.getConstArray()[0];
5241}
5242
5243css::uno::Sequence<css::beans::PropertyState> SAL_CALL SwXTextCellStyle::getPropertyStates(const css::uno::Sequence<OUString>& aPropertyNames)
5244{
5245 SolarMutexGuard aGuard;
5246 uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength());
5247 beans::PropertyState* pStates = aRet.getArray();
5248 const SwBoxAutoFormat& rDefaultBoxFormat = SwTableAutoFormat::GetDefaultBoxFormat();
5250 const OUString* pNames = aPropertyNames.getConstArray();
5251 for(sal_Int32 i=0; i < aPropertyNames.getLength(); ++i)
5252 {
5253 const OUString sPropName = pNames[i];
5254 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(sPropName);
5255 if(pEntry)
5256 {
5257 uno::Any aAny1, aAny2;
5258 switch(pEntry->nWID)
5259 {
5260 case RES_BACKGROUND:
5262 rDefaultBoxFormat.GetBackground().QueryValue(aAny2, pEntry->nMemberId);
5263 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5264 break;
5265 case RES_BOX:
5266 m_pBoxAutoFormat->GetBox().QueryValue(aAny1, pEntry->nMemberId);
5267 rDefaultBoxFormat.GetBox().QueryValue(aAny2, pEntry->nMemberId);
5268 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5269 break;
5270 case RES_VERT_ORIENT:
5272 rDefaultBoxFormat.GetVerticalAlignment().QueryValue(aAny2, pEntry->nMemberId);
5273 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5274 break;
5275 case RES_FRAMEDIR:
5277 rDefaultBoxFormat.GetTextOrientation().QueryValue(aAny2, pEntry->nMemberId);
5278 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5279 break;
5280 case RES_BOXATR_FORMAT:
5281 {
5282 OUString sFormat;
5283 LanguageType eLng, eSys;
5284 m_pBoxAutoFormat->GetValueFormat(sFormat, eLng, eSys);
5285 pStates[i] = sFormat.isEmpty() ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5286 break;
5287 }
5288 case RES_PARATR_ADJUST:
5290 rDefaultBoxFormat.GetAdjust().QueryValue(aAny2, pEntry->nMemberId);
5291 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5292 break;
5293 case RES_CHRATR_COLOR:
5294 m_pBoxAutoFormat->GetColor().QueryValue(aAny1, pEntry->nMemberId);
5295 rDefaultBoxFormat.GetColor().QueryValue(aAny2, pEntry->nMemberId);
5296 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5297 break;
5299 m_pBoxAutoFormat->GetShadowed().QueryValue(aAny1, pEntry->nMemberId);
5300 rDefaultBoxFormat.GetShadowed().QueryValue(aAny2, pEntry->nMemberId);
5301 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5302 break;
5303 case RES_CHRATR_CONTOUR:
5304 m_pBoxAutoFormat->GetContour().QueryValue(aAny1, pEntry->nMemberId);
5305 rDefaultBoxFormat.GetContour().QueryValue(aAny2, pEntry->nMemberId);
5306 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5307 break;
5310 rDefaultBoxFormat.GetCrossedOut().QueryValue(aAny2, pEntry->nMemberId);
5311 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5312 break;
5315 rDefaultBoxFormat.GetUnderline().QueryValue(aAny2, pEntry->nMemberId);
5316 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5317 break;
5320 rDefaultBoxFormat.GetHeight().QueryValue(aAny2, pEntry->nMemberId);
5321 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5322 break;
5323 case RES_CHRATR_WEIGHT:
5325 rDefaultBoxFormat.GetWeight().QueryValue(aAny2, pEntry->nMemberId);
5326 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5327 break;
5328 case RES_CHRATR_POSTURE:
5330 rDefaultBoxFormat.GetPosture().QueryValue(aAny2, pEntry->nMemberId);
5331 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5332 break;
5333 case RES_CHRATR_FONT:
5334 m_pBoxAutoFormat->GetFont().QueryValue(aAny1, pEntry->nMemberId);
5335 rDefaultBoxFormat.GetFont().QueryValue(aAny2, pEntry->nMemberId);
5336 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5337 break;
5340 rDefaultBoxFormat.GetCJKHeight().QueryValue(aAny2, pEntry->nMemberId);
5341 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5342 break;
5345 rDefaultBoxFormat.GetCJKWeight().QueryValue(aAny2, pEntry->nMemberId);
5346 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5347 break;
5350 rDefaultBoxFormat.GetCJKPosture().QueryValue(aAny2, pEntry->nMemberId);
5351 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5352 break;
5355 rDefaultBoxFormat.GetCJKFont().QueryValue(aAny2, pEntry->nMemberId);
5356 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5357 break;
5360 rDefaultBoxFormat.GetCTLHeight().QueryValue(aAny2, pEntry->nMemberId);
5361 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5362 break;
5365 rDefaultBoxFormat.GetCTLWeight().QueryValue(aAny2, pEntry->nMemberId);
5366 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5367 break;
5370 rDefaultBoxFormat.GetCTLPosture().QueryValue(aAny2, pEntry->nMemberId);
5371 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5372 break;
5375 rDefaultBoxFormat.GetCTLFont().QueryValue(aAny2, pEntry->nMemberId);
5376 pStates[i] = aAny1 == aAny2 ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE;
5377 break;
5378 default:
5379 // fallthrough to DIRECT_VALUE, to export properties for which getPropertyStates is not implemented
5380 pStates[i] = beans::PropertyState_DIRECT_VALUE;
5381 SAL_WARN("sw.uno", "SwXTextCellStyle getPropertyStates unknown nWID");
5382 }
5383 }
5384 else
5385 {
5386 SAL_WARN("sw.uno", "SwXTextCellStyle unknown property:" + sPropName);
5387 throw css::beans::UnknownPropertyException(sPropName);
5388 }
5389 }
5390 return aRet;
5391}
5392
5393void SAL_CALL SwXTextCellStyle::setPropertyToDefault(const OUString& rPropertyName)
5394{
5395 SolarMutexGuard aGuard;
5396 const SwBoxAutoFormat& rDefaultBoxFormat = SwTableAutoFormat::GetDefaultBoxFormat();
5398 const SfxItemPropertyMapEntry* pEntry = rMap.getByName(rPropertyName);
5399 if(!pEntry)
5400 return;
5401
5402 uno::Any aAny;
5403 switch(pEntry->nWID)
5404 {
5405 case RES_BACKGROUND:
5406 {
5408 rDefaultBoxFormat.GetBackground().QueryValue(aAny, pEntry->nMemberId);
5409 rBrush.PutValue(aAny, pEntry->nMemberId);
5411 break;
5412 }
5413 case RES_BOX:
5414 {
5416 rDefaultBoxFormat.GetBox().QueryValue(aAny, pEntry->nMemberId);
5417 rBox.PutValue(aAny, pEntry->nMemberId);
5418 m_pBoxAutoFormat->SetBox(rBox);
5419 break;
5420 }
5421 case RES_VERT_ORIENT:
5422 {
5424 rDefaultBoxFormat.GetVerticalAlignment().QueryValue(aAny, pEntry->nMemberId);
5425 rVertOrient.PutValue(aAny, pEntry->nMemberId);
5427 break;
5428 }
5429 case RES_FRAMEDIR:
5430 {
5432 rDefaultBoxFormat.GetTextOrientation().QueryValue(aAny, pEntry->nMemberId);
5433 rFrameDirectionItem.PutValue(aAny, pEntry->nMemberId);
5434 m_pBoxAutoFormat->SetTextOrientation(rFrameDirectionItem);
5435 break;
5436 }
5437 case RES_BOXATR_FORMAT:
5438 {
5439 OUString sFormat;
5440 LanguageType eLng, eSys;
5441 rDefaultBoxFormat.GetValueFormat(sFormat, eLng, eSys);
5442 m_pBoxAutoFormat->SetValueFormat(sFormat, eLng, eSys);
5443 break;
5444 }
5445 case RES_PARATR_ADJUST:
5446 {
5447 SvxAdjustItem rAdjustItem = m_pBoxAutoFormat->GetAdjust();
5448 rDefaultBoxFormat.GetAdjust().QueryValue(aAny, pEntry->nMemberId);
5449 rAdjustItem.PutValue(aAny, pEntry->nMemberId);
5450 m_pBoxAutoFormat->SetAdjust(rAdjustItem);
5451 break;
5452 }
5453 case RES_CHRATR_COLOR:
5454 {
5455 SvxColorItem rColorItem = m_pBoxAutoFormat->GetColor();
5456 rDefaultBoxFormat.GetColor().QueryValue(aAny, pEntry->nMemberId);
5457 rColorItem.PutValue(aAny, pEntry->nMemberId);
5458 m_pBoxAutoFormat->SetColor(rColorItem);
5459 break;
5460 }
5462 {
5463 SvxShadowedItem rShadowedItem = m_pBoxAutoFormat->GetShadowed();
5464 rDefaultBoxFormat.GetShadowed().QueryValue(aAny, pEntry->nMemberId);
5465 rShadowedItem.PutValue(aAny, pEntry->nMemberId);
5466 m_pBoxAutoFormat->SetShadowed(rShadowedItem);
5467 break;
5468 }
5469 case RES_CHRATR_CONTOUR:
5470 {
5471 SvxContourItem rContourItem = m_pBoxAutoFormat->GetContour();
5472 rDefaultBoxFormat.GetContour().QueryValue(aAny, pEntry->nMemberId);
5473 rContourItem.PutValue(aAny, pEntry->nMemberId);
5474 m_pBoxAutoFormat->SetContour(rContourItem);
5475 break;
5476 }
5478 {
5480 rDefaultBoxFormat.GetCrossedOut().QueryValue(aAny, pEntry->nMemberId);
5481 rCrossedOutItem.PutValue(aAny, pEntry->nMemberId);
5482 m_pBoxAutoFormat->SetCrossedOut(rCrossedOutItem);
5483 break;
5484 }
5486 {
5488 rDefaultBoxFormat.GetUnderline().QueryValue(aAny, pEntry->nMemberId);
5489 rUnderlineItem.PutValue(aAny, pEntry->nMemberId);
5490 m_pBoxAutoFormat->SetUnderline(rUnderlineItem);
5491 break;
5492 }
5494 {
5495 SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetHeight();
5496 rDefaultBoxFormat.GetHeight().QueryValue(aAny, pEntry->nMemberId);
5497 rFontHeightItem.PutValue(aAny, pEntry->nMemberId);
5498 m_pBoxAutoFormat->SetHeight(rFontHeightItem);
5499 break;
5500 }
5501 case RES_CHRATR_WEIGHT:
5502 {
5503 SvxWeightItem rWeightItem = m_pBoxAutoFormat->GetWeight();
5504 rDefaultBoxFormat.GetWeight().QueryValue(aAny, pEntry->nMemberId);
5505 rWeightItem.PutValue(aAny, pEntry->nMemberId);
5506 m_pBoxAutoFormat->SetWeight(rWeightItem);
5507 break;
5508 }
5509 case RES_CHRATR_POSTURE:
5510 {
5511 SvxPostureItem rPostureItem = m_pBoxAutoFormat->GetPosture();
5512 rDefaultBoxFormat.GetPosture().QueryValue(aAny, pEntry->nMemberId);
5513 rPostureItem.PutValue(aAny, pEntry->nMemberId);
5514 m_pBoxAutoFormat->SetPosture(rPostureItem);
5515 break;
5516 }
5517 case RES_CHRATR_FONT:
5518 {
5519 SvxFontItem rFontItem = m_pBoxAutoFormat->GetFont();
5520 rDefaultBoxFormat.GetFont().QueryValue(aAny, pEntry->nMemberId);
5521 rFontItem.PutValue(aAny, pEntry->nMemberId);
5522 m_pBoxAutoFormat->SetFont(rFontItem);
5523 break;
5524 }
5526 {
5527 SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCJKHeight();
5528 rDefaultBoxFormat.GetCJKHeight().QueryValue(aAny, pEntry->nMemberId);
5529 rFontHeightItem.PutValue(aAny, pEntry->nMemberId);
5530 m_pBoxAutoFormat->SetCJKHeight(rFontHeightItem);
5531 break;
5532 }
5534 {
5536 rDefaultBoxFormat.GetCJKWeight().QueryValue(aAny, pEntry->nMemberId);
5537 rWeightItem.PutValue(aAny, pEntry->nMemberId);
5538 m_pBoxAutoFormat->SetCJKWeight(rWeightItem);
5539 break;
5540 }
5542 {
5544 rDefaultBoxFormat.GetCJKPosture().QueryValue(aAny, pEntry->nMemberId);
5545 rPostureItem.PutValue(aAny, pEntry->nMemberId);
5546 m_pBoxAutoFormat->SetCJKPosture(rPostureItem);
5547 break;
5548 }
5550 {
5552 rDefaultBoxFormat.GetCJKFont().QueryValue(aAny, pEntry->nMemberId);
5553 rFontItem.PutValue(aAny, pEntry->nMemberId);
5554 m_pBoxAutoFormat->SetCJKFont(rFontItem);
5555 break;
5556 }
5558 {
5559 SvxFontHeightItem rFontHeightItem = m_pBoxAutoFormat->GetCTLHeight();
5560 rDefaultBoxFormat.GetCTLHeight().QueryValue(aAny, pEntry->nMemberId);
5561 rFontHeightItem.PutValue(aAny, pEntry->nMemberId);
5562 m_pBoxAutoFormat->SetCTLHeight(rFontHeightItem);
5563 break;
5564 }
5566 {
5568 rDefaultBoxFormat.GetCTLWeight().QueryValue(aAny, pEntry->nMemberId);
5569 rWeightItem.PutValue(aAny, pEntry->nMemberId);
5570 m_pBoxAutoFormat->SetCTLWeight(rWeightItem);
5571 break;
5572 }
5574 {
5576 rDefaultBoxFormat.GetCTLPosture().QueryValue(aAny, pEntry->nMemberId);
5577 rPostureItem.PutValue(aAny, pEntry->nMemberId);
5578 m_pBoxAutoFormat->SetCTLPosture(rPostureItem);
5579 break;
5580 }
5582 {
5584 rDefaultBoxFormat.GetCTLFont().QueryValue(aAny, pEntry->nMemberId);
5585 rFontItem.PutValue(aAny, pEntry->nMemberId);
5586 m_pBoxAutoFormat->SetCTLFont(rFontItem);
5587 break;
5588 }
5589 default:
5590 SAL_WARN("sw.uno", "SwXTextCellStyle setPropertyToDefault unknown nWID");
5591 }
5592}
5593
5594css::uno::Any SAL_CALL SwXTextCellStyle::getPropertyDefault(const OUString& /*aPropertyName*/)
5595{
5596 SAL_WARN("sw.uno", "not implemented");
5597 uno::Any aRet;
5598 return aRet;
5599}
5600
5601//XServiceInfo
5603{
5604 return {"SwXTextCellStyle"};
5605}
5606
5607sal_Bool SAL_CALL SwXTextCellStyle::supportsService(const OUString& rServiceName)
5608{
5609 return cppu::supportsService(this, rServiceName);
5610}
5611
5612css::uno::Sequence<OUString> SAL_CALL SwXTextCellStyle::getSupportedServiceNames()
5613{
5614 return {"com.sun.star.style.Style"};
5615}
5616
5617/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const PropertyValue * pValues
bool IsConditionalByPoolId(sal_uInt16 nId)
const TranslateId STR_POOLPAGE_ARY[]
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
SwGetPoolIdFromName
PropertiesInfo aProperties
OUString GetCommandContextByIndex(sal_Int16 nIndex)
Definition: ccoll.cxx:74
sal_Int16 GetCommandContextIndex(std::u16string_view rContextName)
Definition: ccoll.cxx:63
#define COND_COMMAND_COUNT
Definition: ccoll.hxx:29
void SetColor(const SvxColorItem &rNew)
const SvxContourItem & GetContour() const
const SvxColorItem & GetColor() const
void SetCJKWeight(const SvxWeightItem &rNew)
const SvxWeightItem & GetWeight() const
void SetCJKHeight(const SvxFontHeightItem &rNew)
const SvxBoxItem & GetBox() const
void SetBackground(const SvxBrushItem &rNew)
void SetShadowed(const SvxShadowedItem &rNew)
const SvxFontHeightItem & GetCJKHeight() const
const SvxWeightItem & GetCTLWeight() const
const SvxFontItem & GetCTLFont() const
void SetHeight(const SvxFontHeightItem &rNew)
void SetCJKPosture(const SvxPostureItem &rNew)
const SvxPostureItem & GetPosture() const
const SvxFontItem & GetFont() const
const SvxWeightItem & GetCJKWeight() const
void SetBox(const SvxBoxItem &rNew)
const SvxPostureItem & GetCJKPosture() const
const SvxFontItem & GetCJKFont() const
const SvxAdjustItem & GetAdjust() const
void SetContour(const SvxContourItem &rNew)
void SetCTLFont(const SvxFontItem &rNew)
void SetWeight(const SvxWeightItem &rNew)
const SvxShadowedItem & GetShadowed() const
void SetUnderline(const SvxUnderlineItem &rNew)
const SvxFontHeightItem & GetCTLHeight() const
const SvxBrushItem & GetBackground() const
void SetCTLPosture(const SvxPostureItem &rNew)
void SetPosture(const SvxPostureItem &rNew)
const SvxFontHeightItem & GetHeight() const
void SetCJKFont(const SvxFontItem &rNew)
void SetCTLWeight(const SvxWeightItem &rNew)
void SetCrossedOut(const SvxCrossedOutItem &rNew)
const SvxPostureItem & GetCTLPosture() const
void SetAdjust(const SvxAdjustItem &rNew)
const SvxCrossedOutItem & GetCrossedOut() const
void SetFont(const SvxFontItem &rNew)
const SvxUnderlineItem & GetUnderline() const
void SetCTLHeight(const SvxFontHeightItem &rNew)
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
virtual std::shared_ptr< SfxItemSet > cacheAutomaticStyle(const SfxItemSet &rSet, SwAutoStyleFamily eFamily)=0
insert the style to the pool and the cache (used during import)
virtual void getAllStyles(std::vector< std::shared_ptr< SfxItemSet > > &rStyles, SwAutoStyleFamily eFamily)=0
void ForAllListeners(std::function< bool(SfxListener *)> f) const
SfxHintId GetId() const
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
bool hasPropertyByName(std::u16string_view rName) const
const o3tl::sorted_vector< const SfxItemPropertyMapEntry *, SfxItemPropertyMapCompare > & getPropertyEntries() const
css::beans::PropertyState getPropertyState(const OUString &rName, const SfxItemSet &rSet) const
void setPropertyValue(const SfxItemPropertyMapEntry &rEntry, const css::uno::Any &aVal, SfxItemSet &rSet) const
const SfxItemPropertyMap & getPropertyMap() const
void getPropertyValue(const SfxItemPropertyMapEntry &rEntry, const SfxItemSet &rSet, css::uno::Any &rAny) const
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
SfxItemPool * GetPool() const
void SetParent(const SfxItemSet *pNew)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxItemSet * GetParent() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
css::uno::Reference< css::frame::XModel3 > GetModel() const
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
sal_uInt16 Which() const
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
virtual std::unique_ptr< SfxStyleSheetIterator > CreateIterator(SfxStyleFamily, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
virtual void Remove(SfxStyleSheetBase *)
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
SfxStyleSheetBase * Next()
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual const OUString & GetParent() const
const OUString & GetName() const
bool IsUserDefined() const
virtual bool SetParent(const OUString &)
virtual bool IsUsed() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
static OUString nameOf(const std::shared_ptr< SfxItemSet > &pSet)
sal_uInt32 GetIndexPuttingAndConverting(OUString &rString, LanguageType eLnge, LanguageType eSysLnge, SvNumFormatType &rType, bool &rNewInserted, sal_Int32 &rCheckPos)
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
LanguageType GetLanguage() const
const OUString & GetFormatstring() const
void EndListeningAll()
bool StartListening(SvtBroadcaster &rBroadcaster)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
const std::optional< vcl::Font > & GetBulletFont() const
static Size GetDefaultPaperSize(MapUnit eUnit=MapUnit::MapTwip)
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual SvxSetItem * Clone(SfxItemPool *pPool=nullptr) const override
static bool SetFillAttribute(sal_uInt16 nWID, const OUString &rName, SfxItemSet &rSet, SdrModel const *pModel)
const Size & GetSize() const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
SwAttrPool * GetPool() const
Definition: swatrset.hxx:190
std::shared_ptr< SfxItemSet > const & nextElement()
Definition: unostyle.cxx:3398
std::vector< std::shared_ptr< SfxItemSet > > mAutoStyles
Definition: unostyle.cxx:3391
std::vector< std::shared_ptr< SfxItemSet > >::iterator m_aIter
Definition: unostyle.cxx:3392
IStyleAccess::SwAutoStyleFamily getFamily() const
Definition: unostyle.cxx:3399
SwDoc & getDoc() const
Definition: unostyle.cxx:3400
IStyleAccess::SwAutoStyleFamily m_eFamily
Definition: unostyle.cxx:3394
SwAutoStylesEnumImpl(SwDoc &rInitDoc, IStyleAccess::SwAutoStyleFamily eFam)
Definition: unostyle.cxx:3790
void SetTextOrientation(const SvxFrameDirectionItem &rNew)
Definition: tblafmt.hxx:87
void GetValueFormat(OUString &rFormat, LanguageType &rLng, LanguageType &rSys) const
Definition: tblafmt.hxx:79
const SwFormatVertOrient & GetVerticalAlignment() const
Definition: tblafmt.hxx:77
void SetXObject(rtl::Reference< SwXTextCellStyle > const &xObject)
Definition: tblafmt.cxx:365
void SetVerticalAlignment(const SwFormatVertOrient &rNew)
Definition: tblafmt.hxx:88
void SetValueFormat(const OUString &rFormat, LanguageType eLng, LanguageType eSys)
Definition: tblafmt.hxx:90
unotools::WeakReference< SwXTextCellStyle > const & GetXObject() const
Definition: tblafmt.hxx:97
const SvxFrameDirectionItem & GetTextOrientation() const
Definition: tblafmt.hxx:76
OUString GetBoxFormatName(const SwBoxAutoFormat &rBoxFormat) const
If found returns its name. If not found returns an empty OUString.
Definition: tblafmt.cxx:1215
void ChangeBoxFormatName(std::u16string_view sFromName, const OUString &sToName)
Definition: tblafmt.cxx:1238
size_t size() const
Definition: tblafmt.cxx:1183
void AddBoxFormat(const SwBoxAutoFormat &rBoxFormat, const OUString &sName)
Add a copy of rBoxFormat.
Definition: tblafmt.cxx:1198
SwBoxAutoFormat * GetBoxFormat(std::u16string_view sName) const
If found returns a ptr to a BoxFormat. If not found returns nullptr.
Definition: tblafmt.cxx:1227
void RemoveBoxFormat(const OUString &sName)
Definition: tblafmt.cxx:1203
Represents the style of a text portion.
Definition: charfmt.hxx:27
const_iterator begin() const
Definition: charformats.hxx:89
const_iterator end() const
Definition: charformats.hxx:90
SwTextFormatColl * GetTextFormatColl() const
Definition: fmtcol.hxx:234
void SetStyle(const OUString *pStyle, sal_uInt16 nPos)
Definition: ccoll.cxx:155
static const CommandStruct * GetCmds()
Definition: ccoll.hxx:58
ErrCode LoadStylesFromFile(const OUString &rURL, SwgReaderOption &rOpt, bool bUnoCall)
Definition: docsh2.cxx:1607
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1152
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
Definition: doc.hxx:197
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:947
const sw::TableFrameFormats * GetTableFrameFormats() const
Definition: doc.hxx:826
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:768
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:252
void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet &rSet)
Definition: docfly.cxx:480
const SwCellStyleTable & GetCellStyles() const
Definition: doc.hxx:1268
size_t GetPageDescCnt() const
Definition: doc.hxx:895
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1081
const sw::FrameFormats< SwFrameFormat * > * GetFrameFormats() const
Definition: doc.hxx:753
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1039
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:755
SwNodes & GetNodes()
Definition: doc.hxx:422
IStyleAccess & GetIStyleAccess()
Definition: doc.hxx:772
bool IsInXMLImport() const
Definition: doc.hxx:985
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:793
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:440
const SwTextFormatColl * GetDfltTextFormatColl() const
Definition: doc.hxx:791
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:978
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:762
SwTableAutoFormatTable & GetTableStyles()
Return the available table styles.
Definition: ndtbl.cxx:3897
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1429
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:896
bool HasTableStyles() const
Counts table styles without triggering lazy-load of them.
Definition: doc.hxx:1260
If SwFormatDrop is a Client, it is the CharFormat that describes the font for the DropCaps.
Definition: paratr.hxx:72
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:65
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
virtual SwFormatFrameSize * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:254
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:34
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:36
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:719
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:61
Defines the vertical position of a fly frame.
Definition: fmtornt.hxx:37
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: atrfrm.cxx:1391
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: atrfrm.cxx:1416
Base class for various Writer styles.
Definition: format.hxx:47
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:618
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
const OUString & GetName() const
Definition: format.hxx:131
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
virtual sal_uInt16 ResetAllFormatAttr()
Takes all hints from Delta-Array,.
Definition: format.cxx:646
Style of a layout element.
Definition: frmfmt.hxx:72
SwCharFormat * GetCharFormat() const
Definition: numrule.hxx:74
const OUString & GetName() const
Definition: numrule.hxx:224
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:275
void StashFrameFormat(const SwFrameFormat &rFormat, bool bHeader, bool bLeft, bool bFirst)
Remember original header/footer formats even when they are hidden by "sharing".
Definition: pagedesc.cxx:409
const OUString & GetName() const
Definition: pagedesc.hxx:196
void ResetAllMasterAttr()
Reset all attrs of the format but keep the ones a pagedesc cannot live without.
Definition: pagedesc.hxx:362
void SetVerticalAdjustment(const drawing::TextVerticalAdjust nVA)
Definition: pagedesc.hxx:264
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
bool IsHeaderShared() const
Definition: pagedesc.hxx:319
bool IsFirstShared() const
Definition: pagedesc.cxx:396
bool IsFooterShared() const
Definition: pagedesc.hxx:323
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:241
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:240
bool GetLandscape() const
Definition: pagedesc.hxx:199
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:239
static SwPageDesc * GetByName(SwDoc &rDoc, std::u16string_view rName)
Definition: pagedesc.cxx:574
void SetUseOn(UseOnPage eNew)
Same as WriteUseOn(), but the >= HeaderShare part of the bitfield is not modified.
Definition: pagedesc.hxx:341
const SwTextFormatColl * GetRegisterFormatColl() const
retrieve the style for the grid alignment
Definition: pagedesc.cxx:223
virtual SwPageFootnoteInfoItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: uiitems.cxx:48
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
void AddAutoFormat(const SwTableAutoFormat &rFormat)
Append table style to the existing styles.
Definition: tblafmt.cxx:949
size_t size() const
Definition: tblafmt.cxx:935
void EraseAutoFormat(size_t i)
Definition: tblafmt.cxx:963
SwTableAutoFormat * FindAutoFormat(std::u16string_view rName) const
Find table style with the provided name, return nullptr when not found.
Definition: tblafmt.cxx:1001
void SetBoxFormat(const SwBoxAutoFormat &rNew, sal_uInt8 nPos)
Definition: tblafmt.cxx:444
static const SwBoxAutoFormat & GetDefaultBoxFormat()
Definition: tblafmt.cxx:486
const SwBoxAutoFormat & GetBoxFormat(sal_uInt8 nPos) const
Definition: tblafmt.cxx:455
bool FirstRowStartColumnIsRow()
Definition: tblafmt.cxx:728
static const std::vector< sal_Int32 > & GetTableTemplateMap()
Returns a vector of indexes in aBoxAutoFormat array. Returned indexes points to cells which are mappe...
Definition: tblafmt.cxx:891
void SetName(const OUString &rNew)
Definition: tblafmt.hxx:205
bool LastRowStartColumnIsRow()
Definition: tblafmt.cxx:736
unotools::WeakReference< SwXTextTableStyle > const & GetXObject() const
Definition: tblafmt.hxx:250
bool LastRowEndColumnIsRow()
Definition: tblafmt.cxx:732
void SetXObject(rtl::Reference< SwXTextTableStyle > const &xObject)
Definition: tblafmt.cxx:925
const OUString & GetName() const
Definition: tblafmt.hxx:206
OUString GetTableTemplateCellSubName(const SwBoxAutoFormat &rBoxFormat) const
Returns the cell's name postfix. eg. ".1".
Definition: tblafmt.cxx:851
bool FirstRowEndColumnIsRow()
These methods returns what style (row or column) is applied first on given Cell.
Definition: tblafmt.cxx:724
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
const OUString & GetTableStyleName() const
Return the table style name of this table.
Definition: swtable.hxx:196
static SwTable * FindTable(SwFrameFormat const *const pFormat)
Definition: swtable.cxx:2308
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
bool IsValid() const
Definition: unocoll.hxx:57
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
Definition: unomap1.cxx:1111
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unostyle.cxx:3780
virtual void Notify(const SfxHint &) override
Definition: unostyle.cxx:3515
SwDocShell * m_pDocShell
Definition: unostyle.hxx:136
virtual ~SwXAutoStyleFamily() override
Definition: unostyle.cxx:3511
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unostyle.cxx:3772
IStyleAccess::SwAutoStyleFamily m_eFamily
Definition: unostyle.hxx:137
virtual css::uno::Reference< css::style::XAutoStyle > SAL_CALL insertStyle(const css::uno::Sequence< css::beans::PropertyValue > &Values) override
Definition: unostyle.cxx:3734
virtual sal_Bool SAL_CALL hasElements() override
Definition: unostyle.cxx:3785
SwXAutoStyleFamily(SwDocShell *pDocShell, IStyleAccess::SwAutoStyleFamily eFamily)
Definition: unostyle.cxx:3504
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unostyle.cxx:3941
virtual void SAL_CALL setAllPropertiesToDefault() override
Definition: unostyle.cxx:4244
SwDoc & mrDoc
Definition: unostyle.hxx:183
virtual void Notify(const SfxHint &) override
Definition: unostyle.cxx:3888
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
Definition: unostyle.cxx:4160
IStyleAccess::SwAutoStyleFamily meFamily
Definition: unostyle.hxx:182
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unostyle.cxx:3894
virtual void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unostyle.cxx:4124
css::uno::Sequence< css::uno::Any > GetPropertyValues_Impl(const css::uno::Sequence< OUString > &aPropertyNames)
Definition: unostyle.cxx:3962
SwXAutoStyle(SwDoc *pDoc, std::shared_ptr< SfxItemSet > pInitSet, IStyleAccess::SwAutoStyleFamily eFam)
Definition: unostyle.cxx:3872
virtual void SAL_CALL removePropertiesChangeListener(const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unostyle.cxx:4130
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: unostyle.cxx:4253
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getProperties() override
Definition: unostyle.cxx:4259
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: unostyle.cxx:4099
virtual void SAL_CALL firePropertiesChangeEvent(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unostyle.cxx:4135
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unostyle.cxx:3951
std::shared_ptr< SfxItemSet > mpSet
Definition: unostyle.hxx:181
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: unostyle.cxx:4154
virtual ~SwXAutoStyle() override
Definition: unostyle.cxx:3884
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unostyle.cxx:3936
virtual void SAL_CALL setPropertiesToDefault(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: unostyle.cxx:4248
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
Definition: unostyle.cxx:4141
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unostyle.cxx:3929
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unostyle.cxx:3925
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
Definition: unostyle.cxx:4150
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unostyle.cxx:3946
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
Definition: unostyle.cxx:3956
virtual css::uno::Any SAL_CALL nextElement() override
Definition: unostyle.cxx:3850
SwXAutoStylesEnumerator(SwDoc &rDoc, IStyleAccess::SwAutoStyleFamily eFam)
Definition: unostyle.cxx:3826
virtual sal_Bool SAL_CALL hasMoreElements() override
Definition: unostyle.cxx:3843
virtual void Notify(const SfxHint &) override
Definition: unostyle.cxx:3837
std::unique_ptr< SwAutoStylesEnumImpl > m_pImpl
Definition: unostyle.hxx:159
virtual ~SwXAutoStylesEnumerator() override
Definition: unostyle.cxx:3833
SwDocShell * m_pDocShell
Definition: unostyle.hxx:109
SwXAutoStyles(SwDocShell &rDocShell)
Definition: unostyle.cxx:3403
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unostyle.cxx:3470
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unostyle.cxx:3494
css::uno::Reference< css::style::XAutoStyleFamily > m_xAutoRubyStyles
Definition: unostyle.hxx:111
css::uno::Reference< css::style::XAutoStyleFamily > m_xAutoCharStyles
Definition: unostyle.hxx:110
virtual sal_Bool SAL_CALL hasElements() override
Definition: unostyle.cxx:3465
virtual sal_Int32 SAL_CALL getCount() override
Definition: unostyle.cxx:3412
css::uno::Reference< css::style::XAutoStyleFamily > m_xAutoParaStyles
Definition: unostyle.hxx:112
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unostyle.cxx:3484
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unostyle.cxx:3460
virtual ~SwXAutoStyles() override
Definition: unostyle.cxx:3408
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unostyle.cxx:3417
static css::uno::Reference< css::text::XText > CreateXHeadFootText(SwFrameFormat &rHeadFootFormat, const bool bIsHeader)
Definition: unotext.cxx:2627
const OUString * GetBulletFontNames() const
Definition: unosett.hxx:199
const SwNumRule * GetNumRule() const
Definition: unosett.hxx:200
static bool isInvalidStyle(std::u16string_view rName)
Definition: unosett.cxx:994
const OUString * GetNewCharStyleNames() const
Definition: unosett.hxx:198
virtual sal_Bool SAL_CALL hasByName(const OUString &Name) override
Definition: unostyle.cxx:889
virtual ~SwXStyleFamilies() override
Definition: unostyle.cxx:864
virtual OUString SAL_CALL getImplementationName() override
Definition: unostyle.cxx:848
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unostyle.cxx:880
std::map< SfxStyleFamily, css::uno::Reference< css::container::XNameContainer > > m_vFamilies
Definition: unostyle.hxx:58
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
Definition: unostyle.cxx:901
virtual void SAL_CALL loadStylesFromURL(const OUString &rURL, const css::uno::Sequence< css::beans::PropertyValue > &aOptions) override
Definition: unostyle.cxx:925
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unostyle.cxx:917
virtual sal_Int32 SAL_CALL getCount() override
Definition: unostyle.cxx:896
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unostyle.cxx:851
static css::uno::Reference< css::style::XStyle > CreateStyle(SfxStyleFamily eFamily, SwDoc &rDoc)
Definition: unostyle.cxx:999
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unostyle.cxx:856
virtual sal_Bool SAL_CALL hasElements() override
Definition: unostyle.cxx:922
SwDocShell * m_pDocShell
Definition: unostyle.hxx:56
virtual css::uno::Any SAL_CALL getByName(const OUString &Name) override
Definition: unostyle.cxx:867
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getStyleLoaderOptions() override
Definition: unostyle.cxx:970
static css::uno::Reference< css::style::XStyle > CreateStyleCondParagraph(SwDoc &rDoc)
Definition: unostyle.cxx:1008
SwXStyleFamilies(SwDocShell &rDocShell)
Definition: unostyle.cxx:859
A text cell style is a UNO API wrapper for a SwBoxAutoFormat core class.
Definition: unostyle.hxx:332
virtual void SAL_CALL setParentStyle(const OUString &aParentStyle) override
Definition: unostyle.cxx:4810
bool m_bPhysical
If true, then it points to a core object, if false, then this is a created, but not-yet-inserted form...
Definition: unostyle.hxx:340
virtual sal_Bool SAL_CALL isUserDefined() override
Definition: unostyle.cxx:4770
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unostyle.cxx:5612
SwDocShell * m_pDocShell
Definition: unostyle.hxx:333
static css::uno::Reference< css::style::XStyle > CreateXTextCellStyle(SwDocShell *pDocShell, const OUString &sName)
Definition: unostyle.cxx:4739
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unostyle.cxx:5607
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unostyle.cxx:5219
void SetBoxFormat(SwBoxAutoFormat *pBoxFormat)
Sets the address of SwBoxAutoFormat this style is bound to. Usable only when style is physical.
Definition: unostyle.cxx:4667
SwBoxAutoFormat * GetBoxFormat()
returns box format assigned to this style
Definition: unostyle.cxx:4662
virtual sal_Bool SAL_CALL isInUse() override
Definition: unostyle.cxx:4780
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &aPropertyName) override
Definition: unostyle.cxx:5243
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unostyle.cxx:4855
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
Definition: unostyle.cxx:5235
virtual OUString SAL_CALL getName() override
Definition: unostyle.cxx:4817
SwBoxAutoFormat * m_pBoxAutoFormat
Definition: unostyle.hxx:334
bool IsPhysical() const
Definition: unostyle.cxx:4694
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unostyle.cxx:4861
virtual OUString SAL_CALL getImplementationName() override
Definition: unostyle.cxx:5602
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
Definition: unostyle.cxx:5393
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unostyle.cxx:5214
virtual void SAL_CALL setName(const OUString &sName) override
Definition: unostyle.cxx:4844
OUString m_sParentStyle
Definition: unostyle.hxx:337
SwXTextCellStyle(SwDocShell *pDocShell, SwBoxAutoFormat *pBoxAutoFormat, OUString sParentStyle)
Definition: unostyle.cxx:4646
std::shared_ptr< SwBoxAutoFormat > m_pBoxAutoFormat_Impl
Stores SwBoxAutoFormat when this is not a physical style.
Definition: unostyle.hxx:336
virtual OUString SAL_CALL getParentStyle() override
Definition: unostyle.cxx:4804
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unostyle.cxx:5224
static SwBoxAutoFormat * GetBoxAutoFormat(SwDocShell *pDocShell, std::u16string_view sName, OUString *pParentName)
This function looks for a SwBoxAutoFormat with given name.
Definition: unostyle.cxx:4699
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unostyle.cxx:5050
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
Definition: unostyle.cxx:5594
OUString m_sName
Definition: unostyle.hxx:338
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unostyle.cxx:5229
A text table style is a UNO API wrapper for a SwTableAutoFormat.
Definition: unostyle.hxx:239
SwTableAutoFormat * m_pTableAutoFormat
Definition: unostyle.hxx:241
virtual void SAL_CALL setParentStyle(const OUString &aParentStyle) override
Definition: unostyle.cxx:4480
rtl::Reference< SwXTextCellStyle > m_aCellStyles[STYLE_COUNT]
Definition: unostyle.hxx:271
SwDocShell * m_pDocShell
Definition: unostyle.hxx:240
virtual void SAL_CALL insertByName(const OUString &rName, const css::uno::Any &aElement) override
Definition: unostyle.cxx:4577
virtual void SAL_CALL setName(const OUString &rName) override
Definition: unostyle.cxx:4492
static const CellStyleNameMap & GetCellStyleNameMap()
Definition: unostyle.cxx:4366
virtual void SAL_CALL removeByName(const OUString &rName) override
Definition: unostyle.cxx:4613
virtual OUString SAL_CALL getParentStyle() override
Definition: unostyle.cxx:4475
virtual sal_Bool SAL_CALL hasElements() override
Definition: unostyle.cxx:4624
SwXTextTableStyle(SwDocShell *pDocShell, SwTableAutoFormat *pTableAutoFormat)
Definition: unostyle.cxx:4311
bool m_bPhysical
If true, then it points to a core object, if false, then this is a created, but not-yet-inserted form...
Definition: unostyle.hxx:245
void UpdateCellStylesMapping()
Fills m_aCellStyles with SwXTextCellStyles pointing to children of this style.
Definition: unostyle.cxx:4349
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: unostyle.cxx:4564
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: unostyle.cxx:4536
virtual OUString SAL_CALL getName() override
Definition: unostyle.cxx:4484
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unostyle.cxx:4619
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: unostyle.cxx:4510
virtual sal_Bool SAL_CALL isInUse() override
Definition: unostyle.cxx:4454
static css::uno::Reference< css::style::XStyle > CreateXTextTableStyle(SwDocShell *pDocShell, const OUString &rTableAutoFormatName)
Definition: unostyle.cxx:4324
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unostyle.cxx:4531
virtual void SAL_CALL replaceByName(const OUString &rName, const css::uno::Any &aElement) override
Definition: unostyle.cxx:4582
@ FIRST_ROW_START_COLUMN_STYLE
Definition: unostyle.hxx:259
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: unostyle.cxx:4505
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unostyle.cxx:4640
virtual sal_Bool SAL_CALL isUserDefined() override
Definition: unostyle.cxx:4444
std::unique_ptr< SwTableAutoFormat > m_pTableAutoFormat_Impl
Stores SwTableAutoFormat when this is not a physical style.
Definition: unostyle.hxx:243
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unostyle.cxx:4541
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unostyle.cxx:4499
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: unostyle.cxx:4546
virtual css::uno::Any SAL_CALL getByName(const OUString &rName) override
Definition: unostyle.cxx:4552
virtual sal_Bool SAL_CALL hasByName(const OUString &rName) override
Definition: unostyle.cxx:4569
virtual OUString SAL_CALL getImplementationName() override
Definition: unostyle.cxx:4630
SwTableAutoFormat * GetTableFormat()
Returns box format assigned to this style.
Definition: unostyle.cxx:4391
static SwTableAutoFormat * GetTableAutoFormat(SwDocShell *pDocShell, std::u16string_view sName)
This function looks for a SwTableAutoFormat with given name. Returns nullptr if could not be found.
Definition: unostyle.cxx:4396
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unostyle.cxx:4635
void SetNumRules(const bool bNew)
Definition: shellio.hxx:126
void SetTextFormats(const bool bNew)
Definition: shellio.hxx:123
void SetMerge(const bool bNew)
Definition: shellio.hxx:129
void SetPageDescs(const bool bNew)
Definition: shellio.hxx:120
void SetFrameFormats(const bool bNew)
Definition: shellio.hxx:117
void SetInputStream(const css::uno::Reference< css::io::XInputStream > &xInputStream)
Definition: shellio.hxx:136
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
const css::uno::Sequence< sal_Int8 > & getSeq() const
css::uno::Type const & get()
virtual const SfxPoolItem * GetItem(sal_uInt16 eAtr)=0
virtual css::document::XEventsSupplier & GetEventsSupplier()=0
virtual void SetItem(sal_uInt16 eAtr, const SfxPoolItem &rItem)=0
#define FN_UNO_IS_AUTO_UPDATE
Definition: cmdid.h:589
#define FN_UNO_NUM_RULES
Definition: cmdid.h:556
#define FN_UNO_PARA_STYLE_CONDITIONS
Definition: cmdid.h:631
#define FN_UNO_FOOTER
Definition: cmdid.h:578
#define FN_UNO_HEADER_FIRST
Definition: cmdid.h:658
#define FN_UNO_FOOTER_FIRST
Definition: cmdid.h:659
#define FN_UNO_HEADER_LEFT
Definition: cmdid.h:576
#define FN_UNO_HIDDEN
Definition: cmdid.h:663
#define FN_UNO_STYLE_INTEROP_GRAB_BAG
Definition: cmdid.h:664
#define FN_UNO_IS_PHYSICAL
Definition: cmdid.h:588
#define FN_PARAM_FTN_INFO
Definition: cmdid.h:808
#define FN_UNO_FOOTER_LEFT
Definition: cmdid.h:579
#define FN_UNO_DISPLAY_NAME
Definition: cmdid.h:590
#define FN_UNO_FOLLOW_STYLE
Definition: cmdid.h:584
#define FN_UNO_LINK_STYLE
Definition: cmdid.h:621
#define FN_UNO_CATEGORY
Definition: cmdid.h:597
#define FN_UNO_HEADER_RIGHT
Definition: cmdid.h:577
#define FN_UNO_HEADER
Definition: cmdid.h:575
#define FN_UNO_FOOTER_RIGHT
Definition: cmdid.h:580
int nCount
virtual OUString GetName() const override
SwDoc & m_rDoc
Definition: docbm.cxx:1228
OUString m_sName
float u
sal_Int16 nValue
@ Fixed
Frame cannot be moved in Var-direction.
OUString sName
void Notify(SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldRect=nullptr)
Notify the background based on the difference between old and new rectangle.
Definition: frmtool.cxx:3254
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
constexpr TypedWhichId< SvxCrossedOutItem > RES_CHRATR_CROSSEDOUT(5)
constexpr sal_uInt16 POOLATTR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
constexpr sal_uInt16 RES_UNKNOWNATR_END(160)
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(166)
constexpr TypedWhichId< SvxShadowedItem > RES_CHRATR_SHADOWED(13)
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(102)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(113)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SvxContourItem > RES_CHRATR_CONTOUR(4)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
constexpr TypedWhichId< SwHeaderAndFooterEatSpacingItem > RES_HEADER_FOOTER_EAT_SPACING(127)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(103)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
constexpr TypedWhichId< SwFormatAutoFormat > RES_AUTO_STYLE(133)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SdrTextVertAdjustItem > RES_TEXT_VERT_ADJUST(137)
constexpr TypedWhichId< SwFormatDrop > RES_PARATR_DROP(70)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SfxUInt16Item > RES_PARATR_OUTLINELEVEL(79)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
constexpr TypedWhichId< SvxPaperBinItem > RES_PAPER_BIN(90)
constexpr TypedWhichId< SwFormatRuby > RES_TXTATR_CJK_RUBY(53)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
const char * name
LanguageType GetAppLanguage()
Definition: init.cxx:741
WhichRangesContainer const aCharAutoFormatSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >)
WhichRangesContainer const aTextNodeSetRange(svl::Items< RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_PARATR_BEGIN, RES_PARATR_END-1, RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1, RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST >)
sal_Int32 nIndex
OUString aName
Mode eMode
sal_Int64 n
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
#define SAL_N_ELEMENTS(arr)
MapUnit
#define MID_NAME
const SfxItemSet * GetItemSet(const SfxPoolItem &rAttr)
Returns the item set associated with a character/inet/auto style.
Definition: atrstck.cxx:133
const SfxPoolItem * GetItem(const SwTextAttr &rAttr, sal_uInt16 nWhich)
Extracts pool item of type nWhich from rAttr.
Definition: atrstck.cxx:157
bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet &rSet, sal_uInt16 const nMID)
helper to check if fill style is set to color or bitmap and thus formerly used SvxBrushItem parts nee...
void SetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName, const css::uno::Any &rValue, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
css::uno::Sequence< typename M::key_type > mapKeysToSequence(M const &map)
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Any SAL_CALL getCaughtException()
int i
void Create(SvxOrientationItem &rItem, SvStream &rStrm, sal_uInt16)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::shared_ptr< T > make_shared(Args &&... args)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
constexpr auto toTwips(N number, Length from)
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
std::map< OUString, sal_Int32 > CellStyleNameMap
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
UNOTOOLS_DLLPUBLIC css::uno::Any GetProperty(OUString const &url, OUString const &property)
HashMap_OWString_Interface aMap
sal_Int16 nId
constexpr tools::Long constTwips_5mm
Definition: pggrid.cxx:38
const sal_uInt16 COLL_DOC_BITS
Definition: poolfmt.hxx:69
@ RES_POOLCOLL_REGISTER_BEGIN
Group indices.
Definition: poolfmt.hxx:364
@ RES_POOLCOLL_HTML_BEGIN
Group HTML-styles.
Definition: poolfmt.hxx:432
@ RES_POOLCOLL_TEXT_BEGIN
Definition: poolfmt.hxx:248
@ RES_POOLCOLL_EXTRA_BEGIN
Special ranges.
Definition: poolfmt.hxx:327
@ RES_POOLCOLL_LISTS_BEGIN
Group lists.
Definition: poolfmt.hxx:276
@ RES_POOLCOLL_DOC_BEGIN
Group chapter / document.
Definition: poolfmt.hxx:423
@ RES_POOLNUMRULE_BEGIN
Definition: poolfmt.hxx:187
@ RES_POOLPAGE_BEGIN
Definition: poolfmt.hxx:168
@ RES_POOLPAGE_STANDARD
Standard page.
Definition: poolfmt.hxx:170
@ RES_POOLCHR_HTML_BEGIN
HTML-styles.
Definition: poolfmt.hxx:134
@ RES_POOLCHR_NORMAL_BEGIN
Definition: poolfmt.hxx:111
const sal_uInt16 COLL_GET_RANGE_BITS
Definition: poolfmt.hxx:71
const sal_uInt16 COLL_REGISTER_BITS
Definition: poolfmt.hxx:68
const sal_uInt16 COLL_TEXT_BITS
Definition: poolfmt.hxx:65
bool IsPoolUserFormat(sal_uInt16 nId)
Definition: poolfmt.hxx:86
@ RES_POOLFRM_BEGIN
Definition: poolfmt.hxx:152
const sal_uInt16 COLL_HTML_BITS
Definition: poolfmt.hxx:70
const sal_uInt16 COLL_LISTS_BITS
Definition: poolfmt.hxx:66
const sal_uInt16 COLL_EXTRA_BITS
Definition: poolfmt.hxx:67
QPRO_FUNC_TYPE nType
static SfxItemSet & rSet
std::map< OUString, rtl::Reference< Entity > > map
PropertyMoreFlags nMoreFlags
css::uno::Type aType
bool hasValue()
Object Value
SfxStyleFamily
SfxStyleSearchBits
Reference< XModel > xModel
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
tools::Long SwTwips
Definition: swtypes.hxx:51
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
OUString Name
unsigned char sal_uInt8
unsigned char sal_Bool
signed char sal_Int8
SVXCORE_DLLPUBLIC std::unique_ptr< SvxBrushItem > getSvxBrushItemFromSourceSet(const SfxItemSet &rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents=true, bool bXMLImportHack=false)
SVXCORE_DLLPUBLIC void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem &rBrush, SfxItemSet &rToSet)
void SvxUnoConvertToMM(const MapUnit eSourceMapUnit, uno::Any &rMetric) noexcept
void SvxUnoConvertFromMM(const MapUnit eDestinationMapUnit, uno::Any &rMetric) noexcept
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:88
#define PROPERTY_MAP_PARA_AUTO_STYLE
Definition: unomap.hxx:122
#define OWN_ATTR_FILLBMP_MODE
Definition: unomap.hxx:332
#define PROPERTY_MAP_PAGE_STYLE
Definition: unomap.hxx:32
#define PROPERTY_MAP_CELL_STYLE
Definition: unomap.hxx:127
#define PROPERTY_MAP_NUM_STYLE
Definition: unomap.hxx:33
#define PROPERTY_MAP_CHAR_AUTO_STYLE
Definition: unomap.hxx:120
#define PROPERTY_MAP_PARA_STYLE
Definition: unomap.hxx:30
#define PROPERTY_MAP_TABLE_STYLE
Definition: unomap.hxx:126
#define PROPERTY_MAP_RUBY_AUTO_STYLE
Definition: unomap.hxx:121
#define PROPERTY_MAP_CHAR_STYLE
Definition: unomap.hxx:29
#define PROPERTY_MAP_FRAME_STYLE
Definition: unomap.hxx:31
#define PROPERTY_MAP_CONDITIONAL_PARA_STYLE
Definition: unomap.hxx:119
#define MID_PAGEDESC_PAGEDESCNAME
Definition: unomid.h:26
#define MID_DROPCAP_CHAR_STYLE_NAME
Definition: unomid.h:65
#define MID_RUBY_CHARSTYLE
Definition: unomid.h:115
#define MID_BITMAP
Page
constexpr OUStringLiteral UNO_NAME_TABLE_FIRST_ROW_START_COLUMN
Definition: unoprnms.hxx:909
constexpr OUStringLiteral UNO_NAME_LOAD_NUMBERING_STYLES
Definition: unoprnms.hxx:429
constexpr OUStringLiteral UNO_NAME_TABLE_FIRST_ROW_END_COLUMN
Definition: unoprnms.hxx:908
constexpr OUStringLiteral UNO_NAME_FOOTER_IS_SHARED
Definition: unoprnms.hxx:421
constexpr OUStringLiteral UNO_NAME_LOAD_FRAME_STYLES
Definition: unoprnms.hxx:431
constexpr OUStringLiteral UNO_NAME_HEADER_IS_SHARED
Definition: unoprnms.hxx:408
constexpr OUStringLiteral UNO_NAME_FIRST_IS_SHARED
Definition: unoprnms.hxx:868
constexpr OUStringLiteral UNO_NAME_TABLE_LAST_ROW_START_COLUMN
Definition: unoprnms.hxx:911
constexpr OUStringLiteral UNO_NAME_OVERWRITE_STYLES
Definition: unoprnms.hxx:428
constexpr OUStringLiteral UNO_NAME_LOAD_PAGE_STYLES
Definition: unoprnms.hxx:430
constexpr OUStringLiteral UNO_NAME_PARA_STYLE_CONDITIONS
Definition: unoprnms.hxx:814
constexpr OUStringLiteral UNO_NAME_TABLE_LAST_ROW_END_COLUMN
Definition: unoprnms.hxx:910
constexpr OUStringLiteral UNO_NAME_LOAD_TEXT_STYLES
Definition: unoprnms.hxx:432
constexpr OUStringLiteral UNO_NAME_DISPLAY_NAME
Definition: unoprnms.hxx:31
static SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum(SfxStyleFamily eFamily)
Definition: unostyle.cxx:1239
static const SfxItemSet * lcl_GetItemsetForProperty(const SfxItemSet &rSet, SfxStyleFamily eFamily, std::u16string_view rPropertyName)
Definition: unostyle.cxx:2467
#define nPoolPageRange
Definition: unostyle.cxx:144
#define nPoolCollDocRange
Definition: unostyle.cxx:141
#define AUTOSTYLE_FAMILY_COUNT
Definition: unostyle.cxx:3381
#define nPoolCollHtmlRange
Definition: unostyle.cxx:142
#define nPoolCollRegisterStackedStart
Definition: unostyle.cxx:148
static uno::Reference< text::XText > lcl_makeHeaderFooter(const sal_uInt16 nRes, const bool bHeader, SwFrameFormat const *const pFrameFormat)
Definition: unostyle.cxx:3068
const IStyleAccess::SwAutoStyleFamily aAutoStyleByIndex[]
Definition: unostyle.cxx:3382
static bool lcl_InitConditional(SfxStyleSheetBasePool *pBasePool, const SfxStyleFamily eFamily, const OUString &rStyleName)
Definition: unostyle.cxx:1332
#define nPoolCollListsRange
Definition: unostyle.cxx:138
#define nPoolCollRegisterRange
Definition: unostyle.cxx:140
#define nPoolChrHtmlRange
Definition: unostyle.cxx:136
#define nPoolChrNormalRange
Definition: unostyle.cxx:135
#define nPoolCollExtraStackedStart
Definition: unostyle.cxx:147
#define nPoolCollListsStackedStart
Definition: unostyle.cxx:146
static const StyleFamilyEntry & lcl_GetStyleEntry(const SfxStyleFamily eFamily)
Definition: unostyle.cxx:1346
static bool lcl_GetHeaderFooterItem(SfxItemSet const &rSet, std::u16string_view rPropName, bool const bFooter, SvxSetItem const *&o_rpItem)
Definition: unostyle.cxx:982
#define nPoolCollHtmlStackedStart
Definition: unostyle.cxx:150
static uno::Reference< beans::XPropertySet > lcl_InitStandardStyle(const SfxStyleFamily eFamily, uno::Reference< container::XNameAccess > const &rxStyleFamily)
Definition: unostyle.cxx:1305
static sal_uInt8 lcl_TranslateMetric(const SfxItemPropertyMapEntry &rEntry, SwDoc *pDoc, uno::Any &o_aValue)
Definition: unostyle.cxx:1560
#define nPoolCollExtraRange
Definition: unostyle.cxx:139
static uno::Reference< container::XNameAccess > lcl_InitStyleFamily(SwDoc *pDoc, const StyleFamilyEntry &rEntry)
Definition: unostyle.cxx:1316
static SwFormat * lcl_GetFormatForStyle(SwDoc const *pDoc, const rtl::Reference< SwDocStyleSheet > &xStyle, const SfxStyleFamily eFamily)
Definition: unostyle.cxx:2596
#define nPoolCollDocStackedStart
Definition: unostyle.cxx:149
#define nPoolCollTextRange
Definition: unostyle.cxx:137
std::shared_ptr< SfxItemSet > PropValuesToAutoStyleItemSet(SwDoc &rDoc, IStyleAccess::SwAutoStyleFamily eFamily, const uno::Sequence< beans::PropertyValue > &Values, SwAttrSet &aSet)
Definition: unostyle.cxx:3522
#define nPoolFrameRange
Definition: unostyle.cxx:143
#define nPoolNumRange
Definition: unostyle.cxx:145
constexpr TypedWhichId< XFillBmpPosOffsetYItem > XATTR_FILLBMP_POSOFFSETY(XATTR_FILL_FIRST+18)
constexpr TypedWhichId< XGradientStepCountItem > XATTR_GRADIENTSTEPCOUNT(XATTR_FILL_FIRST+6)
constexpr TypedWhichId< XFillBmpPosItem > XATTR_FILLBMP_POS(XATTR_FILL_FIRST+8)
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr TypedWhichId< XFillBmpTileOffsetXItem > XATTR_FILLBMP_TILEOFFSETX(XATTR_FILL_FIRST+14)
constexpr TypedWhichId< XFillTransparenceItem > XATTR_FILLTRANSPARENCE(XATTR_FILL_FIRST+5)
constexpr TypedWhichId< XSecondaryFillColorItem > XATTR_SECONDARYFILLCOLOR(XATTR_FILL_FIRST+12)
constexpr TypedWhichId< SfxMetricItem > XATTR_FILLBMP_SIZEX(XATTR_FILL_FIRST+9)
constexpr TypedWhichId< XFillBmpPosOffsetXItem > XATTR_FILLBMP_POSOFFSETX(XATTR_FILL_FIRST+17)
constexpr TypedWhichId< XFillBmpTileOffsetYItem > XATTR_FILLBMP_TILEOFFSETY(XATTR_FILL_FIRST+15)
constexpr TypedWhichId< XFillBmpSizeYItem > XATTR_FILLBMP_SIZEY(XATTR_FILL_FIRST+10)
constexpr TypedWhichId< XFillBmpStretchItem > XATTR_FILLBMP_STRETCH(XATTR_FILL_FIRST+16)
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
constexpr TypedWhichId< XFillBmpSizeLogItem > XATTR_FILLBMP_SIZELOG(XATTR_FILL_FIRST+13)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)
constexpr TypedWhichId< XFillBmpTileItem > XATTR_FILLBMP_TILE(XATTR_FILL_FIRST+7)
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
constexpr TypedWhichId< XFillBackgroundItem > XATTR_FILLBACKGROUND(XATTR_FILL_FIRST+19)
constexpr TypedWhichId< XFillFloatTransparenceItem > XATTR_FILLFLOATTRANSPARENCE(XATTR_FILL_FIRST+11)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
sal_Int32 nLength
SvNumFormatType