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  const auto pSet(pFormat->GetStyleHandle());
316  if (!pSet)
317  return {};
319  SfxItemPropertyMap const& rMap(rPropSet.getPropertyMap());
320  std::vector<beans::NamedValue> props;
321  // have to iterate the map, not the item set?
322  for (auto const pEntry : rMap.getPropertyEntries())
323  {
324  if (rPropSet.getPropertyState(*pEntry, *pSet) == PropertyState_DIRECT_VALUE)
325  {
326  Any value;
327  rPropSet.getPropertyValue(*pEntry, *pSet, value);
328  props.emplace_back(pEntry->aName, value);
329  }
330  }
331  return uno::makeAny(comphelper::containerToSequence(props));
332 }
333 
334 // Read the special properties of the cursor
336  , SwPaM& rPam
337  , Any *pAny
338  , PropertyState& eState
339  , const SwTextNode* pNode )
340 {
341  PropertyState eNewState = PropertyState_DIRECT_VALUE;
342  bool bDone = true;
343  switch(rEntry.nWID)
344  {
346  if (pAny)
347  {
348  const SwTextNode * pTmpNode = pNode;
349 
350  if (!pTmpNode)
351  pTmpNode = rPam.GetNode().GetTextNode();
352 
353  bool bRet = false;
354 
355  if ( pTmpNode &&
356  pTmpNode->GetNum() &&
357  pTmpNode->GetNum()->IsContinueingPreviousSubTree() )
358  {
359  bRet = true;
360  }
361 
362  *pAny <<= bRet;
363  }
364  break;
366  if (pAny)
367  {
368  const SwTextNode * pTmpNode = pNode;
369 
370  if (!pTmpNode)
371  pTmpNode = rPam.GetNode().GetTextNode();
372 
373  OUString sRet;
374  if ( pTmpNode && pTmpNode->GetNum() )
375  {
376  sRet = pTmpNode->GetNumString();
377  }
378 
379  *pAny <<= sRet;
380  }
381  break;
383  if (pAny)
384  {
385  const SwTextNode * pTmpNode = pNode;
386 
387  if (!pTmpNode)
388  pTmpNode = rPam.GetNode().GetTextNode();
389 
390  sal_Int16 nRet = -1;
391  if ( pTmpNode )
392  nRet = sal::static_int_cast< sal_Int16 >( pTmpNode->GetAttrOutlineLevel() );
393 
394  *pAny <<= nRet;
395  }
396  break;
398  case FN_UNO_PARA_STYLE :
399  {
400  SwFormatColl* pFormat = nullptr;
401  if(pNode)
402  pFormat = FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID
403  ? pNode->GetFormatColl() : &pNode->GetAnyFormatColl();
404  else
405  {
408  }
409  if(pFormat)
410  {
411  if( pAny )
412  {
413  OUString sVal;
415  *pAny <<= sVal;
416  }
417  }
418  else
419  eNewState = PropertyState_AMBIGUOUS_VALUE;
420  }
421  break;
422  case FN_UNO_PAGE_STYLE :
423  {
424  OUString sVal;
425  GetCurPageStyle(rPam, sVal);
426  if( pAny )
427  *pAny <<= sVal;
428  if(sVal.isEmpty())
429  eNewState = PropertyState_AMBIGUOUS_VALUE;
430  }
431  break;
433  if( pAny )
434  {
435  sal_Int16 nValue = IsNodeNumStart(rPam, eNewState);
436  *pAny <<= nValue;
437  }
438  break;
439  case FN_UNO_NUM_LEVEL :
440  case FN_UNO_IS_NUMBER :
441  // #i91601#
442  case FN_UNO_LIST_ID:
443  case FN_NUMBER_NEWSTART:
445  {
446  if (!pAny)
447  {
448  break;
449  }
450  // a multi selection is not considered
451  const SwTextNode* pTextNd = rPam.GetNode().GetTextNode();
452  if ( pTextNd && pTextNd->IsInList() )
453  {
454  switch (rEntry.nWID)
455  {
456  case FN_UNO_NUM_LEVEL:
457  {
458  *pAny <<= static_cast<sal_Int16>(pTextNd->GetActualListLevel());
459  break;
460  }
461  case FN_UNO_IS_NUMBER:
462  {
463  *pAny <<= pTextNd->IsCountedInList();
464  break;
465  }
466  // #i91601#
467  case FN_UNO_LIST_ID:
468  {
469  *pAny <<= pTextNd->GetListId();
470  break;
471  }
472  case FN_NUMBER_NEWSTART:
473  {
474  *pAny <<= pTextNd->IsListRestart();
475  break;
476  }
478  {
479  *pAny = GetParaListAutoFormat(*pTextNd);
480  break;
481  }
482  default:
483  assert(false);
484  }
485  }
486  else
487  {
488  eNewState = PropertyState_DEFAULT_VALUE;
489 
490  // #i30838# set default values for default properties
491  switch (rEntry.nWID)
492  {
493  case FN_UNO_NUM_LEVEL:
494  {
495  *pAny <<= static_cast<sal_Int16>( 0 );
496  break;
497  }
498  case FN_UNO_IS_NUMBER:
499  {
500  *pAny <<= false;
501  break;
502  }
503  // #i91601#
504  case FN_UNO_LIST_ID:
505  {
506  *pAny <<= OUString();
507  break;
508  }
509  case FN_NUMBER_NEWSTART:
510  {
511  *pAny <<= false;
512  break;
513  }
515  {
516  break; // void
517  }
518  default:
519  assert(false);
520  }
521  }
522  //PROPERTY_MAYBEVOID!
523  }
524  break;
525  case FN_UNO_NUM_RULES :
526  if( pAny )
527  getNumberingProperty(rPam, eNewState, pAny);
528  else
529  {
530  if( !SwDoc::GetNumRuleAtPos( *rPam.GetPoint() ) )
531  eNewState = PropertyState_DEFAULT_VALUE;
532  }
533  break;
535  {
536  std::vector<SwTextAttr *> marks;
537  if (rPam.GetNode().IsTextNode())
538  {
539  marks = rPam.GetNode().GetTextNode()->GetTextAttrsAt(
541  }
542  if (!marks.empty())
543  {
544  if( pAny )
545  { // hmm... can only return 1 here
546  SwTOXMark & rMark =
547  static_cast<SwTOXMark &>((*marks.begin())->GetAttr());
548  const uno::Reference< text::XDocumentIndexMark > xRef =
550  rPam.GetDoc(), &rMark);
551  (*pAny) <<= xRef;
552  }
553  }
554  else
555  //also here - indistinguishable
556  eNewState = PropertyState_DEFAULT_VALUE;
557  }
558  break;
560  {
561  SwTOXBase* pBase = SwDoc::GetCurTOX(
562  *rPam.Start() );
563  if( pBase )
564  {
565  if( pAny )
566  {
567  const uno::Reference< text::XDocumentIndex > xRef =
569  static_cast<SwTOXBaseSection *>(pBase));
570  (*pAny) <<= xRef;
571  }
572  }
573  else
574  eNewState = PropertyState_DEFAULT_VALUE;
575  }
576  break;
577  case FN_UNO_TEXT_FIELD:
578  {
579  const SwPosition *pPos = rPam.Start();
580  const SwTextNode *pTextNd =
581  rPam.GetDoc().GetNodes()[pPos->nNode.GetIndex()]->GetTextNode();
582  const SwTextAttr* pTextAttr = pTextNd
583  ? pTextNd->GetFieldTextAttrAt( pPos->nContent.GetIndex(), true )
584  : nullptr;
585  if ( pTextAttr != nullptr )
586  {
587  if( pAny )
588  {
589  uno::Reference<text::XTextField> const xField(
591  &pTextAttr->GetFormatField()));
592  *pAny <<= xField;
593  }
594  }
595  else
596  eNewState = PropertyState_DEFAULT_VALUE;
597  }
598  break;
599  case FN_UNO_TEXT_TABLE:
600  case FN_UNO_CELL:
601  {
602  SwStartNode* pSttNode = rPam.GetNode().StartOfSectionNode();
603  SwStartNodeType eType = pSttNode->GetStartNodeType();
604  if(SwTableBoxStartNode == eType)
605  {
606  if( pAny )
607  {
608  const SwTableNode* pTableNode = pSttNode->FindTableNode();
609  SwFrameFormat* pTableFormat = pTableNode->GetTable().GetFrameFormat();
610  //SwTable& rTable = static_cast<SwTableNode*>(pSttNode)->GetTable();
611  if(FN_UNO_TEXT_TABLE == rEntry.nWID)
612  {
613  uno::Reference< XTextTable > xTable = SwXTextTables::GetObject(*pTableFormat);
614  *pAny <<= xTable;
615  }
616  else
617  {
618  SwTableBox* pBox = pSttNode->GetTableBox();
619  uno::Reference< XCell > xCell = SwXCell::CreateXCell(pTableFormat, pBox);
620  *pAny <<= xCell;
621  }
622  }
623  }
624  else
625  eNewState = PropertyState_DEFAULT_VALUE;
626  }
627  break;
628  case FN_UNO_TEXT_FRAME:
629  {
630  SwStartNode* pSttNode = rPam.GetNode().StartOfSectionNode();
631  SwStartNodeType eType = pSttNode->GetStartNodeType();
632 
633  SwFrameFormat* pFormat;
634  if(eType == SwFlyStartNode && nullptr != (pFormat = pSttNode->GetFlyFormat()))
635  {
636  if( pAny )
637  {
638  uno::Reference<XTextFrame> const xFrame(
639  SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat));
640  (*pAny) <<= xFrame;
641  }
642  }
643  else
644  eNewState = PropertyState_DEFAULT_VALUE;
645  }
646  break;
647  case FN_UNO_TEXT_SECTION:
648  {
649  SwSection* pSect = SwDoc::GetCurrSection(*rPam.GetPoint());
650  if(pSect)
651  {
652  if( pAny )
653  {
654  uno::Reference< XTextSection > xSect = SwXTextSections::GetObject( *pSect->GetFormat() );
655  *pAny <<= xSect;
656  }
657  }
658  else
659  eNewState = PropertyState_DEFAULT_VALUE;
660  }
661  break;
663  {
664  SwTextNode* pTextNode = rPam.GetPoint()->nNode.GetNode().GetTextNode();
665  if (pTextNode)
666  {
667  if (pAny)
668  {
669  uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
670  *pAny <<= xParagraph;
671  }
672  }
673  else
674  eNewState = PropertyState_DEFAULT_VALUE;
675  }
676  break;
677  case FN_UNO_ENDNOTE:
678  case FN_UNO_FOOTNOTE:
679  {
680  SwTextAttr *const pTextAttr = rPam.GetNode().IsTextNode() ?
682  rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN) : nullptr;
683  if(pTextAttr)
684  {
685  const SwFormatFootnote& rFootnote = pTextAttr->GetFootnote();
686  if(rFootnote.IsEndNote() == (FN_UNO_ENDNOTE == rEntry.nWID))
687  {
688  if( pAny )
689  {
690  const uno::Reference< text::XFootnote > xFootnote =
692  &const_cast<SwFormatFootnote&>(rFootnote));
693  *pAny <<= xFootnote;
694  }
695  }
696  else
697  eNewState = PropertyState_DEFAULT_VALUE;
698  }
699  else
700  eNewState = PropertyState_DEFAULT_VALUE;
701  }
702  break;
704  {
705  std::vector<SwTextAttr *> marks;
706  if (rPam.GetNode().IsTextNode())
707  {
708  marks = rPam.GetNode().GetTextNode()->GetTextAttrsAt(
710  }
711  if (!marks.empty())
712  {
713  if( pAny )
714  { // hmm... can only return 1 here
715  const SwFormatRefMark& rRef = (*marks.begin())->GetRefMark();
716  uno::Reference<XTextContent> const xRef =
718  const_cast<SwFormatRefMark*>(&rRef));
719  *pAny <<= xRef;
720  }
721  }
722  else
723  eNewState = PropertyState_DEFAULT_VALUE;
724  }
725  break;
727  {
728  uno::Reference<XTextContent> const xRet(rPam.GetNode().IsTextNode()
730  rPam.GetPoint()->nContent.GetIndex(), false)
731  : nullptr);
732  if (xRet.is())
733  {
734  if (pAny)
735  {
736  (*pAny) <<= xRet;
737  }
738  }
739  else
740  {
741  eNewState = PropertyState_DEFAULT_VALUE;
742  }
743  }
744  break;
746  {
747 
748  SwTextNode *const pTextNode = rPam.GetNode().GetTextNode();
749  if (&rPam.GetNode() == &rPam.GetNode(false)
750  && pTextNode && pTextNode->GetpSwpHints())
751  {
752  sal_Int32 nPaMStart = rPam.GetPoint()->nContent.GetIndex();
753  sal_Int32 nPaMEnd = rPam.GetMark() ? rPam.GetMark()->nContent.GetIndex() : nPaMStart;
754  if(nPaMStart > nPaMEnd)
755  {
756  std::swap(nPaMStart, nPaMEnd);
757  }
758  Sequence< OUString> aCharStyles;
759  SwpHints* pHints = pTextNode->GetpSwpHints();
760  for( size_t nAttr = 0; nAttr < pHints->Count(); ++nAttr )
761  {
762  SwTextAttr* pAttr = pHints->Get( nAttr );
763  if(pAttr->Which() != RES_TXTATR_CHARFMT)
764  continue;
765  const sal_Int32 nAttrStart = pAttr->GetStart();
766  const sal_Int32 nAttrEnd = *pAttr->GetEnd();
767  //check if the attribute touches the selection
768  if( ( nAttrEnd > nPaMStart && nAttrStart < nPaMEnd ) ||
769  ( !nAttrStart && !nAttrEnd && !nPaMStart && !nPaMEnd ) )
770  {
771  //check for overlapping
772  if(nAttrStart > nPaMStart ||
773  nAttrEnd < nPaMEnd)
774  {
775  aCharStyles.realloc(0);
776  break;
777  }
778  else
779  {
780  //now the attribute should start before or at the selection
781  //and it should end at the end of the selection or behind
782  OSL_ENSURE(nAttrStart <= nPaMStart && nAttrEnd >=nPaMEnd,
783  "attribute overlaps or is outside");
784  //now the name of the style has to be added to the sequence
785  aCharStyles.realloc(aCharStyles.getLength() + 1);
786  OSL_ENSURE(pAttr->GetCharFormat().GetCharFormat(), "no character format set");
787  aCharStyles.getArray()[aCharStyles.getLength() - 1] =
790  }
791  }
792 
793  }
794  eNewState =
795  aCharStyles.hasElements() ?
796  PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
797  if(pAny)
798  (*pAny) <<= aCharStyles;
799  }
800  else
801  eNewState = PropertyState_DEFAULT_VALUE;
802  }
803  break;
804  case RES_TXTATR_CHARFMT:
805  // no break here!
806  default: bDone = false;
807  }
808  if( bDone )
809  eState = eNewState;
810  return bDone;
811 };
812 
813 sal_Int16 IsNodeNumStart(SwPaM const & rPam, PropertyState& eState)
814 {
815  const SwTextNode* pTextNd = rPam.GetNode().GetTextNode();
816  // correction: check, if restart value is set at the text node and use
817  // new method <SwTextNode::GetAttrListRestartValue()> to retrieve the value
818  if ( pTextNd && pTextNd->GetNumRule() && pTextNd->IsListRestart() &&
819  pTextNd->HasAttrListRestartValue() )
820  {
821  eState = PropertyState_DIRECT_VALUE;
822  sal_Int16 nTmp = sal::static_int_cast< sal_Int16 >(pTextNd->GetAttrListRestartValue());
823  return nTmp;
824  }
825  eState = PropertyState_DEFAULT_VALUE;
826  return -1;
827 }
828 
829 void setNumberingProperty(const Any& rValue, SwPaM& rPam)
830 {
831  uno::Reference<XIndexReplace> xIndexReplace;
832  if(rValue >>= xIndexReplace)
833  {
834  auto pSwNum = comphelper::getUnoTunnelImplementation<SwXNumberingRules>(xIndexReplace);
835  if(pSwNum)
836  {
837  SwDoc& rDoc = rPam.GetDoc();
838  if(pSwNum->GetNumRule())
839  {
840  SwNumRule aRule(*pSwNum->GetNumRule());
841  const OUString* pNewCharStyles = pSwNum->GetNewCharStyleNames();
842  const OUString* pBulletFontNames = pSwNum->GetBulletFontNames();
843  for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
844  {
845  SwNumFormat aFormat(aRule.Get( i ));
846  if (!pNewCharStyles[i].isEmpty() &&
847  !SwXNumberingRules::isInvalidStyle(pNewCharStyles[i]) &&
848  (!aFormat.GetCharFormat() || pNewCharStyles[i] != aFormat.GetCharFormat()->GetName()))
849  {
850  if (pNewCharStyles[i].isEmpty())
851  {
852  // FIXME
853  // Is something missing/wrong here?
854  // if condition is always false due to outer check!
855  aFormat.SetCharFormat(nullptr);
856  }
857  else
858  {
859 
860  // get CharStyle and set the rule
861  const size_t nChCount = rDoc.GetCharFormats()->size();
862  SwCharFormat* pCharFormat = nullptr;
863  for(size_t nCharFormat = 0; nCharFormat < nChCount; ++nCharFormat)
864  {
865  SwCharFormat& rChFormat = *((*(rDoc.GetCharFormats()))[nCharFormat]);
866  if(rChFormat.GetName() == pNewCharStyles[i])
867  {
868  pCharFormat = &rChFormat;
869  break;
870  }
871  }
872 
873  if(!pCharFormat)
874  {
876  SfxStyleSheetBase* pBase;
877  pBase = pPool->Find(pNewCharStyles[i], SfxStyleFamily::Char);
878  // shall it really be created?
879  if(!pBase)
880  pBase = &pPool->Make(pNewCharStyles[i], SfxStyleFamily::Page);
881  pCharFormat = static_cast<SwDocStyleSheet*>(pBase)->GetCharFormat();
882  }
883  if(pCharFormat)
884  aFormat.SetCharFormat(pCharFormat);
885  }
886  }
887  //Now again for fonts
888  if(
889  !pBulletFontNames[i].isEmpty() &&
890  !SwXNumberingRules::isInvalidStyle(pBulletFontNames[i]) &&
891  (!aFormat.GetBulletFont() || aFormat.GetBulletFont()->GetFamilyName() != pBulletFontNames[i])
892  )
893  {
894  const SvxFontListItem* pFontListItem =
895  static_cast<const SvxFontListItem* >(rDoc.GetDocShell()
896  ->GetItem( SID_ATTR_CHAR_FONTLIST ));
897  const FontList* pList = pFontListItem->GetFontList();
898 
899  FontMetric aFontMetric = pList->Get(
900  pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
901  vcl::Font aFont(aFontMetric);
902  aFormat.SetBulletFont(&aFont);
903  }
904  aRule.Set( i, aFormat );
905  }
906  UnoActionContext aAction(&rDoc);
907 
908  if( rPam.GetNext() != &rPam ) // Multiple selection?
909  {
911  SwPamRanges aRangeArr( rPam );
912  SwPaM aPam( *rPam.GetPoint() );
913  for ( size_t n = 0; n < aRangeArr.Count(); ++n )
914  {
915  // no start of a new list
916  rDoc.SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
917  }
918  rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
919  }
920  else
921  {
922  // no start of a new list
923  rDoc.SetNumRule( rPam, aRule, false );
924  }
925 
926  }
927  else if(!pSwNum->GetCreatedNumRuleName().isEmpty())
928  {
929  UnoActionContext aAction( &rDoc );
930  SwNumRule* pRule = rDoc.FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
931  if ( !pRule )
932  throw RuntimeException();
933  // no start of a new list
934  rDoc.SetNumRule( rPam, *pRule, false );
935  }
936  else
937  {
938  // #i103817#
939  // outline numbering
940  UnoActionContext aAction(&rDoc);
941  SwNumRule* pRule = rDoc.GetOutlineNumRule();
942  if(!pRule)
943  throw RuntimeException();
944  rDoc.SetNumRule( rPam, *pRule, false );
945  }
946  }
947  }
948  else if ( rValue.getValueType() == cppu::UnoType<void>::get() )
949  {
950  rPam.GetDoc().DelNumRules(rPam);
951  }
952 }
953 
954 void getNumberingProperty(SwPaM& rPam, PropertyState& eState, Any * pAny )
955 {
956  const SwNumRule* pNumRule = SwDoc::GetNumRuleAtPos( *rPam.GetPoint() );
957  if(pNumRule)
958  {
959  uno::Reference< XIndexReplace > xNum = new SwXNumberingRules(*pNumRule);
960  if ( pAny )
961  *pAny <<= xNum;
962  eState = PropertyState_DIRECT_VALUE;
963  }
964  else
965  eState = PropertyState_DEFAULT_VALUE;
966 }
967 
968 void GetCurPageStyle(SwPaM const & rPaM, OUString &rString)
969 {
970  if (!rPaM.GetContentNode())
971  return; // TODO: is there an easy way to get it for tables/sections?
973  // Consider the position inside the content node, since the node may span over multiple pages
974  // with different page styles.
975  SwContentFrame* pFrame = rPaM.GetContentNode()->getLayoutFrame(pLayout, rPaM.GetPoint());
976  if(pFrame)
977  {
978  const SwPageFrame* pPage = pFrame->FindPageFrame();
979  if(pPage)
980  {
983  }
984  }
985 }
986 
987 // reset special properties of the cursor
989 {
990  SwDoc& rDoc = rPam.GetDoc();
991  switch(rEntry.nWID)
992  {
993  case FN_UNO_PARA_STYLE :
994  break;
995  case FN_UNO_PAGE_STYLE :
996  break;
998  {
999  UnoActionContext aAction(&rDoc);
1000 
1001  if( rPam.GetNext() != &rPam ) // Multiple selection?
1002  {
1003  rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
1004  SwPamRanges aRangeArr( rPam );
1005  SwPaM aPam( *rPam.GetPoint() );
1006  for( size_t n = 0; n < aRangeArr.Count(); ++n )
1007  rDoc.SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
1008  rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
1009  }
1010  else
1011  rDoc.SetNodeNumStart( *rPam.GetPoint(), 0 );
1012  }
1013 
1014  break;
1015  case FN_UNO_NUM_LEVEL :
1016  break;
1017  case FN_UNO_NUM_RULES:
1018  break;
1020  {
1021  rDoc.ResetAttrs(rPam, true, { RES_TXTATR_CHARFMT });
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& rDoc = pUnoCursor->GetDoc();
1032  SwDocShell* pDocSh = rDoc.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(&rDoc);
1132 
1133  if(pUnoCursor->HasMark())
1134  rDoc.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  std::u16string_view rRedlineType,
1230  const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1231 {
1232  IDocumentRedlineAccess& rRedlineAccess = rPaM.GetDoc().getIDocumentRedlineAccess();
1233 
1235  if ( rRedlineType == u"Insert" )
1236  eType = RedlineType::Insert;
1237  else if ( rRedlineType == u"Delete" )
1238  eType = RedlineType::Delete;
1239  else if ( rRedlineType == u"Format" )
1240  eType = RedlineType::Format;
1241  else if ( rRedlineType == u"TextTable" )
1242  eType = RedlineType::Table;
1243  else if ( rRedlineType == u"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 = rRedlineAccess.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& rDoc = rPaM.GetDoc();
1292 
1293  // Build set of attributes we want to fetch
1294  std::vector<sal_uInt16> aWhichPairs;
1295  std::vector<SfxItemPropertyMapEntry 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  SfxItemPropertyMapEntry 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(rDoc.GetAttrPool(), aWhichPairs.data());
1338 
1339  for (size_t i = 0; i < aEntries.size(); ++i)
1340  {
1341  SfxItemPropertyMapEntry 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 = rDoc.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 = rRedlineAccess.GetRedlineFlags( );
1377  // xRedlineExtraData is copied here
1378  pRedline->SetExtraData( xRedlineExtraData.get() );
1379 
1380  rRedlineAccess.SetRedlineFlags_intern(RedlineFlags::On);
1381  auto const result(rRedlineAccess.AppendRedline(pRedline, false));
1382  rRedlineAccess.SetRedlineFlags_intern( nPrevMode );
1384  throw lang::IllegalArgumentException();
1385 }
1386 
1388  std::u16string_view rRedlineType,
1389  const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1390 {
1391  IDocumentRedlineAccess* pRedlineAccess = &rTableLine.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess();
1392 
1394  if ( rRedlineType == u"TableRowInsert" )
1395  {
1396  eType = RedlineType::TableRowInsert;
1397  }
1398  else if ( rRedlineType == u"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  std::u16string_view rRedlineType,
1438  const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1439 {
1440  IDocumentRedlineAccess* pRedlineAccess = &rTableBox.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess();
1441 
1443  if ( rRedlineType == u"TableCellInsert" )
1444  {
1445  eType = RedlineType::TableCellInsert;
1446  }
1447  else if ( rRedlineType == u"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:312
static const OUString & PROP_DOCUMENTBASEURL()
#define FN_API_CALL
Definition: cmdid.h:551
static const OUString & PROP_PASSWORD()
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
virtual SfxObjectFactory & GetFactory() const =0
static uno::Any GetParaListAutoFormat(SwTextNode const &rNode)
virtual const SwDoc * GetDoc() const =0
static const OUString & PROP_FILENAME()
Marks a position in the document model.
Definition: pam.hxx:35
void setPropertyValue(const SfxItemPropertyMapEntry &rEntry, const css::uno::Any &aVal, SfxItemSet &rSet) const
#define FN_UNO_DOCUMENT_INDEX_MARK
Definition: cmdid.h:523
#define FN_UNO_CELL
Definition: cmdid.h:527
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:3957
bool getCursorPropertyValue(const SfxItemPropertyMapEntry &rEntry, SwPaM &rPam, Any *pAny, PropertyState &eState, const SwTextNode *pNode)
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:754
constexpr TypedWhichId< SwFormatMeta > RES_TXTATR_METAFIELD(49)
virtual const SwRootFrame * GetCurrentLayout() const =0
static rtl::Reference< SwXCell > CreateXCell(SwFrameFormat *pTableFormat, SwTableBox *pBox, SwTable *pTable=nullptr)
Definition: unotbl.cxx:1136
SwDocShell * GetDocShell()
Definition: doc.hxx:1353
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:218
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:606
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:4382
static const OUString & PROP_FILTERNAME()
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
Definition: unomap1.cxx:1061
Definition: doc.hxx:187
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:547
const std::shared_ptr< SfxItemSet > & GetStyleHandle() const
Definition: fmtautofmt.hxx:49
SwSectionFormat * GetFormat()
Definition: section.hxx:336
bool IsEndNote() const
Definition: fmtftn.hxx:71
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
void resetCursorPropertyValue(const SfxItemPropertyMapEntry &rEntry, SwPaM &rPam)
void GetSelectableFromAny(uno::Reference< uno::XInterface > const &xIfc, SwDoc &rTargetDoc, SwPaM *&o_rpPaM, std::pair< OUString, FlyCntType > &o_rFrame, OUString &o_rTableName, SwUnoTableCursor const *&o_rpTableCursor,::sw::mark::IMark const *&o_rpMark, std::vector< SdrObject * > &o_rSdrObjects)
sal_uInt16 Which() const
Definition: txatbase.hxx:114
static css::uno::Reference< css::text::XTextField > CreateXTextField(SwDoc *pDoc, SwFormatField const *pFormat, SwServiceType nServiceId=SwServiceType::Invalid)
Definition: unofield.cxx:1219
virtual bool DeleteAndJoin(SwPaM &, const bool bForceJoinNext=false)=0
complete delete of a given PaM
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, enum GetTextAttrMode const eMode=DEFAULT) const
get the innermost text attribute covering position nIndex.
Definition: ndtxt.cxx:1731
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:4129
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:4106
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:203
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4022
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:197
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
SwContentNode * GetContentNode(bool bPoint=true) const
Definition: pam.hxx:229
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
Definition: ndtxt.cxx:3050
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:518
#define FN_UNO_ENDNOTE
Definition: cmdid.h:532
#define FN_UNO_LIST_ID
Definition: cmdid.h:603
Reference< XInputStream > xStream
SwIndex nContent
Definition: pam.hxx:38
#define FN_UNO_DOCUMENT_INDEX
Definition: cmdid.h:524
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:258
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:560
RedlineFlags on.
static const OUString & PROP_STREAM()
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(58)
void SetExtraData(const SwRedlineExtraData *pData)
ExtraData gets copied, the pointer is therefore not taken over by the RedLineObject.
Definition: redline.hxx:213
SwPaM * GetNext()
Definition: pam.hxx:264
Redline that holds information about a table-cell that had some change.
Definition: redline.hxx:301
virtual bool AppendTableCellRedline(SwTableCellRedline *pPtr)=0
SwPaM & SetPam(size_t nArrPos, SwPaM &rPam)
Definition: ednumber.cxx:101
#define FN_UNO_IS_NUMBER
Definition: cmdid.h:563
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:516
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:1157
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:610
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
SwPageFrame * FindPageFrame()
Definition: frame.hxx:678
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:143
SwContentNode * GetContentNode()
Definition: node.hxx:619
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
css::uno::Any getValue(const OUString &sKey) const
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1140
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:1623
const SfxItemPropertyMap & getPropertyMap() const
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2813
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
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:979
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, const bool bIncludeInputFieldAtStart=false) const
Definition: ndtxt.cxx:1775
Reader * StartConvertFrom(SfxMedium &rMedium, SwReaderPtr &rpRdr, SwCursorShell const *pCursorSh=nullptr, SwPaM *pPaM=nullptr)
For inserting document.
Definition: docsh.cxx:138
SwStartNodeType GetStartNodeType() const
Definition: node.hxx:329
ITALIC_NONE
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
virtual std::size_t InsertRedlineAuthor(const OUString &rAuthor)=0
#define FN_UNO_NUM_START_VALUE
Definition: cmdid.h:520
void InsertFile(SwUnoCursor *pUnoCursor, const OUString &rURL, const uno::Sequence< beans::PropertyValue > &rOptions)
static css::uno::Reference< css::text::XTextContent > CreateXReferenceMark(SwDoc &rDoc, SwFormatRefMark *pMarkFormat)
Definition: unorefmk.cxx:129
A page of the document layout.
Definition: pagefrm.hxx:57
bool FillValue(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const css::uno::Any *&pAny)
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:204
Redline that holds information about a table-row that had some change.
Definition: redline.hxx:280
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
#define FN_UNO_TEXT_SECTION
Definition: cmdid.h:530
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:1096
EXPAND : (Start < nIndex <= End)
Definition: ndtxt.hxx:363
bool IsControlChar(sal_Unicode cChar)
DEFAULT: (Start <= nIndex < End)
Definition: ndtxt.hxx:362
virtual const SwPaM * GetPaM() const =0
#define FN_UNO_TEXT_FIELD
Definition: cmdid.h:525
std::map< sal_uInt32, css::uno::Any > m_Map
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
uno::Reference< text::XTextContent > GetNestedTextContent(SwTextNode const &rTextNode, sal_Int32 const nIndex, bool const bParent)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual bool AppendTableRowRedline(SwTableRowRedline *pPtr)=0
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:522
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:739
#define FN_NUMBER_NEWSTART
Definition: cmdid.h:456
SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const
Definition: ndtxt.cxx:4183
#define FN_UNO_CHARFMT_SEQUENCE
Definition: cmdid.h:587
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:529
#define SAL_INFO(area, stream)
sal_Int32 GetIndex() const
Definition: index.hxx:91
bool IsCountedInList() const
Definition: ndtxt.cxx:4244
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:3189
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:392
const SwUnoCursor * GetTableCursor() const
Definition: unotbl.cxx:3830
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:87
#define FN_UNO_TEXT_FRAME
Definition: cmdid.h:528
::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:3121
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:1722
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:4348
SwDoc & GetDoc() const
Definition: pam.hxx:243
bool DocInsertStringSplitCR(SwDoc &rDoc, const SwPaM &rNewCursor, const OUString &rText, const bool bForceExpandHints)
void SetUsedByRedline(bool bUsed)
Definition: numrule.hxx:248
RedlineType
virtual SwUnoCursor * GetCursor()=0
#define FN_UNO_TEXT_TABLE
Definition: cmdid.h:526
#define FN_UNO_NUM_LEVEL
Definition: cmdid.h:521
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:1523
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:4178
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:531
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:607
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:515
GetTextAttrMode
Definition: ndtxt.hxx:360
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1320
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:845
SwFrameFormat * GetFrameFormat() const
Definition: unotbl.hxx:146
sal_Int16 nValue
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1025
static const OUString & GetProgName(const OUString &rName, SwGetPoolIdFromName)
SW_DLLPUBLIC SwFrameFormat * GetFrameFormat()
Definition: unotbl.cxx:2020