Kaydet (Commit) bd363380 authored tarafından Ingrid Halama [iha]'s avatar Ingrid Halama [iha]

chart46: #i25706# implement date axis - simplify axis access in chart api

üst 87e71d01
......@@ -29,10 +29,15 @@
#include "precompiled_chart2.hxx"
#include "AxisWrapper.hxx"
#include "AxisHelper.hxx"
#include "TitleHelper.hxx"
#include "Chart2ModelContact.hxx"
#include "ContainerHelper.hxx"
#include "macros.hxx"
#include "WrappedDirectStateProperty.hxx"
#include "GridWrapper.hxx"
#include "TitleWrapper.hxx"
#include "DisposeHelper.hxx"
#include <comphelper/InlineContainer.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
......@@ -84,6 +89,7 @@ enum
PROP_AXIS_AUTO_STEPHELP,
PROP_AXIS_TYPE,
PROP_AXIS_TIME_INCREMENT,
PROP_AXIS_EXPLICIT_TIME_INCREMENT,
PROP_AXIS_LOGARITHMIC,
PROP_AXIS_REVERSEDIRECTION,
PROP_AXIS_VISIBLE,
......@@ -189,6 +195,13 @@ void lcl_AddPropertiesToVector(
//#i111967# no PropertyChangeEvent is fired on change so far
beans::PropertyAttribute::MAYBEVOID ));
rOutProperties.push_back(
Property( C2U( "ExplicitTimeIncrement" ),
PROP_AXIS_EXPLICIT_TIME_INCREMENT,
::getCppuType( reinterpret_cast< const ::com::sun::star::chart::TimeIncrement * >(0)),
beans::PropertyAttribute::READONLY |
beans::PropertyAttribute::MAYBEVOID ));
rOutProperties.push_back(
Property( C2U( "Logarithmic" ),
PROP_AXIS_LOGARITHMIC,
......@@ -388,6 +401,83 @@ AxisWrapper::~AxisWrapper()
{
}
// ____ chart::XAxis ____
Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getAxisTitle() throw (uno::RuntimeException)
{
if( !m_xAxisTitle.is() )
{
TitleHelper::eTitleType eTitleType( TitleHelper::X_AXIS_TITLE );
switch( m_eType )
{
case X_AXIS:
eTitleType = TitleHelper::X_AXIS_TITLE;
break;
case Y_AXIS:
eTitleType = TitleHelper::Y_AXIS_TITLE;
break;
case Z_AXIS:
eTitleType = TitleHelper::Z_AXIS_TITLE;
break;
case SECOND_X_AXIS:
eTitleType = TitleHelper::SECONDARY_X_AXIS_TITLE;
break;
case SECOND_Y_AXIS:
eTitleType = TitleHelper::SECONDARY_Y_AXIS_TITLE;
break;
default:
return 0;
}
m_xAxisTitle = new TitleWrapper( eTitleType, m_spChart2ModelContact );
}
return m_xAxisTitle;
}
Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMajorGrid() throw (uno::RuntimeException)
{
if( !m_xMajorGrid.is() )
{
GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID );
switch( m_eType )
{
case X_AXIS:
eGridType = GridWrapper::X_MAJOR_GRID;
break;
case Y_AXIS:
eGridType = GridWrapper::Y_MAJOR_GRID;
break;
case Z_AXIS:
eGridType = GridWrapper::Z_MAJOR_GRID;
break;
default:
return 0;
}
m_xMajorGrid = new GridWrapper( eGridType, m_spChart2ModelContact );
}
return m_xMajorGrid;
}
Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMinorGrid() throw (uno::RuntimeException)
{
if( !m_xMinorGrid.is() )
{
GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID );
switch( m_eType )
{
case X_AXIS:
eGridType = GridWrapper::X_MINOR_GRID;
break;
case Y_AXIS:
eGridType = GridWrapper::Y_MINOR_GRID;
break;
case Z_AXIS:
eGridType = GridWrapper::Z_MINOR_GRID;
break;
default:
return 0;
}
m_xMinorGrid = new GridWrapper( eGridType, m_spChart2ModelContact );
}
return m_xMinorGrid;
}
// ____ XShape ____
awt::Point SAL_CALL AxisWrapper::getPosition()
throw (uno::RuntimeException)
......@@ -469,6 +559,10 @@ void SAL_CALL AxisWrapper::dispose()
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
DisposeHelper::DisposeAndClear( m_xAxisTitle );
DisposeHelper::DisposeAndClear( m_xMajorGrid );
DisposeHelper::DisposeAndClear( m_xMinorGrid );
clearWrappedPropertySet();
}
......
......@@ -30,9 +30,10 @@
#include "WrappedPropertySet.hxx"
#include "ReferenceSizePropertyProvider.hxx"
#include "ServiceMacros.hxx"
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/implbase5.hxx>
#include <comphelper/uno3.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <com/sun/star/chart/XAxis.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/drawing/XShape.hpp>
......@@ -45,14 +46,13 @@
namespace chart
{
namespace wrapper
{
class Chart2ModelContact;
class AxisWrapper : public ::cppu::ImplInheritanceHelper4<
class AxisWrapper : public ::cppu::ImplInheritanceHelper5<
WrappedPropertySet
, com::sun::star::chart::XAxis
, com::sun::star::drawing::XShape
, com::sun::star::lang::XComponent
, com::sun::star::lang::XServiceInfo
......@@ -93,6 +93,11 @@ public:
::com::sun::star::lang::XEventListener >& aListener )
throw (::com::sun::star::uno::RuntimeException);
// ____ chart::XAxis ____
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getAxisTitle( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMajorGrid( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMinorGrid( ) throw (::com::sun::star::uno::RuntimeException);
// ____ XShape ____
virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
throw (::com::sun::star::uno::RuntimeException);
......@@ -131,6 +136,10 @@ private: //member
tAxisType m_eType;
::com::sun::star::uno::Any m_aTemporaryHelpStepValue;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAxisTitle;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xMajorGrid;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xMinorGrid;
};
} // namespace wrapper
......
......@@ -30,7 +30,13 @@
#include "WrappedPropertySet.hxx"
#include "ServiceMacros.hxx"
#include "DiagramHelper.hxx"
#include <cppuhelper/implbase12.hxx>
#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13)
#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13
#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 13
#include "comphelper/implbase_var.hxx"
#endif
#include <comphelper/uno3.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <com/sun/star/chart2/XChartDocument.hpp>
......@@ -41,6 +47,7 @@
#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
#include <com/sun/star/chart2/XChartTypeManager.hpp>
#include <com/sun/star/chart/XDiagram.hpp>
#include <com/sun/star/chart/XAxisSupplier.hpp>
#include <com/sun/star/chart/XAxisZSupplier.hpp>
#include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
#include <com/sun/star/chart/XTwoAxisYSupplier.hpp>
......@@ -56,15 +63,15 @@
namespace chart
{
namespace wrapper
{
class Chart2ModelContact;
class DiagramWrapper : public ::cppu::ImplInheritanceHelper12<
class DiagramWrapper : public ::comphelper::ImplInheritanceHelper13<
WrappedPropertySet
, ::com::sun::star::chart::XDiagram
, ::com::sun::star::chart::XAxisSupplier
, ::com::sun::star::chart::XAxisZSupplier
, ::com::sun::star::chart::XTwoAxisXSupplier // : XAxisXSupplier
, ::com::sun::star::chart::XTwoAxisYSupplier // : XAxisYSupplier
......@@ -123,6 +130,14 @@ public:
virtual ::rtl::OUString SAL_CALL getShapeType()
throw (::com::sun::star::uno::RuntimeException);
// ____ XAxisSupplier ____
virtual ::com::sun::star::uno::Reference<
::com::sun::star::chart::XAxis > SAL_CALL getAxis( sal_Int32 nDimensionIndex )
throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference<
::com::sun::star::chart::XAxis > SAL_CALL getSecondaryAxis( sal_Int32 nDimensionIndex )
throw (::com::sun::star::uno::RuntimeException);
// ____ XAxisZSupplier ____
virtual ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShape > SAL_CALL getZAxisTitle()
......@@ -244,72 +259,27 @@ private:
::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShape >
m_xXAxisTitle;
::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShape >
m_xYAxisTitle;
::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShape >
m_xZAxisTitle;
::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShape >
m_xSecondXAxisTitle;
::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShape >
m_xSecondYAxisTitle;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xXAxis;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xYAxis;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xZAxis;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xSecondXAxis;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xSecondYAxis;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xXMainGrid;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xYMainGrid;
::com::sun::star::chart::XAxis > m_xXAxis;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xZMainGrid;
::com::sun::star::chart::XAxis > m_xYAxis;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xXHelpGrid;
::com::sun::star::chart::XAxis > m_xZAxis;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xYHelpGrid;
::com::sun::star::chart::XAxis > m_xSecondXAxis;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xZHelpGrid;
::com::sun::star::chart::XAxis > m_xSecondYAxis;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xWall;
::com::sun::star::beans::XPropertySet > m_xWall;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xFloor;
::com::sun::star::beans::XPropertySet > m_xFloor;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xMinMaxLineWrapper;
::com::sun::star::beans::XPropertySet > m_xMinMaxLineWrapper;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xUpBarWrapper;
::com::sun::star::beans::XPropertySet > m_xUpBarWrapper;
::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet >
m_xDownBarWrapper;
::com::sun::star::beans::XPropertySet > m_xDownBarWrapper;
};
} // namespace wrapper
......
......@@ -112,17 +112,17 @@ void GridWrapper::getDimensionAndSubGridBool( tGridType eType, sal_Int32& rnDime
switch( eType )
{
case X_MAIN_GRID:
case X_MAJOR_GRID:
rnDimensionIndex = 0; rbSubGrid = false; break;
case Y_MAIN_GRID:
case Y_MAJOR_GRID:
rnDimensionIndex = 1; rbSubGrid = false; break;
case Z_MAIN_GRID:
case Z_MAJOR_GRID:
rnDimensionIndex = 2; rbSubGrid = false; break;
case X_SUB_GRID:
case X_MINOR_GRID:
rnDimensionIndex = 0; rbSubGrid = true; break;
case Y_SUB_GRID:
case Y_MINOR_GRID:
rnDimensionIndex = 1; rbSubGrid = true; break;
case Z_SUB_GRID:
case Z_MINOR_GRID:
rnDimensionIndex = 2; rbSubGrid = true; break;
}
}
......@@ -209,3 +209,4 @@ APPHELPER_XSERVICEINFO_IMPL( GridWrapper, lcl_aServiceName );
} // namespace wrapper
} // namespace chart
......@@ -42,7 +42,6 @@
namespace chart
{
namespace wrapper
{
......@@ -57,12 +56,12 @@ class GridWrapper : public ::cppu::ImplInheritanceHelper2<
public:
enum tGridType
{
X_MAIN_GRID,
Y_MAIN_GRID,
Z_MAIN_GRID,
X_SUB_GRID,
Y_SUB_GRID,
Z_SUB_GRID
X_MAJOR_GRID,
Y_MAJOR_GRID,
Z_MAJOR_GRID,
X_MINOR_GRID,
Y_MINOR_GRID,
Z_MINOR_GRID
};
GridWrapper( tGridType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
......
......@@ -97,6 +97,9 @@ WrappedScaleProperty::WrappedScaleProperty( tScaleProperty eScaleProperty
case SCALE_PROP_DATE_INCREMENT:
m_aOuterName = C2U("TimeIncrement");
break;
case SCALE_PROP_EXPLICIT_DATE_INCREMENT:
m_aOuterName = C2U("ExplicitTimeIncrement");
break;
case SCALE_PROP_LOGARITHMIC:
m_aOuterName = C2U("Logarithmic");
break;
......@@ -130,6 +133,7 @@ void WrappedScaleProperty::addWrappedProperties( std::vector< WrappedProperty* >
rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_STEPHELP, spChart2ModelContact ) );
rList.push_back( new WrappedScaleProperty( SCALE_PROP_AXIS_TYPE, spChart2ModelContact ) );
rList.push_back( new WrappedScaleProperty( SCALE_PROP_DATE_INCREMENT, spChart2ModelContact ) );
rList.push_back( new WrappedScaleProperty( SCALE_PROP_EXPLICIT_DATE_INCREMENT, spChart2ModelContact ) );
rList.push_back( new WrappedScaleProperty( SCALE_PROP_LOGARITHMIC, spChart2ModelContact ) );
rList.push_back( new WrappedScaleProperty( SCALE_PROP_REVERSEDIRECTION, spChart2ModelContact ) );
}
......@@ -308,6 +312,9 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons
bSetScaleData = true;
break;
}
case SCALE_PROP_EXPLICIT_DATE_INCREMENT:
//read only property
break;
case SCALE_PROP_LOGARITHMIC:
{
if( rOuterValue >>= bBool )
......@@ -550,6 +557,25 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const
aRet = uno::makeAny( aScaleData.TimeIncrement );
break;
}
case SCALE_PROP_EXPLICIT_DATE_INCREMENT:
{
if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis )
{
m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement );
if( aExplicitScale.AxisType == AxisType::DATE )
{
TimeIncrement aTimeIncrement;
aTimeIncrement.MajorTimeInterval = uno::makeAny( aExplicitIncrement.MajorTimeInterval );
aTimeIncrement.MinorTimeInterval = uno::makeAny( aExplicitIncrement.MinorTimeInterval );
aTimeIncrement.TimeResolution = uno::makeAny( aExplicitScale.TimeResolution );
aRet = uno::makeAny(aTimeIncrement);
}
}
if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis )
aRet = uno::makeAny( aScaleData.TimeIncrement );
break;
}
case SCALE_PROP_LOGARITHMIC:
{
aRet <<= static_cast< sal_Bool >( AxisHelper::isLogarithmic(aScaleData.Scaling) );
......@@ -571,5 +597,5 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const
}
} // namespace wrapper
} //namespace chart
} // namespace chart
//.............................................................................
......@@ -57,6 +57,7 @@ public:
, SCALE_PROP_AUTO_STEPHELP
, SCALE_PROP_AXIS_TYPE
, SCALE_PROP_DATE_INCREMENT
, SCALE_PROP_EXPLICIT_DATE_INCREMENT
, SCALE_PROP_LOGARITHMIC
, SCALE_PROP_REVERSEDIRECTION
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment