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