/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// If TextBox wasn't enabled previously if (pShape->GetOtherTextBoxFormats() && pShape->GetOtherTextBoxFormats()->GetTextBox(pObject)) return;
// Store the current text content of the shape
OUString sCopyableText;
if (bCopyText)
{ if (pObject)
{
uno::Reference<text::XText> xSrcCnt(pObject->getWeakUnoShape().get(), uno::UNO_QUERY); auto xCur = xSrcCnt->createTextCursor();
xCur->gotoStart(false);
xCur->gotoEnd(true);
sCopyableText = xCur->getText()->getString();
}
}
// Create the associated TextFrame and insert it into the document.
rtl::Reference<SwXTextFrame> xTextFrame
= SwXTextFrame::CreateXTextFrame(pShape->GetDoc(), nullptr);
uno::Reference<text::XTextContentAppend> xTextContentAppend; if (xAnchor)
xTextContentAppend.set(xAnchor->getText(), uno::UNO_QUERY);
if (!xTextContentAppend)
{ if (SwDocShell* pShell = pShape->GetDoc().GetDocShell())
{
rtl::Reference<SwXTextDocument> xTextDocument(pShell->GetBaseModel());
xTextContentAppend = xTextDocument->getBodyText();
}
}
if (xAnchor)
{ // insertTextContentWithProperties would fail if xAnchor is in a different XText
assert(xAnchor->getText() == xTextContentAppend);
xTextContentAppend->insertTextContentWithProperties(
uno::Reference<text::XTextContent>(cppu::getXWeak(xTextFrame.get()), uno::UNO_QUERY),
{}, xAnchor);
} else
{
xTextContentAppend->appendTextContent(
uno::Reference<text::XTextContent>(cppu::getXWeak(xTextFrame.get()), uno::UNO_QUERY),
uno::Sequence<beans::PropertyValue>());
}
// Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls).
SwFrameFormat* pFormat = xTextFrame->GetFrameFormat();
// Link its text range to the original shape.
SwUnoInternalPaM aInternalPaM(pShape->GetDoc()); if (sw::XTextRangeToSwPaM(aInternalPaM, xTextFrame))
{
SwAttrSet aSet(pShape->GetAttrSet());
SwFormatContent aContent(aInternalPaM.GetPointNode().StartOfSectionNode());
aSet.Put(aContent);
pShape->SetFormatAttr(aSet);
}
DoTextBoxZOrderCorrection(pShape, pObject);
// Also initialize the properties, which are not constant, but inherited from the shape's ones.
uno::Reference<drawing::XShape> xShape(pObject->getUnoShape(), uno::UNO_QUERY);
syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::Any(xShape->getSize()), pObject);
void SwTextBoxHelper::set(SwFrameFormat* pShapeFormat, SdrObject* pObj, const uno::Reference<text::XTextFrame>& xNew)
{ // Do not set invalid data
assert(pShapeFormat && pObj && xNew); // Firstly find the format of the new textbox.
SwFrameFormat* pFormat = nullptr; if (auto pTextFrame = dynamic_cast<SwXTextFrame*>(xNew.get()))
pFormat = pTextFrame->GetFrameFormat(); if (!pFormat) return;
// If there is a format, check if the shape already has a textbox assigned to. if (auto& pTextBoxNode = pShapeFormat->GetOtherTextBoxFormats())
{ // If it has a texbox, destroy it. if (pTextBoxNode->GetTextBox(pObj))
pTextBoxNode->DelTextBox(pObj, true); // And set the new one.
pTextBoxNode->AddTextBox(pObj, pFormat);
pFormat->SetOtherTextBoxFormats(pTextBoxNode);
} else
{ // If the shape do not have a texbox node and textbox, // create that for the shape. auto pTextBox = std::make_shared<SwTextBoxNode>(SwTextBoxNode(pShapeFormat));
pTextBox->AddTextBox(pObj, pFormat);
pShapeFormat->SetOtherTextBoxFormats(pTextBox);
pFormat->SetOtherTextBoxFormats(pTextBox);
} // Initialize its properties
uno::Reference<beans::XPropertySet> xPropertySet(xNew, uno::UNO_QUERY);
uno::Any aEmptyBorder{ table::BorderLine2() };
xPropertySet->setPropertyValue(UNO_NAME_TOP_BORDER, aEmptyBorder);
xPropertySet->setPropertyValue(UNO_NAME_BOTTOM_BORDER, aEmptyBorder);
xPropertySet->setPropertyValue(UNO_NAME_LEFT_BORDER, aEmptyBorder);
xPropertySet->setPropertyValue(UNO_NAME_RIGHT_BORDER, aEmptyBorder);
xPropertySet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::Any(sal_Int32(100)));
xPropertySet->setPropertyValue(UNO_NAME_SIZE_TYPE, uno::Any(text::SizeType::FIX));
xPropertySet->setPropertyValue(UNO_NAME_SURROUND, uno::Any(text::WrapTextMode_THROUGH)); // Add a new name to it
uno::Reference<container::XNamed> xNamed(xNew, uno::UNO_QUERY);
assert(!xNamed->getName().isEmpty());
(void)xNamed; // And sync. properties.
uno::Reference<drawing::XShape> xShape(pObj->getUnoShape(), uno::UNO_QUERY);
syncProperty(pShapeFormat, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::Any(xShape->getSize()), pObj);
uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
syncProperty(pShapeFormat, RES_ANCHOR, MID_ANCHOR_ANCHORTYPE,
xShapePropertySet->getPropertyValue(UNO_NAME_ANCHOR_TYPE), pObj);
syncProperty(pShapeFormat, RES_HORI_ORIENT, MID_HORIORIENT_ORIENT,
xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT), pObj);
syncProperty(pShapeFormat, RES_HORI_ORIENT, MID_HORIORIENT_RELATION,
xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_RELATION), pObj);
syncProperty(pShapeFormat, RES_VERT_ORIENT, MID_VERTORIENT_ORIENT,
xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT), pObj);
syncProperty(pShapeFormat, RES_VERT_ORIENT, MID_VERTORIENT_RELATION,
xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION), pObj);
syncProperty(pShapeFormat, RES_HORI_ORIENT, MID_HORIORIENT_POSITION,
xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION), pObj);
syncProperty(pShapeFormat, RES_VERT_ORIENT, MID_VERTORIENT_POSITION,
xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION), pObj);
syncProperty(pShapeFormat, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT,
xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT), pObj);
drawing::TextVerticalAdjust aVertAdj = drawing::TextVerticalAdjust_CENTER; if ((uno::Reference<beans::XPropertyState>(xShape, uno::UNO_QUERY_THROW))
->getPropertyState(UNO_NAME_TEXT_VERT_ADJUST)
!= beans::PropertyState::PropertyState_DEFAULT_VALUE)
{
aVertAdj = xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST)
.get<drawing::TextVerticalAdjust>();
}
xPropertySet->setPropertyValue(UNO_NAME_TEXT_VERT_ADJUST, uno::Any(aVertAdj));
text::WritingMode eMode; if (xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_WRITINGMODE) >>= eMode)
syncProperty(pShapeFormat, RES_FRAMEDIR, 0, uno::Any(sal_Int16(eMode)), pObj);
// Do sync for the new textframe.
synchronizeGroupTextBoxProperty(&changeAnchor, pShapeFormat, pObj);
synchronizeGroupTextBoxProperty(&syncTextBoxSize, pShapeFormat, pObj);
updateTextBoxMargin(pObj);
}
void SwTextBoxHelper::destroy(const SwFrameFormat* pShape, const SdrObject* pObject)
{ // If a TextBox was enabled previously auto& pTextBox = pShape->GetOtherTextBoxFormats(); if (pTextBox)
{ // Unlink the TextBox's text range from the original shape. // Delete the associated TextFrame.
pTextBox->DelTextBox(pObject, true);
}
}
auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape); if (pCustomShape)
{ // Need to temporarily release the lock acquired in // SdXMLShapeContext::AddShape(), otherwise we get an empty rectangle, // see EnhancedCustomShapeEngine::getTextBounds().
uno::Reference<document::XActionLockable> xLockable(pCustomShape->getUnoShape(),
uno::UNO_QUERY);
sal_Int16 nLocks = 0; if (xLockable.is())
nLocks = xLockable->resetActionLocks();
pCustomShape->GetTextBounds(aRet); if (nLocks)
xLockable->setActionLocks(nLocks);
} elseif (pShape)
{ // fallback - get *any* bound rect we can possibly get hold of
aRet = pShape->GetCurrentBoundRect();
}
if (pShape)
{ // Relative, so count the logic (reference) rectangle, see the EnhancedCustomShape2d ctor.
Point aPoint(pShape->GetSnapRect().Center());
Size aSize(pShape->GetLogicRect().GetSize());
aPoint.AdjustX(-(aSize.Width() / 2));
aPoint.AdjustY(-(aSize.Height() / 2));
tools::Rectangle aLogicRect(aPoint, aSize);
aRet.Move(-1 * aLogicRect.Left(), -1 * aLogicRect.Top());
}
return aRet;
}
void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, std::u16string_view rPropertyName, const css::uno::Any& rValue, SdrObject* pObj)
{ // Textframes does not have valid horizontal adjust property, so map it to paragraph adjust property if (rPropertyName == UNO_NAME_TEXT_HORZADJUST)
{
SwFrameFormat* pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj); if (!pFormat) return;
auto xTextFrame = SwXTextFrame::CreateXTextFrame(pFormat->GetDoc(), pFormat);
uno::Reference<text::XTextCursor> xCursor = xTextFrame->getText()->createTextCursor();
// Select all paragraphs in the textframe
xCursor->gotoStart(false);
xCursor->gotoEnd(true);
uno::Reference<beans::XPropertySet> xFrameParaProps(xCursor, uno::UNO_QUERY);
// And simply map the property constauto eValue = rValue.get<drawing::TextHorizontalAdjust>(); switch (eValue)
{ case drawing::TextHorizontalAdjust::TextHorizontalAdjust_CENTER:
xFrameParaProps->setPropertyValue(
UNO_NAME_PARA_ADJUST,
uno::Any(style::ParagraphAdjust::ParagraphAdjust_CENTER)); //3 break; case drawing::TextHorizontalAdjust::TextHorizontalAdjust_LEFT:
xFrameParaProps->setPropertyValue(
UNO_NAME_PARA_ADJUST,
uno::Any(style::ParagraphAdjust::ParagraphAdjust_LEFT)); //0 break; case drawing::TextHorizontalAdjust::TextHorizontalAdjust_RIGHT:
xFrameParaProps->setPropertyValue(
UNO_NAME_PARA_ADJUST,
uno::Any(style::ParagraphAdjust::ParagraphAdjust_RIGHT)); //1 break; default:
SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: unhandled TextHorizontalAdjust: "
<< static_cast<sal_Int32>(eValue)); break;
} return;
}
if (rPropertyName == u"CustomShapeGeometry")
{ // CustomShapeGeometry changes the textbox position offset and size, so adjust both.
syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::Any());
SwFrameFormat* pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj); if (!pFormat) return;
// Older documents or documents in ODF strict do not have WritingMode, but have used the // TextRotateAngle values -90 and -270 to emulate these text directions of frames. // ToDo: Is TextPreRotateAngle needed for diagrams or can it be removed?
comphelper::SequenceAsHashMap aCustomShapeGeometry(rValue); auto it = aCustomShapeGeometry.find(u"TextPreRotateAngle"_ustr); if (it == aCustomShapeGeometry.end())
{
it = aCustomShapeGeometry.find(u"TextRotateAngle"_ustr);
}
if (it != aCustomShapeGeometry.end())
{ auto nAngle = it->second.has<sal_Int32>() ? it->second.get<sal_Int32>() : 0; if (nAngle == 0)
{
nAngle = it->second.has<double>() ? it->second.get<double>() : 0;
}
void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const css::uno::Any& rValue, SdrObject* pObj)
{ // No shape yet? Then nothing to do, initial properties are set by create(). if (!pShape) return;
do
{ switch (pItem->Which())
{ case RES_VERT_ORIENT:
{ // The new position can be with anchor changing so sync it! const text::TextContentAnchorType aNewAnchorType
= mapAnchorType(rShape.GetAnchor().GetAnchorId());
syncProperty(&rShape, RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, uno::Any(aNewAnchorType),
pObj); if (bInlineAnchored || bLayoutInCell) return;
SwFormatVertOrient aOrient(pItem->StaticWhichCast(RES_VERT_ORIENT));
if (rShape.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE
&& rShape.GetAnchor().GetPageNum() != 0)
aOrient.SetRelationOrient(rShape.GetVertOrient().GetRelationOrient());
aTextBoxSet.Put(aOrient);
// restore height (shrunk for extending beyond the page bottom - tdf#91260)
SwFormatFrameSize aSize(pFormat->GetFrameSize()); if (!aRect.IsEmpty())
{
aSize.SetHeight(aRect.getOpenHeight());
aTextBoxSet.Put(aSize);
}
} break; case RES_HORI_ORIENT:
{ // The new position can be with anchor changing so sync it! const text::TextContentAnchorType aNewAnchorType
= mapAnchorType(rShape.GetAnchor().GetAnchorId());
syncProperty(&rShape, RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, uno::Any(aNewAnchorType),
pObj); if (bInlineAnchored || bLayoutInCell) return;
SwFormatHoriOrient aOrient(pItem->StaticWhichCast(RES_HORI_ORIENT));
if (rShape.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE
&& rShape.GetAnchor().GetPageNum() != 0)
aOrient.SetRelationOrient(rShape.GetHoriOrient().GetRelationOrient());
aTextBoxSet.Put(aOrient);
} break; case RES_FRM_SIZE:
{ // In case the shape got resized, then we need to adjust both // the position and the size of the textbox (e.g. larger // rounded edges of a rectangle -> need to push right/down the // textbox).
SwFormatVertOrient aVertOrient(rShape.GetVertOrient());
SwFormatHoriOrient aHoriOrient(rShape.GetHoriOrient());
SwFormatFrameSize aSize(pFormat->GetFrameSize());
aSize.SetWidth(aRect.getOpenWidth());
aSize.SetHeight(aRect.getOpenHeight());
aTextBoxSet.Put(aSize);
}
} break; case RES_ANCHOR:
{ if (pItem->StaticWhichCast(RES_ANCHOR) == rShape.GetAnchor()) // the anchor have to be synced
{ const text::TextContentAnchorType aNewAnchorType
= mapAnchorType(rShape.GetAnchor().GetAnchorId());
syncProperty(&rShape, RES_ANCHOR, MID_ANCHOR_ANCHORTYPE,
uno::Any(aNewAnchorType), pObj);
} else
{
SAL_WARN("sw.core", "SwTextBoxHelper::syncFlyFrameAttr: The anchor of the " "shape different from the textframe!");
}
} break; default:
SAL_WARN("sw.core", "SwTextBoxHelper::syncFlyFrameAttr: unhandled which-id: "
<< pItem->Which()); break;
}
pItem = aIter.NextItem();
} while (pItem && (0 != pItem->Which()));
if (aTextBoxSet.Count())
{ auto aGuard = SwTextBoxLockGuard(*rShape.GetOtherTextBoxFormats());
pFormat->SetFormatAttr(aTextBoxSet);
}
DoTextBoxZOrderCorrection(&rShape, pObj);
}
void SwTextBoxHelper::updateTextBoxMargin(SdrObject* pObj)
{ if (!pObj) return;
uno::Reference<drawing::XShape> xShape(pObj->getUnoShape(), uno::UNO_QUERY); if (!xShape) return;
uno::Reference<beans::XPropertySet> const xPropertySet(xShape, uno::UNO_QUERY);
auto pParentFormat = getOtherTextBoxFormat(getOtherTextBoxFormat(xShape), RES_FLYFRMFMT); if (!pParentFormat) return;
bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* pShape, SdrObject* pObj)
{ // Set the position of the textboxes according to the position of its shape-pair constbool bIsGroupObj = (pObj != pShape->FindRealSdrObject()) && pObj; if (auto pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj))
{ // Do not create undo entry for the positioning
::sw::UndoGuard const UndoGuard(pShape->GetDoc().GetIDocumentUndoRedo()); auto aGuard = SwTextBoxLockGuard(*pShape->GetOtherTextBoxFormats()); // Special treatment for AS_CHAR textboxes: if (pShape->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR)
{ // Get the text area of the shape
tools::Rectangle aRect
= getRelativeTextRectangle(pObj ? pObj : pShape->FindRealSdrObject());
// Set the textbox position at the X-axis:
SwFormatHoriOrient aNewHOri(pFormat->GetHoriOrient()); if (bIsGroupObj && aNewHOri.GetHoriOrient() != text::HoriOrientation::NONE)
aNewHOri.SetHoriOrient(text::HoriOrientation::NONE);
// tdf#152142: For RTL, positioning is relative to the right if (pShape->GetLayoutDir() == SwFrameFormat::HORI_R2L)
{ auto nRightSpace = pShape->GetLRSpace().ResolveRight({});
// Special handling of group textboxes if (bIsGroupObj)
{ // There are the following cases: // case 1: The textbox should be in that position where the shape is. // case 2: The shape has negative offset so that have to be subtracted // case 3: The shape and its parent shape also has negative offset, so subtract
aNewVOri.SetPos(
((pObj->GetRelativePos().getY()) > 0
? (pShape->GetVertOrient().GetPos() > 0
? pObj->GetRelativePos().getY()
: pObj->GetRelativePos().getY() - pShape->GetVertOrient().GetPos())
: (pShape->GetVertOrient().GetPos() > 0
? 0 // Is this can be a variation?
: pObj->GetRelativePos().getY() - pShape->GetVertOrient().GetPos()))
+ aRect.Top());
} else
{ // Simple textboxes: vertical position equals to the vertical offset of the shape
aNewVOri.SetPos(
((pShape->GetVertOrient().GetPos()) > 0 ? pShape->GetVertOrient().GetPos() : 0)
+ aRect.Top());
}
// Special cases when the shape is aligned to the line if (pShape->GetVertOrient().GetVertOrient() != text::VertOrientation::NONE)
{
aNewVOri.SetVertOrient(text::VertOrientation::NONE); switch (pShape->GetVertOrient().GetVertOrient())
{ // Top aligned shape case text::VertOrientation::TOP: case text::VertOrientation::CHAR_TOP: case text::VertOrientation::LINE_TOP:
{
aNewVOri.SetPos(aNewVOri.GetPos() - pShape->GetFrameSize().GetHeight()); break;
} // Bottom aligned shape case text::VertOrientation::BOTTOM: case text::VertOrientation::CHAR_BOTTOM: case text::VertOrientation::LINE_BOTTOM:
{
aNewVOri.SetPos(aNewVOri.GetPos() + pShape->GetFrameSize().GetHeight()); break;
} // Center aligned shape case text::VertOrientation::CENTER: case text::VertOrientation::CHAR_CENTER: case text::VertOrientation::LINE_CENTER:
{
aNewVOri.SetPos(aNewVOri.GetPos()
+ std::lroundf(pShape->GetFrameSize().GetHeight() / 2)); break;
} default: break;
}
}
pFormat->SetFormatAttr(aNewHOri);
pFormat->SetFormatAttr(aNewVOri);
} // Other cases when the shape has different anchor from AS_CHAR else
{ // Text area of the shape
tools::Rectangle aRect
= getRelativeTextRectangle(pObj ? pObj : pShape->FindRealSdrObject());
// Set the same position as the (child) shape has
SwFormatHoriOrient aNewHOri(pShape->GetHoriOrient()); if (bIsGroupObj && aNewHOri.GetHoriOrient() != text::HoriOrientation::NONE)
aNewHOri.SetHoriOrient(text::HoriOrientation::NONE);
// Get the distance of the child shape inside its parent constauto nInshapePos
= pObj ? pObj->GetRelativePos() - pShape->FindRealSdrObject()->GetRelativePos()
: Point();
// Special case: the shape has relative position from the page if (pShape->GetHoriOrient().GetRelationOrient() == text::RelOrientation::PAGE_FRAME
&& pShape->GetAnchor().GetAnchorId() != RndStdIds::FLY_AT_PAGE)
{
aNewHOri.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
aNewHOri.SetPos(pShape->GetHoriOrient().GetPos() + nInshapePos.getX()
+ aRect.Left());
}
// Other special case: shape is inside a table or floating table following the text flow if (pShape->GetFollowTextFlow().GetValue() && pShape->GetAnchor().GetAnchorNode()
&& pShape->GetAnchor().GetAnchorNode()->FindTableNode())
{ // WARNING: It is highly likely that everything here is simplistic and incomplete.
// Microsoft allows WrapThrough shapes to be placed outside of the cell // despite having specified layoutInCell. // (Re-using existing, appropriately-named, compat flag to identify MSO formats.) constbool bMSOLayout = pFormat->getIDocumentSettingAccess().get(
DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION);
// Table position
Point nTableOffset; // Floating table if (auto pFly
= pShape->GetAnchor().GetAnchorNode()->FindTableNode()->FindFlyStartNode())
{ if (auto pFlyFormat = pFly->GetFlyFormat())
{
nTableOffset.setX(pFlyFormat->GetHoriOrient().GetPos());
nTableOffset.setY(pFlyFormat->GetVertOrient().GetPos());
}
} else // Normal table
{ auto pTableNode = pShape->GetAnchor().GetAnchorNode()->FindTableNode(); if (auto pTableFormat = pTableNode->GetTable().GetFrameFormat())
{
nTableOffset.setX(pTableFormat->GetHoriOrient().GetPos());
nTableOffset.setY(pTableFormat->GetVertOrient().GetPos());
}
}
// stay within the cell limits (since following text flow) // unless this is based on a Microsoft layout which has a through-wrap exception. bool bWrapThrough = false;
getShapeWrapThrough(pShape, bWrapThrough);
sal_Int32 nPos = aNewHOri.GetPos(); if (nPos < 0 && (!bMSOLayout || !bWrapThrough))
nPos = 0; // Add the table positions to the textbox
aNewHOri.SetPos(nPos + nTableOffset.getX());
if (auto pTextBox = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj))
{ auto aGuard = SwTextBoxLockGuard(*pShape->GetOtherTextBoxFormats()); constauto aSize = getRelativeTextRectangle(pObj).GetSize(); if (!aSize.IsEmpty())
{
SwFormatFrameSize aFrameSize(pTextBox->GetFrameSize());
aFrameSize.SetSize(aSize); return pTextBox->SetFormatAttr(aFrameSize);
}
}
returnfalse;
}
bool SwTextBoxHelper::DoTextBoxZOrderCorrection(SwFrameFormat* pShape, const SdrObject* pObj)
{ // TODO: do this with group shape textboxes.
SdrObject* pShpObj = nullptr;
pShpObj = pShape->FindRealSdrObject();
if (!pShpObj)
{
SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): " "No Valid SdrObject for the shape!"); returnfalse;
}
auto pTextBox = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj); if (!pTextBox) returnfalse;
SdrObject* pFrmObj = pTextBox->FindRealSdrObject(); if (!pFrmObj)
{ if (SwFlyFrameFormat* pFlyFrameFormat = dynamic_cast<SwFlyFrameFormat*>(pTextBox))
{ // During loading there is no ready SdrObj for z-ordering, so create and cache it here
pFrmObj = SwXTextFrame::GetOrCreateSdrObject(*pFlyFrameFormat);
}
} if (!pFrmObj)
{
SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): " "No Valid SdrObject for the frame!"); returnfalse;
} // Get the draw model from the doc
SwDrawModel* pDrawModel = pShape->GetDoc().getIDocumentDrawModelAccess().GetDrawModel(); if (!pDrawModel)
{
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.