2003-11-04 08:35:09 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 15:04:39 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2003-11-04 08:35:09 -06:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2003-11-04 08:35:09 -06:00
|
|
|
*
|
2008-04-10 15:04:39 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2003-11-04 08:35:09 -06:00
|
|
|
*
|
2008-04-10 15:04:39 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2003-11-04 08:35:09 -06:00
|
|
|
*
|
2008-04-10 15:04:39 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2003-11-04 08:35:09 -06:00
|
|
|
*
|
2008-04-10 15:04:39 -05:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2003-11-04 08:35:09 -06:00
|
|
|
*
|
2008-04-10 15:04:39 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2003-11-04 08:35:09 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef CHART2_DIAGRAMHELPER_HXX
|
|
|
|
#define CHART2_DIAGRAMHELPER_HXX
|
|
|
|
|
2007-05-22 12:15:39 -05:00
|
|
|
#include "StackMode.hxx"
|
2008-12-30 07:32:01 -06:00
|
|
|
#include "charttoolsdllapi.hxx"
|
2007-05-22 12:15:39 -05:00
|
|
|
#include <com/sun/star/chart2/XAxis.hpp>
|
2004-01-26 02:13:31 -06:00
|
|
|
#include <com/sun/star/chart2/XDiagram.hpp>
|
2007-05-22 12:15:39 -05:00
|
|
|
#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
|
|
|
|
#include <com/sun/star/chart2/XCoordinateSystem.hpp>
|
|
|
|
#include <com/sun/star/chart2/InterpretedData.hpp>
|
|
|
|
#include <com/sun/star/chart2/StackingDirection.hpp>
|
|
|
|
#include <com/sun/star/chart2/XChartDocument.hpp>
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
|
|
|
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
2003-11-04 08:35:09 -06:00
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
|
2008-12-30 07:32:01 -06:00
|
|
|
class OOO_DLLPUBLIC_CHARTTOOLS DiagramHelper
|
2003-11-04 08:35:09 -06:00
|
|
|
{
|
|
|
|
public:
|
2007-05-22 12:15:39 -05:00
|
|
|
typedef ::std::pair<
|
|
|
|
::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XChartTypeTemplate >,
|
|
|
|
::rtl::OUString >
|
|
|
|
tTemplateWithServiceName;
|
|
|
|
|
|
|
|
/** tries to find a template in the chart-type manager that matches the
|
|
|
|
given diagram.
|
|
|
|
|
|
|
|
@param rPreferredTemplateName
|
|
|
|
Check this template first. This may speed up searching, if the
|
|
|
|
caller assumes a certain template as most likely to be the one that
|
|
|
|
matches.
|
|
|
|
|
|
|
|
@return
|
|
|
|
A pair containing a template with the correct properties set as
|
|
|
|
first entry and the service name of the templateas second entry. If
|
|
|
|
no template was found both elements are empty.
|
|
|
|
*/
|
|
|
|
static tTemplateWithServiceName
|
|
|
|
getTemplateForDiagram(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::lang::XMultiServiceFactory > & xChartTypeManager,
|
|
|
|
const ::rtl::OUString & rPreferredTemplateName = ::rtl::OUString());
|
|
|
|
|
|
|
|
/** Sets the "SwapXAndYAxis" property at all coordinate systems found in the
|
|
|
|
given diagram.
|
|
|
|
|
|
|
|
"vertical==true" for bar charts, "vertical==false" for column charts
|
|
|
|
*/
|
|
|
|
static void setVertical( const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram,
|
|
|
|
bool bVertical = true );
|
|
|
|
|
|
|
|
/** Gets the "SwapXAndYAxis" property at all coordinate systems found in the
|
|
|
|
given diagram.
|
|
|
|
|
|
|
|
"vertical==true" for bar charts, "vertical==false" for column charts
|
|
|
|
*/
|
|
|
|
static bool getVertical( const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram,
|
|
|
|
bool& rbOutFoundResult, bool& rbOutAmbiguousResult );
|
|
|
|
|
|
|
|
static StackMode getStackMode(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
2008-04-04 04:59:16 -05:00
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram,
|
|
|
|
bool& rbFound, bool& rbAmbiguous
|
2007-05-22 12:15:39 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
/** @param bOnlyAtFirstChartType
|
|
|
|
If </TRUE>, the stacking mode is only set at the series found inside
|
|
|
|
the first chart type. This is the standard for all current
|
|
|
|
templates (the only template that has more than one chart-type and
|
|
|
|
allows stacking is bar/line combi, and for this the stacking only
|
|
|
|
applies to the first chart type/the bars)
|
|
|
|
*/
|
|
|
|
static void setStackMode(
|
2003-11-04 08:35:09 -06:00
|
|
|
const ::com::sun::star::uno::Reference<
|
2007-05-22 12:15:39 -05:00
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram,
|
|
|
|
StackMode eStackMode,
|
2008-06-06 03:11:55 -05:00
|
|
|
bool bOnlyAtFirstChartType = true
|
2003-11-04 08:35:09 -06:00
|
|
|
);
|
|
|
|
|
2008-04-04 04:59:16 -05:00
|
|
|
/** Retrieves the stackmode of the first DataSeries or none. If the series have differing stack
|
|
|
|
modes, rbAmbiguous is set to true. If no series is there rbFound is set to false.
|
2007-05-22 12:15:39 -05:00
|
|
|
|
|
|
|
@param xCorrespondingCoordinateSystem
|
|
|
|
The coordinate system in which the given chart type xChartType is
|
|
|
|
located. (This is needed for determining percent stacking. If
|
|
|
|
omitted, the result will just indicate "not stacked", "stacked" or
|
|
|
|
"ambiguous")
|
|
|
|
*/
|
|
|
|
static StackMode getStackModeFromChartType(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XChartType > & xChartType,
|
2008-04-04 04:59:16 -05:00
|
|
|
bool& rbFound, bool& rbAmbiguous,
|
2007-05-22 12:15:39 -05:00
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem =
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >()
|
|
|
|
);
|
|
|
|
|
|
|
|
/** Returns the dimension found for all chart types in the tree. If the
|
|
|
|
dimension is not unique, 0 is returned.
|
|
|
|
*/
|
|
|
|
static sal_Int32 getDimension(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram );
|
|
|
|
|
|
|
|
/** Sets the dimension of the diagram given.
|
|
|
|
|
|
|
|
1. Sets the dimension of all used ChartTypes
|
|
|
|
2. Adapts the DataSeriesTree to reflect the new dimension
|
|
|
|
3. If new coordinate-systems have to be created, adapts the
|
|
|
|
XCoordinateSystemContainer of the diagram.
|
|
|
|
*/
|
|
|
|
static void setDimension(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram,
|
|
|
|
sal_Int32 nNewDimensionCount );
|
|
|
|
|
|
|
|
/** Replaces all occurences of xCooSysToReplace in the tree with
|
|
|
|
xReplacement in the diagram's tree
|
|
|
|
*/
|
2009-06-04 04:41:18 -05:00
|
|
|
SAL_DLLPRIVATE static void replaceCoordinateSystem(
|
2007-05-22 12:15:39 -05:00
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XCoordinateSystem > & xCooSysToReplace,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XCoordinateSystem > & xReplacement );
|
|
|
|
|
|
|
|
static bool isSeriesAttachedToMainAxis(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDataSeries >& xDataSeries );
|
|
|
|
|
|
|
|
static bool attachSeriesToAxis( bool bMainAxis,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDataSeries >& xSeries,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram >& xDiagram,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
2010-03-09 10:58:27 -06:00
|
|
|
::com::sun::star::uno::XComponentContext > & xContext,
|
|
|
|
bool bAdaptAxes=true );
|
2007-05-22 12:15:39 -05:00
|
|
|
|
|
|
|
static ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XAxis > getAttachedAxis(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDataSeries >& xSeries,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram >& xDiagram );
|
|
|
|
|
|
|
|
static ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XChartType >
|
|
|
|
getChartTypeOfSeries(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram >& xDiagram,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDataSeries >& xSeries );
|
|
|
|
|
|
|
|
static ::std::vector<
|
|
|
|
::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDataSeries > >
|
|
|
|
getDataSeriesFromDiagram(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram );
|
|
|
|
|
|
|
|
/** return all data series in this diagram grouped by chart-types
|
|
|
|
*/
|
|
|
|
static ::com::sun::star::uno::Sequence<
|
|
|
|
::com::sun::star::uno::Sequence<
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > >
|
|
|
|
getDataSeriesGroups(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram );
|
|
|
|
|
|
|
|
static bool isCategoryDiagram(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram >& xDiagram );
|
|
|
|
|
|
|
|
static void setCategoriesToDiagram(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::data::XLabeledDataSequence >& xCategories,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram >& xDiagram,
|
|
|
|
bool bSetAxisType = false, // when this flag is true ...
|
|
|
|
bool bCategoryAxis = true);// set the AxisType to CATEGORY or back to REALNUMBER
|
|
|
|
|
|
|
|
static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
|
|
|
|
getCategoriesFromDiagram(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram );
|
|
|
|
|
|
|
|
static ::com::sun::star::uno::Sequence< rtl::OUString >
|
2009-12-01 08:01:55 -06:00
|
|
|
getExplicitSimpleCategories(
|
2007-05-22 12:15:39 -05:00
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XChartDocument > & xChartDoc );
|
|
|
|
|
2009-06-04 04:41:18 -05:00
|
|
|
SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< rtl::OUString >
|
2009-12-01 08:01:55 -06:00
|
|
|
generateAutomaticCategoriesFromCooSys(
|
2007-05-22 12:15:39 -05:00
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XCoordinateSystem > & xCooSys );
|
|
|
|
|
|
|
|
static ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XChartType >
|
|
|
|
getChartTypeByIndex( const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram >& xDiagram, sal_Int32 nIndex );
|
|
|
|
|
|
|
|
static ::com::sun::star::uno::Sequence<
|
|
|
|
::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XChartType > >
|
|
|
|
getChartTypesFromDiagram(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram );
|
|
|
|
|
2009-06-04 04:41:18 -05:00
|
|
|
SAL_DLLPRIVATE static bool areChartTypesCompatible( const ::com::sun::star::uno::Reference<
|
2007-05-22 12:15:39 -05:00
|
|
|
::com::sun::star::chart2::XChartType >& xFirstType,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XChartType >& xSecondType );
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test if a series can be moved.
|
|
|
|
*
|
|
|
|
* @param xDiagram
|
|
|
|
* Reference to the diagram that contains the series.
|
|
|
|
*
|
|
|
|
* @param xGivenDataSeries
|
|
|
|
* Reference to the series that should be tested for moving.
|
|
|
|
*
|
|
|
|
* @param bForward
|
|
|
|
* Direction of the move to be checked.
|
|
|
|
*
|
|
|
|
* @returns </TRUE> if the series can be moved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static bool isSeriesMoveable(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram >& xDiagram,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDataSeries >& xGivenDataSeries,
|
|
|
|
bool bForward );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Move a series forward or backward.
|
|
|
|
*
|
|
|
|
* @param xDiagram
|
|
|
|
* Reference to the diagram that contains the series.
|
|
|
|
*
|
|
|
|
* @param xGivenDataSeries
|
|
|
|
* Reference to the series that should be moved.
|
|
|
|
*
|
|
|
|
* @param bForward
|
|
|
|
* Direction in which the series should be moved.
|
|
|
|
*
|
|
|
|
* @returns </TRUE> if the series was moved successfully.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static bool moveSeries(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram >& xDiagram,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDataSeries >& xGivenDataSeries,
|
|
|
|
bool bForward );
|
|
|
|
|
|
|
|
static bool isSupportingFloorAndWall( const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram );
|
|
|
|
|
|
|
|
static bool isPieOrDonutChart( const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram >& xDiagram );
|
|
|
|
|
2008-01-14 06:59:09 -06:00
|
|
|
static sal_Int32 getGeometry3D(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram,
|
|
|
|
bool& rbFound, bool& rbAmbiguous );
|
|
|
|
|
|
|
|
static void setGeometry3D(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram,
|
|
|
|
sal_Int32 nNewGeometry );
|
|
|
|
|
2008-07-30 05:54:27 -05:00
|
|
|
//returns integer from constant group ::com::sun::star::chart::MissingValueTreatment
|
|
|
|
static sal_Int32 getCorrectedMissingValueTreatment(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XDiagram > & xDiagram,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::chart2::XChartType >& xChartType );
|
|
|
|
|
2003-11-04 08:35:09 -06:00
|
|
|
private:
|
|
|
|
// not implemented
|
|
|
|
DiagramHelper();
|
2007-05-22 12:15:39 -05:00
|
|
|
|
2003-11-04 08:35:09 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chart
|
|
|
|
|
|
|
|
// CHART2_DIAGRAMHELPER_HXX
|
|
|
|
#endif
|