[Libreoffice-commits] core.git: writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Feb 20 11:12:08 UTC 2019


 writerfilter/source/rtftok/rtfdispatchdestination.cxx |    2 
 writerfilter/source/rtftok/rtfdispatchflag.cxx        |   12 +-
 writerfilter/source/rtftok/rtfdispatchvalue.cxx       |   30 ++---
 writerfilter/source/rtftok/rtfdocumentimpl.cxx        |   83 +++++++------
 writerfilter/source/rtftok/rtfdocumentimpl.hxx        |  108 +++++++++++++++---
 writerfilter/source/rtftok/rtfsdrimport.cxx           |   66 +++++------
 6 files changed, 190 insertions(+), 111 deletions(-)

New commits:
commit d1a6aa9433f9b48d7a476af0b41d389fd3267c73
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Feb 20 08:56:18 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Feb 20 12:11:38 2019 +0100

    writerfilter: make RTFShape members private
    
    Change-Id: Ifc8431514d95a848de9c31011c457acb32cf44f2
    Reviewed-on: https://gerrit.libreoffice.org/68061
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
index 68adede7d9f0..773138c27e86 100644
--- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
@@ -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))
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index ea57b385aa44..d4bb2b57fbac 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -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;
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index bd0fac947fb7..aba2e4ca90c2 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -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:
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3785e99cd66b..9e2d9fea060b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1024,8 +1024,8 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
     if (m_aStates.top().bInShape)
     {
         // Picture in shape: it looks like pib picture, so we will stretch the picture to shape size (tdf#49893)
-        nXExt = m_aStates.top().aShape.nRight - m_aStates.top().aShape.nLeft;
-        nYExt = m_aStates.top().aShape.nBottom - m_aStates.top().aShape.nTop;
+        nXExt = m_aStates.top().aShape.getRight() - m_aStates.top().aShape.getLeft();
+        nYExt = m_aStates.top().aShape.getBottom() - m_aStates.top().aShape.getTop();
     }
     auto pXExtValue = new RTFValue(oox::drawingml::convertHmmToEmu(nXExt));
     auto pYExtValue = new RTFValue(oox::drawingml::convertHmmToEmu(nYExt));
@@ -1058,9 +1058,9 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
     {
         // wrap sprm
         RTFSprms aAnchorWrapAttributes;
-        m_aStates.top().aShape.aAnchorAttributes.set(
+        m_aStates.top().aShape.getAnchorAttributes().set(
             NS_ooxml::LN_CT_Anchor_behindDoc,
-            new RTFValue((m_aStates.top().aShape.bInBackground) ? 1 : 0));
+            new RTFValue((m_aStates.top().aShape.getInBackground()) ? 1 : 0));
         RTFSprms aAnchorSprms;
         for (auto& rCharacterAttribute : m_aStates.top().aCharacterAttributes)
         {
@@ -1077,20 +1077,20 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
 
                 // If there is a wrap polygon prepared by RTFSdrImport, pick it up here.
                 if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight
-                    && !m_aStates.top().aShape.aWrapPolygonSprms.empty())
+                    && !m_aStates.top().aShape.getWrapPolygonSprms().empty())
                     rCharacterSprm.second->getSprms().set(
                         NS_ooxml::LN_CT_WrapTight_wrapPolygon,
-                        new RTFValue(RTFSprms(), m_aStates.top().aShape.aWrapPolygonSprms));
+                        new RTFValue(RTFSprms(), m_aStates.top().aShape.getWrapPolygonSprms()));
 
                 aAnchorSprms.set(rCharacterSprm.first, rCharacterSprm.second);
             }
         }
 
-        if (m_aStates.top().aShape.aWrapSprm.first != 0)
+        if (m_aStates.top().aShape.getWrapSprm().first != 0)
             // Replay of a buffered shape, wrap sprm there has priority over
             // character sprms of the current state.
-            aAnchorSprms.set(m_aStates.top().aShape.aWrapSprm.first,
-                             m_aStates.top().aShape.aWrapSprm.second);
+            aAnchorSprms.set(m_aStates.top().aShape.getWrapSprm().first,
+                             m_aStates.top().aShape.getWrapSprm().second);
 
         aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue);
         if (!aAnchorWrapAttributes.empty() && nWrap == -1)
