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* pDoc = 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 = pDoc->GetCharFormats()->size();
860  SwCharFormat* pCharFormat = nullptr;
861  for(size_t nCharFormat = 0; nCharFormat < nChCount; ++nCharFormat)
862  {
863  SwCharFormat& rChFormat = *((*(pDoc->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* >(pDoc->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(pDoc);
905 
906  if( rPam.GetNext() != &rPam ) // Multiple selection?
907  {
908  pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
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  pDoc->SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
915  }
916  pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
917  }
918  else
919  {
920  // no start of a new list
921  pDoc->SetNumRule( rPam, aRule, false );
922  }
923 
924  }
925  else if(!pSwNum->GetCreatedNumRuleName().isEmpty())
926  {
927  UnoActionContext aAction( pDoc );
928  SwNumRule* pRule = pDoc->FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
929  if ( !pRule )
930  throw RuntimeException();
931  // no start of a new list
932  pDoc->SetNumRule( rPam, *pRule, false );
933  }
934  else
935  {
936  // #i103817#
937  // outline numbering
938  UnoActionContext aAction(pDoc);
939  SwNumRule* pRule = pDoc->GetOutlineNumRule();
940  if(!pRule)
941  throw RuntimeException();
942  pDoc->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* pDoc = 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(pDoc);
998 
999  if( rPam.GetNext() != &rPam ) // Multiple selection?
1000  {
1001  pDoc->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  pDoc->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
1006  pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
1007  }
1008  else
1009  pDoc->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  std::set<sal_uInt16> aWhichIds;
1020  aWhichIds.insert( RES_TXTATR_CHARFMT);
1021  pDoc->ResetAttrs(rPam, true, aWhichIds);
1022  }
1023  break;
1024  }
1025 }
1026 
1027 void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL,
1028  const uno::Sequence< beans::PropertyValue >& rOptions)
1029 {
1030  std::unique_ptr<SfxMedium> pMed;
1031  SwDoc* pDoc = pUnoCursor->GetDoc();
1032  SwDocShell* pDocSh = pDoc->GetDocShell();
1033  utl::MediaDescriptor aMediaDescriptor( rOptions );
1034  OUString sFileName = rURL;
1035  OUString sFilterName, sFilterOptions, sPassword, sBaseURL;
1036  uno::Reference < io::XStream > xStream;
1037  uno::Reference < io::XInputStream > xInputStream;
1038 
1039  if( sFileName.isEmpty() )
1040  aMediaDescriptor[utl::MediaDescriptor::PROP_URL()] >>= sFileName;
1041  if( sFileName.isEmpty() )
1042  aMediaDescriptor[utl::MediaDescriptor::PROP_FILENAME()] >>= sFileName;
1043  aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
1044  aMediaDescriptor[utl::MediaDescriptor::PROP_STREAM()] >>= xStream;
1045  aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
1046  aMediaDescriptor[utl::MediaDescriptor::PROP_FILTERNAME()] >>= sFilterName;
1047  aMediaDescriptor[utl::MediaDescriptor::PROP_FILTEROPTIONS()] >>= sFilterOptions;
1048  aMediaDescriptor[utl::MediaDescriptor::PROP_PASSWORD()] >>= sPassword;
1049  aMediaDescriptor[utl::MediaDescriptor::PROP_DOCUMENTBASEURL() ] >>= sBaseURL;
1050  if ( !xInputStream.is() && xStream.is() )
1051  xInputStream = xStream->getInputStream();
1052 
1053  if(!pDocSh || (sFileName.isEmpty() && !xInputStream.is()))
1054  return;
1055 
1056  SfxObjectFactory& rFact = pDocSh->GetFactory();
1057  std::shared_ptr<const SfxFilter> pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( sFilterName );
1058  uno::Reference < embed::XStorage > xReadStorage;
1059  if( xInputStream.is() )
1060  {
1061  uno::Sequence< uno::Any > aArgs( 2 );
1062  aArgs[0] <<= xInputStream;
1063  aArgs[1] <<= embed::ElementModes::READ;
1064  try
1065  {
1066  xReadStorage.set( ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ),
1067  uno::UNO_QUERY );
1068  }
1069  catch( const io::IOException&) {}
1070  }
1071  if ( !pFilter )
1072  {
1073  if( xInputStream.is() && !xReadStorage.is())
1074  {
1075  pMed.reset(new SfxMedium);
1076  pMed->setStreamToLoadFrom(xInputStream, true );
1077  }
1078  else
1079  pMed.reset(xReadStorage.is() ?
1080  new SfxMedium(xReadStorage, sBaseURL ) :
1081  new SfxMedium(sFileName, StreamMode::READ ));
1082  if( !sBaseURL.isEmpty() )
1083  pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
1084 
1085  SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
1086  ErrCode nErr = aMatcher.GuessFilter(*pMed, pFilter, SfxFilterFlags::NONE);
1087  if ( nErr || !pFilter)
1088  return;
1089  pMed->SetFilter( pFilter );
1090  }
1091  else
1092  {
1093  if( xInputStream.is() && !xReadStorage.is())
1094  {
1095  pMed.reset(new SfxMedium);
1096  pMed->setStreamToLoadFrom(xInputStream, true );
1097  pMed->SetFilter( pFilter );
1098  }
1099  else
1100  {
1101  if( xReadStorage.is() )
1102  {
1103  pMed.reset(new SfxMedium(xReadStorage, sBaseURL ));
1104  pMed->SetFilter( pFilter );
1105  }
1106  else
1107  pMed.reset(new SfxMedium(sFileName, StreamMode::READ, pFilter, nullptr));
1108  }
1109  if(!sFilterOptions.isEmpty())
1110  pMed->GetItemSet()->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sFilterOptions ) );
1111  if(!sBaseURL.isEmpty())
1112  pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
1113  }
1114 
1115  // this sourcecode is not responsible for the lifetime of the shell, SfxObjectShellLock should not be used
1116  SfxObjectShellRef aRef( pDocSh );
1117 
1118  pMed->Download(); // if necessary: start the download
1119  if( !(aRef.is() && 1 < aRef->GetRefCount()) ) // Ref still valid?
1120  return;
1121 
1122  SwReaderPtr pRdr;
1123  SfxItemSet* pSet = pMed->GetItemSet();
1124  pSet->Put(SfxBoolItem(FN_API_CALL, true));
1125  if(!sPassword.isEmpty())
1126  pSet->Put(SfxStringItem(SID_PASSWORD, sPassword));
1127  Reader *pRead = pDocSh->StartConvertFrom( *pMed, pRdr, nullptr, pUnoCursor);
1128  if( !pRead )
1129  return;
1130 
1131  UnoActionContext aContext(pDoc);
1132 
1133  if(pUnoCursor->HasMark())
1134  pDoc->getIDocumentContentOperations().DeleteAndJoin(*pUnoCursor);
1135 
1136  SwNodeIndex aSave( pUnoCursor->GetPoint()->nNode, -1 );
1137  sal_Int32 nContent = pUnoCursor->GetPoint()->nContent.GetIndex();
1138 
1139  ErrCode nErrno = pRdr->Read( *pRead ); // and paste the document
1140 
1141  if(!nErrno)
1142  {
1143  ++aSave;
1144  pUnoCursor->SetMark();
1145  pUnoCursor->GetMark()->nNode = aSave;
1146 
1147  SwContentNode* pCntNode = aSave.GetNode().GetContentNode();
1148  if( !pCntNode )
1149  nContent = 0;
1150  pUnoCursor->GetMark()->nContent.Assign( pCntNode, nContent );
1151  }
1152 }
1153 
1154 // insert text and scan for CR characters in order to insert
1155 // paragraph breaks at those positions by calling SplitNode
1157  SwDoc &rDoc,
1158  const SwPaM &rNewCursor,
1159  const OUString &rText,
1160  const bool bForceExpandHints )
1161 {
1162  bool bOK = true;
1163 
1164  for (sal_Int32 i = 0; i < rText.getLength(); ++i)
1165  {
1166  sal_Unicode const ch(rText[i]);
1168  && ch != '\r' && ch != '\n' && ch != '\t')
1169  {
1170  SAL_WARN("sw.uno", "DocInsertStringSplitCR: refusing to insert control character " << int(ch));
1171  return false;
1172  }
1173  }
1174 
1175  const SwInsertFlags nInsertFlags =
1176  bForceExpandHints
1179 
1180  // grouping done in InsertString is intended for typing, not API calls
1181  ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
1182  SwTextNode* const pTextNd =
1183  rNewCursor.GetPoint()->nNode.GetNode().GetTextNode();
1184  if (!pTextNd)
1185  {
1186  SAL_INFO("sw.uno", "DocInsertStringSplitCR: need a text node");
1187  return false;
1188  }
1189  OUString aText;
1190  sal_Int32 nStartIdx = 0;
1191  const sal_Int32 nMaxLength = COMPLETE_STRING - pTextNd->GetText().getLength();
1192 
1193  sal_Int32 nIdx = rText.indexOf( '\r', nStartIdx );
1194  if( ( nIdx == -1 && nMaxLength < rText.getLength() ) ||
1195  ( nIdx != -1 && nMaxLength < nIdx ) )
1196  {
1197  nIdx = nMaxLength;
1198  }
1199  while (nIdx != -1 )
1200  {
1201  OSL_ENSURE( nIdx - nStartIdx >= 0, "index negative!" );
1202  aText = rText.copy( nStartIdx, nIdx - nStartIdx );
1203  if (!aText.isEmpty() &&
1204  !rDoc.getIDocumentContentOperations().InsertString( rNewCursor, aText, nInsertFlags ))
1205  {
1206  OSL_FAIL( "Doc->Insert(Str) failed." );
1207  bOK = false;
1208  }
1209  if (!rDoc.getIDocumentContentOperations().SplitNode( *rNewCursor.GetPoint(), false ) )
1210  {
1211  OSL_FAIL( "SplitNode failed" );
1212  bOK = false;
1213  }
1214  nStartIdx = nIdx + 1;
1215  nIdx = rText.indexOf( '\r', nStartIdx );
1216  }
1217  aText = rText.copy( nStartIdx );
1218  if (!aText.isEmpty() &&
1219  !rDoc.getIDocumentContentOperations().InsertString( rNewCursor, aText, nInsertFlags ))
1220  {
1221  OSL_FAIL( "Doc->Insert(Str) failed." );
1222  bOK = false;
1223  }
1224 
1225  return bOK;
1226 }
1227 
1228 void makeRedline( SwPaM const & rPaM,
1229  const OUString& rRedlineType,
1230  const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1231 {
1232  IDocumentRedlineAccess* pRedlineAccess = &rPaM.GetDoc()->getIDocumentRedlineAccess();
1233 
1235  if ( rRedlineType == "Insert" )
1236  eType = RedlineType::Insert;
1237  else if ( rRedlineType == "Delete" )
1238  eType = RedlineType::Delete;
1239  else if ( rRedlineType == "Format" )
1240  eType = RedlineType::Format;
1241  else if ( rRedlineType == "TextTable" )
1242  eType = RedlineType::Table;
1243  else if ( rRedlineType == "ParagraphFormat" )
1244  eType = RedlineType::ParagraphFormat;
1245  else
1246  throw lang::IllegalArgumentException();
1247 
1248  //todo: what about REDLINE_FMTCOLL?
1249  comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
1250  std::size_t nAuthor = 0;
1251  OUString sAuthor;
1252  if( aPropMap.getValue("RedlineAuthor") >>= sAuthor )
1253  nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
1254 
1255  OUString sComment;
1256  SwRedlineData aRedlineData( eType, nAuthor );
1257  if( aPropMap.getValue("RedlineComment") >>= sComment )
1258  aRedlineData.SetComment( sComment );
1259 
1260  ::util::DateTime aStamp;
1261  if( aPropMap.getValue("RedlineDateTime") >>= aStamp )
1262  {
1263  aRedlineData.SetTimeStamp( DateTime( aStamp));
1264  }
1265 
1266  std::unique_ptr<SwRedlineExtraData_FormatColl> xRedlineExtraData;
1267 
1268  // Read the 'Redline Revert Properties' from the parameters
1269  uno::Sequence< beans::PropertyValue > aRevertProperties;
1270  // Check if the value exists
1271  if ( aPropMap.getValue("RedlineRevertProperties") >>= aRevertProperties )
1272  {
1273  int nMap = 0;
1274  // Make sure that paragraph format gets its own map, otherwise e.g. fill attributes are not preserved.
1275  if (eType == RedlineType::ParagraphFormat)
1276  {
1277  nMap = PROPERTY_MAP_PARAGRAPH;
1278  if (!aRevertProperties.hasElements())
1279  {
1280  // to reject the paragraph style change, use standard style
1281  xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", RES_POOLCOLL_STANDARD, nullptr ));
1282  }
1283  }
1284  else
1286  SfxItemPropertySet const& rPropSet = *aSwMapProvider.GetPropertySet(nMap);
1287 
1288  // Check if there are any properties
1289  if (aRevertProperties.hasElements())
1290  {
1291  SwDoc *const pDoc = rPaM.GetDoc();
1292 
1293  // Build set of attributes we want to fetch
1294  std::vector<sal_uInt16> aWhichPairs;
1295  std::vector<SfxItemPropertySimpleEntry const*> aEntries;
1296  std::vector<uno::Any> aValues;
1297  aEntries.reserve(aRevertProperties.getLength());
1298  sal_uInt16 nStyleId = USHRT_MAX;
1299  sal_uInt16 nNumId = USHRT_MAX;
1300  for (const auto& rRevertProperty : std::as_const(aRevertProperties))
1301  {
1302  const OUString &rPropertyName = rRevertProperty.Name;
1303  SfxItemPropertySimpleEntry const* pEntry = rPropSet.getPropertyMap().getByName(rPropertyName);
1304 
1305  if (!pEntry)
1306  {
1307  // unknown property
1308  break;
1309  }
1310  else if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
1311  {
1312  break;
1313  }
1314  else if (rPropertyName == "NumberingRules")
1315  {
1316  aWhichPairs.push_back(RES_PARATR_NUMRULE);
1317  aWhichPairs.push_back(RES_PARATR_NUMRULE);
1318  nNumId = aEntries.size();
1319  }
1320  else
1321  {
1322  // FIXME: we should have some nice way of merging ranges surely ?
1323  aWhichPairs.push_back(pEntry->nWID);
1324  aWhichPairs.push_back(pEntry->nWID);
1325  if (rPropertyName == "ParaStyleName")
1326  nStyleId = aEntries.size();
1327  }
1328  aEntries.push_back(pEntry);
1329  aValues.push_back(rRevertProperty.Value);
1330  }
1331 
1332  if (!aWhichPairs.empty())
1333  {
1334  sal_uInt16 nStylePoolId = USHRT_MAX;
1335  OUString sParaStyleName;
1336  aWhichPairs.push_back(0); // terminate
1337  SfxItemSet aItemSet(pDoc->GetAttrPool(), aWhichPairs.data());
1338 
1339  for (size_t i = 0; i < aEntries.size(); ++i)
1340  {
1341  SfxItemPropertySimpleEntry const*const pEntry = aEntries[i];
1342  const uno::Any &rValue = aValues[i];
1343  if (i == nNumId)
1344  {
1345  uno::Reference<container::XNamed> xNumberingRules;
1346  rValue >>= xNumberingRules;
1347  if (xNumberingRules.is())
1348  {
1349  aItemSet.Put( SwNumRuleItem( xNumberingRules->getName() ));
1350  // keep it during export
1351  SwNumRule* pRule = pDoc->FindNumRulePtr(
1352  xNumberingRules->getName());
1353  if (pRule)
1354  pRule->SetUsedByRedline(true);
1355  }
1356  }
1357  else
1358  {
1359  rPropSet.setPropertyValue(*pEntry, rValue, aItemSet);
1360  if (i == nStyleId)
1361  rValue >>= sParaStyleName;
1362  }
1363  }
1364 
1365  if (eType == RedlineType::ParagraphFormat && sParaStyleName.isEmpty())
1366  nStylePoolId = RES_POOLCOLL_STANDARD;
1367 
1368  xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( sParaStyleName, nStylePoolId, &aItemSet ));
1369  }
1370  else if (eType == RedlineType::ParagraphFormat)
1371  xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", RES_POOLCOLL_STANDARD, nullptr ));
1372  }
1373  }
1374 
1375  SwRangeRedline* pRedline = new SwRangeRedline( aRedlineData, rPaM );
1376  RedlineFlags nPrevMode = pRedlineAccess->GetRedlineFlags( );
1377  // xRedlineExtraData is copied here
1378  pRedline->SetExtraData( xRedlineExtraData.get() );
1379 
1380  pRedlineAccess->SetRedlineFlags_intern(RedlineFlags::On);
1381  auto const result(pRedlineAccess->AppendRedline(pRedline, false));
1382  pRedlineAccess->SetRedlineFlags_intern( nPrevMode );
1384  throw lang::IllegalArgumentException();
1385 }
1386 
1388  const OUString& rRedlineType,
1389  const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1390 {
1391  IDocumentRedlineAccess* pRedlineAccess = &rTableLine.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess();
1392 
1394  if ( rRedlineType == "TableRowInsert" )
1395  {
1396  eType = RedlineType::TableRowInsert;
1397  }
1398  else if ( rRedlineType == "TableRowDelete" )
1399  {
1400  eType = RedlineType::TableRowDelete;
1401  }
1402  else
1403  {
1404  throw lang::IllegalArgumentException();
1405  }
1406 
1407  comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
1408  std::size_t nAuthor = 0;
1409  OUString sAuthor;
1410  if( aPropMap.getValue("RedlineAuthor") >>= sAuthor )
1411  nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
1412 
1413  OUString sComment;
1414  SwRedlineData aRedlineData( eType, nAuthor );
1415  if( aPropMap.getValue("RedlineComment") >>= sComment )
1416  aRedlineData.SetComment( sComment );
1417 
1418  ::util::DateTime aStamp;
1419  if( aPropMap.getValue("RedlineDateTime") >>= aStamp )
1420  {
1421  aRedlineData.SetTimeStamp(
1422  DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), tools::Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
1423  }
1424 
1425  SwTableRowRedline* pRedline = new SwTableRowRedline( aRedlineData, rTableLine );
1426  RedlineFlags nPrevMode = pRedlineAccess->GetRedlineFlags( );
1427  pRedline->SetExtraData( nullptr );
1428 
1429  pRedlineAccess->SetRedlineFlags_intern(RedlineFlags::On);
1430  bool bRet = pRedlineAccess->AppendTableRowRedline( pRedline );
1431  pRedlineAccess->SetRedlineFlags_intern( nPrevMode );
1432  if( !bRet )
1433  throw lang::IllegalArgumentException();
1434 }
1435 
1437  const OUString& rRedlineType,
1438  const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1439 {
1440  IDocumentRedlineAccess* pRedlineAccess = &rTableBox.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess();
1441 
1443  if ( rRedlineType == "TableCellInsert" )
1444  {
1445  eType = RedlineType::TableCellInsert;
1446  }
1447  else if ( rRedlineType == "TableCellDelete" )
1448  {
1449  eType = RedlineType::TableCellDelete;
1450  }
1451  else
1452  {
1453  throw lang::IllegalArgumentException();
1454  }
1455 
1456  comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
1457  std::size_t nAuthor = 0;
1458  OUString sAuthor;
1459  if( aPropMap.getValue("RedlineAuthor") >>= sAuthor )
1460  nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
1461 
1462  OUString sComment;
1463  SwRedlineData aRedlineData( eType, nAuthor );
1464  if( aPropMap.getValue("RedlineComment") >>= sComment )
1465  aRedlineData.SetComment( sComment );
1466 
1467  ::util::DateTime aStamp;
1468  if( aPropMap.getValue("RedlineDateTime") >>= aStamp )
1469  {
1470  aRedlineData.SetTimeStamp(
1471  DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), tools::Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
1472  }
1473 
1474  SwTableCellRedline* pRedline = new SwTableCellRedline( aRedlineData, rTableBox );
1475  RedlineFlags nPrevMode = pRedlineAccess->GetRedlineFlags( );
1476  pRedline->SetExtraData( nullptr );
1477 
1478  pRedlineAccess->SetRedlineFlags_intern(RedlineFlags::On);
1479  bool bRet = pRedlineAccess->AppendTableCellRedline( pRedline );
1480  pRedlineAccess->SetRedlineFlags_intern( nPrevMode );
1481  if( !bRet )
1482  throw lang::IllegalArgumentException();
1483 }
1484 
1485 void SwAnyMapHelper::SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& rAny )
1486 {
1487  sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
1488  m_Map[nKey] = rAny;
1489 }
1490 
1491 bool SwAnyMapHelper::FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& pAny )
1492 {
1493  bool bRet = false;
1494  sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
1495  auto aIt = m_Map.find( nKey );
1496  if (aIt != m_Map.end())
1497  {
1498  pAny = & aIt->second;
1499  bRet = true;
1500  }
1501  return bRet;
1502 }
1503 
1504 }//namespace SwUnoCursorHelper
1505 
1506 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool is() const
Starts a section of nodes in the document model.
Definition: node.hxx:303
static const OUString & PROP_DOCUMENTBASEURL()
#define FN_API_CALL
Definition: cmdid.h:550
void ResetAttrs(const SwPaM &rRg, bool bTextAttr=true, const std::set< sal_uInt16 > &rAttrs=std::set< sal_uInt16 >(), const bool bSendDataChangedEvents=true, SwRootFrame const *pLayout=nullptr)
Reset attributes.
Definition: docfmt.cxx:241
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:522
void makeRedline(SwPaM const &rPaM, const OUString &rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
#define FN_UNO_CELL
Definition: cmdid.h:526
void SetExtraData(const SwRedlineExtraData *pData)
ExtraData gets copied, the pointer is therefore not taken over by the RedLineObject.
Definition: redline.hxx:312
const SwNodeNum * GetNum(SwRootFrame const *pLayout=nullptr) const
Definition: ndtxt.cxx:3962
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:749
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_METAFIELD(49)
virtual const SwRootFrame * GetCurrentLayout() const =0
SwDocShell * GetDocShell()
Definition: doc.hxx:1348
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:133
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:448
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:605
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:1190
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:4392
static const OUString & PROP_FILTERNAME()
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
Definition: unomap1.cxx:1060
Definition: doc.hxx:184
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:344
SwNode & GetNode() const
Definition: ndindex.hxx:119
#define FN_UNO_TEXT_PARAGRAPH
Definition: cmdid.h:546
const std::shared_ptr< SfxItemSet > & GetStyleHandle() const
Definition: fmtautofmt.hxx:49
SwSectionFormat * GetFormat()
Definition: section.hxx:336
bool IsEndNote() const
Definition: fmtftn.hxx:74
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:110
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:1725
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
bool IsListRestart() const
Definition: ndtxt.cxx:4134
The root element of a Writer document layout.
Definition: rootfrm.hxx:80
static SwSection * GetCurrSection(const SwPosition &rPos)
Definition: ndsect.cxx:501
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4111
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:201
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4027
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:187
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:3054
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:517
#define FN_UNO_ENDNOTE
Definition: cmdid.h:531
#define FN_UNO_LIST_ID
Definition: cmdid.h:602
Reference< XInputStream > xStream
SwIndex nContent
Definition: pam.hxx:38
#define FN_UNO_DOCUMENT_INDEX
Definition: cmdid.h:523
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
static SwNumRule * GetNumRuleAtPos(SwPosition &rPos, SwRootFrame const *pLayout=nullptr)
Definition: docnum.cxx:2387
void SetComment(const OUString &rS)
Definition: redline.hxx:132
const OUString & GetName() const
Definition: format.hxx:111
constexpr TypedWhichId< SfxUInt16Item > RES_PARATR_OUTLINELEVEL(79)
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
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:260
Mode eMode
const SwTable & GetTable() const
Definition: node.hxx:497
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
const SwFormatField & GetFormatField() const
Definition: txatbase.hxx:191
#define FN_UNO_PARA_CONDITIONAL_STYLE_NAME
Definition: cmdid.h:559
RedlineFlags on.
static const OUString & PROP_STREAM()
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange)
Definition: unoobj2.cxx:952
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:214
SwPaM * GetNext()
Definition: pam.hxx:264
Redline that holds information about a table-cell that had some change.
Definition: redline.hxx:300
virtual bool AppendTableCellRedline(SwTableCellRedline *pPtr)=0
SwPaM & SetPam(size_t nArrPos, SwPaM &rPam)
Definition: ednumber.cxx:97
static SwXCell * CreateXCell(SwFrameFormat *pTableFormat, SwTableBox *pBox, SwTable *pTable=nullptr)
Definition: unotbl.cxx:1147
#define FN_UNO_IS_NUMBER
Definition: cmdid.h:562
SwFormatColl & GetAnyFormatColl() const
Definition: node.hxx:716
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:515
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:2416
static SwTable * FindTable(SwFrameFormat const *const pFormat)
Definition: swtable.cxx:1922
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:57
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:954
static const OUString & PROP_URL()
SwTableBox * FindBox(SwTable *pTable, SwTableBox *pBox)
search if a box exists in a table
Definition: unotbl.cxx:1168
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
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:609
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
SwPageFrame * FindPageFrame()
Definition: frame.hxx:660
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:130
SwContentNode * GetContentNode()
Definition: node.hxx:615
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
SwDoc * GetDoc()
Definition: node.hxx:702
SwDoc * GetDoc() const
Definition: pam.hxx:243
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1139
WEIGHT_NORMAL
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:1628
const SfxItemPropertyMap & getPropertyMap() const
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2808
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:366
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:425
css::uno::Type const & get()
static css::uno::Reference< css::text::XTextTable > GetObject(SwFrameFormat &rFormat)
Definition: unocoll.cxx:982
void makeTableCellRedline(SwTableBox &rTableBox, const OUString &rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, const bool bIncludeInputFieldAtStart=false) const
Definition: ndtxt.cxx:1769
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:320
ITALIC_NONE
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
virtual std::size_t InsertRedlineAuthor(const OUString &rAuthor)=0
#define FN_UNO_NUM_START_VALUE
Definition: cmdid.h:519
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:200
const SfxItemPropertySimpleEntry * getByName(const OUString &rName) const
Redline that holds information about a table-row that had some change.
Definition: redline.hxx:279
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
#define FN_UNO_TEXT_SECTION
Definition: cmdid.h:529
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:110
const SwPosition * Start() const
Definition: pam.hxx:212
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:524
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:291
#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:439
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:521
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:735
#define FN_NUMBER_NEWSTART
Definition: cmdid.h:455
SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const
Definition: ndtxt.cxx:4188
#define FN_UNO_CHARFMT_SEQUENCE
Definition: cmdid.h:586
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:528
#define SAL_INFO(area, stream)
sal_Int32 GetIndex() const
Definition: index.hxx:91
bool IsCountedInList() const
Definition: ndtxt.cxx:4254
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
SwNodes & GetNodes()
Definition: doc.hxx:403
SdrObject * GetSdrObject() const
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3178
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:386
const SwUnoCursor * GetTableCursor() const
Definition: unotbl.cxx:3843
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:89
#define FN_UNO_TEXT_FRAME
Definition: cmdid.h:527
::sw::mark::IMark const * GetBookmarkInDoc(SwDoc const *const pDoc, const css::uno::Reference< css::lang::XUnoTunnel > &xUT)
Definition: unobkm.cxx:182
constexpr TypedWhichId< SwTOXMark > RES_TXTATR_TOXMARK(47)
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:723
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:352
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:3125
const SfxPoolItem & GetAttr() const
Definition: txatbase.hxx:159
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:1716
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:447
bool IsInList() const
Definition: ndtxt.cxx:4358
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:525
#define FN_UNO_NUM_LEVEL
Definition: cmdid.h:520
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:475
constexpr TypedWhichId< SwFormatRefMark > RES_TXTATR_REFMARK(RES_TXTATR_WITHEND_BEGIN)
const FontList * GetFontList() const
void makeTableRowRedline(SwTableLine &rTableLine, const OUString &rRedlineType, const uno::Sequence< beans::PropertyValue > &rRedlineProperties)
static css::uno::Reference< css::text::XTextSection > GetObject(SwSectionFormat &rFormat)
Definition: unocoll.cxx:1526
SfxFilterContainer * GetFilterContainer() const
const SwFormatCharFormat & GetCharFormat() const
Definition: txatbase.hxx:179
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:4183
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:79
#define FN_UNO_FOOTNOTE
Definition: cmdid.h:530
bool IsTextNode() const
Definition: node.hxx:636
static bool isInvalidStyle(const OUString &rName)
Definition: unosett.cxx:1017
OUString const & GetName() const
sal_Int16 IsNodeNumStart(SwPaM const &rPam, PropertyState &eState)
#define FN_UNO_PARA_NUM_STRING
Definition: cmdid.h:606
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:714
#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:514
GetTextAttrMode
Definition: ndtxt.hxx:361
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1315
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:844
SwFrameFormat * GetFrameFormat() const
Definition: unotbl.hxx:146
sal_Int16 nValue
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1021
static const OUString & GetProgName(const OUString &rName, SwGetPoolIdFromName)
SW_DLLPUBLIC SwFrameFormat * GetFrameFormat()
Definition: unotbl.cxx:2033