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