diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-02-16 02:53:17 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-02-16 02:54:13 +0100 |
commit | 24f51d315cd75715cb57709a86c7470c42dbb595 (patch) | |
tree | 5c7512d722dbaf22a662f31bd65f4aeb3cd2b563 /chart2 | |
parent | improve bubble positioning (diff) | |
download | core-24f51d315cd75715cb57709a86c7470c42dbb595.tar.gz core-24f51d315cd75715cb57709a86c7470c42dbb595.zip |
text position for legend improvements
Change-Id: I06d8baf8cfe59999cd6b417fc6e70c1bd6eede27
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/inc/DummyXShape.hxx | 7 | ||||
-rw-r--r-- | chart2/source/view/main/DummyXShape.cxx | 49 | ||||
-rw-r--r-- | chart2/source/view/main/OpenglShapeFactory.cxx | 2 |
3 files changed, 52 insertions, 6 deletions
diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx index 3a9dccbbfcba..45f6dc408625 100644 --- a/chart2/source/view/inc/DummyXShape.hxx +++ b/chart2/source/view/inc/DummyXShape.hxx @@ -332,13 +332,18 @@ class DummyText : public DummyXShape { public: DummyText(const OUString& rText, const tNameSequence& rNames, - const tAnySequence& rValues, const uno::Any& rTrans ); + const tAnySequence& rValues, const uno::Any& rTrans, com::sun::star::uno::Reference< + com::sun::star::drawing::XShapes > xTarget); virtual void render() SAL_OVERRIDE; virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw(::com::sun::star::uno::RuntimeException); + private: + void setTransformatAsProperty(const com::sun::star::drawing::HomogenMatrix3& rMatrix); + OUString maText; uno::Any maTrans; BitmapEx maBitmap; diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 478226ccdfbc..134d6cc64d33 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -714,7 +714,7 @@ private: } DummyText::DummyText(const OUString& rText, const tNameSequence& rNames, - const tAnySequence& rValues, const uno::Any& rTrans ): + const tAnySequence& rValues, const uno::Any& rTrans, uno::Reference< drawing::XShapes > xTarget ): maText(rText), maTrans(rTrans) { @@ -744,12 +744,25 @@ DummyText::DummyText(const OUString& rText, const tNameSequence& rNames, setPosition(awt::Point(aTrans.Line1.Column3, aTrans.Line2.Column3)); aTrans.Line1.Column1 = 20 * bmpWidth; aTrans.Line2.Column2 = 20 * bmpHeight; - uno::Any aNewTrans; - aNewTrans <<= aTrans; - setPropertyValue("Transformation", aNewTrans); + setTransformatAsProperty(aTrans); } else + { setSize(awt::Size(20*bmpWidth, 20*bmpHeight)); + uno::Reference< drawing::XShape > xTargetShape(xTarget, uno::UNO_QUERY); + drawing::HomogenMatrix3 aTrans; + aTrans.Line1.Column1 = 20 * bmpWidth; + aTrans.Line2.Column2 = 20 * bmpHeight; + aTrans.Line3.Column3 = 1; + if(xTargetShape.is()) + { + const awt::Point rPoint = xTargetShape->getPosition(); + setPosition(rPoint); + aTrans.Line1.Column3 = rPoint.X; + aTrans.Line2.Column3 = rPoint.Y; + } + setTransformatAsProperty(aTrans); + } } void DummyText::render() @@ -788,6 +801,34 @@ void DummyText::setPropertyValue( const OUString& rName, const uno::Any& rValue) DummyXShape::setPropertyValue(rName, rValue); } +void DummyText::setPosition(const awt::Point& rPosition ) + throw(uno::RuntimeException) +{ + DummyXShape::setPosition(rPosition); + if(maTrans.hasValue()) + return; + + std::map<OUString, uno::Any>::const_iterator itr = + maProperties.find("Transformation"); + if(itr != maProperties.end()) + { + if(itr->second.hasValue()) + { + drawing::HomogenMatrix3 aTrans = itr->second.get<drawing::HomogenMatrix3>(); + aTrans.Line1.Column3 = rPosition.X; + aTrans.Line2.Column3 = rPosition.Y; + setTransformatAsProperty(aTrans); + } + } +} + +void DummyText::setTransformatAsProperty(const drawing::HomogenMatrix3& rMatrix) +{ + uno::Any aNewTrans; + aNewTrans <<= rMatrix; + setPropertyValue("Transformation", aNewTrans); +} + DummyFormattedText::DummyFormattedText(uno::Sequence< uno::Reference< chart2::XFormattedString > >& rFormattedString): maFormattedString(rFormattedString) diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx index c2ae65db194e..5b19a5be6974 100644 --- a/chart2/source/view/main/OpenglShapeFactory.cxx +++ b/chart2/source/view/main/OpenglShapeFactory.cxx @@ -401,7 +401,7 @@ uno::Reference< drawing::XShape > , const uno::Any& rATransformation ) { dummy::DummyText* pText = new dummy::DummyText( rText, rPropNames, rPropValues, - rATransformation ); + rATransformation, xTarget ); xTarget->add(pText); return pText; } |