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