LibreOffice Module sw (master)  1
unocrsrhelper.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 <unocrsrhelper.hxx>
21 
22 #include <map>
23 #include <algorithm>
24 #include <memory>
25 
26 #include <com/sun/star/beans/NamedValue.hpp>
27 #include <com/sun/star/beans/PropertyAttribute.hpp>
28 #include <com/sun/star/beans/PropertyState.hpp>
29 #include <com/sun/star/embed/ElementModes.hpp>
30 #include <com/sun/star/embed/XStorage.hpp>
31 #include <com/sun/star/io/IOException.hpp>
32 #include <com/sun/star/text/XTextSection.hpp>
33 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
34 
35 #include <svx/unoshape.hxx>
36 
37 #include <cmdid.h>
38 #include <hintids.hxx>
39 #include <unotextrange.hxx>
40 #include <unodraw.hxx>
41 #include <unofootnote.hxx>
42 #include <unobookmark.hxx>
43 #include <unomap.hxx>
44 #include <unorefmark.hxx>
45 #include <unoidx.hxx>
46 #include <unofield.hxx>
47 #include <unotbl.hxx>
48 #include <unosett.hxx>
49 #include <unoframe.hxx>
50 #include <unocrsr.hxx>
51 #include <doc.hxx>
52 #include <IDocumentUndoRedo.hxx>
55 #include <fmtftn.hxx>
56 #include <charfmt.hxx>
57 #include <pagedesc.hxx>
58 #include <docstyle.hxx>
59 #include <ndtxt.hxx>
60 #include <docsh.hxx>
61 #include <section.hxx>
62 #include <shellio.hxx>
63 #include <edimp.hxx>
64 #include <swundo.hxx>
65 #include <cntfrm.hxx>
66 #include <pagefrm.hxx>
67 #include <svl/eitem.hxx>
68 #include <svl/lngmisc.hxx>
69 #include <docary.hxx>
70 #include <swtable.hxx>
71 #include <tox.hxx>
72 #include <doctxm.hxx>
73 #include <fchrfmt.hxx>
74 #include <editeng/editids.hrc>
75 #include <editeng/flstitem.hxx>
76 #include <editeng/prntitem.hxx>
77 #include <vcl/metric.hxx>
78 #include <svtools/ctrltool.hxx>
79 #include <sfx2/docfilt.hxx>
80 #include <sfx2/docfile.hxx>
81 #include <sfx2/fcontnr.hxx>
82 #include <svl/stritem.hxx>
83 #include <SwStyleNameMapper.hxx>
84 #include <redline.hxx>
85 #include <numrule.hxx>
89 #include <SwNodeNum.hxx>
90 #include <fmtmeta.hxx>
91 #include <txtfld.hxx>
92 #include <unoparagraph.hxx>
93 #include <poolfmt.hxx>
94 #include <paratr.hxx>
95 #include <sal/log.hxx>
96 
97 using namespace ::com::sun::star;
98 using namespace ::com::sun::star::uno;
99 using namespace ::com::sun::star::beans;
100 using namespace ::com::sun::star::text;
101 using namespace ::com::sun::star::table;
102 using namespace ::com::sun::star::container;
103 using namespace ::com::sun::star::lang;
104 
106 {
107 
108 static SwPaM* lcl_createPamCopy(const SwPaM& rPam)
109 {
110  SwPaM *const pRet = new SwPaM(*rPam.GetPoint());
111  ::sw::DeepCopyPaM(rPam, *pRet);
112  return pRet;
113 }
114 
115 void GetSelectableFromAny(uno::Reference<uno::XInterface> const& xIfc,
116  SwDoc & rTargetDoc,
117  SwPaM *& o_rpPaM, std::pair<OUString, FlyCntType> & o_rFrame,
118  OUString & o_rTableName, SwUnoTableCursor const*& o_rpTableCursor,
119  ::sw::mark::IMark const*& o_rpMark,
120  std::vector<SdrObject *> & o_rSdrObjects)
121 {
122  uno::Reference<drawing::XShapes> const xShapes(xIfc, UNO_QUERY);
123  if (xShapes.is())
124  {
125  sal_Int32 nShapes(xShapes->getCount());
126  for (sal_Int32 i = 0; i < nShapes; ++i)
127  {
128  uno::Reference<lang::XUnoTunnel> xShape;
129  xShapes->getByIndex(i) >>= xShape;
130  if (xShape.is())
131  {
132  SvxShape *const pSvxShape(
133  comphelper::getFromUnoTunnel<SvxShape>(xShape));
134  if (pSvxShape)
135  {
136  SdrObject *const pSdrObject = pSvxShape->GetSdrObject();
137  if (pSdrObject)
138  { // hmm... needs view to verify it's in right doc...
139  o_rSdrObjects.push_back(pSdrObject);
140  }
141  }
142  }
143  }
144  return;
145  }
146 
147  uno::Reference<lang::XUnoTunnel> const xTunnel(xIfc, UNO_QUERY);
148  if (!xTunnel.is()) // everything below needs tunnel
149  {
150  return;
151  }
152 
153  SwXShape *const pShape(comphelper::getFromUnoTunnel<SwXShape>(xTunnel));
154  if (pShape)
155  {
156  uno::Reference<uno::XAggregation> const xAgg(
157  pShape->GetAggregationInterface());
158  if (xAgg.is())
159  {
160  SvxShape *const pSvxShape(
161  comphelper::getFromUnoTunnel<SvxShape>(xTunnel));
162  if (pSvxShape)
163  {
164  SdrObject *const pSdrObject = pSvxShape->GetSdrObject();
165  if (pSdrObject)
166  { // hmm... needs view to verify it's in right doc...
167  o_rSdrObjects.push_back(pSdrObject);
168  }
169  }
170  }
171  return;
172  }
173 
174  OTextCursorHelper *const pCursor(
175  comphelper::getFromUnoTunnel<OTextCursorHelper>(xTunnel));
176  if (pCursor)
177  {
178  if (pCursor->GetDoc() == &rTargetDoc)
179  {
180  o_rpPaM = lcl_createPamCopy(*pCursor->GetPaM());
181  }
182  return;
183  }
184 
185  SwXTextRanges* const pRanges(
186  comphelper::getFromUnoTunnel<SwXTextRanges>(xTunnel));
187  if (pRanges)
188  {
189  SwUnoCursor const* pUnoCursor = pRanges->GetCursor();
190  if (pUnoCursor && &pUnoCursor->GetDoc() == &rTargetDoc)
191  {
192  o_rpPaM = lcl_createPamCopy(*pUnoCursor);
193  }
194  return;
195  }
196 
197  // check these before Range to prevent misinterpretation of text frames
198  // and cells also implement XTextRange
199  SwXFrame *const pFrame(
200  comphelper::getFromUnoTunnel<SwXFrame>(xTunnel));
201  if (pFrame)
202  {
203  const SwFrameFormat *const pFrameFormat(pFrame->GetFrameFormat());
204  if (pFrameFormat && pFrameFormat->GetDoc() == &rTargetDoc)
205  {
206  o_rFrame = std::make_pair(pFrameFormat->GetName(), pFrame->GetFlyCntType());
207  }
208  return;
209  }
210 
211  SwXTextTable *const pTextTable(
212  comphelper::getFromUnoTunnel<SwXTextTable>(xTunnel));
213  if (pTextTable)
214  {
215  SwFrameFormat *const pFrameFormat(pTextTable->GetFrameFormat());
216  if (pFrameFormat && pFrameFormat->GetDoc() == &rTargetDoc)
217  {
218  o_rTableName = pFrameFormat->GetName();
219  }
220  return;
221  }
222 
223  SwXCell *const pCell(
224  comphelper::getFromUnoTunnel<SwXCell>(xTunnel));
225  if (pCell)
226  {
227  SwFrameFormat *const pFrameFormat(pCell->GetFrameFormat());
228  if (pFrameFormat && pFrameFormat->GetDoc() == &rTargetDoc)
229  {
230  SwTableBox * pBox = pCell->GetTableBox();
231  SwTable *const pTable = SwTable::FindTable(pFrameFormat);
232  // ??? what's the benefit of setting pBox in this convoluted way?
233  pBox = pCell->FindBox(pTable, pBox);
234  if (pBox)
235  {
236  SwPosition const aPos(*pBox->GetSttNd());
237  SwPaM aPam(aPos);
238  aPam.Move(fnMoveForward, GoInNode);
239  o_rpPaM = lcl_createPamCopy(aPam);
240  }
241  }
242  return;
243  }
244 
245  uno::Reference<text::XTextRange> const xTextRange(xTunnel, UNO_QUERY);
246  if (xTextRange.is())
247  {
248  SwUnoInternalPaM aPam(rTargetDoc);
249  if (::sw::XTextRangeToSwPaM(aPam, xTextRange))
250  {
251  o_rpPaM = lcl_createPamCopy(aPam);
252  }
253  return;
254  }
255 
256  SwXCellRange *const pCellRange(
257  comphelper::getFromUnoTunnel<SwXCellRange>(xTunnel));
258  if (pCellRange)
259  {
260  SwUnoCursor const*const pUnoCursor(pCellRange->GetTableCursor());
261  if (pUnoCursor && &pUnoCursor->GetDoc() == &rTargetDoc)
262  {
263  // probably can't copy it to o_rpPaM for this since it's
264  // a SwTableCursor
265  o_rpTableCursor = dynamic_cast<SwUnoTableCursor const*>(pUnoCursor);
266  }
267  return;
268  }
269 
270  ::sw::mark::IMark const*const pMark(
271  SwXBookmark::GetBookmarkInDoc(& rTargetDoc, xTunnel));
272  if (pMark)
273  {
274  o_rpMark = pMark;
275  return;
276  }
277 }
278 
279 uno::Reference<text::XTextContent>
280 GetNestedTextContent(SwTextNode const & rTextNode, sal_Int32 const nIndex,
281  bool const bParent)
282 {
283  // these should be unambiguous because of the dummy character
284  SwTextNode::GetTextAttrMode const eMode( bParent
286  SwTextAttr *const pMetaTextAttr =
287  rTextNode.GetTextAttrAt(nIndex, RES_TXTATR_META, eMode);
288  SwTextAttr *const pMetaFieldTextAttr =
289  rTextNode.GetTextAttrAt(nIndex, RES_TXTATR_METAFIELD, eMode);
290  // which is innermost?
291  SwTextAttr *const pTextAttr = pMetaTextAttr
292  ? (pMetaFieldTextAttr
293  ? ((pMetaFieldTextAttr->GetStart() >
294  pMetaTextAttr->GetStart())
295  ? pMetaFieldTextAttr : pMetaTextAttr)
296  : pMetaTextAttr)
297  : pMetaFieldTextAttr;
298  uno::Reference<XTextContent> xRet;
299  if (pTextAttr)
300  {
301  ::sw::Meta *const pMeta(
302  static_cast<SwFormatMeta &>(pTextAttr->GetAttr()).GetMeta());
303  assert(pMeta);
304  xRet.set(pMeta->MakeUnoObject(), uno::UNO_QUERY);
305  }
306  return xRet;
307 }
308 
310 {
311  SwFormatAutoFormat const*const pFormat(
313  if (!pFormat)
314  {
315  return uno::Any();
316  }
317  const auto pSet(pFormat->GetStyleHandle());
318  if (!pSet)
319  return {};
321  SfxItemPropertyMap const& rMap(rPropSet.getPropertyMap());
322  std::vector<beans::NamedValue> props;
323  // have to iterate the map, not the item set?
324  for (auto const pEntry : rMap.getPropertyEntries())
325  {
326  if (rPropSet.getPropertyState(*pEntry, *pSet) == PropertyState_DIRECT_VALUE)
327  {
328  Any value;
329  rPropSet.getPropertyValue(*pEntry, *pSet, value);
330  props.emplace_back(pEntry->aName, value);
331  }
332  }
333  return uno::makeAny(comphelper::containerToSequence(props));
334 }
335 
336 // Read the special properties of the cursor
338  , SwPaM& rPam
339  , Any *pAny
340  , PropertyState& eState
341  , const SwTextNode* pNode )
342 {
343  PropertyState eNewState = PropertyState_DIRECT_VALUE;
344  bool bDone = true;
345  switch(rEntry.nWID)
346  {
348  if (pAny)
349  {
350  const SwTextNode * pTmpNode = pNode;
351 
352  if (!pTmpNode)
353  pTmpNode = rPam.GetNode().GetTextNode();
354 
355  bool bRet = false;
356 
357  if ( pTmpNode &&
358  pTmpNode->GetNum() &&
359  pTmpNode->GetNum()->IsContinueingPreviousSubTree() )
360  {
361  bRet = true;
362  }
363 
364  *pAny <<= bRet;
365  }
366  break;
368  if (pAny)
369  {
370  const SwTextNode * pTmpNode = pNode;
371 
372  if (!pTmpNode)
373  pTmpNode = rPam.GetNode().GetTextNode();
374 
375  OUString sRet;
376  if ( pTmpNode && pTmpNode->GetNum() )
377  {
378  sRet = pTmpNode->GetNumString();
379  }
380 
381  *pAny <<= sRet;
382  }
383  break;
385  if (pAny)
386  {
387  const SwTextNode * pTmpNode = pNode;
388 
389  if (!pTmpNode)
390  pTmpNode = rPam.GetNode().GetTextNode();
391 
392  sal_Int16 nRet = -1;
393  if ( pTmpNode )
394  nRet = sal::static_int_cast< sal_Int16 >( pTmpNode->GetAttrOutlineLevel() );
395 
396  *pAny <<= nRet;
397  }
398  break;
400  case FN_UNO_PARA_STYLE :
401  {
402  SwFormatColl* pFormat = nullptr;
403  if(pNode)
404  pFormat = FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID
405  ? pNode->GetFormatColl() : &pNode->GetAnyFormatColl();
406  else
407  {
410  }
411  if(pFormat)
412  {
413  if( pAny )
414  {
415  OUString sVal;
417  *pAny <<= sVal;
418  }
419  }
420  else
421  eNewState = PropertyState_AMBIGUOUS_VALUE;
422  }
423  break;
424  case FN_UNO_PAGE_STYLE :
425  {
426  OUString sVal;
427  GetCurPageStyle(rPam, sVal);
428  if( pAny )
429  *pAny <<= sVal;
430  if(sVal.isEmpty())
431  eNewState = PropertyState_AMBIGUOUS_VALUE;
432  }
433  break;
435  if( pAny )
436  {
437  sal_Int16 nValue = IsNodeNumStart(rPam, eNewState);
438  *pAny <<= nValue;
439  }
440  break;
441  case FN_UNO_NUM_LEVEL :
442  case FN_UNO_IS_NUMBER :
443  // #i91601#
444  case FN_UNO_LIST_ID:
445  case FN_NUMBER_NEWSTART:
447  {
448  if (!pAny)
449  {
450  break;
451  }
452  // a multi selection is not considered
453  const SwTextNode* pTextNd = rPam.GetNode().GetTextNode();
454  if ( pTextNd && pTextNd->IsInList() )
455  {
456  switch (rEntry.nWID)
457  {
458  case FN_UNO_NUM_LEVEL:
459  {
460  *pAny <<= static_cast<sal_Int16>(pTextNd->GetActualListLevel());
461  break;
462  }
463  case FN_UNO_IS_NUMBER:
464  {
465  *pAny <<= pTextNd->IsCountedInList();
466  break;
467  }
468  // #i91601#
469  case FN_UNO_LIST_ID:
470  {
471  *pAny <<= pTextNd->GetListId();
472  break;
473  }
474  case FN_NUMBER_NEWSTART:
475  {
476  *pAny <<= pTextNd->IsListRestart();
477  break;
478  }
480  {
481  *pAny = GetParaListAutoFormat(*pTextNd);
482  break;
483  }
484  default:
485  assert(false);
486  }
487  }
488  else
489  {
490  eNewState = PropertyState_DEFAULT_VALUE;
491 
492  // #i30838# set default values for default properties
493  switch (rEntry.nWID)
494  {
495  case FN_UNO_NUM_LEVEL:
496  {
497  *pAny <<= static_cast<sal_Int16>( 0 );
498  break;
499  }
500  case FN_UNO_IS_NUMBER:
501  {
502  *pAny <<= false;
503  break;
504  }
505  // #i91601#
506  case FN_UNO_LIST_ID:
507  {
508  *pAny <<= OUString();
509  break;
510  }
511  case FN_NUMBER_NEWSTART:
512  {
513  *pAny <<= false;
514  break;
515  }
517  {
518  break; // void
519  }
520  default:
521  assert(false);
522  }
523  }
524  //PROPERTY_MAYBEVOID!
525  }
526  break;
527  case FN_UNO_NUM_RULES :
528  if( pAny )
529  getNumberingProperty(rPam, eNewState, pAny);
530  else
531  {
532  if( !SwDoc::GetNumRuleAtPos( *rPam.GetPoint() ) )
533  eNewState = PropertyState_DEFAULT_VALUE;
534  }
535  break;
537  {
538  std::vector<SwTextAttr *> marks;
539  if (rPam.GetNode().IsTextNode())
540  {
541  marks = rPam.GetNode().GetTextNode()->GetTextAttrsAt(
543  }
544  if (!marks.empty())
545  {
546  if( pAny )
547  { // hmm... can only return 1 here
548  SwTOXMark & rMark =
549  static_cast<SwTOXMark &>((*marks.begin())->GetAttr());
550  const uno::Reference< text::XDocumentIndexMark > xRef =
552  rPam.GetDoc(), &rMark);
553  (*pAny) <<= xRef;
554  }
555  }
556  else
557  //also here - indistinguishable
558  eNewState = PropertyState_DEFAULT_VALUE;
559  }
560  break;
562  {
563  SwTOXBase* pBase = SwDoc::GetCurTOX(
564  *rPam.Start() );
565  if( pBase )
566  {
567  if( pAny )
568  {
569  const uno::Reference< text::XDocumentIndex > xRef =
571  static_cast<SwTOXBaseSection *>(pBase));
572  (*pAny) <<= xRef;
573  }
574  }
575  else
576  eNewState = PropertyState_DEFAULT_VALUE;
577  }
578  break;
579  case FN_UNO_TEXT_FIELD:
580  {
581  const SwPosition *pPos = rPam.Start();
582  const SwTextNode *pTextNd =
583  rPam.GetDoc().GetNodes()[pPos->nNode.GetIndex()]->GetTextNode();
584  const SwTextAttr* pTextAttr = pTextNd
585  ? pTextNd->GetFieldTextAttrAt( pPos->nContent.GetIndex(), true )
586  : nullptr;
587  if ( pTextAttr != nullptr )
588  {
589  if( pAny )
590  {
591  uno::Reference<text::XTextField> const xField(
593  &pTextAttr->GetFormatField()));
594  *pAny <<= xField;
595  }
596  }
597  else
598  eNewState = PropertyState_DEFAULT_VALUE;
599  }
600  break;
601  case FN_UNO_TEXT_TABLE:
602  case FN_UNO_CELL:
603  {
604  SwStartNode* pSttNode = rPam.GetNode().StartOfSectionNode();
605  SwStartNodeType eType = pSttNode->GetStartNodeType();
606  if(SwTableBoxStartNode == eType)
607  {
608  if( pAny )
609  {
610  const SwTableNode* pTableNode = pSttNode->FindTableNode();
611  SwFrameFormat* pTableFormat = pTableNode->GetTable().GetFrameFormat();
612  //SwTable& rTable = static_cast<SwTableNode*>(pSttNode)->GetTable();
613  if(FN_UNO_TEXT_TABLE == rEntry.nWID)
614  {
615  uno::Reference< XTextTable > xTable = SwXTextTables::GetObject(*pTableFormat);
616  *pAny <<= xTable;
617  }
618  else
619  {
620  SwTableBox* pBox = pSttNode->GetTableBox();
621  uno::Reference< XCell > xCell = SwXCell::CreateXCell(pTableFormat, pBox);
622  *pAny <<= xCell;
623  }
624  }
625  }
626  else
627  eNewState = PropertyState_DEFAULT_VALUE;
628  }
629  break;
630  case FN_UNO_TEXT_FRAME:
631  {
632  SwStartNode* pSttNode = rPam.GetNode().StartOfSectionNode();
633  SwStartNodeType eType = pSttNode->GetStartNodeType();
634 
635  SwFrameFormat* pFormat;
636  if(eType == SwFlyStartNode && nullptr != (pFormat = pSttNode->GetFlyFormat()))
637  {
638  // Create a wrapper only for text frames, not for graphic or OLE nodes.
639  if (pAny && !rPam.GetNode().IsNoTextNode())
640  {
641  uno::Reference<XTextFrame> const xFrame(
642  SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat));
643  (*pAny) <<= xFrame;
644  }
645  }
646  else
647  eNewState = PropertyState_DEFAULT_VALUE;
648  }
649  break;
650  case FN_UNO_TEXT_SECTION:
651  {
652  SwSection* pSect = SwDoc::GetCurrSection(*rPam.GetPoint());
653  if(pSect)
654  {
655  if( pAny )
656  {
657  uno::Reference< XTextSection > xSect = SwXTextSections::GetObject( *pSect->GetFormat() );
658  *pAny <<= xSect;
659  }
660  }
661  else
662  eNewState = PropertyState_DEFAULT_VALUE;
663  }
664  break;
666  {
667  SwTextNode* pTextNode = rPam.GetPoint()->nNode.GetNode().GetTextNode();
668  if (pTextNode)
669  {
670  if (pAny)
671  {
672  uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
673  *pAny <<= xParagraph;
674  }
675  }
676  else
677  eNewState = PropertyState_DEFAULT_VALUE;
678  }
679  break;
680  case FN_UNO_ENDNOTE:
681  case FN_UNO_FOOTNOTE:
682  {
683  SwTextAttr *const pTextAttr = rPam.GetNode().IsTextNode() ?
685  rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN) : nullptr;
686  if(pTextAttr)
687  {
688  const SwFormatFootnote& rFootnote = pTextAttr->GetFootnote();
689  if(rFootnote.IsEndNote() == (FN_UNO_ENDNOTE == rEntry.nWID))
690  {
691  if( pAny )
692  {
693  const uno::Reference< text::XFootnote > xFootnote =
695  &const_cast<SwFormatFootnote&>(rFootnote));
696  *pAny <<= xFootnote;
697  }
698  }
699  else
700  eNewState = PropertyState_DEFAULT_VALUE;
701  }
702  else
703  eNewState = PropertyState_DEFAULT_VALUE;
704  }
705  break;
707  {
708  std::vector<SwTextAttr *> marks;
709  if (rPam.GetNode().IsTextNode())
710  {
711  marks = rPam.GetNode().GetTextNode()->GetTextAttrsAt(
713  }
714  if (!marks.empty())
715  {
716  if( pAny )
717  { // hmm... can only return 1 here
718  const SwFormatRefMark& rRef = (*marks.begin())->GetRefMark();
719  uno::Reference<XTextContent> const xRef =
721  const_cast<SwFormatRefMark*>(&rRef));
722  *pAny <<= xRef;
723  }
724  }
725  else
726  eNewState = PropertyState_DEFAULT_VALUE;
727  }
728  break;
730  {
731  uno::Reference<XTextContent> const xRet(rPam.GetNode().IsTextNode()
733  rPam.GetPoint()->nContent.GetIndex(), false)
734  : nullptr);
735  if (xRet.is())
736  {
737  if (pAny)
738  {
739  (*pAny) <<= xRet;
740  }
741  }
742  else
743  {
744  eNewState = PropertyState_DEFAULT_VALUE;
745  }
746  }
747  break;
749  {
750 
751  SwTextNode *const pTextNode = rPam.GetNode().GetTextNode();
752  if (&rPam.GetNode() == &rPam.GetNode(false)
753  && pTextNode && pTextNode->GetpSwpHints())
754  {
755  sal_Int32 nPaMStart = rPam.Start()->nContent.GetIndex();
756  sal_Int32 nPaMEnd = rPam.End()->nContent.GetIndex();
757  Sequence< OUString> aCharStyles;
758  SwpHints* pHints = pTextNode->GetpSwpHints();
759  for( size_t nAttr = 0; nAttr < pHints->Count(); ++nAttr )
760  {
761  SwTextAttr* pAttr = pHints->Get( nAttr );
762  if(pAttr->Which() != RES_TXTATR_CHARFMT)
763  continue;
764  const sal_Int32 nAttrStart = pAttr->GetStart();
765  const sal_Int32 nAttrEnd = *pAttr->GetEnd();
766  //check if the attribute touches the selection
767  if( ( nAttrEnd > nPaMStart && nAttrStart < nPaMEnd ) ||
768  ( !nAttrStart && !nAttrEnd && !nPaMStart && !nPaMEnd ) )
769  {
770  //check for overlapping
771  if(nAttrStart > nPaMStart ||
772  nAttrEnd < nPaMEnd)
773  {
774  aCharStyles.realloc(0);
775  break;
776  }
777  else
778  {
779  //now the attribute should start before or at the selection
780  //and it should end at the end of the selection or behind
781  OSL_ENSURE(nAttrStart <= nPaMStart && nAttrEnd >=nPaMEnd,
782  "attribute overlaps or is outside");
783  //now the name of the style has to be added to the sequence
784  aCharStyles.realloc(aCharStyles.getLength() + 1);
785  OSL_ENSURE(pAttr->GetCharFormat().GetCharFormat(), "no character format set");
786  aCharStyles.getArray()[aCharStyles.getLength() - 1] =
789  }
790  }
791 
792  }
793  eNewState =
794  aCharStyles.hasElements() ?
795  PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
796  if(pAny)
797  (*pAny) <<= aCharStyles;
798  }
799  else
800  eNewState = PropertyState_DEFAULT_VALUE;
801  }
802  break;
803  case RES_TXTATR_CHARFMT:
804  // no break here!
805  default: bDone = false;
806  }
807  if( bDone )
808  eState = eNewState;
809  return bDone;
810 };
811 
812 sal_Int16 IsNodeNumStart(SwPaM const & rPam, PropertyState& eState)
813 {
814  const SwTextNode* pTextNd = rPam.GetNode().GetTextNode();
815  // correction: check, if restart value is set at the text node and use
816  // new method <SwTextNode::GetAttrListRestartValue()> to retrieve the value
817  if ( pTextNd && pTextNd->GetNumRule() && pTextNd->IsListRestart() &&
818  pTextNd->HasAttrListRestartValue() )
819  {
820  eState = PropertyState_DIRECT_VALUE;
821  sal_Int16 nTmp = sal::static_int_cast< sal_Int16 >(pTextNd->GetAttrListRestartValue());
822  return nTmp;
823  }
824  eState = PropertyState_DEFAULT_VALUE;
825  return -1;
826 }
827 
828 void setNumberingProperty(const Any& rValue, SwPaM& rPam)
829 {
830  uno::Reference<XIndexReplace> xIndexReplace;
831  if(rValue >>= xIndexReplace)
832  {
833  auto pSwNum = comphelper::getFromUnoTunnel<SwXNumberingRules>(xIndexReplace);
834  if(pSwNum)
835  {
836  SwDoc& rDoc = rPam.GetDoc();
837  if(pSwNum->GetNumRule())
838  {
839  SwNumRule aRule(*pSwNum->GetNumRule());
840  const OUString* pNewCharStyles = pSwNum->GetNewCharStyleNames();
841  const OUString* pBulletFontNames = pSwNum->GetBulletFontNames();
842  for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
843  {
844  SwNumFormat aFormat(aRule.Get( i ));
845  if (!pNewCharStyles[i].isEmpty() &&
846  !SwXNumberingRules::isInvalidStyle(pNewCharStyles[i]) &&
847  (!aFormat.GetCharFormat() || pNewCharStyles[i] != aFormat.GetCharFormat()->GetName()))
848  {
849  if (pNewCharStyles[i].isEmpty())
850  {
851  // FIXME
852  // Is something missing/wrong here?
853  // if condition is always false due to outer check!
854  aFormat.SetCharFormat(nullptr);
855  }
856  else
857  {
858 
859  // get CharStyle and set the rule
860  const size_t nChCount = rDoc.GetCharFormats()->size();
861  SwCharFormat* pCharFormat = nullptr;
862  for(size_t nCharFormat = 0; nCharFormat < nChCount; ++nCharFormat)
863  {
864  SwCharFormat& rChFormat = *((*(rDoc.GetCharFormats()))[nCharFormat]);
865  if(rChFormat.GetName() == pNewCharStyles[i])
866  {
867  pCharFormat = &rChFormat;
868  break;
869  }
870  }
871 
872  if(!pCharFormat)
873  {
875  SfxStyleSheetBase* pBase;
876  pBase = pPool->Find(pNewCharStyles[i], SfxStyleFamily::Char);
877  // shall it really be created?
878  if(!pBase)
879  pBase = &pPool->Make(pNewCharStyles[i], SfxStyleFamily::Page);
880  pCharFormat = static_cast<SwDocStyleSheet*>(pBase)->GetCharFormat();
881  }
882  if(pCharFormat)
883  aFormat.SetCharFormat(pCharFormat);
884  }
885  }
886  //Now again for fonts
887  if(
888  !pBulletFontNames[i].isEmpty() &&
889  !SwXNumberingRules::isInvalidStyle(pBulletFontNames[i]) &&
890  (!aFormat.GetBulletFont() || aFormat.GetBulletFont()->GetFamilyName() != pBulletFontNames[i])
891  )
892  {
893  const SvxFontListItem* pFontListItem =
894  static_cast<const SvxFontListItem* >(rDoc.GetDocShell()
895  ->GetItem( SID_ATTR_CHAR_FONTLIST ));
896  const FontList* pList = pFontListItem->GetFontList();
897 
898  FontMetric aFontMetric = pList->Get(
899  pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
900  vcl::Font aFont(aFontMetric);
901  aFormat.SetBulletFont(&aFont);
902  }
903  aRule.Set( i, aFormat );
904  }
905  UnoActionContext aAction(&rDoc);
906 
907  if( rPam.GetNext() != &rPam ) // Multiple selection?
908  {
910  SwPamRanges aRangeArr( rPam );
911  SwPaM aPam( *rPam.GetPoint() );
912  for ( size_t n = 0; n < aRangeArr.Count(); ++n )
913  {
914  // no start of a new list
915  rDoc.SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
916  }
917  rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
918  }
919  else
920  {
921  // no start of a new list
922  rDoc.SetNumRule( rPam, aRule, false );
923  }
924 
925  }
926  else if(!pSwNum->GetCreatedNumRuleName().isEmpty())
927  {
928  UnoActionContext aAction( &rDoc );
929  SwNumRule* pRule = rDoc.FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
930  if ( !pRule )
931  throw RuntimeException();
932  // no start of a new list
933  rDoc.SetNumRule( rPam, *pRule, false );
934  }
935  else
936  {
937  // #i103817#
938  // outline numbering
939  UnoActionContext aAction(&rDoc);
940  SwNumRule* pRule = rDoc.GetOutlineNumRule();
941  if(!pRule)
942  throw RuntimeException();
943  rDoc.SetNumRule( rPam, *pRule, false );
944  }
945  }
946  }
947  else if ( rValue.getValueType() == cppu::UnoType<void>::get() )
948  {
949  rPam.GetDoc().DelNumRules(rPam);
950  }
951 }
952 
953 void getNumberingProperty(SwPaM& rPam, PropertyState& eState, Any * pAny )
954 {
955  const SwNumRule* pNumRule = SwDoc::GetNumRuleAtPos( *rPam.GetPoint() );
956  if(pNumRule)
957  {
958  uno::Reference< XIndexReplace > xNum = new SwXNumberingRules(*pNumRule);
959  if ( pAny )
960  *pAny <<= xNum;
961  eState = PropertyState_DIRECT_VALUE;
962  }
963  else
964  eState = PropertyState_DEFAULT_VALUE;
965 }
966 
967 void GetCurPageStyle(SwPaM const & rPaM, OUString &rString)
968 {
969  if (!rPaM.GetContentNode())
970  return; // TODO: is there an easy way to get it for tables/sections?
972  // Consider the position inside the content node, since the node may span over multiple pages
973  // with different page styles.
974  SwContentFrame* pFrame = rPaM.GetContentNode()->getLayoutFrame(pLayout, rPaM.GetPoint());
975  if(pFrame)
976  {
977  const SwPageFrame* pPage = pFrame->FindPageFrame();
978  if(pPage)
979  {
982  }
983  }
984 }
985 
986 // reset special properties of the cursor
988 {
989  SwDoc& rDoc = rPam.GetDoc();
990  switch(rEntry.nWID)
991  {
992  case FN_UNO_PARA_STYLE :
993  break;
994  case FN_UNO_PAGE_STYLE :
995  break;
997  {
998  UnoActionContext aAction(&rDoc);
999 
1000  if( rPam.GetNext() != &rPam ) // Multiple selection?
1001  {
1002  rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
1003  SwPamRanges aRangeArr( rPam );
1004  SwPaM aPam( *rPam.GetPoint() );
1005  for( size_t n = 0; n < aRangeArr.Count(); ++n )
1006  rDoc.SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
1007  rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
1008  }
1009  else
1010  rDoc.SetNodeNumStart( *rPam.GetPoint(), 0 );
1011  }
1012 
1013  break;
1014  case FN_UNO_NUM_LEVEL :
1015  break;
1016  case FN_UNO_NUM_RULES:
1017  break;
1019  {
1020  rDoc.ResetAttrs(rPam, true, { RES_TXTATR_CHARFMT });
1021  }
1022  break;
1023  }
1024 }
1025 
1026 void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL,
1027  const uno::Sequence< beans::PropertyValue >& rOptions)
1028 {
1029  std::unique_ptr<SfxMedium> pMed;
1030  SwDoc& rDoc = pUnoCursor->GetDoc();
1031  SwDocShell* pDocSh = rDoc.GetDocShell();
1032  utl::MediaDescriptor aMediaDescriptor( rOptions );
1033  OUString sFileName = rURL;
1034  OUString sFilterName, sFilterOptions, sPassword, sBaseURL;
1035  uno::Reference < io::XStream > xStream;
1036  uno::Reference < io::XInputStream > xInputStream;
1037 
1038  if( sFileName.isEmpty() )
1039  aMediaDescriptor[utl::MediaDescriptor::PROP_URL] >>= sFileName;
1040  if( sFileName.isEmpty() )
1041  aMediaDescriptor[utl::MediaDescriptor::PROP_FILENAME] >>= sFileName;
1042  aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM] >>= xInputStream;
1043  aMediaDescriptor[utl::MediaDescriptor::PROP_STREAM] >>= xStream;
1044  aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM] >>= xInputStream;
1045  aMediaDescriptor[utl::MediaDescriptor::PROP_FILTERNAME] >>= sFilterName;
1046  aMediaDescriptor[utl::MediaDescriptor::PROP_FILTEROPTIONS] >>= sFilterOptions;
1047  aMediaDescriptor[utl::MediaDescriptor::PROP_PASSWORD] >>= sPassword;
1048  aMediaDescriptor[utl::MediaDescriptor::PROP_DOCUMENTBASEURL ] >>= sBaseURL;
1049  if ( !xInputStream.is() && xStream.is() )
1050  xInputStream = xStream->getInputStream();
1051 
1052  if(!pDocSh || (sFileName.isEmpty() && !xInputStream.is()))
1053  return;
1054 
1055  SfxObjectFactory& rFact = pDocSh->GetFactory();
1056  std::shared_ptr<const SfxFilter> pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( sFilterName );
1057  uno::Reference < embed::XStorage > xReadStorage;
1058  if( xInputStream.is() )
1059  {
1060  uno::Sequence< uno::Any > aArgs{ uno::Any(xInputStream),
1061  uno::Any(embed::ElementModes::READ) };
1062  try
1063  {
1064  xReadStorage.set( ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ),
1065  uno::UNO_QUERY );
1066  }
1067  catch( const io::IOException&) {}
1068  }
1069  if ( !pFilter )
1070  {
1071  if( xInputStream.is() && !xReadStorage.is())
1072  {
1073  pMed.reset(new SfxMedium);
1074  pMed->setStreamToLoadFrom(xInputStream, true );
1075  }
1076  else
1077  pMed.reset(xReadStorage.is() ?
1078  new SfxMedium(xReadStorage, sBaseURL ) :
1079  new SfxMedium(sFileName, StreamMode::READ ));
1080  if( !sBaseURL.isEmpty() )
1081  pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
1082 
1083  SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
1084  ErrCode nErr = aMatcher.GuessFilter(*pMed, pFilter, SfxFilterFlags::NONE);
1085  if ( nErr || !pFilter)
1086  return;
1087  pMed->SetFilter( pFilter );
1088  }
1089  else
1090  {
1091  if( xInputStream.is() && !xReadStorage.is())
1092  {
1093  pMed.reset(new SfxMedium);
1094  pMed->setStreamToLoadFrom(xInputStream, true );
1095  pMed->SetFilter( pFilter );
1096  }
1097  else
1098  {
1099  if( xReadStorage.is() )
1100  {
1101  pMed.reset(new SfxMedium(xReadStorage, sBaseURL ));
1102  pMed->SetFilter( pFilter );
1103  }
1104  else
1105  pMed.reset(new SfxMedium(sFileName, StreamMode::READ, pFilter, nullptr));
1106  }
1107  if(!sFilterOptions.isEmpty())
1108  pMed->GetItemSet()->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sFilterOptions ) );
1109  if(!sBaseURL.isEmpty())
1110  pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
1111  }
1112 
1113  // this sourcecode is not responsible for the lifetime of the shell, SfxObjectShellLock should not be used
1114  SfxObjectShellRef aRef( pDocSh );
1115 
1116  pMed->Download(); // if necessary: start the download
1117  if( !(aRef.is() && 1 < aRef->GetRefCount()) ) // Ref still valid?
1118  return;
1119 
1120  SwReaderPtr pRdr;
1121  SfxItemSet* pSet = pMed->GetItemSet();
1122  pSet->Put(SfxBoolItem(FN_API_CALL, true));
1123  if(!sPassword.isEmpty())
1124  pSet->Put(SfxStringItem(SID_PASSWORD, sPassword));
1125  Reader *pRead = pDocSh->StartConvertFrom( *pMed, pRdr, nullptr, pUnoCursor);
1126  if( !pRead )
1127  return;
1128 
1129  UnoActionContext aContext(&rDoc);
1130 
1131  if(pUnoCursor->HasMark())
1132  rDoc.getIDocumentContentOperations().DeleteAndJoin(*pUnoCursor);
1133 
1134  SwNodeIndex aSave( pUnoCursor->GetPoint()->nNode, -1 );
1135  sal_Int32 nContent = pUnoCursor->GetPoint()->nContent.GetIndex();
1136 
1137  ErrCode nErrno = pRdr->Read( *pRead ); // and paste the document
1138 
1139  if(!nErrno)
1140  {
1141  ++aSave;
1142  pUnoCursor->SetMark();
1143  pUnoCursor->GetMark()->nNode = aSave;
1144 
1145  SwContentNode* pCntNode = aSave.GetNode().GetContentNode();
1146  if( !pCntNode )
1147  nContent = 0;
1148  pUnoCursor->GetMark()->nContent.Assign( pCntNode, nContent );
1149  }
1150 }
1151 
1152 // insert text and scan for CR characters in order to insert
1153 // paragraph breaks at those positions by calling SplitNode
1155  SwDoc &rDoc,
1156  const SwPaM &rNewCursor,
1157  const OUString &rText,
1158  const bool bForceExpandHints )
1159 {
1160  bool bOK = true;
1161 
1162  for (sal_Int32 i = 0; i < rText.getLength(); ++i)
1163  {
1164  sal_Unicode const ch(rText[i]);
1166  && ch != '\r' && ch != '\n' && ch != '\t')
1167  {
1168  SAL_WARN("sw.uno", "DocInsertStringSplitCR: refusing to insert control character " << int(ch));
1169  return false;
1170  }
1171  }
1172 
1173  const SwInsertFlags nInsertFlags =
1174  bForceExpandHints
1177 
1178  // grouping done in InsertString is intended for typing, not API calls
1179  ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
1180  SwTextNode* const pTextNd =
1181  rNewCursor.GetPoint()->nNode.GetNode().GetTextNode();
1182  if (!pTextNd)
1183  {
1184  SAL_INFO("sw.uno", "DocInsertStringSplitCR: need a text node");
1185  return false;
1186  }
1187  OUString aText;
1188  sal_Int32 nStartIdx = 0;
1189  const sal_Int32 nMaxLength = COMPLETE_STRING - pTextNd->GetText().getLength();
1190 
1191  sal_Int32 nIdx = rText.indexOf( '\r', nStartIdx );
1192  if( ( nIdx == -1 && nMaxLength < rText.getLength() ) ||
1193  ( nIdx != -1 && nMaxLength < nIdx ) )
1194  {
1195  nIdx = nMaxLength;
1196  }
1197  while (nIdx != -1 )
1198  {
1199  OSL_ENSURE( nIdx - nStartIdx >= 0, "index negative!" );
1200  aText = rText.copy( nStartIdx, nIdx - nStartIdx );
1201  if (!aText.isEmpty() &&
1202  !rDoc.getIDocumentContentOperations().InsertString( rNewCursor, aText, nInsertFlags ))
1203  {
1204  OSL_FAIL( "Doc->Insert(Str) failed." );
1205  bOK = false;
1206  }
1207  if (!rDoc.getIDocumentContentOperations().SplitNode( *rNewCursor.GetPoint(), false ) )
1208  {
1209  OSL_FAIL( "SplitNode failed" );
1210  bOK = false;
1211  }
1212  nStartIdx = nIdx + 1;
1213  nIdx = rText.indexOf( '\r', nStartIdx );
1214  }
1215  aText = rText.copy( nStartIdx );
1216  if (!aText.isEmpty() &&
1217  !rDoc.getIDocumentContentOperations().InsertString( rNewCursor, aText, nInsertFlags ))
1218  {
1219  OSL_FAIL( "Doc->Insert(Str) failed." );
1220  bOK = false;
1221  }
1222 
1223  return bOK;
1224 }
1225 
1226 void makeRedline( SwPaM const & rPaM,
1227  std::u16string_view rRedlineType,
1228  const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1229 {
1230  IDocumentRedlineAccess& rRedlineAccess = rPaM.GetDoc().getIDocumentRedlineAccess();
1231 
1233  if ( rRedlineType == u"Insert" )
1234  eType = RedlineType::Insert;
1235  else if ( rRedlineType == u"Delete" )
1236  eType = RedlineType::Delete;
1237  else if ( rRedlineType == u"Format" )
1238  eType = RedlineType::Format;
1239  else if ( rRedlineType == u"TextTable" )
1240  eType = RedlineType::Table;
1241  else if ( rRedlineType == u"ParagraphFormat" )
1242  eType = RedlineType::ParagraphFormat;
1243  else
1244  throw lang::IllegalArgumentException();
1245 
1246  //todo: what about REDLINE_FMTCOLL?
1247  comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
1248  std::size_t nAuthor = 0;
1249  OUString sAuthor;
1250  if( aPropMap.getValue("RedlineAuthor") >>= sAuthor )
1251  nAuthor = rRedlineAccess.InsertRedlineAuthor(sAuthor);
1252 
1253  OUString sComment;
1254  SwRedlineData aRedlineData( eType, nAuthor );
1255  if( aPropMap.getValue("RedlineComment") >>= sComment )
1256  aRedlineData.SetComment( sComment );
1257 
1258  ::util::DateTime aStamp;
1259  if( aPropMap.getValue("RedlineDateTime") >>= aStamp )
1260  {
1261  aRedlineData.SetTimeStamp( DateTime( aStamp));
1262  }
1263 
1264  std::unique_ptr<SwRedlineExtraData_FormatColl> xRedlineExtraData;
1265 
1266  // Read the 'Redline Revert Properties' from the parameters
1267  uno::Sequence< beans::PropertyValue > aRevertProperties;
1268  // Check if the value exists
1269  if ( aPropMap.getValue("RedlineRevertProperties") >>= aRevertProperties )
1270  {
1271  int nMap = 0;
1272  // Make sure that paragraph format gets its own map, otherwise e.g. fill attributes are not preserved.
1273  if (eType == RedlineType::ParagraphFormat)
1274  {
1275  nMap = PROPERTY_MAP_PARAGRAPH;
1276  if (!aRevertProperties.hasElements())
1277  {
1278  // to reject the paragraph style change, use standard style
1279  xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", RES_POOLCOLL_STANDARD, nullptr ));
1280  }
1281  }
1282  else
1284  SfxItemPropertySet const& rPropSet = *aSwMapProvider.GetPropertySet(nMap);
1285 
1286  // Check if there are any properties
1287  if (aRevertProperties.hasElements())
1288  {
1289  SwDoc& rDoc = rPaM.GetDoc();
1290 
1291  // Build set of attributes we want to fetch
1292  WhichRangesContainer aWhichPairs;
1293  std::vector<SfxItemPropertyMapEntry const*> aEntries;
1294  std::vector<uno::Any> aValues;
1295  aEntries.reserve(aRevertProperties.getLength());
1296  sal_uInt16 nStyleId = USHRT_MAX;
1297  sal_uInt16 nNumId = USHRT_MAX;
1298  for (const auto& rRevertProperty : std::as_const(aRevertProperties))
1299  {
1300  const OUString &rPropertyName = rRevertProperty.Name;
1301  SfxItemPropertyMapEntry const* pEntry = rPropSet.getPropertyMap().getByName(rPropertyName);
1302 
1303  if (!pEntry)
1304  {
1305  // unknown property
1306  break;
1307  }
1308  else if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
1309  {
1310  break;
1311  }
1312  else if (rPropertyName == "NumberingRules")
1313  {
1314  aWhichPairs = aWhichPairs.MergeRange(RES_PARATR_NUMRULE, RES_PARATR_NUMRULE);
1315  nNumId = aEntries.size();
1316  }
1317  else
1318  {
1319  aWhichPairs = aWhichPairs.MergeRange(pEntry->nWID, pEntry->nWID);
1320  if (rPropertyName == "ParaStyleName")
1321  nStyleId = aEntries.size();
1322  }
1323  aEntries.push_back(pEntry);
1324  aValues.push_back(rRevertProperty.Value);
1325  }
1326 
1327  if (!aWhichPairs.empty())
1328  {
1329  sal_uInt16 nStylePoolId = USHRT_MAX;
1330  OUString sParaStyleName;
1331  SfxItemSet aItemSet(rDoc.GetAttrPool(), aWhichPairs);
1332 
1333  for (size_t i = 0; i < aEntries.size(); ++i)
1334  {
1335  const uno::Any &rValue = aValues[i];
1336  if (i == nNumId)
1337  {
1338  uno::Reference<container::XNamed> xNumberingRules;
1339  rValue >>= xNumberingRules;
1340  if (xNumberingRules.is())
1341  {
1342  aItemSet.Put( SwNumRuleItem( xNumberingRules->getName() ));
1343  // keep it during export
1344  SwNumRule* pRule = rDoc.FindNumRulePtr(
1345  xNumberingRules->getName());
1346  if (pRule)
1347  pRule->SetUsedByRedline(true);
1348  }
1349  }
1350  else
1351  {
1352  SfxItemPropertyMapEntry const*const pEntry = aEntries[i];
1353  rPropSet.setPropertyValue(*pEntry, rValue, aItemSet);
1354  if (i == nStyleId)
1355  rValue >>= sParaStyleName;
1356  }
1357  }
1358 
1359  if (eType == RedlineType::ParagraphFormat && sParaStyleName.isEmpty())
1360  nStylePoolId = RES_POOLCOLL_STANDARD;
1361 
1362  xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( sParaStyleName, nStylePoolId, &aItemSet ));
1363  }
1364  else if (eType == RedlineType::ParagraphFormat)
1365  xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", RES_POOLCOLL_STANDARD, nullptr ));
1366  }
1367  }
1368 
1369  SwRangeRedline* pRedline = new SwRangeRedline( aRedlineData, rPaM );
1370 
1371  // set IsMoved bit of the redline to show and handle moved text
1372  bool bIsMoved;
1373  if( (aPropMap.getValue("RedlineMoved") >>= bIsMoved) && bIsMoved )
1374  pRedline->SetMoved();
1375 
1376  RedlineFlags nPrevMode = rRedlineAccess.GetRedlineFlags( );
1377  // xRedlineExtraData is copied here
1378  pRedline->SetExtraData( xRedlineExtraData.get() );
1379 
1380  rRedlineAccess.SetRedlineFlags_intern(RedlineFlags::On);
1381  auto const result(rRedlineAccess.AppendRedline(pRedline, false));
1382  rRedlineAccess.SetRedlineFlags_intern( nPrevMode );
1384  throw lang::IllegalArgumentException();
1385 }
1386 
1388  std::u16string_view rRedlineType,
1389  const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1390 {
1391  SwDoc* pDoc = rTableLine.GetFrameFormat()->GetDoc();
1392  IDocumentRedlineAccess* pRedlineAccess = &pDoc->getIDocumentRedlineAccess();
1393 
1395  if ( rRedlineType == u"TableRowInsert" )
1396  {
1397  eType = RedlineType::TableRowInsert;
1398  }
1399  else if ( rRedlineType == u"TableRowDelete" )
1400  {
1401  eType = RedlineType::TableRowDelete;
1402  }
1403  else
1404  {
1405  throw lang::IllegalArgumentException();
1406  }
1407 
1408  // set table row property "HasTextChangesOnly" to false
1409  // to handle tracked deletion or insertion of the table row on the UI
1410  const SvxPrintItem *pHasTextChangesOnlyProp =
1412  if ( !pHasTextChangesOnlyProp || pHasTextChangesOnlyProp->GetValue() )
1413  {
1414  SvxPrintItem aSetTracking(RES_PRINT, false);
1415  SwNodeIndex aInsPos( *(rTableLine.GetTabBoxes()[0]->GetSttNd()), 1 );
1416  // as a workaround for the rows without text content,
1417  // add a redline with invisible text CH_TXT_TRACKED_DUMMY_CHAR
1418  if ( rTableLine.IsEmpty() )
1419  {
1420  SwPaM aPaM(aInsPos);
1422  OUStringChar(CH_TXT_TRACKED_DUMMY_CHAR) );
1423  aPaM.SetMark();
1424  aPaM.GetMark()->nContent.Assign(aPaM.GetContentNode(), 0);
1425  makeRedline(aPaM, RedlineType::TableRowInsert == eType
1426  ? u"Insert"
1427  : u"Delete", rRedlineProperties);
1428  }
1429  SwCursor aCursor( SwPosition(aInsPos), nullptr );
1430  pDoc->SetRowNotTracked( aCursor, aSetTracking );
1431  }
1432 
1433  comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
1434  std::size_t nAuthor = 0;
1435  OUString sAuthor;
1436  if( aPropMap.getValue("RedlineAuthor") >>= sAuthor )
1437  nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
1438 
1439  OUString sComment;
1440  SwRedlineData aRedlineData( eType, nAuthor );
1441  if( aPropMap.getValue("RedlineComment") >>= sComment )
1442  aRedlineData.SetComment( sComment );
1443 
1444  ::util::DateTime aStamp;
1445  if( aPropMap.getValue("RedlineDateTime") >>= aStamp )
1446  {
1447  aRedlineData.SetTimeStamp(
1448  DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), tools::Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
1449  }
1450 
1451  SwTableRowRedline* pRedline = new SwTableRowRedline( aRedlineData, rTableLine );
1452  RedlineFlags nPrevMode = pRedlineAccess->GetRedlineFlags( );
1453  pRedline->SetExtraData( nullptr );
1454 
1455  pRedlineAccess->SetRedlineFlags_intern(RedlineFlags::On);
1456  bool bRet = pRedlineAccess->AppendTableRowRedline( pRedline );
1457  pRedlineAccess->SetRedlineFlags_intern( nPrevMode );
1458  if( !bRet )
1459  throw lang::IllegalArgumentException();
1460 }
1461 
1463  std::u16string_view rRedlineType,
1464  const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1465 {
1466  IDocumentRedlineAccess* pRedlineAccess = &rTableBox.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess();
1467 
1469  if ( rRedlineType == u"TableCellInsert" )
1470  {
1471  eType = RedlineType::TableCellInsert;
1472  }
1473  else if ( rRedlineType == u"TableCellDelete" )
1474  {
1475  eType = RedlineType::TableCellDelete;
1476  }
1477  else
1478  {
1479  throw lang::IllegalArgumentException();
1480  }
1481 
1482  comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
1483  std::size_t nAuthor = 0;
1484  OUString sAuthor;
1485  if( aPropMap.getValue("RedlineAuthor") >>= sAuthor )
1486  nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
1487 
1488  OUString sComment;
1489  SwRedlineData aRedlineData( eType, nAuthor );
1490  if( aPropMap.getValue("RedlineComment") >>= sComment )
1491  aRedlineData.SetComment( sComment );
1492 
1493  ::util::DateTime aStamp;
1494  if( aPropMap.getValue("RedlineDateTime") >>= aStamp )
1495  {
1496  aRedlineData.SetTimeStamp(
1497  DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), tools::Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
1498  }
1499 
1500  SwTableCellRedline* pRedline = new SwTableCellRedline( aRedlineData, rTableBox );
1501  RedlineFlags nPrevMode = pRedlineAccess->GetRedlineFlags( );
1502  pRedline->SetExtraData( nullptr );
1503 
1504  pRedlineAccess->SetRedlineFlags_intern(RedlineFlags::On);
1505  bool bRet = pRedlineAccess->AppendTableCellRedline( pRedline );
1506  pRedlineAccess->SetRedlineFlags_intern( nPrevMode );
1507  if( !bRet )
1508  throw lang::IllegalArgumentException();
1509 }
1510 
1511 void SwAnyMapHelper::SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& rAny )
1512 {
1513  sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
1514  m_Map[nKey] = rAny;
1515 }
1516 
1517 bool SwAnyMapHelper::FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& pAny )
1518 {
1519  bool bRet = false;
1520  sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
1521  auto aIt = m_Map.find( nKey );
1522  if (aIt != m_Map.end())
1523  {
1524  pAny = & aIt->second;
1525  bRet = true;
1526  }
1527  return bRet;
1528 }
1529 
1530 }//namespace SwUnoCursorHelper
1531 
1532 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool is() const
Starts a section of nodes in the document model.
Definition: node.hxx:313
#define FN_API_CALL
Definition: cmdid.h:552
static constexpr OUStringLiteral PROP_URL
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:224
static constexpr OUStringLiteral PROP_DOCUMENTBASEURL
virtual SfxObjectFactory & GetFactory() const =0
static uno::Any GetParaListAutoFormat(SwTextNode const &rNode)
virtual const SwDoc * GetDoc() const =0
static constexpr OUStringLiteral PROP_FILTERNAME
Marks a position in the document model.
Definition: pam.hxx:36
void setPropertyValue(const SfxItemPropertyMapEntry &rEntry, const css::uno::Any &aVal, SfxItemSet &rSet) const
#define FN_UNO_DOCUMENT_INDEX_MARK
Definition: cmdid.h:524
#define FN_UNO_CELL
Definition: cmdid.h:528
void SetExtraData(const SwRedlineExtraData *pData)
ExtraData gets copied, the pointer is therefore not taken over by the RedLineObject.
Definition: redline.hxx:320
const SwNodeNum * GetNum(SwRootFrame const *pLayout=nullptr) const
Definition: ndtxt.cxx:3936
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(98)
bool getCursorPropertyValue(const SfxItemPropertyMapEntry &rEntry, SwPaM &rPam, Any *pAny, PropertyState &eState, const SwTextNode *pNode)
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:754
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_METAFIELD(49)
virtual const SwRootFrame * GetCurrentLayout() const =0
static rtl::Reference< SwXCell > CreateXCell(SwFrameFormat *pTableFormat, SwTableBox *pBox, SwTable *pTable=nullptr)
Definition: unotbl.cxx:1119
SwDocShell * GetDocShell()
Definition: doc.hxx:1352
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:226
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
void SetTimeStamp(const DateTime &rDT)
Definition: redline.hxx:134
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_META(48)
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
static SwTOXBase * GetCurTOX(const SwPosition &rPos)
Get current table of contents.
Definition: doctxm.cxx:447
SwNodeIndex nNode
Definition: pam.hxx:38
static constexpr OUStringLiteral PROP_FILENAME
static SwPaM * lcl_createPamCopy(const SwPaM &rPam)
virtual const sal_Int32 * GetEnd() const
end position
Definition: txatbase.cxx:48
const SwFrameFormat * GetFrameFormat() const
Definition: unoframe.hxx:152
static css::uno::Reference< css::text::XTextContent > CreateXParagraph(SwDoc &rDoc, SwTextNode *pTextNode, css::uno::Reference< css::text::XText > const &xParentText=nullptr, const sal_Int32 nSelStart=-1, const sal_Int32 nSelEnd=-1)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
Reference< XFrame > xFrame
const SwPosition * GetMark() const
Definition: pam.hxx:210
#define FN_UNO_PARA_CONT_PREV_SUBTREE
Definition: cmdid.h:608
void getNumberingProperty(SwPaM &rPam, PropertyState &eState, Any *pAny)
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1210
SwTableBox * GetTableBox() const
Definition: unotbl.hxx:143
sal_Int64 n
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
OUString GetListId() const
Definition: ndtxt.cxx:4357
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
Definition: unomap1.cxx:1062
Definition: doc.hxx:188
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:93
SwTableLine is one table row in the document model.
Definition: swtable.hxx:358
SwNode & GetNode() const
Definition: ndindex.hxx:121
#define FN_UNO_TEXT_PARAGRAPH
Definition: cmdid.h:548
const std::shared_ptr< SfxItemSet > & GetStyleHandle() const
Definition: fmtautofmt.hxx:49
SwSectionFormat * GetFormat()
Definition: section.hxx:340
bool IsEndNote() const
Definition: fmtftn.hxx:71
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
void resetCursorPropertyValue(const SfxItemPropertyMapEntry &rEntry, SwPaM &rPam)
void GetSelectableFromAny(uno::Reference< uno::XInterface > const &xIfc, SwDoc &rTargetDoc, SwPaM *&o_rpPaM, std::pair< OUString, FlyCntType > &o_rFrame, OUString &o_rTableName, SwUnoTableCursor const *&o_rpTableCursor,::sw::mark::IMark const *&o_rpMark, std::vector< SdrObject * > &o_rSdrObjects)
sal_uInt16 Which() const
Definition: txatbase.hxx:114
static css::uno::Reference< css::text::XTextField > CreateXTextField(SwDoc *pDoc, SwFormatField const *pFormat, SwServiceType nServiceId=SwServiceType::Invalid)
Definition: unofield.cxx:1216
virtual bool DeleteAndJoin(SwPaM &, const bool bForceJoinNext=false)=0
complete delete of a given PaM
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, enum GetTextAttrMode const eMode=DEFAULT) const
get the innermost text attribute covering position nIndex.
Definition: ndtxt.cxx:1709
static constexpr OUStringLiteral PROP_FILTEROPTIONS
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
void makeTableCellRedline(SwTableBox &rTableBox, std::u16string_view rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
bool IsListRestart() const
Definition: ndtxt.cxx:4104
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
static SwSection * GetCurrSection(const SwPosition &rPos)
Definition: ndsect.cxx:504
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4081
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:205
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4001
static css::uno::Reference< css::lang::XSingleServiceFactory > GetStorageFactory(const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
const OUString & GetName() const
Definition: pagedesc.hxx:196
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
SwContentNode * GetContentNode(bool bPoint=true) const
Definition: pam.hxx:230
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
Definition: ndtxt.cxx:3030
sal_uInt16 sal_Unicode
#define PROPERTY_MAP_CHAR_AUTO_STYLE
Definition: unomap.hxx:119
#define FN_UNO_PARA_NUM_AUTO_FORMAT
Definition: cmdid.h:519
#define FN_UNO_ENDNOTE
Definition: cmdid.h:533
#define FN_UNO_LIST_ID
Definition: cmdid.h:605
Reference< XInputStream > xStream
SwIndex nContent
Definition: pam.hxx:39
#define FN_UNO_DOCUMENT_INDEX
Definition: cmdid.h:525
static SwNumRule * GetNumRuleAtPos(SwPosition &rPos, SwRootFrame const *pLayout=nullptr)
Definition: docnum.cxx:2441
void ResetAttrs(const SwPaM &rRg, bool bTextAttr=true, const o3tl::sorted_vector< sal_uInt16 > &rAttrs=o3tl::sorted_vector< sal_uInt16 >(), const bool bSendDataChangedEvents=true, SwRootFrame const *pLayout=nullptr)
Reset attributes.
Definition: docfmt.cxx:242
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
Definition: txatbase.hxx:41
void SetComment(const OUString &rS)
Definition: redline.hxx:133
const OUString & GetName() const
Definition: format.hxx:115
constexpr TypedWhichId< SfxUInt16Item > RES_PARATR_OUTLINELEVEL(79)
sal_Int32 GetStart() const
Definition: txatbase.hxx:86
FontMetric Get(const OUString &rName, const OUString &rStyleName) const
void SetValue(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any &rAny)
const css::uno::Reference< css::uno::XAggregation > & GetAggregationInterface() const
Definition: unodraw.hxx:259
Mode eMode
const SwTable & GetTable() const
Definition: node.hxx:500
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:195
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:154
#define FN_UNO_PARA_CONDITIONAL_STYLE_NAME
Definition: cmdid.h:561
RedlineFlags on.
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(58)
void SetExtraData(const SwRedlineExtraData *pData)
ExtraData gets copied, the pointer is therefore not taken over by the RedLineObject.
Definition: redline.hxx:217
SwPaM * GetNext()
Definition: pam.hxx:265
Redline that holds information about a table-cell that had some change.
Definition: redline.hxx:308
virtual bool AppendTableCellRedline(SwTableCellRedline *pPtr)=0
SwPaM & SetPam(size_t nArrPos, SwPaM &rPam)
Definition: ednumber.cxx:101
#define FN_UNO_IS_NUMBER
Definition: cmdid.h:564
SwFormatColl & GetAnyFormatColl() const
Definition: node.hxx:711
std::unique_ptr< SwReader, o3tl::default_delete< SwReader > > SwReaderPtr
Definition: docsh.hxx:44
DocumentType eType
void DelNumRules(const SwPaM &, SwRootFrame const *pLayout=nullptr)
Definition: docnum.cxx:1321
void SetNodeNumStart(const SwPosition &rPos, sal_uInt16 nStt)
Definition: docnum.cxx:1037
FlyCntType GetFlyCntType() const
Definition: unoframe.hxx:157
#define FN_UNO_PAGE_STYLE
Definition: cmdid.h:517
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
size_t Count() const
Definition: edimp.hxx:49
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2470
static SwTable * FindTable(SwFrameFormat const *const pFormat)
Definition: swtable.cxx:2098
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
#define CH_TXT_TRACKED_DUMMY_CHAR
Definition: hintids.hxx:188
static constexpr OUStringLiteral PROP_INPUTSTREAM
Style of a layout element.
Definition: frmfmt.hxx:59
size_t Count() const
Definition: ndhints.hxx:142
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
SwTextAttr * Get(size_t nPos) const
Definition: ndhints.hxx:144
int i
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:961
SwTableBox * FindBox(SwTable *pTable, SwTableBox *pBox)
search if a box exists in a table
Definition: unotbl.cxx:1140
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:133
SwDoc & GetDoc()
Definition: node.hxx:213
const SwPosition * GetPoint() const
Definition: pam.hxx:208
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
#define FN_UNO_NESTED_TEXT_CONTENT
Definition: cmdid.h:612
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
SwPageFrame * FindPageFrame()
Definition: frame.hxx:681
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:143
SwContentNode * GetContentNode()
Definition: node.hxx:619
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:206
css::uno::Any getValue(const OUString &sKey) const
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1158
WEIGHT_NORMAL
float u
static css::uno::Reference< css::text::XDocumentIndexMark > CreateXDocumentIndexMark(SwDoc &rDoc, SwTOXMark *pMark, TOXTypes eType=TOX_INDEX)
Definition: unoidx.cxx:1616
const SfxItemPropertyMap & getPropertyMap() const
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2795
dictionary props
static css::uno::Reference< css::text::XDocumentIndex > CreateXDocumentIndex(SwDoc &rDoc, SwTOXBaseSection *pSection, TOXTypes eTypes=TOX_INDEX)
Definition: unoidx.cxx:402
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:381
bool IsNoTextNode() const
Definition: node.hxx:652
Marks a node in the document model.
Definition: ndindex.hxx:32
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:458
css::uno::Type const & get()
static css::uno::Reference< css::text::XTextTable > GetObject(SwFrameFormat &rFormat)
Definition: unocoll.cxx:978
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, const bool bIncludeInputFieldAtStart=false) const
Definition: ndtxt.cxx:1753
Reader * StartConvertFrom(SfxMedium &rMedium, SwReaderPtr &rpRdr, SwCursorShell const *pCursorSh=nullptr, SwPaM *pPaM=nullptr)
For inserting document.
Definition: docsh.cxx:139
SwStartNodeType GetStartNodeType() const
Definition: node.hxx:330
ITALIC_NONE
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
virtual std::size_t InsertRedlineAuthor(const OUString &rAuthor)=0
#define FN_UNO_NUM_START_VALUE
Definition: cmdid.h:521
void InsertFile(SwUnoCursor *pUnoCursor, const OUString &rURL, const uno::Sequence< beans::PropertyValue > &rOptions)
static css::uno::Reference< css::text::XTextContent > CreateXReferenceMark(SwDoc &rDoc, SwFormatRefMark *pMarkFormat)
Definition: unorefmk.cxx:127
Represents the style of a text portion.
Definition: charfmt.hxx:26
A page of the document layout.
Definition: pagefrm.hxx:57
bool FillValue(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any *&pAny)
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:204
Redline that holds information about a table-row that had some change.
Definition: redline.hxx:287
static constexpr OUStringLiteral PROP_STREAM
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
#define FN_UNO_TEXT_SECTION
Definition: cmdid.h:531
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
const SwPosition * Start() const
Definition: pam.hxx:213
SAL_WARN_UNUSED_RESULT WhichRangesContainer MergeRange(sal_uInt16 nFrom, sal_uInt16 nTo) const
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange,::sw::TextRangeMode const eMode)
Definition: unoobj2.cxx:1107
EXPAND : (Start < nIndex <= End)
Definition: ndtxt.hxx:371
size_t size() const
Definition: charformats.hxx:71
bool IsControlChar(sal_Unicode cChar)
DEFAULT: (Start <= nIndex < End)
Definition: ndtxt.hxx:370
virtual const SwPaM * GetPaM() const =0
#define FN_UNO_TEXT_FIELD
Definition: cmdid.h:526
std::map< sal_uInt32, css::uno::Any > m_Map
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
uno::Reference< text::XTextContent > GetNestedTextContent(SwTextNode const &rTextNode, sal_Int32 const nIndex, bool const bParent)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual bool AppendTableRowRedline(SwTableRowRedline *pPtr)=0
SwTableBoxes & GetTabBoxes()
Definition: swtable.hxx:369
void SetExtraData(const SwRedlineExtraData *pData)
ExtraData gets copied, the pointer is therefore not taken over by the RedLineObject.
Definition: redline.hxx:299
#define PROPERTY_MAP_PARAGRAPH
Definition: unomap.hxx:61
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
SwCharFormat * GetCharFormat() const
Definition: fchrfmt.hxx:70
void SetCharFormat(SwCharFormat *)
Definition: number.cxx:280
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:472
An SwTextAttr container, stores all directly formatted text portions for a text node.
Definition: ndhints.hxx:67
#define FN_UNO_NUM_RULES
Definition: cmdid.h:523
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:740
#define FN_NUMBER_NEWSTART
Definition: cmdid.h:456
SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const
Definition: ndtxt.cxx:4158
static constexpr OUStringLiteral PROP_PASSWORD
#define FN_UNO_CHARFMT_SEQUENCE
Definition: cmdid.h:589
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
std::shared_ptr< const SfxFilter > GetFilter4FilterName(const OUString &rName, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
#define FN_UNO_REFERENCE_MARK
Definition: cmdid.h:530
#define SAL_INFO(area, stream)
sal_Int32 GetIndex() const
Definition: index.hxx:91
bool IsCountedInList() const
Definition: ndtxt.cxx:4219
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
SwNodes & GetNodes()
Definition: doc.hxx:409
void SetRowNotTracked(const SwCursor &rCursor, const SvxPrintItem &rNotTracked, bool bAll=false)
rNotTracked = false means that the row was deleted or inserted with its tracked cell content bAll: de...
Definition: ndtbl1.cxx:543
void SetMoved()
Definition: redline.hxx:269
const SwPosition * End() const
Definition: pam.hxx:218
SdrObject * GetSdrObject() const
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3196
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:419
const SwUnoCursor * GetTableCursor() const
Definition: unotbl.cxx:3812
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:87
#define FN_UNO_TEXT_FRAME
Definition: cmdid.h:529
::sw::mark::IMark const * GetBookmarkInDoc(SwDoc const *const pDoc, const css::uno::Reference< css::lang::XUnoTunnel > &xUT)
Definition: unobkm.cxx:185
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
void makeRedline(SwPaM const &rPaM, std::u16string_view rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
Any value
bool IsContinueingPreviousSubTree() const
static css::uno::Reference< css::text::XFootnote > CreateXFootnote(SwDoc &rDoc, SwFormatFootnote *pFootnoteFormat, bool isEndnote=false)
Definition: unoftn.cxx:142
SwStartNodeType
Definition: ndtyp.hxx:50
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:718
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:357
void makeTableRowRedline(SwTableLine &rTableLine, std::u16string_view rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
constexpr sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:58
SwFormatColl * GetCurTextFormatColl(SwPaM &rPam, const bool bConditional)
Definition: unoobj.cxx:617
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
OUString GetNumString(const bool _bInclPrefixAndSuffixStrings=true, const unsigned int _nRestrictToThisLevel=MAXLEVEL, SwRootFrame const *pLayout=nullptr) const
Returns outline of numbering string.
Definition: ndtxt.cxx:3101
const SfxPoolItem & GetAttr() const
Definition: txatbase.hxx:163
void GetCurPageStyle(SwPaM const &rPaM, OUString &rString)
void setNumberingProperty(const Any &rValue, SwPaM &rPam)
std::vector< SwTextAttr * > GetTextAttrsAt(sal_Int32 const nIndex, sal_uInt16 const nWhich) const
get the innermost text attributes covering position nIndex.
Definition: ndtxt.cxx:1700
sal_Int32 size() const noexcept
ScXMLEditAttributeMap::Entry const aEntries[]
constexpr TypedWhichId< SwFormatAutoFormat > RES_PARATR_LIST_AUTOFMT(87)
Any result
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
#define SAL_WARN(area, stream)
SwFormatColl * GetFormatColl() const
Definition: node.hxx:455
bool IsInList() const
Definition: ndtxt.cxx:4323
SwDoc & GetDoc() const
Definition: pam.hxx:244
bool DocInsertStringSplitCR(SwDoc &rDoc, const SwPaM &rNewCursor, const OUString &rText, const bool bForceExpandHints)
void SetUsedByRedline(bool bUsed)
Definition: numrule.hxx:248
RedlineType
virtual SwUnoCursor * GetCursor()=0
#define FN_UNO_TEXT_TABLE
Definition: cmdid.h:527
bool empty() const noexcept
#define FN_UNO_NUM_LEVEL
Definition: cmdid.h:522
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:478
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
const FontList * GetFontList() const
static bool isInvalidStyle(std::u16string_view rName)
Definition: unosett.cxx:1012
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:120
static css::uno::Reference< css::text::XTextSection > GetObject(SwSectionFormat &rFormat)
Definition: unocoll.cxx:1521
SfxFilterContainer * GetFilterContainer() const
const SwFormatCharFormat & GetCharFormat() const
Definition: txatbase.hxx:183
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:867
bool HasAttrListRestartValue() const
Definition: ndtxt.cxx:4153
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
void DeepCopyPaM(SwPaM const &rSource, SwPaM &rTarget)
Definition: unoobj2.cxx:78
#define FN_UNO_FOOTNOTE
Definition: cmdid.h:532
bool IsTextNode() const
Definition: node.hxx:640
OUString const & GetName() const
sal_Int16 IsNodeNumStart(SwPaM const &rPam, PropertyState &eState)
#define FN_UNO_PARA_NUM_STRING
Definition: cmdid.h:609
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:719
#define PROPERTY_MAP_TEXTPORTION_EXTENSIONS
Definition: unomap.hxx:59
#define FN_UNO_PARA_STYLE
Definition: cmdid.h:516
GetTextAttrMode
Definition: ndtxt.hxx:368
bool IsEmpty() const
Definition: swtable.cxx:1557
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:856
SwFrameFormat * GetFrameFormat() const
Definition: unotbl.hxx:146
sal_Int16 nValue
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1024
static const OUString & GetProgName(const OUString &rName, SwGetPoolIdFromName)
SW_DLLPUBLIC SwFrameFormat * GetFrameFormat()
Definition: unotbl.cxx:2004