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())
363 throw lang::IndexOutOfBoundsException();
370 if (
p &&
p->IsTextBox())
381 throw lang::IndexOutOfBoundsException();
390 sal_Int32 nOrder = 0;
391 for (std::size_t
i = 0;
i < pPage->GetObjCount(); ++
i)
394 if (
p &&
p->IsTextBox())
402 SAL_WARN(
"sw.core",
"SwTextBoxHelper::getOrdNum: no page or page doesn't contain the object");
414 sal_uInt16 nType,
const SdrObject* pObject)
437 auto pShape =
dynamic_cast<SwXShape*
>(xShape.get());
446uno::Reference<text::XTextFrame>
454 auto pSdrObj = pFrameFormat->FindSdrObject();
457 return { pSdrObj->getUnoShape(), uno::UNO_QUERY };
470 uno::Reference<T>
const xInterface(
485 lcl_queryInterface<text::XTextAppend>(pShape, aRet, pObj);
489 lcl_queryInterface<text::XText>(pShape, aRet, pObj);
493 lcl_queryInterface<text::XTextRange>(pShape, aRet, pObj);
512 uno::Reference<document::XActionLockable> xLockable(pCustomShape->getUnoShape(),
514 sal_Int16 nLocks = 0;
516 nLocks = xLockable->resetActionLocks();
517 pCustomShape->GetTextBounds(aRet);
519 xLockable->setActionLocks(nLocks);
535 aRet.
Move(-1 * aLogicRect.
Left(), -1 * aLogicRect.
Top());
542 const css::uno::Any& rValue,
SdrObject* pObj)
552 uno::Reference<text::XTextCursor> xCursor = xTextFrame->getText()->createTextCursor();
555 xCursor->gotoStart(
false);
556 xCursor->gotoEnd(
true);
557 uno::Reference<beans::XPropertySet> xFrameParaProps(xCursor, uno::UNO_QUERY);
560 const auto eValue = rValue.get<drawing::TextHorizontalAdjust>();
563 case drawing::TextHorizontalAdjust::TextHorizontalAdjust_CENTER:
564 xFrameParaProps->setPropertyValue(
566 uno::Any(style::ParagraphAdjust::ParagraphAdjust_CENTER));
568 case drawing::TextHorizontalAdjust::TextHorizontalAdjust_LEFT:
569 xFrameParaProps->setPropertyValue(
571 uno::Any(style::ParagraphAdjust::ParagraphAdjust_LEFT));
573 case drawing::TextHorizontalAdjust::TextHorizontalAdjust_RIGHT:
574 xFrameParaProps->setPropertyValue(
576 uno::Any(style::ParagraphAdjust::ParagraphAdjust_RIGHT));
580 "SwTextBoxHelper::syncProperty: unhandled TextHorizontalAdjust: "
581 <<
static_cast<sal_Int32
>(eValue));
587 if (rPropertyName ==
u"CustomShapeGeometry")
610 auto it = aCustomShapeGeometry.
find(
"TextPreRotateAngle");
611 if (it == aCustomShapeGeometry.
end())
613 it = aCustomShapeGeometry.
find(
"TextRotateAngle");
616 if (it != aCustomShapeGeometry.
end())
618 auto nAngle = it->second.has<sal_Int32>() ? it->second.get<sal_Int32>() : 0;
621 nAngle = it->second.has<
double>() ? it->second.get<
double>() : 0;
624 sal_Int16 nDirection = 0;
628 nDirection = text::WritingMode2::TB_RL90;
631 nDirection = text::WritingMode2::BT_LR;
634 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled property value: "
635 "CustomShapeGeometry:TextPreRotateAngle: "
660 text::WritingMode
eMode;
662 if (rValue >>=
eMode)
664 else if (rValue >>= eMode2)
667 else if (rPropertyName ==
u"WritingMode")
670 if (rValue >>= eMode2)
674 SAL_INFO(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled property: "
675 <<
static_cast<OUString
>(rPropertyName));
679 css::uno::Any& rValue)
684 nMemberID &= ~CONVERT_TWIPS;
706 SAL_WARN(
"sw.core",
"SwTextBoxHelper::getProperty: unhandled member-id: "
707 << o3tl::narrowing<sal_uInt16>(nMemberID));
724 return xPropertySet->getPropertyValue(rPropName);
728 const css::uno::Any& rValue,
SdrObject* pObj)
735 nMemberID &= ~CONVERT_TWIPS;
741 OUString aPropertyName;
742 bool bAdjustX =
false;
743 bool bAdjustY =
false;
744 bool bAdjustSize =
false;
764 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
765 << o3tl::narrowing<sal_uInt16>(nMemberID)
766 <<
" (which-id: " << nWID <<
")");
781 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
782 << o3tl::narrowing<sal_uInt16>(nMemberID)
783 <<
" (which-id: " << nWID <<
")");
805 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
806 << o3tl::narrowing<sal_uInt16>(nMemberID)
807 <<
" (which-id: " << nWID <<
")");
842 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
843 << o3tl::narrowing<sal_uInt16>(nMemberID)
844 <<
" (which-id: " << nWID <<
")");
850 uno::Reference<text::XTextRange> xRange;
871 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
872 << o3tl::narrowing<sal_uInt16>(nMemberID)
873 <<
" (which-id: " << nWID <<
")");
896 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
897 << o3tl::narrowing<sal_uInt16>(nMemberID)
898 <<
" (which-id: " << nWID <<
")");
915 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled member-id: "
916 << o3tl::narrowing<sal_uInt16>(nMemberID)
917 <<
" (which-id: " << nWID <<
")");
922 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncProperty: unhandled which-id: "
923 << nWID <<
" (member-id: "
924 << o3tl::narrowing<sal_uInt16>(nMemberID) <<
")");
928 if (aPropertyName.isEmpty())
932 if (bAdjustX || bAdjustY || bAdjustSize)
939 if (bAdjustX || bAdjustY)
948 else if (bAdjustSize)
959 xPropertySet->setPropertyValue(aPropertyName, aValue);
963 std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks)
965 for (
const auto pFormat : rFormats)
968 rLinks[pFormat] = pTextBox;
976 for (
const auto& rIt : rOld)
978 auto aTextBoxIt = rSavedLinks.find(rIt.GetFormat());
979 if (aTextBoxIt != rSavedLinks.end())
982 for (
const auto& rJt : rOld)
984 if (rJt.GetFormat() == aTextBoxIt->second)
985 rNew[
i]->SetFormatAttr(rNew[j]->GetContent());
995 text::TextContentAnchorType aAnchorType;
998 case RndStdIds::FLY_AS_CHAR:
999 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AS_CHARACTER;
1001 case RndStdIds::FLY_AT_CHAR:
1002 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AT_CHARACTER;
1004 case RndStdIds::FLY_AT_PARA:
1005 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AT_PARAGRAPH;
1007 case RndStdIds::FLY_AT_PAGE:
1008 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AT_PAGE;
1010 case RndStdIds::FLY_AT_FLY:
1011 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AT_FRAME;
1014 aAnchorType = text::TextContentAnchorType::TextContentAnchorType_AT_PARAGRAPH;
1015 SAL_WARN(
"sw.core",
"SwTextBoxHelper::mapAnchorType: Unknown AnchorType!");
1039 switch (pItem->
Which())
1044 const text::TextContentAnchorType aNewAnchorType
1048 if (bInlineAnchored || bLayoutInCell)
1060 aTextBoxSet.
Put(aOrient);
1067 aTextBoxSet.
Put(aSize);
1074 const text::TextContentAnchorType aNewAnchorType
1078 if (bInlineAnchored || bLayoutInCell)
1090 aTextBoxSet.
Put(aOrient);
1107 if (!bInlineAnchored)
1116 aTextBoxSet.
Put(aVertOrient);
1117 aTextBoxSet.
Put(aHoriOrient);
1122 aTextBoxSet.
Put(aSize);
1131 const text::TextContentAnchorType aNewAnchorType
1138 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncFlyFrameAttr: The anchor of the "
1139 "shape different from the textframe!");
1144 SAL_WARN(
"sw.core",
"SwTextBoxHelper::syncFlyFrameAttr: unhandled which-id: "
1150 }
while (pItem && (0 != pItem->
Which()));
1152 if (aTextBoxSet.
Count())
1164 uno::Reference<drawing::XShape> xShape(pObj->
getUnoShape(), uno::UNO_QUERY);
1167 uno::Reference<beans::XPropertySet>
const xPropertySet(xShape, uno::UNO_QUERY);
1190 const bool bIsAutoGrow
1198 uno::Any(bIsAutoWrap ? text::SizeType::FIX : text::SizeType::MIN), pObj);
1238 if (pOldCnt && rNewAnch.
GetAnchorId() == RndStdIds::FLY_AT_PAGE
1241 uno::Any aValue(text::TextContentAnchorType_AT_PAGE);
1247 else if (rOldAnch.
GetAnchorId() == RndStdIds::FLY_AT_PAGE && pNewCnt)
1249 if (rNewAnch.
GetAnchorId() == RndStdIds::FLY_AS_CHAR)
1252 uno::Any aValue(text::TextContentAnchorType_AT_CHARACTER);
1255 uno::Any(text::RelOrientation::CHAR));
1257 uno::Any(text::RelOrientation::PRINT_AREA));
1266 aShapeHorRelOrient);
1273 if (rNewAnch.
GetAnchorId() == RndStdIds::FLY_AS_CHAR)
1276 uno::Any aValue(text::TextContentAnchorType_AT_CHARACTER);
1279 uno::Any(text::RelOrientation::CHAR));
1281 uno::Any(text::RelOrientation::PRINT_AREA));
1289 aShapeHorRelOrient);
1290 if (rNewAnch.
GetAnchorId() == RndStdIds::FLY_AT_PAGE
1300 catch (uno::Exception& e)
1302 SAL_WARN(
"sw.core",
"SwTextBoxHelper::changeAnchor(): " << e.Message);
1372 case text::VertOrientation::TOP:
1373 case text::VertOrientation::CHAR_TOP:
1374 case text::VertOrientation::LINE_TOP:
1380 case text::VertOrientation::BOTTOM:
1381 case text::VertOrientation::CHAR_BOTTOM:
1382 case text::VertOrientation::LINE_BOTTOM:
1388 case text::VertOrientation::CENTER:
1389 case text::VertOrientation::CHAR_CENTER:
1390 case text::VertOrientation::LINE_CENTER:
1428 const auto& nInshapePos
1459 if (
auto pFlyFormat = pFly->GetFlyFormat())
1461 nTableOffset.
setX(pFlyFormat->GetHoriOrient().GetPos());
1462 nTableOffset.
setY(pFlyFormat->GetVertOrient().GetPos());
1469 if (
auto pTableFormat = pTableNode->GetTable().GetFrameFormat())
1471 nTableOffset.
setX(pTableFormat->GetHoriOrient().GetPos());
1472 nTableOffset.
setY(pTableFormat->GetVertOrient().GetPos());
1480 == text::RelOrientation::PAGE_PRINT_AREA)
1495 if (!pShape || !pObj)
1502 if (!rSize.IsEmpty())
1506 return pTextBox->SetFormatAttr(aSize);
1525 SdrObject* pFrmObj = pTextBox->FindRealSdrObject();
1530 = SwXTextFrame::GetOrCreateSdrObject(*
dynamic_cast<SwFlyFrameFormat*
>(pTextBox));
1540 auto pPage = pDrawModel->
GetPage(0);
1544 sal_uInt16 nIterator = 0;
1556 if (pPage->GetObjCount() == pFrmObj->
GetOrdNum())
1559 if (nIterator > 300)
1562 pPage->RecalcObjOrdNums();
1565 SAL_WARN(
"sw.core",
"SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
1566 "No Valid Draw model for SdrObject for the shape!");
1568 SAL_WARN(
"sw.core",
"SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
1569 "No Valid SdrObject for the frame!");
1571 SAL_WARN(
"sw.core",
"SwTextBoxHelper::DoTextBoxZOrderCorrection(): "
1572 "No Valid SdrObject for the shape!");
1582 for (
size_t i = 0;
i < pChildren->GetObjCount(); ++
i)
1587 (*pFunc)(pFormat, pObj);
1594 std::vector<SwFrameFormat*> vRet;
1597 for (
size_t i = 0;
i < pChildren->GetObjCount(); ++
i)
1600 for (
auto& rChildTextBox : pChildTextBoxes)
1601 vRet.push_back(rChildTextBox);
1620 if (pFirst == pSecond)
1635 const auto& rShapeAnchor
1637 const auto& rFrameAnchor
1640 if (rShapeAnchor.GetAnchorId() == rFrameAnchor.GetAnchorId())
1642 if (rShapeAnchor.GetAnchorNode() && rFrameAnchor.GetAnchorNode())
1644 if (*rShapeAnchor.GetContentAnchor() != *rFrameAnchor.GetContentAnchor())
1650 if (rShapeAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE
1651 && rFrameAnchor.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
1653 if (rShapeAnchor.GetPageNum() == rFrameAnchor.GetPageNum())
1662 if (rShapeAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR
1663 && rFrameAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
1665 if (rShapeAnchor.GetAnchorNode() && rFrameAnchor.GetAnchorNode())
1667 if (*rShapeAnchor.GetContentAnchor() != *rFrameAnchor.GetContentAnchor())
1680 assert(pOwnerShape);
1695 SAL_WARN(
"sw.core",
"SwTextBoxNode::~SwTextBoxNode(): Text-Box-Vector still not empty!");
1702 assert(pNewTextBox);
1705 assert(pDrawObject);
1713 if (rE.m_pDrawObject == pDrawObject || rE.m_pTextBoxFormat == pNewTextBox)
1715 SAL_WARN(
"sw.core",
"SwTextBoxNode::AddTextBox(): Already exist!");
1720 auto pSwFlyDraw =
dynamic_cast<SwFlyDrawObj*
>(pDrawObject);
1730 assert(pDrawObject);
1736 if (it->m_pDrawObject == pDrawObject)
1740 it->m_pTextBoxFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat(
1741 it->m_pTextBoxFormat);
1755 SAL_WARN(
"sw.core",
"SwTextBoxNode::DelTextBox(): Not found!");
1765 if (it->m_pTextBoxFormat == pTextBox)
1769 it->m_pTextBoxFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat(
1770 it->m_pTextBoxFormat);
1784 SAL_WARN(
"sw.core",
"SwTextBoxNode::DelTextBox(): Not found!");
1789 assert(pDrawObject);
1794 if (
size_t(pTextBoxes.use_count()) != pTextBoxes->GetTextBoxCount() +
size_t(1))
1796 SAL_WARN(
"sw.core",
"SwTextBoxNode::GetTextBox(): RefCount and TexBox count mismatch!");
1807 if (it->m_pDrawObject == pDrawObject)
1809 return it->m_pTextBoxFormat;
1812 SAL_WARN(
"sw.core",
"SwTextBoxNode::GetTextBox(): Not found!");
1830 sal_uInt16 nLoopCount = 0;
1845 if (nLoopCount > (nTextBoxCount + 1))
1847 SAL_WARN(
"sw.core",
"SwTextBoxNode::ClearAll(): Maximum loop count reached!");
1859 SAL_WARN(
"sw.core",
"SwTextBoxNode::ClearAll(): Text-Box-Vector still not empty!");
1868 std::map<SdrObject*, SwFrameFormat*> aRet;
1871 aRet.emplace(rElem.m_pDrawObject, rElem.m_pTextBoxFormat);
1877 bool bSetAttr,
bool bMakeFrame)
const
1879 if (!o_pTarget || !pDoc)
1906 bool bMakeFrame)
const
1908 if (!pSrcObj || !pDestObj)
1914 if (pSrcList && pDestList)
1916 if (pSrcList->GetObjCount() != pDestList->GetObjCount())
1918 SAL_WARN(
"sw.core",
"SwTextBoxNode::Clone_Impl(): Difference between the shapes!");
1922 for (
size_t i = 0;
i < pSrcList->GetObjCount(); ++
i)
1924 Clone_Impl(pDoc, rNewAnc, o_pTarget, pSrcList->GetObj(
i), pDestList->GetObj(
i),
1925 bSetAttr, bMakeFrame);
1930 if (!pSrcList && !pDestList)
1935 if (aNewAnchor.
GetAnchorId() == RndStdIds::FLY_AS_CHAR)
1937 aNewAnchor.
SetType(RndStdIds::FLY_AT_CHAR);
1944 *pSrcFormat, aNewAnchor, bSetAttr, bMakeFrame))
1948 auto pNewTextBoxes = std::make_shared<SwTextBoxNode>(
SwTextBoxNode(o_pTarget));
1950 pNewTextBoxes->AddTextBox(pDestObj, pTargetFormat);
1951 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.
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long getX() const
constexpr tools::Long getY() const
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 sw::FrameFormats< sw::SpzFrameFormat * > * 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 void saveLinks(const sw::FrameFormats< sw::SpzFrameFormat * > &rFormats, std::map< const SwFrameFormat *, const SwFrameFormat * > &rLinks)
Saves the current shape -> textbox links in a map, so they can be restored later.
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 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)
#define DBG_TESTSOLARMUTEX()
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