office-gobmx/chart2/source/inc/DataSourceHelper.hxx
Vladimir Glazounov 0f6cbdec6a INTEGRATION: CWS chart2mst3 (1.1.2); FILE ADDED
2006/11/17 16:32:42 bm 1.1.2.15: in ChartModel::setParent migrate the data from one data provider to the new one, if it is the same implementation and no temporary document. This is needed for solving the current clipboard problems
2006/03/17 13:27:50 bm 1.1.2.14: +allArgumentsForRectRangeDetected
2005/12/02 15:22:52 bm 1.1.2.13: +getUsedDataRanges for XDiagram, +getRangesFromLabeledDataSequence, +getRangesFromDataSource
2005/11/01 13:08:40 iha 1.1.2.12: support sequence mapping
2005/10/27 17:44:23 iha 1.1.2.11: support SequenceMapping
2005/10/25 16:25:55 iha 1.1.2.10: support SequenceMapping
2005/10/11 09:20:33 bm 1.1.2.9: license header change
2005/08/19 15:27:54 bm 1.1.2.8: GetUsedData for XChartDocument
2005/07/29 14:54:57 bm 1.1.2.7: detectRangeSegmentation: allow including unused data for calculation of data range
2005/05/27 12:20:52 bm 1.1.2.6: +getUsedDataRanges
2005/05/12 13:56:40 bm 1.1.2.5: API change XDataProvider
2005/05/09 09:51:04 bm 1.1.2.4: moved parts of API to data namespace
2005/04/04 16:12:06 iha 1.1.2.3: added helping methods for ranges
2004/06/29 12:46:35 bm 1.1.2.2: -getRangeIdentifiers
+addRangeRepresentationsFromLabeledDataSequence (was local before as helper for
the above)
2004/05/07 16:26:10 iha 1.1.2.1: #i20344# new
2007-05-22 17:15:28 +00:00

165 lines
7 KiB
C++

/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: DataSourceHelper.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: vg $ $Date: 2007-05-22 18:15:28 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 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
*
************************************************************************/
#ifndef _CHART2_DATASOURCEHELPER_HXX
#define _CHART2_DATASOURCEHELPER_HXX
#ifndef _COM_SUN_STAR_CHART2_XCHARTDOCUMENT_HPP_
#include <com/sun/star/chart2/XChartDocument.hpp>
#endif
#ifndef _COM_SUN_STAR_CHART2_XDIAGRAM_HPP_
#include <com/sun/star/chart2/XDiagram.hpp>
#endif
#ifndef _COM_SUN_STAR_CHART2_DATA_XDATASOURCE_HPP_
#include <com/sun/star/chart2/data/XDataSource.hpp>
#endif
#ifndef _COM_SUN_STAR_CHART2_XLABELEDDATASEQUENCE_HPP_
#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
#include <com/sun/star/frame/XModel.hpp>
#endif
#include <vector>
//.............................................................................
namespace chart
{
//.............................................................................
//-----------------------------------------------------------------------------
/**
*/
class DataSourceHelper
{
public:
static ::com::sun::star::uno::Sequence<
::com::sun::star::beans::PropertyValue > createArguments(
bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories );
static ::com::sun::star::uno::Sequence<
::com::sun::star::beans::PropertyValue > createArguments(
const ::rtl::OUString & rRangeRepresentation,
const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping,
bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories );
static void readArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArguments
, ::rtl::OUString & rRangeRepresentation, ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool& bUseColumns, bool& bFirstCellAsLabel, bool& bHasCategories );
static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >
pressUsedDataIntoRectangularFormat( const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument >& xChartDoc,
bool bWithCategories = true );
static void addRangeRepresentationsFromLabeledDataSequence(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence >& xLabeledDataSequence
, ::std::vector< ::rtl::OUString >& rOutRangeRepresentations );
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getUsedDataRanges(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDiagram > & xDiagram );
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getUsedDataRanges(
const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel > & xChartModel );
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XDataSource > getUsedData(
const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xChartModel,
bool bIncludeUnusedData = false );
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XDataSource > getUsedData(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument >& xChartDoc,
bool bIncludeUnusedData = false );
static bool detectRangeSegmentation(
const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xChartModel
, ::rtl::OUString& rOutRangeString
, ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool& rOutUseColumns
, bool& rOutFirstCellAsLabel
, bool& rOutHasCategories
, bool bIncludeUnusedData = false );
static void setRangeSegmentation(
const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xChartModel
, const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool bUseColumns
, bool bFirstCellAsLabel
, bool bUseCategories );
/** Returns true, if all arguments necessary for getting all data by a
rectangular region are returned by detectArguments at the given
document's data provider.
Currently, this is: CellRangeRepresentation, DataRowSource,
HasCategories and FirstCellAsLabel.
*/
static bool allArgumentsForRectRangeDetected(
const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument );
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getRangesFromLabeledDataSequence(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence > & xLSeq );
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getRangesFromDataSource(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XDataSource > & xSource );
static bool migrateData(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDoc,
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XDataProvider > & xNewDataProvider );
};
//.............................................................................
} //namespace chart
//.............................................................................
#endif