summaryrefslogtreecommitdiff
path: root/chart2/source/view/axes
diff options
context:
space:
mode:
authorIngrid Halama <iha@openoffice.org>2004-01-17 12:10:08 +0000
committerIngrid Halama <iha@openoffice.org>2004-01-17 12:10:08 +0000
commitb064ca8aa953835e683f3e4679b08c37fc48507d (patch)
treef30b96e3d9039e482432f3e1aa7b8432cd632bfb /chart2/source/view/axes
parent8fb7f58276fd9541f6e17da81965648c8af5519f (diff)
introduced polarcoordinate system + axis + grids + some cleanup
Diffstat (limited to 'chart2/source/view/axes')
-rw-r--r--chart2/source/view/axes/VAxisProperties.cxx106
-rw-r--r--chart2/source/view/axes/VAxisProperties.hxx191
-rw-r--r--chart2/source/view/axes/VCartesianAxis.cxx1143
-rw-r--r--chart2/source/view/axes/VCartesianAxis.hxx129
-rw-r--r--chart2/source/view/axes/VCartesianCoordinateSystem.cxx133
-rw-r--r--chart2/source/view/axes/VCartesianCoordinateSystem.hxx91
-rw-r--r--chart2/source/view/axes/VCartesianGrid.cxx318
-rw-r--r--chart2/source/view/axes/VCartesianGrid.hxx100
-rw-r--r--chart2/source/view/axes/VCoordinateSystem.cxx128
-rw-r--r--chart2/source/view/axes/VPolarAxis.cxx360
-rw-r--r--chart2/source/view/axes/VPolarAxis.hxx103
-rw-r--r--chart2/source/view/axes/VPolarCoordinateSystem.cxx154
-rw-r--r--chart2/source/view/axes/VPolarCoordinateSystem.hxx91
-rw-r--r--chart2/source/view/axes/VPolarGrid.cxx303
-rw-r--r--chart2/source/view/axes/VPolarGrid.hxx130
-rw-r--r--chart2/source/view/axes/makefile.mk14
16 files changed, 3348 insertions, 146 deletions
diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx
index 943a35a3694b..63adbf2d46cc 100644
--- a/chart2/source/view/axes/VAxisProperties.cxx
+++ b/chart2/source/view/axes/VAxisProperties.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: VAxisProperties.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: iha $ $Date: 2003-11-19 16:39:12 $
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -201,7 +201,6 @@ AxisProperties::AxisProperties()
, m_nMinorTickmarks(1)
, m_aTickmarkPropertiesList()
, m_aLineProperties()
- , m_bTESTTEST_HorizontalAdjustmentIsLeft(true)
{
}
@@ -217,7 +216,6 @@ AxisProperties::AxisProperties( const AxisProperties& rAxisProperties )
, m_nMinorTickmarks( rAxisProperties.m_nMinorTickmarks )
, m_aTickmarkPropertiesList( rAxisProperties.m_aTickmarkPropertiesList )
, m_aLineProperties( rAxisProperties.m_aLineProperties )
- , m_bTESTTEST_HorizontalAdjustmentIsLeft( rAxisProperties.m_bTESTTEST_HorizontalAdjustmentIsLeft )
{
if( rAxisProperties.m_pfMainLinePositionAtOtherAxis )
m_pfMainLinePositionAtOtherAxis = new double(*rAxisProperties.m_pfMainLinePositionAtOtherAxis);
@@ -271,62 +269,6 @@ void AxisProperties::init()
}
}
-sal_Int32 getAxisScreenPosition( double fCrossOtherAxis
- , const PlottingPositionHelper& rPosHelper, bool bIsYAxis )
-{
- double fX = bIsYAxis ? fCrossOtherAxis : rPosHelper.getLogicMinX();
- double fY = bIsYAxis ? rPosHelper.getLogicMinY() : fCrossOtherAxis;
-
- rPosHelper.clipLogicValues( &fX,&fY,0 );
- rPosHelper.doLogicScaling( &fX,&fY,0 );
- drawing::Position3D aPos( fX, fY, 0);
-
- uno::Reference< XTransformation > xTransformation =
- rPosHelper.getTransformationLogicToScene();
- uno::Sequence< double > aSeq =
- xTransformation->transform( Position3DToSequence(aPos) );
-
- return static_cast<sal_Int32>(
- bIsYAxis ? aSeq[0] : aSeq[1] );
-}
-
-
-
-sal_Int32 AxisProperties::getMainLineScreenPosition(
- const PlottingPositionHelper& rPosHelper ) const
-{
- double fMin = m_bIsYAxis ? rPosHelper.getLogicMinX() : rPosHelper.getLogicMinY();
- double fMax = m_bIsYAxis ? rPosHelper.getLogicMaxX() : rPosHelper.getLogicMaxY();
-
- double fCrossOtherAxis;
- if(m_pfMainLinePositionAtOtherAxis)
- fCrossOtherAxis = *m_pfMainLinePositionAtOtherAxis;
- else
- {
- bool bMinimumForLeftAxis = ( m_bIsYAxis && rPosHelper.isMathematicalOrientationY() )
- || ( !m_bIsYAxis && rPosHelper.isMathematicalOrientationX() );
- fCrossOtherAxis = ( bMinimumForLeftAxis && m_bIsLeftOrBottomAxis ) ? fMin : fMax;
- }
- sal_Int32 nRet = getAxisScreenPosition( fCrossOtherAxis, rPosHelper, m_bIsYAxis );
- return nRet;
-}
-
-bool AxisProperties::getExtraLineScreenPosition(
- sal_Int32& rnExtraLineScreenPosition, const PlottingPositionHelper& rPosHelper ) const
-{
- if( !m_pfExrtaLinePositionAtOtherAxis )
- return false;
-
- double fMin = m_bIsYAxis ? rPosHelper.getLogicMinX() : rPosHelper.getLogicMinY();
- double fMax = m_bIsYAxis ? rPosHelper.getLogicMaxX() : rPosHelper.getLogicMaxY();
- if( *m_pfExrtaLinePositionAtOtherAxis <= fMin
- || *m_pfExrtaLinePositionAtOtherAxis >= fMax )
- return false;
- rnExtraLineScreenPosition = getAxisScreenPosition(
- *m_pfExrtaLinePositionAtOtherAxis, rPosHelper, m_bIsYAxis );
- return true;
-}
-
//-----------------------------------------------------------------------------
AxisLabelProperties::AxisLabelProperties()
@@ -425,50 +367,6 @@ sal_Bool AxisLabelProperties::getIsStaggered() const
return sal_False;
}
-//------------------------
-
-drawing::TextVerticalAdjust AxisProperties::getVerticalAdjustment() const
-{
- drawing::TextVerticalAdjust aRet =
- !m_bIsYAxis && !m_bIsLeftOrBottomAxis
- ? drawing::TextVerticalAdjust_BOTTOM
- : drawing::TextVerticalAdjust_TOP;
- return aRet;
-}
-
-sal_Int16 AxisProperties::getWritingMode()const
-{
- //@todo get this dependent on the locale ...
- sal_Int16 nWritingMode( text::WritingMode2::LR_TB );
- return nWritingMode;
-}
-
-drawing::TextHorizontalAdjust AxisProperties::getHorizontalAdjustment() const
-{
- return m_bTESTTEST_HorizontalAdjustmentIsLeft
- ? drawing::TextHorizontalAdjust_LEFT
- : drawing::TextHorizontalAdjust_RIGHT;
-//
-
- bool bIsYAxis = m_bIsYAxis;
- bool bIsLeftOrBottomAxis = m_bIsLeftOrBottomAxis;
- sal_Int16 nWritingMode = getWritingMode();
-
- switch( nWritingMode )
- {
- case text::WritingMode2::RL_TB:
- case text::WritingMode2::TB_RL:
- return bIsYAxis && !bIsLeftOrBottomAxis
- ? drawing::TextHorizontalAdjust_LEFT
- : drawing::TextHorizontalAdjust_RIGHT;
- case text::WritingMode2::TB_LR:
- default:
- return bIsYAxis && bIsLeftOrBottomAxis
- ? drawing::TextHorizontalAdjust_RIGHT
- : drawing::TextHorizontalAdjust_LEFT;
- }
-}
-
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/view/axes/VAxisProperties.hxx b/chart2/source/view/axes/VAxisProperties.hxx
new file mode 100644
index 000000000000..cfb51c6877bf
--- /dev/null
+++ b/chart2/source/view/axes/VAxisProperties.hxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * $RCSfile: VAxisProperties.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CHART2_VAXIS_PROPERTIES_HXX
+#define _CHART2_VAXIS_PROPERTIES_HXX
+
+#include "VLineProperties.hxx"
+#include "PlottingPositionHelper.hxx"
+
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_NUMBERFORMAT_HPP_
+#include <drafts/com/sun/star/chart2/NumberFormat.hpp>
+#endif
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XAXIS_HPP_
+#include <drafts/com/sun/star/chart2/XAxis.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_
+#include <com/sun/star/awt/Size.hpp>
+#endif
+#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
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+struct TickmarkProperties
+{
+ sal_Int32 RelativePos;//Position in screen values relative to the axis where the tickmark line starts
+ sal_Int32 Length;//Length of the tickmark line in screen values
+
+ VLineProperties aLineProperties;
+};
+
+//These properties describe how a couple of labels are arranged one to another.
+//The couple can contain all labels for all tickmark depth or just the labels for one single depth or
+//the labels from an coherent range of tick depths (e.g. the major and first minor tickmarks should be handled together).
+//... only allow side by side for different tick depth
+enum AxisLabelStaggering
+{
+ SIDE_BY_SIDE
+ , STAGGER_EVEN
+ , STAGGER_ODD
+ , STAGGER_AUTO
+};
+
+struct AxisLabelProperties
+{
+ AxisLabelProperties();
+
+ drafts::com::sun::star::chart2::NumberFormat aNumberFormat;
+
+ sal_Bool bDisplayLabels;
+
+ AxisLabelStaggering eStaggering;
+
+ sal_Bool bLineBreakAllowed;
+ sal_Bool bOverlapAllowed;
+
+ sal_Bool bStackCharacters;
+ double fRotationAngleDegree;
+
+ sal_Int32 nRhythm; //show only each nth label with n==nRhythm
+ bool bRhythmIsFix; //states wether the given rythm is fix or may be changed
+
+ //methods:
+ void init( const ::com::sun::star::uno::Reference<
+ ::drafts::com::sun::star::chart2::XAxis >& xAxisModel );
+
+ sal_Bool getIsStaggered() const;
+};
+
+struct AxisProperties
+{
+ ::com::sun::star::uno::Reference< ::drafts::com::sun::star::chart2::XAxis > m_xAxisModel;
+
+ bool m_bIsYAxis;
+ bool m_bIsLeftOrBottomAxis;
+ double* m_pfMainLinePositionAtOtherAxis;
+ double* m_pfExrtaLinePositionAtOtherAxis;
+
+ /*
+ sal_Int32 m_nOrthogonalAxisScreenPosition;//gives a position in the direction orthogonal to the axis direction
+ //e.g. for an y-axis this value describes a x position on the screen
+ sal_Int32 m_nOrthogonalAxisExtraLineScreenPosition;//gives the screen value for an additional line ( e.g. a line at 0 ) at the other axis
+ */
+
+ enum RelativeLabelPosition { NONE, LEFTORBOTTOM_OF_DIAGRAM, RIGHTORTOP_OF_DIAGRAM,
+ LEFTORBOTTOM_OF_AXIS, RIGHTORTOP_OF_AXIS };
+
+ RelativeLabelPosition m_eRelativeLabelPosition;
+ ::com::sun::star::awt::Size m_aReferenceSize;
+
+
+ /*
+ 0: no tickmarks 1: inner tickmarks
+ 2: outer tickmarks 3: inner and outer tickmarks
+ */
+ sal_Int32 m_nMajorTickmarks;
+ sal_Int32 m_nMinorTickmarks;
+ ::std::vector<TickmarkProperties> m_aTickmarkPropertiesList;
+
+ VLineProperties m_aLineProperties;
+
+ //methods:
+ AxisProperties();
+ AxisProperties( const AxisProperties& rAxisProperties );
+ ~AxisProperties();
+ void init();//init from model data (m_xAxisModel)
+
+private:
+ TickmarkProperties makeTickmarkProperties( sal_Int32 nDepth ) const;
+ sal_Int32 calcTickLengthForDepth( sal_Int32 nDepth, sal_Int32 nTickmarkStyle ) const;
+ VLineProperties makeLinePropertiesForDepth( sal_Int32 nDepth ) const;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
new file mode 100644
index 000000000000..8125b4b497a7
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -0,0 +1,1143 @@
+/*************************************************************************
+ *
+ * $RCSfile: VCartesianAxis.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "VCartesianAxis.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "ViewDefines.hxx"
+#include "TickmarkHelper.hxx"
+#include "PropertyMapper.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "chartview/ObjectIdentifier.hxx"
+#include "LabelPositionHelper.hxx"
+
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XIDENTIFIABLE_HPP_
+#include <drafts/com/sun/star/chart2/XIdentifiable.hpp>
+#endif
+
+#ifndef INCLUDED_RTL_MATH_HXX
+#include <rtl/math.hxx>
+#endif
+#ifndef _TOOLS_COLOR_HXX
+#include <tools/color.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _COM_SUN_STAR_TEXT_XTEXT_HPP_
+#include <com/sun/star/text/XText.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TEXT_WRITINGMODE2_HPP_
+#include <com/sun/star/text/WritingMode2.hpp>
+#endif
+
+#ifndef _SVX_UNOPRNMS_HXX
+#include <svx/unoprnms.hxx>
+#endif
+
+#include <algorithm>
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star::chart2;
+using namespace ::rtl::math;
+
+LabelAlignment lcl_getLabelAlignment( const AxisProperties& rAxisProperties )
+{
+ sal_Int16 nWritingMode( text::WritingMode2::LR_TB );//@todo get correct one
+ bool bIsYAxis = rAxisProperties.m_bIsYAxis;
+ bool bIsLeftOrBottomAxis = rAxisProperties.m_bIsLeftOrBottomAxis;
+
+ bool bTop = !bIsYAxis && !bIsLeftOrBottomAxis;
+ bool bLeft = true;
+ switch( nWritingMode )
+ {
+ case text::WritingMode2::RL_TB:
+ case text::WritingMode2::TB_RL:
+ bLeft = !( bIsYAxis && !bIsLeftOrBottomAxis );
+ case text::WritingMode2::TB_LR:
+ default:
+ bLeft = bIsYAxis && bIsLeftOrBottomAxis;
+ }
+
+ LabelAlignment aRet( LABEL_ALIGN_LEFT );
+ if(bTop)
+ {
+ if(bLeft)
+ aRet = LABEL_ALIGN_LEFT_TOP;
+ else
+ aRet = LABEL_ALIGN_RIGHT_TOP;
+ }
+ else
+ {
+ if(bLeft)
+ aRet = LABEL_ALIGN_LEFT_BOTTOM;
+ else
+ aRet = LABEL_ALIGN_RIGHT_BOTTOM;
+ }
+ return aRet;
+}
+
+sal_Int32 lcl_getAxisScreenPosition( double fCrossOtherAxis
+ , const PlottingPositionHelper& rPosHelper, bool bIsYAxis )
+{
+ double fX = bIsYAxis ? fCrossOtherAxis : rPosHelper.getLogicMinX();
+ double fY = bIsYAxis ? rPosHelper.getLogicMinY() : fCrossOtherAxis;
+
+ rPosHelper.clipLogicValues( &fX,&fY,0 );
+ rPosHelper.doLogicScaling( &fX,&fY,0 );
+ drawing::Position3D aPos( fX, fY, 0);
+
+ uno::Reference< XTransformation > xTransformation =
+ rPosHelper.getTransformationLogicToScene();
+ uno::Sequence< double > aSeq =
+ xTransformation->transform( Position3DToSequence(aPos) );
+
+ return static_cast<sal_Int32>(
+ bIsYAxis ? aSeq[0] : aSeq[1] );
+}
+
+sal_Int32 lcl_getMainLineScreenPosition(
+ const PlottingPositionHelper& rPosHelper
+ , const AxisProperties& rAxisProperties )
+{
+ double fMin = rAxisProperties.m_bIsYAxis ? rPosHelper.getLogicMinX() : rPosHelper.getLogicMinY();
+ double fMax = rAxisProperties.m_bIsYAxis ? rPosHelper.getLogicMaxX() : rPosHelper.getLogicMaxY();
+
+ double fCrossOtherAxis;
+ if(rAxisProperties.m_pfMainLinePositionAtOtherAxis)
+ fCrossOtherAxis = *rAxisProperties.m_pfMainLinePositionAtOtherAxis;
+ else
+ {
+ bool bMinimumForLeftAxis = ( rAxisProperties.m_bIsYAxis && rPosHelper.isMathematicalOrientationY() )
+ || ( !rAxisProperties.m_bIsYAxis && rPosHelper.isMathematicalOrientationX() );
+ fCrossOtherAxis = ( bMinimumForLeftAxis && rAxisProperties.m_bIsLeftOrBottomAxis ) ? fMin : fMax;
+ }
+ sal_Int32 nRet = lcl_getAxisScreenPosition( fCrossOtherAxis, rPosHelper
+ , rAxisProperties.m_bIsYAxis );
+ return nRet;
+}
+
+bool lcl_getExtraLineScreenPosition(
+ sal_Int32& rnExtraLineScreenPosition
+ , const PlottingPositionHelper& rPosHelper
+ , const AxisProperties& rAxisProperties )
+{
+ if( !rAxisProperties.m_pfExrtaLinePositionAtOtherAxis )
+ return false;
+
+ double fMin = rAxisProperties.m_bIsYAxis ? rPosHelper.getLogicMinX() : rPosHelper.getLogicMinY();
+ double fMax = rAxisProperties.m_bIsYAxis ? rPosHelper.getLogicMaxX() : rPosHelper.getLogicMaxY();
+ if( *rAxisProperties.m_pfExrtaLinePositionAtOtherAxis <= fMin
+ || *rAxisProperties.m_pfExrtaLinePositionAtOtherAxis >= fMax )
+ return false;
+ rnExtraLineScreenPosition = lcl_getAxisScreenPosition(
+ *rAxisProperties.m_pfExrtaLinePositionAtOtherAxis
+ , rPosHelper, rAxisProperties.m_bIsYAxis );
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+VAxis::VAxis( const AxisProperties& rAxisProperties
+ , NumberFormatterWrapper* pNumberFormatterWrapper
+ , sal_Int32 nDimensionCount )
+ : VMeterBase( uno::Reference<XMeter>::query(rAxisProperties.m_xAxisModel)
+ , nDimensionCount )
+ , m_aAxisProperties( rAxisProperties )
+ , m_pNumberFormatterWrapper( pNumberFormatterWrapper )
+{
+ m_pPosHelper = new PlottingPositionHelper();
+}
+
+VAxis::~VAxis()
+{
+ delete m_pPosHelper;
+ m_pPosHelper = NULL;
+}
+
+void lcl_correctRotation_Left( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for left y-axis with right top alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ rfXCorrection = 0.0;
+ rfYCorrection = -aSize.Height/2.0;
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi );
+ rfYCorrection = -aSize.Height*rtl::math::cos( fAnglePi )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ rfXCorrection = -aSize.Width *rtl::math::sin( fAnglePi - F_PI/2.0 )
+ -aSize.Height*rtl::math::cos( fAnglePi - F_PI/2.0 );
+ rfYCorrection = -aSize.Width *rtl::math::cos( fAnglePi - F_PI/2.0 )
+ +aSize.Height*rtl::math::sin( fAnglePi - F_PI/2.0 )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = fAnglePi - F_PI;
+ double gamma = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = -aSize.Width *rtl::math::cos( beta );
+ rfYCorrection = +aSize.Height*rtl::math::sin( gamma )/2.0
+ +aSize.Width *rtl::math::sin( beta );
+ }
+ else
+ {
+ rfXCorrection = 0.0;
+ rfYCorrection = -aSize.Height*rtl::math::cos( fAnglePi )/2.0;
+ }
+}
+
+void lcl_correctRotation_Right( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for right y-axis with left top alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ rfXCorrection = 0.0;
+ rfYCorrection = -aSize.Height/2.0;
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = 0.0;
+ rfYCorrection = -aSize.Height*rtl::math::cos( fAnglePi )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = F_PI - fAnglePi;
+ double gamma = fAnglePi - F_PI/2.0;
+ rfXCorrection = aSize.Width *rtl::math::cos( beta );
+ rfYCorrection = +aSize.Height*rtl::math::sin( gamma )/2.0
+ +aSize.Width *rtl::math::sin( beta );
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = aSize.Width *rtl::math::sin( beta )
+ +aSize.Height*rtl::math::cos( beta );
+ rfYCorrection = -aSize.Width *rtl::math::cos( beta )
+ +aSize.Height*rtl::math::sin( beta )/2.0;
+ }
+ else
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( 2*F_PI - fAnglePi );
+ rfYCorrection = -aSize.Height*rtl::math::cos( 2*F_PI - fAnglePi )/2.0;
+ }
+}
+void lcl_correctRotation_Bottom_Left( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for bottom x-axis with left top alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ rfXCorrection = -aSize.Width/2.0;
+ rfYCorrection = 0.0;
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi )/2.0
+ -aSize.Width *rtl::math::cos( fAnglePi );
+ rfYCorrection = aSize.Width *rtl::math::sin( fAnglePi );
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = F_PI - fAnglePi;
+ rfYCorrection = aSize.Width *rtl::math::sin( beta )
+ +aSize.Height*rtl::math::cos( beta );
+ rfXCorrection = aSize.Width *rtl::math::cos( beta )
+ -aSize.Height*rtl::math::sin( beta )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = aSize.Height*rtl::math::cos( beta )/2.0;
+ rfYCorrection = aSize.Height*rtl::math::sin( beta );
+ }
+ else
+ {
+ double beta = 2*F_PI - fAnglePi;
+ rfXCorrection = aSize.Height*rtl::math::sin( beta )/2.0;
+ rfYCorrection = 0.0;
+ }
+}
+
+void lcl_correctRotation_Bottom_Right( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for bottom x-axis with right top alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ rfXCorrection = aSize.Width/2.0;
+ rfYCorrection = 0.0;
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = -aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ rfYCorrection = 0.0;
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = F_PI - fAnglePi;
+ rfYCorrection = aSize.Height*rtl::math::cos( beta );
+ rfXCorrection = -aSize.Height*rtl::math::sin( beta )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = aSize.Height*rtl::math::cos( beta )/2.0
+ -aSize.Width*rtl::math::sin( beta );
+
+ rfYCorrection = aSize.Height*rtl::math::sin( beta )
+ +aSize.Width*rtl::math::cos( beta );
+ }
+ else
+ {
+ double beta = 2*F_PI - fAnglePi;
+ rfXCorrection = aSize.Height*rtl::math::sin( beta )/2.0
+ +aSize.Width*rtl::math::cos( beta );
+ rfYCorrection = aSize.Width*rtl::math::sin( beta );
+ }
+}
+
+void lcl_correctRotation_Top_Left( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for top x-axis with left top alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ rfXCorrection = -aSize.Width/2.0;
+ rfYCorrection = 0.0;
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = +aSize.Height*rtl::math::sin( fAnglePi )/2.0;
+ rfYCorrection = 0.0;
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = F_PI - fAnglePi;
+ rfYCorrection = -aSize.Height*rtl::math::cos( beta );
+ rfXCorrection = aSize.Height*rtl::math::sin( beta )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = -aSize.Height*rtl::math::cos( beta )/2.0
+ +aSize.Width *rtl::math::sin( beta );
+ rfYCorrection = -aSize.Width *rtl::math::cos( beta )
+ -aSize.Height*rtl::math::sin( beta );
+ }
+ else
+ {
+ double beta = 2*F_PI - fAnglePi;
+ rfXCorrection = - aSize.Width*rtl::math::cos( beta )
+ - aSize.Height*rtl::math::sin( beta )/2.0;
+ rfYCorrection = - aSize.Width*rtl::math::sin( beta );
+ }
+}
+
+void lcl_correctRotation_Top_Right( double& rfXCorrection, double& rfYCorrection
+ , double fAnglePositiveDegree, const awt::Size& aSize )
+{
+ //correct position for top x-axis with right top alignment
+ double fAnglePi = fAnglePositiveDegree*F_PI/180.0;
+ if( fAnglePositiveDegree==0.0 )
+ {
+ rfXCorrection = aSize.Width/2.0;
+ rfYCorrection = 0.0;
+ }
+ else if( fAnglePositiveDegree<= 90.0 )
+ {
+ rfXCorrection = aSize.Height*rtl::math::sin( fAnglePi )/2.0
+ +aSize.Width*rtl::math::cos( fAnglePi );
+ rfYCorrection = -aSize.Width*rtl::math::sin( fAnglePi );
+ }
+ else if( fAnglePositiveDegree<= 180.0 )
+ {
+ double beta = F_PI - fAnglePi;
+ rfYCorrection = -aSize.Height*rtl::math::cos( beta )
+ -aSize.Width*rtl::math::sin( beta );
+ rfXCorrection = -aSize.Width*rtl::math::cos( beta )
+ +aSize.Height*rtl::math::sin( beta )/2.0;
+ }
+ else if( fAnglePositiveDegree<= 270.0 )
+ {
+ double beta = 3*F_PI/2.0 - fAnglePi;
+ rfXCorrection = -aSize.Height*rtl::math::cos( beta )/2.0;
+ rfYCorrection = -aSize.Height*rtl::math::sin( beta );
+ }
+ else
+ {
+ double beta = 2*F_PI - fAnglePi;
+ rfXCorrection = - aSize.Height*rtl::math::sin( beta )/2.0;
+ rfYCorrection = - 0.0;
+ }
+}
+
+enum ShiftDirection { SHIFT_LEFT, SHIFT_TOP, SHIFT_RIGHT, SHIFT_BOTTOM };
+enum RotationCentre { ROTATE_LEFT_TOP, ROTATE_LEFT_BOTTOM, ROTATE_RIGHT_TOP, ROTATE_RIGHT_BOTTOM };
+
+ShiftDirection lcl_getLabelShiftDirection( const AxisProperties& rAxisProperties )
+{
+ ShiftDirection aShiftDirection = SHIFT_RIGHT;
+ if(rAxisProperties.m_bIsYAxis)
+ {
+ if(rAxisProperties.m_bIsLeftOrBottomAxis)
+ aShiftDirection = SHIFT_LEFT;
+ }
+ else
+ {
+ if(rAxisProperties.m_bIsLeftOrBottomAxis)
+ aShiftDirection = SHIFT_BOTTOM;
+ else
+ aShiftDirection = SHIFT_TOP;
+ }
+ return aShiftDirection;
+}
+
+RotationCentre lcl_getLabelRotationCentre(
+ const AxisProperties& rAxisProperties
+ , const AxisLabelProperties& rAxisLabelProperties )
+{
+ //indicate where the centre of the rotation lies (e.g. top left or bottom left corner of the text shape)
+ RotationCentre aRotationCentre = ROTATE_LEFT_TOP;
+ {
+ LabelAlignment eLabelAlignment( lcl_getLabelAlignment( rAxisProperties ) );
+ switch(eLabelAlignment)
+ {
+ case LABEL_ALIGN_LEFT_TOP:
+ aRotationCentre = ROTATE_RIGHT_BOTTOM;
+ break;
+ case LABEL_ALIGN_LEFT_BOTTOM:
+ aRotationCentre = ROTATE_RIGHT_TOP;
+ break;
+ case LABEL_ALIGN_RIGHT_TOP:
+ aRotationCentre = ROTATE_LEFT_BOTTOM;
+ break;
+ case LABEL_ALIGN_RIGHT_BOTTOM:
+ aRotationCentre = ROTATE_LEFT_TOP;
+ break;
+ case LABEL_ALIGN_LEFT:
+ case LABEL_ALIGN_TOP:
+ case LABEL_ALIGN_RIGHT:
+ case LABEL_ALIGN_BOTTOM:
+ default: //LABEL_ALIGN_CENTER
+ ROTATE_RIGHT_BOTTOM;
+ break;
+ };
+ }
+ return aRotationCentre;
+}
+
+void lcl_getPositionCorrectionForRotation(
+ double& rfXCorrection
+ , double& rfYCorrection
+ , const ShiftDirection& aShiftDirection
+ , const RotationCentre& aRotationCentre
+ , const double fRotationAngle
+ , const awt::Size& aSize )
+{
+ double fAnglePositiveDegree = fRotationAngle;
+ while(fAnglePositiveDegree<0.0)
+ fAnglePositiveDegree+=360.0;
+
+ if( SHIFT_LEFT ==aShiftDirection )
+ {
+ DBG_ASSERT( ROTATE_RIGHT_TOP ==aRotationCentre, "it is assumed that rotation centre is at left top corner if labels are shifted to the right" );
+
+ lcl_correctRotation_Left( rfXCorrection, rfYCorrection, fAnglePositiveDegree, aSize );
+ }
+ else if( SHIFT_RIGHT ==aShiftDirection )
+ {
+ DBG_ASSERT( ROTATE_LEFT_TOP ==aRotationCentre, "it is assumed that rotation centre is at left top corner if labels are shifted to the right" );
+
+ lcl_correctRotation_Right( rfXCorrection, rfYCorrection, fAnglePositiveDegree, aSize );
+ }
+ else if( SHIFT_BOTTOM ==aShiftDirection )
+ {
+ DBG_ASSERT( ROTATE_LEFT_TOP ==aRotationCentre
+ || ROTATE_RIGHT_TOP ==aRotationCentre
+ , "it is assumed that rotation centre is at left or right top corner if labels are shifted to the bottom" );
+
+ if( ROTATE_LEFT_TOP ==aRotationCentre )
+ lcl_correctRotation_Bottom_Left( rfXCorrection, rfYCorrection, fAnglePositiveDegree, aSize );
+ else
+ lcl_correctRotation_Bottom_Right( rfXCorrection, rfYCorrection, fAnglePositiveDegree, aSize );
+ }
+ else if( SHIFT_TOP ==aShiftDirection )
+ {
+ DBG_ASSERT( ROTATE_LEFT_BOTTOM ==aRotationCentre
+ || ROTATE_RIGHT_BOTTOM ==aRotationCentre
+ , "it is assumed that rotation centre is at left or right bottom corner if labels are shifted to the top" );
+
+ if( ROTATE_LEFT_BOTTOM ==aRotationCentre )
+ lcl_correctRotation_Top_Left( rfXCorrection, rfYCorrection, fAnglePositiveDegree, aSize );
+ else
+ lcl_correctRotation_Top_Right( rfXCorrection, rfYCorrection, fAnglePositiveDegree, aSize );
+ }
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+uno::Reference< drawing::XShape > createSingleLabel(
+ const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
+ , const uno::Reference< drawing::XShapes >& xTarget
+ , const awt::Point& rAnchorScreenPosition2D
+ , const rtl::OUString& rLabel
+ , const AxisLabelProperties& rAxisLabelProperties
+ , const AxisProperties& rAxisProperties
+ , const tNameSequence& rPropNames
+ , const tAnySequence& rPropValues
+ )
+{
+ double fRotationAnglePi = rAxisLabelProperties.fRotationAngleDegree*F_PI/180.0;
+ uno::Any aATransformation = ShapeFactory::makeTransformation( rAnchorScreenPosition2D, fRotationAnglePi );
+ rtl::OUString aLabel = ShapeFactory::getStackedString( rLabel, rAxisLabelProperties.bStackCharacters );
+
+ uno::Reference< drawing::XShape > xShape2DText = ShapeFactory(xShapeFactory)
+ .createText( xTarget, aLabel, rPropNames, rPropValues, aATransformation );
+ //-------------
+ //correctPositionForRotation()
+ awt::Point aOldPos = xShape2DText->getPosition();
+ awt::Size aSize = xShape2DText->getSize();
+
+ ShiftDirection aShiftDirection = lcl_getLabelShiftDirection( rAxisProperties );
+ RotationCentre aRotationCentre = lcl_getLabelRotationCentre( rAxisProperties, rAxisLabelProperties );
+
+ double fYCorrection = 0.0;
+ double fXCorrection = 0.0;
+
+ lcl_getPositionCorrectionForRotation( fXCorrection, fYCorrection
+ , aShiftDirection, aRotationCentre
+ , rAxisLabelProperties.fRotationAngleDegree, aSize );
+
+ xShape2DText->setPosition( awt::Point(
+ static_cast<sal_Int32>(aOldPos.X + fXCorrection )
+ , static_cast<sal_Int32>(aOldPos.Y + fYCorrection ) ) );
+ //-------------
+
+ return xShape2DText;
+}
+
+bool lcl_doesOverlap( const uno::Reference< drawing::XShape >& xShape
+, sal_Int32 nScreenTickValue, bool bCheckDirectionIsY )
+{
+ if(!xShape.is())
+ return false;
+
+ awt::Size aSize = xShape->getSize();
+ awt::Point aPos = xShape->getPosition();
+
+ sal_Int32 nMin = bCheckDirectionIsY ? aPos.Y : aPos.X;
+ sal_Int32 nMax = nMin + ( bCheckDirectionIsY ? aSize.Height : aSize.Width );
+
+ return nMin <= nScreenTickValue && nScreenTickValue <= nMax;
+}
+
+bool doesOverlap( const uno::Reference< drawing::XShape >& xShape1
+ , const uno::Reference< drawing::XShape >& xShape2
+ , bool bCheckDirectionIsY )
+{
+ awt::Size aSize1 = xShape1->getSize();
+ awt::Point aPos1 = xShape1->getPosition();
+
+ sal_Int32 nMin1 = bCheckDirectionIsY ? aPos1.Y : aPos1.X;
+ sal_Int32 nMax1 = nMin1 + ( bCheckDirectionIsY ? aSize1.Height : aSize1.Width );
+
+ awt::Size aSize2 = xShape2->getSize();
+ awt::Point aPos2 = xShape2->getPosition();
+
+ sal_Int32 nMin2 = bCheckDirectionIsY ? aPos2.Y : aPos2.X;
+ sal_Int32 nMax2 = nMin2 + ( bCheckDirectionIsY ? aSize2.Height : aSize2.Width );
+
+ if( nMax1 < nMin2 )
+ return false;
+ if( nMax2 < nMin1 )
+ return false;
+ return true;
+}
+
+void removeShapesAtWrongRythm( TickIter& rIter
+ , sal_Int32 nCorrectRhythm
+ , sal_Int32 nMaxTickToCheck
+ , const uno::Reference< drawing::XShapes >& xTarget )
+{
+ sal_Int32 nTick = 0;
+ for( TickInfo* pTickInfo = rIter.firstInfo()
+ ; pTickInfo && nTick <= nMaxTickToCheck
+ ; pTickInfo = rIter.nextInfo(), nTick++ )
+ {
+ //remove labels which does not fit into the rythm
+ if( nTick%nCorrectRhythm != 0)
+ {
+ if(pTickInfo->xTextShape.is())
+ {
+ xTarget->remove(pTickInfo->xTextShape);
+ pTickInfo->xTextShape = NULL;
+ }
+ }
+ }
+}
+
+class LabelIterator : private TickIter
+{
+ //this Iterator iterates over existing text labels
+
+ //if the labels are staggered and bInnerLine is true
+ //we iterate only through the labels which are lying more inside the diagram
+
+ //if the labels are staggered and bInnerLine is false
+ //we iterate only through the labels which are lying more outside the diagram
+
+ //if the labels are not staggered
+ //we iterate through all labels
+
+public:
+ LabelIterator( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
+ , const ::drafts::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , const AxisLabelStaggering eAxisLabelStaggering
+ , bool bInnerLine
+ , sal_Int32 nMinDepth=0, sal_Int32 nMaxDepth=-1 );
+
+ TickInfo* firstInfo();
+ TickInfo* nextInfo();
+
+private: //methods
+ LabelIterator();
+
+private: //member
+ const AxisLabelStaggering m_eAxisLabelStaggering;
+ bool m_bInnerLine;
+};
+
+LabelIterator::LabelIterator( ::std::vector< ::std::vector< TickInfo > >& rTickInfos
+ , const ::drafts::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , const AxisLabelStaggering eAxisLabelStaggering
+ , bool bInnerLine
+ , sal_Int32 nMinDepth, sal_Int32 nMaxDepth )
+ : TickIter( rTickInfos, rIncrement, nMinDepth, nMaxDepth )
+ , m_eAxisLabelStaggering(eAxisLabelStaggering)
+ , m_bInnerLine(bInnerLine)
+{
+}
+
+TickInfo* LabelIterator::firstInfo()
+{
+ TickInfo* pTickInfo = TickIter::firstInfo();
+ while( pTickInfo && !pTickInfo->xTextShape.is() )
+ pTickInfo = TickIter::nextInfo();
+ if(!pTickInfo)
+ return NULL;
+ if( (STAGGER_EVEN==m_eAxisLabelStaggering && !m_bInnerLine)
+ ||
+ (STAGGER_ODD==m_eAxisLabelStaggering && m_bInnerLine)
+ )
+ {
+ //skip first label
+ do
+ pTickInfo = TickIter::nextInfo();
+ while( pTickInfo && !pTickInfo->xTextShape.is() );
+ }
+ if(!pTickInfo)
+ return NULL;
+ return pTickInfo;
+}
+
+TickInfo* LabelIterator::nextInfo()
+{
+ TickInfo* pTickInfo = NULL;
+ //get next label
+ do
+ pTickInfo = TickIter::nextInfo();
+ while( pTickInfo && !pTickInfo->xTextShape.is() );
+
+ if( STAGGER_EVEN==m_eAxisLabelStaggering
+ || STAGGER_ODD==m_eAxisLabelStaggering )
+ {
+ //skip one label
+ do
+ pTickInfo = TickIter::nextInfo();
+ while( pTickInfo && !pTickInfo->xTextShape.is() );
+ }
+ return pTickInfo;
+}
+
+sal_Int32 lcl_getStaggerDistance(
+ LabelIterator& rIter
+ , const ShiftDirection aShiftDirection )
+{
+ //calculates the height or width of the first line of labels
+ //thus the second line of labels needs to be shifted for that distance
+
+ sal_Int32 nRet=0;
+ uno::Reference< drawing::XShape > xShape2DText(NULL);
+ for( TickInfo* pTickInfo = rIter.firstInfo()
+ ; pTickInfo
+ ; pTickInfo = rIter.nextInfo() )
+ {
+ xShape2DText = pTickInfo->xTextShape;
+ DBG_ASSERT(xShape2DText.is(),"LabelIterator does not work correctly");
+
+ awt::Size aSize = xShape2DText->getSize();
+ switch(aShiftDirection)
+ {
+ case SHIFT_TOP:
+ nRet = ::std::max(nRet,aSize.Height); break;
+ case SHIFT_BOTTOM:
+ nRet = ::std::max(nRet,aSize.Height); break;
+ case SHIFT_LEFT:
+ nRet = ::std::max(nRet,aSize.Width); break;
+ case SHIFT_RIGHT:
+ nRet = ::std::max(nRet,aSize.Width); break;
+ }
+ }
+ return nRet;
+}
+
+void lcl_correctPositionForStaggering(
+ LabelIterator& rIter
+ , const ShiftDirection aShiftDirection
+ , sal_Int32 nStaggerDistance
+ )
+{
+ uno::Reference< drawing::XShape > xShape2DText(NULL);
+ for( TickInfo* pTickInfo = rIter.firstInfo()
+ ; pTickInfo
+ ; pTickInfo = rIter.nextInfo() )
+ {
+ xShape2DText = pTickInfo->xTextShape;
+ DBG_ASSERT(xShape2DText.is(),"LabelIterator does not work correctly");
+
+ awt::Point aPos = xShape2DText->getPosition();
+ switch(aShiftDirection)
+ {
+ case SHIFT_TOP:
+ aPos.Y -= nStaggerDistance; break;
+ case SHIFT_BOTTOM:
+ aPos.Y += nStaggerDistance; break;
+ case SHIFT_LEFT:
+ aPos.X -= nStaggerDistance; break;
+ case SHIFT_RIGHT:
+ aPos.X += nStaggerDistance; break;
+ }
+ xShape2DText->setPosition( aPos );
+ }
+}
+
+bool createTextShapes( const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
+ , const uno::Reference< drawing::XShapes >& xTarget
+ , ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos
+ , const ExplicitIncrementData& rIncrement
+ , AxisLabelProperties& rAxisLabelProperties
+ , const AxisProperties& rAxisProperties
+ , sal_Int32 nTextReferenceScreenPosition
+ , const FixedNumberFormatter& rFixedNumberFormatter
+ , const uno::Reference< XScaling >& xInverseScaling )
+{
+ //returns true if the text shapes have been created succesfully
+ //otherwise false - in this case the AxisLabelProperties have changed
+ //and contain new instructions for the next try for text shape creation
+
+ bool bOverlapCheckDirectionIsY = rAxisProperties.m_bIsYAxis;
+ //@todo: iterate through all tick depth wich should be labeled
+ TickIter aIter( rAllTickInfos, rIncrement, 0, 0 );
+ TickInfo* pPreviousVisibleTickInfo = NULL;
+ TickInfo* pPREPreviousVisibleTickInfo = NULL;
+ TickInfo* pLastVisibleNeighbourTickInfo = NULL;
+ bool bIsStaggered = rAxisLabelProperties.getIsStaggered();
+ sal_Int32 nLimitedSpaceForStaggering = -1;
+ if( bIsStaggered && rAxisLabelProperties.bLineBreakAllowed
+ && rAxisLabelProperties.fRotationAngleDegree == 0.0 //use line break only, if labels are not rotated
+ )
+ {
+ nLimitedSpaceForStaggering = 2*TickmarkHelper_2D::getTickScreenDistance( aIter );
+ if( nLimitedSpaceForStaggering > 0 )
+ { //reduce space for a small amount to have a visible distance between the labels:
+ sal_Int32 nReduce = (nLimitedSpaceForStaggering*5)/100;
+ if(!nReduce)
+ nReduce = 1;
+ nLimitedSpaceForStaggering -= nReduce;
+ }
+ //maybe @todo in future:
+ //if the labeled tickmarks are not equidistant [this is not considered to be a relevant case so far]
+ //the limited space maybe needs to be calculated for each tickmark seperatly
+ //or the staggering could be ignored in that case
+ }
+
+ //------------------------------------------------
+ //prepare properties for multipropertyset-interface of shape
+ tNameSequence aPropNames;
+ tAnySequence aPropValues;
+
+ uno::Reference< beans::XPropertySet > xProps( rAxisProperties.m_xAxisModel, uno::UNO_QUERY );
+ PropertyMapper::getTextLabelMultiPropertyLists( xProps, aPropNames, aPropValues, false
+ , nLimitedSpaceForStaggering, rAxisProperties.m_bIsYAxis );
+ LabelPositionHelper::doDynamicFontResize( aPropValues, aPropNames, xProps
+ , rAxisProperties.m_aReferenceSize );
+ LabelPositionHelper::changeTextAdjustment( aPropValues, aPropNames, lcl_getLabelAlignment( rAxisProperties ) );
+
+ uno::Any* pColorAny = PropertyMapper::getValuePointer(aPropValues,aPropNames,C2U("CharColor"));
+ sal_Int32 nColor = Color( COL_AUTO ).GetColor();
+ if(pColorAny)
+ *pColorAny >>= nColor;
+ //------------------------------------------------
+
+ sal_Int32 nTick = 0;
+ for( TickInfo* pTickInfo = aIter.firstInfo()
+ ; pTickInfo
+ ; pTickInfo = aIter.nextInfo(), nTick++ )
+ {
+ pLastVisibleNeighbourTickInfo = bIsStaggered ?
+ pPREPreviousVisibleTickInfo : pPreviousVisibleTickInfo;
+
+ //don't create labels which does not fit into the rythm
+ if( nTick%rAxisLabelProperties.nRhythm != 0)
+ continue;
+
+ //don't create labels for invisible ticks
+ if( !pTickInfo->bPaintIt )
+ continue;
+
+ //if NO OVERLAP -> don't create labels where the tick overlaps
+ //with the text of the last neighbour tickmark
+ if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
+ {
+ if( lcl_doesOverlap( pLastVisibleNeighbourTickInfo->xTextShape, pTickInfo->nScreenTickValue, bOverlapCheckDirectionIsY ) )
+ {
+ if( rAxisLabelProperties.bRhythmIsFix )
+ continue;
+ rAxisLabelProperties.nRhythm++;
+ TickIter aRemoveIter( rAllTickInfos, rIncrement, 0, 0 );
+ removeShapesAtWrongRythm( aRemoveIter, rAxisLabelProperties.nRhythm, nTick, xTarget );
+ return false;
+ }
+ }
+
+ pTickInfo->updateUnscaledValue( xInverseScaling );
+
+ bool bHasExtraColor=false;
+ sal_Int32 nExtraColor=0;
+ rtl::OUString aLabel = rFixedNumberFormatter.getFormattedString( pTickInfo->fUnscaledTickValue, nExtraColor, bHasExtraColor );
+ if(pColorAny)
+ *pColorAny = uno::makeAny(bHasExtraColor?nExtraColor:nColor);
+
+ awt::Point aAnchorScreenPosition2D;
+ {//get anchor position
+ sal_Int32 nAxisPos = nTextReferenceScreenPosition;
+ sal_Int32 nTickPos = pTickInfo->nScreenTickValue;
+ if( rAxisProperties.m_bIsYAxis )
+ aAnchorScreenPosition2D = awt::Point(nAxisPos,nTickPos);
+ else
+ aAnchorScreenPosition2D = awt::Point(nTickPos,nAxisPos);
+ }
+
+ //create single label
+ if(!pTickInfo->xTextShape.is())
+ pTickInfo->xTextShape = createSingleLabel( xShapeFactory, xTarget
+ , aAnchorScreenPosition2D, aLabel
+ , rAxisLabelProperties, rAxisProperties
+ , aPropNames, aPropValues );
+
+ //if NO OVERLAP -> remove overlapping shapes
+ if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
+ {
+ if( doesOverlap( pLastVisibleNeighbourTickInfo->xTextShape, pTickInfo->xTextShape, bOverlapCheckDirectionIsY ) )
+ {
+ if( rAxisLabelProperties.bRhythmIsFix )
+ {
+ xTarget->remove(pTickInfo->xTextShape);
+ pTickInfo->xTextShape = NULL;
+ continue;
+ }
+ rAxisLabelProperties.nRhythm++;
+ TickIter aRemoveIter( rAllTickInfos, rIncrement, 0, 0 );
+ removeShapesAtWrongRythm( aRemoveIter, rAxisLabelProperties.nRhythm, nTick, xTarget );
+ return false;
+ }
+ }
+
+ pPREPreviousVisibleTickInfo = pPreviousVisibleTickInfo;
+ pPreviousVisibleTickInfo = pTickInfo;
+ }
+ return true;
+}
+
+sal_Int32 lcl_getTextReferenceScreenPosition( const ::std::vector<TickmarkProperties>& rTickmarkPropertiesList
+ , bool bIsYAxis
+ , bool bIsLeftOrBottomAxis
+ , sal_Int32 nAxisPos )
+{
+ sal_Int32 nRet = 0;
+
+ bool bFindMin = (bIsYAxis && bIsLeftOrBottomAxis) || (!bIsYAxis && !bIsLeftOrBottomAxis);
+ ::std::vector<TickmarkProperties>::const_iterator aIter = rTickmarkPropertiesList.begin();
+ const ::std::vector<TickmarkProperties>::const_iterator aIterEnd = rTickmarkPropertiesList.end();
+ for( ; aIter != aIterEnd; aIter++ )
+ {
+ if( ( bFindMin && (*aIter).RelativePos < nRet )
+ ||
+ ( !bFindMin && (*aIter).RelativePos > nRet )
+ )
+ {
+ nRet = (*aIter).RelativePos;
+ }
+ }
+ nRet+=nAxisPos;
+
+ if(bFindMin)
+ nRet-=AXIS2D_TICKLABELSPACING;
+ else
+ nRet+=AXIS2D_TICKLABELSPACING;
+ return nRet;
+}
+
+void addLine( drawing::PointSequenceSequence& rPoints, sal_Int32 nIndex
+ , sal_Int32 nScreenTickValue, sal_Int32 nOrthogonalAxisScreenPosition
+ , const TickmarkProperties& rTickmarkProperties, bool bIsYAxis )
+{
+ sal_Int32 nStartX = bIsYAxis ? nOrthogonalAxisScreenPosition + rTickmarkProperties.RelativePos : nScreenTickValue;
+ sal_Int32 nStartY = bIsYAxis ? nScreenTickValue : nOrthogonalAxisScreenPosition + rTickmarkProperties.RelativePos;
+
+ sal_Int32 nEndX = nStartX;
+ sal_Int32 nEndY = nStartY;
+ if( bIsYAxis )
+ nEndX += rTickmarkProperties.Length;
+ else
+ nEndY += rTickmarkProperties.Length;
+
+ rPoints[nIndex].realloc(2);
+ rPoints[nIndex][0].X = nStartX;
+ rPoints[nIndex][0].Y = nStartY;
+ rPoints[nIndex][1].X = nEndX;
+ rPoints[nIndex][1].Y = nEndY;
+}
+
+void createPointSequenceForAxisMainLine( drawing::PointSequenceSequence& rPoints,
+ bool bIsYAxis, sal_Int32 nOrthogonalPos, sal_Int32 nMin, sal_Int32 nMax )
+{
+ rPoints[0].realloc(2);
+ rPoints[0][0].X = bIsYAxis ? nOrthogonalPos : nMin;
+ rPoints[0][0].Y = bIsYAxis ? nMin : nOrthogonalPos;
+ rPoints[0][1].X = bIsYAxis ? nOrthogonalPos : nMax;
+ rPoints[0][1].Y = bIsYAxis ? nMax : nOrthogonalPos;
+}
+
+void SAL_CALL VAxis::createShapes()
+{
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"Axis is not proper initialized");
+ if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ return;
+
+ m_aAxisProperties.init();
+ bool bIsYAxis = m_aAxisProperties.m_bIsYAxis;
+ bool bIsLeftOrBottomAxis = m_aAxisProperties.m_bIsLeftOrBottomAxis;
+ sal_Int32 nMainLineScreenPosition = lcl_getMainLineScreenPosition( *m_pPosHelper, m_aAxisProperties );
+
+ //-----------------------------------------
+ //create named group shape
+ uno::Reference< XIdentifiable > xIdent( m_aAxisProperties.m_xAxisModel, uno::UNO_QUERY );
+ DBG_ASSERT( xIdent.is(), "Axis should support XIdentifiable" );
+ if( ! xIdent.is())
+ return;
+ uno::Reference< drawing::XShapes > xGroupShape_Shapes(
+ m_pShapeFactory->createGroup2D( m_xLogicTarget
+ , ObjectIdentifier::createClassifiedIdentifier(
+ OBJECTTYPE_AXIS, xIdent->getIdentifier() )
+ ) );
+
+ //-----------------------------------------
+ //create all scaled tickmark values
+ std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() );
+ ::std::vector< ::std::vector< TickInfo > > aAllTickInfos;
+ apTickmarkHelper->getAllTicks( aAllTickInfos );
+
+ //-----------------------------------------
+ //create tick mark line shapes
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = aAllTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = aAllTickInfos.end();
+
+ if(aDepthIter == aDepthEnd)//no tickmarks at all
+ return;
+
+ sal_Int32 nTickmarkPropertiesCount = m_aAxisProperties.m_aTickmarkPropertiesList.size();
+ for( sal_Int32 nDepth=0
+ ; aDepthIter != aDepthEnd && nDepth < nTickmarkPropertiesCount
+ ; aDepthIter++, nDepth++ )
+ {
+ const TickmarkProperties& rTickmarkProperties = m_aAxisProperties.m_aTickmarkPropertiesList[nDepth];
+
+ sal_Int32 nPointCount = (*aDepthIter).size();
+ drawing::PointSequenceSequence aPoints(nPointCount);
+
+ ::std::vector< TickInfo >::const_iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ sal_Int32 nN = 0;
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ if( !(*aTickIter).bPaintIt )
+ continue;
+ addLine( aPoints, nN
+ , (*aTickIter).nScreenTickValue, nMainLineScreenPosition
+ , rTickmarkProperties, bIsYAxis);
+ nN++;
+ }
+ aPoints.realloc(nN);
+ m_pShapeFactory->createLine2D( xGroupShape_Shapes, aPoints
+ , rTickmarkProperties.aLineProperties );
+ }
+ //-----------------------------------------
+ //create axis main lines
+ if(2==m_nDimension)
+ {
+ //TickmarkHelper_2D& aTickmarkHelper = *dynamic_cast<TickmarkHelper_2D*>(apTickmarkHelper.get());
+ TickmarkHelper_2D& aTickmarkHelper = *reinterpret_cast<TickmarkHelper_2D*>(apTickmarkHelper.get());
+ //create axis line
+ //it serves also as the handle shape for the axis selection
+ {
+ drawing::PointSequenceSequence aPoints(1);
+ createPointSequenceForAxisMainLine( aPoints
+ , bIsYAxis, nMainLineScreenPosition
+ , aTickmarkHelper.getScreenValueForMinimum(), aTickmarkHelper.getScreenValueForMaximum() );
+
+ uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ xGroupShape_Shapes, aPoints
+ , m_aAxisProperties.m_aLineProperties );
+ //because of this name this line will be used for marking the axis
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ }
+ //-----------------------------------------
+ //create an additional line at NULL
+ sal_Int32 nExtraLineScreenPosition;
+ if( lcl_getExtraLineScreenPosition( nExtraLineScreenPosition, *m_pPosHelper, m_aAxisProperties ) )
+ {
+ drawing::PointSequenceSequence aPoints(1);
+ createPointSequenceForAxisMainLine( aPoints
+ , bIsYAxis, nExtraLineScreenPosition
+ , aTickmarkHelper.getScreenValueForMinimum(), aTickmarkHelper.getScreenValueForMaximum() );
+
+ uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ xGroupShape_Shapes, aPoints
+ , m_aAxisProperties.m_aLineProperties );
+ }
+ }
+ //-----------------------------------------
+ //create labels
+ AxisLabelProperties aAxisLabelProperties;
+ aAxisLabelProperties.init(m_aAxisProperties.m_xAxisModel);
+ if( aAxisLabelProperties.bDisplayLabels )
+ {
+ FixedNumberFormatter aFixedNumberFormatter(
+ m_pNumberFormatterWrapper, aAxisLabelProperties.aNumberFormat );
+
+ uno::Reference< XScaling > xInverseScaling( NULL );
+ if( m_aScale.Scaling.is() )
+ xInverseScaling = m_aScale.Scaling->getInverseScaling();
+
+ sal_Int32 nTextReferenceScreenPosition = lcl_getTextReferenceScreenPosition(
+ m_aAxisProperties.m_aTickmarkPropertiesList
+ , bIsYAxis, bIsLeftOrBottomAxis, nMainLineScreenPosition );
+
+ //create tick mark text shapes
+ while( !createTextShapes( m_xShapeFactory, xGroupShape_Shapes, aAllTickInfos
+ , m_aIncrement, aAxisLabelProperties, m_aAxisProperties
+ , nTextReferenceScreenPosition
+ , aFixedNumberFormatter, xInverseScaling
+ ) )
+ {
+ };
+
+ //staggering
+ if( aAxisLabelProperties.getIsStaggered() )
+ {
+ LabelIterator aInnerIter( aAllTickInfos, m_aIncrement
+ , aAxisLabelProperties.eStaggering, true, 0, 0 );
+ LabelIterator aOuterIter( aAllTickInfos, m_aIncrement
+ , aAxisLabelProperties.eStaggering, false, 0, 0 );
+
+ sal_Int32 nStaggerDistance = lcl_getStaggerDistance( aInnerIter
+ , lcl_getLabelShiftDirection( m_aAxisProperties ) );
+
+ lcl_correctPositionForStaggering( aOuterIter
+ , lcl_getLabelShiftDirection( m_aAxisProperties )
+ , nStaggerDistance );
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VCartesianAxis.hxx b/chart2/source/view/axes/VCartesianAxis.hxx
new file mode 100644
index 000000000000..8f29d974e0dd
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianAxis.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: VCartesianAxis.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CHART2_VAXIS_HXX
+#define _CHART2_VAXIS_HXX
+
+#include "VMeterBase.hxx"
+#include "VAxisProperties.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class NumberFormatterWrapper;
+
+class VAxis : public VMeterBase
+{
+ //-------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------
+public:
+ VAxis( const AxisProperties& rAxisProperties
+ , NumberFormatterWrapper* pNumberFormatterWrapper
+ , sal_Int32 nDimensionCount=2 );
+
+ virtual ~VAxis();
+
+ //-------------------------------------------------------------------------
+ // partly chart2::XPlotter
+ //-------------------------------------------------------------------------
+
+ /*
+ virtual ::rtl::OUString SAL_CALL getCoordinateSystemTypeID( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTransformation( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::chart2::XTransformation >& xTransformationToLogicTarget, const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::chart2::XTransformation >& xTransformationToFinalPage ) throw (::com::sun::star::uno::RuntimeException);
+ */
+
+ virtual void SAL_CALL createShapes();
+
+ //-------------------------------------------------------------------------
+ //Layout interface for cartesian axes:
+
+ //the returned value describes the minimum size that is necessary
+ //for the text labels in the direction orthogonal to the axis
+ //(for an y-axis a width is returned; in case of an x-axis the value describes a height)
+ //the return value is measured in screen dimension
+ //As an example the MinimumOrthogonalSize of an x-axis equals the
+ //Font Height if the label properties allow for labels parallel to the axis.
+// sal_Int32 calculateMinimumOrthogonalSize( /*... parallel...*/ );
+ //Minimum->Preferred
+
+ //returns true if the MinimumOrthogonalSize can be calculated
+ //with the creation of at most one text shape
+ //(this is e.g. true if the parameters allow for labels parallel to the axis.)
+// sal_bool canQuicklyCalculateMinimumOrthogonalSize();
+
+
+ //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
+private: //member
+ AxisProperties m_aAxisProperties;
+ NumberFormatterWrapper* m_pNumberFormatterWrapper;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
new file mode 100644
index 000000000000..b9f1b897b245
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * $RCSfile: VCartesianCoordinateSystem.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "VCartesianCoordinateSystem.hxx"
+#include "VCartesianGrid.hxx"
+#include "VCartesianAxis.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star::chart2;
+
+VCartesianCoordinateSystem::VCartesianCoordinateSystem( const uno::Reference< XBoundedCoordinateSystem >& xCooSys )
+ : VCoordinateSystem(xCooSys)
+{
+}
+
+VCartesianCoordinateSystem::~VCartesianCoordinateSystem()
+{
+}
+
+void VCartesianCoordinateSystem::createGridShapes()
+{
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ for( sal_Int32 nDim=0; nDim<3; nDim++)
+ {
+ uno::Sequence< uno::Reference< XGrid > >& rGridList
+ = getGridListByDimension( nDim );
+ for( sal_Int32 nN=0; nN<rGridList.getLength(); nN++ )
+ {
+ VCartesianGrid aGrid(rGridList[nN],nDimensionCount);
+ aGrid.setMeterData( m_aExplicitScales[nDim], m_aExplicitIncrements[nDim] );
+
+ aGrid.init(m_xLogicTargetForGrids,m_xFinalTarget,m_xShapeFactory);
+ if(2==nDimensionCount)
+ aGrid.setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ aGrid.setScales( m_aExplicitScales );
+ aGrid.createShapes();
+ }
+ }
+}
+
+void VCartesianCoordinateSystem::createAxesShapes( const awt::Size& rReferenceSize, NumberFormatterWrapper* pNumberFormatterWrapper )
+{
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ double fCoordinateOrigin[3] = { 0.0, 0.0, 0.0 };
+ for( sal_Int32 nDim = 0; nDim < 3; nDim++ )
+ fCoordinateOrigin[nDim] = this->getOriginByDimension( nDim );
+ for( nDim = 0; nDim < 3; nDim++ )
+ {
+ uno::Reference< XAxis > xAxis = this->getAxisByDimension(nDim);
+ if(xAxis.is()
+ &&2==nDimensionCount) //@todo remove this restriction if 3D axes are available
+ {
+ AxisProperties aAxisProperties;
+ aAxisProperties.m_xAxisModel = xAxis;
+ aAxisProperties.m_pfExrtaLinePositionAtOtherAxis =
+ new double(nDim==1?fCoordinateOrigin[0]:fCoordinateOrigin[1]);
+ aAxisProperties.m_aReferenceSize = rReferenceSize;
+ //-------------------
+ VAxis aAxis(aAxisProperties,pNumberFormatterWrapper);
+ aAxis.setMeterData( m_aExplicitScales[nDim], m_aExplicitIncrements[nDim] );
+ aAxis.init(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory);
+ if(2==nDimensionCount)
+ aAxis.setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ aAxis.setScales( m_aExplicitScales );
+ aAxis.createShapes();
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.hxx b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx
new file mode 100644
index 000000000000..7f073a94971b
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: VCartesianCoordinateSystem.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CHART2_VCARTESIAN_COORDINATESYSTEM_HXX
+#define _CHART2_VCARTESIAN_COORDINATESYSTEM_HXX
+
+#include "VCoordinateSystem.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class VCartesianCoordinateSystem : public VCoordinateSystem
+{
+public:
+ VCartesianCoordinateSystem( const ::com::sun::star::uno::Reference<
+ ::drafts::com::sun::star::chart2::XBoundedCoordinateSystem >& xCooSys );
+ virtual ~VCartesianCoordinateSystem();
+
+ virtual void createGridShapes();
+ virtual void createAxesShapes( const ::com::sun::star::awt::Size& rReferenceSize, NumberFormatterWrapper* pNumberFormatterWrapper );
+
+private:
+ VCartesianCoordinateSystem();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VCartesianGrid.cxx b/chart2/source/view/axes/VCartesianGrid.cxx
new file mode 100644
index 000000000000..ecf83a51fbcf
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianGrid.cxx
@@ -0,0 +1,318 @@
+/*************************************************************************
+ *
+ * $RCSfile: VCartesianGrid.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:56 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "VCartesianGrid.hxx"
+#include "TickmarkHelper.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "chartview/ObjectIdentifier.hxx"
+#include "macros.hxx"
+#include "CommonConverters.hxx"
+
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XIDENTIFIABLE_HPP_
+#include <drafts/com/sun/star/chart2/XIdentifiable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DRAWING_POINTSEQUENCESEQUENCE_HPP_
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DRAWING_LINESTYLE_HPP_
+#include <com/sun/star/drawing/LineStyle.hpp>
+#endif
+
+#include <vector>
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star::chart2;
+
+VCartesianGrid::VCartesianGrid( const uno::Reference< XGrid >& xGrid, sal_Int32 nDimensionCount )
+ : VMeterBase( uno::Reference<XMeter>::query(xGrid), nDimensionCount )
+{
+ m_pPosHelper = new PlottingPositionHelper();
+}
+
+VCartesianGrid::~VCartesianGrid()
+{
+ delete m_pPosHelper;
+ m_pPosHelper = NULL;
+}
+
+//static
+void VCartesianGrid::fillLinePropertiesFromGridModel( ::std::vector<VLineProperties>& rLinePropertiesList
+ , uno::Reference< beans::XPropertySet > xProps )
+{
+ rLinePropertiesList.clear();
+ VLineProperties aLineProperties;
+ aLineProperties.initFromPropertySet( xProps );
+ rLinePropertiesList.assign(2,aLineProperties);
+};
+
+void addLine2D( drawing::PointSequenceSequence& rPoints, sal_Int32 nIndex
+ , bool bIsYGrid , sal_Int32 nScreenTickValue
+ , sal_Int32 nOrthogonalStart, sal_Int32 nOrthogonalEnd
+ )
+{
+ rPoints[nIndex].realloc(2);
+ rPoints[nIndex][0].X = bIsYGrid ? nOrthogonalStart : nScreenTickValue;
+ rPoints[nIndex][0].Y = bIsYGrid ? nScreenTickValue : nOrthogonalStart;
+ rPoints[nIndex][1].X = bIsYGrid ? nOrthogonalEnd : nScreenTickValue;
+ rPoints[nIndex][1].Y = bIsYGrid ? nScreenTickValue : nOrthogonalEnd;
+}
+
+struct GridLinePoints
+{
+ uno::Sequence< double > P0;
+ uno::Sequence< double > P1;
+ uno::Sequence< double > P2;
+
+ GridLinePoints( const uno::Sequence< double >& rMinEdgeSeq, const uno::Sequence< double >& rMaxEdgeSeq );
+ void update( double fScaledTickValue );
+};
+
+GridLinePoints::GridLinePoints( const uno::Sequence< double >& rMinEdgeSeq
+ , const uno::Sequence< double >& rMaxEdgeSeq )
+{
+ P0.realloc(3);
+ P0[0]=rMinEdgeSeq[0];
+ P0[1]=rMinEdgeSeq[1];
+ P0[2]=rMaxEdgeSeq[2];
+
+ P1.realloc(3);
+ P1[0]=rMinEdgeSeq[0];
+ P1[1]=rMaxEdgeSeq[1];
+ P1[2]=rMinEdgeSeq[2];
+
+ P2.realloc(3);
+ P2[0]=rMaxEdgeSeq[0];
+ P2[1]=rMaxEdgeSeq[1];
+ P2[2]=rMinEdgeSeq[2];
+}
+
+void GridLinePoints::update( double fScaledTickValue )
+{
+ P0[1] = P1[1] = P2[1] = fScaledTickValue;
+}
+
+void addLine3D( drawing::PolyPolygonShape3D& rPoints, sal_Int32 nIndex
+ , const GridLinePoints& rBasePoints
+ , const uno::Reference< XTransformation > & xTransformation )
+{
+ drawing::Position3D aPoint = SequenceToPosition3D( xTransformation->transform( rBasePoints.P0 ) );
+ AddPointToPoly( rPoints, aPoint, nIndex );
+ aPoint = SequenceToPosition3D( xTransformation->transform( rBasePoints.P1 ) );
+ AddPointToPoly( rPoints, aPoint, nIndex );
+ aPoint = SequenceToPosition3D( xTransformation->transform( rBasePoints.P2 ) );
+ AddPointToPoly( rPoints, aPoint, nIndex );
+}
+
+void SAL_CALL VCartesianGrid::createShapes()
+{
+ if( !m_xMeter.is())
+ return;
+ uno::Reference< beans::XPropertySet > xGridProps( m_xMeter, uno::UNO_QUERY );
+ if(!xGridProps.is())
+ return;
+ //somehow equal to axis tickmarks
+
+ //-----------------------------------------
+ //create named group shape
+ uno::Reference< XIdentifiable > xIdent( m_xMeter, uno::UNO_QUERY );
+ if( ! xIdent.is())
+ return;
+
+ uno::Reference< drawing::XShapes > xGroupShape_Shapes(
+ this->createGroupShape( m_xLogicTarget
+ , ObjectIdentifier::createClassifiedIdentifier(
+ OBJECTTYPE_GRID, xIdent->getIdentifier() )
+ ) );
+
+ //-----------------------------------------
+
+ sal_Int32 nDimensionIndex = m_xMeter->getRepresentedDimension();
+ ::std::vector<VLineProperties> aLinePropertiesList;
+ fillLinePropertiesFromGridModel( aLinePropertiesList, xGridProps );
+
+ //-----------------------------------------
+ //create all scaled tickmark values
+ std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() );
+ TickmarkHelper& aTickmarkHelper = *apTickmarkHelper.get();
+ ::std::vector< ::std::vector< TickInfo > > aAllTickInfos;
+ aTickmarkHelper.getAllTicks( aAllTickInfos );
+
+ //-----------------------------------------
+ //create tick mark line shapes
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = aAllTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = aAllTickInfos.end();
+
+ if(aDepthIter == aDepthEnd)//no tickmarks at all
+ return;
+
+ if(2==m_nDimension)
+ {
+ uno::Sequence< double > aMinEdgeSeq, aMaxEdgeSeq;
+ m_pPosHelper->getScreenValuesForMinimum( aMinEdgeSeq );
+ m_pPosHelper->getScreenValuesForMaximum( aMaxEdgeSeq );
+ sal_Int32 nOrthogonalDimensionIndex = nDimensionIndex==1 ? 0 : 1;
+ sal_Int32 nOrthogonalScreenPositionStart=static_cast<sal_Int32>(aMinEdgeSeq[nOrthogonalDimensionIndex]);
+ sal_Int32 nOrthogonalScreenPositionEnd =static_cast<sal_Int32>(aMaxEdgeSeq[nOrthogonalDimensionIndex]);
+
+ drawing::PointSequenceSequence aHandlesPoints(1);
+
+ sal_Int32 nLinePropertiesCount = aLinePropertiesList.size();
+ for( sal_Int32 nDepth=0
+ ; aDepthIter != aDepthEnd && nDepth < nLinePropertiesCount
+ ; aDepthIter++, nDepth++ )
+ {
+ sal_Int32 nPointCount = (*aDepthIter).size();
+ drawing::PointSequenceSequence aPoints(nPointCount);
+
+ ::std::vector< TickInfo >::const_iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ sal_Int32 nRealPointCount = 0;
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ if( !(*aTickIter).bPaintIt )
+ continue;
+ addLine2D( aPoints, nRealPointCount, 1==nDimensionIndex, (*aTickIter).nScreenTickValue
+ , nOrthogonalScreenPositionStart, nOrthogonalScreenPositionEnd );
+ nRealPointCount++;
+ }
+ aPoints.realloc(nRealPointCount);
+ m_pShapeFactory->createLine2D( xGroupShape_Shapes, aPoints, aLinePropertiesList[nDepth] );
+
+ //prepare polygon for handle shape:
+ sal_Int32 nOldHandleCount = aHandlesPoints[0].getLength();
+ aHandlesPoints[0].realloc(nOldHandleCount+nRealPointCount);
+ for( sal_Int32 nN = 0; nN<nRealPointCount; nN++)
+ aHandlesPoints[0][nOldHandleCount+nN] = aPoints[nN][1];
+ }
+
+ //create handle shape:
+ VLineProperties aHandleLineProperties;
+ aHandleLineProperties.LineStyle = uno::makeAny( drawing::LineStyle_NONE );
+ uno::Reference< drawing::XShape > xHandleShape =
+ m_pShapeFactory->createLine2D( xGroupShape_Shapes, aHandlesPoints, aHandleLineProperties );
+ m_pShapeFactory->setShapeName( xHandleShape, C2U("HandlesOnly") );
+ }
+ //-----------------------------------------
+ else //if(2!=m_nDimension)
+ {
+ sal_Int32 nLinePropertiesCount = aLinePropertiesList.size();
+ for( sal_Int32 nDepth=0
+ ; aDepthIter != aDepthEnd && nDepth < nLinePropertiesCount
+ ; aDepthIter++, nDepth++ )
+ {
+ sal_Int32 nPointCount = (*aDepthIter).size();
+ drawing::PolyPolygonShape3D aPoints;
+ aPoints.SequenceX.realloc(nPointCount);
+ aPoints.SequenceY.realloc(nPointCount);
+ aPoints.SequenceZ.realloc(nPointCount);
+ uno::Sequence< double > aLogicMinEdge, aLogicMaxEdge;
+ m_pPosHelper->getLogicMinimum( aLogicMinEdge );
+ m_pPosHelper->getLogicMaximum( aLogicMaxEdge );
+
+ if(!m_pPosHelper->isMathematicalOrientationX())
+ {
+ double fHelp = aLogicMinEdge[0];
+ aLogicMinEdge[0] = aLogicMaxEdge[0];
+ aLogicMaxEdge[0] = fHelp;
+ }
+ if(!m_pPosHelper->isMathematicalOrientationY())
+ {
+ double fHelp = aLogicMinEdge[1];
+ aLogicMinEdge[1] = aLogicMaxEdge[1];
+ aLogicMaxEdge[1] = fHelp;
+ }
+ if(m_pPosHelper->isMathematicalOrientationZ())//z axis in draw is reverse to mathematical
+ {
+ double fHelp = aLogicMinEdge[2];
+ aLogicMinEdge[2] = aLogicMaxEdge[2];
+ aLogicMaxEdge[2] = fHelp;
+ }
+
+ GridLinePoints aGridLinePoints( aLogicMinEdge, aLogicMaxEdge );
+
+ ::std::vector< TickInfo >::const_iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ sal_Int32 nRealPointCount = 0;
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ if( !(*aTickIter).bPaintIt )
+ continue;
+
+ aGridLinePoints.update( (*aTickIter).fScaledTickValue );
+ addLine3D( aPoints, nRealPointCount, aGridLinePoints, m_pPosHelper->getTransformationLogicToScene() );
+ nRealPointCount+=3;
+ }
+ aPoints.SequenceX.realloc(nRealPointCount);
+ aPoints.SequenceY.realloc(nRealPointCount);
+ aPoints.SequenceZ.realloc(nRealPointCount);
+ m_pShapeFactory->createLine3D( xGroupShape_Shapes, aPoints, aLinePropertiesList[nDepth] );
+ }
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VCartesianGrid.hxx b/chart2/source/view/axes/VCartesianGrid.hxx
new file mode 100644
index 000000000000..010a30a4f2c0
--- /dev/null
+++ b/chart2/source/view/axes/VCartesianGrid.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * $RCSfile: VCartesianGrid.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:57 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CHART2_VCARTESIANGRID_HXX
+#define _CHART2_VCARTESIANGRID_HXX
+
+#include "VMeterBase.hxx"
+#include "VLineProperties.hxx"
+
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XGRID_HPP_
+#include <drafts/com/sun/star/chart2/XGrid.hpp>
+#endif
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class VCartesianGrid : public VMeterBase
+{
+//-------------------------------------------------------------------------
+// public methods
+//-------------------------------------------------------------------------
+public:
+ VCartesianGrid( const ::com::sun::star::uno::Reference<
+ ::drafts::com::sun::star::chart2::XGrid >& xGrid
+ , sal_Int32 nDimensionCount );
+ virtual ~VCartesianGrid();
+
+ virtual void SAL_CALL createShapes();
+
+ static void fillLinePropertiesFromGridModel( ::std::vector<VLineProperties>& rLinePropertiesList
+ , ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xProps );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx
index 16a5af0e9dd0..6b48d8397c28 100644
--- a/chart2/source/view/axes/VCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: VCoordinateSystem.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: iha $ $Date: 2003-11-17 19:57:47 $
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,9 +59,17 @@
*
************************************************************************/
#include "VCoordinateSystem.hxx"
+#include "VCartesianCoordinateSystem.hxx"
+#include "VPolarCoordinateSystem.hxx"
#include "ScaleAutomatism.hxx"
#include "VSeriesPlotter.hxx"
-#include "VGrid.hxx"
+#include "ShapeFactory.hxx"
+#include "servicenames_coosystems.hxx"
+
+// header for define DBG_ASSERT
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
//.............................................................................
namespace chart
@@ -70,6 +78,23 @@ namespace chart
using namespace ::com::sun::star;
using namespace ::drafts::com::sun::star::chart2;
+//static
+VCoordinateSystem* VCoordinateSystem::createCoordinateSystem( const uno::Reference<
+ XBoundedCoordinateSystem >& xCooSysModel )
+{
+ rtl::OUString aViewServiceName = xCooSysModel->getViewServiceName();
+
+ //@todo: in future the coordinatesystems should be instanciated via service factory
+ VCoordinateSystem* pRet=NULL;
+ if( aViewServiceName.equals( CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME ) )
+ pRet = new VCartesianCoordinateSystem(xCooSysModel);
+ else if( aViewServiceName.equals( CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME ) )
+ pRet = new VPolarCoordinateSystem(xCooSysModel);
+ if(!pRet)
+ pRet = new VCoordinateSystem(xCooSysModel);
+ return pRet;
+}
+
VCoordinateSystem::VCoordinateSystem( const uno::Reference< XBoundedCoordinateSystem >& xCooSys )
: m_xCooSysModel(xCooSys)
, m_xAxis0(NULL)
@@ -80,11 +105,42 @@ VCoordinateSystem::VCoordinateSystem( const uno::Reference< XBoundedCoordinateSy
, m_xGridList2()
, m_aExplicitScales(3)
, m_aExplicitIncrements(3)
+ , m_xLogicTargetForGrids(0)
+ , m_xLogicTargetForAxes(0)
+ , m_xFinalTarget(0)
+ , m_xShapeFactory(0)
+ , m_aMatrixSceneToScreen()
{
}
VCoordinateSystem::~VCoordinateSystem()
{
+}
+
+void SAL_CALL VCoordinateSystem::initPlottingTargets( const uno::Reference< drawing::XShapes >& xLogicTarget
+ , const uno::Reference< drawing::XShapes >& xFinalTarget
+ , const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory )
+ throw (uno::RuntimeException)
+{
+ DBG_ASSERT(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters");
+ //is only allowed to be called once
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ //create group shape for grids first thus axes are always painted above grids
+ ShapeFactory aShapeFactory(xShapeFactory);
+ if(nDimensionCount==2)
+ {
+ //create and add to target
+ m_xLogicTargetForGrids = aShapeFactory.createGroup2D( xLogicTarget );
+ m_xLogicTargetForAxes = aShapeFactory.createGroup2D( xLogicTarget );
+ }
+ else
+ {
+ //create and added to target
+ m_xLogicTargetForGrids = aShapeFactory.createGroup3D( xLogicTarget );
+ m_xLogicTargetForAxes = aShapeFactory.createGroup3D( xLogicTarget );
+ }
+ m_xFinalTarget = xFinalTarget;
+ m_xShapeFactory = xShapeFactory;
}
void VCoordinateSystem::setOrigin( double* fCoordinateOrigin )
@@ -94,6 +150,12 @@ void VCoordinateSystem::setOrigin( double* fCoordinateOrigin )
m_fCoordinateOrigin[2]=fCoordinateOrigin[2];
}
+void VCoordinateSystem::setTransformationSceneToScreen(
+ const drawing::HomogenMatrix& rMatrix )
+{
+ m_aMatrixSceneToScreen = rMatrix;
+}
+
uno::Reference< XBoundedCoordinateSystem > VCoordinateSystem::getModel() const
{
return m_xCooSysModel;
@@ -133,30 +195,6 @@ void VCoordinateSystem::addGrid( const uno::Reference< XGrid >& xGrid )
rGridList[rGridList.getLength()-1] = xGrid;
}
-void VCoordinateSystem::createGridShapes(
- const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
- , const uno::Reference< drawing::XShapes >& xTarget
- , const drawing::HomogenMatrix& rHM_SceneToScreen )
-{
- sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
- for( sal_Int32 nDim=0; nDim<3; nDim++)
- {
- uno::Sequence< uno::Reference< XGrid > >& rGridList
- = getGridListByDimension( nDim );
- for( sal_Int32 nN=0; nN<rGridList.getLength(); nN++ )
- {
- VGrid aGrid(rGridList[nN],nDimensionCount);
- aGrid.setMeterData( m_aExplicitScales[nDim], m_aExplicitIncrements[nDim] );
-
- aGrid.init(xTarget,xTarget,xShapeFactory);
- if(2==nDimensionCount)
- aGrid.setTransformationSceneToScreen( rHM_SceneToScreen );
- aGrid.setScales( m_aExplicitScales );
- aGrid.createShapes();
- }
- }
-}
-
uno::Reference< XAxis > VCoordinateSystem::getAxisByDimension( sal_Int32 nDim ) const
{
uno::Reference< XAxis > xAxis(NULL);
@@ -201,22 +239,31 @@ void VCoordinateSystem::doAutoScale( MinimumAndMaximumSupplier* pMinMaxSupplier
}
if(0==nDim)
{
- aScaleAutomatism.m_fValueMinimum = pMinMaxSupplier->getMinimumX();
- aScaleAutomatism.m_fValueMaximum = pMinMaxSupplier->getMaximumX();
+ if(pMinMaxSupplier)
+ {
+ aScaleAutomatism.m_fValueMinimum = pMinMaxSupplier->getMinimumX();
+ aScaleAutomatism.m_fValueMaximum = pMinMaxSupplier->getMaximumX();
+ }
}
else if(1==nDim)
{
- const ExplicitScaleData& rScale = m_aExplicitScales[0];
- //@todo iterate through all xSlots which belong to coordinate system dimension in this plotter
- //and iterate through all plotter for this coordinate system dimension
- sal_Int32 nXSlotIndex = 0;
- aScaleAutomatism.m_fValueMinimum = pMinMaxSupplier->getMinimumYInRange(rScale.Minimum,rScale.Maximum);
- aScaleAutomatism.m_fValueMaximum = pMinMaxSupplier->getMaximumYInRange(rScale.Minimum,rScale.Maximum);
+ if(pMinMaxSupplier)
+ {
+ const ExplicitScaleData& rScale = m_aExplicitScales[0];
+ //@todo iterate through all xSlots which belong to coordinate system dimension in this plotter
+ //and iterate through all plotter for this coordinate system dimension
+ sal_Int32 nXSlotIndex = 0;
+ aScaleAutomatism.m_fValueMinimum = pMinMaxSupplier->getMinimumYInRange(rScale.Minimum,rScale.Maximum);
+ aScaleAutomatism.m_fValueMaximum = pMinMaxSupplier->getMaximumYInRange(rScale.Minimum,rScale.Maximum);
+ }
}
else if(2==nDim)
{
- aScaleAutomatism.m_fValueMinimum = pMinMaxSupplier->getMinimumZ();
- aScaleAutomatism.m_fValueMaximum = pMinMaxSupplier->getMaximumZ();
+ if(pMinMaxSupplier)
+ {
+ aScaleAutomatism.m_fValueMinimum = pMinMaxSupplier->getMinimumZ();
+ aScaleAutomatism.m_fValueMaximum = pMinMaxSupplier->getMaximumZ();
+ }
}
aScaleAutomatism.calculateExplicitScaleAndIncrement(
m_aExplicitScales[nDim], m_aExplicitIncrements[nDim] );
@@ -225,6 +272,13 @@ void VCoordinateSystem::doAutoScale( MinimumAndMaximumSupplier* pMinMaxSupplier
setExplicitScaleToDefault(m_aExplicitScales[2]);
}
+void VCoordinateSystem::createGridShapes()
+{
+}
+void VCoordinateSystem::createAxesShapes( const ::com::sun::star::awt::Size& rReferenceSize, NumberFormatterWrapper* pNumberFormatterWrapper )
+{
+}
+
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/chart2/source/view/axes/VPolarAxis.cxx b/chart2/source/view/axes/VPolarAxis.cxx
new file mode 100644
index 000000000000..833a61518126
--- /dev/null
+++ b/chart2/source/view/axes/VPolarAxis.cxx
@@ -0,0 +1,360 @@
+/*************************************************************************
+ *
+ * $RCSfile: VPolarAxis.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "VPolarAxis.hxx"
+#include "VPolarGrid.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "ViewDefines.hxx"
+#include "TickmarkHelper.hxx"
+#include "PropertyMapper.hxx"
+#include "chartview/NumberFormatterWrapper.hxx"
+#include "chartview/ObjectIdentifier.hxx"
+#include "PolarLabelPositionHelper.hxx"
+
+#ifndef INCLUDED_RTL_MATH_HXX
+#include <rtl/math.hxx>
+#endif
+#ifndef _TOOLS_COLOR_HXX
+#include <tools/color.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_PARAGRAPHADJUST_HPP_
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TEXT_XTEXT_HPP_
+#include <com/sun/star/text/XText.hpp>
+#endif
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XIDENTIFIABLE_HPP_
+#include <drafts/com/sun/star/chart2/XIdentifiable.hpp>
+#endif
+
+#ifndef _SVX_UNOPRNMS_HXX
+#include <svx/unoprnms.hxx>
+#endif
+
+#include <algorithm>
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star::chart2;
+using namespace ::rtl::math;
+
+VPolarAxis::VPolarAxis( const AxisProperties& rAxisProperties
+ , NumberFormatterWrapper* pNumberFormatterWrapper
+ , sal_Int32 nDimensionCount )
+ : VMeterBase( uno::Reference<XMeter>::query(rAxisProperties.m_xAxisModel)
+ , nDimensionCount )
+ , m_aAxisProperties( rAxisProperties )
+ , m_pNumberFormatterWrapper( pNumberFormatterWrapper )
+ , m_pPosHelper( new PolarPlottingPositionHelper(false) )
+{
+ PlotterBase::m_pPosHelper = m_pPosHelper;
+}
+
+VPolarAxis::~VPolarAxis()
+{
+ delete m_pPosHelper;
+ m_pPosHelper = NULL;
+}
+
+bool createTextShapes_ForAngleAxis( const uno::Reference< lang::XMultiServiceFactory >& xShapeFactory
+ , const uno::Reference< drawing::XShapes >& xTarget
+ , ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos
+ , const ExplicitIncrementData& rIncrement
+ , AxisLabelProperties& rAxisLabelProperties
+ , const AxisProperties& rAxisProperties
+ , PolarPlottingPositionHelper* pPosHelper
+ , double fLogicRadius
+ , double fLogicZ
+ , const FixedNumberFormatter& rFixedNumberFormatter )
+{
+ sal_Int32 nDimensionCount = 2;
+ ShapeFactory aShapeFactory(xShapeFactory);
+
+ //------------------------------------------------
+ //prepare text properties for multipropertyset-interface of shape
+ tNameSequence aPropNames;
+ tAnySequence aPropValues;
+
+ uno::Reference< beans::XPropertySet > xProps( rAxisProperties.m_xAxisModel, uno::UNO_QUERY );
+ PropertyMapper::getTextLabelMultiPropertyLists( xProps, aPropNames, aPropValues, false );
+ LabelPositionHelper::doDynamicFontResize( aPropValues, aPropNames, xProps
+ , rAxisProperties.m_aReferenceSize );
+
+ uno::Any* pColorAny = PropertyMapper::getValuePointer(aPropValues,aPropNames,C2U("CharColor"));
+ sal_Int32 nColor = Color( COL_AUTO ).GetColor();
+ if(pColorAny)
+ *pColorAny >>= nColor;
+ //------------------------------------------------
+
+ //TickInfo* pLastVisibleNeighbourTickInfo = NULL;
+ sal_Int32 nTick = 0;
+ TickIter aIter( rAllTickInfos, rIncrement, 0, 0 );
+ for( TickInfo* pTickInfo = aIter.firstInfo()
+ ; pTickInfo
+ ; pTickInfo = aIter.nextInfo(), nTick++ )
+ {
+ //don't create labels which does not fit into the rythm
+ if( nTick%rAxisLabelProperties.nRhythm != 0)
+ continue;
+
+ //don't create labels for invisible ticks
+ if( !pTickInfo->bPaintIt )
+ continue;
+
+ //if NO OVERLAP -> don't create labels where the
+ //anchor position is the same as for the last label
+ //@todo
+ /*
+ if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
+ {
+ if( lcl_doesOverlap( pLastVisibleNeighbourTickInfo->xTextShape, pTickInfo->nScreenTickValue, bOverlapCheckDirectionIsY ) )
+ {
+ if( rAxisLabelProperties.bRhythmIsFix )
+ continue;
+ rAxisLabelProperties.nRhythm++;
+ TickIter aRemoveIter( rAllTickInfos, rIncrement, 0, 0 );
+ removeShapesAtWrongRythm( aRemoveIter, rAxisLabelProperties.nRhythm, nTick, xTarget );
+ return false;
+ }
+ }
+ */
+
+ if(!pTickInfo->xTextShape.is())
+ {
+ //create single label
+ bool bHasExtraColor=false;
+ sal_Int32 nExtraColor=0;
+ rtl::OUString aLabel = rFixedNumberFormatter.getFormattedString( pTickInfo->fUnscaledTickValue, nExtraColor, bHasExtraColor );
+ if(pColorAny)
+ *pColorAny = uno::makeAny(bHasExtraColor?nExtraColor:nColor);
+
+ double fLogicAngle = pTickInfo->fUnscaledTickValue;
+
+ LabelAlignment eLabelAlignment(LABEL_ALIGN_CENTER);
+ PolarLabelPositionHelper aPolarLabelPositionHelper(pPosHelper,nDimensionCount,xTarget,&aShapeFactory);
+ awt::Point aAnchorScreenPosition2D( aPolarLabelPositionHelper.getLabelScreenPositionAndAlignment(
+ eLabelAlignment, true, fLogicAngle, fLogicAngle, fLogicRadius, fLogicRadius, fLogicZ ));
+ LabelPositionHelper::changeTextAdjustment( aPropValues, aPropNames, eLabelAlignment );
+
+ double fRotationAnglePi = rAxisLabelProperties.fRotationAngleDegree*F_PI/180.0;
+ uno::Any aATransformation = ShapeFactory::makeTransformation( aAnchorScreenPosition2D, fRotationAnglePi );
+ rtl::OUString aStackedLabel = ShapeFactory::getStackedString( aLabel, rAxisLabelProperties.bStackCharacters );
+
+ pTickInfo->xTextShape = aShapeFactory.createText( xTarget, aStackedLabel, aPropNames, aPropValues, aATransformation );
+ }
+
+ //if NO OVERLAP -> remove overlapping shapes
+ //@todo
+ /*
+ if( pLastVisibleNeighbourTickInfo && !rAxisLabelProperties.bOverlapAllowed )
+ {
+ if( doesOverlap( pLastVisibleNeighbourTickInfo->xTextShape, pTickInfo->xTextShape, bOverlapCheckDirectionIsY ) )
+ {
+ if( rAxisLabelProperties.bRhythmIsFix )
+ {
+ xTarget->remove(pTickInfo->xTextShape);
+ pTickInfo->xTextShape = NULL;
+ continue;
+ }
+ rAxisLabelProperties.nRhythm++;
+ TickIter aRemoveIter( rAllTickInfos, rIncrement, 0, 0 );
+ removeShapesAtWrongRythm( aRemoveIter, rAxisLabelProperties.nRhythm, nTick, xTarget );
+ return false;
+ }
+ }
+ */
+ //pLastVisibleNeighbourTickInfo = pTickInfo;
+ }
+ return true;
+}
+
+void VPolarAxis::create2DAngleAxis( const uno::Reference< drawing::XShapes >& xTarget, ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos )
+{
+ double fLogicRadius = m_pPosHelper->getOuterLogicRadius();
+ double fLogicZ = -0.5;//as defined
+
+ //-----------------------------------------
+ //create axis main lines
+ drawing::PointSequenceSequence aPoints(1);
+ VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, rAllTickInfos, m_aIncrement, m_aScale, m_pPosHelper, fLogicRadius, fLogicZ );
+ uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ xTarget, aPoints, m_aAxisProperties.m_aLineProperties );
+ //because of this name this line will be used for marking the axis
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+
+ //-----------------------------------------
+ //create labels
+ AxisLabelProperties aAxisLabelProperties;
+ aAxisLabelProperties.init(m_aAxisProperties.m_xAxisModel);
+ if( aAxisLabelProperties.bDisplayLabels )
+ {
+ FixedNumberFormatter aFixedNumberFormatter(
+ m_pNumberFormatterWrapper, aAxisLabelProperties.aNumberFormat );
+
+ while( !createTextShapes_ForAngleAxis( m_xShapeFactory, xTarget, rAllTickInfos
+ , m_aIncrement, aAxisLabelProperties, m_aAxisProperties, m_pPosHelper
+ , fLogicRadius, fLogicZ
+ , aFixedNumberFormatter
+ ) )
+ {
+ };
+
+ //no staggering for polar angle axis
+ }
+}
+
+void VPolarAxis::create2DRadiusAxis( const uno::Reference< drawing::XShapes >& xTarget, ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos )
+{
+ /*
+ sal_Int32 nTickmarkPropertiesCount = m_aAxisProperties.m_aTickmarkPropertiesList.size();
+ for( sal_Int32 nDepth=0
+ ; aDepthIter != aDepthEnd && nDepth < nTickmarkPropertiesCount
+ ; aDepthIter++, nDepth++ )
+ {
+ const TickmarkProperties& rTickmarkProperties = m_aAxisProperties.m_aTickmarkPropertiesList[nDepth];
+
+ sal_Int32 nPointCount = (*aDepthIter).size();
+ drawing::PointSequenceSequence aPoints(nPointCount);
+
+ ::std::vector< TickInfo >::const_iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ sal_Int32 nN = 0;
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ if( !(*aTickIter).bPaintIt )
+ continue;
+ //addLine( aPoints, nN
+ // , (*aTickIter).nScreenTickValue, nMainLineScreenPosition
+ // , rTickmarkProperties, bIsRadiusAxis);
+
+ nN++;
+ }
+ aPoints.realloc(nN);
+ m_pShapeFactory->createLine2D( xGroupShape_Shapes, aPoints
+ , rTickmarkProperties.aLineProperties );
+ }
+
+ //-----------------------------------------
+ //create all scaled tickmark values
+ std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() );
+ ::std::vector< ::std::vector< TickInfo > > aAllTickInfos;
+ apTickmarkHelper->getAllTicks( aAllTickInfos );
+
+ //-----------------------------------------
+ //create tick mark line shapes
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = aAllTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = aAllTickInfos.end();
+
+ if(aDepthIter == aDepthEnd)//no tickmarks at all
+ return;
+ */
+}
+
+void SAL_CALL VPolarAxis::createShapes()
+{
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"Axis is not proper initialized");
+ if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ return;
+
+ m_aAxisProperties.init();
+
+ //-----------------------------------------
+ //create named group shape
+ uno::Reference< XIdentifiable > xIdent( m_aAxisProperties.m_xAxisModel, uno::UNO_QUERY );
+ DBG_ASSERT( xIdent.is(), "Axis should support XIdentifiable" );
+ if( ! xIdent.is())
+ return;
+ uno::Reference< drawing::XShapes > xGroupShape_Shapes(
+ m_pShapeFactory->createGroup2D( m_xLogicTarget
+ , ObjectIdentifier::createClassifiedIdentifier(
+ OBJECTTYPE_AXIS, xIdent->getIdentifier() )
+ ) );
+
+ //-----------------------------------------
+ //create all scaled tickmark values
+ std::auto_ptr< TickmarkHelper > apTickmarkHelper( this->createTickmarkHelper() );
+ ::std::vector< ::std::vector< TickInfo > > aAllTickInfos;
+ apTickmarkHelper->getAllTicks( aAllTickInfos );
+
+ //-----------------------------------------
+ //create different axes
+ if(2==m_nDimension)
+ {
+ sal_Int32 nDimensionIndex = m_xMeter->getRepresentedDimension();
+ if(nDimensionIndex==1)
+ this->create2DRadiusAxis( xGroupShape_Shapes, aAllTickInfos );
+ else
+ this->create2DAngleAxis( xGroupShape_Shapes, aAllTickInfos );
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VPolarAxis.hxx b/chart2/source/view/axes/VPolarAxis.hxx
new file mode 100644
index 000000000000..1ee108bf3c80
--- /dev/null
+++ b/chart2/source/view/axes/VPolarAxis.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * $RCSfile: VPolarAxis.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:58 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CHART2_VPOLARAXIS_HXX
+#define _CHART2_VPOLARAXIS_HXX
+
+#include "TickmarkHelper.hxx"
+#include "VMeterBase.hxx"
+#include "VAxisProperties.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+
+class NumberFormatterWrapper;
+class PolarPlottingPositionHelper;
+
+class VPolarAxis : public VMeterBase
+{
+public:
+ VPolarAxis( const AxisProperties& rAxisProperties
+ , NumberFormatterWrapper* pNumberFormatterWrapper
+ , sal_Int32 nDimensionCount=2 );
+ virtual ~VPolarAxis();
+
+ virtual void SAL_CALL createShapes();
+
+private: //methods
+ void create2DAngleAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget, ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos );
+ void create2DRadiusAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget, ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos );
+
+private: //member
+ AxisProperties m_aAxisProperties;
+ NumberFormatterWrapper* m_pNumberFormatterWrapper;
+ PolarPlottingPositionHelper* m_pPosHelper;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.cxx b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
new file mode 100644
index 000000000000..d2f5d4e08610
--- /dev/null
+++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * $RCSfile: VPolarCoordinateSystem.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "VPolarCoordinateSystem.hxx"
+#include "VPolarGrid.hxx"
+#include "VPolarAxis.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star::chart2;
+
+VPolarCoordinateSystem::VPolarCoordinateSystem( const uno::Reference< XBoundedCoordinateSystem >& xCooSys )
+ : VCoordinateSystem(xCooSys)
+{
+}
+
+VPolarCoordinateSystem::~VPolarCoordinateSystem()
+{
+}
+
+void VPolarCoordinateSystem::createGridShapes()
+{
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ for( sal_Int32 nDim=0; nDim<3; nDim++)
+ {
+ uno::Sequence< uno::Reference< XGrid > >& rGridList
+ = getGridListByDimension( nDim );
+ for( sal_Int32 nN=0; nN<rGridList.getLength(); nN++ )
+ {
+ VPolarGrid aGrid(rGridList[nN],nDimensionCount);
+ aGrid.setIncrements( m_aExplicitIncrements );
+
+ aGrid.init(m_xLogicTargetForGrids,m_xFinalTarget,m_xShapeFactory);
+ if(2==nDimensionCount)
+ aGrid.setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ aGrid.setScales( m_aExplicitScales );
+ aGrid.createShapes();
+ }
+ }
+}
+
+void VPolarCoordinateSystem::createAxesShapes( const awt::Size& rReferenceSize, NumberFormatterWrapper* pNumberFormatterWrapper )
+{
+ sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
+ double fCoordinateOrigin[3] = { 0.0, 0.0, 0.0 };
+ for( sal_Int32 nDim = 0; nDim < 3; nDim++ )
+ fCoordinateOrigin[nDim] = this->getOriginByDimension( nDim );
+ //create angle axis (dimension index 0)
+ nDim = 0;
+ {
+ uno::Reference< XAxis > xAxis = this->getAxisByDimension(0);
+ AxisProperties aAxisProperties;
+ aAxisProperties.m_xAxisModel = xAxis;
+ aAxisProperties.m_pfExrtaLinePositionAtOtherAxis =
+ new double(nDim==1?fCoordinateOrigin[0]:fCoordinateOrigin[1]);
+ aAxisProperties.m_aReferenceSize = rReferenceSize;
+ //-------------------
+ VPolarAxis aAxis(aAxisProperties,pNumberFormatterWrapper);
+ aAxis.setMeterData( m_aExplicitScales[nDim], m_aExplicitIncrements[nDim] );
+ aAxis.init(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory);
+ if(2==nDimensionCount)
+ aAxis.setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ aAxis.setScales( m_aExplicitScales );
+ aAxis.createShapes();
+ }
+
+ /*
+ for( nDim = 0; nDim < 3; nDim++ )
+ {
+ uno::Reference< XAxis > xAxis = this->getAxisByDimension(nDim);
+ if(xAxis.is()
+ &&2==nDimensionCount) //@todo remove this restriction if 3D axes are available
+ {
+ AxisProperties aAxisProperties;
+ aAxisProperties.m_xAxisModel = xAxis;
+ aAxisProperties.m_pfExrtaLinePositionAtOtherAxis =
+ new double(nDim==1?fCoordinateOrigin[0]:fCoordinateOrigin[1]);
+ aAxisProperties.m_aReferenceSize = rReferenceSize;
+ //-------------------
+ VAxis aAxis(aAxisProperties,pNumberFormatterWrapper);
+ aAxis.setMeterData( m_aExplicitScales[nDim], m_aExplicitIncrements[nDim] );
+ aAxis.init(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory);
+ if(2==nDimensionCount)
+ aAxis.setTransformationSceneToScreen( m_aMatrixSceneToScreen );
+ aAxis.setScales( m_aExplicitScales );
+ aAxis.createShapes();
+ }
+ }
+ */
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.hxx b/chart2/source/view/axes/VPolarCoordinateSystem.hxx
new file mode 100644
index 000000000000..61ba559fad76
--- /dev/null
+++ b/chart2/source/view/axes/VPolarCoordinateSystem.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: VPolarCoordinateSystem.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CHART2_VPOLAR_COORDINATESYSTEM_HXX
+#define _CHART2_VPOLAR_COORDINATESYSTEM_HXX
+
+#include "VCoordinateSystem.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class VPolarCoordinateSystem : public VCoordinateSystem
+{
+public:
+ VPolarCoordinateSystem( const ::com::sun::star::uno::Reference<
+ ::drafts::com::sun::star::chart2::XBoundedCoordinateSystem >& xCooSys );
+ virtual ~VPolarCoordinateSystem();
+
+ virtual void createGridShapes();
+ virtual void createAxesShapes( const ::com::sun::star::awt::Size& rReferenceSize, NumberFormatterWrapper* pNumberFormatterWrapper );
+
+private:
+ VPolarCoordinateSystem();
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/VPolarGrid.cxx b/chart2/source/view/axes/VPolarGrid.cxx
new file mode 100644
index 000000000000..ea0b104ca9a5
--- /dev/null
+++ b/chart2/source/view/axes/VPolarGrid.cxx
@@ -0,0 +1,303 @@
+/*************************************************************************
+ *
+ * $RCSfile: VPolarGrid.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:09:59 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "VPolarGrid.hxx"
+#include "VCartesianGrid.hxx"
+#include "TickmarkHelper.hxx"
+#include "PlottingPositionHelper.hxx"
+#include "ShapeFactory.hxx"
+#include "chartview/ObjectIdentifier.hxx"
+#include "macros.hxx"
+#include "CommonConverters.hxx"
+
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XIDENTIFIABLE_HPP_
+#include <drafts/com/sun/star/chart2/XIdentifiable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DRAWING_LINESTYLE_HPP_
+#include <com/sun/star/drawing/LineStyle.hpp>
+#endif
+
+#include <vector>
+#include <memory>
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star::chart2;
+
+VPolarGrid::VPolarGrid( const uno::Reference< XGrid >& xGrid, sal_Int32 nDimensionCount )
+ : VMeterBase( uno::Reference<XMeter>::query(xGrid), nDimensionCount )
+ , m_pPosHelper( new PolarPlottingPositionHelper(false) )
+{
+ PlotterBase::m_pPosHelper = m_pPosHelper;
+}
+
+VPolarGrid::~VPolarGrid()
+{
+ delete m_pPosHelper;
+ m_pPosHelper = NULL;
+}
+
+void VPolarGrid::setIncrements( const uno::Sequence< ExplicitIncrementData >& rIncrements )
+{
+ m_aIncrements = rIncrements;
+}
+
+void VPolarGrid::getAllTickInfos( sal_Int32 nDimensionIndex, ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const
+{
+ TickmarkHelper_2D aTickmarkHelper(
+ m_pPosHelper->getScales()[nDimensionIndex], m_aIncrements[nDimensionIndex]
+ , m_aMatrixScreenToScene[nDimensionIndex][nDimensionIndex]
+ , m_aMatrixScreenToScene[nDimensionIndex][3]
+ );
+ aTickmarkHelper.getAllTicks( rAllTickInfos );
+}
+
+//static
+void VPolarGrid::createLinePointSequence_ForAngleAxis(
+ drawing::PointSequenceSequence& rPoints
+ , ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos
+ , const ExplicitIncrementData& rIncrement
+ , const ExplicitScaleData& rScale
+ , PolarPlottingPositionHelper* pPosHelper
+ , double fLogicRadius, double fLogicZ )
+{
+ uno::Reference< XScaling > xInverseScaling( NULL );
+ if( rScale.Scaling.is() )
+ xInverseScaling = rScale.Scaling->getInverseScaling();
+
+ sal_Int32 nTick = 0;
+ TickIter aIter( rAllTickInfos, rIncrement, 0, 0 );
+ for( TickInfo* pTickInfo = aIter.firstInfo()
+ ; pTickInfo
+ ; pTickInfo = aIter.nextInfo(), nTick++ )
+ {
+ if(nTick>=rPoints[0].getLength())
+ rPoints[0].realloc(rPoints.getLength()+30);
+
+ pTickInfo->updateUnscaledValue( xInverseScaling );
+ double fLogicAngle = pTickInfo->fUnscaledTickValue;
+
+ drawing::Position3D aScenePosition3D( pPosHelper->transformLogicToScene( fLogicAngle, fLogicRadius, fLogicZ ) );
+ rPoints[0][nTick].X = static_cast<sal_Int32>(aScenePosition3D.PositionX);
+ rPoints[0][nTick].Y = static_cast<sal_Int32>(aScenePosition3D.PositionY);
+ }
+ if(rPoints.getLength()>1)
+ {
+ rPoints[0].realloc(nTick+1);
+ rPoints[0][nTick].X = rPoints[0][0].X;
+ rPoints[0][nTick].Y = rPoints[0][0].Y;
+ }
+ else
+ rPoints[0].realloc(nTick);
+}
+
+void VPolarGrid::create2DAngleGrid( const uno::Reference< drawing::XShapes >& xTarget
+ , ::std::vector< ::std::vector< TickInfo > >& rRadiusTickInfos
+ , ::std::vector< ::std::vector< TickInfo > >& rAngleTickInfos
+ , const ::std::vector<VLineProperties>& rLinePropertiesList )
+{
+ const ExplicitScaleData& rAngleScale = m_pPosHelper->getScales()[0];
+ const ExplicitIncrementData& rAngleIncrement = m_aIncrements[0];
+ uno::Reference< XScaling > xInverseScaling( NULL );
+ if( rAngleScale.Scaling.is() )
+ xInverseScaling = rAngleScale.Scaling->getInverseScaling();
+
+ double fLogicInnerRadius = m_pPosHelper->getInnerLogicRadius();
+ double fLogicOuterRadius = m_pPosHelper->getOuterLogicRadius();
+ double fLogicZ = -0.5;//as defined
+
+ sal_Int32 nLinePropertiesCount = rLinePropertiesList.size();
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = rAngleTickInfos.begin();
+ sal_Int32 nDepth=0;
+ /*
+ //no subgrids so far for polar angle grid (need different radii)
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = rAngleTickInfos.end();
+ for( ; aDepthIter != aDepthEnd && nDepth < nLinePropertiesCount
+ ; aDepthIter++, nDepth++ )
+ */
+ if(nLinePropertiesCount)
+ {
+ //create axis main lines
+ drawing::PointSequenceSequence aAllPoints(1);
+ ::std::vector< TickInfo >::iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ sal_Int32 nRealPointCount = 0;
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ TickInfo& rTickInfo = *aTickIter;
+ if( !rTickInfo.bPaintIt )
+ continue;
+
+ rTickInfo.updateUnscaledValue( xInverseScaling );
+ double fLogicAngle = rTickInfo.fUnscaledTickValue;
+
+ drawing::PointSequenceSequence aPoints(1);
+ aPoints[0].realloc(2);
+ drawing::Position3D aScenePositionStart( m_pPosHelper->transformLogicToScene( fLogicAngle, fLogicInnerRadius, fLogicZ ) );
+ drawing::Position3D aScenePositionEnd( m_pPosHelper->transformLogicToScene( fLogicAngle, fLogicOuterRadius, fLogicZ ) );
+ aPoints[0][0].X = static_cast<sal_Int32>(aScenePositionStart.PositionX);
+ aPoints[0][0].Y = static_cast<sal_Int32>(aScenePositionStart.PositionY);
+ aPoints[0][1].X = static_cast<sal_Int32>(aScenePositionEnd.PositionX);
+ aPoints[0][1].Y = static_cast<sal_Int32>(aScenePositionEnd.PositionY);
+ appendPointSequence( aAllPoints, aPoints );
+ }
+
+ uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ xTarget, aAllPoints, rLinePropertiesList[nDepth] );
+ //because of this name this line will be used for marking
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ }
+}
+
+void VPolarGrid::create2DRadiusGrid( const uno::Reference< drawing::XShapes >& xTarget
+ , ::std::vector< ::std::vector< TickInfo > >& rRadiusTickInfos
+ , ::std::vector< ::std::vector< TickInfo > >& rAngleTickInfos
+ , const ::std::vector<VLineProperties>& rLinePropertiesList )
+{
+ const ExplicitScaleData& rRadiusScale = m_pPosHelper->getScales()[1];
+ const ExplicitIncrementData& rRadiusIncrement = m_aIncrements[1];
+ uno::Reference< XScaling > xInverseScaling( NULL );
+ if( rRadiusScale.Scaling.is() )
+ xInverseScaling = rRadiusScale.Scaling->getInverseScaling();
+
+ sal_Int32 nLinePropertiesCount = rLinePropertiesList.size();
+ ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = rRadiusTickInfos.begin();
+ const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = rRadiusTickInfos.end();
+ for( sal_Int32 nDepth=0
+ ; aDepthIter != aDepthEnd && nDepth < nLinePropertiesCount
+ ; aDepthIter++, nDepth++ )
+ {
+ //create axis main lines
+ drawing::PointSequenceSequence aAllPoints(1);
+ ::std::vector< TickInfo >::iterator aTickIter = (*aDepthIter).begin();
+ const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end();
+ sal_Int32 nRealPointCount = 0;
+ for( ; aTickIter != aTickEnd; aTickIter++ )
+ {
+ TickInfo& rTickInfo = *aTickIter;
+ if( !rTickInfo.bPaintIt )
+ continue;
+
+ rTickInfo.updateUnscaledValue( xInverseScaling );
+ double fLogicRadius = rTickInfo.fUnscaledTickValue;
+ double fLogicZ = -0.5;//as defined
+
+ drawing::PointSequenceSequence aPoints(1);
+ VPolarGrid::createLinePointSequence_ForAngleAxis( aPoints, rAngleTickInfos
+ , rRadiusIncrement, rRadiusScale, m_pPosHelper, fLogicRadius, fLogicZ );
+ appendPointSequence( aAllPoints, aPoints );
+ }
+
+ uno::Reference< drawing::XShape > xShape = m_pShapeFactory->createLine2D(
+ xTarget, aAllPoints, rLinePropertiesList[nDepth] );
+ //because of this name this line will be used for marking
+ m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
+ }
+}
+
+void SAL_CALL VPolarGrid::createShapes()
+{
+ DBG_ASSERT(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"Axis is not proper initialized");
+ if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ return;
+ if( !m_xMeter.is())
+ return;
+ uno::Reference< beans::XPropertySet > xGridProps( m_xMeter, uno::UNO_QUERY );
+ if(!xGridProps.is())
+ return;
+
+ //-----------------------------------------
+ //create named group shape
+ uno::Reference< XIdentifiable > xIdent( m_xMeter, uno::UNO_QUERY );
+ if( ! xIdent.is())
+ return;
+
+ uno::Reference< drawing::XShapes > xTarget(
+ this->createGroupShape( m_xLogicTarget
+ , ObjectIdentifier::createClassifiedIdentifier(
+ OBJECTTYPE_GRID, xIdent->getIdentifier() )
+ ) );
+
+ //-----------------------------------------
+ //create all scaled tickmark values
+ ::std::vector< ::std::vector< TickInfo > > aAngleTickInfos;
+ ::std::vector< ::std::vector< TickInfo > > aRadiusTickInfos;
+ getAllTickInfos( 0, aAngleTickInfos );
+ getAllTickInfos( 1, aRadiusTickInfos );
+
+ //-----------------------------------------
+ ::std::vector<VLineProperties> aLinePropertiesList;
+ VCartesianGrid::fillLinePropertiesFromGridModel( aLinePropertiesList, xGridProps );
+
+ //-----------------------------------------
+ //create tick mark line shapes
+ sal_Int32 nDimensionIndex = m_xMeter->getRepresentedDimension();
+ if(nDimensionIndex==1)
+ this->create2DRadiusGrid( xTarget, aRadiusTickInfos, aAngleTickInfos, aLinePropertiesList );
+ else
+ this->create2DAngleGrid( xTarget, aRadiusTickInfos, aAngleTickInfos, aLinePropertiesList );
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/view/axes/VPolarGrid.hxx b/chart2/source/view/axes/VPolarGrid.hxx
new file mode 100644
index 000000000000..92f463f78dbf
--- /dev/null
+++ b/chart2/source/view/axes/VPolarGrid.hxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * $RCSfile: VPolarGrid.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: iha $ $Date: 2004-01-17 13:10:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CHART2_VPOLARGRID_HXX
+#define _CHART2_VPOLARGRID_HXX
+
+#include "VMeterBase.hxx"
+#include "TickmarkHelper.hxx"
+#include "VLineProperties.hxx"
+
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XGRID_HPP_
+#include <drafts/com/sun/star/chart2/XGrid.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_DRAWING_POINTSEQUENCESEQUENCE_HPP_
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#endif
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+//-----------------------------------------------------------------------------
+/**
+*/
+class PolarPlottingPositionHelper;
+
+class VPolarGrid : public VMeterBase
+{
+//-------------------------------------------------------------------------
+// public methods
+//-------------------------------------------------------------------------
+public:
+ VPolarGrid( const ::com::sun::star::uno::Reference<
+ ::drafts::com::sun::star::chart2::XGrid >& xGrid
+ , sal_Int32 nDimensionCount );
+ virtual ~VPolarGrid();
+
+ virtual void SAL_CALL createShapes();
+
+ void setIncrements( const ::com::sun::star::uno::Sequence<
+ ::drafts::com::sun::star::chart2::ExplicitIncrementData >& rIncrements );
+
+ static void createLinePointSequence_ForAngleAxis(
+ ::com::sun::star::drawing::PointSequenceSequence& rPoints
+ , ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos
+ , const ::drafts::com::sun::star::chart2::ExplicitIncrementData& rIncrement
+ , const ::drafts::com::sun::star::chart2::ExplicitScaleData& rScale
+ , PolarPlottingPositionHelper* pPosHelper
+ , double fLogicRadius, double fLogicZ );
+
+private: //member
+ PolarPlottingPositionHelper* m_pPosHelper;
+ ::com::sun::star::uno::Sequence<
+ ::drafts::com::sun::star::chart2::ExplicitIncrementData > m_aIncrements;
+
+ void getAllTickInfos( sal_Int32 nDimensionIndex, ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const;
+
+ void create2DRadiusGrid( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , ::std::vector< ::std::vector< TickInfo > >& rRadiusTickInfos
+ , ::std::vector< ::std::vector< TickInfo > >& rAngleTickInfos
+ , const ::std::vector<VLineProperties>& rLinePropertiesList );
+ void create2DAngleGrid( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , ::std::vector< ::std::vector< TickInfo > >& rRadiusTickInfos
+ , ::std::vector< ::std::vector< TickInfo > >& rAngleTickInfos
+ , const ::std::vector<VLineProperties>& rLinePropertiesList );
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/view/axes/makefile.mk b/chart2/source/view/axes/makefile.mk
index dd0fac9cff24..4117a7dc299f 100644
--- a/chart2/source/view/axes/makefile.mk
+++ b/chart2/source/view/axes/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1.1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: bm $ $Date: 2003-10-06 09:58:33 $
+# last change: $Author: iha $ $Date: 2004-01-17 13:10:00 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -81,10 +81,14 @@ SLOFILES = \
$(SLO)$/VMeterBase.obj \
$(SLO)$/TickmarkHelper.obj \
$(SLO)$/ScaleAutomatism.obj \
- $(SLO)$/VCoordinateSystem.obj \
$(SLO)$/VAxisProperties.obj \
- $(SLO)$/VAxis.obj \
- $(SLO)$/VGrid.obj
+ $(SLO)$/VCartesianAxis.obj \
+ $(SLO)$/VCartesianGrid.obj \
+ $(SLO)$/VCartesianCoordinateSystem.obj \
+ $(SLO)$/VPolarAxis.obj \
+ $(SLO)$/VPolarGrid.obj \
+ $(SLO)$/VPolarCoordinateSystem.obj \
+ $(SLO)$/VCoordinateSystem.obj
# --- Targets -----------------------------------------------------------------