LibreOffice Module sw (master) 1
fltshell.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 <sal/config.h>
22#include <sal/log.hxx>
23#include <osl/diagnose.h>
24
25#include <cstddef>
26
27#include <hintids.hxx>
28#include <hints.hxx>
29
30#include <svl/cintitem.hxx>
31#include <svl/stritem.hxx>
32#include <fmtanchr.hxx>
33#include <fmtfld.hxx>
34#include <redline.hxx>
35#include <pam.hxx>
36#include <doc.hxx>
41#include <ndtxt.hxx>
42#include <fldbas.hxx>
43#include <docufld.hxx>
44#include <txtfld.hxx>
45#include <tox.hxx>
46#include <expfld.hxx>
47#include <bookmark.hxx>
48#include <fltshell.hxx>
49#include <rdfhelper.hxx>
50#include <utility>
51
52using namespace com::sun::star;
53
54static SwContentNode* GetContentNode(SwDoc& rDoc, SwPosition& rPos, bool bNext)
55{
56 SwContentNode * pCNd = rPos.GetNode().GetContentNode();
57 if(!pCNd && nullptr == (pCNd = bNext ? rDoc.GetNodes().GoNext(&rPos)
58 : SwNodes::GoPrevious(&rPos)))
59 {
60 pCNd = bNext ? SwNodes::GoPrevious(&rPos)
61 : rDoc.GetNodes().GoNext(&rPos);
62 OSL_ENSURE(pCNd, "no ContentNode found");
63 }
64 return pCNd;
65}
66
67static OUString lcl_getTypePath(OUString& rType)
68{
69 OUString aRet;
70 if (rType.startsWith("urn:bails"))
71 {
72 rType = "urn:bails";
73 aRet = "tscp/bails.rdf";
74 }
75 return aRet;
76}
77
78// Stack entry for all text attributes
79SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, std::unique_ptr<SfxPoolItem> pHt)
80 : m_aMkPos(rStartPos)
81 , m_aPtPos(rStartPos)
82 , m_pAttr( std::move(pHt) )
83 , m_isAnnotationOnEnd(false)
84{
85 m_bOld = false; // used for marking Attributes *before* skipping field results
86 m_bOpen = true; // lock the attribute --> may first
87 m_bConsumedByField = false;
88}
89
91{
92 // Although attribute got passed as pointer, it gets deleted here
93}
94
96{
97 // Release attribute and keep track of end
98 // Everything with sal_uInt16s, because otherwise the inserting of new text at
99 // the cursor position moves the attribute's range
100 // That's not the desired behavior!
101 m_bOpen = false; // release and remember END
102 m_aPtPos.FromSwPosition(rEndPos);
103}
104
105bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode const eCheck,
106 const SwFltPosition &rMkPos, const SwFltPosition &rPtPos,
107 sal_uInt16 nWhich)
108{
109 // does this range actually contain something?
110 // empty range is allowed if at start of empty paragraph
111 // fields are special: never have range, so leave them
112 SwNodeOffset nMk = rMkPos.m_nNode.GetIndex() + 1;
113 const SwNodes& rMkNodes = rMkPos.m_nNode.GetNodes();
114 if (nMk >= rMkNodes.Count())
115 return false;
116 SwContentNode *const pContentNode(rMkNodes[nMk]->GetContentNode());
117 if (rMkPos == rPtPos &&
118 ((0 != rPtPos.m_nContent) || (pContentNode && (0 != pContentNode->Len())))
119 && ( RES_TXTATR_FIELD != nWhich
120 && RES_TXTATR_ANNOTATION != nWhich
121 && RES_TXTATR_INPUTFIELD != nWhich ))
122 {
123 return false;
124 }
125 // The content indices always apply to the node!
126 rRegion.GetPoint()->Assign( rMkPos.m_nNode.GetIndex() + 1 );
127 SwContentNode* pCNd = GetContentNode(rDoc, *rRegion.GetPoint(), true);
128
129 SAL_WARN_IF(pCNd->Len() < rMkPos.m_nContent, "sw.ww8",
130 "invalid content index " << rMkPos.m_nContent << " but text node has only " << pCNd->Len());
131 rRegion.GetPoint()->SetContent( std::min<sal_Int32>(rMkPos.m_nContent, pCNd->Len()) );
132 rRegion.SetMark();
133 if (rMkPos.m_nNode != rPtPos.m_nNode)
134 {
135 SwNodeOffset n = rPtPos.m_nNode.GetIndex() + 1;
136 SwNodes& rNodes = rRegion.GetPoint()->GetNodes();
137 if (n >= rNodes.Count())
138 return false;
139 rRegion.GetPoint()->Assign(n);
140 pCNd = GetContentNode(rDoc, *rRegion.GetPoint(), false);
141 }
142 SAL_WARN_IF(pCNd->Len() < rPtPos.m_nContent, "sw.ww8",
143 "invalid content index " << rPtPos.m_nContent << " but text node has only " << pCNd->Len());
144 rRegion.GetPoint()->SetContent( std::min<sal_Int32>(rPtPos.m_nContent, pCNd->Len()) );
145 OSL_ENSURE( CheckNodesRange( rRegion.Start()->GetNode(),
146 rRegion.End()->GetNode(), true ),
147 "attribute or similar crosses section-boundaries" );
148 bool bRet = true;
149 if (eCheck & RegionMode::CheckNodes)
150 {
151 bRet &= CheckNodesRange(rRegion.Start()->GetNode(),
152 rRegion.End()->GetNode(), true);
153 }
154 if (eCheck & RegionMode::CheckFieldmark)
155 {
156 bRet &= !sw::mark::IsFieldmarkOverlap(rRegion);
157 }
158 return bRet;
159}
160
161bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode eCheck) const
162{
163 return MakeRegion(rDoc, rRegion, eCheck, m_aMkPos, m_aPtPos, m_pAttr->Which());
164}
165
167 : m_nFieldFlags(nFieldFl), m_rDoc(rDo), m_bIsEndStack(false)
168{
169}
170
172{
173 OSL_ENSURE(m_Entries.empty(), "There are still Attributes on the stack");
174}
175
176// MoveAttrs() is meant to address the following problem:
177// When a field like "set variable" is set through the stack, the text
178// is shifted by one \xff character, which makes all subsequent
179// attribute positions invalid.
180// After setting the attribute in the doc, MoveAttrs() needs to be
181// called in order to push all attribute positions to the right in the
182// same paragraph further out by one character.
184{
185 SwNodeOffset nPosNd = rPos.GetNodeIndex();
186 sal_uInt16 nPosCt = rPos.GetContentIndex() - 1;
187
188 for (size_t i = 0, nCnt = m_Entries.size(); i < nCnt; ++i)
189 {
190 SwFltStackEntry& rEntry = *m_Entries[i];
191 if (
192 (rEntry.m_aMkPos.m_nNode.GetIndex()+1 == nPosNd) &&
193 (rEntry.m_aMkPos.m_nContent >= nPosCt)
194 )
195 {
196 rEntry.m_aMkPos.m_nContent++;
197 OSL_ENSURE( rEntry.m_aMkPos.m_nContent
198 <= m_rDoc.GetNodes()[nPosNd]->GetContentNode()->Len(),
199 "Attribute ends after end of line" );
200 }
201 if (
202 (rEntry.m_aPtPos.m_nNode.GetIndex()+1 == nPosNd) &&
203 (rEntry.m_aPtPos.m_nContent >= nPosCt)
204 )
205 {
206 if ( !rEntry.m_isAnnotationOnEnd
207 || rEntry.m_aPtPos.m_nContent > nPosCt)
208 {
209 assert(!(rEntry.m_isAnnotationOnEnd && rEntry.m_aPtPos.m_nContent > nPosCt));
211 && rEntry.m_aPtPos.m_nContent == nPosCt
212 && rEntry.m_pAttr->Which() == RES_FLTR_ANNOTATIONMARK)
213 {
214 rEntry.m_isAnnotationOnEnd = true;
215 eMode = MoveAttrsMode::DEFAULT; // only set 1 flag
216 }
217 rEntry.m_aPtPos.m_nContent++;
218 OSL_ENSURE( rEntry.m_aPtPos.m_nContent
219 <= m_rDoc.GetNodes()[nPosNd]->GetContentNode()->Len(),
220 "Attribute ends after end of line" );
221 }
222 }
223 }
224}
225
227{
228 size_t nCnt = m_Entries.size();
229 for (size_t i=0; i < nCnt; ++i)
230 m_Entries[i]->m_bOld = true;
231}
232
233namespace
234{
235 bool couldExtendEntry(const SwFltStackEntry *pExtendCandidate,
236 const SfxPoolItem& rAttr)
237 {
238 return (pExtendCandidate &&
239 !pExtendCandidate->m_bConsumedByField &&
240 //if we bring character attributes into the fold we need to both
241 //a) consider RES_CHRATR_FONTSIZE and RES_CHRATR_FONT wrt Word's CJK/CTL variants
242 //b) consider crossing table cell boundaries (tdf#102334)
243 isPARATR_LIST(rAttr.Which()) &&
244 *(pExtendCandidate->m_pAttr) == rAttr);
245 }
246}
247
248void SwFltControlStack::NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr)
249{
250 sal_uInt16 nWhich = rAttr.Which();
251 // Set end position of potentially equal attributes on stack, so
252 // as to avoid having them accumulate
253 SwFltStackEntry *pExtendCandidate = SetAttr(rPos, nWhich);
254 if (couldExtendEntry(pExtendCandidate, rAttr))
255 {
256 //Here we optimize by seeing if there is an attribute uncommitted
257 //to the document which
258
259 //a) has the same value as this attribute
260 //b) is already open, or ends at the same place as where we're starting
261 //from. If so we merge it with this one and elide adding another
262 //to the stack
263 pExtendCandidate->SetEndPos(rPos);
264 pExtendCandidate->m_bOpen=true;
265 }
266 else
267 {
268 SwFltStackEntry *pTmp = new SwFltStackEntry(rPos, std::unique_ptr<SfxPoolItem>(rAttr.Clone()) );
269 m_Entries.push_back(std::unique_ptr<SwFltStackEntry>(pTmp));
270 }
271}
272
273void SwFltControlStack::DeleteAndDestroy(Entries::size_type nCnt)
274{
275 OSL_ENSURE(nCnt < m_Entries.size(), "Out of range!");
276 if (nCnt < m_Entries.size())
277 {
278 auto aElement = m_Entries.begin() + nCnt;
279 m_Entries.erase(aElement);
280 }
281}
282
283// SwFltControlStack::StealAttr() removes attributes of the given type
284// from the stack. Allowed as nAttrId: 0 meaning any, or a specific
285// type. This makes them disappear from the doc structure. Only
286// attributes from the same paragraph as rPos are removed. Used for
287// graphic apos -> images.
289{
290 size_t nCnt = m_Entries.size();
291
292 while (nCnt)
293 {
294 nCnt --;
295 SwFltStackEntry& rEntry = *m_Entries[nCnt];
296 if (rEntry.m_aPtPos.m_nNode.GetIndex()+1 == rNode.GetIndex())
297 {
298 DeleteAndDestroy(nCnt); // delete from the stack
299 }
300 }
301}
302
303// SwFltControlStack::KillUnlockedAttr() removes all attributes from
304// the stack, which are assigned to an rPos. This makes them disappear
305// from the doc structure. Used in WW import for ignoring attributes
306// assigned to the 0x0c section break symbol.
308{
309 SwFltPosition aFltPos(rPos);
310
311 size_t nCnt = m_Entries.size();
312 while( nCnt )
313 {
314 nCnt --;
315 SwFltStackEntry& rEntry = *m_Entries[nCnt];
316 if( !rEntry.m_bOld
317 && !rEntry.m_bOpen
318 && (rEntry.m_aMkPos == aFltPos)
319 && (rEntry.m_aPtPos == aFltPos))
320 {
321 DeleteAndDestroy( nCnt ); // remove from stack
322 }
323 }
324}
325
326// Unlock all locked attributes and move to the end, all others will
327// be applied to the document and removed from the stack.
328// Returns if there were any selected attributes on the stack
330 sal_uInt16 nAttrId, bool bTstEnd, tools::Long nHand,
331 bool consumedByField)
332{
333 SwFltStackEntry *pRet = nullptr;
334
335 SwFltPosition aFltPos(rPos);
336
337 OSL_ENSURE(!nAttrId ||
338 (POOLATTR_BEGIN <= nAttrId && POOLATTR_END > nAttrId) ||
339 (RES_FLTRATTR_BEGIN <= nAttrId && RES_FLTRATTR_END > nAttrId),
340 "Wrong id for attribute");
341
342 auto aI = m_Entries.begin();
343 while (aI != m_Entries.end())
344 {
345 bool bLastEntry = aI == m_Entries.end() - 1;
346
347 SwFltStackEntry& rEntry = **aI;
348 if (rEntry.m_bOpen)
349 {
350 // set end of attribute
351 bool bF = false;
352 if (!nAttrId )
353 {
354 bF = true;
355 }
356 else if (nAttrId == rEntry.m_pAttr->Which())
357 {
358 if( nAttrId != RES_FLTR_BOOKMARK && nAttrId != RES_FLTR_ANNOTATIONMARK && nAttrId != RES_FLTR_RDFMARK )
359 {
360 // query handle
361 bF = true;
362 }
363 else if (nAttrId == RES_FLTR_BOOKMARK && nHand == static_cast<SwFltBookmark*>(rEntry.m_pAttr.get())->GetHandle())
364 {
365 bF = true;
366 }
367 else if (nAttrId == RES_FLTR_ANNOTATIONMARK && nHand == static_cast<CntUInt16Item*>(rEntry.m_pAttr.get())->GetValue())
368 {
369 bF = true;
370 }
371 else if (nAttrId == RES_FLTR_RDFMARK && nHand == static_cast<SwFltRDFMark*>(rEntry.m_pAttr.get())->GetHandle())
372 {
373 bF = true;
374 }
375 }
376 if (bF)
377 {
378 rEntry.m_bConsumedByField = consumedByField;
379 rEntry.SetEndPos(rPos);
380 if (bLastEntry && nAttrId == rEntry.m_pAttr->Which())
381 {
382 //potential candidate for merging with an identical
383 //property beginning at rPos
384 pRet = &rEntry;
385 }
386 }
387 ++aI;
388 continue;
389 }
390
391 // if the end position is equal to the cursor position, then
392 // refrain from applying it; there needs to be following text,
393 // except at the very end. (attribute expansion !!)
394 // Never apply end stack except at document ending
395 if (bTstEnd)
396 {
397 if (m_bIsEndStack)
398 {
399 ++aI;
400 continue;
401 }
402
403 //defer inserting this attribute into the document until
404 //we advance to the next node, or finish processing the document
405 if (rEntry.m_aPtPos.m_nNode.GetIndex() == aFltPos.m_nNode.GetIndex())
406 {
407 if (bLastEntry && nAttrId == rEntry.m_pAttr->Which() &&
408 rEntry.m_aPtPos.m_nContent == aFltPos.m_nContent)
409 {
410 //potential candidate for merging with an identical
411 //property beginning at rPos
412 pRet = &rEntry;
413 }
414
415 ++aI;
416 continue;
417 }
418 }
419 SetAttrInDoc(rPos, rEntry);
420 aI = m_Entries.erase(aI);
421 }
422
423 return pRet;
424}
425
426static bool MakePoint(const SwFltStackEntry& rEntry, SwDoc& rDoc,
427 SwPaM& rRegion)
428{
429 // the anchor is the Pam's Point. It's modified when inserting
430 // text, etc.; therefore it is kept on the stack. Only the
431 // attribute's format needs to be set.
432 rRegion.DeleteMark();
433
434 SwNodeOffset nMk = rEntry.m_aMkPos.m_nNode.GetIndex() + 1;
435 const SwNodes& rMkNodes = rEntry.m_aMkPos.m_nNode.GetNodes();
436 if (nMk >= rMkNodes.Count())
437 return false;
438
439 rRegion.GetPoint()->Assign(nMk);
440 GetContentNode(rDoc, *rRegion.GetPoint(), true);
441 rRegion.GetPoint()->SetContent(rEntry.m_aMkPos.m_nContent);
442 return true;
443}
444
445// MakeBookRegionOrPoint() behaves like MakeRegionOrPoint, except that
446// it adheres to certain restrictions on bookmarks in tables (cannot
447// span more than one cell)
448static bool MakeBookRegionOrPoint(const SwFltStackEntry& rEntry, SwDoc& rDoc,
449 SwPaM& rRegion )
450{
451 if (rEntry.MakeRegion(rDoc, rRegion, SwFltStackEntry::RegionMode::CheckNodes))
452 {
453 if (rRegion.GetPoint()->GetNode().FindTableBoxStartNode()
454 != rRegion.GetMark()->GetNode().FindTableBoxStartNode())
455 {
456 rRegion.Exchange(); // invalid range
457 rRegion.DeleteMark(); // -> both to mark
458 }
459 return true;
460 }
461 return MakePoint(rEntry, rDoc, rRegion);
462}
463
464// IterateNumrulePiece() looks for the first range valid for Numrules
465// between rTmpStart and rEnd.
466
467// rNds denotes the doc nodes
468// rEnd denotes the range end,
469// rTmpStart is an in/out parameter: in: start of range to be searched,
470// out: start of valid range
471// rTmpEnd is an out parameter
472// Returns true for valid range
473static bool IterateNumrulePiece( const SwPosition& rEnd,
474 SwNodeIndex& rTmpStart, SwNodeIndex& rTmpEnd )
475{
476 while( ( rTmpStart <= rEnd.GetNode() )
477 && !( rTmpStart.GetNode().IsTextNode() ) ) // look for valid start
478 ++rTmpStart;
479
480 rTmpEnd = rTmpStart;
481 while( ( rTmpEnd <= rEnd.GetNode() )
482 && ( rTmpEnd.GetNode().IsTextNode() ) ) // look for valid end + 1
483 ++rTmpEnd;
484
485 --rTmpEnd; // valid end
486
487 return rTmpStart <= rTmpEnd; // valid ?
488}
489
491 SwFltStackEntry& rEntry)
492{
493 SwPaM aRegion( rTmpPos );
494
495 switch(rEntry.m_pAttr->Which())
496 {
497 case RES_FLTR_ANCHOR:
498 {
499 SwFrameFormat* pFormat = static_cast<SwFltAnchor*>(rEntry.m_pAttr.get())->GetFrameFormat();
500 if (pFormat != nullptr)
501 {
502 MakePoint(rEntry, m_rDoc, aRegion);
503 SwFormatAnchor aAnchor(pFormat->GetAnchor());
504 aAnchor.SetAnchor(aRegion.GetPoint());
505 pFormat->SetFormatAttr(aAnchor);
506 // So the frames will be created when inserting into
507 // existing doc (after setting the anchor!):
509 && (RndStdIds::FLY_AT_PARA == pFormat->GetAnchor().GetAnchorId()))
510 {
511 pFormat->MakeFrames();
512 }
513 }
514 }
515 break;
516
517 case RES_TXTATR_FIELD:
520 break;
521
523 break;
524
525 case RES_FLTR_NUMRULE: // insert Numrule
526 {
527 const OUString& rNumNm = static_cast<SfxStringItem*>(rEntry.m_pAttr.get())->GetValue();
528 SwNumRule* pNumRule = m_rDoc.FindNumRulePtr( rNumNm );
529 if( pNumRule )
530 {
532 {
533 SwNodeIndex aTmpStart( aRegion.Start()->GetNode() );
534 SwNodeIndex aTmpEnd( aTmpStart );
535 SwPosition& rRegEndNd = *aRegion.End();
536 while( IterateNumrulePiece( rRegEndNd,
537 aTmpStart, aTmpEnd ) )
538 {
539 SwPaM aTmpPam( aTmpStart, aTmpEnd );
540 // no start of a new list
541 m_rDoc.SetNumRule( aTmpPam, *pNumRule, false );
542
543 aTmpStart = aTmpEnd; // here starts the next range
544 ++aTmpStart;
545 }
546 }
547 else
548 m_rDoc.DelNumRule( rNumNm );
549 }
550 }
551 break;
552
554 {
555 SwFltBookmark* pB = static_cast<SwFltBookmark*>(rEntry.m_pAttr.get());
556 const OUString& rName = static_cast<SwFltBookmark*>(rEntry.m_pAttr.get())->GetName();
557
559 {
561 if (!pFT)
562 {
565 }
566 SwSetExpField aField(static_cast<SwSetExpFieldType*>(pFT), pB->GetValSys());
568 MakePoint(rEntry, m_rDoc, aRegion);
570 MoveAttrs( *(aRegion.GetPoint()) );
571 }
572 if ( ( !IsFlagSet(HYPO) || IsFlagSet(BOOK_AND_REF) ) &&
573 !rEntry.m_bConsumedByField )
574 {
575 MakeBookRegionOrPoint(rEntry, m_rDoc, aRegion);
576 // #i120879# - create a cross reference heading bookmark if appropriate.
577 const IDocumentMarkAccess::MarkType eBookmarkType =
578 ( pB->IsTOCBookmark() &&
582 m_rDoc.getIDocumentMarkAccess()->makeMark(aRegion, rName, eBookmarkType, sw::mark::InsertMode::New);
583 }
584 }
585 break;
587 {
588 if (MakeBookRegionOrPoint(rEntry, m_rDoc, aRegion))
589 {
590 SwTextNode const*const pTextNode(
591 aRegion.End()->GetNode().GetTextNode());
592 SwTextField const*const pField = pTextNode ? pTextNode->GetFieldTextAttrAt(
593 aRegion.End()->GetContentIndex() - 1, ::sw::GetTextAttrMode::Default) : nullptr;
594 if (pField)
595 {
596 SwPostItField const*const pPostIt(
597 dynamic_cast<SwPostItField const*>(pField->GetFormatField().GetField()));
598 if (pPostIt)
599 {
600 assert(pPostIt->GetName().isEmpty());
601
602 if (!aRegion.HasMark())
603 {
604 // Annotation range was found in the file, but start/end is the same,
605 // pointing after the postit placeholder (see assert above).
606 // Adjust the start of the range to actually cover the comment, similar
607 // to what the UI and the UNO API does.
608 aRegion.SetMark();
609 aRegion.Start()->AdjustContent(-1);
610 }
611
612 m_rDoc.getIDocumentMarkAccess()->makeAnnotationMark(aRegion, OUString());
613 }
614 else
615 {
616 SAL_WARN("sw", "RES_FLTR_ANNOTATIONMARK: unexpected field");
617 }
618 }
619 else
620 {
621 SAL_WARN("sw", "RES_FLTR_ANNOTATIONMARK: missing field");
622 }
623 }
624 else
625 SAL_WARN("sw", "failed to make book region or point");
626 }
627 break;
628 case RES_FLTR_RDFMARK:
629 {
630 if (MakeBookRegionOrPoint(rEntry, m_rDoc, aRegion))
631 {
632 SwFltRDFMark* pMark = static_cast<SwFltRDFMark*>(rEntry.m_pAttr.get());
633 if (aRegion.GetPointNode().IsTextNode())
634 {
635 SwTextNode& rTextNode = *aRegion.GetPointNode().GetTextNode();
636
637 for (const std::pair<OUString, OUString>& rAttribute : pMark->GetAttributes())
638 {
639 OUString aTypeNS = rAttribute.first;
640 OUString aMetadataFilePath = lcl_getTypePath(aTypeNS);
641 if (aMetadataFilePath.isEmpty())
642 continue;
643
644 SwRDFHelper::addTextNodeStatement(aTypeNS, aMetadataFilePath, rTextNode, rAttribute.first, rAttribute.second);
645 }
646 }
647 }
648 else
649 SAL_WARN("sw", "failed to make book region or point");
650 }
651 break;
652 case RES_FLTR_TOX:
653 {
654 MakePoint(rEntry, m_rDoc, aRegion);
655
656 SwPosition* pPoint = aRegion.GetPoint();
657
658 SwFltTOX* pTOXAttr = static_cast<SwFltTOX*>(rEntry.m_pAttr.get());
659
660 // test if on this node there had been a pagebreak BEFORE the
661 // tox attribute was put on the stack
663 SwContentNode* pNd = nullptr;
664 if( !pTOXAttr->HadBreakItem() || !pTOXAttr->HadPageDescItem() )
665 {
666 pNd = pPoint->GetNode().GetContentNode();
667 if( pNd )
668 {
669 const SfxItemSet* pSet = pNd->GetpSwAttrSet();
670 const SfxPoolItem* pItem;
671 if( pSet )
672 {
673 if( !pTOXAttr->HadBreakItem()
674 && SfxItemState::SET == pSet->GetItemState( RES_BREAK, false, &pItem ) )
675 {
676 aBkSet.Put( *pItem );
677 pNd->ResetAttr( RES_BREAK );
678 }
679 if( !pTOXAttr->HadPageDescItem()
680 && SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC, false, &pItem ) )
681 {
682 aBkSet.Put( *pItem );
683 pNd->ResetAttr( RES_PAGEDESC );
684 }
685 }
686 }
687 }
688
689 // set (above saved and removed) the break item at the node following the TOX
690 if (pNd && aBkSet.Count())
691 pNd->SetAttr(aBkSet);
692 }
693 break;
694 case RES_FLTR_REDLINE:
695 {
696 if (rEntry.MakeRegion(m_rDoc, aRegion,
698 {
702 SwFltRedline& rFltRedline = *static_cast<SwFltRedline*>(rEntry.m_pAttr.get());
703
704 SwRedlineData aData(rFltRedline.m_eType,
705 rFltRedline.m_nAutorNo,
706 rFltRedline.m_aStamp,
707 OUString(),
708 nullptr
709 );
714 }
715 }
716 break;
717 default:
718 {
720 {
722 }
723 }
724 break;
725 }
726}
727
728SfxPoolItem* SwFltControlStack::GetFormatStackAttr(sal_uInt16 nWhich, sal_uInt16 * pPos)
729{
730 size_t nSize = m_Entries.size();
731
732 while (nSize)
733 {
734 // is it the looked-for attribute ? (only applies to locked, meaning
735 // currently set attributes!!)
736 SwFltStackEntry &rEntry = *m_Entries[--nSize];
737 if (rEntry.m_bOpen && rEntry.m_pAttr->Which() == nWhich)
738 {
739 if (pPos)
740 *pPos = nSize;
741 return rEntry.m_pAttr.get(); // Ok, so stop
742 }
743 }
744 return nullptr;
745}
746
747const SfxPoolItem* SwFltControlStack::GetOpenStackAttr(const SwPosition& rPos, sal_uInt16 nWhich)
748{
749 SwFltPosition aFltPos(rPos);
750
751 size_t nSize = m_Entries.size();
752
753 while (nSize)
754 {
755 SwFltStackEntry &rEntry = *m_Entries[--nSize];
756 if (rEntry.m_bOpen && rEntry.m_pAttr->Which() == nWhich && rEntry.m_aMkPos == aFltPos)
757 {
758 return rEntry.m_pAttr.get();
759 }
760 }
761 return nullptr;
762}
763
765{
766 auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
767
768 if( !rPam.HasMark() || *pStt >= *pEnd )
769 return;
770
771 SwNodeIndex aStartNode(pStt->GetNode(), -1);
772 const sal_Int32 nStartIdx = pStt->GetContentIndex();
773 SwNodeIndex aEndNode(pEnd->GetNode(), -1);
774 const sal_Int32 nEndIdx = pEnd->GetContentIndex();
775
776 // We don't support deleting content that is over one node, or removing a node.
777 OSL_ENSURE(aEndNode == aStartNode, "nodes must be the same, or this method extended");
778 if (aEndNode != aStartNode)
779 return;
780
781 for (size_t nSize = m_Entries.size(); nSize > 0;)
782 {
783 SwFltStackEntry& rEntry = *m_Entries[--nSize];
784
785 bool bEntryStartAfterSelStart =
786 (rEntry.m_aMkPos.m_nNode == aStartNode &&
787 rEntry.m_aMkPos.m_nContent >= nStartIdx);
788
789 bool bEntryStartBeforeSelEnd =
790 (rEntry.m_aMkPos.m_nNode == aEndNode &&
791 rEntry.m_aMkPos.m_nContent <= nEndIdx);
792
793 bool bEntryEndAfterSelStart = false;
794 bool bEntryEndBeforeSelEnd = false;
795 if (!rEntry.m_bOpen)
796 {
797 bEntryEndAfterSelStart =
798 (rEntry.m_aPtPos.m_nNode == aStartNode &&
799 rEntry.m_aPtPos.m_nContent >= nStartIdx);
800
801 bEntryEndBeforeSelEnd =
802 (rEntry.m_aPtPos.m_nNode == aEndNode &&
803 rEntry.m_aPtPos.m_nContent <= nEndIdx);
804 }
805
806 bool bTotallyContained = false;
807 if (
808 bEntryStartAfterSelStart && bEntryStartBeforeSelEnd &&
809 bEntryEndAfterSelStart && bEntryEndBeforeSelEnd
810 )
811 {
812 bTotallyContained = true;
813 }
814
815 if (bTotallyContained)
816 {
817 // after start, before end, delete
818 DeleteAndDestroy(nSize);
819 continue;
820 }
821
822 const sal_Int32 nContentDiff = nEndIdx - nStartIdx;
823
824 // to be adjusted
825 if (bEntryStartAfterSelStart)
826 {
827 if (bEntryStartBeforeSelEnd)
828 {
829 // move start to new start
830 rEntry.m_aMkPos.SetPos(aStartNode, nStartIdx);
831 }
832 else
833 rEntry.m_aMkPos.m_nContent -= nContentDiff;
834 }
835
836 if (bEntryEndAfterSelStart)
837 {
838 if (bEntryEndBeforeSelEnd)
839 rEntry.m_aPtPos.SetPos(aStartNode, nStartIdx);
840 else
841 rEntry.m_aPtPos.m_nContent -= nContentDiff;
842 }
843
844 //That's what Open is, end equal to start, and nPtContent is invalid
845 if (rEntry.m_bOpen)
846 rEntry.m_aPtPos = rEntry.m_aMkPos;
847 }
848}
849
850// methods of SwFltAnchor follow
852 SfxPoolItem(RES_FLTR_ANCHOR), m_pFrameFormat(pFormat)
853{
854 m_pListener.reset(new SwFltAnchorListener(this));
855 m_pListener->StartListening(m_pFrameFormat->GetNotifier());
856}
857
859 SfxPoolItem(RES_FLTR_ANCHOR), m_pFrameFormat(rCpy.m_pFrameFormat)
860{
861 m_pListener.reset(new SwFltAnchorListener(this));
862 m_pListener->StartListening(m_pFrameFormat->GetNotifier());
863}
864
866{
867}
868
870{
871 m_pFrameFormat = _pFrameFormat;
872}
873
874
875bool SwFltAnchor::operator==(const SfxPoolItem& rItem) const
876{
877 return SfxPoolItem::operator==(rItem) &&
878 m_pFrameFormat == static_cast<const SwFltAnchor&>(rItem).m_pFrameFormat;
879}
880
882{
883 return new SwFltAnchor(*this);
884}
885
887 : m_pFltAnchor(pFltAnchor)
888{ }
889
891{
892 if (rHint.GetId() == SfxHintId::Dying)
894 else if (rHint.GetId() == SfxHintId::SwDrawFrameFormat)
895 {
896 auto pDrawFrameFormatHint = static_cast<const sw::DrawFrameFormatHint*>(&rHint);
897 if (pDrawFrameFormatHint->m_eId != sw::DrawFrameFormatHintId::DYING)
898 return;
900 }
901 else if (rHint.GetId() == SfxHintId::SwLegacyModify)
902 {
903 auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
904 if(pLegacyHint->m_pNew->Which() != RES_FMT_CHG)
905 return;
906 auto pFormatChg = dynamic_cast<const SwFormatChg*>(pLegacyHint->m_pNew);
907 auto pFrameFormat = pFormatChg ? dynamic_cast<SwFrameFormat*>(pFormatChg->pChangedFormat) : nullptr;
908 if(pFrameFormat)
909 m_pFltAnchor->SetFrameFormat(pFrameFormat);
910 }
911}
912
913// methods of SwFltRedline follow
914bool SwFltRedline::operator==(const SfxPoolItem& rItem) const
915{
916 return SfxPoolItem::operator==(rItem) &&
917 this == &rItem;
918}
919
921{
922 return new SwFltRedline(*this);
923}
924
925// methods of SwFltBookmark follow
926SwFltBookmark::SwFltBookmark( const OUString& rNa, OUString aVa,
927 tools::Long nHand, const bool bIsTOCBookmark )
929 , mnHandle( nHand )
930 , maName( rNa )
931 , maVal(std::move( aVa ))
932 , mbIsTOCBookmark( bIsTOCBookmark )
933{
934 // eSrc: CHARSET_DONTKNOW for no transform at operator <<
935 // Upcase is always done.
936 // Transform is never done at XXXStack.NewAttr(...).
937 // otherwise: Src Charset from argument for aName
938 // Src Charset from filter for aVal ( Text )
939
941 {
943 maName += rNa;
944 }
945}
946
948{
949 return SfxPoolItem::operator==(rItem)
950 && maName == static_cast<const SwFltBookmark&>(rItem).maName
951 && mnHandle == static_cast<const SwFltBookmark&>(rItem).mnHandle;
952}
953
955{
956 return new SwFltBookmark(*this);
957}
958
961 m_nHandle(0)
962{
963}
964
965bool SwFltRDFMark::operator==(const SfxPoolItem& rItem) const
966{
967 if (!SfxPoolItem::operator==(rItem))
968 return false;
969
970 const SwFltRDFMark& rMark = static_cast<const SwFltRDFMark&>(rItem);
971
972 return m_nHandle == rMark.m_nHandle && m_aAttributes == rMark.m_aAttributes;
973}
974
976{
977 return new SwFltRDFMark(*this);
978}
979
981{
983}
984
986{
987 return m_nHandle;
988}
989
990void SwFltRDFMark::SetAttributes( std::vector< std::pair<OUString, OUString> >&& rAttributes)
991{
992 m_aAttributes = std::move(rAttributes);
993}
994
995const std::vector< std::pair<OUString, OUString> >& SwFltRDFMark::GetAttributes() const
996{
997 return m_aAttributes;
998}
999
1000// methods of SwFltTOX follow
1001SwFltTOX::SwFltTOX(std::shared_ptr<SwTOXBase> xBase)
1002 : SfxPoolItem(RES_FLTR_TOX), m_xTOXBase(std::move(xBase)),
1003 m_bHadBreakItem( false ), m_bHadPageDescItem( false )
1004{
1005}
1006
1007bool SwFltTOX::operator==(const SfxPoolItem& rItem) const
1008{
1009 return SfxPoolItem::operator==(rItem) &&
1010 m_xTOXBase.get() == static_cast<const SwFltTOX&>(rItem).m_xTOXBase.get();
1011}
1012
1014{
1015 return new SwFltTOX(*this);
1016}
1017
1018// UpdatePageDescs needs to be called at end of parsing to make Writer actually
1019// accept Pagedescs contents
1020void UpdatePageDescs(SwDoc &rDoc, size_t nInPageDescOffset)
1021{
1022 // Update document page descriptors (only this way also left pages
1023 // get adjusted)
1024
1025 // PageDesc "Standard"
1026 rDoc.ChgPageDesc(0, rDoc.GetPageDesc(0));
1027
1028 // PageDescs "Convert..."
1029 for (size_t i = nInPageDescOffset; i < rDoc.GetPageDescCnt(); ++i)
1030 rDoc.ChgPageDesc(i, rDoc.GetPageDesc(i));
1031}
1032
1034 : m_pFormat(pFormat)
1035{
1036 if(m_pFormat)
1037 StartListening(pFormat->GetNotifier());
1038}
1039
1041{
1042 bool bDying = false;
1043 if (rHint.GetId() == SfxHintId::Dying)
1044 bDying = true;
1045 else if (rHint.GetId() == SfxHintId::SwDrawFrameFormat)
1046 {
1047 auto pDrawFrameFormatHint = static_cast<const sw::DrawFrameFormatHint*>(&rHint);
1048 bDying = pDrawFrameFormatHint->m_eId == sw::DrawFrameFormatHintId::DYING;
1049 }
1050 if (bDying)
1051 {
1052 m_pFormat = nullptr;
1054 }
1055}
1056
1058{
1059 m_pFormat = nullptr;
1061}
1062
1063/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ ShowDelete
show all deletes
@ On
RedlineFlags on.
@ ShowInsert
show all inserts
@ NONE
no RedlineFlags
OUString maName
sal_uInt16 GetValue() const
virtual void Notify(const SfxHint &rHint) override
Definition: fltshell.cxx:1040
SwFrameFormat * m_pFormat
Definition: fltshell.hxx:317
FrameDeleteWatch(SwFrameFormat *pFormat)
Definition: fltshell.cxx:1033
virtual ~FrameDeleteWatch() override
Definition: fltshell.cxx:1057
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
static SW_DLLPUBLIC OUString GetCrossRefHeadingBookmarkNamePrefix()
Definition: docbm.cxx:536
virtual ::sw::mark::IMark * makeMark(const SwPaM &rPaM, const OUString &rProposedName, MarkType eMark, ::sw::mark::InsertMode eMode, SwPosition const *pSepPos=nullptr)=0
Generates a new mark in the document for a certain selection.
static SW_DLLPUBLIC bool IsLegalPaMForCrossRefHeadingBookmark(const SwPaM &rPaM)
Definition: docbm.cxx:541
virtual sw::mark::IMark * makeAnnotationMark(const SwPaM &rPaM, const OUString &rName)=0
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
SfxHintId GetId() const
sal_uInt16 Count() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 Which() const
virtual bool operator==(const SfxPoolItem &) const=0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
void EndListeningAll()
bool StartListening(SvtBroadcaster &rBroadcaster)
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1586
virtual sal_Int32 Len() const
Definition: node.cxx:1256
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:493
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: node.cxx:1679
Definition: doc.hxx:197
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2454
size_t GetPageDescCnt() const
Definition: doc.hxx:895
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:349
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:419
OUString SetNumRule(const SwPaM &, const SwNumRule &, bool bCreateNewList, SwRootFrame const *pLayout=nullptr, const OUString &sContinuedListId=OUString(), bool bSetItem=true, const bool bResetIndentAttrs=false)
Accept changes of outline styles for OutlineRule.
Definition: docnum.cxx:861
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1890
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:978
bool DelNumRule(const OUString &rName, bool bBroadCast=false)
Definition: docnum.cxx:1055
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:896
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:247
Used by SwFltAnchor, to listen to an SwFrameFormat (to be aware when it is replaced or deleted).
Definition: fltshell.hxx:186
virtual void Notify(const SfxHint &) override
Definition: fltshell.cxx:890
SwFltAnchorListener(SwFltAnchor *pFltAnchor)
Definition: fltshell.cxx:886
SwFltAnchor * m_pFltAnchor
Definition: fltshell.hxx:187
SwFrameFormat * m_pFrameFormat
Definition: fltshell.hxx:168
std::unique_ptr< SwFltAnchorListener > m_pListener
Definition: fltshell.hxx:169
virtual ~SwFltAnchor() override
Definition: fltshell.cxx:865
virtual bool operator==(const SfxPoolItem &) const override
Definition: fltshell.cxx:875
SwFltAnchor(SwFrameFormat *pFlyFormat)
Definition: fltshell.cxx:851
virtual SwFltAnchor * Clone(SfxItemPool *=nullptr) const override
Definition: fltshell.cxx:881
void SetFrameFormat(SwFrameFormat *_pFrameFormat)
Definition: fltshell.cxx:869
OUString maName
Definition: fltshell.hxx:219
tools::Long mnHandle
Definition: fltshell.hxx:218
virtual SwFltBookmark * Clone(SfxItemPool *=nullptr) const override
Definition: fltshell.cxx:954
virtual bool operator==(const SfxPoolItem &) const override
Definition: fltshell.cxx:947
tools::Long GetHandle() const
Definition: fltshell.hxx:233
bool IsTOCBookmark() const
Definition: fltshell.hxx:236
SwFltBookmark(const OUString &rNa, OUString aVa, tools::Long nHand, const bool bIsTOCBookmark=false)
Definition: fltshell.cxx:926
const OUString & GetValSys() const
Definition: fltshell.hxx:235
void MarkAllAttrsOld()
Definition: fltshell.cxx:226
bool IsFlagSet(Flags no) const
Definition: fltshell.hxx:144
void StealAttr(const SwNode &rNode)
Definition: fltshell.cxx:288
void DeleteAndDestroy(Entries::size_type nCnt)
Definition: fltshell.cxx:273
void NewAttr(const SwPosition &rPos, const SfxPoolItem &rAttr)
Definition: fltshell.cxx:248
SwFltControlStack(SwFltControlStack const &)=delete
void KillUnlockedAttrs(const SwPosition &pPos)
Definition: fltshell.cxx:307
void MoveAttrs(const SwPosition &rPos, MoveAttrsMode=MoveAttrsMode::DEFAULT)
Definition: fltshell.cxx:183
virtual SwFltStackEntry * SetAttr(const SwPosition &rPos, sal_uInt16 nAttrId, bool bTstEnd=true, tools::Long nHand=LONG_MAX, bool consumedByField=false)
Definition: fltshell.cxx:329
const SfxPoolItem * GetOpenStackAttr(const SwPosition &rPos, sal_uInt16 nWhich)
Definition: fltshell.cxx:747
void Delete(const SwPaM &rPam)
Definition: fltshell.cxx:764
SfxPoolItem * GetFormatStackAttr(sal_uInt16 nWhich, sal_uInt16 *pPos)
Definition: fltshell.cxx:728
virtual void SetAttrInDoc(const SwPosition &rTmpPos, SwFltStackEntry &rEntry)
Definition: fltshell.cxx:490
virtual ~SwFltControlStack()
Definition: fltshell.cxx:171
Stores RDF statements on a paragraph (key-value pairs where the subject is the paragraph).
Definition: fltshell.hxx:244
tools::Long GetHandle() const
Definition: fltshell.cxx:985
tools::Long m_nHandle
Definition: fltshell.hxx:245
void SetHandle(tools::Long nHandle)
Definition: fltshell.cxx:980
virtual bool operator==(const SfxPoolItem &) const override
Definition: fltshell.cxx:965
virtual SwFltRDFMark * Clone(SfxItemPool *=nullptr) const override
Definition: fltshell.cxx:975
void SetAttributes(std::vector< std::pair< OUString, OUString > > &&rAttributes)
Definition: fltshell.cxx:990
const std::vector< std::pair< OUString, OUString > > & GetAttributes() const
Definition: fltshell.cxx:995
std::vector< std::pair< OUString, OUString > > m_aAttributes
Definition: fltshell.hxx:246
virtual SwFltRedline * Clone(SfxItemPool *=nullptr) const override
Definition: fltshell.cxx:920
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: fltshell.cxx:914
RedlineType m_eType
Definition: fltshell.hxx:197
std::size_t m_nAutorNo
Definition: fltshell.hxx:198
SwFltRedline(RedlineType eType_, std::size_t nAutorNo_, const DateTime &rStamp_)
Definition: fltshell.hxx:200
DateTime m_aStamp
Definition: fltshell.hxx:196
SW_DLLPUBLIC ~SwFltStackEntry()
Definition: fltshell.cxx:90
bool m_isAnnotationOnEnd
annotation already moved onto its end pos.
Definition: fltshell.hxx:95
SW_DLLPUBLIC bool MakeRegion(SwDoc &rDoc, SwPaM &rRegion, RegionMode eCheck) const
Definition: fltshell.cxx:161
SwFltPosition m_aMkPos
Definition: fltshell.hxx:87
SW_DLLPUBLIC void SetEndPos(const SwPosition &rEndPos)
Definition: fltshell.cxx:95
SwFltStackEntry(SwFltStackEntry const &)=delete
SwFltPosition m_aPtPos
Definition: fltshell.hxx:88
bool m_bConsumedByField
Definition: fltshell.hxx:94
std::unique_ptr< SfxPoolItem > m_pAttr
Definition: fltshell.hxx:90
std::shared_ptr< SwTOXBase > m_xTOXBase
Definition: fltshell.hxx:262
SwFltTOX(std::shared_ptr< SwTOXBase > xBase)
Definition: fltshell.cxx:1001
bool HadBreakItem() const
Definition: fltshell.hxx:273
virtual SwFltTOX * Clone(SfxItemPool *=nullptr) const override
Definition: fltshell.cxx:1013
bool HadPageDescItem() const
Definition: fltshell.hxx:274
virtual bool operator==(const SfxPoolItem &) const override
Definition: fltshell.cxx:1007
FlyAnchors.
Definition: fmtanchr.hxx:37
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1593
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
const SwField * GetField() const
Definition: fmtfld.hxx:131
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
Style of a layout element.
Definition: frmfmt.hxx:72
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2744
Marks a node in the document model.
Definition: ndindex.hxx:31
const SwNodes & GetNodes() const
Definition: ndindex.hxx:119
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:111
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
SwNodeOffset GetIndex() const
Definition: node.hxx:312
const SwStartNode * FindTableBoxStartNode() const
Definition: node.hxx:218
bool IsTextNode() const
Definition: node.hxx:190
SwContentNode * GetContentNode()
Definition: node.hxx:666
static SwContentNode * GoPrevious(SwNodeIndex *)
Definition: nodes.cxx:1333
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1299
SwNodeOffset Count() const
Definition: ndarr.hxx:142
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
SwNode & GetPointNode() const
Definition: pam.hxx:275
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:643
void Exchange()
Definition: pam.hxx:242
std::pair< const SwPosition *, const SwPosition * > StartEnd() const
Because sometimes the cost of the operator<= can add up.
Definition: pam.hxx:269
const SwPosition * End() const
Definition: pam.hxx:263
void DeleteMark()
Definition: pam.hxx:232
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SwPosition * Start() const
Definition: pam.hxx:258
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:251
const OUString & GetName() const
Definition: docufld.hxx:504
static void addTextNodeStatement(const OUString &rType, const OUString &rPath, SwTextNode &rTextNode, const OUString &rKey, const OUString &rValue)
Add an (rTextNode, key, value) statement in the graph of type rType – or if it does not exist,...
Definition: rdfhelper.cxx:208
virtual void SetSubType(sal_uInt16 nType) override
Definition: expfld.cxx:882
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:199
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, ::sw::GetTextAttrMode const eMode=::sw::GetTextAttrMode::Expand) const
Definition: ndtxt.cxx:1849
virtual OUString GetName() const override
SwDoc & m_rDoc
Definition: docbm.cxx:1228
const sal_Int32 m_nHandle
static bool IterateNumrulePiece(const SwPosition &rEnd, SwNodeIndex &rTmpStart, SwNodeIndex &rTmpEnd)
Definition: fltshell.cxx:473
static OUString lcl_getTypePath(OUString &rType)
Definition: fltshell.cxx:67
static SwContentNode * GetContentNode(SwDoc &rDoc, SwPosition &rPos, bool bNext)
Definition: fltshell.cxx:54
static bool MakeBookRegionOrPoint(const SwFltStackEntry &rEntry, SwDoc &rDoc, SwPaM &rRegion)
Definition: fltshell.cxx:448
static bool MakePoint(const SwFltStackEntry &rEntry, SwDoc &rDoc, SwPaM &rRegion)
Definition: fltshell.cxx:426
void UpdatePageDescs(SwDoc &rDoc, size_t nInPageDescOffset)
Definition: fltshell.cxx:1020
constexpr TypedWhichId< SwFltAnchor > RES_FLTR_ANCHOR(191)
constexpr TypedWhichId< CntUInt16Item > RES_FLTR_ANNOTATIONMARK(195)
constexpr TypedWhichId< SwFltRedline > RES_FLTR_REDLINE(194)
bool isPARATR_LIST(const sal_uInt16 nWhich)
Definition: hintids.hxx:488
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
constexpr TypedWhichId< SfxStringItem > RES_FLTR_BOOKMARK(RES_FLTRATTR_BEGIN)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SwFltTOX > RES_FLTR_TOX(193)
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
constexpr TypedWhichId< SwFltRDFMark > RES_FLTR_RDFMARK(196)
constexpr TypedWhichId< SfxStringItem > RES_FLTR_NUMRULE(192)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(168)
Mode eMode
sal_Int64 n
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
int i
const SwExtendedSubType SUB_INVISIBLE
Invisible.
Definition: fldbas.hxx:217
const SwGetSetExpType GSE_STRING
String.
Definition: fldbas.hxx:207
bool IsFieldmarkOverlap(SwPaM const &rPaM)
check if rPaM is valid range of new fieldmark
long Long
const char GetValue[]
bool CheckNodesRange(const SwNode &rStt, const SwNode &rEnd, bool bChkSection)
Check if the given range is inside one of the defined top-level sections.
Definition: pam.cxx:349
sal_Int32 nHandle
sal_uIntPtr sal_uLong
sal_Int32 m_nContent
Definition: fltshell.hxx:51
void FromSwPosition(const SwPosition &rPos)
Definition: fltshell.hxx:72
SwNodeIndex m_nNode
Definition: fltshell.hxx:50
void SetPos(SwNodeIndex const &rNode, sal_uInt16 nIdx)
Definition: fltshell.hxx:58
Marks a position in the document model.
Definition: pam.hxx:38
SwNode & GetNode() const
Definition: pam.hxx:81
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:267
SwNodeOffset GetNodeIndex() const
Definition: pam.hxx:78
const SwNodes & GetNodes() const
Definition: pam.hxx:79
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
void AdjustContent(sal_Int32 nDelta)
Adjust content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:262
DrawFrameFormatHintId m_eId
Definition: frmfmt.hxx:310