diff options
author | Ingrid Halama <iha@openoffice.org> | 2003-12-17 14:52:00 +0000 |
---|---|---|
committer | Ingrid Halama <iha@openoffice.org> | 2003-12-17 14:52:00 +0000 |
commit | 13b820d9b46c55871737e385c23629379993c363 (patch) | |
tree | bfe2ffceefebb1c8b32fae99da8bfc3a0b2e0ff6 /chart2 | |
parent | b3b43be06c28220b01f0f786d22526747273c264 (diff) |
added parameter LabelAlignment for data point label creation
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 34 | ||||
-rw-r--r-- | chart2/source/view/inc/VSeriesPlotter.hxx | 9 |
2 files changed, 39 insertions, 4 deletions
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index b885958032b3..6598af37b12e 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -41,6 +41,13 @@ #include <algorithm> +#ifndef _COM_SUN_STAR_DRAWING_TEXTVERTICALADJUST_HPP_ +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#endif +#ifndef _COM_SUN_STAR_DRAWING_TEXTHORIZONTALADJUST_HPP_ +#include <com/sun/star/drawing/TextHorizontalAdjust.hpp> +#endif + //............................................................................. namespace chart { @@ -300,7 +307,8 @@ void VSeriesPlotter::createDataLabel( const uno::Reference< drawing::XShapes >& , sal_Int32 nPointIndex , double fValue , double fSumValue - , const awt::Point& rScreenPosition2D ) + , const awt::Point& rScreenPosition2D + , LabelAlignment eAlignment ) { uno::Reference< drawing::XShapes > xTarget_( this->getLabelsGroupShape(rDataSeries, xTarget) ); @@ -357,6 +365,30 @@ void VSeriesPlotter::createDataLabel( const uno::Reference< drawing::XShapes >& rtl::OUString aCID = ObjectIdentifier::createPointCID( rDataSeries.getLabelCID_Stub(),nPointIndex ); *pCIDAny = uno::makeAny(aCID); } + + //HorizontalAdjustment + { + drawing::TextHorizontalAdjust eHorizontalAdjust = drawing::TextHorizontalAdjust_CENTER; + if( LABEL_ALIGN_RIGHT==eAlignment ) + eHorizontalAdjust = drawing::TextHorizontalAdjust_LEFT; + else if( LABEL_ALIGN_LEFT==eAlignment ) + eHorizontalAdjust = drawing::TextHorizontalAdjust_RIGHT; + uno::Any* pHorizontalAdjustAny = PropertyMapper::getValuePointer(*pPropValues,*pPropNames,C2U("TextHorizontalAdjust")); + if(pHorizontalAdjustAny) + *pHorizontalAdjustAny = uno::makeAny(eHorizontalAdjust); + } + + //VerticalAdjustment + { + drawing::TextVerticalAdjust eVerticalAdjust = drawing::TextVerticalAdjust_CENTER; + if( LABEL_ALIGN_TOP==eAlignment ) + eVerticalAdjust = drawing::TextVerticalAdjust_BOTTOM; + else if( LABEL_ALIGN_BOTTOM==eAlignment ) + eVerticalAdjust = drawing::TextVerticalAdjust_TOP; + uno::Any* pVerticalAdjustAny = PropertyMapper::getValuePointer(*pPropValues,*pPropNames,C2U("TextVerticalAdjust")); + if(pVerticalAdjustAny) + *pVerticalAdjustAny = uno::makeAny(eVerticalAdjust); + } //------------------------------------------------ //create text shape diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index b1be9e904776..eb0a3c92ce4e 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -2,9 +2,9 @@ * * $RCSfile: VSeriesPlotter.hxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: iha $ $Date: 2003-12-17 14:28:02 $ + * last change: $Author: iha $ $Date: 2003-12-17 15:50:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -131,6 +131,8 @@ private: sal_Int32 m_nMaxPointCount; }; +enum LabelAlignment { LABEL_ALIGN_CENTER, LABEL_ALIGN_LEFT, LABEL_ALIGN_TOP, LABEL_ALIGN_RIGHT, LABEL_ALIGN_BOTTOM }; + class VSeriesPlotter : public PlotterBase, public MinimumAndMaximumSupplier { //------------------------------------------------------------------------- @@ -227,7 +229,8 @@ protected: //methods , sal_Int32 nPointIndex , double fValue , double fSumValue - , const ::com::sun::star::awt::Point& rScreenPosition2D ); + , const ::com::sun::star::awt::Point& rScreenPosition2D + , LabelAlignment eAlignment=LABEL_ALIGN_CENTER ); /** creates two T-shaped error bars in both directions (up/down or left/right depending on the bVertical parameter) |