summaryrefslogtreecommitdiff
path: root/xmloff/source/chart
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-05-18 16:46:40 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-05-18 16:46:40 +0000
commit756ad3800d5defb7f8cdf5404d14c9a20cc168d6 (patch)
tree5df5fa79618fbd8dbf690d78c652f6c6417609a2 /xmloff/source/chart
parent38f296af6acc3a4e83a571bb0ce62744b21543a9 (diff)
CWS-TOOLING: integrate CWS koheichart01
2009-05-15 06:32:38 +0200 hde r271925 : header fixed 2009-04-14 16:23:35 +0200 hde r270792 : #100231# 2009-04-14 16:13:48 +0200 hde r270790 : #100231# 2009-04-14 15:56:14 +0200 hde r270787 : #100231# 2009-04-14 14:28:40 +0200 hde r270767 : #100231# 2009-04-14 14:27:30 +0200 hde r270766 : #100231# 2009-04-14 09:43:07 +0200 hde r270749 : #100231# 2009-04-14 09:25:52 +0200 hde r270748 : #100231# 2009-03-25 16:18:26 +0100 iha r270034 : #i91578# removed compiler warning 2009-03-25 03:20:36 +0100 kohei r269992 : fixed a silly typo in in-line comment. 2009-03-24 17:03:57 +0100 kohei r269977 : Let's use row and column's hidden flags, instead of width/height, to determine cell's hidden state. 2009-03-24 16:53:10 +0100 kohei r269973 : The chart positioner no longer needs to skip hidden cells, as hidden cells are handled elsewhere. 2009-03-24 16:50:12 +0100 kohei r269971 : the index should be 0-based (although chart2 doesn't appear to make use of this data any more). 2009-03-24 16:47:56 +0100 kohei r269969 : Skip hidden cells during cache (re-)build, when the include hidden cells flag is false. Also avoid adding data cache when the cell is hidden. 2009-03-24 06:05:53 +0100 kohei r269909 : fixed the build breakage after the resync. 2009-03-24 06:05:34 +0100 kohei r269908 : fixed the build breakage after the resync. 2009-03-23 23:38:36 +0100 kohei r269900 : CWS-TOOLING: rebase CWS koheichart01 to trunk@269781 (milestone: DEV300:m44) 2009-03-17 13:11:40 +0100 iha r269597 : #i91578# import IncludeHiddenCells from xlsx 2009-03-17 12:56:09 +0100 iha r269594 : #i91578# import IncludeHiddenCells from xls correctly 2009-03-17 12:49:13 +0100 iha r269592 : #i91578# import IncludeHiddenCells from xls correctly 2009-03-16 17:03:55 +0100 iha r269561 : #i91578# remove unused variable 2009-03-16 10:22:30 +0100 iha r269509 : #i91578# changed wording 2009-03-04 17:07:16 +0100 iha r268846 : #i91578# display of hidden cells - remove unused property 'IsHidden' 2009-03-04 17:04:22 +0100 iha r268845 : #i91578# display of hidden cells - remove unused property 'IsHidden' 2009-03-04 17:03:43 +0100 iha r268844 : #i91578# display of hidden cells - remove unused property 'IsHidden' 2009-03-04 16:24:30 +0100 iha r268843 : #i91578# display of hidden cells - added missing property description 2009-03-04 15:13:04 +0100 iha r268835 : #i91578# display of hidden cells - remove unused code 2009-03-04 14:38:44 +0100 iha r268832 : #i91578# display of hidden cells - reset state corretly when doing undo/redo 2009-03-04 13:42:10 +0100 iha r268822 : #i81209# #i91578# display of hidden cells - don't show hidden cells per default but keep the hidden ranges 2009-03-04 13:40:10 +0100 iha r268821 : #i81209# #i91578# display of hidden cells - don't show hidden cells per default but keep the hidden ranges 2009-03-04 13:37:05 +0100 iha r268820 : #i81209# #i91578# display of hidden cells - don't show hidden cells per default but keep the hidden ranges 2009-03-03 11:18:39 +0100 iha r268713 : #i91578# display of hidden cells - hide control if the functionality is not offered by the data provider 2009-03-02 17:41:37 +0100 kohei r268684 : removed unintended change from DEV300_m38, which was probably introduced due to some sort of problem during rebase. 2009-02-27 18:51:34 +0100 iha r268613 : #i91578# display of hidden cells - interface redesign: data provider+sequences are now controlled by the chart via a new parameter 'IncludeHiddenCells' thus unwanted values can be removed early in the communication 2009-02-27 18:45:48 +0100 iha r268612 : #i91578# display of hidden cells - interface redesign: data provider+sequences are now controlled by the chart via a new parameter 'IncludeHiddenCells' thus unwanted values can be removed early in the communication 2009-02-27 18:44:17 +0100 iha r268611 : #i91578# display of hidden cells - interface redesign: data provider+sequences are now controlled by the chart via a new parameter 'IncludeHiddenCells' thus unwanted values can be removed early in the communication 2009-02-27 18:35:09 +0100 iha r268610 : #i91578# display of hidden cells - copy-paste-scenario: export hidden flag per column on copy for migration to locale table during import upon paste 2009-02-19 06:47:56 +0100 kohei r268257 : also, set the default value of a cached cell to NaN just in case. 2009-02-19 06:42:08 +0100 kohei r268256 : Set the IsValue flag to false by default so that an empty cell is properly flaged as non-value. This fixes the broken missing value treatment. 2009-02-18 20:16:30 +0100 iha r268255 : #i91578# display of hidden cells - radio button 'leave gap' was not clickable anymore 2009-02-17 17:57:24 +0100 iha r268185 : #i91578# display of hidden cells - corrected range highlighting 2009-02-17 15:39:52 +0100 iha r268174 : #i91578# display of hidden cells - still display data point value in tip help of data points in writer 2009-02-17 11:21:00 +0100 iha r267861 : #i91578# display of hidden cells - do not show a space nor a legend entry for hidden series 2009-02-17 11:15:14 +0100 iha r267853 : #i91578# display of hidden cells - do not show a space nor a legend entry for hidden series 2009-02-16 16:48:10 +0100 iha r267826 : #i91578# display of hidden cells - group related ids and minimize changes 2009-02-16 14:32:11 +0100 iha r267813 : #i91578# display of hidden cells - don't share resource identifier as this easily produces conflicts -> move IDs for series options page into a separate file 2009-02-16 13:21:44 +0100 iha r267795 : #i91578# display of hidden cells - remove unused member 2009-02-16 13:13:40 +0100 iha r267794 : #i91578# display of hidden cells - remove unused methods 2009-02-16 13:00:10 +0100 iha r267792 : #i91578# display of hidden - avoid unnecessary data copy 2009-02-16 11:40:41 +0100 iha r267785 : #i91578# display of hidden - corrected typo 2009-02-16 11:28:39 +0100 iha r267783 : #i91578# display of hidden - set correct dirty state in method setIncludeHiddenCells 2009-02-13 17:04:50 +0100 iha r267734 : #i91578# corrected position and visibility of the controls for display of hidden cells in case of stock charts 2009-02-13 15:30:17 +0100 iha r267724 : #i91578# charts without category range and charts with data from writer table were broken causes by features changes for display of hidden cells 2009-01-14 19:47:28 +0100 kohei r266330 : #i91578# Fixed the issue with incorrect tooltip category values. 2009-01-05 22:27:03 +0100 kohei r265887 : fixed a regression where the x-axis failed to display values when they were numeric or dates. 2008-12-24 17:01:15 +0100 kohei r265800 : CWS-TOOLING: rebase CWS koheichart01 to trunk@265758 (milestone: DEV300:m38) 2008-12-24 16:03:08 +0100 kohei r265799 : a little more code cleanup, mostly on tab to whitespace conversion on modified lines and removal of unnecessary 'using' statements. 2008-12-24 15:52:00 +0100 kohei r265798 : removed unnecessary header inclusion & remove hidden data *only when* the 'include hidden cells' options it false! I'm glad I caught this. 2008-12-24 07:41:23 +0100 kohei r265796 : replaced duplicated local functions with a single template function. 2008-12-24 06:37:15 +0100 kohei r265795 : reverted my last commit, because it was not the right approach. Instead of using the original data point index in the object name, leave that index alone, and remove hidden data in the tooltip text value lookup code. 2008-12-23 23:10:42 +0100 kohei r265793 : fixed the tooltips so that they would display correct values, taking into account the hidden data points (if any). 2008-12-20 05:26:07 +0100 kohei r265739 : CWS-TOOLING: rebase CWS koheichart01 to trunk@264807 (milestone: DEV300:m37) 2008-12-18 15:49:59 +0100 kohei r265696 : removed markRangeDirty() for now, since that method is still a bit controvertial per Niklas's comment in i#91578. 2008-12-05 20:27:24 +0100 kohei r264918 : removed a compiler warning. 2008-12-05 20:24:02 +0100 kohei r264917 : removed a compilar warning. 2008-12-03 17:06:22 +0100 kohei r264800 : recovered the original keyword file before it was stripped. 2008-12-01 22:00:24 +0100 kohei r264640 : by default, "include hidden cells" attribute is true. 2008-12-01 19:03:07 +0100 kohei r264628 : added accelerator for the plot hidden values check box. 2008-12-01 18:32:02 +0100 kohei r264626 : changed wording per Ingrid's suggestion. 2008-11-26 08:09:36 +0100 kohei r264341 : the 'Starnding angle' fixed line was 6 pixel short. 2008-11-26 08:02:47 +0100 kohei r264340 : added include-hidden-cells check box for the pie chart type too & some code cleanup. 2008-11-26 07:41:45 +0100 kohei r264339 : relocate the controls correctly for line chart types. 2008-11-26 07:14:26 +0100 kohei r264337 : #i95714# fixed typos that caused incorrect scaling of the y-axis under some conditions. 2008-11-26 07:11:54 +0100 kohei r264336 : added "Include hidden cells" check box in the data series options tab page. 2008-11-25 21:04:58 +0100 kohei r264333 : don't check for the number of charts; when importing from xls, the count may be zero even when the document has charts. 2008-11-25 19:55:50 +0100 kohei r264332 : patch from ooo-build applied. This implements chart listener that listens on cells show/hide state for the chart's data areas. 2008-11-25 19:52:38 +0100 kohei r264331 : patch from ooo-build applied. 2008-11-25 19:29:54 +0100 kohei r264329 : new xml token for include-hidden-cells attribute.
Diffstat (limited to 'xmloff/source/chart')
-rw-r--r--xmloff/source/chart/PropertyMap.hxx1
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx8
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx62
-rw-r--r--xmloff/source/chart/SchXMLTableContext.cxx166
-rw-r--r--xmloff/source/chart/transporttypes.hxx2
5 files changed, 222 insertions, 17 deletions
diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx
index 4608d6043d72..1fdc18fe1035 100644
--- a/xmloff/source/chart/PropertyMap.hxx
+++ b/xmloff/source/chart/PropertyMap.hxx
@@ -139,6 +139,7 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
MAP_ENTRY( "StackedBarsConnected", CHART, XML_CONNECT_BARS, XML_TYPE_BOOL ),
MAP_ENTRY_ODF12( "GroupBarsPerAxis", CHART, XML_GROUP_BARS_PER_AXIS, XML_TYPE_BOOL ),
+ MAP_ENTRY_ODF12( "IncludeHiddenCells", CHART, XML_INCLUDE_HIDDEN_CELLS, XML_TYPE_BOOL ),
MAP_ENTRY_ODF12( "AutomaticPosition", CHART, XML_AUTOMATIC_POSITION, XML_TYPE_BOOL ),
MAP_ENTRY_ODF12( "AutomaticSize", CHART, XML_AUTOMATIC_SIZE, XML_TYPE_BOOL ),
MAP_ENTRY_ODF12( "StartingAngle", CHART, XML_ANGLE_OFFSET, XML_TYPE_NUMBER ),
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index 951a2020ae03..d6072560297a 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -800,10 +800,8 @@ void SchXMLChartContext::EndElement()
else if( msChartAddress.getLength() )
{
// in this case there are range addresses that are simply wrong.
- bool bOldFileWithOwnDataFromRows =
- (mbHasOwnTable && (meDataRowSource==chart::ChartDataRowSource_ROWS) &&
- SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3(
- Reference< frame::XModel >( xNewDoc, uno::UNO_QUERY )));
+ bool bOlderThan2_3 = SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan2_3( Reference< frame::XModel >( xNewDoc, uno::UNO_QUERY ));
+ bool bOldFileWithOwnDataFromRows = (bOlderThan2_3 && mbHasOwnTable && (meDataRowSource==chart::ChartDataRowSource_ROWS));
if( mbAllRangeAddressesAvailable && !bSpecialHandlingForDonutChart && !mbIsStockChart &&
!bOldFileWithOwnDataFromRows )
{
@@ -826,6 +824,8 @@ void SchXMLChartContext::EndElement()
// parameters and change the diagram via template mechanism
try
{
+ if( bOlderThan2_3 && xDiaProp.is() )//for older charts the hidden cells were removed by calc on the fly
+ xDiaProp->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IncludeHiddenCells")),uno::makeAny(false));
ChangeDiagramAccordingToTemplate( xNewDoc );
}
catch( uno::Exception & )
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 3178f0425add..25b9a2b86d1a 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -552,6 +552,31 @@ double lcl_getValueFromSequence( const Reference< chart2::data::XDataSequence >
return aResult;
}
+bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSequence >& xDataSequence )
+{
+ if( !xDataSequence.is() )
+ return false;
+ uno::Reference< beans::XPropertySet > xProp( xDataSequence, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ uno::Sequence< sal_Int32 > aHiddenValues;
+ try
+ {
+ xProp->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "HiddenValues" ) ) ) >>= aHiddenValues;
+ if( !aHiddenValues.getLength() )
+ return true;
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e; // avoid warning
+ return true;
+ }
+ }
+ if( xDataSequence->getData().getLength() )
+ return true;
+ return false;
+}
+
struct lcl_TableData
{
typedef ::std::vector< OUString > tStringContainer;
@@ -563,6 +588,8 @@ struct lcl_TableData
tStringContainer aFirstRowRangeRepresentations;
tStringContainer aFirstColumnStrings;
tStringContainer aFirstColumnRangeRepresentations;
+
+ ::std::vector< sal_Int32 > aHiddenColumns;
};
// ::std::bind2nd( ::std::mem_fun_ref( &T::resize ), nSize ) does not work
@@ -739,6 +766,10 @@ lcl_TableData lcl_getDataForLocalTable(
aRange = xRangeConversion->convertRangeToXML( aRange );
}
aResult.aDataRangeRepresentations.push_back( aRange );
+
+ //is column hidden?
+ if( !lcl_SequenceHasUnhiddenData(aIt->first) && !lcl_SequenceHasUnhiddenData(aIt->second) )
+ aResult.aHiddenColumns.push_back(nSeqIdx);
}
return aResult;
@@ -1383,9 +1414,34 @@ void SchXMLExportHelper::exportTable()
}
{
SvXMLElementExport aColumns( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, sal_True, sal_True );
- mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED,
- OUString::valueOf( static_cast< sal_Int64 >( aData.aFirstRowStrings.size())));
- SvXMLElementExport aColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
+
+ sal_Int32 nNextIndex = 0;
+ for( size_t nN=0; nN< aData.aHiddenColumns.size(); nN++ )
+ {
+ //i91578 display of hidden values (copy paste scenario; export hidden flag thus it can be used during migration to locale table upon paste )
+ sal_Int32 nHiddenIndex = aData.aHiddenColumns[nN];
+ if( nHiddenIndex > nNextIndex )
+ {
+ sal_Int64 nRepeat = static_cast< sal_Int64 >( nHiddenIndex - nNextIndex );
+ if(nRepeat>1)
+ mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED,
+ OUString::valueOf( nRepeat ));
+ SvXMLElementExport aColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
+ }
+ mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_VISIBILITY, GetXMLToken( XML_COLLAPSE ) );
+ SvXMLElementExport aColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
+ nNextIndex = nHiddenIndex+1;
+ }
+
+ sal_Int32 nEndIndex = aData.aFirstRowStrings.size()-1;
+ if( nEndIndex >= nNextIndex )
+ {
+ sal_Int64 nRepeat = static_cast< sal_Int64 >( nEndIndex - nNextIndex + 1 );
+ if(nRepeat>1)
+ mrExport.AddAttribute( XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED,
+ OUString::valueOf( nRepeat ));
+ SvXMLElementExport aColumn( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True );
+ }
}
// export rows with content
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index 43a1e750a1db..046da76497d7 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -43,7 +43,10 @@
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmluconv.hxx>
#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XInternalDataProvider.hpp>
#include <com/sun/star/chart/XChartDataArray.hpp>
#include <com/sun/star/chart/ChartSeriesAddress.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -672,7 +675,8 @@ void SchXMLTableColumnContext::StartElement( const uno::Reference< xml::sax::XAt
{
// get number-columns-repeated attribute
sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
- rtl::OUString aValue;
+ sal_Int32 nRepeated = 1;
+ bool bHidden = false;
for( sal_Int16 i = 0; i < nAttrCount; i++ )
{
@@ -683,19 +687,32 @@ void SchXMLTableColumnContext::StartElement( const uno::Reference< xml::sax::XAt
if( nPrefix == XML_NAMESPACE_TABLE &&
IsXMLToken( aLocalName, XML_NUMBER_COLUMNS_REPEATED ) )
{
- aValue = xAttrList->getValueByIndex( i );
- break; // we only need this attribute
+ rtl::OUString aValue = xAttrList->getValueByIndex( i );
+ if( aValue.getLength())
+ nRepeated = aValue.toInt32();
+ }
+ else if( nPrefix == XML_NAMESPACE_TABLE &&
+ IsXMLToken( aLocalName, XML_VISIBILITY ) )
+ {
+ rtl::OUString aVisibility = xAttrList->getValueByIndex( i );
+ bHidden = aVisibility.equals( GetXMLToken( XML_COLLAPSE ) );
}
}
- if( aValue.getLength())
- {
- sal_Int32 nRepeated = aValue.toInt32();
- mrTable.nNumberOfColsEstimate += nRepeated;
- }
- else
+ sal_Int32 nOldCount = mrTable.nNumberOfColsEstimate;
+ sal_Int32 nNewCount = nOldCount + nRepeated;
+ mrTable.nNumberOfColsEstimate = nNewCount;
+
+ if( bHidden )
{
- mrTable.nNumberOfColsEstimate++;
+ //i91578 display of hidden values (copy paste scenario; use hidden flag during migration to locale table upon paste )
+ sal_Int32 nColOffset = ( mrTable.bHasHeaderColumn ? 1 : 0 );
+ for( sal_Int32 nN = nOldCount; nN<nNewCount; nN++ )
+ {
+ sal_Int32 nHiddenColumnIndex = nN-nColOffset;
+ if( nHiddenColumnIndex>=0 )
+ mrTable.aHiddenColumns.push_back(nHiddenColumnIndex);
+ }
}
}
@@ -1143,5 +1160,134 @@ void SchXMLTableHelper::postProcessTable(
xDataProv, xChartDoc, OUString(RTL_CONSTASCII_USTRINGPARAM("categories")),
0 /* nCooSysIndex */, 0 /* nDimension */ );
}
+
+ //i91578 display of hidden values (copy paste scenario; use hidden flag during migration to locale table upon paste )
+ //remove series that consist only of hidden columns
+ Reference< chart2::XInternalDataProvider > xInternalDataProvider( xDataProv, uno::UNO_QUERY );
+ if( xInternalDataProvider.is() && !rTable.aHiddenColumns.empty() )
+ {
+ try
+ {
+ Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xChartDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
+ for( sal_Int32 nC=0; nC<aCooSysSeq.getLength(); ++nC )
+ {
+ Reference< chart2::XChartTypeContainer > xCooSysContainer( aCooSysSeq[nC], uno::UNO_QUERY_THROW );
+ Sequence< Reference< chart2::XChartType > > aChartTypeSeq( xCooSysContainer->getChartTypes());
+ for( sal_Int32 nT=0; nT<aChartTypeSeq.getLength(); ++nT )
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesContainer( aChartTypeSeq[nT], uno::UNO_QUERY );
+ if(!xSeriesContainer.is())
+ continue;
+ Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
+ std::vector< Reference< chart2::XDataSeries > > aRemainingSeries;
+
+ for( sal_Int32 nS = 0; nS < aSeriesSeq.getLength(); nS++ )
+ {
+ Reference< chart2::data::XDataSource > xDataSource( aSeriesSeq[nS], uno::UNO_QUERY );
+ if( xDataSource.is() )
+ {
+ bool bHasUnhiddenColumns = false;
+ rtl::OUString aRange;
+ uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences() );
+ for( sal_Int32 nN=0; nN< aSequences.getLength(); ++nN )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSequence( aSequences[nN] );
+ if(!xLabeledSequence.is())
+ continue;
+ Reference< chart2::data::XDataSequence > xValues( xLabeledSequence->getValues() );
+ if( xValues.is() )
+ {
+ aRange = xValues->getSourceRangeRepresentation();
+ if( ::std::find( rTable.aHiddenColumns.begin(), rTable.aHiddenColumns.end(), aRange.toInt32() ) == rTable.aHiddenColumns.end() )
+ bHasUnhiddenColumns = true;
+ }
+ if( !bHasUnhiddenColumns )
+ {
+ Reference< chart2::data::XDataSequence > xLabel( xLabeledSequence->getLabel() );
+ if( xLabel.is() )
+ {
+ aRange = xLabel->getSourceRangeRepresentation();
+ sal_Int32 nSearchIndex = 0;
+ OUString aSecondToken = aRange.getToken( 1, ' ', nSearchIndex );
+ if( ::std::find( rTable.aHiddenColumns.begin(), rTable.aHiddenColumns.end(), aSecondToken.toInt32() ) == rTable.aHiddenColumns.end() )
+ bHasUnhiddenColumns = true;
+ }
+ }
+ }
+ if( bHasUnhiddenColumns )
+ aRemainingSeries.push_back( aSeriesSeq[nS] );
+ }
+ }
+
+ if( static_cast<sal_Int32>(aRemainingSeries.size()) != aSeriesSeq.getLength() )
+ {
+ //remove the series that have only hidden data
+ Sequence< Reference< chart2::XDataSeries > > aRemainingSeriesSeq( aRemainingSeries.size());
+ ::std::copy( aRemainingSeries.begin(), aRemainingSeries.end(), aRemainingSeriesSeq.getArray());
+ xSeriesContainer->setDataSeries( aRemainingSeriesSeq );
+
+ //remove unused sequences
+ Reference< chart2::data::XDataSource > xDataSource( xChartDoc, uno::UNO_QUERY );
+ if( xDataSource.is() )
+ {
+ //first detect which collumns are really used
+ std::map< sal_Int32, bool > aUsageMap;
+ rtl::OUString aRange;
+ Sequence< Reference< chart2::data::XLabeledDataSequence > > aUsedSequences( xDataSource->getDataSequences() );
+ for( sal_Int32 nN=0; nN< aUsedSequences.getLength(); ++nN )
+ {
+ Reference< chart2::data::XLabeledDataSequence > xLabeledSequence( aUsedSequences[nN] );
+ if(!xLabeledSequence.is())
+ continue;
+ Reference< chart2::data::XDataSequence > xValues( xLabeledSequence->getValues() );
+ if( xValues.is() )
+ {
+ aRange = xValues->getSourceRangeRepresentation();
+ sal_Int32 nIndex = aRange.toInt32();
+ if( nIndex!=0 || !aRange.equals(lcl_aCategoriesRange) )
+ aUsageMap[nIndex] = true;
+ }
+ Reference< chart2::data::XDataSequence > xLabel( xLabeledSequence->getLabel() );
+ if( xLabel.is() )
+ {
+ aRange = xLabel->getSourceRangeRepresentation();
+ sal_Int32 nSearchIndex = 0;
+ OUString aSecondToken = aRange.getToken( 1, ' ', nSearchIndex );
+ if( aSecondToken.getLength() )
+ aUsageMap[aSecondToken.toInt32()] = true;
+ }
+ }
+
+ ::std::vector< sal_Int32 > aSequenceIndexesToDelete;
+ for( ::std::vector< sal_Int32 >::const_iterator aIt(
+ rTable.aHiddenColumns.begin()); aIt != rTable.aHiddenColumns.end(); ++aIt )
+ {
+ sal_Int32 nSequenceIndex = *aIt;
+ if( aUsageMap.find(nSequenceIndex) != aUsageMap.end() )
+ continue;
+ aSequenceIndexesToDelete.push_back(nSequenceIndex);
+ }
+
+ // delete unnecessary sequences of the internal data
+ // iterate using greatest index first, so that deletion does not
+ // shift other sequences that will be deleted later
+ ::std::sort( aSequenceIndexesToDelete.begin(), aSequenceIndexesToDelete.end());
+ for( ::std::vector< sal_Int32 >::reverse_iterator aIt(
+ aSequenceIndexesToDelete.rbegin()); aIt != aSequenceIndexesToDelete.rend(); ++aIt )
+ {
+ if( *aIt != -1 )
+ xInternalDataProvider->deleteSequence( *aIt );
+ }
+ }
+ }
+ }
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ (void)ex; // avoid warning for pro build
+ }
+ }
}
diff --git a/xmloff/source/chart/transporttypes.hxx b/xmloff/source/chart/transporttypes.hxx
index fd100b85489d..41bb93fe4401 100644
--- a/xmloff/source/chart/transporttypes.hxx
+++ b/xmloff/source/chart/transporttypes.hxx
@@ -68,6 +68,8 @@ struct SchXMLTable
::rtl::OUString aTableNameOfFile; /// the table name read at the table:table element
+ ::std::vector< sal_Int32 > aHiddenColumns;
+
SchXMLTable() : nRowIndex( -1 ),
nColumnIndex( -1 ),
nMaxColumnIndex( -1 ),