@@ -1100,13 +1100,13 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
         // See OOXMLFastContextHandler::positionOffset(), we can't just put offset values in an RTFValue.
         RTFSprms aPoshAttributes;
         RTFSprms aPoshSprms;
-        if (m_aStates.top().aShape.nHoriOrientRelationToken > 0)
+        if (m_aStates.top().aShape.getHoriOrientRelationToken() > 0)
             aPoshAttributes.set(NS_ooxml::LN_CT_PosH_relativeFrom,
-                                new RTFValue(m_aStates.top().aShape.nHoriOrientRelationToken));
-        if (m_aStates.top().aShape.nLeft != 0)
+                                new RTFValue(m_aStates.top().aShape.getHoriOrientRelationToken()));
+        if (m_aStates.top().aShape.getLeft() != 0)
         {
             Mapper().positionOffset(
-                OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.nLeft)),
+                OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.getLeft())),
                 /*bVertical=*/false);
             aPoshSprms.set(NS_ooxml::LN_CT_PosH_posOffset, new RTFValue());
         }
@@ -1115,13 +1115,13 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
 
         RTFSprms aPosvAttributes;
         RTFSprms aPosvSprms;
-        if (m_aStates.top().aShape.nVertOrientRelationToken > 0)
+        if (m_aStates.top().aShape.getVertOrientRelationToken() > 0)
             aPosvAttributes.set(NS_ooxml::LN_CT_PosV_relativeFrom,
-                                new RTFValue(m_aStates.top().aShape.nVertOrientRelationToken));
-        if (m_aStates.top().aShape.nTop != 0)
+                                new RTFValue(m_aStates.top().aShape.getVertOrientRelationToken()));
+        if (m_aStates.top().aShape.getTop() != 0)
         {
             Mapper().positionOffset(
-                OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.nTop)),
+                OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.getTop())),
                 /*bVertical=*/true);
             aPosvSprms.set(NS_ooxml::LN_CT_PosV_posOffset, new RTFValue());
         }
@@ -1131,7 +1131,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
         aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_docPr, pDocprValue);
         aAnchorSprms.set(NS_ooxml::LN_graphic_graphic, pGraphicValue);
         // anchor sprm
-        auto pValue = new RTFValue(m_aStates.top().aShape.aAnchorAttributes, aAnchorSprms);
+        auto pValue = new RTFValue(m_aStates.top().aShape.getAnchorAttributes(), aAnchorSprms);
         aSprms.set(NS_ooxml::LN_anchor_anchor, pValue);
     }
     writerfilter::Reference<Properties>::Pointer_t pProperties
@@ -2251,23 +2251,24 @@ RTFError RTFDocumentImpl::popState()
         case Destination::SHAPEPROPERTYNAME:
             if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
                 break; // not for nested group
-            aState.aShape.aProperties.emplace_back(
+            aState.aShape.getProperties().emplace_back(
                 m_aStates.top().pDestinationText->makeStringAndClear(), OUString());
             break;
         case Destination::SHAPEPROPERTYVALUE:
-            if (!aState.aShape.aProperties.empty())
+            if (!aState.aShape.getProperties().empty())
             {
-                aState.aShape.aProperties.back().second
+                aState.aShape.getProperties().back().second
                     = m_aStates.top().pDestinationText->makeStringAndClear();
                 if (m_aStates.top().bHadShapeText)
-                    m_pSdrImport->append(aState.aShape.aProperties.back().first,
-                                         aState.aShape.aProperties.back().second);
+                    m_pSdrImport->append(aState.aShape.getProperties().back().first,
+                                         aState.aShape.getProperties().back().second);
                 else if (aState.bInShapeGroup && !aState.bInShape
-                         && aState.aShape.aProperties.back().first == "rotation")
+                         && aState.aShape.getProperties().back().first == "rotation")
                 {
                     // Rotation should be applied on the groupshape itself, not on each shape.
-                    aState.aShape.aGroupProperties.push_back(aState.aShape.aProperties.back());
-                    aState.aShape.aProperties.pop_back();
+                    aState.aShape.getGroupProperties().push_back(
+                        aState.aShape.getProperties().back());
+                    aState.aShape.getProperties().pop_back();
                 }
             }
             break;
@@ -2303,7 +2304,7 @@ RTFError RTFDocumentImpl::popState()
                         if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapNone
                             || rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight)
                         {
-                            m_aStates.top().aShape.aWrapSprm = rCharacterSprm;
+                            m_aStates.top().aShape.getWrapSprm() = rCharacterSprm;
                             break;
                         }
                     }
