summaryrefslogtreecommitdiff
path: root/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx')
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx260
1 files changed, 133 insertions, 127 deletions
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 4819f51d1713..07ca51845cb0 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -31,14 +31,11 @@
#include "DiagramWrapper.hxx"
#include "macros.hxx"
#include "servicenames_charttypes.hxx"
-#include "TitleWrapper.hxx"
#include "DataSeriesPointWrapper.hxx"
#include "AxisWrapper.hxx"
#include "AxisHelper.hxx"
#include "Chart2ModelContact.hxx"
#include "PositionAndSizeHelper.hxx"
-#include "TitleHelper.hxx"
-#include "GridWrapper.hxx"
#include "WallFloorWrapper.hxx"
#include "MinMaxLineWrapper.hxx"
#include "UpDownBarWrapper.hxx"
@@ -89,6 +86,7 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::beans::Property;
+using ::com::sun::star::chart::XAxis;
using ::osl::MutexGuard;
using ::rtl::OUString;
@@ -435,14 +433,17 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-const uno::Sequence< Property > & lcl_GetPropertySequence()
+struct StaticDiagramWrapperPropertyArray_Initializer
{
- static uno::Sequence< Property > aPropSeq;
+ Sequence< Property >* operator()()
+ {
+ static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
+ return &aPropSeq;
+ }
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+private:
+ uno::Sequence< Property > lcl_GetPropertySequence()
{
- // get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::LineProperties::AddPropertiesToVector( aProperties );
@@ -456,16 +457,16 @@ const uno::Sequence< Property > & lcl_GetPropertySequence()
WrappedStockProperties::addProperties( aProperties );
WrappedAutomaticPositionProperties::addProperties( aProperties );
- // and sort them for access via bsearch
::std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
- // transfer result to static Sequence
- aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ return ::chart::ContainerHelper::ContainerToSequence( aProperties );
}
+};
- return aPropSeq;
-}
+struct StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticDiagramWrapperPropertyArray_Initializer >
+{
+};
bool lcl_isXYChart( const Reference< chart2::XDiagram > xDiagram )
{
@@ -883,193 +884,209 @@ void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( cons
return m_spChart2ModelContact->GetDiagramRectangleIncludingTitle();
}
-// ____ XAxisZSupplier ____
-Reference<
- drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle()
+// ____ XAxisSupplier ____
+Reference< XAxis > SAL_CALL DiagramWrapper::getAxis( sal_Int32 nDimensionIndex )
throw (uno::RuntimeException)
{
- if( !m_xZAxisTitle.is() )
+ Reference< XAxis > xAxis;
+ if(!nDimensionIndex)
+ {
+ if( !m_xXAxis.is() )
+ m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact );
+ xAxis = m_xXAxis;
+ }
+ else if(1==nDimensionIndex)
{
- m_xZAxisTitle = new TitleWrapper( TitleHelper::Z_AXIS_TITLE, m_spChart2ModelContact );
+ if( !m_xYAxis.is() )
+ m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact );
+ xAxis = m_xYAxis;
}
- return m_xZAxisTitle;
+ else if(2==nDimensionIndex)
+ {
+ if( !m_xZAxis.is() )
+ m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact );
+ xAxis = m_xZAxis;
+ }
+ return xAxis;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid()
+Reference< XAxis > SAL_CALL DiagramWrapper::getSecondaryAxis( sal_Int32 nDimensionIndex )
throw (uno::RuntimeException)
{
- if( ! m_xZMainGrid.is())
+ Reference< XAxis > xAxis;
+ if(!nDimensionIndex)
+ {
+ if( !m_xSecondXAxis.is() )
+ m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact );
+ xAxis = m_xSecondXAxis;
+ }
+ else if(1==nDimensionIndex)
{
- m_xZMainGrid = new GridWrapper( GridWrapper::Z_MAIN_GRID, m_spChart2ModelContact );
+ if( !m_xSecondYAxis.is() )
+ m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact );
+ xAxis = m_xSecondYAxis;
}
- return m_xZMainGrid;
+ return xAxis;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid()
+// ____ XAxisZSupplier ____
+Reference< drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle()
throw (uno::RuntimeException)
{
- if( !m_xZHelpGrid.is() )
- {
- m_xZHelpGrid = new GridWrapper( GridWrapper::Z_SUB_GRID, m_spChart2ModelContact );
- }
- return m_xZHelpGrid;
+ Reference< drawing::XShape > xRet;
+ Reference< XAxis > xAxis( getAxis(2) );
+ if( xAxis.is() )
+ xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
+ return xRet;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid()
+ throw (uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xRet;
+ Reference< XAxis > xAxis( getAxis(2) );
+ if( xAxis.is() )
+ xRet = xAxis->getMajorGrid();
+ return xRet;
+}
+
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid()
+ throw (uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xRet;
+ Reference< XAxis > xAxis( getAxis(2) );
+ if( xAxis.is() )
+ xRet = xAxis->getMinorGrid();
+ return xRet;
+}
+
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis()
throw (uno::RuntimeException)
{
if( ! m_xZAxis.is())
- {
m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact );
- }
- return m_xZAxis;
+ return Reference< beans::XPropertySet >( m_xZAxis, uno::UNO_QUERY );
}
// ____ XTwoAxisXSupplier ____
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis()
throw (uno::RuntimeException)
{
if( ! m_xSecondXAxis.is())
- {
m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact );
- }
- return m_xSecondXAxis;
+ return Reference< beans::XPropertySet >( m_xSecondXAxis, uno::UNO_QUERY );
}
// ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____
-Reference<
- drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle()
+Reference< drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle()
throw (uno::RuntimeException)
{
-
- if( !m_xXAxisTitle.is() )
- {
- m_xXAxisTitle = new TitleWrapper( TitleHelper::X_AXIS_TITLE, m_spChart2ModelContact );
- }
- return m_xXAxisTitle;
+ Reference< drawing::XShape > xRet;
+ Reference< XAxis > xAxis( getAxis(0) );
+ if( xAxis.is() )
+ xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
+ return xRet;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis()
throw (uno::RuntimeException)
{
if( ! m_xXAxis.is())
- {
m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact );
- }
-
- return m_xXAxis;
+ return Reference< beans::XPropertySet >( m_xXAxis, uno::UNO_QUERY );
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid()
throw (uno::RuntimeException)
{
- if( ! m_xXMainGrid.is())
- {
- m_xXMainGrid = new GridWrapper( GridWrapper::X_MAIN_GRID, m_spChart2ModelContact );
- }
-
- return m_xXMainGrid;
+ Reference< beans::XPropertySet > xRet;
+ Reference< XAxis > xAxis( getAxis(0) );
+ if( xAxis.is() )
+ xRet = xAxis->getMajorGrid();
+ return xRet;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid()
throw (uno::RuntimeException)
{
- if( ! m_xXHelpGrid.is())
- {
- m_xXHelpGrid = new GridWrapper( GridWrapper::X_SUB_GRID, m_spChart2ModelContact );
- }
- return m_xXHelpGrid;
+ Reference< beans::XPropertySet > xRet;
+ Reference< XAxis > xAxis( getAxis(0) );
+ if( xAxis.is() )
+ xRet = xAxis->getMinorGrid();
+ return xRet;
}
// ____ XTwoAxisYSupplier ____
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis()
throw (uno::RuntimeException)
{
if( ! m_xSecondYAxis.is())
- {
m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact );
- }
- return m_xSecondYAxis;
+ return Reference< beans::XPropertySet >( m_xSecondYAxis, uno::UNO_QUERY );
}
// ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____
-Reference<
- drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle()
+Reference< drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle()
throw (uno::RuntimeException)
{
- if( !m_xYAxisTitle.is() )
- {
- m_xYAxisTitle = new TitleWrapper( TitleHelper::Y_AXIS_TITLE, m_spChart2ModelContact );
- }
- return m_xYAxisTitle;
+ Reference< drawing::XShape > xRet;
+ Reference< XAxis > xAxis( getAxis(1) );
+ if( xAxis.is() )
+ xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
+ return xRet;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis()
throw (uno::RuntimeException)
{
if( ! m_xYAxis.is())
- {
m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact );
- }
- return m_xYAxis;
+ return Reference< beans::XPropertySet >( m_xYAxis, uno::UNO_QUERY );
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid()
throw (uno::RuntimeException)
{
- if( ! m_xYHelpGrid.is())
- {
- m_xYHelpGrid = new GridWrapper( GridWrapper::Y_SUB_GRID, m_spChart2ModelContact );
- }
- return m_xYHelpGrid;
+ Reference< beans::XPropertySet > xRet;
+ Reference< XAxis > xAxis( getAxis(1) );
+ if( xAxis.is() )
+ xRet = xAxis->getMajorGrid();
+ return xRet;
}
-Reference<
- beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid()
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid()
throw (uno::RuntimeException)
{
- if( ! m_xYMainGrid.is())
- {
- m_xYMainGrid = new GridWrapper( GridWrapper::Y_MAIN_GRID, m_spChart2ModelContact );
- }
- return m_xYMainGrid;
+ Reference< beans::XPropertySet > xRet;
+ Reference< XAxis > xAxis( getAxis(1) );
+ if( xAxis.is() )
+ xRet = xAxis->getMinorGrid();
+ return xRet;
}
// ____ XSecondAxisTitleSupplier ____
-Reference<
- drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle()
+Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle()
throw (uno::RuntimeException)
{
- if( !m_xSecondXAxisTitle.is() )
- {
- m_xSecondXAxisTitle = new TitleWrapper( TitleHelper::SECONDARY_X_AXIS_TITLE, m_spChart2ModelContact );
- }
- return m_xSecondXAxisTitle;
+ Reference< drawing::XShape > xRet;
+ Reference< XAxis > xAxis( getSecondaryAxis(0) );
+ if( xAxis.is() )
+ xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
+ return xRet;
}
-Reference<
- drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle()
+Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle()
throw (uno::RuntimeException)
{
- if( !m_xSecondYAxisTitle.is() )
- {
- m_xSecondYAxisTitle = new TitleWrapper( TitleHelper::SECONDARY_Y_AXIS_TITLE, m_spChart2ModelContact );
- }
- return m_xSecondYAxisTitle;
+ Reference< drawing::XShape > xRet;
+ Reference< XAxis > xAxis( getSecondaryAxis(1) );
+ if( xAxis.is() )
+ xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY );
+ return xRet;
}
// ____ XStatisticDisplay ____
@@ -1161,22 +1178,11 @@ void SAL_CALL DiagramWrapper::dispose()
MutexGuard aGuard( GetMutex());
- DisposeHelper::DisposeAndClear( m_xXAxisTitle );
- DisposeHelper::DisposeAndClear( m_xYAxisTitle );
- DisposeHelper::DisposeAndClear( m_xZAxisTitle );
- DisposeHelper::DisposeAndClear( m_xSecondXAxisTitle );
- DisposeHelper::DisposeAndClear( m_xSecondYAxisTitle );
DisposeHelper::DisposeAndClear( m_xXAxis );
DisposeHelper::DisposeAndClear( m_xYAxis );
DisposeHelper::DisposeAndClear( m_xZAxis );
DisposeHelper::DisposeAndClear( m_xSecondXAxis );
DisposeHelper::DisposeAndClear( m_xSecondYAxis );
- DisposeHelper::DisposeAndClear( m_xXMainGrid );
- DisposeHelper::DisposeAndClear( m_xYMainGrid );
- DisposeHelper::DisposeAndClear( m_xZMainGrid );
- DisposeHelper::DisposeAndClear( m_xXHelpGrid );
- DisposeHelper::DisposeAndClear( m_xYHelpGrid );
- DisposeHelper::DisposeAndClear( m_xZHelpGrid );
DisposeHelper::DisposeAndClear( m_xWall );
DisposeHelper::DisposeAndClear( m_xFloor );
DisposeHelper::DisposeAndClear( m_xMinMaxLineWrapper );
@@ -2055,7 +2061,7 @@ Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet()
const Sequence< beans::Property >& DiagramWrapper::getPropertySequence()
{
- return lcl_GetPropertySequence();
+ return *StaticDiagramWrapperPropertyArray::get();
}
const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties()