Kaydet (Commit) 4d35ac2f authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: clang-format textboxhelper

This was more or less consistent before, but the recent automatic
rewrites broke consistency, just give up on manual formatting here.

Change-Id: Ieb387e3d7230d227e33ba0b420cfa572309c5330
Reviewed-on: https://gerrit.libreoffice.org/50119Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst f3c68cdf
...@@ -15126,7 +15126,6 @@ sw/inc/tabcol.hxx ...@@ -15126,7 +15126,6 @@ sw/inc/tabcol.hxx
sw/inc/tblafmt.hxx sw/inc/tblafmt.hxx
sw/inc/tblenum.hxx sw/inc/tblenum.hxx
sw/inc/tblsel.hxx sw/inc/tblsel.hxx
sw/inc/textboxhelper.hxx
sw/inc/tgrditem.hxx sw/inc/tgrditem.hxx
sw/inc/tox.hxx sw/inc/tox.hxx
sw/inc/toxe.hxx sw/inc/toxe.hxx
...@@ -15375,7 +15374,6 @@ sw/source/core/doc/swstylemanager.hxx ...@@ -15375,7 +15374,6 @@ sw/source/core/doc/swstylemanager.hxx
sw/source/core/doc/tblafmt.cxx sw/source/core/doc/tblafmt.cxx
sw/source/core/doc/tblcpy.cxx sw/source/core/doc/tblcpy.cxx
sw/source/core/doc/tblrwcl.cxx sw/source/core/doc/tblrwcl.cxx
sw/source/core/doc/textboxhelper.cxx
sw/source/core/doc/visiturl.cxx sw/source/core/doc/visiturl.cxx
sw/source/core/docnode/cancellablejob.cxx sw/source/core/docnode/cancellablejob.cxx
sw/source/core/docnode/cancellablejob.hxx sw/source/core/docnode/cancellablejob.hxx
......
...@@ -55,11 +55,14 @@ public: ...@@ -55,11 +55,14 @@ public:
static css::uno::Any queryInterface(SwFrameFormat* pShape, const css::uno::Type& rType); static css::uno::Any queryInterface(SwFrameFormat* pShape, const css::uno::Type& rType);
/// Sync property of TextBox with the one of the shape. /// Sync property of TextBox with the one of the shape.
static void syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const css::uno::Any& rValue); static void syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID,
const css::uno::Any& rValue);
/// Does the same, but works on properties which lack an sw-specific WID / MemberID. /// Does the same, but works on properties which lack an sw-specific WID / MemberID.
static void syncProperty(SwFrameFormat* pShape, const OUString& rPropertyName, const css::uno::Any& rValue); static void syncProperty(SwFrameFormat* pShape, const OUString& rPropertyName,
const css::uno::Any& rValue);
/// Get a property of the underlying TextFrame. /// Get a property of the underlying TextFrame.
static void getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, css::uno::Any& rValue); static void getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID,
css::uno::Any& rValue);
/// Similar to syncProperty(), but used by the internal API (e.g. for UI purposes). /// Similar to syncProperty(), but used by the internal API (e.g. for UI purposes).
static void syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const& rSet); static void syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const& rSet);
...@@ -74,7 +77,8 @@ public: ...@@ -74,7 +77,8 @@ public:
*/ */
static SwFrameFormat* getOtherTextBoxFormat(const SwFrameFormat* pFormat, sal_uInt16 nType); static SwFrameFormat* getOtherTextBoxFormat(const SwFrameFormat* pFormat, sal_uInt16 nType);
/// If we have an associated TextFrame, then return that. /// If we have an associated TextFrame, then return that.
static SwFrameFormat* getOtherTextBoxFormat(css::uno::Reference<css::drawing::XShape> const& xShape); static SwFrameFormat*
getOtherTextBoxFormat(css::uno::Reference<css::drawing::XShape> const& xShape);
/// Return the textbox rectangle of a draw shape (in twips). /// Return the textbox rectangle of a draw shape (in twips).
static tools::Rectangle getTextRectangle(SwFrameFormat* pShape, bool bAbsolute = true); static tools::Rectangle getTextRectangle(SwFrameFormat* pShape, bool bAbsolute = true);
...@@ -103,11 +107,14 @@ public: ...@@ -103,11 +107,14 @@ public:
static void getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough); static void getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& rWrapThrough);
/// Saves the current shape -> textbox links in a map, so they can be restored later. /// Saves the current shape -> textbox links in a map, so they can be restored later.
static void saveLinks(const SwFrameFormats& rFormats, std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks); static void saveLinks(const SwFrameFormats& rFormats,
std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks);
/// Reset the shape -> textbox link on the shape, and save it to the map, so it can be restored later. /// Reset the shape -> textbox link on the shape, and save it to the map, so it can be restored later.
static void resetLink(SwFrameFormat* pShape, std::map<const SwFrameFormat*, SwFormatContent>& rOldContent); static void resetLink(SwFrameFormat* pShape,
std::map<const SwFrameFormat*, SwFormatContent>& rOldContent);
/// Undo the effect of saveLinks() + individual resetLink() calls. /// Undo the effect of saveLinks() + individual resetLink() calls.
static void restoreLinks(std::set<ZSortFly>& rOld, std::vector<SwFrameFormat*>& rNew, SavedLink& rSavedLinks, SavedContent& rResetContent); static void restoreLinks(std::set<ZSortFly>& rOld, std::vector<SwFrameFormat*>& rNew,
SavedLink& rSavedLinks, SavedContent& rResetContent);
}; };
#endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX #endif // INCLUDED_SW_INC_TEXTBOXHELPER_HXX
......
...@@ -52,9 +52,13 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape) ...@@ -52,9 +52,13 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
return; return;
// Create the associated TextFrame and insert it into the document. // Create the associated TextFrame and insert it into the document.
uno::Reference<text::XTextContent> xTextFrame(SwXServiceProvider::MakeInstance(SwServiceType::TypeTextFrame, *pShape->GetDoc()), uno::UNO_QUERY); uno::Reference<text::XTextContent> xTextFrame(
uno::Reference<text::XTextDocument> xTextDocument(pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY); SwXServiceProvider::MakeInstance(SwServiceType::TypeTextFrame, *pShape->GetDoc()),
uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(), uno::UNO_QUERY); uno::UNO_QUERY);
uno::Reference<text::XTextDocument> xTextDocument(
pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(),
uno::UNO_QUERY);
xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence<beans::PropertyValue>()); xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence<beans::PropertyValue>());
// Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls). // Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls).
...@@ -96,19 +100,27 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape) ...@@ -96,19 +100,27 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
} }
// Also initialize the properties, which are not constant, but inherited from the shape's ones. // Also initialize the properties, which are not constant, but inherited from the shape's ones.
uno::Reference<drawing::XShape> xShape(pShape->FindRealSdrObject()->getUnoShape(), uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape(pShape->FindRealSdrObject()->getUnoShape(),
uno::UNO_QUERY);
syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::makeAny(xShape->getSize())); syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::makeAny(xShape->getSize()));
uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT)); syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_ORIENT,
syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_RELATION)); xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT));
syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT)); syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_RELATION,
syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION)); xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_RELATION));
syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION)); syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_ORIENT,
syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION)); xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT));
syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT)); syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_RELATION,
syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST)); xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION));
syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION,
xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION));
syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION,
xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION));
syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT,
xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT));
syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0,
xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST));
} }
void SwTextBoxHelper::destroy(SwFrameFormat* pShape) void SwTextBoxHelper::destroy(SwFrameFormat* pShape)
...@@ -133,7 +145,8 @@ bool SwTextBoxHelper::isTextBox(const SwFrameFormat* pFormat, sal_uInt16 nType) ...@@ -133,7 +145,8 @@ bool SwTextBoxHelper::isTextBox(const SwFrameFormat* pFormat, sal_uInt16 nType)
if (!pFormat || pFormat->Which() != nType || !pFormat->GetAttrSet().HasItem(RES_CNTNT)) if (!pFormat || pFormat->Which() != nType || !pFormat->GetAttrSet().HasItem(RES_CNTNT))
return false; return false;
sal_uInt16 nOtherType = (pFormat->Which() == RES_FLYFRMFMT) ? sal_uInt16(RES_DRAWFRMFMT) : sal_uInt16(RES_FLYFRMFMT); sal_uInt16 nOtherType = (pFormat->Which() == RES_FLYFRMFMT) ? sal_uInt16(RES_DRAWFRMFMT)
: sal_uInt16(RES_FLYFRMFMT);
SwFrameFormat* pOtherFormat = pFormat->GetOtherTextBoxFormat(); SwFrameFormat* pOtherFormat = pFormat->GetOtherTextBoxFormat();
if (!pOtherFormat) if (!pOtherFormat)
return false; return false;
...@@ -224,7 +237,8 @@ void SwTextBoxHelper::getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& r ...@@ -224,7 +237,8 @@ void SwTextBoxHelper::getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& r
rWrapThrough = pShape->GetSurround().GetSurround() == css::text::WrapTextMode_THROUGH; rWrapThrough = pShape->GetSurround().GetSurround() == css::text::WrapTextMode_THROUGH;
} }
SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(const SwFrameFormat* pFormat, sal_uInt16 nType) SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(const SwFrameFormat* pFormat,
sal_uInt16 nType)
{ {
if (!isTextBox(pFormat, nType)) if (!isTextBox(pFormat, nType))
return nullptr; return nullptr;
...@@ -241,14 +255,12 @@ SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(uno::Reference<drawing::XS ...@@ -241,14 +255,12 @@ SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(uno::Reference<drawing::XS
return getOtherTextBoxFormat(pFormat, RES_DRAWFRMFMT); return getOtherTextBoxFormat(pFormat, RES_DRAWFRMFMT);
} }
template < typename T > template <typename T> void lcl_queryInterface(SwFrameFormat* pShape, uno::Any& rAny)
void lcl_queryInterface(SwFrameFormat* pShape, uno::Any& rAny)
{ {
if (SwFrameFormat* pFormat = SwTextBoxHelper::getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT)) if (SwFrameFormat* pFormat = SwTextBoxHelper::getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT))
{ {
uno::Reference<T> const xInterface( uno::Reference<T> const xInterface(
SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat), SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat), uno::UNO_QUERY);
uno::UNO_QUERY);
rAny <<= xInterface; rAny <<= xInterface;
} }
} }
...@@ -270,7 +282,6 @@ uno::Any SwTextBoxHelper::queryInterface(SwFrameFormat* pShape, const uno::Type& ...@@ -270,7 +282,6 @@ uno::Any SwTextBoxHelper::queryInterface(SwFrameFormat* pShape, const uno::Type&
lcl_queryInterface<text::XTextRange>(pShape, aRet); lcl_queryInterface<text::XTextRange>(pShape, aRet);
} }
return aRet; return aRet;
} }
...@@ -284,7 +295,8 @@ tools::Rectangle SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool b ...@@ -284,7 +295,8 @@ tools::Rectangle SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool b
// Need to temporarily release the lock acquired in // Need to temporarily release the lock acquired in
// SdXMLShapeContext::AddShape(), otherwise we get an empty rectangle, // SdXMLShapeContext::AddShape(), otherwise we get an empty rectangle,
// see EnhancedCustomShapeEngine::getTextBounds(). // see EnhancedCustomShapeEngine::getTextBounds().
uno::Reference<document::XActionLockable> xLockable(pCustomShape->getUnoShape(), uno::UNO_QUERY); uno::Reference<document::XActionLockable> xLockable(pCustomShape->getUnoShape(),
uno::UNO_QUERY);
sal_Int16 nLocks = 0; sal_Int16 nLocks = 0;
if (xLockable.is()) if (xLockable.is())
nLocks = xLockable->resetActionLocks(); nLocks = xLockable->resetActionLocks();
...@@ -298,8 +310,8 @@ tools::Rectangle SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool b ...@@ -298,8 +310,8 @@ tools::Rectangle SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool b
// Relative, so count the logic (reference) rectangle, see the EnhancedCustomShape2d ctor. // Relative, so count the logic (reference) rectangle, see the EnhancedCustomShape2d ctor.
Point aPoint(pCustomShape->GetSnapRect().Center()); Point aPoint(pCustomShape->GetSnapRect().Center());
Size aSize(pCustomShape->GetLogicRect().GetSize()); Size aSize(pCustomShape->GetLogicRect().GetSize());
aPoint.AdjustX( -(aSize.Width() / 2) ); aPoint.AdjustX(-(aSize.Width() / 2));
aPoint.AdjustY( -(aSize.Height() / 2) ); aPoint.AdjustY(-(aSize.Height() / 2));
tools::Rectangle aLogicRect(aPoint, aSize); tools::Rectangle aLogicRect(aPoint, aSize);
aRet.Move(-1 * aLogicRect.Left(), -1 * aLogicRect.Top()); aRet.Move(-1 * aLogicRect.Left(), -1 * aLogicRect.Top());
} }
...@@ -307,7 +319,8 @@ tools::Rectangle SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool b ...@@ -307,7 +319,8 @@ tools::Rectangle SwTextBoxHelper::getTextRectangle(SwFrameFormat* pShape, bool b
return aRet; return aRet;
} }
void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& rPropertyName, const css::uno::Any& rValue) void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& rPropertyName,
const css::uno::Any& rValue)
{ {
if (rPropertyName == "CustomShapeGeometry") if (rPropertyName == "CustomShapeGeometry")
{ {
...@@ -318,26 +331,35 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& rPrope ...@@ -318,26 +331,35 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& rPrope
if (pObject) if (pObject)
{ {
tools::Rectangle aRectangle(pObject->GetSnapRect()); tools::Rectangle aRectangle(pObject->GetSnapRect());
syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Left())))); syncProperty(
syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Top())))); pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION,
uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Left()))));
syncProperty(
pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION,
uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Top()))));
} }
if (SwFrameFormat* pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT)) if (SwFrameFormat* pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT))
{ {
comphelper::SequenceAsHashMap aCustomShapeGeometry(rValue); comphelper::SequenceAsHashMap aCustomShapeGeometry(rValue);
// That would be the btLr text direction which we don't support at a frame level, so do it at a character level. // That would be the btLr text direction which we don't support at a frame level, so do it at a character level.
if (aCustomShapeGeometry.find("TextPreRotateAngle") != aCustomShapeGeometry.end() && aCustomShapeGeometry["TextPreRotateAngle"].get<sal_Int32>() == -270) if (aCustomShapeGeometry.find("TextPreRotateAngle") != aCustomShapeGeometry.end()
&& aCustomShapeGeometry["TextPreRotateAngle"].get<sal_Int32>() == -270)
{ {
if (const SwNodeIndex* pNodeIndex = pFormat->GetContent().GetContentIdx()) if (const SwNodeIndex* pNodeIndex = pFormat->GetContent().GetContentIdx())
{ {
SwPaM aPaM(*pFormat->GetDoc()->GetNodes()[pNodeIndex->GetIndex() + 1], 0); SwPaM aPaM(*pFormat->GetDoc()->GetNodes()[pNodeIndex->GetIndex() + 1], 0);
aPaM.SetMark(); aPaM.SetMark();
if (SwTextNode* pMark = pFormat->GetDoc()->GetNodes()[pNodeIndex->GetNode().EndOfSectionIndex() - 1]->GetTextNode()) if (SwTextNode* pMark
= pFormat->GetDoc()
->GetNodes()[pNodeIndex->GetNode().EndOfSectionIndex() - 1]
->GetTextNode())
{ {
aPaM.GetMark()->nNode = *pMark; aPaM.GetMark()->nNode = *pMark;
aPaM.GetMark()->nContent.Assign(pMark, pMark->GetText().getLength()); aPaM.GetMark()->nContent.Assign(pMark, pMark->GetText().getLength());
SvxCharRotateItem aItem(900, false, RES_CHRATR_ROTATE); SvxCharRotateItem aItem(900, false, RES_CHRATR_ROTATE);
pFormat->GetDoc()->getIDocumentContentOperations().InsertPoolItem(aPaM, aItem); pFormat->GetDoc()->getIDocumentContentOperations().InsertPoolItem(aPaM,
aItem);
} }
} }
} }
...@@ -357,7 +379,8 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& rPrope ...@@ -357,7 +379,8 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& rPrope
syncProperty(pShape, RES_BOX, BOTTOM_BORDER_DISTANCE, rValue); syncProperty(pShape, RES_BOX, BOTTOM_BORDER_DISTANCE, rValue);
} }
void SwTextBoxHelper::getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, css::uno::Any& rValue) void SwTextBoxHelper::getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID,
css::uno::Any& rValue)
{ {
if (!pShape) if (!pShape)
return; return;
...@@ -385,7 +408,8 @@ void SwTextBoxHelper::getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID, ...@@ -385,7 +408,8 @@ void SwTextBoxHelper::getProperty(SwFrameFormat const* pShape, sal_uInt16 nWID,
} }
} }
void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, const css::uno::Any& rValue) void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_uInt8 nMemberID,
const css::uno::Any& rValue)
{ {
// No shape yet? Then nothing to do, initial properties are set by create(). // No shape yet? Then nothing to do, initial properties are set by create().
if (!pShape) if (!pShape)
...@@ -454,12 +478,14 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u ...@@ -454,12 +478,14 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u
switch (nMemberID) switch (nMemberID)
{ {
case MID_ANCHOR_ANCHORTYPE: case MID_ANCHOR_ANCHORTYPE:
if (aValue.get<text::TextContentAnchorType>() == text::TextContentAnchorType_AS_CHARACTER) if (aValue.get<text::TextContentAnchorType>()
== text::TextContentAnchorType_AS_CHARACTER)
{ {
uno::Reference<beans::XPropertySet> const xPropertySet( uno::Reference<beans::XPropertySet> const xPropertySet(
SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat), SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat),
uno::UNO_QUERY); uno::UNO_QUERY);
xPropertySet->setPropertyValue(UNO_NAME_SURROUND, uno::makeAny(text::WrapTextMode_THROUGH)); xPropertySet->setPropertyValue(
UNO_NAME_SURROUND, uno::makeAny(text::WrapTextMode_THROUGH));
return; return;
} }
break; break;
...@@ -536,21 +562,22 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u ...@@ -536,21 +562,22 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u
} }
else if (bAdjustSize) else if (bAdjustSize)
{ {
awt::Size aSize(TWIPS_TO_MM(aRect.getWidth()), TWIPS_TO_MM(aRect.getHeight())); awt::Size aSize(TWIPS_TO_MM(aRect.getWidth()),
TWIPS_TO_MM(aRect.getHeight()));
aValue <<= aSize; aValue <<= aSize;
} }
} }
} }
uno::Reference<beans::XPropertySet> const xPropertySet( uno::Reference<beans::XPropertySet> const xPropertySet(
SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat), SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat), uno::UNO_QUERY);
uno::UNO_QUERY);
xPropertySet->setPropertyValue(aPropertyName, aValue); xPropertySet->setPropertyValue(aPropertyName, aValue);
} }
} }
} }
void SwTextBoxHelper::saveLinks(const SwFrameFormats& rFormats, std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks) void SwTextBoxHelper::saveLinks(const SwFrameFormats& rFormats,
std::map<const SwFrameFormat*, const SwFrameFormat*>& rLinks)
{ {
for (const auto pFormat : rFormats) for (const auto pFormat : rFormats)
{ {
...@@ -559,7 +586,8 @@ void SwTextBoxHelper::saveLinks(const SwFrameFormats& rFormats, std::map<const S ...@@ -559,7 +586,8 @@ void SwTextBoxHelper::saveLinks(const SwFrameFormats& rFormats, std::map<const S
} }
} }
void SwTextBoxHelper::resetLink(SwFrameFormat* pShape, std::map<const SwFrameFormat*, SwFormatContent>& rOldContent) void SwTextBoxHelper::resetLink(SwFrameFormat* pShape,
std::map<const SwFrameFormat*, SwFormatContent>& rOldContent)
{ {
if (pShape->Which() == RES_DRAWFRMFMT) if (pShape->Which() == RES_DRAWFRMFMT)
{ {
...@@ -569,7 +597,8 @@ void SwTextBoxHelper::resetLink(SwFrameFormat* pShape, std::map<const SwFrameFor ...@@ -569,7 +597,8 @@ void SwTextBoxHelper::resetLink(SwFrameFormat* pShape, std::map<const SwFrameFor
} }
} }
void SwTextBoxHelper::restoreLinks(std::set<ZSortFly>& rOld, std::vector<SwFrameFormat*>& rNew, SavedLink& rSavedLinks, SavedContent& rResetContent) void SwTextBoxHelper::restoreLinks(std::set<ZSortFly>& rOld, std::vector<SwFrameFormat*>& rNew,
SavedLink& rSavedLinks, SavedContent& rResetContent)
{ {
std::size_t i = 0; std::size_t i = 0;
for (auto aSetIt = rOld.begin(); aSetIt != rOld.end(); ++aSetIt, ++i) for (auto aSetIt = rOld.begin(); aSetIt != rOld.end(); ++aSetIt, ++i)
...@@ -585,7 +614,8 @@ void SwTextBoxHelper::restoreLinks(std::set<ZSortFly>& rOld, std::vector<SwFrame ...@@ -585,7 +614,8 @@ void SwTextBoxHelper::restoreLinks(std::set<ZSortFly>& rOld, std::vector<SwFrame
} }
} }
if (rResetContent.find(aSetIt->GetFormat()) != rResetContent.end()) if (rResetContent.find(aSetIt->GetFormat()) != rResetContent.end())
const_cast<SwFrameFormat*>(aSetIt->GetFormat())->SetFormatAttr(rResetContent[aSetIt->GetFormat()]); const_cast<SwFrameFormat*>(aSetIt->GetFormat())
->SetFormatAttr(rResetContent[aSetIt->GetFormat()]);
} }
} }
...@@ -659,14 +689,14 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const& ...@@ -659,14 +689,14 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const&
} }
break; break;
default: default:
SAL_WARN("sw.core", "SwTextBoxHelper::syncFlyFrameAttr: unhandled which-id: " << nWhich); SAL_WARN("sw.core",
"SwTextBoxHelper::syncFlyFrameAttr: unhandled which-id: " << nWhich);
break; break;
} }
if (aIter.IsAtEnd()) if (aIter.IsAtEnd())
break; break;
} } while (0 != (nWhich = aIter.NextItem()->Which()));
while (0 != (nWhich = aIter.NextItem()->Which()));
if (aTextBoxSet.Count()) if (aTextBoxSet.Count())
pFormat->GetDoc()->SetFlyFrameAttr(*pFormat, aTextBoxSet); pFormat->GetDoc()->SetFlyFrameAttr(*pFormat, aTextBoxSet);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment