25 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
26 #include <com/sun/star/text/ControlCharacter.hpp>
27 #include <com/sun/star/text/TableColumnSeparator.hpp>
28 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
29 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
43 #include <unotext.hxx>
54 #include <unofield.hxx>
57 #include <unoprnms.hxx>
66 #include <section.hxx>
71 #include <strings.hrc>
95 , m_bIsValid(nullptr != pDoc)
101 uno::Reference< text::XTextRange >
103 const uno::Sequence< beans::PropertyValue >&
104 rCharacterAndParagraphProperties,
105 const uno::Reference< text::XTextRange >& xInsertPosition);
110 const uno::Reference<text::XTextRange>& xPos1,
111 const uno::Reference<text::XTextRange>& xPos2);
118 const uno::Sequence< uno::Reference< text::XTextRange > > & rCell,
119 std::vector<SwNodeRange> & rRowNodes,
155 OSL_ENSURE(!
m_pImpl->m_pDoc || !pDoc,
156 "SwXText::SetDoc: already have a doc?");
158 m_pImpl->m_bIsValid = (
nullptr != pDoc);
177 uno::Reference< text::XTextCursor >
180 uno::Reference< text::XTextCursor > xRet;
185 xRet =
static_cast<text::XWordCursor*
>(
187 xRet->gotoStart(
false);
198 aRet <<= uno::Reference< text::XText >(
this);
202 aRet <<= uno::Reference< text::XSimpleText >(
this);
206 aRet <<= uno::Reference< text::XTextRange>(
this);
210 aRet <<= uno::Reference< text::XTextRangeCompare >(
this);
214 aRet <<= uno::Reference< lang::XTypeProvider >(
this);
218 aRet <<= uno::Reference< text::XRelativeTextContentInsert >(
this);
222 aRet <<= uno::Reference< text::XRelativeTextContentRemove >(
this);
226 aRet <<= uno::Reference< beans::XPropertySet >(
this);
230 aRet <<= uno::Reference< lang::XUnoTunnel >(
this);
234 aRet <<= uno::Reference< text::XTextAppendAndConvert >(
this);
238 aRet <<= uno::Reference< text::XTextAppend >(
this);
242 aRet <<= uno::Reference< text::XTextPortionAppend >(
this);
246 aRet <<= uno::Reference< text::XParagraphAppend >(
this);
250 aRet <<= uno::Reference< text::XTextConvert >(
this);
254 aRet <<= uno::Reference< text::XTextContentAppend >(
this);
258 aRet <<= uno::Reference< text::XTextCopy >( this );
263 uno::Sequence< uno::Type > SAL_CALL
266 static const uno::Sequence< uno::Type >
aTypes {
286 const OUString& rString,
sal_Bool bAbsorb)
291 if (!xTextRange.is())
293 throw uno::RuntimeException();
297 throw uno::RuntimeException();
299 const uno::Reference<lang::XUnoTunnel> xRangeTunnel(xTextRange,
302 comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel);
304 comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel);
306 (!pCursor || pCursor->GetDoc() !=
GetDoc()))
308 throw uno::RuntimeException();
313 const SwPaM * pPam(
nullptr);
316 pPam = pCursor->GetPaM();
327 throw uno::RuntimeException();
331 while (pTmp && pTmp->IsSectionNode())
335 if (!pOwnStartNode || (pOwnStartNode != pTmp))
337 throw uno::RuntimeException();
340 bool bForceExpandHints(
false );
347 catch (
const lang::IllegalArgumentException& iae)
351 throw lang::WrappedTargetRuntimeException( iae.Message,
352 uno::Reference< uno::XInterface >(), anyEx );
363 dynamic_cast<SwXTextCursor*>(pCursor) );
370 xTextRange->setString(rString);
386 *
GetDoc(), aInsertPam, rString, bForceExpandHints );
392 const uno::Reference< text::XTextRange > & xTextRange,
393 sal_Int16 nControlCharacter,
sal_Bool bAbsorb)
397 if (!xTextRange.is())
399 throw lang::IllegalArgumentException();
403 throw uno::RuntimeException();
409 throw uno::RuntimeException();
420 m_pImpl->m_pDoc->getIDocumentContentOperations().DeleteAndJoin(aPam);
425 switch (nControlCharacter)
427 case text::ControlCharacter::PARAGRAPH_BREAK :
430 m_pImpl->m_pDoc->getIDocumentContentOperations().SplitNode(*aPam.
GetPoint(),
false);
432 case text::ControlCharacter::APPEND_PARAGRAPH:
435 m_pImpl->m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPam.
GetPoint());
437 const uno::Reference<lang::XUnoTunnel> xRangeTunnel(
438 xTextRange, uno::UNO_QUERY);
440 comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel);
442 comphelper::getFromUnoTunnel<OTextCursorHelper>(
450 SwPaM *
const pCursorPam = pCursor->GetPaM();
456 case text::ControlCharacter::LINE_BREAK: cIns = 10;
break;
457 case text::ControlCharacter::SOFT_HYPHEN: cIns =
CHAR_SOFTHYPHEN;
break;
458 case text::ControlCharacter::HARD_HYPHEN: cIns =
CHAR_HARDHYPHEN;
break;
459 case text::ControlCharacter::HARD_SPACE: cIns =
CHAR_HARDBLANK;
break;
463 m_pImpl->m_pDoc->getIDocumentContentOperations().InsertString(
464 aPam, OUString(cIns), nInsertFlags);
470 const uno::Reference<lang::XUnoTunnel> xRangeTunnel(
471 xTextRange, uno::UNO_QUERY);
473 comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel);
475 comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel);
487 SwPaM *
const pUnoCursor = pCursor->GetPaM();
488 *pUnoCursor->
GetPoint() = *aCursor.GetPoint();
489 if (aCursor.HasMark())
492 *pUnoCursor->
GetMark() = *aCursor.GetMark();
503 const uno::Reference< text::XTextRange > & xRange,
504 const uno::Reference< text::XTextContent > & xContent,
512 lang::IllegalArgumentException aIllegal;
513 aIllegal.Message =
"first parameter invalid;";
518 lang::IllegalArgumentException aIllegal;
519 aIllegal.Message =
"second parameter invalid";
524 uno::RuntimeException aRuntime;
532 lang::IllegalArgumentException aIllegal;
533 aIllegal.Message =
"first parameter invalid";
568 if (pOwnStartNode != pTmp)
570 uno::RuntimeException aRunException;
571 aRunException.Message =
"text interface and cursor not related";
579 const uno::Reference<lang::XUnoTunnel> xContentTunnel(xContent,
581 if (!xContentTunnel.is())
583 lang::IllegalArgumentException aArgException;
584 aArgException.Message =
"text content does not support lang::XUnoTunnel";
588 comphelper::getFromUnoTunnel<SwXDocumentIndexMark>(xContentTunnel);
590 comphelper::getFromUnoTunnel<SwXTextSection>(xContentTunnel);
592 comphelper::getFromUnoTunnel<SwXBookmark>(xContentTunnel);
594 comphelper::getFromUnoTunnel<SwXReferenceMark>(xContentTunnel);
596 comphelper::getFromUnoTunnel<SwXMeta>(xContentTunnel);
597 auto* pContentControl = comphelper::getFromUnoTunnel<SwXContentControl>(xContentTunnel);
599 comphelper::getFromUnoTunnel<SwXTextField>(xContentTunnel);
601 pTextField =
nullptr;
603 const bool bAttribute = pBookmark || pDocumentIndexMark
604 || pSection || pReferenceMark || pMeta || pContentControl || pTextField;
606 if (bAbsorb && !bAttribute)
608 xRange->setString(OUString());
610 uno::Reference< text::XTextRange > xTempRange =
611 (bAttribute && bAbsorb) ? xRange : xRange->getStart();
612 if (bForceExpandHints)
617 xContent->attach(xTempRange);
622 const uno::Reference< text::XTextContent>& xNewContent,
623 const uno::Reference< text::XTextContent>& xSuccessor)
629 uno::RuntimeException aRuntime;
635 comphelper::getFromUnoTunnel<SwXParagraph>(xNewContent);
636 if (!pPara || !pPara->
IsDescriptor() || !xSuccessor.is())
638 throw lang::IllegalArgumentException();
642 const uno::Reference<lang::XUnoTunnel> xSuccTunnel(xSuccessor,
645 comphelper::getFromUnoTunnel<SwXTextSection>(xSuccTunnel);
647 comphelper::getFromUnoTunnel<SwXTextTable>(xSuccTunnel);
648 SwFrameFormat *
const pTableFormat = pXTable ? pXTable->GetFrameFormat() :
nullptr;
650 if(pTableFormat && pTableFormat->GetDoc() ==
GetDoc())
660 else if (pXSection && pXSection->
GetFormat() &&
671 if (!bRet || !pTextNode)
673 throw lang::IllegalArgumentException();
680 const uno::Reference< text::XTextContent>& xNewContent,
681 const uno::Reference< text::XTextContent>& xPredecessor)
687 throw uno::RuntimeException();
691 comphelper::getFromUnoTunnel<SwXParagraph>(xNewContent);
692 if(!pPara || !pPara->
IsDescriptor() || !xPredecessor.is())
694 throw lang::IllegalArgumentException();
697 const uno::Reference<lang::XUnoTunnel> xPredTunnel(xPredecessor,
700 comphelper::getFromUnoTunnel<SwXTextSection>(xPredTunnel);
702 comphelper::getFromUnoTunnel<SwXTextTable>(xPredTunnel);
703 SwFrameFormat *
const pTableFormat = pXTable ? pXTable->GetFrameFormat() :
nullptr;
706 if(pTableFormat && pTableFormat->GetDoc() ==
GetDoc())
716 else if (pXSection && pXSection->
GetFormat() &&
726 if (!bRet || !pTextNode)
728 throw lang::IllegalArgumentException();
735 const uno::Reference< text::XTextContent>& xSuccessor)
741 uno::RuntimeException aRuntime;
747 const uno::Reference<lang::XUnoTunnel> xSuccTunnel(xSuccessor,
750 comphelper::getFromUnoTunnel<SwXTextSection>(xSuccTunnel);
752 comphelper::getFromUnoTunnel<SwXTextTable>(xSuccTunnel);
753 SwFrameFormat *
const pTableFormat = pXTable ? pXTable->GetFrameFormat() :
nullptr;
754 if(pTableFormat && pTableFormat->GetDoc() ==
GetDoc())
762 SwPaM aBefore(aTableIdx);
766 else if (pXSection && pXSection->
GetFormat() &&
775 SwPaM aBefore(aSectIdx);
781 throw lang::IllegalArgumentException();
787 const uno::Reference< text::XTextContent>& xPredecessor)
793 uno::RuntimeException aRuntime;
799 const uno::Reference<lang::XUnoTunnel> xPredTunnel(xPredecessor,
802 comphelper::getFromUnoTunnel<SwXTextSection>(xPredTunnel);
804 comphelper::getFromUnoTunnel<SwXTextTable>(xPredTunnel);
805 SwFrameFormat *
const pTableFormat = pXTable ? pXTable->GetFrameFormat() :
nullptr;
806 if(pTableFormat && pTableFormat->GetDoc() ==
GetDoc())
815 SwPaM aPaM(aTableIdx);
819 else if (pXSection && pXSection->
GetFormat() &&
828 SwPaM aAfter(aSectIdx);
834 throw lang::IllegalArgumentException();
840 const uno::Reference< text::XTextContent > & xContent)
845 uno::RuntimeException aRuntime;
846 aRuntime.Message =
"first parameter invalid";
852 uno::Reference< text::XText > SAL_CALL
858 const uno::Reference< text::XText > xRet(
this);
862 uno::Reference< text::XTextRange > SAL_CALL
867 const uno::Reference< text::XTextCursor > xRef =
CreateCursor();
870 uno::RuntimeException aRuntime;
874 xRef->gotoStart(
false);
878 uno::Reference< text::XTextRange > SAL_CALL
883 const uno::Reference< text::XTextCursor > xRef =
CreateCursor();
886 uno::RuntimeException aRuntime;
890 xRef->gotoEnd(
false);
898 const uno::Reference< text::XTextCursor > xRet =
CreateCursor();
901 SAL_WARN(
"sw.uno",
"cursor was not created in getString() call. Returning empty string.");
905 return xRet->getString();
915 uno::RuntimeException aRuntime;
923 throw uno::RuntimeException();
938 bool bInsertNodes =
false;
951 while(aStartIdx < aEndIdx);
961 const uno::Reference< text::XTextCursor > xRet =
CreateCursor();
965 uno::RuntimeException aRuntime;
970 xRet->setString(rString);
983 comphelper::getFromUnoTunnel<OTextCursorHelper>(xOwnCursor);
984 OSL_ENSURE(pOwnCursor,
"OTextCursorHelper::getUnoTunnelId() ??? ");
1021 return (pOwnStartNode == pTmp);
1026 const uno::Reference<text::XTextRange>& xPos1,
1027 const uno::Reference<text::XTextRange>& xPos2)
1035 throw lang::IllegalArgumentException();
1037 if (!CheckForOwnMember(aPam1) || !CheckForOwnMember(aPam2))
1039 throw lang::IllegalArgumentException();
1042 sal_Int16 nCompare = 0;
1045 if (*pStart1 < *pStart2)
1049 else if (*pStart1 > *pStart2)
1055 OSL_ENSURE(*pStart1 == *pStart2,
1056 "SwPositions should be equal here");
1065 const uno::Reference<text::XTextRange>& xRange1,
1066 const uno::Reference<text::XTextRange>& xRange2)
1070 if (!xRange1.is() || !xRange2.is())
1072 throw lang::IllegalArgumentException();
1074 const uno::Reference<text::XTextRange> xStart1 = xRange1->getStart();
1075 const uno::Reference<text::XTextRange> xStart2 = xRange2->getStart();
1077 return m_pImpl->ComparePositions(xStart1, xStart2);
1082 const uno::Reference<text::XTextRange>& xRange1,
1083 const uno::Reference<text::XTextRange>& xRange2)
1087 if (!xRange1.is() || !xRange2.is())
1089 throw lang::IllegalArgumentException();
1091 uno::Reference<text::XTextRange> xEnd1 = xRange1->getEnd();
1092 uno::Reference<text::XTextRange> xEnd2 = xRange2->getEnd();
1094 return m_pImpl->ComparePositions(xEnd1, xEnd2);
1097 uno::Reference< beans::XPropertySetInfo > SAL_CALL
1102 static uno::Reference< beans::XPropertySetInfo > xInfo =
1103 m_pImpl->m_rPropSet.getPropertySetInfo();
1111 throw lang::IllegalArgumentException();
1116 const OUString& rPropertyName)
1122 throw uno::RuntimeException();
1126 m_pImpl->m_rPropSet.getPropertyMap().getByName(rPropertyName);
1129 beans::UnknownPropertyException aExcept;
1130 aExcept.Message =
"Unknown property: " + rPropertyName;
1135 switch (pEntry->
nWID)
1143 const size_t nRedTableCount = rRedTable.
size();
1144 if (nRedTableCount > 0)
1148 for (
size_t nRed = 0; nRed < nRedTableCount; ++nRed)
1153 if (nOwnIndex == nRedNode.
GetIndex())
1170 const uno::Reference< beans::XPropertyChangeListener >& )
1172 OSL_FAIL(
"SwXText::addPropertyChangeListener(): not implemented");
1178 const uno::Reference< beans::XPropertyChangeListener >& )
1180 OSL_FAIL(
"SwXText::removePropertyChangeListener(): not implemented");
1186 const uno::Reference< beans::XVetoableChangeListener >& )
1188 OSL_FAIL(
"SwXText::addVetoableChangeListener(): not implemented");
1194 const uno::Reference< beans::XVetoableChangeListener >& )
1196 OSL_FAIL(
"SwXText::removeVetoableChangeListener(): not implemented");
1206 return theSwXTextUnoTunnelId.
getSeq();
1212 return comphelper::getSomethingImpl<SwXText>(rId,
this);
1215 uno::Reference< text::XTextRange > SAL_CALL
1217 const uno::Sequence< beans::PropertyValue > & rProperties)
1221 return m_pImpl->finishOrAppendParagraph(rProperties, uno::Reference< text::XTextRange >());
1224 uno::Reference< text::XTextRange > SAL_CALL
1226 const uno::Sequence< beans::PropertyValue > & rProperties,
1227 const uno::Reference< text::XTextRange >& xInsertPosition)
1231 return m_pImpl->finishOrAppendParagraph(rProperties, xInsertPosition);
1234 uno::Reference< text::XTextRange >
1236 const uno::Sequence< beans::PropertyValue > & rProperties,
1237 const uno::Reference< text::XTextRange >& xInsertPosition)
1241 throw uno::RuntimeException();
1247 throw uno::RuntimeException();
1250 uno::Reference< text::XTextRange > xRet;
1251 bool bIllegalException =
false;
1252 bool bRuntimeException =
false;
1260 SwPaM aPam(aInsertPosition);
1263 if (xInsertPosition.is())
1270 m_pDoc->getIDocumentContentOperations().AppendTextNode( *aPam.
GetPoint() );
1272 m_pDoc->ResetAttrs(aPam);
1288 auto itCharStyle = std::find_if(rProperties.begin(), rProperties.end(), [](
const beans::PropertyValue& rValue)
1290 return rValue.Name ==
"CharStyleName";
1292 if ( itCharStyle != rProperties.end() )
1294 for (
const auto& rValue : rProperties)
1296 if ( rValue != *itCharStyle && rValue.Name.startsWith(
"Char") )
1304 catch (
const lang::IllegalArgumentException& rIllegal)
1306 sMessage = rIllegal.Message;
1307 bIllegalException =
true;
1309 catch (
const uno::RuntimeException& rRuntime)
1311 sMessage = rRuntime.Message;
1312 bRuntimeException =
true;
1314 catch (
const uno::Exception& rEx)
1316 sMessage = rEx.Message;
1317 bRuntimeException =
true;
1320 m_pDoc->GetIDocumentUndoRedo().EndUndo(
SwUndoId::END,
nullptr);
1321 if (bIllegalException || bRuntimeException)
1323 m_pDoc->GetIDocumentUndoRedo().Undo();
1324 if (bIllegalException)
1326 lang::IllegalArgumentException aEx;
1327 aEx.Message = sMessage;
1332 uno::RuntimeException aEx;
1333 aEx.Message = sMessage;
1338 OSL_ENSURE(pTextNode,
"no SwTextNode?");
1348 uno::Reference< text::XTextRange > SAL_CALL
1350 const OUString& rText,
1351 const uno::Sequence< beans::PropertyValue > &
1352 rCharacterAndParagraphProperties,
1353 const uno::Reference<text::XTextRange>& xInsertPosition)
1359 throw uno::RuntimeException();
1361 uno::Reference< text::XTextRange > xRet;
1362 const uno::Reference<text::XTextCursor> xTextCursor = createTextCursorByRange(xInsertPosition);
1364 const uno::Reference< lang::XUnoTunnel > xRangeTunnel(
1365 xTextCursor, uno::UNO_QUERY_THROW );
1367 comphelper::getFromUnoTunnel<SwXTextCursor>(xRangeTunnel);
1369 bool bIllegalException =
false;
1370 bool bRuntimeException =
false;
1374 auto& rCursor(pTextCursor->
GetCursor());
1375 m_pImpl->m_pDoc->DontExpandFormat( *rCursor.Start() );
1377 if (!rText.isEmpty())
1379 SwNodeIndex const nodeIndex(rCursor.GetPoint()->nNode, -1);
1380 const sal_Int32 nContentPos = rCursor.GetPoint()->nContent.
GetIndex();
1382 *
m_pImpl->m_pDoc, rCursor, rText,
false);
1384 rCursor.GetPoint()->nNode.Assign(nodeIndex.GetNode(), +1);
1385 rCursor.GetPoint()->nContent = nContentPos;
1393 rCharacterAndParagraphProperties,
1396 catch (
const lang::IllegalArgumentException& rIllegal)
1398 sMessage = rIllegal.Message;
1399 bIllegalException =
true;
1401 catch (
const uno::RuntimeException& rRuntime)
1403 sMessage = rRuntime.Message;
1404 bRuntimeException =
true;
1407 if (bIllegalException || bRuntimeException)
1409 m_pImpl->m_pDoc->GetIDocumentUndoRedo().Undo();
1410 if (bIllegalException)
1412 lang::IllegalArgumentException aEx;
1413 aEx.Message = sMessage;
1418 uno::RuntimeException aEx;
1419 aEx.Message = sMessage;
1429 uno::Reference< text::XTextRange > SAL_CALL
1431 const OUString& rText,
1432 const uno::Sequence< beans::PropertyValue > &
1433 rCharacterAndParagraphProperties)
1437 uno::Reference<text::XTextRange> xInsertPosition =
getEnd();
1438 return insertTextPortion(rText, rCharacterAndParagraphProperties, xInsertPosition);
1443 uno::Reference< text::XTextRange > SAL_CALL
1445 const uno::Reference< text::XTextContent >& xTextContent,
1446 const uno::Sequence< beans::PropertyValue >&
1447 rCharacterAndParagraphProperties,
1448 const uno::Reference< text::XTextRange >& xInsertPosition)
1454 throw uno::RuntimeException();
1460 throw lang::IllegalArgumentException(
"invalid position",
nullptr, 2);
1476 if (rCharacterAndParagraphProperties.hasElements())
1480 const uno::Reference< beans::XPropertySet > xAnchor(
1481 xTextContent->getAnchor(), uno::UNO_QUERY);
1484 for (
const auto& rProperty : rCharacterAndParagraphProperties)
1486 xAnchor->setPropertyValue(rProperty.Name, rProperty.Value);
1490 catch (
const uno::Exception& e)
1494 throw lang::WrappedTargetRuntimeException( e.Message,
1495 uno::Reference< uno::XInterface >(), anyEx );
1499 return xInsertPosition;
1502 uno::Reference< text::XTextRange > SAL_CALL
1504 const uno::Reference< text::XTextContent >& xTextContent,
1505 const uno::Sequence< beans::PropertyValue >& rCharacterAndParagraphProperties
1510 uno::Reference<text::XTextRange> xInsertPosition =
getEnd();
1525 return index.GetNode().IsGrfNode();
1530 uno::Reference< text::XTextContent > SAL_CALL
1532 const uno::Reference< text::XTextRange >& xStart,
1533 const uno::Reference< text::XTextRange >& xEnd,
1534 const uno::Sequence< beans::PropertyValue >& rFrameProperties)
1540 throw uno::RuntimeException();
1547 for (
const auto& rCellProperty : rFrameProperties)
1549 if (rCellProperty.Name ==
"CursorNotIgnoreTables")
1551 bool bAllowNonTextNode =
false;
1552 rCellProperty.Value >>= bAllowNonTextNode;
1553 if (bAllowNonTextNode)
1554 eMode = ::sw::TextRangeMode::AllowTableNode;
1558 uno::Reference< text::XTextContent > xRet;
1559 std::optional<SwUnoInternalPaM> pTempStartPam(*
GetDoc());
1560 std::optional<SwUnoInternalPaM> pEndPam(*
GetDoc());
1564 throw lang::IllegalArgumentException();
1567 auto pStartPam(
GetDoc()->CreateUnoCursor(*pTempStartPam->GetPoint()));
1568 if (pTempStartPam->HasMark())
1570 pStartPam->SetMark();
1571 *pStartPam->GetMark() = *pTempStartPam->GetMark();
1573 pTempStartPam.reset();
1576 comphelper::getFromUnoTunnel<SwXTextRange>(xStart);
1578 comphelper::getFromUnoTunnel<SwXTextRange>(xEnd);
1587 pEndRange->Invalidate();
1591 bool bIllegalException =
false;
1592 bool bRuntimeException =
false;
1604 bool bParaAfterInserted =
false;
1605 bool bParaBeforeInserted =
false;
1607 pStartStartNode && pEndStartNode &&
1608 (pStartStartNode != pEndStartNode || pStartStartNode !=
GetStartNode())
1620 while (pEndStartTableNode && pStartTableNode &&
1627 if (pStartTableNode)
1629 const SwNodeIndex aTableIdx( *pStartTableNode, -1 );
1632 pStartPam->DeleteMark();
1633 *pStartPam->GetPoint() = aBefore;
1642 pEndPam->DeleteMark();
1643 *pEndPam->GetPoint() = aTableEnd;
1647 if ((pStartStartNode != pEndStartNode) ||
1651 if (bParaBeforeInserted)
1653 SwCursor aDelete(*pStartPam->GetPoint(),
nullptr);
1661 if (bParaAfterInserted)
1663 SwCursor aDelete(*pEndPam->GetPoint(),
nullptr);
1671 throw lang::IllegalArgumentException();
1679 if (pStartPam->Start()->nNode == pEndPam->Start()->nNode
1680 && pStartPam->End()->nNode == pEndPam->End()->nNode)
1684 pEndPam->DeleteMark();
1685 *pEndPam->GetPoint() = aEnd;
1687 pStartPam->SetMark();
1688 *pStartPam->End() = *pEndPam->End();
1695 std::set<OUString> aAnchoredObjectsByName;
1696 for (
size_t i = 0;
i <
m_pImpl->m_pDoc->GetSpzFrameFormats()->size(); ++
i)
1705 if (pFrameFormat->
GetName().isEmpty())
1711 aAnchoredObjectsByName.insert(pFrameFormat->
GetName());
1716 const uno::Reference<text::XTextFrame> xNewFrame(
1721 for (
const beans::PropertyValue& rValue : rFrameProperties)
1723 rNewFrame.SwXFrame::setPropertyValue(rValue.Name, rValue.Value);
1728 const uno::Reference< text::XTextRange> xInsertTextRange =
1730 assert(rNewFrame.IsDescriptor());
1731 rNewFrame.attachToRange(xInsertTextRange, pStartPam.get());
1732 rNewFrame.setName(
m_pImpl->m_pDoc->GetUniqueFrameName());
1735 SwTextNode *
const pTextNode(pStartPam->GetNode().GetTextNode());
1737 if (!pTextNode || !pTextNode->Len())
1741 SwPaM aMovePam( pStartPam->GetNode() );
1745 SwFormatAnchor aNewAnchor(rNewFrame.GetFrameFormat()->GetAnchor());
1746 aNewAnchor.
SetAnchor( aMovePam.Start() );
1748 aNewAnchor, *rNewFrame.GetFrameFormat() );
1751 for (
size_t i = 0;
i <
m_pImpl->m_pDoc->GetSpzFrameFormats()->size(); ++
i)
1754 if ((!pFrameFormat->
GetName().isEmpty() && aAnchoredObjectsByName.find(pFrameFormat->
GetName()) != aAnchoredObjectsByName.end() ) ||
1755 ( pFrameFormat->
GetName().isEmpty() && aAnchoredObjectsByPtr.
find(pFrameFormat->
FindSdrObject()) != aAnchoredObjectsByPtr.
end()) )
1760 m_pImpl->m_pDoc->SetAttr(aAnchor, *pFrameFormat);
1765 m_pImpl->m_pDoc->getIDocumentContentOperations().DelFullPara(*pStartPam);
1768 catch (
const lang::IllegalArgumentException& rIllegal)
1770 sMessage = rIllegal.Message;
1771 bIllegalException =
true;
1773 catch (
const uno::RuntimeException& rRuntime)
1775 sMessage = rRuntime.Message;
1776 bRuntimeException =
true;
1779 if (bParaBeforeInserted || bParaAfterInserted)
1781 const uno::Reference<text::XTextCursor> xFrameTextCursor =
1784 comphelper::getFromUnoTunnel<SwXTextCursor>(xFrameTextCursor);
1785 if (bParaBeforeInserted)
1788 m_pImpl->m_pDoc->getIDocumentContentOperations().DelFullPara(*pFrameCursor->
GetPaM());
1790 if (bParaAfterInserted)
1792 xFrameTextCursor->gotoEnd(
false);
1793 if (!bParaBeforeInserted)
1794 m_pImpl->m_pDoc->getIDocumentContentOperations().DelFullPara(*pFrameCursor->
GetPaM());
1801 m_pImpl->m_pDoc->getIDocumentContentOperations().DelFullPara(aPaM);
1807 if (bIllegalException || bRuntimeException)
1809 m_pImpl->m_pDoc->GetIDocumentUndoRedo().Undo();
1810 if (bIllegalException)
1812 lang::IllegalArgumentException aEx;
1813 aEx.Message = sMessage;
1818 uno::RuntimeException aEx;
1819 aEx.Message = sMessage;
1829 struct VerticallyMergedCell
1831 std::vector<uno::Reference< beans::XPropertySet > > aCells;
1832 sal_Int32 nLeftPosition;
1835 VerticallyMergedCell(uno::Reference< beans::XPropertySet >
const& rxCell,
1836 const sal_Int32 nLeft)
1837 : nLeftPosition( nLeft )
1840 aCells.push_back( rxCell );
1846 #define COL_POS_FUZZY 2
1854 const uno::Sequence< uno::Reference< text::XTextRange > > & rCell,
1855 std::vector<SwNodeRange> & rRowNodes,
1858 if (rCell.getLength() != 2)
1860 throw lang::IllegalArgumentException(
1861 "rCell needs to contain 2 elements",
1862 uno::Reference< text::XTextCopy >( &m_rThis ), sal_Int16( 2 ) );
1864 const uno::Reference<text::XTextRange> xStartRange = rCell[0];
1865 const uno::Reference<text::XTextRange> xEndRange = rCell[1];
1875 throw lang::IllegalArgumentException(
1876 "Start or End range cannot be resolved to a SwPaM",
1877 uno::Reference< text::XTextCopy >( &m_rThis ), sal_Int16( 2 ) );
1882 std::unique_ptr<SwNodeRange> pCorrectedRange =
1883 m_pDoc->GetNodes().ExpandRangeForTableBox(aTmpRange);
1885 if (pCorrectedRange)
1887 SwPaM aNewStartPaM(pCorrectedRange->aStart, 0);
1888 aStartCellPam = aNewStartPaM;
1890 sal_Int32 nEndLen = 0;
1892 if (pTextNode !=
nullptr)
1893 nEndLen = pTextNode->
Len();
1895 SwPaM aNewEndPaM(pCorrectedRange->aEnd, nEndLen);
1896 aEndCellPam = aNewEndPaM;
1898 pCorrectedRange.reset();
1920 if (nOpenNodeBlock < 0)
1922 throw lang::IllegalArgumentException();
1926 if (nOpenNodeBlock != 0)
1928 throw lang::IllegalArgumentException();
1943 m_pDoc->getIDocumentContentOperations().SplitNode(*aStartCellPam.
Start(),
false);
1952 if (nLastNodeEndIndex == nStartCellNodeIndex)
1957 throw lang::IllegalArgumentException();
1960 m_pDoc->getIDocumentContentOperations().SplitNode(*aStartCellPam.
Start(),
false);
1962 if (nNewIndex != nStartCellNodeIndex)
1966 assert(nNewIndex == nStartCellNodeIndex + 1);
1977 else if (nStartCellNodeIndex == (nLastNodeEndIndex + 1))
1986 throw lang::IllegalArgumentException();
1993 m_pDoc->getIDocumentContentOperations().SplitNode(*aEndCellPam.
End(),
false);
2010 rRowNodes.push_back(aCellRange);
2017 uno::Sequence<beans::PropertyValue>
const& rRowProperties,
2019 TableColumnSeparators & rRowSeparators)
2021 uno::Reference< beans::XPropertySet >
xRow;
2023 for (
const beans::PropertyValue& rProperty : rRowProperties)
2025 if ( rProperty.Name ==
"TableColumnSeparators" )
2029 TableColumnSeparators aSeparators;
2030 rProperty.
Value >>= aSeparators;
2031 rRowSeparators = aSeparators;
2033 xRow->setPropertyValue(rProperty.Name, rProperty.Value);
2037 static sal_Int32
lcl_GetLeftPos(sal_Int32 nCell, TableColumnSeparators
const& rRowSeparators)
2041 if (rRowSeparators.getLength() < nCell)
2043 return rRowSeparators[nCell - 1].Position;
2048 const sal_Int32 nLeftPos,
2049 const uno::Sequence< beans::PropertyValue >& rCellProperties,
2050 const uno::Reference< uno::XInterface >& xCell,
2051 std::vector<VerticallyMergedCell> & rMergedCells)
2053 const uno::Reference< beans::XPropertySet > xCellPS(xCell, uno::UNO_QUERY);
2054 for (
const auto& rCellProperty : rCellProperties)
2056 const OUString & rName = rCellProperty.Name;
2058 if ( rName ==
"VerticalMerge" )
2062 bool bMerge =
false;
2068 for(
auto& aMergedCell : rMergedCells)
2072 aMergedCell.bOpen =
false;
2076 rMergedCells.emplace_back(xCellPS, nLeftPos);
2080 bool bFound =
false;
2081 SAL_WARN_IF(rMergedCells.empty(),
"sw.uno",
"the first merged cell is missing");
2082 for(
auto& aMergedCell : rMergedCells)
2086 aMergedCell.aCells.push_back( xCellPS );
2090 SAL_WARN_IF(!bFound,
"sw.uno",
"couldn't find first vertically merged cell" );
2097 xCellPS->setPropertyValue(rName, rValue);
2099 catch (
const uno::Exception&)
2110 for(
auto& aMergedCell : rMergedCells)
2115 sal_Int32 nCellCount =
static_cast<sal_Int32
>(aMergedCell.aCells.size());
2118 SAL_WARN(
"sw.uno",
"incomplete vertical cell merge");
2123 for(
auto pxPSet = aMergedCell.aCells.begin()+1; nCellCount<0; ++pxPSet, ++nCellCount)
2128 uno::Reference< text::XTextTable > SAL_CALL
2130 const uno::Sequence< uno::Sequence< uno::Sequence<
2131 uno::Reference< text::XTextRange > > > >& rTableRanges,
2132 const uno::Sequence< uno::Sequence< uno::Sequence<
2133 beans::PropertyValue > > >& rCellProperties,
2134 const uno::Sequence< uno::Sequence< beans::PropertyValue > >&
2136 const uno::Sequence< beans::PropertyValue >& rTableProperties)
2142 throw uno::RuntimeException();
2148 throw uno::RuntimeException(
2149 "cannot convertToTable if tracked changes are hidden!");
2153 const uno::Sequence< uno::Sequence< uno::Reference< text::XTextRange > > >*
2154 pTableRanges = rTableRanges.getConstArray();
2155 std::vector< std::vector<SwNodeRange> > aTableNodes;
2156 for (sal_Int32 nRow = 0; nRow < rTableRanges.getLength(); ++nRow)
2158 std::vector<SwNodeRange> aRowNodes;
2159 const uno::Sequence< uno::Reference< text::XTextRange > >* pRow =
2160 pTableRanges[nRow].getConstArray();
2161 const sal_Int32 nCells(pTableRanges[nRow].
getLength());
2165 throw lang::IllegalArgumentException();
2168 for (sal_Int32 nCell = 0; nCell < nCells; ++nCell)
2174 : &*aTableNodes.rbegin()->rbegin())
2175 : &*aRowNodes.rbegin());
2176 m_pImpl->ConvertCell(pRow[nCell], aRowNodes, pLastCell);
2178 assert(!aRowNodes.empty());
2179 aTableNodes.push_back(aRowNodes);
2182 std::vector< TableColumnSeparators >
2183 aRowSeparators(rRowProperties.getLength());
2184 std::vector<VerticallyMergedCell> aMergedCells;
2186 SwTable const*
const pTable =
m_pImpl->m_pDoc->TextToTable( aTableNodes );
2189 return uno::Reference< text::XTextTable >();
2191 uno::Reference<text::XTextTable>
const xRet =
2193 uno::Reference<beans::XPropertySet>
const xPrSet(xRet, uno::UNO_QUERY);
2199 for(
const auto& rTableProperty : rTableProperties)
2203 xPrSet->setPropertyValue(rTableProperty.Name, rTableProperty.Value);
2205 catch (
const uno::Exception&)
2212 const auto xRows = xRet->getRows();
2213 const sal_Int32 nLast =
std::min(xRows->getCount(), rRowProperties.getLength());
2214 SAL_WARN_IF(nLast != rRowProperties.getLength(),
"sw.uno",
"not enough rows for properties");
2215 for(sal_Int32 nCnt = 0; nCnt < nLast; ++nCnt)
2218 uno::Reference<table::XCellRange>
const xCR(xRet, uno::UNO_QUERY_THROW);
2221 for(
const auto& rCellPropertiesForRow : rCellProperties)
2223 sal_Int32 nCell = 0;
2224 for(
const auto& rCellProps : rCellPropertiesForRow)
2228 xCR->getCellByPosition(nCell, nRow),
2239 catch (
const lang::WrappedTargetException&)
2242 catch (
const lang::IndexOutOfBoundsException&)
2254 const uno::Reference< text::XTextCopy >& xSource )
2258 uno::Reference<lang::XUnoTunnel>
const xSourceTunnel(xSource,
2260 SwXText const*
const pSource(comphelper::getFromUnoTunnel<SwXText>(xSourceTunnel));
2262 uno::Reference< text::XText >
const xText(xSource, uno::UNO_QUERY_THROW);
2263 uno::Reference< text::XTextCursor >
const xCursor =
2264 xText->createTextCursor();
2265 xCursor->gotoEnd(
true );
2267 uno::Reference< lang::XUnoTunnel >
const xCursorTunnel(xCursor,
2268 uno::UNO_QUERY_THROW);
2271 comphelper::getFromUnoTunnel<OTextCursorHelper>(xCursorTunnel);
2274 throw uno::RuntimeException();
2285 pFirstNode = temp.GetMark()->nNode.GetNode().
GetTextNode();
2292 pNode->MakeEndIndex(&temp.GetPoint()->nContent);
2303 m_pImpl->m_pDoc->getIDocumentContentOperations().DelFullPara(*pDelCursor);
2325 return "SwXBodyText";
2333 uno::Sequence< OUString > SAL_CALL
2336 return {
"com.sun.star.text.Text" };
2345 aRet <<= uno::Reference< container::XEnumerationAccess >(
this);
2349 aRet <<= uno::Reference< container::XElementAccess >(
this);
2353 aRet <<= uno::Reference< lang::XServiceInfo >(
this);
2361 aRet = OWeakAggObject::queryAggregation( rType );
2366 uno::Sequence< uno::Type > SAL_CALL
2371 return ::comphelper::concatSequences(aTypes, aTextTypes);
2374 uno::Sequence< sal_Int8 > SAL_CALL
2377 return css::uno::Sequence<sal_Int8>();
2397 SwPaM aPam(
GetDoc()->GetNodes().GetEndOfContent());
2417 uno::Reference< text::XTextCursor > SAL_CALL
2422 const uno::Reference< text::XTextCursor > xRef =
2426 uno::RuntimeException aRuntime;
2433 uno::Reference< text::XTextCursor > SAL_CALL
2435 const uno::Reference< text::XTextRange > & xTextPosition)
2441 uno::RuntimeException aRuntime;
2446 uno::Reference< text::XTextCursor > aRef;
2451 throw uno::RuntimeException(
"Invalid text range" );
2465 aRef =
static_cast<text::XWordCursor*
>(
2472 throw uno::RuntimeException(
"End of content node doesn't have the proper start node",
2473 uno::Reference< uno::XInterface >( *
this ) );
2478 uno::Reference< container::XEnumeration > SAL_CALL
2485 uno::RuntimeException aRuntime;
2492 auto pUnoCursor(
GetDoc()->CreateUnoCursor(aPos));
2510 uno::RuntimeException aRuntime;
2526 : m_pHeadFootFormat(&rHeadFootFormat)
2527 , m_bIsHeader(bIsHeader)
2537 if (!m_pHeadFootFormat) {
2538 throw uno::RuntimeException(
"SwXHeadFootText: disposed or invalid",
nullptr);
2545 if(rHint.
GetId() == SfxHintId::Dying)
2546 m_pHeadFootFormat =
nullptr;
2552 const bool bIsHeader)
2556 uno::Reference<text::XText> xText(rHeadFootFormat.
GetXObject(), uno::UNO_QUERY);
2567 rHeadFootFormat.GetDoc(),
2579 return {
"SwXHeadFootText"};
2587 uno::Sequence<OUString> SAL_CALL
2590 return {
"com.sun.star.text.Text"};
2615 return ::comphelper::concatSequences(
2616 SwXHeadFootText_Base::getTypes(),
2622 return css::uno::Sequence<sal_Int8>();
2627 const uno::Any ret = SwXHeadFootText_Base::queryInterface(rType);
2640 const SwNode& rNode = rFlyContent.GetContentIdx()->GetNode();
2644 auto& rUnoCursor(pXCursor->GetCursor());
2665 rUnoCursor.GetPoint()->nContent.Assign(pCont, 0);
2670 if (!pNewStartNode || (pNewStartNode != pOwnStartNode))
2672 uno::RuntimeException aExcept;
2673 aExcept.Message =
"no text available";
2676 return static_cast<text::XWordCursor*
>(pXCursor.get());
2679 uno::Reference<text::XTextCursor> SAL_CALL
2686 const uno::Reference<text::XTextRange>& xTextPosition)
2694 uno::RuntimeException aRuntime;
2699 SwNode& rNode = rHeadFootFormat.GetContent().GetContentIdx()->GetNode();
2707 if (p1 == pOwnStartNode)
2709 return static_cast<text::XWordCursor*
>(
2714 *aPam.GetPoint(), aPam.GetMark()));
2725 const SwNode& rNode = rFlyContent.GetContentIdx()->GetNode();
2727 auto pUnoCursor(
GetDoc()->CreateUnoCursor(aPos));
SwStartNode * FindSttNodeByType(SwStartNodeType eTyp)
const SwEndNode * EndOfSectionNode() const
Starts a section of nodes in the document model.
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
static void lcl_ApplyRowProperties(uno::Sequence< beans::PropertyValue > const &rRowProperties, uno::Any const &rRow, TableColumnSeparators &rRowSeparators)
void SetDoc(SwDoc *const pDoc)
SwMoveFnCollection const & fnParaEnd
static css::uno::Reference< css::text::XTextTable > CreateXTextTable(SwFrameFormat *pFrameFormat)
SwNode & GetNode(bool bPoint=true) const
bool GoInContent(SwPaM &rPam, SwMoveFnCollection const &fnMove)
SwNodeOffset EndOfSectionIndex() const
Marks a position in the document model.
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
bool IsSectionNode() const
void attachToText(SwXText &rParent, SwTextNode &rTextNode)
for SwXText
#define PROPERTY_MAP_TEXT_CURSOR
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
bool GoCurrPara(SwPaM &rPam, SwMoveFnCollection const &aPosPara)
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
virtual sal_Int32 Len() const override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
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)
const SwPosition * GetMark() const
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
SwMoveFnCollection const & fnParaStart
SwSectionNode is derived from SwStartNode.
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL finishParagraphInsert(const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties, const css::uno::Reference< css::text::XTextRange > &xInsertPosition) override
void DeleteAndInsert(OUString const &rText, const bool bForceExpandHints)
const_iterator find(const Value &x) const
sal_Int16 SAL_CALL compareRegionEnds(const css::uno::Reference< css::text::XTextRange > &xR1, const css::uno::Reference< css::text::XTextRange > &xR2) override
Content, content of frame (header, footer, fly).
void SetPropertyValues(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const css::uno::Sequence< css::beans::PropertyValue > &rPropertyValues, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
IDocumentUndoRedo & GetIDocumentUndoRedo()
static bool isGraphicNode(const SwFrameFormat *pFrameFormat)
SwNodeOffset abs(const SwNodeOffset &a)
#define UNO_NAME_ROW_SPAN
IDocumentContentOperations const & getIDocumentContentOperations() const
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
SwTableFormat * GetFrameFormat()
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual OUString SAL_CALL getImplementationName() override
static bool IsShowChanges(const RedlineFlags eM)
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
css::uno::Reference< css::i18n::XExtendedTransliteration > Body
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
::sw::UnoImplPtr< Impl > m_pImpl
sal_Int16 SAL_CALL compareRegionStarts(const css::uno::Reference< css::text::XTextRange > &xR1, const css::uno::Reference< css::text::XTextRange > &xR2) override
OUString SwResId(TranslateId aId)
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
virtual css::uno::Reference< css::text::XTextTable > SAL_CALL convertToTable(css::uno::Sequence< css::uno::Sequence< css::uno::Sequence< css::uno::Reference< css::text::XTextRange > > > > const &rTableRanges, css::uno::Sequence< css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > > const &rCellProperties, css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > const &rRowProperties, css::uno::Sequence< css::beans::PropertyValue > const &rTableProperties) override
SwNodeType GetNodeType() const
Any SAL_CALL getCaughtException()
check if target position is in fly anchored at source range
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
virtual const SwStartNode * GetStartNode() const
SwNodeOffset GetIndex() const
uno::Sequence< text::TableColumnSeparator > TableColumnSeparators
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
static void lcl_ApplyCellProperties(const sal_Int32 nLeftPos, const uno::Sequence< beans::PropertyValue > &rCellProperties, const uno::Reference< uno::XInterface > &xCell, std::vector< VerticallyMergedCell > &rMergedCells)
void SelectPam(SwPaM &rPam, const bool bExpand)
const css::uno::Sequence< sal_Int8 > & getSeq() const
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL appendTextContent(const css::uno::Reference< css::text::XTextContent > &xTextContent, const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties) override
PaM is Point and Mark: a selection of the document model.
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
static SwTable * FindTable(SwFrameFormat const *const pFormat)
virtual OUString SAL_CALL getString() override
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
virtual void SAL_CALL copyText(const css::uno::Reference< css::text::XTextCopy > &xSource) override
static bool lcl_SimilarPosition(const sal_Int32 nPos1, const sal_Int32 nPos2)
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
const SwStartNode * StartOfSectionNode() const
virtual void SAL_CALL insertTextContentAfter(const css::uno::Reference< css::text::XTextContent > &xNewContent, const css::uno::Reference< css::text::XTextContent > &xPredecessor) override
const SwPosition * GetPoint() const
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rIdentifier) override
virtual const SwPaM * GetPaM() const override
SwIndex & Assign(SwIndexReg *, sal_Int32)
void ConvertCell(const uno::Sequence< uno::Reference< text::XTextRange > > &rCell, std::vector< SwNodeRange > &rRowNodes, SwNodeRange *const pLastCell)
static sal_Int32 lcl_GetLeftPos(sal_Int32 nCell, TableColumnSeparators const &rRowSeparators)
bool CheckForOwnMember(const SwPaM &rPaM)
uno::Reference< text::XTextRange > finishOrAppendParagraph(const uno::Sequence< beans::PropertyValue > &rCharacterAndParagraphProperties, const uno::Reference< text::XTextRange > &xInsertPosition)
SwNodeOffset GetIndex() const
void MakeStartIndex(SwIndex *pIdx)
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
virtual void PrepareForAttach(css::uno::Reference< css::text::XTextRange > &xRange, SwPaM const &rPam)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
void AddRule(SwUndoArg eWhat, const OUString &rWith)
virtual css::uno::Reference< css::text::XTextCursor > CreateCursor()
virtual css::uno::Type SAL_CALL getElementType() override
virtual void SAL_CALL removeTextContentAfter(const css::uno::Reference< css::text::XTextContent > &xPredecessor) override
Marks a node in the document model.
static void lcl_MergeCells(std::vector< VerticallyMergedCell > &rMergedCells)
css::uno::Type const & get()
SfxItemPropertySet const & m_rPropSet
bool GoInDoc(SwPaM &rPam, SwMoveFnCollection const &fnMove)
const_iterator end() const
SwStartNodeType GetStartNodeType() const
bool StartListening(SvtBroadcaster &rBroadcaster)
SwStartNode * GetStartNode()
SwTable is one table in the document model, containing rows (which contain cells).
const SwPosition * Start() const
virtual ~SwXBodyText() override
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > &xTextPosition) override
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange,::sw::TextRangeMode const eMode)
const SwNodeIndex * GetContentIdx() const
constexpr OUStringLiteral cInvalidObject
SvtBroadcaster & GetNotifier()
virtual const SwPaM * GetPaM() const =0
UNO API wrapper around an internal sw::mark::IMark.
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual bool CheckForOwnMemberMeta(const SwPaM &rPam, const bool bAbsorb)
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL appendTextPortion(const OUString &rText, const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties) override
SwTextNode is a paragraph in the document model.
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &rType) override
const SwDoc * GetDoc() const
sal_Int16 ComparePositions(const uno::Reference< text::XTextRange > &xPos1, const uno::Reference< text::XTextRange > &xPos2)
#define PROPERTY_MAP_PARAGRAPH
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
static css::uno::Sequence< css::beans::PropertyValue > CreateRedlineProperties(SwRangeRedline const &rRedline, bool const bIsStart)
SwUnoCursor & GetCursor()
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL finishParagraph(const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties) override
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
#define SAL_WARN_IF(condition, area, stream)
Blocks grouping undo actions together into an SfxListUndoAction.
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
SwXBodyText(SwDoc *const pDoc)
bool DontExpandFormat(const SwPosition &rPos, bool bFlag=true)
virtual bool DelFullPara(SwPaM &)=0
Delete full paragraphs.
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
sal_Int32 GetIndex() const
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Impl(SwXText &rThis, SwDoc *const pDoc, const CursorType eType)
void SetPropertyValue(SwPaM &rPaM, const SfxItemPropertySet &rPropSet, const OUString &rPropertyName, const css::uno::Any &rValue, const SetAttrMode nAttrMode=SetAttrMode::DEFAULT)
SwXText(SwDoc *const pDoc, const CursorType eType)
SwSectionFormat * GetFormat() const
const SwPosition * End() const
static SW_DLLPUBLIC css::uno::Reference< css::text::XTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
bool IsDescriptor() const
SwTableNode is derived from SwStartNode.
SwUnoPropertyMapProvider aSwMapProvider
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
double getLength(const B2DPolygon &rCandidate)
virtual bool AppendTextNode(SwPosition &rPos)=0
SwMoveFnCollection const & fnMoveBackward
SwTableNode * FindTableNode()
Search table node, in which it is.
UNO wrapper around an SwFormatField, i.e.
virtual void SAL_CALL removeTextContentBefore(const css::uno::Reference< css::text::XTextContent > &xSuccessor) override
virtual css::uno::Reference< css::text::XTextContent > SAL_CALL convertToTextFrame(const css::uno::Reference< css::text::XTextRange > &xStart, const css::uno::Reference< css::text::XTextRange > &xEnd, const css::uno::Sequence< css::beans::PropertyValue > &xFrameProperties) override
rtl::Reference< SwXTextCursor > CreateTextCursor(const bool bIgnoreTables=false)
#define SAL_WARN(area, stream)
bool DocInsertStringSplitCR(SwDoc &rDoc, const SwPaM &rNewCursor, const OUString &rText, const bool bForceExpandHints)
Ends a section of nodes in the document model.
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
static rtl::Reference< SwXParagraphEnumeration > Create(css::uno::Reference< css::text::XText > const &xParent, const std::shared_ptr< SwUnoCursor > &pCursor, const CursorType eType, SwTableBox const *const pTableBox=nullptr)
virtual const SwRedlineTable & GetRedlineTable() const =0
std::pair< const_iterator, bool > insert(Value &&x)
virtual void SAL_CALL setString(const OUString &rString) override
#define FN_UNO_REDLINE_NODE_END
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL insertTextContentWithProperties(const css::uno::Reference< css::text::XTextContent > &xTextContent, const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties, const css::uno::Reference< css::text::XTextRange > &xInsertPosition) override
virtual void SAL_CALL insertTextContentBefore(const css::uno::Reference< css::text::XTextContent > &xNewContent, const css::uno::Reference< css::text::XTextContent > &xSuccessor) override
virtual void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::text::XTextContent > &xContent, sal_Bool bAbsorb) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
SwContentNode * GoNext(SwNodeIndex *) const
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL insertTextPortion(const OUString &rText, const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties, const css::uno::Reference< css::text::XTextRange > &rTextRange) override
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
virtual sal_Bool SAL_CALL hasElements() override
#define PROPERTY_MAP_TEXT
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
SwTableNode * GetTableNode() const
Base class of the Writer document model elements.
SW_DLLPUBLIC SwFrameFormat * GetFrameFormat()