summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-02-03 22:17:48 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-02-03 22:20:19 +0100
commit30f8d566bb11d2b514af0c449d00683a445505d8 (patch)
treed2b4dff92c9426983a215914855bd6be13aed251
parent6f50837b5ee950776ddca9ceb78caed3015e8ccd (diff)
improve diagram rendering
Size and positioning look much better right now. Change-Id: I3422087967af1231e9e9fbaf87f1c7c2db25958a
-rw-r--r--chart2/source/view/inc/DummyXShape.hxx5
-rw-r--r--chart2/source/view/main/DummyXShape.cxx52
2 files changed, 57 insertions, 0 deletions
diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
index eae679b88678..4ce530a20e36 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 003afd24cf2f..9e957d21a725 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)