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

Grzegorz Araminowicz g.araminowicz at gmail.com
Thu Aug 17 13:23:34 UTC 2017


 oox/source/drawingml/diagram/datamodelcontext.cxx   |    3 -
 oox/source/drawingml/diagram/diagram.cxx            |   44 +++++++-------------
 oox/source/drawingml/diagram/diagram.hxx            |   16 +++----
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |    2 
 oox/source/drawingml/diagram/layoutatomvisitors.cxx |    4 -
 oox/source/drawingml/diagram/layoutnodecontext.cxx  |    8 ---
 6 files changed, 27 insertions(+), 50 deletions(-)

New commits:
commit 8e397fc58b63d08998b1ee8f1c05f1415b2eaf9f
Author: Grzegorz Araminowicz <g.araminowicz at gmail.com>
Date:   Thu Aug 17 09:52:17 2017 +0200

    SmartArt: simplify conditions, miscellaneous changes
    
    Change-Id: I70cc3548a68367b0a5f4cc5f55e55dc2db1e8b27
    Reviewed-on: https://gerrit.libreoffice.org/41239
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/oox/source/drawingml/diagram/datamodelcontext.cxx b/oox/source/drawingml/diagram/datamodelcontext.cxx
index 43d9bb547ecb..ce0608a666b3 100644
--- a/oox/source/drawingml/diagram/datamodelcontext.cxx
+++ b/oox/source/drawingml/diagram/datamodelcontext.cxx
@@ -55,8 +55,7 @@ public:
                     mrConnection.push_back( dgm::Connection() );
                     dgm::Connection& rConnection=mrConnection.back();
 
