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