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 SwPaM aPam(*pBox->GetSttNd());
237 o_rpPaM = lcl_createPamCopy(aPam);
238 }
239 }
240 return;
241 }
242
243 uno::Reference<text::XTextRange> const xTextRange(xTunnel, UNO_QUERY);
244 if (xTextRange.is())
245 {
246 SwUnoInternalPaM aPam(rTargetDoc);
247 if (::sw::XTextRangeToSwPaM(aPam, xTextRange))
248 {
249 o_rpPaM = lcl_createPamCopy(aPam);
250 }
251 return;
252 }
253
254 SwXCellRange *const pCellRange(
255 comphelper::getFromUnoTunnel<SwXCellRange>(xTunnel));
256 if (pCellRange)
257 {
258 SwUnoCursor const*const pUnoCursor(pCellRange->GetTableCursor());
259 if (pUnoCursor && &pUnoCursor->GetDoc() == &rTargetDoc)
260 {
261 // probably can't copy it to o_rpPaM for this since it's
262 // a SwTableCursor
263 o_rpTableCursor = dynamic_cast<SwUnoTableCursor const*>(pUnoCursor);
264 }
265 return;
266 }
267
268 ::sw::mark::IMark const*const pMark(
269 SwXBookmark::GetBookmarkInDoc(& rTargetDoc, xTunnel));
270 if (pMark)
271 {
272 o_rpMark = pMark;
273 return;
274 }
275}
276
277uno::Reference<text::XTextContent>
278GetNestedTextContent(SwTextNode const & rTextNode, sal_Int32 const nIndex,
279 bool const bParent)
280{
281 // these should be unambiguous because of the dummy character
282 auto const eMode( bParent
284 SwTextAttr *const pMetaTextAttr =
286 SwTextAttr *const pMetaFieldTextAttr =
288 // which is innermost?
289 SwTextAttr *const pTextAttr = pMetaTextAttr
290 ? (pMetaFieldTextAttr
291 ? ((pMetaFieldTextAttr->GetStart() >
292 pMetaTextAttr->GetStart())
293 ? pMetaFieldTextAttr : pMetaTextAttr)
294 : pMetaTextAttr)
295 : pMetaFieldTextAttr;
296 uno::Reference<XTextContent> xRet;
297 if (pTextAttr)
298 {
299 ::sw::Meta *const pMeta(
300 static_cast<SwFormatMeta &>(pTextAttr->GetAttr()).GetMeta());
301 assert(pMeta);
302 xRet.set(pMeta->MakeUnoObject(), uno::UNO_QUERY);
303 }
304 return xRet;
305}
306
308{
309 SwFormatAutoFormat const*const pFormat(
311 if (!pFormat)
312 {
313 return uno::Any();
314 }
315 const auto pSet(pFormat->GetStyleHandle());
316 if (!pSet)
317 return {};
319 SfxItemPropertyMap const& rMap(rPropSet.getPropertyMap());
320 std::vector<beans::NamedValue> props;
321 // have to iterate the map, not the item set?
322 for (auto const pEntry : rMap.getPropertyEntries())
323 {
324 if (rPropSet.getPropertyState(*pEntry, *pSet) == PropertyState_DIRECT_VALUE)
325 {
326 Any value;
327 rPropSet.getPropertyValue(*pEntry, *pSet, value);
328 props.emplace_back(pEntry->aName, value);
329 }
330 }
332}
333
334// Read the special properties of the cursor
336 , SwPaM& rPam
337 , Any *pAny
338 , PropertyState& eState
339 , const SwTextNode* pNode )
340{
341 PropertyState eNewState = PropertyState_DIRECT_VALUE;
342 bool bDone = true;
343 switch(rEntry.nWID)
344 {
346 if (pAny)
347 {
348 const SwTextNode * pTmpNode = pNode;
349
350 if (!pTmpNode)
351 pTmpNode = rPam.GetPointNode().GetTextNode();
352
353 bool bRet = false;
354
355 if ( pTmpNode &&
356 pTmpNode->GetNum() &&
357 pTmpNode->GetNum()->IsContinueingPreviousSubTree() )
358 {
359 bRet = true;
360 }
361
362 *pAny <<= bRet;
363 }
364 break;
366 if (pAny)
367 {
368 const SwTextNode * pTmpNode = pNode;
369
370 if (!pTmpNode)
371 pTmpNode = rPam.GetPointNode().GetTextNode();
372
373 OUString sRet;
374 if ( pTmpNode && pTmpNode->GetNum() )
375 {
376 sRet = pTmpNode->GetNumString();
377 }
378
379 *pAny <<= sRet;
380 }
381 break;
383 if (pAny)
384 {
385 const SwTextNode * pTmpNode = pNode;
386
387 if (!pTmpNode)
388 pTmpNode = rPam.GetPointNode().GetTextNode();
389
390 sal_Int16 nRet = -1;
391 if ( pTmpNode )
392 nRet = sal::static_int_cast< sal_Int16 >( pTmpNode->GetAttrOutlineLevel() );
393
394 *pAny <<= nRet;
395 }
396 break;
398 case FN_UNO_PARA_STYLE :
399 {
400 SwFormatColl* pFormat = nullptr;
401 if(pNode)
402 pFormat = FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID
403 ? pNode->GetFormatColl() : &pNode->GetAnyFormatColl();
404 else
405 {
408 }
409 if(pFormat)
410 {
411 if( pAny )
412 {
413 OUString sVal;
415 *pAny <<= sVal;
416 }
417 }
418 else
419 eNewState = PropertyState_AMBIGUOUS_VALUE;
420 }
421 break;
422 case FN_UNO_PAGE_STYLE :
423 {
424 OUString sVal;
425 GetCurPageStyle(rPam, sVal);
426 if( pAny )
427 *pAny <<= sVal;
428 if(sVal.isEmpty())
429 eNewState = PropertyState_AMBIGUOUS_VALUE;
430 }
431 break;
433 if( pAny )
434 {
435 sal_Int16 nValue = IsNodeNumStart(rPam, eNewState);
436 *pAny <<= nValue;
437 }
438 break;
439 case FN_UNO_NUM_LEVEL :
440 case FN_UNO_IS_NUMBER :
441 // #i91601#
442 case FN_UNO_LIST_ID:
445 {
446 if (!pAny)
447 {
448 break;
449 }
450 // a multi selection is not considered
451 const SwTextNode* pTextNd = rPam.GetPointNode().GetTextNode();
452 if ( pTextNd && pTextNd->IsInList() )
453 {
454 switch (rEntry.nWID)
455 {
456 case FN_UNO_NUM_LEVEL:
457 {
458 *pAny <<= static_cast<sal_Int16>(pTextNd->GetActualListLevel());
459 break;
460 }
461 case FN_UNO_IS_NUMBER:
462 {
463 *pAny <<= pTextNd->IsCountedInList();
464 break;
465 }
466 // #i91601#
467 case FN_UNO_LIST_ID:
468 {
469 *pAny <<= pTextNd->GetListId();
470 break;
471 }
473 {
474 *pAny <<= pTextNd->IsListRestart();
475 break;
476 }
478 {
479 *pAny = GetParaListAutoFormat(*pTextNd);
480 break;
481 }
482 default:
483 assert(false);
484 }
485 }
486 else
487 {
488 eNewState = PropertyState_DEFAULT_VALUE;
489
490 // #i30838# set default values for default properties
491 switch (rEntry.nWID)
492 {
493 case FN_UNO_NUM_LEVEL:
494 {
495 *pAny <<= static_cast<sal_Int16>( 0 );
496 break;
497 }
498 case FN_UNO_IS_NUMBER:
499 {
500 *pAny <<= false;
501 break;
502 }
503 // #i91601#
504 case FN_UNO_LIST_ID:
505 {
506 *pAny <<= OUString();
507 break;
508 }
510 {
511 *pAny <<= false;
512 break;
513 }
515 {
516 break; // void
517 }
518 default:
519 assert(false);
520 }
521 }
522 //PROPERTY_MAYBEVOID!
523 }
524 break;
525 case FN_UNO_NUM_RULES :
526 if( pAny )
527 getNumberingProperty(rPam, eNewState, pAny);
528 else
529 {
530 if( !SwDoc::GetNumRuleAtPos( *rPam.GetPoint() ) )
531 eNewState = PropertyState_DEFAULT_VALUE;
532 }
533 break;
535 {
536 std::vector<SwTextAttr *> marks;
537 if (rPam.GetPointNode().IsTextNode())
538 {
539 marks = rPam.GetPointNode().GetTextNode()->GetTextAttrsAt(
541 }
542 if (!marks.empty())
543 {
544 if( pAny )
545 { // hmm... can only return 1 here
546 SwTOXMark & rMark =
547 static_cast<SwTOXMark &>((*marks.begin())->GetAttr());
548 const uno::Reference< text::XDocumentIndexMark > xRef =
550 rPam.GetDoc(), &rMark);
551 (*pAny) <<= xRef;
552 }
553 }
554 else
555 //also here - indistinguishable
556 eNewState = PropertyState_DEFAULT_VALUE;
557 }
558 break;
560 {
562 *rPam.Start() );
563 if( pBase )
564 {
565 if( pAny )
566 {
567 const uno::Reference< text::XDocumentIndex > xRef =
569 static_cast<SwTOXBaseSection *>(pBase));
570 (*pAny) <<= xRef;
571 }
572 }
573 else
574 eNewState = PropertyState_DEFAULT_VALUE;
575 }
576 break;
578 {
579 const SwPosition *pPos = rPam.Start();
580 const SwTextNode *pTextNd =
581 rPam.GetDoc().GetNodes()[pPos->GetNodeIndex()]->GetTextNode();
582 const SwTextAttr* pTextAttr = pTextNd
584 : nullptr;
585 if ( pTextAttr != nullptr )
586 {
587 if( pAny )
588 {
589 uno::Reference<text::XTextField> const xField(
591 &pTextAttr->GetFormatField()));
592 *pAny <<= xField;
593 }
594 }
595 else
596 eNewState = PropertyState_DEFAULT_VALUE;
597 }
598 break;
600 case FN_UNO_CELL:
601 {
602 SwStartNode* pSttNode = rPam.GetPointNode().StartOfSectionNode();
605 {
606 if( pAny )
607 {
608 const SwTableNode* pTableNode = pSttNode->FindTableNode();
609 SwFrameFormat* pTableFormat = pTableNode->GetTable().GetFrameFormat();
610 //SwTable& rTable = static_cast<SwTableNode*>(pSttNode)->GetTable();
611 if(FN_UNO_TEXT_TABLE == rEntry.nWID)
612 {
613 uno::Reference< XTextTable > xTable = SwXTextTables::GetObject(*pTableFormat);
614 *pAny <<= xTable;
615 }
616 else
617 {
618 SwTableBox* pBox = pSttNode->GetTableBox();
619 uno::Reference< XCell > xCell = SwXCell::CreateXCell(pTableFormat, pBox);
620 *pAny <<= xCell;
621 }
622 }
623 }
624 else
625 eNewState = PropertyState_DEFAULT_VALUE;
626 }
627 break;
629 {
630 SwStartNode* pSttNode = rPam.GetPointNode().StartOfSectionNode();
632
633 SwFrameFormat* pFormat;
634 if(eType == SwFlyStartNode && nullptr != (pFormat = pSttNode->GetFlyFormat()))
635 {
636 // Create a wrapper only for text frames, not for graphic or OLE nodes.
637 if (pAny && !rPam.GetPointNode().IsNoTextNode())
638 {
639 uno::Reference<XTextFrame> const xFrame(
640 SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat));
641 (*pAny) <<= xFrame;
642 }
643 }
644 else
645 eNewState = PropertyState_DEFAULT_VALUE;
646 }
647 break;
649 {
650 SwSection* pSect = SwDoc::GetCurrSection(*rPam.GetPoint());
651 if(pSect)
652 {
653 if( pAny )
654 {
655 uno::Reference< XTextSection > xSect = SwXTextSections::GetObject( *pSect->GetFormat() );
656 *pAny <<= xSect;
657 }
658 }
659 else
660 eNewState = PropertyState_DEFAULT_VALUE;
661 }
662 break;
664 {
665 SwTextNode* pTextNode = rPam.GetPoint()->GetNode().GetTextNode();
666 if (pTextNode)
667 {
668 if (pAny)
669 {
670 uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
671 *pAny <<= xParagraph;
672 }
673 }
674 else
675 eNewState = PropertyState_DEFAULT_VALUE;
676 }
677 break;
678 case FN_UNO_ENDNOTE:
679 case FN_UNO_FOOTNOTE:
680 {
681 SwTextAttr *const pTextAttr = rPam.GetPointNode().IsTextNode() ?
683 rPam.GetPoint()->GetContentIndex(), RES_TXTATR_FTN) : nullptr;
684 if(pTextAttr)
685 {
686 const SwFormatFootnote& rFootnote = pTextAttr->GetFootnote();
687 if(rFootnote.IsEndNote() == (FN_UNO_ENDNOTE == rEntry.nWID))
688 {
689 if( pAny )
690 {
691 const uno::Reference< text::XFootnote > xFootnote =
693 &const_cast<SwFormatFootnote&>(rFootnote));
694 *pAny <<= xFootnote;
695 }
696 }
697 else
698 eNewState = PropertyState_DEFAULT_VALUE;
699 }
700 else
701 eNewState = PropertyState_DEFAULT_VALUE;
702 }
703 break;
705 {
706 std::vector<SwTextAttr *> marks;
707 if (rPam.GetPointNode().IsTextNode())
708 {
709 marks = rPam.GetPointNode().GetTextNode()->GetTextAttrsAt(
711 }
712 if (!marks.empty())
713 {
714 if( pAny )
715 { // hmm... can only return 1 here
716 const SwFormatRefMark& rRef = (*marks.begin())->GetRefMark();
717 uno::Reference<XTextContent> const xRef =
719 const_cast<SwFormatRefMark*>(&rRef));
720 *pAny <<= xRef;
721 }
722 }
723 else
724 eNewState = PropertyState_DEFAULT_VALUE;
725 }
726 break;
728 {
729 uno::Reference<XTextContent> const xRet(rPam.GetPointNode().IsTextNode()
731 rPam.GetPoint()->GetContentIndex(), false)
732 : nullptr);
733 if (xRet.is())
734 {
735 if (pAny)
736 {
737 (*pAny) <<= xRet;
738 }
739 }
740 else
741 {
742 eNewState = PropertyState_DEFAULT_VALUE;
743 }
744 }
745 break;
747 {
748
749 SwTextNode *const pTextNode = rPam.GetPointNode().GetTextNode();
750 if (&rPam.GetPointNode() == &rPam.GetMarkNode()
751 && pTextNode && pTextNode->GetpSwpHints())
752 {
753 sal_Int32 nPaMStart = rPam.Start()->GetContentIndex();
754 sal_Int32 nPaMEnd = rPam.End()->GetContentIndex();
755 Sequence< OUString> aCharStyles;
756 SwpHints* pHints = pTextNode->GetpSwpHints();
757 for( size_t nAttr = 0; nAttr < pHints->Count(); ++nAttr )
758 {
759 SwTextAttr* pAttr = pHints->Get( nAttr );
760 if(pAttr->Which() != RES_TXTATR_CHARFMT)
761 continue;
762 const sal_Int32 nAttrStart = pAttr->GetStart();
763 const sal_Int32 nAttrEnd = *pAttr->GetEnd();
764 //check if the attribute touches the selection
765 if( ( nAttrEnd > nPaMStart && nAttrStart < nPaMEnd ) ||
766 ( !nAttrStart && !nAttrEnd && !nPaMStart && !nPaMEnd ) )
767 {
768 //check for overlapping
769 if(nAttrStart > nPaMStart ||
770 nAttrEnd < nPaMEnd)
771 {
772 aCharStyles.realloc(0);
773 break;
774 }
775 else
776 {
777 //now the attribute should start before or at the selection
778 //and it should end at the end of the selection or behind
779 OSL_ENSURE(nAttrStart <= nPaMStart && nAttrEnd >=nPaMEnd,
780 "attribute overlaps or is outside");
781 //now the name of the style has to be added to the sequence
782 aCharStyles.realloc(aCharStyles.getLength() + 1);
783 OSL_ENSURE(pAttr->GetCharFormat().GetCharFormat(), "no character format set");
784 aCharStyles.getArray()[aCharStyles.getLength() - 1] =
787 }
788 }
789
790 }
791 eNewState =
792 aCharStyles.hasElements() ?
793 PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
794 if(pAny)
795 (*pAny) <<= aCharStyles;
796 }
797 else
798 eNewState = PropertyState_DEFAULT_VALUE;
799 }
800 break;
802 // no break here!
803 default: bDone = false;
804 }
805 if( bDone )
806 eState = eNewState;
807 return bDone;
808};
809
810sal_Int16 IsNodeNumStart(SwPaM const & rPam, PropertyState& eState)
811{
812 const SwTextNode* pTextNd = rPam.GetPointNode().GetTextNode();
813 // correction: check, if restart value is set at the text node and use
814 // new method <SwTextNode::GetAttrListRestartValue()> to retrieve the value
815 if ( pTextNd && pTextNd->GetNumRule() && pTextNd->IsListRestart() &&
816 pTextNd->HasAttrListRestartValue() )
817 {
818 eState = PropertyState_DIRECT_VALUE;
819 sal_Int16 nTmp = sal::static_int_cast< sal_Int16 >(pTextNd->GetAttrListRestartValue());
820 return nTmp;
821 }
822 eState = PropertyState_DEFAULT_VALUE;
823 return -1;
824}
825
826void setNumberingProperty(const Any& rValue, SwPaM& rPam)
827{
828 uno::Reference<XIndexReplace> xIndexReplace;
829 if(rValue >>= xIndexReplace)
830 {
831 auto pSwNum = comphelper::getFromUnoTunnel<SwXNumberingRules>(xIndexReplace);
832 if(pSwNum)
833 {
834 SwDoc& rDoc = rPam.GetDoc();
835 if(pSwNum->GetNumRule())
836 {
837 SwNumRule aRule(*pSwNum->GetNumRule());
838 const OUString* pNewCharStyles = pSwNum->GetNewCharStyleNames();
839 const OUString* pBulletFontNames = pSwNum->GetBulletFontNames();
840 for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
841 {
842 SwNumFormat aFormat(aRule.Get( i ));
843 if (!pNewCharStyles[i].isEmpty() &&
844 !SwXNumberingRules::isInvalidStyle(pNewCharStyles[i]) &&
845 (!aFormat.GetCharFormat() || pNewCharStyles[i] != aFormat.GetCharFormat()->GetName()))
846 {
847 if (pNewCharStyles[i].isEmpty())
848 {
849 // FIXME
850 // Is something missing/wrong here?
851 // if condition is always false due to outer check!
852 aFormat.SetCharFormat(nullptr);
853 }
854 else
855 {
856
857 // get CharStyle and set the rule
858 const size_t nChCount = rDoc.GetCharFormats()->size();
859 SwCharFormat* pCharFormat = nullptr;
860 for(size_t nCharFormat = 0; nCharFormat < nChCount; ++nCharFormat)
861 {
862 SwCharFormat& rChFormat = *((*(rDoc.GetCharFormats()))[nCharFormat]);
863 if(rChFormat.GetName() == pNewCharStyles[i])
864 {
865 pCharFormat = &rChFormat;
866 break;
867 }
868 }
869
870 if(!pCharFormat)
871 {
873 SfxStyleSheetBase* pBase;
874 pBase = pPool->Find(pNewCharStyles[i], SfxStyleFamily::Char);
875 // shall it really be created?
876 if(!pBase)
877 pBase = &pPool->Make(pNewCharStyles[i], SfxStyleFamily::Page);
878 pCharFormat = static_cast<SwDocStyleSheet*>(pBase)->GetCharFormat();
879 }
880 if(pCharFormat)
881 aFormat.SetCharFormat(pCharFormat);
882 }
883 }
884 //Now again for fonts
885 if(
886 !pBulletFontNames[i].isEmpty() &&
887 !SwXNumberingRules::isInvalidStyle(pBulletFontNames[i]) &&
888 (!aFormat.GetBulletFont() || aFormat.GetBulletFont()->GetFamilyName() != pBulletFontNames[i])
889 )
890 {
891 const SvxFontListItem* pFontListItem =
892 static_cast<const SvxFontListItem* >(rDoc.GetDocShell()
893 ->GetItem( SID_ATTR_CHAR_FONTLIST ));
894 const FontList* pList = pFontListItem->GetFontList();
895
896 FontMetric aFontMetric = pList->Get(
897 pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
898 vcl::Font aFont(aFontMetric);
899 aFormat.SetBulletFont(&aFont);
900 }
901 aRule.Set( i, aFormat );
902 }
903 UnoActionContext aAction(&rDoc);
904
905 if( rPam.GetNext() != &rPam ) // Multiple selection?
906 {
908 SwPamRanges aRangeArr( rPam );
909 SwPaM aPam( *rPam.GetPoint() );
910 for ( size_t n = 0; n < aRangeArr.Count(); ++n )
911 {
912 // no start of a new list
913 rDoc.SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
914 }
915 rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
916 }
917 else
918 {
919 // no start of a new list
920 rDoc.SetNumRule( rPam, aRule, false );
921 }
922
923 }
924 else if(!pSwNum->GetCreatedNumRuleName().isEmpty())
925 {
926 UnoActionContext aAction( &rDoc );
927 SwNumRule* pRule = rDoc.FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
928 if ( !pRule )
929 throw RuntimeException();
930 // no start of a new list
931 rDoc.SetNumRule( rPam, *pRule, false );
932 }
933 else
934 {
935 // #i103817#
936 // outline numbering
937 UnoActionContext aAction(&rDoc);
938 SwNumRule* pRule = rDoc.GetOutlineNumRule();
939 if(!pRule)
940 throw RuntimeException();
941 rDoc.SetNumRule( rPam, *pRule, false );
942 }
943 }
944 }
945 else if ( rValue.getValueType() == cppu::UnoType<void>::get() )
946 {
947 rPam.GetDoc().DelNumRules(rPam);
948 }
949}
950
951void getNumberingProperty(SwPaM& rPam, PropertyState& eState, Any * pAny )
952{
953 const SwNumRule* pNumRule = SwDoc::GetNumRuleAtPos( *rPam.GetPoint() );
954 if(pNumRule)
955 {
956 uno::Reference< XIndexReplace > xNum = new SwXNumberingRules(*pNumRule);
957 if ( pAny )
958 *pAny <<= xNum;
959 eState = PropertyState_DIRECT_VALUE;
960 }
961 else
962 eState = PropertyState_DEFAULT_VALUE;
963}
964
965void GetCurPageStyle(SwPaM const & rPaM, OUString &rString)
966{
967 if (!rPaM.GetPointContentNode())
968 return; // TODO: is there an easy way to get it for tables/sections?
970 // Consider the position inside the content node, since the node may span over multiple pages
971 // with different page styles.
972 SwContentFrame* pFrame = rPaM.GetPointContentNode()->getLayoutFrame(pLayout, rPaM.GetPoint());
973 if(pFrame)
974 {
975 const SwPageFrame* pPage = pFrame->FindPageFrame();
976 if(pPage)
977 {
980 }
981 }
982}
983
984// reset special properties of the cursor
986{
987 SwDoc& rDoc = rPam.GetDoc();
988 switch(rEntry.nWID)
989 {
990 case FN_UNO_PARA_STYLE :
991 break;
992 case FN_UNO_PAGE_STYLE :
993 break;
995 {
996 UnoActionContext aAction(&rDoc);
997
998 if( rPam.GetNext() != &rPam ) // Multiple selection?
999 {
1001 SwPamRanges aRangeArr( rPam );
1002 SwPaM aPam( *rPam.GetPoint() );
1003 for( size_t n = 0; n < aRangeArr.Count(); ++n )
1004 rDoc.SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
1005 rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
1006 }
1007 else
1008 rDoc.SetNodeNumStart( *rPam.GetPoint(), 0 );
1009 }
1010
1011 break;
1012 case FN_UNO_NUM_LEVEL :
1013 break;
1014 case FN_UNO_NUM_RULES:
1015 break;
1017 {
1018 rDoc.ResetAttrs(rPam, true, { RES_TXTATR_CHARFMT });
1019 }
1020 break;
1021 }
1022}
1023
1024void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL,
1025 const uno::Sequence< beans::PropertyValue >& rOptions)
1026{
1027 if (SwTextNode const*const pTextNode = pUnoCursor->GetPoint()->GetNode().GetTextNode())
1028 {
1029 // TODO: check meta field here too in case it ever grows a 2nd char
1030 if (pTextNode->GetTextAttrAt(pUnoCursor->GetPoint()->GetContentIndex(),
1032 {
1033 throw uno::RuntimeException("cannot insert file inside input field");
1034 }
1035
1036 if (pTextNode->GetTextAttrAt(pUnoCursor->GetPoint()->GetContentIndex(),
1038 {
1039 throw uno::RuntimeException("cannot insert file inside content controls");
1040 }
1041 }
1042
1043 std::unique_ptr<SfxMedium> pMed;
1044 SwDoc& rDoc = pUnoCursor->GetDoc();
1045 SwDocShell* pDocSh = rDoc.GetDocShell();
1046 utl::MediaDescriptor aMediaDescriptor( rOptions );
1047 OUString sFileName = rURL;
1048 OUString sFilterName, sFilterOptions, sPassword, sBaseURL;
1049 uno::Reference < io::XStream > xStream;
1050 uno::Reference < io::XInputStream > xInputStream;
1051
1052 if( sFileName.isEmpty() )
1053 aMediaDescriptor[utl::MediaDescriptor::PROP_URL] >>= sFileName;
1054 if( sFileName.isEmpty() )
1055 aMediaDescriptor[utl::MediaDescriptor::PROP_FILENAME] >>= sFileName;
1056 aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM] >>= xInputStream;
1057 aMediaDescriptor[utl::MediaDescriptor::PROP_STREAM] >>= xStream;
1058 aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM] >>= xInputStream;
1059 aMediaDescriptor[utl::MediaDescriptor::PROP_FILTERNAME] >>= sFilterName;
1060 aMediaDescriptor[utl::MediaDescriptor::PROP_FILTEROPTIONS] >>= sFilterOptions;
1061 aMediaDescriptor[utl::MediaDescriptor::PROP_PASSWORD] >>= sPassword;
1062 aMediaDescriptor[utl::MediaDescriptor::PROP_DOCUMENTBASEURL ] >>= sBaseURL;
1063 if ( !xInputStream.is() && xStream.is() )
1064 xInputStream = xStream->getInputStream();
1065
1066 if(!pDocSh || (sFileName.isEmpty() && !xInputStream.is()))
1067 return;
1068
1069 SfxObjectFactory& rFact = pDocSh->GetFactory();
1070 std::shared_ptr<const SfxFilter> pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( sFilterName );
1071 uno::Reference < embed::XStorage > xReadStorage;
1072 if( xInputStream.is() )
1073 {
1074 uno::Sequence< uno::Any > aArgs{ uno::Any(xInputStream),
1075 uno::Any(embed::ElementModes::READ) };
1076 try
1077 {
1078 xReadStorage.set( ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ),
1079 uno::UNO_QUERY );
1080 }
1081 catch( const io::IOException&) {}
1082 }
1083 if ( !pFilter )
1084 {
1085 if( xInputStream.is() && !xReadStorage.is())
1086 {
1087 pMed.reset(new SfxMedium);
1088 pMed->setStreamToLoadFrom(xInputStream, true );
1089 }
1090 else
1091 pMed.reset(xReadStorage.is() ?
1092 new SfxMedium(xReadStorage, sBaseURL ) :
1093 new SfxMedium(sFileName, StreamMode::READ ));
1094 if( !sBaseURL.isEmpty() )
1095 pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
1096
1097 SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
1098 ErrCode nErr = aMatcher.GuessFilter(*pMed, pFilter, SfxFilterFlags::NONE);
1099 if ( nErr || !pFilter)
1100 return;
1101 pMed->SetFilter( pFilter );
1102 }
1103 else
1104 {
1105 if( xInputStream.is() && !xReadStorage.is())
1106 {
1107 pMed.reset(new SfxMedium);
1108 pMed->setStreamToLoadFrom(xInputStream, true );
1109 pMed->SetFilter( pFilter );
1110 }
1111 else
1112 {
1113 if( xReadStorage.is() )
1114 {
1115 pMed.reset(new SfxMedium(xReadStorage, sBaseURL ));
1116 pMed->SetFilter( pFilter );
1117 }
1118 else
1119 pMed.reset(new SfxMedium(sFileName, StreamMode::READ, pFilter, nullptr));
1120 }
1121 if(!sFilterOptions.isEmpty())
1122 pMed->GetItemSet()->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sFilterOptions ) );
1123 if(!sBaseURL.isEmpty())
1124 pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
1125 }
1126
1127 // this sourcecode is not responsible for the lifetime of the shell, SfxObjectShellLock should not be used
1128 SfxObjectShellRef aRef( pDocSh );
1129
1130 pMed->Download(); // if necessary: start the download
1131 if( !(aRef.is() && 1 < aRef->GetRefCount()) ) // Ref still valid?
1132 return;
1133
1134 SwReaderPtr pRdr;
1135 SfxItemSet* pSet = pMed->GetItemSet();
1136 pSet->Put(SfxBoolItem(FN_API_CALL, true));
1137 if(!sPassword.isEmpty())
1138 pSet->Put(SfxStringItem(SID_PASSWORD, sPassword));
1139 Reader *pRead = pDocSh->StartConvertFrom( *pMed, pRdr, nullptr, pUnoCursor);
1140 if( !pRead )
1141 return;
1142
1143 UnoActionContext aContext(&rDoc);
1144
1145 if(pUnoCursor->HasMark())
1146 rDoc.getIDocumentContentOperations().DeleteAndJoin(*pUnoCursor);
1147
1148 SwNodeIndex aSave( pUnoCursor->GetPoint()->GetNode(), -1 );
1149 sal_Int32 nContent = pUnoCursor->GetPoint()->GetContentIndex();
1150
1151 ErrCode nErrno = pRdr->Read( *pRead ); // and paste the document
1152
1153 if(!nErrno)
1154 {
1155 ++aSave;
1156 pUnoCursor->SetMark();
1157 pUnoCursor->GetMark()->Assign( aSave );
1158
1159 SwContentNode* pCntNode = aSave.GetNode().GetContentNode();
1160 if( !pCntNode )
1161 nContent = 0;
1162 pUnoCursor->GetMark()->SetContent( nContent );
1163 }
1164}
1165
1166// insert text and scan for CR characters in order to insert
1167// paragraph breaks at those positions by calling SplitNode
1169 SwDoc &rDoc,
1170 const SwPaM &rNewCursor,
1171 std::u16string_view rText,
1172 const bool bForceExpandHints )
1173{
1174 bool bOK = true;
1175
1176 for (size_t i = 0; i < rText.size(); ++i)
1177 {
1178 sal_Unicode const ch(rText[i]);
1180 && ch != '\r' && ch != '\n' && ch != '\t')
1181 {
1182 SAL_WARN("sw.uno", "DocInsertStringSplitCR: refusing to insert control character " << int(ch));
1183 return false;
1184 }
1185 }
1186
1187 const SwInsertFlags nInsertFlags =
1188 bForceExpandHints
1191
1192 // grouping done in InsertString is intended for typing, not API calls
1193 ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
1194 SwTextNode* const pTextNd =
1195 rNewCursor.GetPoint()->GetNode().GetTextNode();
1196 if (!pTextNd)
1197 {
1198 SAL_INFO("sw.uno", "DocInsertStringSplitCR: need a text node");
1199 return false;
1200 }
1201 OUString aText;
1202 sal_Int32 nStartIdx = 0;
1203 const sal_Int32 nMaxLength = COMPLETE_STRING - pTextNd->GetText().getLength();
1204
1205 size_t nIdx = rText.find( '\r', nStartIdx );
1206 if( ( nIdx == std::u16string_view::npos && nMaxLength < sal_Int32(rText.size()) ) ||
1207 ( nIdx != std::u16string_view::npos && nMaxLength < sal_Int32(nIdx) ) )
1208 {
1209 nIdx = nMaxLength;
1210 }
1211 while (nIdx != std::u16string_view::npos )
1212 {
1213 OSL_ENSURE( sal_Int32(nIdx) - nStartIdx >= 0, "index negative!" );
1214 aText = rText.substr( nStartIdx, nIdx - nStartIdx );
1215 if (!aText.isEmpty() &&
1216 !rDoc.getIDocumentContentOperations().InsertString( rNewCursor, aText, nInsertFlags ))
1217 {
1218 OSL_FAIL( "Doc->Insert(Str) failed." );
1219 bOK = false;
1220 }
1221 if (!rDoc.getIDocumentContentOperations().SplitNode( *rNewCursor.GetPoint(), false ) )
1222 {
1223 OSL_FAIL( "SplitNode failed" );
1224 bOK = false;
1225 }
1226 nStartIdx = nIdx + 1;
1227 nIdx = rText.find( '\r', nStartIdx );
1228 }
1229 aText = rText.substr( nStartIdx );
1230 if (!aText.isEmpty() &&
1231 !rDoc.getIDocumentContentOperations().InsertString( rNewCursor, aText, nInsertFlags ))
1232 {
1233 OSL_FAIL( "Doc->Insert(Str) failed." );
1234 bOK = false;
1235 }
1236
1237 return bOK;
1238}
1239
1240void makeRedline( SwPaM const & rPaM,
1241 std::u16string_view rRedlineType,
1242 const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1243{
1244 IDocumentRedlineAccess& rRedlineAccess = rPaM.GetDoc().getIDocumentRedlineAccess();
1245
1247 if ( rRedlineType == u"Insert" )
1248 eType = RedlineType::Insert;
1249 else if ( rRedlineType == u"Delete" )
1250 eType = RedlineType::Delete;
1251 else if ( rRedlineType == u"Format" )
1252 eType = RedlineType::Format;
1253 else if ( rRedlineType == u"TextTable" )
1254 eType = RedlineType::Table;
1255 else if ( rRedlineType == u"ParagraphFormat" )
1256 eType = RedlineType::ParagraphFormat;
1257 else
1258 throw lang::IllegalArgumentException();
1259
1260 //todo: what about REDLINE_FMTCOLL?
1261 std::size_t nAuthor = 0;
1262 OUString sAuthor;
1263 OUString sComment;
1264 ::util::DateTime aStamp;
1265 uno::Sequence< beans::PropertyValue > aRevertProperties;
1266 bool bIsMoved = false;
1267 bool bFoundComment = false;
1268 bool bFoundStamp = false;
1269 bool bFoundRevertProperties = false;
1270 for (const css::beans::PropertyValue & rProp : rRedlineProperties )
1271 {
1272 if (rProp.Name == "RedlineAuthor")
1273 {
1274 if( rProp.Value >>= sAuthor )
1275 nAuthor = rRedlineAccess.InsertRedlineAuthor(sAuthor);
1276 }
1277 else if (rProp.Name == "RedlineComment")
1278 bFoundComment = rProp.Value >>= sComment;
1279 else if (rProp.Name == "RedlineDateTime")
1280 bFoundStamp = rProp.Value >>= aStamp;
1281 else if (rProp.Name == "RedlineRevertProperties")
1282 bFoundRevertProperties = rProp.Value >>= aRevertProperties;
1283 else if (rProp.Name == "RedlineMoved")
1284 rProp.Value >>= bIsMoved;
1285 }
1286
1287 SwRedlineData aRedlineData( eType, nAuthor );
1288 if( bFoundComment )
1289 aRedlineData.SetComment( sComment );
1290 if( bFoundStamp )
1291 aRedlineData.SetTimeStamp( DateTime( aStamp));
1292
1293 std::unique_ptr<SwRedlineExtraData_FormatColl> xRedlineExtraData;
1294
1295 // Read the 'Redline Revert Properties' from the parameters
1296 // Check if the value exists
1297 if ( bFoundRevertProperties )
1298 {
1299 int nMap = 0;
1300 // Make sure that paragraph format gets its own map, otherwise e.g. fill attributes are not preserved.
1301 if (eType == RedlineType::ParagraphFormat)
1302 {
1304 if (!aRevertProperties.hasElements())
1305 {
1306 // to reject the paragraph style change, use standard style
1307 xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", RES_POOLCOLL_STANDARD, nullptr ));
1308 }
1309 }
1310 else
1312 SfxItemPropertySet const& rPropSet = *aSwMapProvider.GetPropertySet(nMap);
1313
1314 // Check if there are any properties
1315 if (aRevertProperties.hasElements())
1316 {
1317 SwDoc& rDoc = rPaM.GetDoc();
1318
1319 // Build set of attributes we want to fetch
1320 WhichRangesContainer aWhichPairs;
1321 std::vector<SfxItemPropertyMapEntry const*> aEntries;
1322 std::vector<uno::Any> aValues;
1323 aEntries.reserve(aRevertProperties.getLength());
1324 sal_uInt16 nStyleId = USHRT_MAX;
1325 sal_uInt16 nNumId = USHRT_MAX;
1326 for (const auto& rRevertProperty : std::as_const(aRevertProperties))
1327 {
1328 const OUString &rPropertyName = rRevertProperty.Name;
1329 SfxItemPropertyMapEntry const* pEntry = rPropSet.getPropertyMap().getByName(rPropertyName);
1330
1331 if (!pEntry)
1332 {
1333 // unknown property
1334 break;
1335 }
1336 else if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
1337 {
1338 break;
1339 }
1340 else if (rPropertyName == "NumberingRules")
1341 {
1342 aWhichPairs = aWhichPairs.MergeRange(RES_PARATR_NUMRULE, RES_PARATR_NUMRULE);
1343 nNumId = aEntries.size();
1344 }
1345 else
1346 {
1347 aWhichPairs = aWhichPairs.MergeRange(pEntry->nWID, pEntry->nWID);
1348 if (rPropertyName == "ParaStyleName")
1349 nStyleId = aEntries.size();
1350 }
1351 aEntries.push_back(pEntry);
1352 aValues.push_back(rRevertProperty.Value);
1353 }
1354
1355 if (!aWhichPairs.empty())
1356 {
1357 sal_uInt16 nStylePoolId = USHRT_MAX;
1358 OUString sParaStyleName, sUIStyle;
1359 SfxItemSet aItemSet(rDoc.GetAttrPool(), std::move(aWhichPairs));
1360
1361 for (size_t i = 0; i < aEntries.size(); ++i)
1362 {
1363 const uno::Any &rValue = aValues[i];
1364 if (i == nNumId)
1365 {
1366 uno::Reference<container::XNamed> xNumberingRules;
1367 rValue >>= xNumberingRules;
1368 if (xNumberingRules.is())
1369 {
1370 aItemSet.Put( SwNumRuleItem( xNumberingRules->getName() ));
1371 // keep it during export
1372 SwNumRule* pRule = rDoc.FindNumRulePtr(
1373 xNumberingRules->getName());
1374 if (pRule)
1375 pRule->SetUsedByRedline(true);
1376 }
1377 }
1378 else
1379 {
1380 SfxItemPropertyMapEntry const*const pEntry = aEntries[i];
1381 rPropSet.setPropertyValue(*pEntry, rValue, aItemSet);
1382 if (i == nStyleId)
1383 rValue >>= sParaStyleName;
1384 }
1385 }
1386
1387 if (eType == RedlineType::ParagraphFormat && sParaStyleName.isEmpty())
1388 nStylePoolId = RES_POOLCOLL_STANDARD;
1389
1390 // tdf#149747 Get UI style name from programmatic style name
1391 SwStyleNameMapper::FillUIName(sParaStyleName, sUIStyle,
1393 xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl(
1394 sUIStyle.isEmpty() ? sParaStyleName : sUIStyle, nStylePoolId, &aItemSet));
1395 }
1396 else if (eType == RedlineType::ParagraphFormat)
1397 xRedlineExtraData.reset(new SwRedlineExtraData_FormatColl( "", RES_POOLCOLL_STANDARD, nullptr ));
1398 }
1399 }
1400
1401 SwRangeRedline* pRedline = new SwRangeRedline( aRedlineData, rPaM );
1402
1403 // set IsMoved bit of the redline to show and handle moved text
1404 if( bIsMoved )
1405 pRedline->SetMoved();
1406
1407 RedlineFlags nPrevMode = rRedlineAccess.GetRedlineFlags( );
1408 // xRedlineExtraData is copied here
1409 pRedline->SetExtraData( xRedlineExtraData.get() );
1410
1412 auto const result(rRedlineAccess.AppendRedline(pRedline, false));
1413 rRedlineAccess.SetRedlineFlags_intern( nPrevMode );
1415 throw lang::IllegalArgumentException();
1416}
1417
1419 std::u16string_view rRedlineType,
1420 const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1421{
1422 SwDoc* pDoc = rTableLine.GetFrameFormat()->GetDoc();
1423 IDocumentRedlineAccess* pRedlineAccess = &pDoc->getIDocumentRedlineAccess();
1424
1426 if ( rRedlineType == u"TableRowInsert" )
1427 {
1428 eType = RedlineType::TableRowInsert;
1429 }
1430 else if ( rRedlineType == u"TableRowDelete" )
1431 {
1432 eType = RedlineType::TableRowDelete;
1433 }
1434 else
1435 {
1436 throw lang::IllegalArgumentException();
1437 }
1438
1439 // set table row property "HasTextChangesOnly" to false
1440 // to handle tracked deletion or insertion of the table row on the UI
1441 const SvxPrintItem *pHasTextChangesOnlyProp =
1443 if ( !pHasTextChangesOnlyProp || pHasTextChangesOnlyProp->GetValue() )
1444 {
1445 SvxPrintItem aSetTracking(RES_PRINT, false);
1446 SwNodeIndex aInsPos( *(rTableLine.GetTabBoxes()[0]->GetSttNd()), 1 );
1447 // as a workaround for the rows without text content,
1448 // add a redline with invisible text CH_TXT_TRACKED_DUMMY_CHAR
1449 if ( rTableLine.IsEmpty() )
1450 {
1451 SwPaM aPaM(aInsPos);
1453 OUStringChar(CH_TXT_TRACKED_DUMMY_CHAR) );
1454 aPaM.SetMark();
1455 aPaM.GetMark()->SetContent(0);
1456 makeRedline(aPaM, RedlineType::TableRowInsert == eType
1457 ? u"Insert"
1458 : u"Delete", rRedlineProperties);
1459 }
1460 SwCursor aCursor( SwPosition(aInsPos), nullptr );
1461 pDoc->SetRowNotTracked( aCursor, aSetTracking );
1462 }
1463
1464 comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
1465 std::size_t nAuthor = 0;
1466 OUString sAuthor;
1467 if( aPropMap.getValue("RedlineAuthor") >>= sAuthor )
1468 nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
1469
1470 OUString sComment;
1471 SwRedlineData aRedlineData( eType, nAuthor );
1472 if( aPropMap.getValue("RedlineComment") >>= sComment )
1473 aRedlineData.SetComment( sComment );
1474
1475 ::util::DateTime aStamp;
1476 if( aPropMap.getValue("RedlineDateTime") >>= aStamp )
1477 {
1478 aRedlineData.SetTimeStamp(
1479 DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), tools::Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
1480 }
1481
1482 SwTableRowRedline* pRedline = new SwTableRowRedline( aRedlineData, rTableLine );
1483 RedlineFlags nPrevMode = pRedlineAccess->GetRedlineFlags( );
1484 pRedline->SetExtraData( nullptr );
1485
1487 bool bRet = pRedlineAccess->AppendTableRowRedline( pRedline );
1488 pRedlineAccess->SetRedlineFlags_intern( nPrevMode );
1489 if( !bRet )
1490 throw lang::IllegalArgumentException();
1491}
1492
1494 std::u16string_view rRedlineType,
1495 const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1496{
1497 IDocumentRedlineAccess* pRedlineAccess = &rTableBox.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess();
1498
1500 if ( rRedlineType == u"TableCellInsert" )
1501 {
1502 eType = RedlineType::TableCellInsert;
1503 }
1504 else if ( rRedlineType == u"TableCellDelete" )
1505 {
1506 eType = RedlineType::TableCellDelete;
1507 }
1508 else
1509 {
1510 throw lang::IllegalArgumentException();
1511 }
1512
1513 comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
1514 std::size_t nAuthor = 0;
1515 OUString sAuthor;
1516 if( aPropMap.getValue("RedlineAuthor") >>= sAuthor )
1517 nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
1518
1519 OUString sComment;
1520 SwRedlineData aRedlineData( eType, nAuthor );
1521 if( aPropMap.getValue("RedlineComment") >>= sComment )
1522 aRedlineData.SetComment( sComment );
1523
1524 ::util::DateTime aStamp;
1525 if( aPropMap.getValue("RedlineDateTime") >>= aStamp )
1526 {
1527 aRedlineData.SetTimeStamp(
1528 DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), tools::Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
1529 }
1530
1531 SwTableCellRedline* pRedline = new SwTableCellRedline( aRedlineData, rTableBox );
1532 RedlineFlags nPrevMode = pRedlineAccess->GetRedlineFlags( );
1533 pRedline->SetExtraData( nullptr );
1534
1536 bool bRet = pRedlineAccess->AppendTableCellRedline( pRedline );
1537 pRedlineAccess->SetRedlineFlags_intern( nPrevMode );
1538 if( !bRet )
1539 throw lang::IllegalArgumentException();
1540}
1541
1542void SwAnyMapHelper::SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& rAny )
1543{
1544 sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
1545 m_Map[nKey] = rAny;
1546}
1547
1548bool SwAnyMapHelper::FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& pAny )
1549{
1550 bool bRet = false;
1551 sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
1552 auto aIt = m_Map.find( nKey );
1553 if (aIt != m_Map.end())
1554 {
1555 pAny = & aIt->second;
1556 bRet = true;
1557 }
1558 return bRet;
1559}
1560
1561}//namespace SwUnoCursorHelper
1562
1563/* 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:497
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1235
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:763
SwFormatColl & GetAnyFormatColl() const
Definition: node.hxx:756
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:194
static SwSection * GetCurrSection(const SwPosition &rPos)
Definition: ndsect.cxx:502
void SetNodeNumStart(const SwPosition &rPos, sal_uInt16 nStt)
Definition: docnum.cxx:1031
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2441
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1032
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:748
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:321
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:150
SwNodes & GetNodes()
Definition: doc.hxx:417
void SetRowNotTracked(const SwCursor &rCursor, const SvxPrintItem &rNotTracked, bool bAll=false, bool bIns=false)
rNotTracked = false means that the row was deleted or inserted with its tracked cell content bAll: de...
Definition: ndtbl1.cxx:581
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:341
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:1314
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:411
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:861
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:243
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1326
SwDocShell * GetDocShell()
Definition: doc.hxx:1359
static SwNumRule * GetNumRuleAtPos(SwPosition &rPos, SwRootFrame const *pLayout=nullptr)
Definition: docnum.cxx:2413
const std::shared_ptr< SfxItemSet > & GetStyleHandle() const
Definition: fmtautofmt.hxx:49
SwCharFormat * GetCharFormat() const
Definition: fchrfmt.hxx:70
bool IsEndNote() const
Definition: fmtftn.hxx:73
::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:62
SwPageFrame * FindPageFrame()
Definition: frame.hxx:680
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:136
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:742
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:897
bool IsNoTextNode() const
Definition: node.hxx:697
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:777
SwDoc & GetDoc()
Definition: node.hxx:233
bool IsTextNode() const
Definition: node.hxx:685
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:381
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:153
SwContentNode * GetContentNode()
Definition: node.hxx:664
SwCharFormat * GetCharFormat() const
Definition: numrule.hxx:74
void SetCharFormat(SwCharFormat *)
Definition: number.cxx:281
void SetUsedByRedline(bool bUsed)
Definition: numrule.hxx:247
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:87
void Set(sal_uInt16 i, const SwNumFormat *)
Definition: number.cxx:618
bool IsContinueingPreviousSubTree() const
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
SwNode & GetPointNode() const
Definition: pam.hxx:283
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:642
SwContentNode * GetPointContentNode() const
Definition: pam.hxx:287
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:668
const SwPosition * End() const
Definition: pam.hxx:271
SwPaM * GetNext()
Definition: pam.hxx:320
SwDoc & GetDoc() const
Definition: pam.hxx:299
SwNode & GetMarkNode() const
Definition: pam.hxx:284
const SwPosition * GetPoint() const
Definition: pam.hxx:261
const SwPosition * Start() const
Definition: pam.hxx:266
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:259
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:223
void SetMoved()
Definition: redline.hxx:275
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:337
Starts a section of nodes in the document model.
Definition: node.hxx:348
SwStartNodeType GetStartNodeType() const
Definition: node.hxx:364
static const OUString & GetProgName(const OUString &rName, SwGetPoolIdFromName)
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:426
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:464
const SwStartNode * GetSttNd() const
Definition: swtable.hxx:478
Redline that holds information about a table-cell that had some change.
Definition: redline.hxx:315
void SetExtraData(const SwRedlineExtraData *pData)
ExtraData gets copied, the pointer is therefore not taken over by the RedLineObject.
Definition: redline.hxx:326
SwTableLine is one table row in the document model.
Definition: swtable.hxx:364
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:386
SwTableBoxes & GetTabBoxes()
Definition: swtable.hxx:374
bool IsEmpty() const
Definition: swtable.cxx:1563
const SwTable & GetTable() const
Definition: node.hxx:542
Redline that holds information about a table-row that had some change.
Definition: redline.hxx:294
void SetExtraData(const SwRedlineExtraData *pData)
ExtraData gets copied, the pointer is therefore not taken over by the RedLineObject.
Definition: redline.hxx:305
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:207
static SwTable * FindTable(SwFrameFormat const *const pFormat)
Definition: swtable.cxx:2135
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:111
SwNumberTree::tSwNumTreeNumber GetAttrListRestartValue() const
Definition: ndtxt.cxx:4312
OUString GetListId() const
Definition: ndtxt.cxx:4560
SwTextField * GetFieldTextAttrAt(const sal_Int32 nIndex, ::sw::GetTextAttrMode const eMode=::sw::GetTextAttrMode::Expand) const
Definition: ndtxt.cxx:1835
const SwNodeNum * GetNum(SwRootFrame const *pLayout=nullptr, SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Definition: ndtxt.cxx:4075
bool IsInList() const
Definition: ndtxt.cxx:4526
bool IsCountedInList() const
Definition: ndtxt.cxx:4373
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2907
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:4228
bool HasAttrListRestartValue() const
Definition: ndtxt.cxx:4307
bool IsListRestart() const
Definition: ndtxt.cxx:4253
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4148
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:3233
std::vector< SwTextAttr * > GetTextAttrsAt(sal_Int32 const nIndex, sal_uInt16 const nWhich) const
get the innermost text attributes covering position nIndex.
Definition: ndtxt.cxx:1781
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, ::sw::GetTextAttrMode const eMode=::sw::GetTextAttrMode::Default) const
get the innermost text attribute covering position nIndex.
Definition: ndtxt.cxx:1790
SwpHints * GetpSwpHints()
Definition: ndtxt.hxx:250
const OUString & GetText() const
Definition: ndtxt.hxx:242
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:3141
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:1071
::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:3824
SwTableBox * FindBox(SwTable *pTable, SwTableBox *pBox)
search if a box exists in a table
Definition: unotbl.cxx:1154
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:1133
static rtl::Reference< SwXDocumentIndexMark > CreateXDocumentIndexMark(SwDoc &rDoc, SwTOXMark *pMark, TOXTypes eType=TOX_INDEX)
Definition: unoidx.cxx:1614
static rtl::Reference< SwXDocumentIndex > CreateXDocumentIndex(SwDoc &rDoc, SwTOXBaseSection *pSection, TOXTypes eTypes=TOX_INDEX)
Definition: unoidx.cxx:401
static rtl::Reference< SwXFootnote > CreateXFootnote(SwDoc &rDoc, SwFormatFootnote *pFootnoteFormat, bool isEndnote=false)
Definition: unoftn.cxx:142
const SwFrameFormat * GetFrameFormat() const
Definition: unoframe.hxx:153
FlyCntType GetFlyCntType() const
Definition: unoframe.hxx:158
static bool isInvalidStyle(std::u16string_view rName)
Definition: unosett.cxx:994
static rtl::Reference< SwXParagraph > 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 rtl::Reference< SwXReferenceMark > CreateXReferenceMark(SwDoc &rDoc, SwFormatRefMark *pMarkFormat)
Definition: unorefmk.cxx:126
const css::uno::Reference< css::uno::XAggregation > & GetAggregationInterface() const
Definition: unodraw.hxx:245
static rtl::Reference< SwXTextField > CreateXTextField(SwDoc *pDoc, SwFormatField const *pFormat, SwServiceType nServiceId=SwServiceType::Invalid)
Definition: unofield.cxx:1216
static SW_DLLPUBLIC rtl::Reference< SwXTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
Definition: unoframe.cxx:3224
static css::uno::Reference< css::text::XTextSection > GetObject(SwSectionFormat &rFormat)
Definition: unocoll.cxx:1532
SW_DLLPUBLIC SwFrameFormat * GetFrameFormat()
Definition: unotbl.cxx:2016
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:724
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:536
#define FN_UNO_ENDNOTE
Definition: cmdid.h:548
#define FN_UNO_NUM_RULES
Definition: cmdid.h:538
#define FN_UNO_NUM_LEVEL
Definition: cmdid.h:537
#define FN_UNO_LIST_ID
Definition: cmdid.h:620
#define FN_UNO_PARA_NUM_AUTO_FORMAT
Definition: cmdid.h:534
#define FN_UNO_PARA_NUM_STRING
Definition: cmdid.h:624
#define FN_UNO_PARA_CONT_PREV_SUBTREE
Definition: cmdid.h:623
#define FN_UNO_TEXT_TABLE
Definition: cmdid.h:542
#define FN_UNO_PARA_CONDITIONAL_STYLE_NAME
Definition: cmdid.h:576
#define FN_UNO_NESTED_TEXT_CONTENT
Definition: cmdid.h:627
#define FN_UNO_TEXT_SECTION
Definition: cmdid.h:546
#define FN_UNO_IS_NUMBER
Definition: cmdid.h:579
#define FN_UNO_CELL
Definition: cmdid.h:543
#define FN_UNO_PAGE_STYLE
Definition: cmdid.h:532
#define FN_UNO_REFERENCE_MARK
Definition: cmdid.h:545
#define FN_UNO_TEXT_FRAME
Definition: cmdid.h:544
#define FN_UNO_CHARFMT_SEQUENCE
Definition: cmdid.h:604
#define FN_NUMBER_NEWSTART
Definition: cmdid.h:471
#define FN_UNO_DOCUMENT_INDEX
Definition: cmdid.h:540
#define FN_UNO_DOCUMENT_INDEX_MARK
Definition: cmdid.h:539
#define FN_UNO_TEXT_FIELD
Definition: cmdid.h:541
#define FN_API_CALL
Definition: cmdid.h:567
#define FN_UNO_PARA_STYLE
Definition: cmdid.h:531
#define FN_UNO_FOOTNOTE
Definition: cmdid.h:547
#define FN_UNO_TEXT_PARAGRAPH
Definition: cmdid.h:563
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:187
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:615
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, std::u16string_view 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:1103
void DeepCopyPaM(SwPaM const &rSource, SwPaM &rTarget)
Definition: unoobj2.cxx:79
@ Parent
EXPAND : (Start < nIndex <= End)
@ Expand
DEFAULT: (Start <= nIndex < End)
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:1170
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:61
@ RES_POOLCOLL_STANDARD
Standard.
Definition: poolfmt.hxx:250
Marks a position in the document model.
Definition: pam.hxx:37
SwNode & GetNode() const
Definition: pam.hxx:80
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:230
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
Definition: pam.cxx:266
SwNodeOffset GetNodeIndex() const
Definition: pam.hxx:77
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
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:62
#define PROPERTY_MAP_CHAR_AUTO_STYLE
Definition: unomap.hxx:120
#define PROPERTY_MAP_TEXTPORTION_EXTENSIONS
Definition: unomap.hxx:60