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