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

writerfilter: make RTFShape members private

Change-Id: Ifc8431514d95a848de9c31011c457acb32cf44f2
Reviewed-on: https://gerrit.libreoffice.org/68061Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
üst 0626e66d
......@@ -362,7 +362,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
case RTF_DPTXBXTEXT:
{
bool bPictureFrame = false;
for (auto& rProperty : m_aStates.top().aShape.aProperties)
for (auto& rProperty : m_aStates.top().aShape.getProperties())
{
if (rProperty.first == "shapeType"
&& rProperty.second == OUString::number(ESCHER_ShpInst_PictureFrame))
......
......@@ -1087,14 +1087,14 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
}
break;
case RTF_SHPBXPAGE:
m_aStates.top().aShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME;
m_aStates.top().aShape.nHoriOrientRelationToken
= NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page;
m_aStates.top().aShape.setHoriOrientRelation(text::RelOrientation::PAGE_FRAME);
m_aStates.top().aShape.setHoriOrientRelationToken(
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page);
break;
case RTF_SHPBYPAGE:
m_aStates.top().aShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME;
m_aStates.top().aShape.nVertOrientRelationToken
= NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page;
m_aStates.top().aShape.setVertOrientRelation(text::RelOrientation::PAGE_FRAME);
m_aStates.top().aShape.setVertOrientRelationToken(
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page);
break;
case RTF_DPLINEHOLLOW:
m_aStates.top().aDrawingObject.nFLine = 0;
......
......@@ -822,23 +822,23 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
switch (nParam)
{
case 1:
m_aStates.top().aShape.nWrap = text::WrapTextMode_NONE;
m_aStates.top().aShape.setWrap(text::WrapTextMode_NONE);
break;
case 2:
m_aStates.top().aShape.nWrap = text::WrapTextMode_PARALLEL;
m_aStates.top().aShape.setWrap(text::WrapTextMode_PARALLEL);
break;
case 3:
m_aStates.top().aShape.nWrap = text::WrapTextMode_THROUGH;
m_aStates.top().aShape.setWrap(text::WrapTextMode_THROUGH);
m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapNone,
new RTFValue());
break;
case 4:
m_aStates.top().aShape.nWrap = text::WrapTextMode_PARALLEL;
m_aStates.top().aShape.setWrap(text::WrapTextMode_PARALLEL);
m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapTight,
new RTFValue());
break;
case 5:
m_aStates.top().aShape.nWrap = text::WrapTextMode_THROUGH;
m_aStates.top().aShape.setWrap(text::WrapTextMode_THROUGH);
break;
}
}
......@@ -1060,19 +1060,19 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
}
break;
case RTF_SHPLEFT:
m_aStates.top().aShape.nLeft = convertTwipToMm100(nParam);
m_aStates.top().aShape.setLeft(convertTwipToMm100(nParam));
break;
case RTF_SHPTOP:
m_aStates.top().aShape.nTop = convertTwipToMm100(nParam);
m_aStates.top().aShape.setTop(convertTwipToMm100(nParam));
break;
case RTF_SHPRIGHT:
m_aStates.top().aShape.nRight = convertTwipToMm100(nParam);
m_aStates.top().aShape.setRight(convertTwipToMm100(nParam));
break;
case RTF_SHPBOTTOM:
m_aStates.top().aShape.nBottom = convertTwipToMm100(nParam);
m_aStates.top().aShape.setBottom(convertTwipToMm100(nParam));
break;
case RTF_SHPZ:
m_aStates.top().aShape.oZ.reset(nParam);
m_aStates.top().aShape.setZ(nParam);
break;
case RTF_FFTYPE:
switch (nParam)
......@@ -1204,16 +1204,16 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
NS_ooxml::LN_CT_Spacing_after, pIntValue);
break;
case RTF_DPX:
m_aStates.top().aDrawingObject.nLeft = convertTwipToMm100(nParam);
m_aStates.top().aDrawingObject.setLeft(convertTwipToMm100(nParam));
break;
case RTF_DPY:
m_aStates.top().aDrawingObject.nTop = convertTwipToMm100(nParam);
m_aStates.top().aDrawingObject.setTop(convertTwipToMm100(nParam));
break;
case RTF_DPXSIZE:
m_aStates.top().aDrawingObject.nRight = convertTwipToMm100(nParam);
m_aStates.top().aDrawingObject.setRight(convertTwipToMm100(nParam));
break;
case RTF_DPYSIZE:
m_aStates.top().aDrawingObject.nBottom = convertTwipToMm100(nParam);
m_aStates.top().aDrawingObject.setBottom(convertTwipToMm100(nParam));
break;
case RTF_PNSTART:
m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_start, pIntValue);
......@@ -1380,7 +1380,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
break;
case RTF_SHPFBLWTXT:
// Shape is below text -> send it to the background.
m_aStates.top().aShape.bInBackground = nParam;
m_aStates.top().aShape.setInBackground(nParam != 0);
break;
case RTF_CLPADB:
case RTF_CLPADL:
......
......@@ -190,27 +190,103 @@ class RTFShape : public virtual SvRefBase
{
public:
RTFShape();
std::vector<std::pair<OUString, OUString>> aProperties; ///< Properties of a single shape.
std::vector<std::pair<OUString, OUString>>& getProperties() { return m_aProperties; }
const std::vector<std::pair<OUString, OUString>>& getProperties() const
{
return m_aProperties;
}
std::vector<std::pair<OUString, OUString>>& getGroupProperties() { return m_aGroupProperties; }
void setLeft(sal_Int32 nLeft) { m_nLeft = nLeft; }
sal_Int32 getLeft() const { return m_nLeft; }
void setTop(sal_Int32 nTop) { m_nTop = nTop; }
sal_Int32 getTop() const { return m_nTop; }
void setRight(sal_Int32 nRight) { m_nRight = nRight; }
sal_Int32 getRight() const { return m_nRight; }
void setBottom(sal_Int32 nBottom) { m_nBottom = nBottom; }
sal_Int32 getBottom() const { return m_nBottom; }
void setZ(sal_Int32 nZ) { m_oZ.reset(nZ); }
bool hasZ() const { return m_oZ.has_value(); }
sal_Int32 getZ() const { return *m_oZ; }
void setHoriOrientRelation(sal_Int16 nHoriOrientRelation)
{
m_nHoriOrientRelation = nHoriOrientRelation;
}
sal_Int16 getHoriOrientRelation() const { return m_nHoriOrientRelation; }
void setVertOrientRelation(sal_Int16 nVertOrientRelation)
{
m_nVertOrientRelation = nVertOrientRelation;
}
sal_Int16 getVertOrientRelation() const { return m_nVertOrientRelation; }
void setHoriOrientRelationToken(sal_uInt32 nHoriOrientRelationToken)
{
m_nHoriOrientRelationToken = nHoriOrientRelationToken;
}
sal_uInt32 getHoriOrientRelationToken() const { return m_nHoriOrientRelationToken; }
void setVertOrientRelationToken(sal_uInt32 nVertOrientRelationToken)
{
m_nVertOrientRelationToken = nVertOrientRelationToken;
}
sal_uInt32 getVertOrientRelationToken() const { return m_nVertOrientRelationToken; }
void setWrap(css::text::WrapTextMode nWrap) { m_nWrap = nWrap; }
css::text::WrapTextMode getWrap() const { return m_nWrap; }
void setInBackground(bool bInBackground) { m_bInBackground = bInBackground; }
bool getInBackground() const { return m_bInBackground; }
RTFSprms& getWrapPolygonSprms() { return m_aWrapPolygonSprms; }
RTFSprms& getAnchorAttributes() { return m_aAnchorAttributes; }
std::pair<Id, RTFValue::Pointer_t>& getWrapSprm() { return m_aWrapSprm; }
private:
std::vector<std::pair<OUString, OUString>> m_aProperties; ///< Properties of a single shape.
std::vector<std::pair<OUString, OUString>>
aGroupProperties; ///< Properties applied on the groupshape.
sal_Int32 nLeft = 0;
sal_Int32 nTop = 0;
sal_Int32 nRight = 0;
sal_Int32 nBottom = 0;
boost::optional<sal_Int32> oZ; ///< Z-Order of the shape.
sal_Int16 nHoriOrientRelation = 0; ///< Horizontal text::RelOrientation for drawinglayer shapes.
sal_Int16 nVertOrientRelation = 0; ///< Vertical text::RelOrientation for drawinglayer shapes.
sal_uInt32 nHoriOrientRelationToken = 0; ///< Horizontal dmapper token for Writer pictures.
sal_uInt32 nVertOrientRelationToken = 0; ///< Vertical dmapper token for Writer pictures.
css::text::WrapTextMode nWrap = css::text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE;
m_aGroupProperties; ///< Properties applied on the groupshape.
sal_Int32 m_nLeft = 0;
sal_Int32 m_nTop = 0;
sal_Int32 m_nRight = 0;
sal_Int32 m_nBottom = 0;
boost::optional<sal_Int32> m_oZ; ///< Z-Order of the shape.
sal_Int16 m_nHoriOrientRelation
= 0; ///< Horizontal text::RelOrientation for drawinglayer shapes.
sal_Int16 m_nVertOrientRelation = 0; ///< Vertical text::RelOrientation for drawinglayer shapes.
sal_uInt32 m_nHoriOrientRelationToken = 0; ///< Horizontal dmapper token for Writer pictures.
sal_uInt32 m_nVertOrientRelationToken = 0; ///< Vertical dmapper token for Writer pictures.
css::text::WrapTextMode m_nWrap = css::text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE;
/// If shape is below text (true) or text is below shape (false).
bool bInBackground = false;
bool m_bInBackground = false;
/// Wrap polygon, written by RTFSdrImport::resolve(), read by RTFDocumentImpl::resolvePict().
RTFSprms aWrapPolygonSprms;
RTFSprms m_aWrapPolygonSprms;
/// Anchor attributes like wrap distance, written by RTFSdrImport::resolve(), read by RTFDocumentImpl::resolvePict().
RTFSprms aAnchorAttributes;
RTFSprms m_aAnchorAttributes;
/// Wrap type, written by RTFDocumentImpl::popState(), read by RTFDocumentImpl::resolvePict().
std::pair<Id, RTFValue::Pointer_t> aWrapSprm{ 0, nullptr };
std::pair<Id, RTFValue::Pointer_t> m_aWrapSprm{ 0, nullptr };
};
/// Stores the properties of a drawing object.
......
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