-                    const sal_Int32 nType = rAttribs.getToken( XML_type, XML_parOf );
-                    rConnection.mnType = nType;
+                    rConnection.mnType = rAttribs.getToken( XML_type, XML_parOf );
                     rConnection.msModelId = rAttribs.getString( XML_modelId ).get();
                     rConnection.msSourceId = rAttribs.getString( XML_srcId ).get();
                     rConnection.msDestId  = rAttribs.getString( XML_destId ).get();
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index 705a883e8fcd..2f33d9a79002 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -17,8 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <functional>
-
 #include <com/sun/star/awt/Point.hpp>
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/xml/dom/XDocument.hpp>
@@ -47,7 +45,7 @@ namespace oox { namespace drawingml {
 
 namespace dgm {
 
-void Connection::dump()
+void Connection::dump() const
 {
     SAL_INFO(
         "oox.drawingml",
@@ -57,7 +55,7 @@ void Connection::dump()
             << mnSourceOrder << ", dstOrd " << mnDestOrder);
 }
 
-void Point::dump()
+void Point::dump() const
 {
     SAL_INFO(
         "oox.drawingml",
@@ -82,27 +80,17 @@ const dgm::Point* DiagramData::getRootPoint() const
     return nullptr;
 }
 
-void DiagramData::dump()
+void DiagramData::dump() const
 {
     SAL_INFO("oox.drawingml", "Dgm: DiagramData # of cnx: " << maConnections.size() );
-    for (auto& rConnection : maConnections)
+    for (const auto& rConnection : maConnections)
         rConnection.dump();
 
     SAL_INFO("oox.drawingml", "Dgm: DiagramData # of pt: " << maPoints.size() );
-    for (auto& rPoint : maPoints)
+    for (const auto& rPoint : maPoints)
         rPoint.dump();
 }
 
-void Diagram::setData( const DiagramDataPtr & pData)
-{
-    mpData = pData;
-}
-
-void Diagram::setLayout( const DiagramLayoutPtr & pLayout)
-{
-    mpLayout = pLayout;
-}
-
 #ifdef DEBUG_OOX_DIAGRAM
 OString normalizeDotName( const OUString& rStr )
 {
@@ -135,12 +123,10 @@ static sal_Int32 calcDepth( const OUString& rNodeName,
             !aCurrCxn->msSibTransId.isEmpty() &&
             !aCurrCxn->msSourceId.isEmpty() &&
             !aCurrCxn->msDestId.isEmpty() &&
-            aCurrCxn->mnType != XML_presOf &&
-            aCurrCxn->mnType != XML_presParOf &&
+            aCurrCxn->mnType == XML_parOf &&
             rNodeName == aCurrCxn->msDestId )
         {
-            return calcDepth(aCurrCxn->msSourceId,
-                             rCnx) + 1;
+            return calcDepth(aCurrCxn->msSourceId, rCnx) + 1;
         }
         ++aCurrCxn;
     }
@@ -351,7 +337,7 @@ uno::Sequence<beans::PropertyValue> Diagram::getDomsAsPropertyValues() const
 {
     sal_Int32 length = maMainDomMap.size();
 
-    if ( 0 < maDataRelsMap.getLength() )
+    if (maDataRelsMap.hasElements())
         ++length;
 
     uno::Sequence<beans::PropertyValue> aValue(length);
@@ -360,15 +346,15 @@ uno::Sequence<beans::PropertyValue> Diagram::getDomsAsPropertyValues() const
          i != maMainDomMap.end();
          ++i)
     {
-        pValue[0].Name = i->first;
-        pValue[0].Value <<= i->second;
+        pValue->Name = i->first;
+        pValue->Value <<= i->second;
         ++pValue;
     }
 
-    if ( 0 < maDataRelsMap.getLength() )
+    if (maDataRelsMap.hasElements())
     {
-        pValue[0].Name = "OOXDiagramDataRels";
-        pValue[0].Value <<= maDataRelsMap;
+        pValue->Name = "OOXDiagramDataRels";
+        pValue->Value <<= maDataRelsMap;
         ++pValue;
     }
 
@@ -471,7 +457,9 @@ void loadDiagram( ShapePtr const & pShape,
                     pDiagram,
                     xRefQStyle);
         }
-    } else {
+    }
+    else
+    {
         // We still want to add the XDocuments to the DiagramDomMap
         DiagramDomMap& rMainDomMap = pDiagram->getDomMap();
         rMainDomMap[OUString("OOXLayout")] = loadFragment(rFilter,rLayoutPath);
diff --git a/oox/source/drawingml/diagram/diagram.hxx b/oox/source/drawingml/diagram/diagram.hxx
index 28db882b5f73..f31757f6ad91 100644
--- a/oox/source/drawingml/diagram/diagram.hxx
+++ b/oox/source/drawingml/diagram/diagram.hxx
@@ -48,7 +48,7 @@ struct Connection
         mnDestOrder( 0 )
     {}
 
-    void dump();
+    void dump() const;
 
     sal_Int32 mnType;
     OUString msModelId;
@@ -97,7 +97,7 @@ struct Point
         mbCustomText(false),
         mbIsPlaceholder(false)
     {}
-    void dump();
+    void dump() const;
 
     ShapePtr      mpShape;
 
@@ -182,7 +182,7 @@ public:
     ::std::vector<OUString> &getExtDrawings()
         { return maExtDrawings; }
     const dgm::Point* getRootPoint() const;
-    void dump();
+    void dump() const;
 private:
     FillPropertiesPtr mpFillProperties;
     dgm::Connections  maConnections;
@@ -267,12 +267,12 @@ typedef std::map<OUString,DiagramColor> DiagramColorMap;
 class Diagram
 {
 public:
-    void setData( const DiagramDataPtr & );
+    void setData( const DiagramDataPtr & pData )
+        { mpData = pData; }
     const DiagramDataPtr& getData() const
-        {
-            return mpData;
-        }
-    void setLayout( const DiagramLayoutPtr & );
+        { return mpData; }
+    void setLayout( const DiagramLayoutPtr & pLayout )
+        { mpLayout = pLayout; }
 
     DiagramQStyleMap& getStyles() { return maStyles; }
     const DiagramQStyleMap& getStyles() const { return maStyles; }
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 8d690836b4b3..07d018736c83 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -19,8 +19,6 @@
 
 #include "diagramlayoutatoms.hxx"
 
-#include <functional>
-
 #include <basegfx/numeric/ftools.hxx>
 
 #include "oox/helper/attributelist.hxx"
diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
index b9100241cc00..378f4cad2f44 100755
--- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx
+++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
@@ -19,10 +19,6 @@
 
 #include "layoutatomvisitors.hxx"
 
-#include <functional>
-
-#include <basegfx/numeric/ftools.hxx>
-
 #include "drawingml/customshapeproperties.hxx"
 
 using namespace ::com::sun::star;
diff --git a/oox/source/drawingml/diagram/layoutnodecontext.cxx b/oox/source/drawingml/diagram/layoutnodecontext.cxx
index 57689958ae49..ca41a568781b 100644
--- a/oox/source/drawingml/diagram/layoutnodecontext.cxx
+++ b/oox/source/drawingml/diagram/layoutnodecontext.cxx
@@ -297,12 +297,8 @@ LayoutNodeContext::onCreateContext( ::sal_Int32 aElement,
     {
         // CT_PresentationOf
         // TODO
-        rAttribs.getString( XML_axis );
-        rAttribs.getString( XML_cnt );
-        rAttribs.getString( XML_hideLastTrans );
-        rAttribs.getString( XML_ptType );
-        rAttribs.getString( XML_st );
-        rAttribs.getString( XML_step );
+        IteratorAttr aIterator;
+        aIterator.loadFromXAttr(rAttribs.getFastAttributeList());
         break;
     }
     case DGM_TOKEN( ruleLst ):


More information about the Libreoffice-commits mailing list