LibreOffice Module sw (master) 1
fmtcol.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 <memory>
21#include <libxml/xmlwriter.h>
22#include <editeng/fhgtitem.hxx>
23#include <editeng/lrspitem.hxx>
24#include <editeng/ulspitem.hxx>
25#include <osl/diagnose.h>
26#include <sal/macros.h>
27#include <svl/intitem.hxx>
28#include <calbck.hxx>
29#include <doc.hxx>
30#include <fmtcol.hxx>
31#include <fmtcolfunc.hxx>
32#include <hintids.hxx>
33#include <hints.hxx>
34#include <node.hxx>
35#include <numrule.hxx>
36#include <paratr.hxx>
37#include <swfntcch.hxx>
38
40{
41 // #i71574#
43 SwFormat* pFormat,
44 const SwNumRuleItem* pNewNumRuleItem )
45 {
46 SwTextFormatColl* pTextFormatColl = dynamic_cast<SwTextFormatColl*>(pFormat);
47 if ( !pTextFormatColl )
48 {
49 OSL_FAIL( "<TextFormatCollFunc::CheckTextFormatCollFuncForDeletionOfAssignmentToOutlineStyle> - misuse of method - it's only for instances of <SwTextFormatColl>" );
50 return;
51 }
52
53 // #i73790#
54 if ( pTextFormatColl->StayAssignedToListLevelOfOutlineStyle() ||
55 !pTextFormatColl->IsAssignedToListLevelOfOutlineStyle() )
56 return;
57
58 if (!pNewNumRuleItem)
59 {
60 pNewNumRuleItem = pTextFormatColl->GetItemIfSet(RES_PARATR_NUMRULE, false);
61 }
62 if (pNewNumRuleItem)
63 {
64 const OUString& sNumRuleName = pNewNumRuleItem->GetValue();
65 if ( sNumRuleName.isEmpty() ||
66 sNumRuleName != pTextFormatColl->GetDoc()->GetOutlineNumRule()->GetName() )
67 {
68 // delete assignment of paragraph style to list level of outline style.
70 }
71 }
72 }
73
75 {
76 SwNumRule* pNumRule( nullptr );
77
78 const SwNumRuleItem* pNumRuleItem = rTextFormatColl.GetItemIfSet(RES_PARATR_NUMRULE, false);
79 if (pNumRuleItem)
80 {
81 const OUString& sNumRuleName = pNumRuleItem->GetValue();
82 if ( !sNumRuleName.isEmpty() )
83 {
84 pNumRule = rTextFormatColl.GetDoc()->FindNumRulePtr( sNumRuleName );
85 }
86 }
87
88 return pNumRule;
89 }
90
91 void AddToNumRule( SwTextFormatColl& rTextFormatColl )
92 {
93 SwNumRule* pNumRule = GetNumRule( rTextFormatColl );
94 if ( pNumRule )
95 {
96 pNumRule->AddParagraphStyle( rTextFormatColl );
97 }
98 }
99
100 void RemoveFromNumRule( SwTextFormatColl& rTextFormatColl )
101 {
102 SwNumRule* pNumRule = GetNumRule( rTextFormatColl );
103 if ( pNumRule )
104 {
105 pNumRule->RemoveParagraphStyle( rTextFormatColl );
106 }
107 }
108} // end of namespace TextFormatCollFunc
109
111{
113 pSwFontCache->Delete( this );
114
115 if (GetDoc()->IsInDtor())
116 {
117 return;
118 }
119
120 for (const auto& pCharFormat : *GetDoc()->GetCharFormats())
121 {
122 if (pCharFormat->GetLinkedParaFormat() == this)
123 {
124 pCharFormat->SetLinkedParaFormat(nullptr);
125 }
126 }
127}
128void SwTextFormatColl::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
129{
130 if (rHint.GetId() != SfxHintId::SwLegacyModify)
131 return;
132 auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
133 if(GetDoc()->IsInDtor())
134 {
135 SwFormatColl::SwClientNotify(rModify, rHint);
136 return;
137 }
138 bool bNewParent( false ); // #i66431# - adjust type of <bNewParent>
139 const SvxULSpaceItem *pNewULSpace = nullptr, *pOldULSpace = nullptr;
140 const SvxFirstLineIndentItem *pNewFirstLineIndent = nullptr;
141 const SvxTextLeftMarginItem *pNewTextLeftMargin = nullptr;
142 const SvxRightMarginItem *pNewRightMargin = nullptr;
143 const SvxFontHeightItem* aFontSizeArr[3] = {nullptr,nullptr,nullptr};
144 // #i70223#
145 const bool bAssignedToListLevelOfOutlineStyle(IsAssignedToListLevelOfOutlineStyle());
146 const SwNumRuleItem* pNewNumRuleItem( nullptr );
147
148 const SwAttrSetChg *pNewChgSet = nullptr, *pOldChgSet = nullptr;
149 const auto pOld = pLegacy->m_pOld;
150 const auto pNew = pLegacy->m_pNew;
151 switch( pLegacy->GetWhich() )
152 {
153 case RES_ATTRSET_CHG:
154 // Only recalculate if we're not the sender!
155 pNewChgSet = &pNew->StaticWhichCast(RES_ATTRSET_CHG);
156 pOldChgSet = &pOld->StaticWhichCast(RES_ATTRSET_CHG);
157 pNewFirstLineIndent = pNewChgSet->GetChgSet()->GetItemIfSet(RES_MARGIN_FIRSTLINE, false);
158 pNewTextLeftMargin = pNewChgSet->GetChgSet()->GetItemIfSet(RES_MARGIN_TEXTLEFT, false);
159 pNewRightMargin = pNewChgSet->GetChgSet()->GetItemIfSet(RES_MARGIN_RIGHT, false);
160 pNewULSpace = pNewChgSet->GetChgSet()->GetItemIfSet( RES_UL_SPACE, false );
161 aFontSizeArr[0] = pNewChgSet->GetChgSet()->GetItemIfSet( RES_CHRATR_FONTSIZE, false );
162 aFontSizeArr[1] = pNewChgSet->GetChgSet()->GetItemIfSet( RES_CHRATR_CJK_FONTSIZE, false );
163 aFontSizeArr[2] = pNewChgSet->GetChgSet()->GetItemIfSet( RES_CHRATR_CTL_FONTSIZE, false );
164 // #i70223#, #i84745#
165 // check, if attribute set is applied to this paragraph style
166 if ( bAssignedToListLevelOfOutlineStyle &&
167 pNewChgSet->GetTheChgdSet() == &GetAttrSet() )
168 {
169 pNewNumRuleItem = pNewChgSet->GetChgSet()->GetItemIfSet( RES_PARATR_NUMRULE, false );
170 }
171
172 break;
173
174 case RES_FMT_CHG:
175 if( GetAttrSet().GetParent() )
176 {
177 const SfxItemSet* pParent = GetAttrSet().GetParent();
178 pNewFirstLineIndent = &pParent->Get(RES_MARGIN_FIRSTLINE);
179 pNewTextLeftMargin = &pParent->Get(RES_MARGIN_TEXTLEFT);
180 pNewRightMargin = &pParent->Get(RES_MARGIN_RIGHT);
181 pNewULSpace = &pParent->Get( RES_UL_SPACE );
182 aFontSizeArr[0] = &pParent->Get( RES_CHRATR_FONTSIZE );
183 aFontSizeArr[1] = &pParent->Get( RES_CHRATR_CJK_FONTSIZE );
184 aFontSizeArr[2] = &pParent->Get( RES_CHRATR_CTL_FONTSIZE );
185 // #i66431# - modify has to be propagated, because of new parent format.
186 bNewParent = true;
187 }
188 break;
189
191 pNewFirstLineIndent = &pNew->StaticWhichCast(RES_MARGIN_FIRSTLINE);
192 break;
194 pNewTextLeftMargin = &pNew->StaticWhichCast(RES_MARGIN_TEXTLEFT);
195 break;
196 case RES_MARGIN_RIGHT:
197 pNewRightMargin = &pNew->StaticWhichCast(RES_MARGIN_RIGHT);
198 break;
199 case RES_UL_SPACE:
200 pNewULSpace = &pNew->StaticWhichCast(RES_UL_SPACE);
201 break;
203 aFontSizeArr[0] = &pNew->StaticWhichCast(RES_CHRATR_CJK_FONTSIZE);
204 break;
206 aFontSizeArr[1] = &pNew->StaticWhichCast(RES_CHRATR_CJK_FONTSIZE);
207 break;
209 aFontSizeArr[2] = &pNew->StaticWhichCast(RES_CHRATR_CTL_FONTSIZE);
210 break;
211 // #i70223#
213 if (bAssignedToListLevelOfOutlineStyle)
214 {
215 pNewNumRuleItem = &pNew->StaticWhichCast(RES_PARATR_NUMRULE);
216 }
217 break;
218 default:
219 break;
220 }
221
222 // #i70223#
223 if ( bAssignedToListLevelOfOutlineStyle && pNewNumRuleItem )
224 {
226 this, pNewNumRuleItem );
227 }
228
229 bool bContinue = true;
230
231 // Check against the own attributes
232 const SvxFirstLineIndentItem *pOldFirstLineIndent(GetItemIfSet(RES_MARGIN_FIRSTLINE, false));
233 if (pNewFirstLineIndent && pOldFirstLineIndent)
234 {
235 if (pOldFirstLineIndent != pNewFirstLineIndent) // Avoid recursion (SetAttr!)
236 {
237 bool bChg = false;
238 SvxFirstLineIndentItem aNew(*pOldFirstLineIndent);
239 // We had a relative value -> recalculate
240 if( 100 != aNew.GetPropTextFirstLineOffset() )
241 {
242 short nTmp = aNew.GetTextFirstLineOffset(); // keep so that we can compare
243 aNew.SetTextFirstLineOffset(pNewFirstLineIndent->GetTextFirstLineOffset(),
245 bChg |= nTmp != aNew.GetTextFirstLineOffset();
246 }
247 if( bChg )
248 {
249 SetFormatAttr( aNew );
250 bContinue = nullptr != pOldChgSet || bNewParent;
251 }
252 // We set it to absolute -> do not propagate it further, unless
253 // we set it!
254 else if( pNewChgSet )
255 bContinue = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
256 }
257 }
258 const SvxTextLeftMarginItem *pOldTextLeftMargin(GetItemIfSet(RES_MARGIN_TEXTLEFT, false));
259 if (pNewTextLeftMargin && pOldTextLeftMargin)
260 {
261 if (pOldTextLeftMargin != pNewTextLeftMargin) // Avoid recursion (SetAttr!)
262 {
263 bool bChg = false;
264 SvxTextLeftMarginItem aNew(*pOldTextLeftMargin);
265 // We had a relative value -> recalculate
266 if( 100 != aNew.GetPropLeft() )
267 {
268 // note: changing from Left to TextLeft - looked wrong with Left
269 tools::Long nTmp = aNew.GetTextLeft(); // keep so that we can compare
270 aNew.SetTextLeft(pNewTextLeftMargin->GetTextLeft(), aNew.GetPropLeft());
271 bChg |= nTmp != aNew.GetTextLeft();
272 }
273 if( bChg )
274 {
275 SetFormatAttr( aNew );
276 bContinue = nullptr != pOldChgSet || bNewParent;
277 }
278 // We set it to absolute -> do not propagate it further, unless
279 // we set it!
280 else if( pNewChgSet )
281 bContinue = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
282 }
283 }
284 const SvxRightMarginItem *pOldRightMargin(GetItemIfSet(RES_MARGIN_RIGHT, false));
285 if (pNewRightMargin && pOldRightMargin)
286 {
287 if (pOldRightMargin != pNewRightMargin) // Avoid recursion (SetAttr!)
288 {
289 bool bChg = false;
290 SvxRightMarginItem aNew(*pOldRightMargin);
291 // We had a relative value -> recalculate
292 if( 100 != aNew.GetPropRight() )
293 {
294 tools::Long nTmp = aNew.GetRight(); // keep so that we can compare
295 aNew.SetRight(pNewRightMargin->GetRight(), aNew.GetPropRight());
296 bChg |= nTmp != aNew.GetRight();
297 }
298 if( bChg )
299 {
300 SetFormatAttr( aNew );
301 bContinue = nullptr != pOldChgSet || bNewParent;
302 }
303 // We set it to absolute -> do not propagate it further, unless
304 // we set it!
305 else if( pNewChgSet )
306 bContinue = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
307 }
308 }
309
310 if( pNewULSpace && (pOldULSpace = GetItemIfSet(RES_UL_SPACE, false)) &&
311 pOldULSpace != pNewULSpace ) // Avoid recursion (SetAttr!)
312 {
313 SvxULSpaceItem aNew( *pOldULSpace );
314 bool bChg = false;
315 // We had a relative value -> recalculate
316 if( 100 != aNew.GetPropUpper() )
317 {
318 sal_uInt16 nTmp = aNew.GetUpper(); // keep so that we can compare
319 aNew.SetUpper( pNewULSpace->GetUpper(), aNew.GetPropUpper() );
320 bChg |= nTmp != aNew.GetUpper();
321 }
322 // We had a relative value -> recalculate
323 if( 100 != aNew.GetPropLower() )
324 {
325 sal_uInt16 nTmp = aNew.GetLower(); // keep so that we can compare
326 aNew.SetLower( pNewULSpace->GetLower(), aNew.GetPropLower() );
327 bChg |= nTmp != aNew.GetLower();
328 }
329 if( bChg )
330 {
331 SetFormatAttr( aNew );
332 bContinue = nullptr != pOldChgSet || bNewParent;
333 }
334 // We set it to absolute -> do not propagate it further, unless
335 // we set it!
336 else if( pNewChgSet )
337 bContinue = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
338 }
339
340 for( int nC = 0; nC < int(SAL_N_ELEMENTS(aFontSizeArr)); ++nC )
341 {
342 const SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize;
343 if( pFSize && (SfxItemState::SET == GetItemState(
344 pFSize->Which(), false, reinterpret_cast<const SfxPoolItem**>(&pOldFSize) )) &&
345 // Avoid recursion (SetAttr!)
346 pFSize != pOldFSize )
347 {
348 if( 100 == pOldFSize->GetProp() &&
349 MapUnit::MapRelative == pOldFSize->GetPropUnit() )
350 {
351 // We set it to absolute -> do not propagate it further, unless
352 // we set it!
353 if( pNewChgSet )
354 bContinue = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
355 }
356 else
357 {
358 // We had a relative value -> recalculate
359 sal_uInt32 nTmp = pOldFSize->GetHeight(); // keep so that we can compare
360 SvxFontHeightItem aNew(240 , 100, pFSize->Which());
361 aNew.SetHeight( pFSize->GetHeight(), pOldFSize->GetProp(),
362 pOldFSize->GetPropUnit() );
363 if( nTmp != aNew.GetHeight() )
364 {
365 SetFormatAttr( aNew );
366 bContinue = nullptr != pOldChgSet || bNewParent;
367 }
368 // We set it to absolute -> do not propagate it further, unless
369 // we set it!
370 else if( pNewChgSet )
371 bContinue = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
372 }
373 }
374 }
375
376 if( bContinue )
377 SwFormatColl::SwClientNotify(rModify, rHint);
378}
379
381
383
385{
387 const SwNodes& rNds = GetDoc()->GetNodes();
388 for( SwContentNode* pNode = aIter.First(); pNode; pNode = aIter.Next() )
389 if( &(pNode->GetNodes()) == &rNds )
390 return true;
391
392 return false;
393}
394
396{
397 const bool bIsNumRuleItem = rAttr.Which() == RES_PARATR_NUMRULE;
398 if ( bIsNumRuleItem )
399 {
401 }
402
403 const bool bRet = SwFormatColl::SetFormatAttr( rAttr );
404
405 if ( bIsNumRuleItem )
406 {
408 }
409
410 return bRet;
411}
412
414{
415 const bool bIsNumRuleItemAffected =
416 rSet.GetItemState( RES_PARATR_NUMRULE, false ) == SfxItemState::SET;
417 if ( bIsNumRuleItemAffected )
418 {
420 }
421
422 const bool bRet = SwFormatColl::SetFormatAttr( rSet );
423
424 if ( bIsNumRuleItemAffected )
425 {
427 }
428
429 return bRet;
430}
431
432bool SwTextFormatColl::ResetFormatAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
433{
434 const bool bIsNumRuleItemAffected =
435 ( nWhich2 != 0 && nWhich2 > nWhich1 )
436 ? ( nWhich1 <= RES_PARATR_NUMRULE &&
437 RES_PARATR_NUMRULE <= nWhich2 )
438 : nWhich1 == RES_PARATR_NUMRULE;
439 if ( bIsNumRuleItemAffected )
440 {
442 }
443
444 const bool bRet = SwFormatColl::ResetFormatAttr( nWhich1, nWhich2 );
445
446 return bRet;
447}
448
449// #i73790#
451{
452 const bool bOldState( mbStayAssignedToListLevelOfOutlineStyle );
454 // #i70748#
455 // Outline level is no longer a member, it is an attribute now.
456 // Thus, it needs to be restored, if the paragraph style is assigned
457 // to the outline style
458 const int nAssignedOutlineStyleLevel = IsAssignedToListLevelOfOutlineStyle()
460 : -1;
461
462 sal_uInt16 nRet = SwFormatColl::ResetAllFormatAttr();
463
464 // #i70748#
465 if ( nAssignedOutlineStyleLevel != -1 )
466 {
467 AssignToListLevelOfOutlineStyle( nAssignedOutlineStyleLevel );
468 }
469
471
472 return nRet;
473}
474
476{
479 {
480 ret |= ::sw::ListLevelIndents::FirstLine;
481 }
483 {
485 }
486 return ret;
487}
488
490{
491 bool bAreListLevelIndentsApplicable( true );
492
493 if ( GetItemState( RES_PARATR_NUMRULE ) != SfxItemState::SET )
494 {
495 // no list style applied to paragraph style
496 bAreListLevelIndentsApplicable = false;
497 }
498 else if (GetItemState(nWhich, false ) == SfxItemState::SET)
499 {
500 // paragraph style has hard-set indent attributes
501 bAreListLevelIndentsApplicable = false;
502 }
503 else if ( GetItemState( RES_PARATR_NUMRULE, false ) == SfxItemState::SET )
504 {
505 // list style is directly applied to paragraph style and paragraph
506 // style has no hard-set indent attributes
507 bAreListLevelIndentsApplicable = true;
508 }
509 else
510 {
511 // list style is applied through one of the parent paragraph styles and
512 // paragraph style has no hard-set indent attributes
513
514 // check parent paragraph styles
515 const SwTextFormatColl* pColl = dynamic_cast<const SwTextFormatColl*>(DerivedFrom());
516 while ( pColl )
517 {
518 if (pColl->GetAttrSet().GetItemState(nWhich, false) == SfxItemState::SET)
519 {
520 // indent attributes found in the paragraph style hierarchy.
521 bAreListLevelIndentsApplicable = false;
522 break;
523 }
524
525 if ( pColl->GetAttrSet().GetItemState( RES_PARATR_NUMRULE, false ) == SfxItemState::SET )
526 {
527 // paragraph style with the list style found and until now no
528 // indent attributes are found in the paragraph style hierarchy.
529 bAreListLevelIndentsApplicable = true;
530 break;
531 }
532
533 pColl = dynamic_cast<const SwTextFormatColl*>(pColl->DerivedFrom());
534 OSL_ENSURE( pColl,
535 "<SwTextFormatColl::AreListLevelIndentsApplicable()> - something wrong in paragraph style hierarchy. The applied list style is not found." );
536 }
537 }
538
539 return bAreListLevelIndentsApplicable;
540}
541
543{
544 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTextFormatColl"));
545 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
546 (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", BAD_CAST(typeid(*this).name()));
547 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr()));
549 {
550 (void)xmlTextWriterWriteAttribute(
551 pWriter, BAD_CAST("next"), BAD_CAST(mpNextTextFormatColl->GetName().toUtf8().getStr()));
552 }
554 {
555 (void)xmlTextWriterWriteAttribute(
556 pWriter, BAD_CAST("linked"), BAD_CAST(mpLinkedCharFormat->GetName().toUtf8().getStr()));
557 }
558 GetAttrSet().dumpAsXml(pWriter);
559 (void)xmlTextWriterEndElement(pWriter);
560}
561
563{
564 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTextFormatColls"));
565 for (size_t i = 0; i < size(); ++i)
566 GetFormat(i)->dumpAsXml(pWriter);
567 (void)xmlTextWriterEndElement(pWriter);
568}
569
570//FEATURE::CONDCOLL
571
573 sal_uInt32 nSubCond )
574 : SwClient( pColl ), m_nCondition( nMasterCond ),
575 m_nSubCondition( nSubCond )
576{
577}
578
580 : SwClient( const_cast<sw::BroadcastingModify*>(static_cast<const sw::BroadcastingModify*>(rCopy.GetRegisteredIn())) ),
581 m_nCondition( rCopy.m_nCondition ),
582 m_nSubCondition( rCopy.m_nSubCondition )
583{
584}
585
587{
588}
589
591{
592 rFormat.Add( this );
593}
594
596{
597 return ( m_nCondition == rCmp.m_nCondition )
598 && ( m_nSubCondition == rCmp.m_nSubCondition );
599}
600
601void SwCollCondition::SetCondition( Master_CollCondition nCond, sal_uInt32 nSubCond )
602{
603 m_nCondition = nCond;
604 m_nSubCondition = nSubCond;
605}
606
608{
609}
610
612 const SwCollCondition& rCond ) const
613{
614 for (const auto &rpFnd : m_CondColls)
615 {
616 if (*rpFnd == rCond)
617 return rpFnd.get();
618 }
619
620 return nullptr;
621}
622
624{
625 for (SwFormatCollConditions::size_type n = 0; n < m_CondColls.size(); ++n)
626 {
627 if (*m_CondColls[ n ] == rCond)
628 {
629 m_CondColls.erase( m_CondColls.begin() + n );
630 break;
631 }
632 }
633
634 // Not found -> so insert it
635 m_CondColls.push_back( std::make_unique<SwCollCondition> (rCond) );
636}
637
639{
640 for (SwFormatCollConditions::size_type n = 0; n < m_CondColls.size(); ++n)
641 {
642 if (*m_CondColls[ n ] == rCond)
643 {
644 m_CondColls.erase( m_CondColls.begin() + n );
645 }
646 }
647}
648
650{
651 // Copy the Conditions, but first delete the old ones
652 m_CondColls.clear();
653 SwDoc& rDoc = *GetDoc();
654 for (const auto &rpFnd : rCndClls)
655 {
656 SwTextFormatColl *const pTmpColl = rpFnd->GetTextFormatColl()
657 ? rDoc.CopyTextColl( *rpFnd->GetTextFormatColl() )
658 : nullptr;
659 std::unique_ptr<SwCollCondition> pNew;
660 pNew.reset(new SwCollCondition( pTmpColl, rpFnd->GetCondition(),
661 rpFnd->GetSubCondition() ));
662 m_CondColls.push_back( std::move(pNew) );
663 }
664}
665
667{
668 OSL_ENSURE( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTextFormatColl: Level Out Of Range" );
670 o3tl::narrowing<sal_uInt16>(nLevel) ) );
671}
672
674{
675 return GetFormatAttr(RES_PARATR_OUTLINELEVEL).GetValue();
676}
677
679{
681 "<SwTextFormatColl::GetAssignedOutlineStyleLevel()> - misuse of method");
682 return GetAttrOutlineLevel() - 1;
683}
684
686{
688 SetAttrOutlineLevel(nAssignedListLevel+1);
689
690 // #i100277#
692 SwTextFormatColl* pDerivedTextFormatColl = aIter.First();
693 while ( pDerivedTextFormatColl != nullptr )
694 {
695 if ( !pDerivedTextFormatColl->IsAssignedToListLevelOfOutlineStyle() )
696 {
697 if ( pDerivedTextFormatColl->GetItemState( RES_PARATR_NUMRULE, false ) == SfxItemState::DEFAULT )
698 {
699 SwNumRuleItem aItem;
700 pDerivedTextFormatColl->SetFormatAttr( aItem );
701 }
702 if ( pDerivedTextFormatColl->GetItemState( RES_PARATR_OUTLINELEVEL, false ) == SfxItemState::DEFAULT )
703 {
704 pDerivedTextFormatColl->SetAttrOutlineLevel( 0 );
705 }
706 }
707
708 pDerivedTextFormatColl = aIter.Next();
709 }
710}
711
713{
716}
717
718/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & GetValue() const
SfxHintId GetId() const
void dumpAsXml(xmlTextWriterPtr pWriter) const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxItemSet * GetParent() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
T & StaticWhichCast(TypedWhichId< T > nId)
sal_uInt16 Which() const
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
sal_uInt16 GetPropTextFirstLineOffset() const
short GetTextFirstLineOffset() const
sal_uInt32 GetHeight() const
void SetHeight(sal_uInt32 nNewHeight, const sal_uInt16 nNewProp=100, MapUnit eUnit=MapUnit::MapRelative)
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
tools::Long GetRight() const
sal_uInt16 GetPropRight() const
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
sal_uInt16 GetPropLeft() const
tools::Long GetTextLeft() const
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
sal_uInt16 GetPropLower() const
sal_uInt16 GetUpper() const
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
sal_uInt16 GetLower() const
sal_uInt16 GetPropUpper() const
const SwAttrSet * GetTheChgdSet() const
Where it has changed.
Definition: hints.hxx:351
const SwAttrSet * GetChgSet() const
What has changed.
Definition: hints.hxx:347
void Delete(const void *pOwner, sal_uInt16 nIndex)
Definition: swcache.cxx:322
Represents the style of a text portion.
Definition: charfmt.hxx:27
void RegisterToFormat(SwFormat &)
Definition: fmtcol.cxx:590
void SetCondition(Master_CollCondition nCond, sal_uInt32 nSubCond)
Definition: fmtcol.cxx:601
Master_CollCondition m_nCondition
Definition: fmtcol.hxx:212
SwCollCondition(SwTextFormatColl *pColl, Master_CollCondition nMasterCond, sal_uInt32 nSubCond)
Definition: fmtcol.cxx:572
bool operator==(const SwCollCondition &rCmp) const
Definition: fmtcol.cxx:595
virtual ~SwCollCondition() override
Definition: fmtcol.cxx:586
sal_uInt32 m_nSubCondition
Definition: fmtcol.hxx:213
SwFormatCollConditions m_CondColls
Definition: fmtcol.hxx:245
void InsertCondition(const SwCollCondition &rCond)
Definition: fmtcol.cxx:623
void RemoveCondition(const SwCollCondition &rCond)
Definition: fmtcol.cxx:638
virtual ~SwConditionTextFormatColl() override
Definition: fmtcol.cxx:607
void SetConditions(const SwFormatCollConditions &)
Definition: fmtcol.cxx:649
const SwCollCondition * HasCondition(const SwCollCondition &rCond) const
Definition: fmtcol.cxx:611
Definition: doc.hxx:197
SwTextFormatColl * CopyTextColl(const SwTextFormatColl &rColl)
copy TextNodes
Definition: docfmt.cxx:1192
bool IsInDtor() const
Definition: doc.hxx:417
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2454
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1039
SwNodes & GetNodes()
Definition: doc.hxx:422
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
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:618
const OUString & GetName() const
Definition: format.hxx:131
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:385
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
SwFormat * DerivedFrom() const
Definition: format.hxx:128
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: format.cxx:224
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:366
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
virtual sal_uInt16 ResetAllFormatAttr()
Takes all hints from Delta-Array,.
Definition: format.cxx:646
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Templatized version of GetItemState() to directly return the correct type.
Definition: format.hxx:111
virtual SwTextFormatColl * GetFormat(size_t idx) const override
Definition: docary.hxx:159
TElementType * Next()
Definition: calbck.hxx:380
TElementType * First()
Definition: calbck.hxx:372
void AddParagraphStyle(SwTextFormatColl &rTextFormatColl)
Definition: number.cxx:1098
void RemoveParagraphStyle(SwTextFormatColl &rTextFormatColl)
Definition: number.cxx:1109
const OUString & GetName() const
Definition: numrule.hxx:224
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
void SetAttrOutlineLevel(int)
Definition: fmtcol.cxx:666
SwCharFormat * mpLinkedCharFormat
Definition: fmtcol.hxx:75
bool mbAssignedToOutlineStyle
Definition: fmtcol.hxx:69
bool AreListLevelIndentsApplicableImpl(sal_uInt16 nWhich) const
Definition: fmtcol.cxx:489
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
Definition: fmtcol.cxx:432
bool m_bInSwFntCache
Definition: fmtcol.hxx:71
bool StayAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:141
void SetLinkedCharFormat(SwCharFormat *pLink)
Definition: fmtcol.cxx:380
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:122
virtual ~SwTextFormatColl()
Definition: fmtcol.cxx:110
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: fmtcol.cxx:542
void DeleteAssignmentToListLevelOfOutlineStyle()
Definition: fmtcol.cxx:712
virtual bool SetFormatAttr(const SfxPoolItem &rAttr) override
Override to recognize changes on the <SwNumRuleItem> and register/unregister the paragragh style at t...
Definition: fmtcol.cxx:395
void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
Definition: fmtcol.cxx:685
SwTextFormatColl * mpNextTextFormatColl
Definition: fmtcol.hxx:73
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
To get UL- / LR- / FontHeight-changes.
Definition: fmtcol.cxx:128
virtual sal_uInt16 ResetAllFormatAttr() override
Override <ResetAllFormatAttr()> to stay assigned to list level of outline style.
Definition: fmtcol.cxx:450
::sw::ListLevelIndents AreListLevelIndentsApplicable() const
Definition: fmtcol.cxx:475
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:678
bool IsAtDocNodeSet() const
Definition: fmtcol.cxx:384
const SwCharFormat * GetLinkedCharFormat() const
Definition: fmtcol.cxx:382
int GetAttrOutlineLevel() const
Definition: fmtcol.cxx:673
bool mbStayAssignedToListLevelOfOutlineStyle
Definition: fmtcol.hxx:67
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: fmtcol.cxx:562
struct _xmlTextWriter * xmlTextWriterPtr
Master_CollCondition
Conditional styles.
Definition: fmtcol.hxx:196
std::vector< std::unique_ptr< SwCollCondition > > SwFormatCollConditions
Definition: fmtcol.hxx:238
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< SvxFirstLineIndentItem > RES_MARGIN_FIRSTLINE(91)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(169)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
constexpr TypedWhichId< SvxRightMarginItem > RES_MARGIN_RIGHT(93)
constexpr TypedWhichId< SvxTextLeftMarginItem > RES_MARGIN_TEXTLEFT(92)
constexpr TypedWhichId< SfxUInt16Item > RES_PARATR_OUTLINELEVEL(79)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(168)
sal_Int64 n
SvBaseLink * pLink
#define SAL_N_ELEMENTS(arr)
SwNumRule * GetNumRule(SwTextFormatColl &rTextFormatColl)
determines the list style, which directly set at the given paragraph style
Definition: fmtcol.cxx:74
void RemoveFromNumRule(SwTextFormatColl &rTextFormatColl)
removes the given paragraph style from the directly set list style
Definition: fmtcol.cxx:100
void CheckTextFormatCollForDeletionOfAssignmentToOutlineStyle(SwFormat *pFormat, const SwNumRuleItem *pNewNumRuleItem)
Checks, if assignment of paragraph style to list level of outline style has to be deleted,...
Definition: fmtcol.cxx:42
void AddToNumRule(SwTextFormatColl &rTextFormatColl)
adds the given paragraph style at the directly set list style
Definition: fmtcol.cxx:91
int i
Dialog to specify the properties of date form field.
ListLevelIndents
Definition: paratr.hxx:52
long Long
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
static SfxItemSet & rSet
SwFontCache * pSwFontCache
Definition: swfntcch.cxx:33
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92