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 <vcl/metric.hxx>
76 #include <svtools/ctrltool.hxx>
77 #include <sfx2/docfilt.hxx>
78 #include <sfx2/docfile.hxx>
79 #include <sfx2/fcontnr.hxx>
80 #include <svl/stritem.hxx>
81 #include <SwStyleNameMapper.hxx>
82 #include <redline.hxx>
83 #include <numrule.hxx>
87 #include <SwNodeNum.hxx>
88 #include <fmtmeta.hxx>
89 #include <txtfld.hxx>
90 #include <unoparagraph.hxx>
91 #include <poolfmt.hxx>
92 #include <paratr.hxx>
93 #include <sal/log.hxx>
94 
95 using namespace ::com::sun::star;
96 using namespace ::com::sun::star::uno;
97 using namespace ::com::sun::star::beans;
98 using namespace ::com::sun::star::text;
99 using namespace ::com::sun::star::table;
100 using namespace ::com::sun::star::container;
101 using namespace ::com::sun::star::lang;
102 
104 {
105 
106 static SwPaM* lcl_createPamCopy(const SwPaM& rPam)
107 {
108  SwPaM *const pRet = new SwPaM(*rPam.GetPoint());
109  ::sw::DeepCopyPaM(rPam, *pRet);
110  return pRet;
111 }
112 
113 void GetSelectableFromAny(uno::Reference<uno::XInterface> const& xIfc,
114  SwDoc & rTargetDoc,
115  SwPaM *& o_rpPaM, std::pair<OUString, FlyCntType> & o_rFrame,
116  OUString & o_rTableName, SwUnoTableCursor const*& o_rpTableCursor,
117  ::sw::mark::IMark const*& o_rpMark,
118  std::vector<SdrObject *> & o_rSdrObjects)
119 {
120  uno::Reference<drawing::XShapes> const xShapes(xIfc, UNO_QUERY);
121  if (xShapes.is())
122  {
123  sal_Int32 nShapes(xShapes->getCount());
124  for (sal_Int32 i = 0; i < nShapes; ++i)
125  {
126  uno::Reference<lang::XUnoTunnel> xShape;
127  xShapes->getByIndex(i) >>= xShape;
128  if (xShape.is())
129  {
130  SvxShape *const pSvxShape(
131  ::sw::UnoTunnelGetImplementation<SvxShape>(xShape));
132  if (pSvxShape)
133  {
134  SdrObject *const pSdrObject = pSvxShape->GetSdrObject();
135  if (pSdrObject)
136  { // hmm... needs view to verify it's in right doc...
137  o_rSdrObjects.push_back(pSdrObject);
138  }
139  }
140  }
141  }
142  return;
143  }
144 
145  uno::Reference<lang::XUnoTunnel> const xTunnel(xIfc, UNO_QUERY);
146  if (!xTunnel.is()) // everything below needs tunnel
147  {
148  return;
149  }
150 
151  SwXShape *const pShape(::sw::UnoTunnelGetImplementation<SwXShape>(xTunnel));
152  if (pShape)
153  {
154  uno::Reference<uno::XAggregation> const xAgg(
155  pShape->GetAggregationInterface());
156  if (xAgg.is())
157  {
158  SvxShape *const pSvxShape(
159  ::sw::UnoTunnelGetImplementation<SvxShape>(xTunnel));
160  if (pSvxShape)
161  {
162  SdrObject *const pSdrObject = pSvxShape->GetSdrObject();
163  if (pSdrObject)
164  { // hmm... needs view to verify it's in right doc...
165  o_rSdrObjects.push_back(pSdrObject);
166  }
167  }
168  }
169  return;
170  }
171 
172  OTextCursorHelper *const pCursor(
173  ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xTunnel));
174  if (pCursor)
175  {
176  if (pCursor->GetDoc() == &rTargetDoc)
177  {
178  o_rpPaM = lcl_createPamCopy(*pCursor->GetPaM());
179  }
180  return;
181  }
182 
183  SwXTextRanges* const pRanges(
184  ::sw::UnoTunnelGetImplementation<SwXTextRanges>(xTunnel));
185  if (pRanges)
186  {
187  SwUnoCursor const* pUnoCursor = pRanges->GetCursor();
188  if (pUnoCursor && &pUnoCursor->GetDoc() == &rTargetDoc)
189  {
190  o_rpPaM = lcl_createPamCopy(*pUnoCursor);
191  }
192  return;
193  }
194 
195  // check these before Range to prevent misinterpretation of text frames
196  // and cells also implement XTextRange
197  SwXFrame *const pFrame(
198  ::sw::UnoTunnelGetImplementation<SwXFrame>(xTunnel));
199  if (pFrame)
200  {
201  const SwFrameFormat *const pFrameFormat(pFrame->GetFrameFormat());
202  if (pFrameFormat && pFrameFormat->GetDoc() == &rTargetDoc)
203  {
204  o_rFrame = std::make_pair(pFrameFormat->GetName(), pFrame->GetFlyCntType());
205  }
206  return;
207  }
208 
209  SwXTextTable *const pTextTable(
210  ::sw::UnoTunnelGetImplementation<SwXTextTable>(xTunnel));
211  if (pTextTable)
212  {
213  SwFrameFormat *const pFrameFormat(pTextTable->GetFrameFormat());
214  if (pFrameFormat && pFrameFormat->GetDoc() == &rTargetDoc)
215  {
216  o_rTableName = pFrameFormat->GetName();
217  }
218  return;
219  }
220 
221  SwXCell *const pCell(
222  ::sw::UnoTunnelGetImplementation<SwXCell>(xTunnel));
223  if (pCell)
224  {
225  SwFrameFormat *const pFrameFormat(pCell->GetFrameFormat());
226  if (pFrameFormat && pFrameFormat->GetDoc() == &rTargetDoc)
227  {
228  SwTableBox * pBox = pCell->GetTableBox();
229  SwTable *const pTable = SwTable::FindTable(pFrameFormat);
230  // ??? what's the benefit of setting pBox in this convoluted way?
231  pBox = pCell->FindBox(pTable, pBox);
232  if (pBox)
233  {
234  SwPosition const aPos(*pBox->GetSttNd());
235  SwPaM aPam(aPos);
236  aPam.Move(fnMoveForward, GoInNode);
237  o_rpPaM = lcl_createPamCopy(aPam);
238  }
239  }
240  return;
241  }
242 
243  uno::Reference<text::XTextRange> const xTextRange(xTunnel, UNO_QUERY);
244  if (xTextRange.is())
245  {
246  SwUnoInternalPaM aPam(rTargetDoc);
247  if (::sw::XTextRangeToSwPaM(aPam, xTextRange))
248  {
249  o_rpPaM = lcl_createPamCopy(aPam);
250  }
251  return;
252  }
253 
254  SwXCellRange *const pCellRange(
255  ::sw::UnoTunnelGetImplementation<SwXCellRange>(xTunnel));
256  if (pCellRange)
257  {
258  SwUnoCursor const*const pUnoCursor(pCellRange->GetTableCursor());
259  if (pUnoCursor && &pUnoCursor->GetDoc() == &rTargetDoc)
260  {
261  // probably can't copy it to o_rpPaM for this since it's
262  // a SwTableCursor
263  o_rpTableCursor = dynamic_cast<SwUnoTableCursor const*>(pUnoCursor);
264  }
265  return;
266  }
267 
268  ::sw::mark::IMark const*const pMark(
269  SwXBookmark::GetBookmarkInDoc(& rTargetDoc, xTunnel));
270  if (pMark)
271  {
272  o_rpMark = pMark;
273  return;
274  }
275 }
276 
277 uno::Reference<text::XTextContent>
278 GetNestedTextContent(SwTextNode const & rTextNode, sal_Int32 const nIndex,
279  bool const bParent)
280 {
281  // these should be unambiguous because of the dummy character
282  SwTextNode::GetTextAttrMode const eMode( bParent
284  SwTextAttr *const pMetaTextAttr =
285  rTextNode.GetTextAttrAt(nIndex, RES_TXTATR_META, eMode);
286  SwTextAttr *const pMetaFieldTextAttr =
287  rTextNode.GetTextAttrAt(nIndex, RES_TXTATR_METAFIELD, eMode);
288  // which is innermost?
289  SwTextAttr *const pTextAttr = pMetaTextAttr
290  ? (pMetaFieldTextAttr
291  ? ((pMetaFieldTextAttr->GetStart() >
292  pMetaTextAttr->GetStart())
293  ? pMetaFieldTextAttr : pMetaTextAttr)
294  : pMetaTextAttr)
295  : pMetaFieldTextAttr;
296  uno::Reference<XTextContent> xRet;
297  if (pTextAttr)
298  {
299  ::sw::Meta *const pMeta(
300  static_cast<SwFormatMeta &>(pTextAttr->GetAttr()).GetMeta());
301  assert(pMeta);
302  xRet.set(pMeta->MakeUnoObject(), uno::UNO_QUERY);
303  }
304  return xRet;
305 }
306 
308 {
309  SwFormatAutoFormat const*const pFormat(
311  if (!pFormat)
312  {
313  return uno::Any();
314  }
315  SfxItemSet const& rSet(*pFormat->GetStyleHandle());
317  SfxItemPropertyMap const& rMap(rPropSet.getPropertyMap());
318  std::vector<beans::NamedValue> props;
319  // have to iterate the map, not the item set?
320  for (auto const& rEntry : rMap.getPropertyEntries())
321  {
322  if (rPropSet.getPropertyState(rEntry, rSet) == PropertyState_DIRECT_VALUE)
323  {
324  Any value;
325  rPropSet.getPropertyValue(rEntry, rSet, value);
326  props.emplace_back(rEntry.sName, value);
327  }
328  }
329  return uno::makeAny(comphelper::containerToSequence(props));
330 }
331 
332 // Read the special properties of the cursor
334  , SwPaM& rPam
335  , Any *pAny
336  , PropertyState& eState
337  , const SwTextNode* pNode )
338 {
339  PropertyState eNewState = PropertyState_DIRECT_VALUE;
340  bool bDone = true;
341  switch(rEntry.nWID)
342  {
344  if (pAny)
345  {
346  const SwTextNode * pTmpNode = pNode;
347 
348  if (!pTmpNode)
349  pTmpNode = rPam.GetNode().GetTextNode();
350 
351  bool bRet = false;
352 
353  if ( pTmpNode &&
354  pTmpNode->GetNum() &&
355  pTmpNode->GetNum()->IsContinueingPreviousSubTree() )
356  {
357  bRet = true;
358  }
359 
360  *pAny <<= bRet;
361  }
362  break;
364  if (pAny)
365  {
366  const SwTextNode * pTmpNode = pNode;
367 
368  if (!pTmpNode)
369  pTmpNode = rPam.GetNode().GetTextNode();
370 
371  OUString sRet;
372  if ( pTmpNode && pTmpNode->GetNum() )
373  {
374  sRet = pTmpNode->GetNumString();
375  }
376 
377  *pAny <<= sRet;
378  }
379  break;
381  if (pAny)
382  {
383  const SwTextNode * pTmpNode = pNode;
384 
385  if (!pTmpNode)
386  pTmpNode = rPam.GetNode().GetTextNode();
387 
388  sal_Int16 nRet = -1;
389  if ( pTmpNode )
390  nRet = sal::static_int_cast< sal_Int16 >( pTmpNode->GetAttrOutlineLevel() );
391 
392  *pAny <<= nRet;
393  }
394  break;
396  case FN_UNO_PARA_STYLE :
397  {
398  SwFormatColl* pFormat = nullptr;
399  if(pNode)
400  pFormat = FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID
401  ? pNode->GetFormatColl() : &pNode->GetAnyFormatColl();
402  else
403  {
406  }
407  if(pFormat)
408  {
409  if( pAny )
410  {
411  OUString sVal;
413  *pAny <<= sVal;
414  }
415  }
416  else
417  eNewState = PropertyState_AMBIGUOUS_VALUE;
418  }
419  break;
420  case FN_UNO_PAGE_STYLE :
421  {
422  OUString sVal;
423  GetCurPageStyle(rPam, sVal);
424  if( pAny )
425  *pAny <<= sVal;
426  if(sVal.isEmpty())
427  eNewState = PropertyState_AMBIGUOUS_VALUE;
428  }
429  break;
431  if( pAny )
432  {
433  sal_Int16 nValue = IsNodeNumStart(rPam, eNewState);
434  *pAny <<= nValue;
435  }
436  break;
437  case FN_UNO_NUM_LEVEL :
438  case FN_UNO_IS_NUMBER :
439  // #i91601#
440  case FN_UNO_LIST_ID:
441  case FN_NUMBER_NEWSTART:
443  {
444  if (!pAny)
445  {
446  break;
447  }
448  // a multi selection is not considered
449  const SwTextNode* pTextNd = rPam.GetNode().GetTextNode();
450  if ( pTextNd && pTextNd->IsInList() )
451  {
452  switch (rEntry.nWID)
453  {
454  case FN_UNO_NUM_LEVEL:
455  {
456  *pAny <<= static_cast<sal_Int16>(pTextNd->GetActualListLevel());
457  break;
458  }
459  case FN_UNO_IS_NUMBER:
460  {
461  *pAny <<= pTextNd->IsCountedInList();
462  break;
463  }
464  // #i91601#
465  case FN_UNO_LIST_ID:
466  {
467  *pAny <<= pTextNd->GetListId();
468  break;
469  }
470  case FN_NUMBER_NEWSTART:
471  {
472  *pAny <<= pTextNd->IsListRestart();
473  break;
474  }
476  {
477  *pAny = GetParaListAutoFormat(*pTextNd);
478  break;
479  }
480  default:
481  assert(false);
482  }
483  }
484  else
485  {
486  eNewState = PropertyState_DEFAULT_VALUE;
487 
488  // #i30838# set default values for default properties
489  switch (rEntry.nWID)
490  {
491  case FN_UNO_NUM_LEVEL:
492  {
493  *pAny <<= static_cast<sal_Int16>( 0 );
494  break;
495  }
496  case FN_UNO_IS_NUMBER:
497  {
498  *pAny <<= false;
499  break;
500  }
501  // #i91601#
502  case FN_UNO_LIST_ID:
503  {
504  *pAny <<= OUString();
505  break;
506  }
507  case FN_NUMBER_NEWSTART:
508  {
509  *pAny <<= false;
510  break;
511  }
513  {
514  break; // void
515  }
516  default:
517  assert(false);
518  }
519  }
520  //PROPERTY_MAYBEVOID!
521  }
522  break;
523  case FN_UNO_NUM_RULES :
524  if( pAny )
525  getNumberingProperty(rPam, eNewState, pAny);
526  else
527  {
528  if( !SwDoc::GetNumRuleAtPos( *rPam.GetPoint() ) )
529  eNewState = PropertyState_DEFAULT_VALUE;
530  }
531  break;
533  {
534  std::vector<SwTextAttr *> marks;
535  if (rPam.GetNode().IsTextNode())
536  {
537  marks = rPam.GetNode().GetTextNode()->GetTextAttrsAt(
539  }
540  if (!marks.empty())
541  {
542  if( pAny )
543  { // hmm... can only return 1 here
544  SwTOXMark & rMark =
545  static_cast<SwTOXMark &>((*marks.begin())->GetAttr());
546  const uno::Reference< text::XDocumentIndexMark > xRef =
548  rPam.GetDoc(), &rMark);
549  (*pAny) <<= xRef;
550  }
551  }
552  else
553  //also here - indistinguishable
554  eNewState = PropertyState_DEFAULT_VALUE;
555  }
556  break;
558  {
559  SwTOXBase* pBase = SwDoc::GetCurTOX(
560  *rPam.Start() );
561  if( pBase )
562  {
563  if( pAny )
564  {
565  const uno::Reference< text::XDocumentIndex > xRef =
567  static_cast<SwTOXBaseSection *>(pBase));
568  (*pAny) <<= xRef;
569  }
570  }
571  else
572  eNewState = PropertyState_DEFAULT_VALUE;
573  }
574  break;
575  case FN_UNO_TEXT_FIELD:
576  {
577  const SwPosition *pPos = rPam.Start();
578  const SwTextNode *pTextNd =
579  rPam.GetDoc().GetNodes()[pPos->nNode.GetIndex()]->GetTextNode();
580  const SwTextAttr* pTextAttr = pTextNd
581  ? pTextNd->GetFieldTextAttrAt( pPos->nContent.GetIndex(), true )
582  : nullptr;
583  if ( pTextAttr != nullptr )
584  {
585  if( pAny )
586  {
587  uno::Reference<text::XTextField> const xField(
589  &pTextAttr->GetFormatField()));
590  *pAny <<= xField;
591  }
592  }
593  else
594  eNewState = PropertyState_DEFAULT_VALUE;
595  }
596  break;
597  case FN_UNO_TEXT_TABLE:
598  case FN_UNO_CELL:
599  {
600  SwStartNode* pSttNode = rPam.GetNode().StartOfSectionNode();
601  SwStartNodeType eType = pSttNode->GetStartNodeType();
602  if(SwTableBoxStartNode == eType)
603  {
604  if( pAny )
605  {
606  const SwTableNode* pTableNode = pSttNode->FindTableNode();
607  SwFrameFormat* pTableFormat = pTableNode->GetTable().GetFrameFormat();
608  //SwTable& rTable = static_cast<SwTableNode*>(pSttNode)->GetTable();
609  if(FN_UNO_TEXT_TABLE == rEntry.nWID)
610  {
611  uno::Reference< XTextTable > xTable = SwXTextTables::GetObject(*pTableFormat);
612  *pAny <<= xTable;
613  }
614  else
615  {
616  SwTableBox* pBox = pSttNode->GetTableBox();
617  uno::Reference< XCell > xCell = SwXCell::CreateXCell(pTableFormat, pBox);
618  *pAny <<= xCell;
619  }
620  }
621  }
622  else
623  eNewState = PropertyState_DEFAULT_VALUE;
624  }
625  break;
626  case FN_UNO_TEXT_FRAME:
627  {
628  SwStartNode* pSttNode = rPam.GetNode().StartOfSectionNode();
629  SwStartNodeType eType = pSttNode->GetStartNodeType();
630 
631  SwFrameFormat* pFormat;
632  if(eType == SwFlyStartNode && nullptr != (pFormat = pSttNode->GetFlyFormat()))
633  {
634  if( pAny )
635  {
636  uno::Reference<XTextFrame> const xFrame(
637  SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat));
638  (*pAny) <<= xFrame;
639  }
640  }
641  else
642  eNewState = PropertyState_DEFAULT_VALUE;
643  }
644  break;
645  case FN_UNO_TEXT_SECTION:
646  {
647  SwSection* pSect = SwDoc::GetCurrSection(*rPam.GetPoint());
648  if(pSect)
649  {
650  if( pAny )
651  {
652  uno::Reference< XTextSection > xSect = SwXTextSections::GetObject( *pSect->GetFormat() );
653  *pAny <<= xSect;
654  }
655  }
656  else
657  eNewState = PropertyState_DEFAULT_VALUE;
658  }
659  break;
661  {
662  SwTextNode* pTextNode = rPam.GetPoint()->nNode.GetNode().GetTextNode();
663  if (pTextNode)
664  {
665  if (pAny)
666  {
667  uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
668  *pAny <<= xParagraph;
669  }
670  }
671  else
672  eNewState = PropertyState_DEFAULT_VALUE;
673  }
674  break;
675  case FN_UNO_ENDNOTE:
676  case FN_UNO_FOOTNOTE:
677  {
678  SwTextAttr *const pTextAttr = rPam.GetNode().IsTextNode() ?
680  rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN) : nullptr;
681  if(pTextAttr)
682  {
683  const SwFormatFootnote& rFootnote = pTextAttr->GetFootnote();
684  if(rFootnote.IsEndNote() == (FN_UNO_ENDNOTE == rEntry.nWID))
685  {
686  if( pAny )
687  {
688  const uno::Reference< text::XFootnote > xFootnote =
690  &const_cast<SwFormatFootnote&>(rFootnote));
691  *pAny <<= xFootnote;
692  }
693  }
694  else
695  eNewState = PropertyState_DEFAULT_VALUE;
696  }
697  else
698  eNewState = PropertyState_DEFAULT_VALUE;
699  }
700  break;
702  {
703  std::vector<SwTextAttr *> marks;
704  if (rPam.GetNode().IsTextNode())
705  {
706  marks = rPam.GetNode().GetTextNode()->GetTextAttrsAt(
708  }
709  if (!marks.empty())
710  {
711  if( pAny )
712  { // hmm... can only return 1 here
713  const SwFormatRefMark& rRef = (*marks.begin())->GetRefMark();
714  uno::Reference<XTextContent> const xRef =
716  const_cast<SwFormatRefMark*>(&rRef));
717  *pAny <<= xRef;
718  }
719  }
720  else
721  eNewState = PropertyState_DEFAULT_VALUE;
722  }
723  break;
725  {
726  uno::Reference<XTextContent> const xRet(rPam.GetNode().IsTextNode()
728  rPam.GetPoint()->nContent.GetIndex(), false)
729  : nullptr);
730  if (xRet.is())
731  {
732  if (pAny)
733  {
734  (*pAny) <<= xRet;
735  }
736  }
737  else
738  {
739  eNewState = PropertyState_DEFAULT_VALUE;
740  }
741  }
742  break;
744  {
745 
746  SwTextNode *const pTextNode = rPam.GetNode().GetTextNode();
747  if (&rPam.GetNode() == &rPam.GetNode(false)
748  && pTextNode && pTextNode->GetpSwpHints())
749  {
750  sal_Int32 nPaMStart = rPam.GetPoint()->nContent.GetIndex();
751  sal_Int32 nPaMEnd = rPam.GetMark() ? rPam.GetMark()->nContent.GetIndex() : nPaMStart;
752  if(nPaMStart > nPaMEnd)
753  {
754  std::swap(nPaMStart, nPaMEnd);
755  }
756  Sequence< OUString> aCharStyles;
757  SwpHints* pHints = pTextNode->GetpSwpHints();
758  for( size_t nAttr = 0; nAttr < pHints->Count(); ++nAttr )
759  {
760  SwTextAttr* pAttr = pHints->Get( nAttr );
761  if(pAttr->Which() != RES_TXTATR_CHARFMT)
762  continue;
763  const sal_Int32 nAttrStart = pAttr->GetStart();
764  const sal_Int32 nAttrEnd = *pAttr->GetEnd();
765  //check if the attribute touches the selection
766  if( ( nAttrEnd > nPaMStart && nAttrStart < nPaMEnd ) ||
767  ( !nAttrStart && !nAttrEnd && !nPaMStart && !nPaMEnd ) )
768  {
769  //check for overlapping
770  if(nAttrStart > nPaMStart ||
771  nAttrEnd < nPaMEnd)
772  {
773  aCharStyles.realloc(0);
774  break;
775  }
776  else
777  {
778  //now the attribute should start before or at the selection
779  //and it should end at the end of the selection or behind
780  OSL_ENSURE(nAttrStart <= nPaMStart && nAttrEnd >=nPaMEnd,
781  "attribute overlaps or is outside");
782  //now the name of the style has to be added to the sequence
783  aCharStyles.realloc(aCharStyles.getLength() + 1);
784  OSL_ENSURE(pAttr->GetCharFormat().GetCharFormat(), "no character format set");
785  aCharStyles.getArray()[aCharStyles.getLength() - 1] =
788  }
789  }
790 
791  }
792  eNewState =
793  aCharStyles.hasElements() ?
794  PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
795  if(pAny)
796  (*pAny) <<= aCharStyles;
797  }
798  else
799  eNewState = PropertyState_DEFAULT_VALUE;
800  }
801  break;
802  case RES_TXTATR_CHARFMT:
803  // no break here!
804  default: bDone = false;
805  }
806  if( bDone )
807  eState = eNewState;
808  return bDone;
809 };
810 
811 sal_Int16 IsNodeNumStart(SwPaM const & rPam, PropertyState& eState)
812 {
813  const SwTextNode* pTextNd = rPam.GetNode().GetTextNode();
814  // correction: check, if restart value is set at the text node and use
815  // new method <SwTextNode::GetAttrListRestartValue()> to retrieve the value
816  if ( pTextNd && pTextNd->GetNumRule() && pTextNd->IsListRestart() &&
817  pTextNd->HasAttrListRestartValue() )
818  {
819  eState = PropertyState_DIRECT_VALUE;
820  sal_Int16 nTmp = sal::static_int_cast< sal_Int16 >(pTextNd->GetAttrListRestartValue());
821  return nTmp;
822  }
823  eState = PropertyState_DEFAULT_VALUE;
824  return -1;
825 }
826 
827 void setNumberingProperty(const Any& rValue, SwPaM& rPam)
828 {
829  uno::Reference<XIndexReplace> xIndexReplace;
830  if(rValue >>= xIndexReplace)
831  {
832  auto pSwNum = comphelper::getUnoTunnelImplementation<SwXNumberingRules>(xIndexReplace);
833  if(pSwNum)
834  {
835  SwDoc& rDoc = rPam.GetDoc();
836  if(pSwNum->GetNumRule())
837  {
838  SwNumRule aRule(*pSwNum->GetNumRule());
839  const OUString* pNewCharStyles = pSwNum->GetNewCharStyleNames();
840  const OUString* pBulletFontNames = pSwNum->GetBulletFontNames();
841  for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
842  {
843  SwNumFormat aFormat(aRule.Get( i ));
844  if (!pNewCharStyles[i].isEmpty() &&
845  !SwXNumberingRules::isInvalidStyle(pNewCharStyles[i]) &&
846  (!aFormat.GetCharFormat() || pNewCharStyles[i] != aFormat.GetCharFormat()->GetName()))
847  {
848  if (pNewCharStyles[i].isEmpty())
849  {
850  // FIXME
851  // Is something missing/wrong here?
852  // if condition is always false due to outer check!
853  aFormat.SetCharFormat(nullptr);
854  }
855  else
856  {
857 
858  // get CharStyle and set the rule
859  const size_t nChCount = rDoc.GetCharFormats()->size();
860  SwCharFormat* pCharFormat = nullptr;
861  for(size_t nCharFormat = 0; nCharFormat < nChCount; ++nCharFormat)
862  {
863  SwCharFormat& rChFormat = *((*(rDoc.GetCharFormats()))[nCharFormat]);
864  if(rChFormat.GetName() == pNewCharStyles[i])
865  {
866  pCharFormat = &rChFormat;
867  break;
868  }
869  }
870 
871  if(!pCharFormat)
872  {
874  SfxStyleSheetBase* pBase;
875  pBase = pPool->Find(pNewCharStyles[i], SfxStyleFamily::Char);
876  // shall it really be created?
877  if(!pBase)
878  pBase = &pPool->Make(pNewCharStyles[i], SfxStyleFamily::Page);
879  pCharFormat = static_cast<SwDocStyleSheet*>(pBase)->GetCharFormat();
880  }
881  if(pCharFormat)
882  aFormat.SetCharFormat(pCharFormat);
883  }
884  }
885  //Now again for fonts
886  if(
887  !pBulletFontNames[i].isEmpty() &&
888  !SwXNumberingRules::isInvalidStyle(pBulletFontNames[i]) &&
889  (!aFormat.GetBulletFont() || aFormat.GetBulletFont()->GetFamilyName() != pBulletFontNames[i])
890  )
891  {
892  const SvxFontListItem* pFontListItem =
893  static_cast<const SvxFontListItem* >(rDoc.GetDocShell()
894  ->GetItem( SID_ATTR_CHAR_FONTLIST ));
895  const FontList* pList = pFontListItem->GetFontList();
896 
897  FontMetric aFontMetric = pList->Get(
898  pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
899  vcl::Font aFont(aFontMetric);
900  aFormat.SetBulletFont(&aFont);
901  }
902  aRule.Set( i, aFormat );
903  }
904  UnoActionContext aAction(&rDoc);
905 
906  if( rPam.GetNext() != &rPam ) // Multiple selection?
907  {
909  SwPamRanges aRangeArr( rPam );
910  SwPaM aPam( *rPam.GetPoint() );
911  for ( size_t n = 0; n < aRangeArr.Count(); ++n )
912  {
913  // no start of a new list
914  rDoc.SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
915  }
916  rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
917  }
918  else
919  {
920  // no start of a new list
921  rDoc.SetNumRule( rPam, aRule, false );
922  }
923 
924  }
925  else if(!pSwNum->GetCreatedNumRuleName().isEmpty())
926  {
927  UnoActionContext aAction( &rDoc );
928  SwNumRule* pRule = rDoc.FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
929  if ( !pRule )
930  throw RuntimeException();
931  // no start of a new list
932  rDoc.SetNumRule( rPam, *pRule, false );
933  }
934  else
935  {
936  // #i103817#
937  // outline numbering
938  UnoActionContext aAction(&rDoc);
939  SwNumRule* pRule = rDoc.GetOutlineNumRule();
940  if(!pRule)
941  throw RuntimeException();
942  rDoc.SetNumRule( rPam, *pRule, false );
943  }
944  }
945  }
946  else if ( rValue.getValueType() == cppu::UnoType<void>::get() )
947  {
948  rPam.GetDoc().DelNumRules(rPam);
949  }
950 }
951 
952 void getNumberingProperty(SwPaM& rPam, PropertyState& eState, Any * pAny )
953 {
954  const SwNumRule* pNumRule = SwDoc::GetNumRuleAtPos( *rPam.GetPoint() );
955  if(pNumRule)
956  {
957  uno::Reference< XIndexReplace > xNum = new SwXNumberingRules(*pNumRule);
958  if ( pAny )
959  *pAny <<= xNum;
960  eState = PropertyState_DIRECT_VALUE;
961  }
962  else
963  eState = PropertyState_DEFAULT_VALUE;
964 }
965 
966 void GetCurPageStyle(SwPaM const & rPaM, OUString &rString)
967 {
968  if (!rPaM.GetContentNode())
969  return; // TODO: is there an easy way to get it for tables/sections?
971  // Consider the position inside the content node, since the node may span over multiple pages
972  // with different page styles.
973  SwContentFrame* pFrame = rPaM.GetContentNode()->getLayoutFrame(pLayout, rPaM.GetPoint());
974  if(pFrame)
975  {
976  const SwPageFrame* pPage = pFrame->FindPageFrame();
977  if(pPage)
978  {
981  }
982  }
983 }
984 
985 // reset special properties of the cursor
987 {
988  SwDoc& rDoc = rPam.GetDoc();
989  switch(rEntry.nWID)
990  {
991  case FN_UNO_PARA_STYLE :
992  break;
993  case FN_UNO_PAGE_STYLE :
994  break;
996  {
997  UnoActionContext aAction(&rDoc);
998 
999  if( rPam.GetNext() != &rPam ) // Multiple selection?
1000  {
1001  rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
1002  SwPamRanges aRangeArr( rPam );
1003  SwPaM aPam( *rPam.GetPoint() );
1004  for( size_t n = 0; n < aRangeArr.Count(); ++n )
1005  rDoc.SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
1006  rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
1007  }
1008  else
1009  rDoc.SetNodeNumStart( *rPam.GetPoint(), 0 );
1010  }
1011 
1012  break;
1013  case FN_UNO_NUM_LEVEL :
1014  break;
1015  case FN_UNO_NUM_RULES:
1016  break;
1018  {
1019  rDoc.ResetAttrs(rPam, true, { RES_TXTATR_CHARFMT });
1020  }
1021  break;
1022  }
1023 }
1024 
1025 void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL,
1026  const uno::Sequence< beans::PropertyValue >& rOptions)
1027 {
1028  std::unique_ptr<SfxMedium> pMed;
1029  SwDoc& rDoc = pUnoCursor->GetDoc();
1030  SwDocShell* pDocSh = rDoc.GetDocShell();
1031  utl::MediaDescriptor aMediaDescriptor( rOptions );
1032  OUString sFileName = rURL;
1033  OUString sFilterName, sFilterOptions, sPassword, sBaseURL;
1034  uno::Reference < io::XStream > xStream;
1035  uno::Reference < io::XInputStream > xInputStream;
1036 
1037  if( sFileName.isEmpty() )
1038  aMediaDescriptor[utl::MediaDescriptor::PROP_URL()] >>= sFileName;
1039  if( sFileName.isEmpty() )
1040  aMediaDescriptor[utl::MediaDescriptor::PROP_FILENAME()] >>= sFileName;
1041  aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
1042  aMediaDescriptor[utl::MediaDescriptor::PROP_STREAM()] >>= xStream;
1043  aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
1044  aMediaDescriptor[utl::MediaDescriptor::PROP_FILTERNAME()] >>= sFilterName;
1045  aMediaDescriptor[utl::MediaDescriptor::PROP_FILTEROPTIONS()] >>= sFilterOptions;
1046  aMediaDescriptor[utl::MediaDescriptor::PROP_PASSWORD()] >>= sPassword;
1047  aMediaDescriptor[utl::MediaDescriptor::PROP_DOCUMENTBASEURL() ] >>= sBaseURL;
1048  if ( !xInputStream.is() && xStream.is() )
1049  xInputStream = xStream->getInputStream();
1050 
1051  if(!pDocSh || (sFileName.isEmpty() && !xInputStream.is()))
1052  return;
1053 
1054  SfxObjectFactory& rFact = pDocSh->GetFactory();
1055  std::shared_ptr<const SfxFilter> pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( sFilterName );
1056  uno::Reference < embed::XStorage > xReadStorage;
1057  if( xInputStream.is() )
1058  {
1059  uno::Sequence< uno::Any > aArgs( 2 );
1060  aArgs[0] <<= xInputStream;
1061  aArgs[1] <<= 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  std::vector<sal_uInt16> aWhichPairs;
1293  std::vector<SfxItemPropertySimpleEntry 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  SfxItemPropertySimpleEntry 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.push_back(RES_PARATR_NUMRULE);
1315  aWhichPairs.push_back(RES_PARATR_NUMRULE);
1316  nNumId = aEntries.size();
1317  }
1318  else
1319  {
1320  // FIXME: we should have some nice way of merging ranges surely ?
1321  aWhichPairs.push_back(pEntry->nWID);
1322  aWhichPairs.push_back(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  aWhichPairs.push_back(0); // terminate
1335  SfxItemSet aItemSet(rDoc.GetAttrPool(), aWhichPairs.data());
1336 
1337  for (size_t i = 0; i < aEntries.size(); ++i)
1338  {
1339  SfxItemPropertySimpleEntry const*const pEntry = aEntries[i];
1340  const uno::Any &rValue = aValues[i];
1341  if (i == nNumId)
1342  {
1343  uno::Reference<container::XNamed> xNumberingRules;
1344  rValue >>= xNumberingRules;
1345  if (xNumberingRules.is())
1346  {
1347  aItemSet.Put( SwNumRuleItem( xNumberingRules->getName() ));
1348  // keep it during export
1349  SwNumRule* pRule = rDoc.FindNumRulePtr(
1350  xNumberingRules->getName());
1351  if (pRule)
1352  pRule->SetUsedByRedline(true);
1353  }
1354  }
1355  else
1356  {
1357  rPropSet.setPropertyValue(*pEntry, rValue, aItemSet);
1358  if (i == nStyleId)
1359  rValue >>= sParaStyleName;
1360  }
1361  }
1362 
1363  if (eType == RedlineType::ParagraphFormat && sParaStyleName.isEmpty())
1364  nStylePoolId = RES_POOLCOLL_STANDARD;
1365 
1366  xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( sParaStyleName, nStylePoolId, &aItemSet ));
1367  }
1368  else if (eType == RedlineType::ParagraphFormat)
1369  xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", RES_POOLCOLL_STANDARD, nullptr ));
1370  }
1371  }
1372 
1373  SwRangeRedline* pRedline = new SwRangeRedline( aRedlineData, rPaM );
1374  RedlineFlags nPrevMode = rRedlineAccess.GetRedlineFlags( );
1375  // xRedlineExtraData is copied here
1376  pRedline->SetExtraData( xRedlineExtraData.get() );
1377 
1378  rRedlineAccess.SetRedlineFlags_intern(RedlineFlags::On);
1379  auto const result(rRedlineAccess.AppendRedline(pRedline, false));
1380  rRedlineAccess.SetRedlineFlags_intern( nPrevMode );
1382  throw lang::IllegalArgumentException();
1383 }
1384 
1386  std::u16string_view rRedlineType,
1387  const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1388 {
1389  IDocumentRedlineAccess* pRedlineAccess = &rTableLine.GetFrameFormat()->GetDoc()->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  comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
1406  std::size_t nAuthor = 0;
1407  OUString sAuthor;
1408  if( aPropMap.getValue("RedlineAuthor") >>= sAuthor )
1409  nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
1410 
1411  OUString sComment;
1412  SwRedlineData aRedlineData( eType, nAuthor );
1413  if( aPropMap.getValue("RedlineComment") >>= sComment )
1414  aRedlineData.SetComment( sComment );
1415 
1416  ::util::DateTime aStamp;
1417  if( aPropMap.getValue("RedlineDateTime") >>= aStamp )
1418  {
1419  aRedlineData.SetTimeStamp(
1420  DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), tools::Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
1421  }
1422 
1423  SwTableRowRedline* pRedline = new SwTableRowRedline( aRedlineData, rTableLine );
1424  RedlineFlags nPrevMode = pRedlineAccess->GetRedlineFlags( );
1425  pRedline->SetExtraData( nullptr );
1426 
1427  pRedlineAccess->SetRedlineFlags_intern(RedlineFlags::On);
1428  bool bRet = pRedlineAccess->AppendTableRowRedline( pRedline );
1429  pRedlineAccess->SetRedlineFlags_intern( nPrevMode );
1430  if( !bRet )
1431  throw lang::IllegalArgumentException();
1432 }
1433 
1435  std::u16string_view rRedlineType,
1436  const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1437 {
1438  IDocumentRedlineAccess* pRedlineAccess = &rTableBox.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess();
1439 
1441  if ( rRedlineType == u"TableCellInsert" )
1442  {
1443  eType = RedlineType::TableCellInsert;
1444  }
1445  else if ( rRedlineType == u"TableCellDelete" )
1446  {
1447  eType = RedlineType::TableCellDelete;
1448  }
1449  else
1450  {
1451  throw lang::IllegalArgumentException();
1452  }
1453 
1454  comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
1455  std::size_t nAuthor = 0;
1456  OUString sAuthor;
1457  if( aPropMap.getValue("RedlineAuthor") >>= sAuthor )
1458  nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
1459 
1460  OUString sComment;
1461  SwRedlineData aRedlineData( eType, nAuthor );
1462  if( aPropMap.getValue("RedlineComment") >>= sComment )
1463  aRedlineData.SetComment( sComment );
1464 
1465  ::util::DateTime aStamp;
1466  if( aPropMap.getValue("RedlineDateTime") >>= aStamp )
1467  {
1468  aRedlineData.SetTimeStamp(
1469  DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), tools::Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
1470  }
1471 
1472  SwTableCellRedline* pRedline = new SwTableCellRedline( aRedlineData, rTableBox );
1473  RedlineFlags nPrevMode = pRedlineAccess->GetRedlineFlags( );
1474  pRedline->SetExtraData( nullptr );
1475 
1476  pRedlineAccess->SetRedlineFlags_intern(RedlineFlags::On);
1477  bool bRet = pRedlineAccess->AppendTableCellRedline( pRedline );
1478  pRedlineAccess->SetRedlineFlags_intern( nPrevMode );
1479  if( !bRet )
1480  throw lang::IllegalArgumentException();
1481 }
1482 
1483 void SwAnyMapHelper::SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& rAny )
1484 {
1485  sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
1486  m_Map[nKey] = rAny;
1487 }
1488 
1489 bool SwAnyMapHelper::FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& pAny )
1490 {
1491  bool bRet = false;
1492  sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
1493  auto aIt = m_Map.find( nKey );
1494  if (aIt != m_Map.end())
1495  {
1496  pAny = & aIt->second;
1497  bRet = true;
1498  }
1499  return bRet;
1500 }
1501 
1502 }//namespace SwUnoCursorHelper
1503 
1504 /* 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:553
const SfxItemPropertySimpleEntry * getByName(std::u16string_view rName) const
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
#define FN_UNO_DOCUMENT_INDEX_MARK
Definition: cmdid.h:525
#define FN_UNO_CELL
Definition: cmdid.h:529
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:3956
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
SwDocShell * GetDocShell()
Definition: doc.hxx:1354
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:219
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: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:1212
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:4381
static const OUString & PROP_FILTERNAME()
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
Definition: unomap1.cxx:1059
Definition: doc.hxx:187
void resetCursorPropertyValue(const SfxItemPropertySimpleEntry &rEntry, SwPaM &rPam)
bool getCursorPropertyValue(const SfxItemPropertySimpleEntry &rEntry, SwPaM &rPam, Any *pAny, PropertyState &eState, const SwTextNode *pNode)
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:549
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 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:1227
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:1730
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:4128
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:4105
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:203
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4021
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:186
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:3049
css::uno::Any const & rValue
sal_uInt16 sal_Unicode
#define PROPERTY_MAP_CHAR_AUTO_STYLE
Definition: unomap.hxx:120
#define FN_UNO_PARA_NUM_AUTO_FORMAT
Definition: cmdid.h:520
#define FN_UNO_ENDNOTE
Definition: cmdid.h:534
#define FN_UNO_LIST_ID
Definition: cmdid.h:605
Reference< XInputStream > xStream
SwIndex nContent
Definition: pam.hxx:38
#define FN_UNO_DOCUMENT_INDEX
Definition: cmdid.h:526
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
static SwNumRule * GetNumRuleAtPos(SwPosition &rPos, SwRootFrame const *pLayout=nullptr)
Definition: docnum.cxx:2386
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:95
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:501
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:562
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
static SwXCell * CreateXCell(SwFrameFormat *pTableFormat, SwTableBox *pBox, SwTable *pTable=nullptr)
Definition: unotbl.cxx:1140
#define FN_UNO_IS_NUMBER
Definition: cmdid.h:565
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:1324
void SetNodeNumStart(const SwPosition &rPos, sal_uInt16 nStt)
Definition: docnum.cxx:1024
FlyCntType GetFlyCntType() const
Definition: unoframe.hxx:157
#define FN_UNO_PAGE_STYLE
Definition: cmdid.h:518
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:2415
static SwTable * FindTable(SwFrameFormat const *const pFormat)
Definition: swtable.cxx:1906
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:1161
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:612
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
SwPageFrame * FindPageFrame()
Definition: frame.hxx:663
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:127
SwContentNode * GetContentNode()
Definition: node.hxx:619
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
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1139
WEIGHT_NORMAL
float u
size_t size() const
Definition: docary.hxx:84
static css::uno::Reference< css::text::XDocumentIndexMark > CreateXDocumentIndexMark(SwDoc &rDoc, SwTOXMark *pMark, TOXTypes eType=TOX_INDEX)
Definition: unoidx.cxx:1627
const SfxItemPropertyMap & getPropertyMap() const
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2812
dictionary props
static css::uno::Reference< css::text::XDocumentIndex > CreateXDocumentIndex(SwDoc &rDoc, SwTOXBaseSection *pSection, TOXTypes eTypes=TOX_INDEX)
Definition: unoidx.cxx:399
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:373
void setPropertyValue(const SfxItemPropertySimpleEntry &rEntry, const css::uno::Any &aVal, SfxItemSet &rSet) const
Marks a node in the document model.
Definition: ndindex.hxx:31
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:431
css::uno::Type const & get()
static css::uno::Reference< css::text::XTextTable > GetObject(SwFrameFormat &rFormat)
Definition: unocoll.cxx:982
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, const bool bIncludeInputFieldAtStart=false) const
Definition: ndtxt.cxx:1774
Reader * StartConvertFrom(SfxMedium &rMedium, SwReaderPtr &rpRdr, SwCursorShell const *pCursorSh=nullptr, SwPaM *pPaM=nullptr)
For inserting document.
Definition: docsh.cxx:137
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:522
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:41
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:532
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
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange,::sw::TextRangeMode const eMode)
Definition: unoobj2.cxx:1100
EXPAND : (Start < nIndex <= End)
Definition: ndtxt.hxx:364
bool IsControlChar(sal_Unicode cChar)
DEFAULT: (Start <= nIndex < End)
Definition: ndtxt.hxx:363
virtual const SwPaM * GetPaM() const =0
#define FN_UNO_TEXT_FIELD
Definition: cmdid.h:527
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:80
virtual bool AppendTableRowRedline(SwTableRowRedline *pPtr)=0
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:62
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:445
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:524
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:740
#define FN_NUMBER_NEWSTART
Definition: cmdid.h:458
SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const
Definition: ndtxt.cxx:4182
#define FN_UNO_CHARFMT_SEQUENCE
Definition: cmdid.h:589
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:254
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:531
#define SAL_INFO(area, stream)
sal_Int32 GetIndex() const
Definition: index.hxx:91
bool IsCountedInList() const
Definition: ndtxt.cxx:4243
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
SwNodes & GetNodes()
Definition: doc.hxx:408
SdrObject * GetSdrObject() const
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3193
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:392
const SwUnoCursor * GetTableCursor() const
Definition: unotbl.cxx:3837
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:87
#define FN_UNO_TEXT_FRAME
Definition: cmdid.h:530
::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: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)
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:3120
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:1721
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:456
bool IsInList() const
Definition: ndtxt.cxx:4347
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:246
RedlineType
virtual SwUnoCursor * GetCursor()=0
#define FN_UNO_TEXT_TABLE
Definition: cmdid.h:528
#define FN_UNO_NUM_LEVEL
Definition: cmdid.h:523
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:1017
static css::uno::Reference< css::text::XTextSection > GetObject(SwSectionFormat &rFormat)
Definition: unocoll.cxx:1526
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:854
bool HasAttrListRestartValue() const
Definition: ndtxt.cxx:4177
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:533
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
const sal_Int32 COMPLETE_STRING
Definition: swtypes.hxx:61
#define FN_UNO_PARA_STYLE
Definition: cmdid.h:517
GetTextAttrMode
Definition: ndtxt.hxx:361
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1321
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:846
SwFrameFormat * GetFrameFormat() const
Definition: unotbl.hxx:146
sal_Int16 nValue
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1026
static const OUString & GetProgName(const OUString &rName, SwGetPoolIdFromName)
SW_DLLPUBLIC SwFrameFormat * GetFrameFormat()
Definition: unotbl.cxx:2026