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

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Feb 3 13:20:47 PST 2014


 chart2/source/view/inc/DummyXShape.hxx  |    5 +++
 chart2/source/view/main/DummyXShape.cxx |   52 ++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

New commits:
commit 30f8d566bb11d2b514af0c449d00683a445505d8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 3 22:17:48 2014 +0100

    improve diagram rendering
    
    Size and positioning look much better right now.
    
    Change-Id: I3422087967af1231e9e9fbaf87f1c7c2db25958a

diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
index eae679b..4ce530a 100644
--- a/chart2/source/view/inc/DummyXShape.hxx
+++ b/chart2/source/view/inc/DummyXShape.hxx
@@ -417,6 +417,11 @@ class DummyGroup2D : public DummyXShapes
 {
 public:
     DummyGroup2D(const OUString& rName);
+
+    virtual ::com::sun::star::awt::Point SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw(::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw(::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
 };
 
 class DummyGroup3D : public DummyXShapes
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 003afd2..9e957d2 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -805,6 +805,58 @@ DummyGroup2D::DummyGroup2D(const OUString& rName)
     setName(rName);
 }
 
+awt::Point DummyGroup2D::getPosition()
+    throw(uno::RuntimeException)
+{
+    long nTop = std::numeric_limits<long>::max();
+    long nLeft = std::numeric_limits<long>::max();
+    for(std::vector<DummyXShape*>::iterator itr = maShapes.begin(),
+            itrEnd = maShapes.end(); itr != itrEnd; ++itr)
+    {
+        awt::Point aPoint = (*itr)->getPosition();
+        if(aPoint.X >= 0 && aPoint.Y >= 0)
+        {
+            nLeft = std::min<long>(nLeft, aPoint.X);
+            nTop = std::min<long>(nTop, aPoint.Y);
+        }
+    }
+
+    return awt::Point(nTop, nLeft);
+}
+
+awt::Size DummyGroup2D::getSize()
+    throw(uno::RuntimeException)
+{
+    long nTop = std::numeric_limits<long>::max();
+    long nLeft = std::numeric_limits<long>::max();
+    long nBottom = 0;
+    long nRight = 0;
+    for(std::vector<DummyXShape*>::iterator itr = maShapes.begin(),
+            itrEnd = maShapes.end(); itr != itrEnd; ++itr)
+    {
+        awt::Point aPoint = (*itr)->getPosition();
+        nLeft = std::min<long>(nLeft, aPoint.X);
+        nTop = std::min<long>(nTop, aPoint.Y);
+        awt::Size aSize = (*itr)->getSize();
+        nRight = std::max<long>(nRight, aPoint.X + aSize.Width);
+        nBottom = std::max<long>(nBottom, aPoint.Y + aSize.Height);
+    }
+
+    return awt::Size(nRight - nLeft, nBottom - nTop);
+}
+
+void DummyGroup2D::setPosition( const awt::Point& )
+    throw(uno::RuntimeException)
+{
+    SAL_WARN("chart2.opengl", "set position on group shape");
+}
+
+void DummyGroup2D::setSize( const awt::Size& )
+    throw( beans::PropertyVetoException, uno::RuntimeException )
+{
+    SAL_WARN("chart2.opengl", "set size on group shape");
+}
+
 DummyGraphic2D::DummyGraphic2D(const drawing::Position3D& rPos, const drawing::Direction3D& rSize,
         const uno::Reference< graphic::XGraphic > xGraphic ):
     mxGraphic(xGraphic)


More information about the Libreoffice-commits mailing list