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