@@ -2315,9 +2316,9 @@ RTFError RTFDocumentImpl::popState()
             else if (aState.bInShapeGroup && !aState.bInShape)
             {
                 // End of a groupshape, as we're in shapegroup, but not in a real shape.
-                for (auto& rGroupProperty : aState.aShape.aGroupProperties)
+                for (auto& rGroupProperty : aState.aShape.getGroupProperties())
                     m_pSdrImport->appendGroupProperty(rGroupProperty.first, rGroupProperty.second);
-                aState.aShape.aGroupProperties.clear();
+                aState.aShape.getGroupProperties().clear();
             }
             break;
         case Destination::BOOKMARKSTART:
@@ -2656,15 +2657,15 @@ RTFError RTFDocumentImpl::popState()
                 if (bTextFrame)
                 {
                     xPropertySet->setPropertyValue("HoriOrientPosition",
-                                                   uno::makeAny(rDrawing.nLeft));
+                                                   uno::makeAny(rDrawing.getLeft()));
                     xPropertySet->setPropertyValue("VertOrientPosition",
-                                                   uno::makeAny(rDrawing.nTop));
+                                                   uno::makeAny(rDrawing.getTop()));
                 }
                 else
                 {
-                    xShape->setPosition(awt::Point(rDrawing.nLeft, rDrawing.nTop));
+                    xShape->setPosition(awt::Point(rDrawing.getLeft(), rDrawing.getTop()));
                 }
