49#include <com/sun/star/document/XActionLockable.hpp>
50#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
51#include <com/sun/star/text/SizeType.hpp>
52#include <com/sun/star/text/WrapTextMode.hpp>
53#include <com/sun/star/text/XTextDocument.hpp>
54#include <com/sun/star/text/XTextFrame.hpp>
55#include <com/sun/star/table/BorderLine2.hpp>
56#include <com/sun/star/text/WritingMode.hpp>
57#include <com/sun/star/text/WritingMode2.hpp>
58#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
59#include <com/sun/star/style/ParagraphAdjust.hpp>
73 OUString sCopyableText;
79 uno::Reference<text::XText> xSrcCnt(
pObject->getWeakUnoShape().get(), uno::UNO_QUERY);
80 auto xCur = xSrcCnt->createTextCursor();
81 xCur->gotoStart(
false);
83 sCopyableText = xCur->getText()->getString();
88 uno::Reference<text::XTextContent> xTextFrame(
91 uno::Reference<text::XTextDocument> xTextDocument(
93 uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(),
95 xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence<beans::PropertyValue>());
98 uno::Reference<text::XTextFrame> xRealTextFrame(xTextFrame, uno::UNO_QUERY);
99 auto pTextFrame =
dynamic_cast<SwXTextFrame*
>(xRealTextFrame.get());
100 assert(
nullptr != pTextFrame);
108 auto pTextBox = std::make_shared<SwTextBoxNode>(
SwTextBoxNode(pShape));
109 pTextBox->AddTextBox(
pObject, pFormat);
116 pTextBox->AddTextBox(
pObject, pFormat);
120 uno::Reference<beans::XPropertySet> xPropertySet(xTextFrame, uno::UNO_QUERY);
121 uno::Any aEmptyBorder{ table::BorderLine2() };
133 uno::Reference<container::XNamed> xNamed(xTextFrame, uno::UNO_QUERY);
134 assert(!xNamed->getName().isEmpty());
138 uno::Reference<text::XTextRange> xTextBox(xTextFrame, uno::UNO_QUERY_THROW);
151 uno::Reference<drawing::XShape> xShape(
pObject->getUnoShape(), uno::UNO_QUERY);
154 uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
175 text::WritingMode
eMode;
183 if (!bCopyText || sCopyableText.isEmpty())
189 uno::Reference<text::XTextRange> xDestText(xRealTextFrame, uno::UNO_QUERY);
191 xDestText->setString(sCopyableText);
194 pSourceText->SetText(OUString());
201 uno::Reference<text::XTextFrame> xNew)
204 assert(pShapeFormat && pObj && xNew);
207 if (
auto pTextFrame =
dynamic_cast<SwXTextFrame*
>(xNew.get()))
208 pFormat = pTextFrame->GetFrameFormat();
216 if (pTextBoxNode->GetTextBox(pObj))
217 pTextBoxNode->DelTextBox(pObj,
true);
219 pTextBoxNode->AddTextBox(pObj, pFormat);
226 auto pTextBox = std::make_shared<SwTextBoxNode>(
SwTextBoxNode(pShapeFormat));
227 pTextBox->AddTextBox(pObj, pFormat);
232 uno::Reference<beans::XPropertySet> xPropertySet(xNew, uno::UNO_QUERY);
233 uno::Any aEmptyBorder{ table::BorderLine2() };
242 uno::Reference<container::XNamed> xNamed(xNew, uno::UNO_QUERY);
243 assert(!xNamed->getName().isEmpty());
246 uno::Reference<drawing::XShape> xShape(pObj->
getUnoShape(), uno::UNO_QUERY);
248 uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
265 drawing::TextVerticalAdjust aVertAdj = drawing::TextVerticalAdjust_CENTER;
266 if ((uno::Reference<beans::XPropertyState>(xShape, uno::UNO_QUERY_THROW))
268 != beans::PropertyState::PropertyState_DEFAULT_VALUE)
271 .get<drawing::TextVerticalAdjust>();
274 text::WritingMode
eMode;
293 pTextBox->DelTextBox(
pObject,
true);
312 return pTextBox->GetTextBox(
pObject);
314 return pTextBox->GetTextBox(pObj);
319 return pTextBox->GetOwnerShape();
330 uno::Reference<drawing::XShape> xShape(pObj->
getWeakUnoShape().get(), uno::UNO_QUERY);
342 if (
p &&
p->IsTextBox())
353 for (
const auto pFormat : rSpzFrameFormats)
364 throw lang::IndexOutOfBoundsException();
371 if (
p &&
p->IsTextBox())
382 throw lang::IndexOutOfBoundsException();
391 sal_Int32 nOrder = 0;
392 for (std::size_t
i = 0;
i < pPage->GetObjCount(); ++
i)
395 if (
p &&
p->IsTextBox())
403 SAL_WARN(
"sw.core",
"SwTextBoxHelper::getOrdNum: no page or page doesn't contain the object");
415 sal_uInt16 nType,
const SdrObject* pObject)
438 auto pShape =
dynamic_cast<SwXShape*
>(xShape.get());
447uno::Reference<text::XTextFrame>
455 auto pSdrObj = pFrameFormat->FindSdrObject();
458 return { pSdrObj->getUnoShape(), uno::UNO_QUERY };
471 uno::Reference<T>
const xInterface(
486 lcl_queryInterface<text::XTextAppend>(pShape, aRet, pObj);
490 lcl_queryInterface<text::XText>(pShape, aRet, pObj);
494 lcl_queryInterface<text::XTextRange>(pShape, aRet, pObj);
513 uno::Reference<document::XActionLockable> xLockable(pCustomShape->getUnoShape(),
515 sal_Int16 nLocks = 0;
517 nLocks = xLockable->resetActionLocks();
518 pCustomShape->GetTextBounds(aRet);
520 xLockable->setActionLocks(nLocks);
533 aPoint.AdjustX(-(aSize.
Width() / 2));
534 aPoint.AdjustY(-(aSize.
Height() / 2));
536 aRet.
Move(-1 * aLogicRect.
Left(), -1 * aLogicRect.
Top());
543 const css::uno::Any& rValue,
SdrObject* pObj)
553 uno::Reference<text::XTextCursor> xCursor = xTextFrame->getText()->createTextCursor();
556 xCursor->gotoStart(
false);
557 xCursor->gotoEnd(
true);
558 uno::Reference<beans::XPropertySet> xFrameParaProps(xCursor, uno::UNO_QUERY);
561 const auto eValue = rValue.get<drawing::TextHorizontalAdjust>();
564 case drawing::TextHorizontalAdjust::TextHorizontalAdjust_CENTER:
565 xFrameParaProps->setPropertyValue(
567 uno::Any(style::ParagraphAdjust::ParagraphAdjust_CENTER));
569 case drawing::TextHorizontalAdjust::TextHorizontalAdjust_LEFT:
570 xFrameParaProps->setPropertyValue(
572 uno::Any(style::ParagraphAdjust::ParagraphAdjust_LEFT));
574 case drawing::TextHorizontalAdjust::TextHorizontalAdjust_RIGHT:
575 xFrameParaProps->setPropertyValue(
577 uno::Any(style::ParagraphAdjust::ParagraphAdjust_RIGHT));
581 "SwTextBoxHelper::syncProperty: unhandled TextHorizontalAdjust: "
582 <<
static_cast<sal_Int32
>(eValue));
588 if (rPropertyName ==
u"CustomShapeGeometry")
611 auto it = aCustomShapeGeometry.
find(
"TextPreRotateAngle");
612 if (it == aCustomShapeGeometry.
end())
614 it = aCustomShapeGeometry.
find(
"TextRotateAngle");
617 if (it != aCustomShapeGeometry.
end())
619 auto nAngle = it->second.has<sal_Int32>() ? it->second.get<sal_Int32>() : 0;
622 nAngle = it->second.has<
double>() ? it->second.get<
double>() : 0;
625 sal_Int16 nDirection = 0;
629 nDirection = text::WritingMode2::TB_RL90;
632 nDirection = text::WritingMode2::BT_LR;
635 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled property value: "
636 "CustomShapeGeometry:TextPreRotateAngle: "
661 text::WritingMode
eMode;
663 if (rValue >>=
eMode)
665 else if (rValue >>= eMode2)
668 else if (rPropertyName ==
u"WritingMode")
671 if (rValue >>= eMode2)
675 SAL_INFO(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled property: "
676 <<
static_cast<OUString
>(rPropertyName));
680 css::uno::Any& rValue)
685 nMemberID &= ~CONVERT_TWIPS;
707 SAL_WARN(
"sw.core",
"SwTextBoxHelper::getProperty: unhandled member-id: "
708 << o3tl::narrowing<sal_uInt16>(nMemberID));
725 return xPropertySet->getPropertyValue(rPropName);
729 const css::uno::Any& rValue,
SdrObject* pObj)
736 nMemberID &= ~CONVERT_TWIPS;
742 OUString aPropertyName;
743 bool bAdjustX =
false;
744 bool bAdjustY =
false;
745 bool bAdjustSize =
false;
765 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
766 << o3tl::narrowing<sal_uInt16>(nMemberID)
767 <<
" (which-id: " << nWID <<
")");
782 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
783 << o3tl::narrowing<sal_uInt16>(nMemberID)
784 <<
" (which-id: " << nWID <<
")");
806 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
807 << o3tl::narrowing<sal_uInt16>(nMemberID)
808 <<
" (which-id: " << nWID <<
")");
843 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
844 << o3tl::narrowing<sal_uInt16>(nMemberID)
845 <<
" (which-id: " << nWID <<
")");
851 uno::Reference<text::XTextRange> xRange;
872 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
873 << o3tl::narrowing<sal_uInt16>(nMemberID)
874 <<
" (which-id: " << nWID <<
")");
897 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
898 << o3tl::narrowing<sal_uInt16>(nMemberID)
899 <<
" (which-id: " << nWID <<
")");
916 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
917 << o3tl::narrowing<sal_uInt16>(nMemberID)
918 <<
" (which-id: " << nWID <<
")");
923 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled which-id: "
924 << nWID <<
" (member-id: "
925 << o3tl::narrowing<sal_uInt16>(nMemberID) <<
")");
929 if (aPropertyName.isEmpty())
933 if (bAdjustX || bAdjustY || bAdjustSize)
940 if (bAdjustX || bAdjustY)
949 else if (bAdjustSize)
960 xPropertySet->setPropertyValue(aPropertyName, aValue);
964 std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks)
966 for (
const auto pFormat : rFormats)
969 rLinks[pFormat] = pTextBox;
977 for (
const auto& rIt : rOld)
979 auto aTextBoxIt = rSavedLinks.find(rIt.GetFormat());
980 if (aTextBoxIt != rSavedLinks.end())
983 for (
const auto& rJt : rOld)
985 if (rJt.GetFormat() == aTextBoxIt->second)
986 rNew[
i]->SetFormatAttr(rNew[j]->GetContent());
996 text::TextContentAnchorType aAnchorType;
999 case RndStdIds::FLY_AS_CHAR:
1000 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AS_CHARACTER;
1002 case RndStdIds::FLY_AT_CHAR:
1003 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AT_CHARACTER;
1005 case RndStdIds::FLY_AT_PARA:
1006 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AT_PARAGRAPH;
1008 case RndStdIds::FLY_AT_PAGE:
1009 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AT_PAGE;
1011 case RndStdIds::FLY_AT_FLY:
1012 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AT_FRAME;
1015 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AT_PARAGRAPH;
1016 SAL_WARN(
"sw.core",
"SwTextBoxHelper::mapAnchorType: Unknown AnchorType!");
1040 switch (pItem->
Which())
1045 const text::TextContentAnchorType aNewAnchorType
1049 if (bInlineAnchored || bLayoutInCell)
1061 aTextBoxSet.
Put(aOrient);
1068 aTextBoxSet.
Put(aSize);
1075 const text::TextContentAnchorType aNewAnchorType
1079 if (bInlineAnchored || bLayoutInCell)
1091 aTextBoxSet.
Put(aOrient);
1108 if (!bInlineAnchored)
1117 aTextBoxSet.
Put(aVertOrient);
1118 aTextBoxSet.
Put(aHoriOrient);
1123 aTextBoxSet.
Put(aSize);
1132 const text::TextContentAnchorType aNewAnchorType
1139 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncFlyFrameAttr: The anchor of the "
1140 "shape different from the textframe!");
1145 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncFlyFrameAttr: unhandled which-id: "
1151 }
while (pItem && (0 != pItem->
Which()));
1153 if (aTextBoxSet.
Count())
1165 uno::Reference<drawing::XShape> xShape(pObj->
getUnoShape(), uno::UNO_QUERY);
1168 uno::Reference<beans::XPropertySet>
const xPropertySet(xShape, uno::UNO_QUERY);
1191 const bool bIsAutoGrow
1199 uno::Any(bIsAutoWrap ? text::SizeType::FIX : text::SizeType::MIN), pObj);
1239 if (pOldCnt && rNewAnch.
GetAnchorId() == RndStdIds::FLY_AT_PAGE
1242 uno::Any aValue(text::TextContentAnchorType_AT_PAGE);
1248 else if (rOldAnch.
GetAnchorId() == RndStdIds::FLY_AT_PAGE && pNewCnt)
1250 if (rNewAnch.
GetAnchorId() == RndStdIds::FLY_AS_CHAR)
1253 uno::Any aValue(text::TextContentAnchorType_AT_CHARACTER);
1256 uno::Any(text::RelOrientation::CHAR));
1258 uno::Any(text::RelOrientation::PRINT_AREA));
1267 aShapeHorRelOrient);
1274 if (rNewAnch.
GetAnchorId() == RndStdIds::FLY_AS_CHAR)
1277 uno::Any aValue(text::TextContentAnchorType_AT_CHARACTER);
1280 uno::Any(text::RelOrientation::CHAR));
1282 uno::Any(text::RelOrientation::PRINT_AREA));
1290 aShapeHorRelOrient);
1291 if (rNewAnch.
GetAnchorId() == RndStdIds::FLY_AT_PAGE
1301 catch (uno::Exception& e)
1303 SAL_WARN(
"sw.core",
"SwTextBoxHelper::changeAnchor(): " << e.Message);
1373 case text::VertOrientation::TOP:
1374 case text::VertOrientation::CHAR_TOP:
1375 case text::VertOrientation::LINE_TOP:
1381 case text::VertOrientation::BOTTOM:
1382 case text::VertOrientation::CHAR_BOTTOM:
1383 case text::VertOrientation::LINE_BOTTOM:
1389 case text::VertOrientation::CENTER:
1390 case text::VertOrientation::CHAR_CENTER:
1391 case text::VertOrientation::LINE_CENTER:
1429 const auto& nInshapePos
1460 if (
auto pFlyFormat = pFly->GetFlyFormat())
1462 nTableOffset.setX(pFlyFormat->GetHoriOrient().GetPos());
1463 nTableOffset.setY(pFlyFormat->GetVertOrient().GetPos());
1470 if (
auto pTableFormat = pTableNode->GetTable().GetFrameFormat())
1472 nTableOffset.setX(pTableFormat->GetHoriOrient().GetPos());
1473 nTableOffset.setY(pTableFormat->GetVertOrient().GetPos());
1478 aNewHOri.
SetPos(aNewHOri.
GetPos() + nTableOffset.getX() + nLeftSpace);
1481 == text::RelOrientation::PAGE_PRINT_AREA)
1482 aNewVOri.
SetPos(aNewVOri.
GetPos() + nTableOffset.getY());
1496 if (!pShape || !pObj)
1503 if (!rSize.IsEmpty())
1507 return pTextBox->SetFormatAttr(aSize);
1526 SdrObject* pFrmObj = pTextBox->FindRealSdrObject();
1531 = SwXTextFrame::GetOrCreateSdrObject(*
dynamic_cast<SwFlyFrameFormat*
>(pTextBox));
1541 auto pPage = pDrawModel->
GetPage(0);
1545 sal_uInt16 nIterator = 0;
1557 if (pPage->GetObjCount() == pFrmObj->
GetOrdNum())
1560 if (nIterator > 300)
1563 pPage->RecalcObjOrdNums();
1566 SAL_WARN(
"sw.core",
"SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
1567 "No Valid Draw model for SdrObject for the shape!");
1569 SAL_WARN(
"sw.core",
"SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
1570 "No Valid SdrObject for the frame!");
1572 SAL_WARN(
"sw.core",
"SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
1573 "No Valid SdrObject for the shape!");
1583 for (
size_t i = 0;
i < pChildren->GetObjCount(); ++
i)
1588 (*pFunc)(pFormat, pObj);
1595 std::vector<SwFrameFormat*> vRet;
1598 for (
size_t i = 0;
i < pChildren->GetObjCount(); ++
i)
1601 for (
auto& rChildTextBox : pChildTextBoxes)
1602 vRet.push_back(rChildTextBox);
1621 if (pFirst == pSecond)
1636 const auto& rShapeAnchor
1638 const auto& rFrameAnchor
1641 if (rShapeAnchor.GetAnchorId() == rFrameAnchor.GetAnchorId())
1643 if (rShapeAnchor.GetAnchorNode() && rFrameAnchor.GetAnchorNode())
1645 if (*rShapeAnchor.GetContentAnchor() != *rFrameAnchor.GetContentAnchor())
1651 if (rShapeAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE
1652 && rFrameAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
1654 if (rShapeAnchor.GetPageNum() == rFrameAnchor.GetPageNum())
1663 if (rShapeAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR
1664 && rFrameAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
1666 if (rShapeAnchor.GetAnchorNode() && rFrameAnchor.GetAnchorNode())
1668 if (*rShapeAnchor.GetContentAnchor() != *rFrameAnchor.GetContentAnchor())
1681 assert(pOwnerShape);
1696 SAL_WARN(
"sw.core",
"SwTextBoxNode::~SwTextBoxNode(): Text-Box-Vector still not empty!");
1703 assert(pNewTextBox);
1706 assert(pDrawObject);
1714 if (rE.m_pDrawObject == pDrawObject || rE.m_pTextBoxFormat == pNewTextBox)
1716 SAL_WARN(
"sw.core",
"SwTextBoxNode::AddTextBox(): Already exist!");
1721 auto pSwFlyDraw =
dynamic_cast<SwFlyDrawObj*
>(pDrawObject);
1731 assert(pDrawObject);
1737 if (it->m_pDrawObject == pDrawObject)
1741 it->m_pTextBoxFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat(
1742 it->m_pTextBoxFormat);
1756 SAL_WARN(
"sw.core",
"SwTextBoxNode::DelTextBox(): Not found!");
1766 if (it->m_pTextBoxFormat == pTextBox)
1770 it->m_pTextBoxFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat(
1771 it->m_pTextBoxFormat);
1785 SAL_WARN(
"sw.core",
"SwTextBoxNode::DelTextBox(): Not found!");
1790 assert(pDrawObject);
1795 if (
size_t(pTextBoxes.use_count()) != pTextBoxes->GetTextBoxCount() +
size_t(1))
1797 SAL_WARN(
"sw.core",
"SwTextBoxNode::GetTextBox(): RefCount and TexBox count mismatch!");
1808 if (it->m_pDrawObject == pDrawObject)
1810 return it->m_pTextBoxFormat;
1813 SAL_WARN(
"sw.core",
"SwTextBoxNode::GetTextBox(): Not found!");
1831 sal_uInt16 nLoopCount = 0;
1846 if (nLoopCount > (nTextBoxCount + 1))
1848 SAL_WARN(
"sw.core",
"SwTextBoxNode::ClearAll(): Maximum loop count reached!");
1860 SAL_WARN(
"sw.core",
"SwTextBoxNode::ClearAll(): Text-Box-Vector still not empty!");
1869 std::map<SdrObject*, SwFrameFormat*> aRet;
1872 aRet.emplace(rElem.m_pDrawObject, rElem.m_pTextBoxFormat);
1878 bool bSetAttr,
bool bMakeFrame)
const
1880 if (!o_pTarget || !pDoc)
1907 bool bMakeFrame)
const
1909 if (!pSrcObj || !pDestObj)
1915 if (pSrcList && pDestList)
1917 if (pSrcList->GetObjCount() != pDestList->GetObjCount())
1919 SAL_WARN(
"sw.core",
"SwTextBoxNode::Clone_Impl(): Difference between the shapes!");
1923 for (
size_t i = 0;
i < pSrcList->GetObjCount(); ++
i)
1925 Clone_Impl(pDoc, rNewAnc, o_pTarget, pSrcList->GetObj(
i), pDestList->GetObj(
i),
1926 bSetAttr, bMakeFrame);
1931 if (!pSrcList && !pDestList)
1936 if (aNewAnchor.
GetAnchorId() == RndStdIds::FLY_AS_CHAR)
1938 aNewAnchor.
SetType(RndStdIds::FLY_AT_CHAR);
1945 *pSrcFormat, aNewAnchor, bSetAttr, bMakeFrame))
1949 auto pNewTextBoxes = std::make_shared<SwTextBoxNode>(
SwTextBoxNode(o_pTarget));
1951 pNewTextBoxes->AddTextBox(pDestObj, pTargetFormat);
1952 pTargetFormat->SetOtherTextBoxFormats(pNewTextBoxes);
constexpr auto convertTwipToMm100(N n)
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual SwFrameFormat * CopyLayoutFormat(const SwFrameFormat &rSrc, const SwFormatAnchor &rNewAnchor, bool bSetTextFlyAtt, bool bMakeFrames)=0
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual void SetModified()=0
Must be called manually at changes of format.
const SdrPage * GetPage(sal_uInt16 nPgNum) const
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
const css::uno::WeakReference< css::drawing::XShape > & getWeakUnoShape() const
virtual css::uno::Reference< css::drawing::XShape > getUnoShape()
sal_uInt32 GetOrdNum() const
virtual const tools::Rectangle & GetCurrentBoundRect() const
virtual const tools::Rectangle & GetSnapRect() const
virtual SdrObjList * getChildrenOfSdrObject() const
virtual Point GetRelativePos() const
virtual const tools::Rectangle & GetLogicRect() const
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
T & StaticWhichCast(TypedWhichId< T > nId)
constexpr tools::Long Height() const
constexpr tools::Long Width() const
tools::Long GetLeft() const
tools::Long GetHeight() const
void SetHeight(tools::Long n)
void SetSize(const Size &rSize)
void SetWidth(tools::Long n)
IDocumentState const & getIDocumentState() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
const SwAttrPool & GetAttrPool() const
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
const SwFrameFormats * GetSpzFrameFormats() const
SwDocShell * GetDocShell()
void SetTextBox(bool bIsTextBox)
Content, content of frame (header, footer, fly).
const SwStartNode * FindFlyStartNode() const
SwTableNode * FindTableNode()
Search table node, in which it is.
const SwStartNode * StartOfSectionNode() const
SwNode & GetPointNode() const
const SwPosition * Start() const
static css::uno::Any getByIndex(SdrPage const *pPage, sal_Int32 nIndex)
Get a shape by index, excluding TextBoxes.
static bool doTextBoxPositioning(SwFrameFormat *pShape, SdrObject *pObj)
Does the positioning for the associated textframe of the shape, and returns true on success.
static bool hasTextFrame(const SdrObject *pObj)
Returns true if the SdrObject has a SwTextFrame otherwise false.
static css::uno::Reference< css::text::XTextFrame > getUnoTextFrame(css::uno::Reference< css::drawing::XShape > const &xShape)
If we have an associated TextFrame, then return its XTextFrame.
static std::vector< SwFrameFormat * > CollectTextBoxes(const SdrObject *pGroupObject, SwFrameFormat *pFormat)
Collect all textboxes of the group given by the pGroupObj Parameter.
static void set(SwFrameFormat *pShape, SdrObject *pObject, css::uno::Reference< css::text::XTextFrame > xNew)
Sets the given textframe as textbox for the given (group member) shape.
static sal_Int32 getCount(const SwDoc &rDoc)
Count number of shapes in the document, excluding TextBoxes.
static void saveLinks(const SwFrameFormats &rFormats, std::map< const SwFrameFormat *, const SwFrameFormat * > &rLinks)
Saves the current shape -> textbox links in a map, so they can be restored later.
static bool DoTextBoxZOrderCorrection(SwFrameFormat *pShape, const SdrObject *pObj)
static void syncProperty(SwFrameFormat *pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const css::uno::Any &rValue, SdrObject *pObj=nullptr)
Sync property of TextBox with the one of the shape.
static void getShapeWrapThrough(const SwFrameFormat *pTextBox, bool &rWrapThrough)
If pTextBox is a textbox, then set rWrapThrough to the surround of its shape.
static css::text::TextContentAnchorType mapAnchorType(const RndStdIds &rAnchorID)
There are two types of enum of anchor type, so this function maps this.
static void restoreLinks(std::set< ZSortFly > &rOld, std::vector< SwFrameFormat * > &rNew, SavedLink &rSavedLinks)
Undo the effect of saveLinks() + individual resetLink() calls.
static bool isAnchorSyncNeeded(const SwFrameFormat *pFirst, const SwFrameFormat *pSecond)
static void create(SwFrameFormat *pShape, SdrObject *pObject, bool bCopyText=false)
Create a TextBox for a shape.
static bool syncTextBoxSize(SwFrameFormat *pShape, SdrObject *pObj)
Sets the correct size of textframe depending on the given SdrObject.
static tools::Rectangle getRelativeTextRectangle(SdrObject *pShape)
Return the textbox rectangle of a draw shape (in relative twips).
static SwFrameFormat * getOtherTextBoxFormat(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
If we have an associated TextFrame, then return that.
static void getProperty(SwFrameFormat const *pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, css::uno::Any &rValue)
Get a property of the underlying TextFrame.
static void updateTextBoxMargin(SdrObject *pObj)
Copy shape attributes to the text frame.
static bool changeAnchor(SwFrameFormat *pShape, SdrObject *pObj)
Sets the anchor of the associated textframe of the given shape, and returns true on success.
static void syncFlyFrameAttr(SwFrameFormat &rShape, SfxItemSet const &rSet, SdrObject *pObj)
Similar to syncProperty(), but used by the internal API (e.g. for UI purposes).
static void synchronizeGroupTextBoxProperty(bool pFunc(SwFrameFormat *, SdrObject *), SwFrameFormat *pFormat, SdrObject *pObj)
Calls the method given by pFunc with every textboxes of the group given by pFormat.
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
Is the frame format a text box?
static void destroy(const SwFrameFormat *pShape, const SdrObject *pObject)
Destroy a TextBox for a shape.
static sal_Int32 getOrdNum(const SdrObject *pObject)
Get the order of the shape, excluding TextBoxes.
static css::uno::Any queryInterface(const SwFrameFormat *pShape, const css::uno::Type &rType, SdrObject *pObj)
Get interface of a shape's TextBox, if there is any.
std::map< const SwFrameFormat *, const SwFrameFormat * > SavedLink
Maps a draw format to a fly format.
Textboxes are basically textframe + shape pairs.
bool m_bIsCloningInProgress
void AddTextBox(SdrObject *pDrawObject, SwFrameFormat *pNewTextBox)
void Clone_Impl(SwDoc *pDoc, const SwFormatAnchor &rNewAnc, SwFrameFormat *o_pTarget, const SdrObject *pSrcObj, SdrObject *pDestObj, bool bSetAttr, bool bMakeFrame) const
SwFrameFormat * GetTextBox(const SdrObject *pDrawObject) const
std::map< SdrObject *, SwFrameFormat * > GetAllTextBoxes() const
bool IsGroupTextBox() const
void Clone(SwDoc *pDoc, const SwFormatAnchor &rNewAnc, SwFrameFormat *o_pTarget, bool bSetAttr, bool bMakeFrame) const
SwFrameFormat * m_pOwnerShapeFormat
std::vector< SwTextBoxElement > m_pTextBoxes
void DelTextBox(const SdrObject *pDrawObject, bool bDelFromDoc=false)
static css::uno::Reference< css::uno::XInterface > MakeInstance(SwServiceType nObjectType, SwDoc &rDoc)
static SW_DLLPUBLIC rtl::Reference< SwXTextFrame > CreateXTextFrame(SwDoc &rDoc, SwFrameFormat *pFrameFormat)
iterator find(const OUString &rKey)
EmbeddedObjectRef * pObject
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(109)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(105)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SwFormatWrapInfluenceOnObjPos > RES_WRAP_INFLUENCE_ON_OBJPOS(132)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SdrTextVertAdjustItem > RES_TEXT_VERT_ADJUST(137)
constexpr TypedWhichId< SwFormatChain > RES_CHAIN(120)
constexpr TypedWhichId< SwFormatFollowTextFlow > RES_FOLLOW_TEXT_FLOW(130)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
WhichRangesContainer const aFrameFormatSetRange(svl::Items< RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST >)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
#define LEFT_BORDER_DISTANCE
#define TOP_BORDER_DISTANCE
#define RIGHT_BORDER_DISTANCE
#define BOTTOM_BORDER_DISTANCE
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange, ::sw::TextRangeMode const eMode)
SdrObject * m_pDrawObject
SwFrameFormat * m_pTextBoxFormat
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
static void lcl_queryInterface(const SwFrameFormat *pShape, uno::Any &rAny, SdrObject *pObj)
#define MID_HORIORIENT_RELATION
#define MID_FRMSIZE_REL_WIDTH_RELATION
#define MID_FRMSIZE_REL_HEIGHT_RELATION
#define MID_VERTORIENT_RELATION
#define MID_VERTORIENT_POSITION
#define MID_FRMSIZE_WIDTH_TYPE
#define MID_VERTORIENT_ORIENT
#define MID_HORIORIENT_POSITION
#define MID_FOLLOW_TEXT_FLOW
#define MID_ANCHOR_ANCHORTYPE
#define MID_CHAIN_PREVNAME
#define MID_CHAIN_NEXTNAME
#define MID_FRMSIZE_IS_AUTO_HEIGHT
#define MID_HORIORIENT_ORIENT
#define MID_ALLOW_OVERLAP
constexpr OUStringLiteral UNO_NAME_CHAIN_NEXT_NAME
constexpr OUStringLiteral UNO_NAME_FILL_TRANSPARENCE
constexpr OUStringLiteral UNO_NAME_TEXT_LOWERDIST
constexpr OUStringLiteral UNO_NAME_SIZE_TYPE
constexpr OUStringLiteral UNO_NAME_ALLOW_OVERLAP
constexpr OUStringLiteral UNO_NAME_SIZE
constexpr OUStringLiteral UNO_NAME_TEXT_VERT_ADJUST
constexpr OUStringLiteral UNO_NAME_TEXT_UPPERDIST
constexpr OUStringLiteral UNO_NAME_RIGHT_BORDER_DISTANCE
constexpr OUStringLiteral UNO_NAME_ANCHOR_TYPE
constexpr OUStringLiteral UNO_NAME_RIGHT_MARGIN
constexpr OUStringLiteral UNO_NAME_CHAIN_PREV_NAME
constexpr OUStringLiteral UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT
constexpr OUStringLiteral UNO_NAME_HORI_ORIENT_POSITION
constexpr OUStringLiteral UNO_NAME_BOTTOM_BORDER
constexpr OUStringLiteral UNO_NAME_VERT_ORIENT_POSITION
constexpr OUStringLiteral UNO_NAME_LEFT_MARGIN
constexpr OUStringLiteral UNO_NAME_HORI_ORIENT
constexpr OUStringLiteral UNO_NAME_BOTTOM_BORDER_DISTANCE
constexpr OUStringLiteral UNO_NAME_VERT_ORIENT
constexpr OUStringLiteral UNO_NAME_HORI_ORIENT_RELATION
constexpr OUStringLiteral UNO_NAME_TOP_BORDER
constexpr OUStringLiteral UNO_NAME_TEXT_HORZADJUST
constexpr OUStringLiteral UNO_NAME_RIGHT_BORDER
constexpr OUStringLiteral UNO_NAME_WRITING_MODE
constexpr OUStringLiteral UNO_NAME_TEXT_WORDWRAP
constexpr OUStringLiteral UNO_NAME_TEXT_VERTADJUST
constexpr OUStringLiteral UNO_NAME_TEXT_LEFTDIST
constexpr OUStringLiteral UNO_NAME_TEXT_WRITINGMODE
constexpr OUStringLiteral UNO_NAME_OPAQUE
constexpr OUStringLiteral UNO_NAME_TOP_BORDER_DISTANCE
constexpr OUStringLiteral UNO_NAME_TEXT_AUTOGROWHEIGHT
constexpr OUStringLiteral UNO_NAME_LEFT_BORDER_DISTANCE
constexpr OUStringLiteral UNO_NAME_SURROUND
constexpr OUStringLiteral UNO_NAME_VERT_ORIENT_RELATION
constexpr OUStringLiteral UNO_NAME_PARA_ADJUST
constexpr OUStringLiteral UNO_NAME_ANCHOR_PAGE_NO
constexpr OUStringLiteral UNO_NAME_RELATIVE_WIDTH_RELATION
constexpr OUStringLiteral UNO_NAME_LEFT_BORDER
constexpr OUStringLiteral UNO_NAME_TEXT_RIGHTDIST
constexpr OUStringLiteral UNO_NAME_RELATIVE_HEIGHT_RELATION
constexpr OUStringLiteral UNO_NAME_WIDTH_TYPE
constexpr OUStringLiteral UNO_NAME_IS_FOLLOWING_TEXT_FLOW