summaryrefslogtreecommitdiff
path: root/chart2/source/inc
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/inc')
-rw-r--r--chart2/source/inc/ChartModelHelper.hxx12
-rw-r--r--chart2/source/inc/CloneHelper.hxx1
-rw-r--r--chart2/source/inc/DataSourceHelper.hxx13
-rw-r--r--chart2/source/inc/DiagramHelper.hxx8
-rw-r--r--chart2/source/inc/ExplicitCategoriesProvider.hxx63
-rwxr-xr-xchart2/source/inc/InternalData.hxx109
-rw-r--r--chart2/source/inc/InternalDataProvider.hxx69
7 files changed, 210 insertions, 65 deletions
diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx
index bdeab6736044..7cd205b83fb5 100644
--- a/chart2/source/inc/ChartModelHelper.hxx
+++ b/chart2/source/inc/ChartModelHelper.hxx
@@ -34,7 +34,6 @@
#include <com/sun/star/chart2/XUndoManager.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
#include <com/sun/star/chart2/data/XRangeHighlighter.hpp>
-#include <com/sun/star/chart/XChartDataArray.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/awt/Size.hpp>
@@ -58,13 +57,8 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XRangeHighlighter > createRangeHighlighter(
const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier >& xSelectionSupplier );
- static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > createInternalDataProvider();
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > createInternalDataProvider(
- const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataArray >& xDataToCopy );
-
static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > createInternalDataProvider(
- const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc, bool bConnectToModel );
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDiagram >
@@ -74,6 +68,10 @@ public:
::com::sun::star::chart2::XDiagram >
findDiagram( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc );
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >
+ getFirstCoordinateSystem( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
+
SAL_DLLPRIVATE static ::std::vector< ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDataSeries > > getDataSeries(
const ::com::sun::star::uno::Reference<
diff --git a/chart2/source/inc/CloneHelper.hxx b/chart2/source/inc/CloneHelper.hxx
index c78abe32da59..6747bd614d84 100644
--- a/chart2/source/inc/CloneHelper.hxx
+++ b/chart2/source/inc/CloneHelper.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/util/XCloneable.hpp>
+#include <map>
#include <functional>
#include <algorithm>
diff --git a/chart2/source/inc/DataSourceHelper.hxx b/chart2/source/inc/DataSourceHelper.hxx
index efb69df7f2b5..06888fe858d6 100644
--- a/chart2/source/inc/DataSourceHelper.hxx
+++ b/chart2/source/inc/DataSourceHelper.hxx
@@ -111,14 +111,12 @@ public:
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 );
+ ::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::chart2::XChartDocument >& xChartDoc,
- bool bIncludeUnusedData = false );
+ ::com::sun::star::chart2::XChartDocument >& xChartDoc );
static bool detectRangeSegmentation(
const ::com::sun::star::uno::Reference<
@@ -127,8 +125,7 @@ public:
, ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool& rOutUseColumns
, bool& rOutFirstCellAsLabel
- , bool& rOutHasCategories
- , bool bIncludeUnusedData = false );
+ , bool& rOutHasCategories );
static void setRangeSegmentation(
const ::com::sun::star::uno::Reference<
@@ -152,6 +149,10 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XLabeledDataSequence > & xLSeq );
+ SAL_DLLPRIVATE static ::rtl::OUString getRangeFromValues(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence > & xLSeq );
+
SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< ::rtl::OUString > getRangesFromDataSource(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XDataSource > & xSource );
diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx
index fe412366606b..c685b99b974f 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -223,19 +223,15 @@ public:
::com::sun::star::chart2::XDiagram > & xDiagram );
static ::com::sun::star::uno::Sequence< rtl::OUString >
- generateAutomaticCategories(
+ getExplicitSimpleCategories(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > & xChartDoc );
SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< rtl::OUString >
- generateAutomaticCategories(
+ generateAutomaticCategoriesFromCooSys(
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XCoordinateSystem > & xCooSys );
- SAL_DLLPRIVATE static void generateAutomaticCategoriesFromChartType(
- ::com::sun::star::uno::Sequence< rtl::OUString >& rRet,
- const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType );
-
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartType >
getChartTypeByIndex( const ::com::sun::star::uno::Reference<
diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx b/chart2/source/inc/ExplicitCategoriesProvider.hxx
index 8195ae0d92f2..18d54eb6e2ad 100644
--- a/chart2/source/inc/ExplicitCategoriesProvider.hxx
+++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx
@@ -35,36 +35,71 @@
#include <com/sun/star/frame/XModel.hpp>
#include "charttoolsdllapi.hxx"
+#include <vector>
+
namespace chart
{
-class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider :
- public ::cppu::WeakImplHelper1<
- ::com::sun::star::chart2::data::XTextualDataSequence
- >
+struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory
+{
+ rtl::OUString Text;
+ sal_Int32 Count;
+
+ ComplexCategory( const rtl::OUString& rText, sal_Int32 nCount ) : Text( rText ), Count (nCount)
+ {}
+};
+
+class OOO_DLLPUBLIC_CHARTTOOLS SplitCategoriesProvider
+{
+public:
+ virtual ~SplitCategoriesProvider();
+
+ virtual sal_Int32 getLevelCount() const = 0;
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > getStringsForLevel( sal_Int32 nIndex ) const = 0;
+};
+
+class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider
{
public:
ExplicitCategoriesProvider( const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel );
- SAL_DLLPRIVATE virtual ~ExplicitCategoriesProvider();
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ );
+ virtual ~ExplicitCategoriesProvider();
+
+ void init();
- //XTextualDataSequence
- SAL_DLLPRIVATE virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData()
- throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > getSimpleCategories();
+ ::std::vector< ComplexCategory > getCategoriesByLevel( sal_Int32 nLevel );
static ::rtl::OUString getCategoryByIndex(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel,
- sal_Int32 nIndex );
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel
+ , sal_Int32 nIndex );
+
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getExplicitSimpleCategories(
+ const SplitCategoriesProvider& rSplitCategoriesProvider );
+
+ bool hasComplexCategories() const;
+ sal_Int32 getCategoryLevelCount() const;
+
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList();
private: //member
- ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aExplicitCategories;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aExplicitCategories;
+ ::std::vector< ::std::vector< ComplexCategory > > m_aComplexCats;
bool volatile m_bDirty;
::com::sun::star::uno::WeakReference<
::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel;
::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::data::XLabeledDataSequence> m_xCategories;
+ ::com::sun::star::chart2::data::XLabeledDataSequence> m_xOriginalCategories;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList;
};
} // namespace chart
diff --git a/chart2/source/inc/InternalData.hxx b/chart2/source/inc/InternalData.hxx
new file mode 100755
index 000000000000..6b6590cffdac
--- /dev/null
+++ b/chart2/source/inc/InternalData.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef CHART2_INTERNALDATA_HXX
+#define CHART2_INTERNALDATA_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <vector>
+#include <valarray>
+
+namespace chart
+{
+
+class InternalData
+{
+public:
+ InternalData();
+
+ void createDefaultData();
+
+ void setData( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< double > > & rDataInRows );
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< double > > getData() const;
+
+ ::com::sun::star::uno::Sequence< double > getColumnValues( sal_Int32 nColumnIndex ) const;
+ ::com::sun::star::uno::Sequence< double > getRowValues( sal_Int32 nRowIndex ) const;
+
+ void setColumnValues( sal_Int32 nColumnIndex, const ::std::vector< double > & rNewData );
+ void setRowValues( sal_Int32 nRowIndex, const ::std::vector< double > & rNewData );
+
+ void setComplexColumnLabel( sal_Int32 nColumnIndex, const ::std::vector< ::rtl::OUString >& rComplexLabel );
+ void setComplexRowLabel( sal_Int32 nRowIndex, const ::std::vector< ::rtl::OUString >& rComplexLabel );
+
+ ::std::vector< ::rtl::OUString > getComplexColumnLabel( sal_Int32 nColumnIndex ) const;
+ ::std::vector< ::rtl::OUString > getComplexRowLabel( sal_Int32 nRowIndex ) const;
+
+ void swapRowWithNext( sal_Int32 nRowIndex );
+ void swapColumnWithNext( sal_Int32 nColumnIndex );
+
+ void insertColumn( sal_Int32 nAfterIndex );
+ void insertRow( sal_Int32 nAfterIndex );
+ void deleteColumn( sal_Int32 nAtIndex );
+ void deleteRow( sal_Int32 nAtIndex );
+
+ /// @return the index of the newly appended column
+ sal_Int32 appendColumn();
+ /// @return the index of the newly appended row
+ sal_Int32 appendRow();
+
+ sal_Int32 getRowCount() const;
+ sal_Int32 getColumnCount() const;
+
+ typedef ::std::valarray< double > tDataType;
+ typedef ::std::vector< ::std::vector< ::rtl::OUString > > tVecVecString; //inner index is hierarchical level
+
+ void setComplexRowLabels( const tVecVecString& rNewRowLabels );
+ tVecVecString getComplexRowLabels() const;
+ void setComplexColumnLabels( const tVecVecString& rNewColumnLabels );
+ tVecVecString getComplexColumnLabels() const;
+
+#if OSL_DEBUG_LEVEL > 2
+ void traceData() const;
+#endif
+
+private: //methods
+ /** resizes the data if at least one of the given dimensions is larger than
+ before. The data is never becoming smaller only larger.
+
+ @return </TRUE>, if the data was enlarged
+ */
+ bool enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount );
+
+private:
+ sal_Int32 m_nColumnCount;
+ sal_Int32 m_nRowCount;
+
+ tDataType m_aData;
+ tVecVecString m_aRowLabels;//outer index is row index, inner index is category level
+ tVecVecString m_aColumnLabels;//outer index is column index
+};
+
+#endif
+
+} // namespace chart
diff --git a/chart2/source/inc/InternalDataProvider.hxx b/chart2/source/inc/InternalDataProvider.hxx
index 9100b32d5859..f5e12f87f505 100644
--- a/chart2/source/inc/InternalDataProvider.hxx
+++ b/chart2/source/inc/InternalDataProvider.hxx
@@ -27,8 +27,10 @@
#ifndef CHART2_INTERNALDATAPROVIDER_HXX
#define CHART2_INTERNALDATAPROVIDER_HXX
+#include "InternalData.hxx"
+
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/chart/XChartDataArray.hpp>
+#include <com/sun/star/chart/XComplexDescriptionAccess.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
#include <com/sun/star/chart2/XInternalDataProvider.hpp>
#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
@@ -49,12 +51,11 @@ namespace chart
namespace impl
{
-class InternalData;
typedef ::cppu::WeakImplHelper6<
::com::sun::star::chart2::XInternalDataProvider,
::com::sun::star::chart2::data::XRangeXMLConversion,
- ::com::sun::star::chart::XChartDataArray,
+ ::com::sun::star::chart::XComplexDescriptionAccess,
::com::sun::star::util::XCloneable,
::com::sun::star::lang::XInitialization,
::com::sun::star::lang::XServiceInfo >
@@ -75,16 +76,9 @@ class InternalDataProvider :
public impl::InternalDataProvider_Base
{
public:
- explicit InternalDataProvider();
explicit InternalDataProvider(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & _xContext);
- /// sets the internal data to the given data
- explicit InternalDataProvider(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart::XChartDataArray > & xDataToCopy );
- /// copies the data from the given data provider for all given used ranges
explicit InternalDataProvider( const ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::XChartDocument > & xChartDoc );
- // copy-CTOR
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc, bool bConnectToModel );
explicit InternalDataProvider( const InternalDataProvider & rOther );
virtual ~InternalDataProvider();
@@ -110,6 +104,10 @@ public:
throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL appendSequence()
throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertComplexCategoryLevel( ::sal_Int32 nLevel )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deleteComplexCategoryLevel( ::sal_Int32 nLevel )
+ throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL insertDataPointForAllSequences( ::sal_Int32 nAfterIndex )
throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL deleteDataPointForAllSequences( ::sal_Int32 nAtIndex )
@@ -151,7 +149,21 @@ public:
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
- // ____ XChartDataArray ____
+ // ____ XComplexDescriptionAccess ____
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL
+ getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setComplexRowDescriptions(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aRowDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL
+ getComplexColumnDescriptions() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setComplexColumnDescriptions(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aColumnDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartDataArray (base of XComplexDescriptionAccess) ____
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL getData()
throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setData(
@@ -189,29 +201,27 @@ public:
throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception);
private:
- impl::InternalData & getInternalData();
- const impl::InternalData & getInternalData() const;
-
- void addDataSequenceToMap(
+ void lcl_addDataSequenceToMap(
const ::rtl::OUString & rRangeRepresentation,
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XDataSequence > & xSequence );
+
::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XDataSequence >
- createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation,
+ lcl_createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation,
const ::rtl::OUString & rRole );
::com::sun::star::uno::Reference<
::com::sun::star::chart2::data::XDataSequence >
- createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation );
- ::com::sun::star::uno::Reference<
- ::com::sun::star::chart2::data::XDataSequence >
- createErrorBarDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation );
- void deleteMapReferences( const ::rtl::OUString & rRangeRepresentation );
- void adaptMapReferences(
+ lcl_createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation );
+
+ void lcl_deleteMapReferences( const ::rtl::OUString & rRangeRepresentation );
+
+ void lcl_adaptMapReferences(
const ::rtl::OUString & rOldRangeRepresentation,
const ::rtl::OUString & rNewRangeRepresentation );
- void increaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
- void decreaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
+
+ void lcl_increaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
+ void lcl_decreaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd );
typedef ::std::multimap< ::rtl::OUString,
::com::sun::star::uno::WeakReference< ::com::sun::star::chart2::data::XDataSequence > >
@@ -225,14 +235,9 @@ private:
referred to by some component (weak reference is valid), the range will
be adapted.
*/
- mutable tSequenceMap m_aSequenceMap;
- mutable ::std::auto_ptr< impl::InternalData > m_apData;
+ tSequenceMap m_aSequenceMap;
+ InternalData m_aInternalData;
bool m_bDataInColumns;
-
-// typedef ::std::map< ::rtl::OUString,
-// ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > >
-// tHardRefSequenceMap;
-// tHardRefSequenceMap m_aErrorBarSequences;
};
} // namespace chart