-                xShape->setSize(awt::Size(rDrawing.nRight, rDrawing.nBottom));
+                xShape->setSize(awt::Size(rDrawing.getRight(), rDrawing.getBottom()));
 
                 if (rDrawing.bHasLineColor)
                 {
@@ -3329,14 +3330,14 @@ RTFError RTFDocumentImpl::popState()
 
                 // It's allowed to declare these inside the shape text, and they
                 // are expected to have an effect for the whole shape.
-                if (aState.aDrawingObject.nLeft)
-                    m_aStates.top().aDrawingObject.nLeft = aState.aDrawingObject.nLeft;
-                if (aState.aDrawingObject.nTop)
-                    m_aStates.top().aDrawingObject.nTop = aState.aDrawingObject.nTop;
-                if (aState.aDrawingObject.nRight)
-                    m_aStates.top().aDrawingObject.nRight = aState.aDrawingObject.nRight;
-                if (aState.aDrawingObject.nBottom)
-                    m_aStates.top().aDrawingObject.nBottom = aState.aDrawingObject.nBottom;
+                if (aState.aDrawingObject.getLeft())
+                    m_aStates.top().aDrawingObject.setLeft(aState.aDrawingObject.getLeft());
+                if (aState.aDrawingObject.getTop())
+                    m_aStates.top().aDrawingObject.setTop(aState.aDrawingObject.getTop());
+                if (aState.aDrawingObject.getRight())
+                    m_aStates.top().aDrawingObject.setRight(aState.aDrawingObject.getRight());
+                if (aState.aDrawingObject.getBottom())
+                    m_aStates.top().aDrawingObject.setBottom(aState.aDrawingObject.getBottom());
             }
             break;
         case Destination::PROPNAME:
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 9ef52152018a..cc3deeab5461 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -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.
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index ee3d24e3b878..8c8aeb8c6405 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -284,10 +284,10 @@ int RTFSdrImport::initShape(uno::Reference<drawing::XShape>& o_xShape,
     // first, find the shape type
     int nType = -1;
     auto iter = std::find_if(
-        rShape.aProperties.begin(), rShape.aProperties.end(),
+        rShape.getProperties().begin(), rShape.getProperties().end(),
         [](std::pair<OUString, OUString> aProperty) { return aProperty.first == "shapeType"; });
 
-    if (iter == rShape.aProperties.end())
+    if (iter == rShape.getProperties().end())
     {
         if (SHAPE == shapeOrPict)
         {
@@ -391,7 +391,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
     bool bCustom(false);
     int const nType = initShape(xShape, xPropertySet, bCustom, rShape, bClose, shapeOrPict);
 
-    for (auto& rProperty : rShape.aProperties)
+    for (auto& rProperty : rShape.getProperties())
     {
         if (rProperty.first == "shapeType")
         {
@@ -567,7 +567,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
         else if (rProperty.first == "dhgt")
         {
             // dhgt is Word 2007, \shpz is Word 97-2003, the later has priority.
-            if (!rShape.oZ)
+            if (!rShape.hasZ())
                 resolveDhgt(xPropertySet, rProperty.second.toInt32(), /*bOldStyle=*/false);
         }
         // These are in EMU, convert to mm100.
@@ -598,8 +598,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
         else if (rProperty.first == "dxWrapDistLeft")
         {
             if (m_bTextGraphicObject)
-                rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distL,
-                                             new RTFValue(rProperty.second.toInt32()));
+                rShape.getAnchorAttributes().set(NS_ooxml::LN_CT_Anchor_distL,
+                                                 new RTFValue(rProperty.second.toInt32()));
             else if (xPropertySet.is())
                 xPropertySet->setPropertyValue("LeftMargin",
                                                uno::makeAny(rProperty.second.toInt32() / 360));
@@ -607,8 +607,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
         else if (rProperty.first == "dyWrapDistTop")
         {
             if (m_bTextGraphicObject)
-                rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distT,
-                                             new RTFValue(rProperty.second.toInt32()));
+                rShape.getAnchorAttributes().set(NS_ooxml::LN_CT_Anchor_distT,
+                                                 new RTFValue(rProperty.second.toInt32()));
             else if (xPropertySet.is())
                 xPropertySet->setPropertyValue("TopMargin",
                                                uno::makeAny(rProperty.second.toInt32() / 360));
@@ -616,8 +616,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
         else if (rProperty.first == "dxWrapDistRight")
         {
             if (m_bTextGraphicObject)
-                rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distR,
-                                             new RTFValue(rProperty.second.toInt32()));
+                rShape.getAnchorAttributes().set(NS_ooxml::LN_CT_Anchor_distR,
+                                                 new RTFValue(rProperty.second.toInt32()));
             else if (xPropertySet.is())
                 xPropertySet->setPropertyValue("RightMargin",
                                                uno::makeAny(rProperty.second.toInt32() / 360));
@@ -625,8 +625,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
         else if (rProperty.first == "dyWrapDistBottom")
         {
             if (m_bTextGraphicObject)
-                rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distB,
-                                             new RTFValue(rProperty.second.toInt32()));
+                rShape.getAnchorAttributes().set(NS_ooxml::LN_CT_Anchor_distB,
+                                                 new RTFValue(rProperty.second.toInt32()));
             else if (xPropertySet.is())
                 xPropertySet->setPropertyValue("BottomMargin",
                                                uno::makeAny(rProperty.second.toInt32() / 360));
@@ -667,7 +667,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
             switch (rProperty.second.toInt32())
             {
                 case 1:
-                    rShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME;
+                    rShape.setHoriOrientRelation(text::RelOrientation::PAGE_FRAME);
                     break;
                 default:
                     break;
@@ -678,7 +678,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
             switch (rProperty.second.toInt32())
             {
                 case 1:
-                    rShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME;
+                    rShape.setVertOrientRelation(text::RelOrientation::PAGE_FRAME);
                     break;
                 default:
                     break;
@@ -774,13 +774,13 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
         {
             // horizontal rule height
             sal_uInt32 const nHeight(convertTwipToMm100(rProperty.second.toInt32()));
-            rShape.nBottom = rShape.nTop + nHeight;
+            rShape.setBottom(rShape.getTop() + nHeight);
         }
         else if (rProperty.first == "dxWidthHR")
         {
             // horizontal rule width
             sal_uInt32 const nWidth(convertTwipToMm100(rProperty.second.toInt32()));
-            rShape.nRight = rShape.nLeft + nWidth;
+            rShape.setRight(rShape.getLeft() + nWidth);
         }
         else if (rProperty.first == "alignHR")
         {
@@ -830,7 +830,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
                                       new RTFValue(aPathAttributes), RTFOverwrite::NO_APPEND);
                 }
             } while (nCharIndex >= 0);
-            rShape.aWrapPolygonSprms = aPolygonSprms;
+            rShape.getWrapPolygonSprms() = aPolygonSprms;
         }
         else if (rProperty.first == "fRelFlipV")
             obRelFlipV = rProperty.second.toInt32() == 1;
@@ -846,10 +846,10 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
     if (xPropertySet.is())
     {
         resolveLineColorAndWidth(m_bTextFrame, xPropertySet, aLineColor, aLineWidth);
-        if (rShape.oZ)
+        if (rShape.hasZ())
         {
             bool bOldStyle = m_aParents.size() > 1;
-            resolveDhgt(xPropertySet, *rShape.oZ, bOldStyle);
+            resolveDhgt(xPropertySet, rShape.getZ(), bOldStyle);
         }
         if (m_bTextFrame)
             // Writer textframes implement text::WritingMode2, which is a different data type.
@@ -974,8 +974,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
     // Set position and size
     if (xShape.is())
     {
-        sal_Int32 nLeft = rShape.nLeft;
-        sal_Int32 nTop = rShape.nTop;
+        sal_Int32 nLeft = rShape.getLeft();
+        sal_Int32 nTop = rShape.getTop();
 
         bool bInShapeGroup = oGroupLeft && oGroupTop && oGroupRight && oGroupBottom && oRelLeft
                              && oRelTop && oRelRight && oRelBottom;
@@ -983,14 +983,15 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
         if (bInShapeGroup)
         {
             // See lclGetAbsPoint() in the VML import: rShape is the group shape, oGroup is its coordinate system, oRel is the relative child shape.
-            sal_Int32 nShapeWidth = rShape.nRight - rShape.nLeft;
-            sal_Int32 nShapeHeight = rShape.nBottom - rShape.nTop;
+            sal_Int32 nShapeWidth = rShape.getRight() - rShape.getLeft();
+            sal_Int32 nShapeHeight = rShape.getBottom() - rShape.getTop();
             sal_Int32 nCoordSysWidth = *oGroupRight - *oGroupLeft;
             sal_Int32 nCoordSysHeight = *oGroupBottom - *oGroupTop;
             double fWidthRatio = static_cast<double>(nShapeWidth) / nCoordSysWidth;
             double fHeightRatio = static_cast<double>(nShapeHeight) / nCoordSysHeight;
-            nLeft = static_cast<sal_Int32>(rShape.nLeft + fWidthRatio * (*oRelLeft - *oGroupLeft));
-            nTop = static_cast<sal_Int32>(rShape.nTop + fHeightRatio * (*oRelTop - *oGroupTop));
+            nLeft = static_cast<sal_Int32>(rShape.getLeft()
+                                           + fWidthRatio * (*oRelLeft - *oGroupLeft));
+            nTop = static_cast<sal_Int32>(rShape.getTop() + fHeightRatio * (*oRelTop - *oGroupTop));
 
             // See lclGetAbsRect() in the VML import.
             aSize.Width = std::lround(fWidthRatio * (*oRelRight - *oRelLeft));
@@ -1008,7 +1009,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
         if (bInShapeGroup)
             xShape->setSize(aSize);
         else
-            xShape->setSize(awt::Size(rShape.nRight - rShape.nLeft, rShape.nBottom - rShape.nTop));
+            xShape->setSize(awt::Size(rShape.getRight() - rShape.getLeft(),
+                                      rShape.getBottom() - rShape.getTop()));
 
         if (obFlipH == true || obFlipV == true)
         {
@@ -1028,14 +1030,14 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
             }
         }
 
-        if (rShape.nHoriOrientRelation != 0)
+        if (rShape.getHoriOrientRelation() != 0)
             xPropertySet->setPropertyValue("HoriOrientRelation",
-                                           uno::makeAny(rShape.nHoriOrientRelation));
-        if (rShape.nVertOrientRelation != 0)
+                                           uno::makeAny(rShape.getHoriOrientRelation()));
+        if (rShape.getVertOrientRelation() != 0)
             xPropertySet->setPropertyValue("VertOrientRelation",
-                                           uno::makeAny(rShape.nVertOrientRelation));
-        if (rShape.nWrap != text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE)
-            xPropertySet->setPropertyValue("Surround", uno::makeAny(rShape.nWrap));
+                                           uno::makeAny(rShape.getVertOrientRelation()));
+        if (rShape.getWrap() != text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE)
+            xPropertySet->setPropertyValue("Surround", uno::makeAny(rShape.getWrap()));
         oox::ModelObjectHelper aModelObjectHelper(m_rImport.getModelFactory());
         if (aFillModel.moType.has())
         {


More information about the Libreoffice-commits mailing list