ooo-build r15072 - in branches/ooo-build-3-0-1: . patches/dev300
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r15072 - in branches/ooo-build-3-0-1: . patches/dev300
- Date: Wed, 14 Jan 2009 19:18:46 +0000 (UTC)
Author: kyoshida
Date: Wed Jan 14 19:18:46 2009
New Revision: 15072
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15072&view=rev
Log:
2009-01-14 Kohei Yoshida <kyoshida novell com>
* patches/dev300/apply:
* patches/dev300/chart-skip-hidden-cells-chart2.diff:
* patches/dev300/chart-skip-hidden-cells-sc.diff:
* patches/dev300/chart-skip-hidden-cells-xmloff.diff: ported from
opensuse-11-1 branch to implement "skip hidden cells" functionality in
charts.
* patches/dev300/chart-refresh-mark-range-dirty.diff: removed; combined
with the above patch set.
Added:
branches/ooo-build-3-0-1/patches/dev300/chart-skip-hidden-cells-xmloff.diff
Removed:
branches/ooo-build-3-0-1/patches/dev300/chart-refresh-mark-range-dirty.diff
Modified:
branches/ooo-build-3-0-1/ChangeLog
branches/ooo-build-3-0-1/patches/dev300/apply
branches/ooo-build-3-0-1/patches/dev300/chart-skip-hidden-cells-chart2.diff
branches/ooo-build-3-0-1/patches/dev300/chart-skip-hidden-cells-sc.diff
Modified: branches/ooo-build-3-0-1/patches/dev300/apply
==============================================================================
--- branches/ooo-build-3-0-1/patches/dev300/apply (original)
+++ branches/ooo-build-3-0-1/patches/dev300/apply Wed Jan 14 19:18:46 2009
@@ -1804,8 +1804,10 @@
# fix bug generating a specific Sheet reference
parse-xla1-bad-3dflag.diff, n#422569, noelpwer
-# mark data range dirty to force full re-calculation.
-chart-refresh-mark-range-dirty.diff, n#425617, kohei
+# skip data in hidden cells when rendering charts.
+chart-skip-hidden-cells-chart2.diff, n#404190, i#81209, n#427545, kohei
+chart-skip-hidden-cells-sc.diff, n#404190, i#81209, n#425617, kohei
+chart-skip-hidden-cells-xmloff.diff, n#404190, i#81209, n#425617, kohei
# fix 'Identify Categories' greakage on grouping.
calc-dp-group-ident-category-fix.diff, n#447182, i#96171, kohei
Modified: branches/ooo-build-3-0-1/patches/dev300/chart-skip-hidden-cells-chart2.diff
==============================================================================
--- branches/ooo-build-3-0-1/patches/dev300/chart-skip-hidden-cells-chart2.diff (original)
+++ branches/ooo-build-3-0-1/patches/dev300/chart-skip-hidden-cells-chart2.diff Wed Jan 14 19:18:46 2009
@@ -1,9 +1,222 @@
+diff --git chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+index df18ec8..3d4e9a9 100644
+--- chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
++++ chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+@@ -113,6 +113,7 @@ enum
+ PROP_DIAGRAM_DATAROW_SOURCE,
+
+ PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
++ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
+
+ PROP_DIAGRAM_SORT_BY_X_VALUES,
+
+@@ -230,6 +231,13 @@ void lcl_AddPropertiesToVector(
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
++ rOutProperties.push_back(
++ Property( C2U( "IncludeHiddenCells" ),
++ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
++ ::getBooleanCppuType(),
++ beans::PropertyAttribute::BOUND
++ | beans::PropertyAttribute::MAYBEDEFAULT ));
++
+ //new for XY charts
+ rOutProperties.push_back(
+ Property( C2U( "SortByXValues" ),
+diff --git chart2/source/controller/dialogs/ObjectNameProvider.cxx chart2/source/controller/dialogs/ObjectNameProvider.cxx
+index d477a34..20d9b81 100644
+--- chart2/source/controller/dialogs/ObjectNameProvider.cxx
++++ chart2/source/controller/dialogs/ObjectNameProvider.cxx
+@@ -63,6 +63,10 @@ using namespace ::com::sun::star::chart2;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Any;
++using ::com::sun::star::uno::UNO_QUERY;
++using ::com::sun::star::chart2::XDiagram;
++using ::com::sun::star::beans::XPropertySet;
++using ::com::sun::star::beans::UnknownPropertyException;
+ using rtl::OUString;
+
+ namespace
+@@ -95,11 +99,33 @@ void lcl_addText( OUString& rOut, const OUString& rSeparator, const OUString& rN
+ rOut+=rNext;
+ }
+
++bool lcl_isHiddenCellsIncluded( const Reference<frame::XModel>& xChartModel )
++{
++ bool bIncluded = true; // hidden cells are included by default.
++
++ Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
++ if (!xDiagram.is())
++ return bIncluded;
++
++ Reference< XPropertySet > xProp( xDiagram, UNO_QUERY );
++ if (!xProp.is())
++ return bIncluded;
++
++ try
++ {
++ xProp->getPropertyValue(C2U("IncludeHiddenCells")) >>= bIncluded;
++ }
++ catch (const UnknownPropertyException&)
++ {
++ }
++
++ return bIncluded;
++}
++
+ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal_Int32 nPointIndex,
+ const Reference< XCoordinateSystem >& xCooSys,
+ const Reference< frame::XModel >& xChartModel )
+ {
+-
+ OUString aRet;
+
+ Reference<data::XDataSource> xDataSource(
+@@ -111,6 +137,7 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
+
+ rtl::OUString aX, aY, aY_Min, aY_Max, aY_First, aY_Last;
+ double fValue = 0;
++ bool bIncludeHiddenCells = lcl_isHiddenCellsIncluded(xChartModel);
+
+ uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY );
+ NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
+@@ -130,6 +157,14 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
+ {
+ try
+ {
++ if (!bIncludeHiddenCells)
++ {
++ Sequence<sal_Int32> aHiddenValues;
++ xProp->getPropertyValue( C2U("HiddenValues") ) >>= aHiddenValues;
++ if (aHiddenValues.getLength())
++ DataSeriesHelper::removeHiddenDataPoints(aData, aHiddenValues);
++ }
++
+ uno::Any aARole = xProp->getPropertyValue( C2U( "Role" ) );
+ rtl::OUString aRole;
+ aARole >>= aRole;
+@@ -184,7 +219,7 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal
+
+ replaceParamterInString( aCategory
+ , C2U("%CATEGORYVALUE")
+- , ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, nPointIndex )
++ , ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, nPointIndex, bIncludeHiddenCells )
+ );
+
+ aRet = aCategory;
+diff --git chart2/source/inc/DataSeriesHelper.hxx chart2/source/inc/DataSeriesHelper.hxx
+index a7e1019..0cf57eb 100644
+--- chart2/source/inc/DataSeriesHelper.hxx
++++ chart2/source/inc/DataSeriesHelper.hxx
+@@ -41,6 +41,7 @@
+
+ #include <vector>
+ #include <functional>
++#include <hash_set>
+
+ namespace chart
+ {
+@@ -177,6 +178,34 @@ bool hasAttributedDataPointDifferentValue(
+ const ::rtl::OUString& rPropertyName,
+ const ::com::sun::star::uno::Any& rPropertyValue );
+
++template<typename T>
++void removeHiddenDataPoints(
++ ::com::sun::star::uno::Sequence<T>& rDataPoints,
++ const ::com::sun::star::uno::Sequence<sal_Int32>& rHiddenIndices )
++{
++ ::std::hash_set<sal_Int32> aIndices;
++ sal_Int32 n = rHiddenIndices.getLength();
++ for (sal_Int32 i = 0; i < n; ++i)
++ aIndices.insert(rHiddenIndices[i]);
++
++ ::std::vector<T> aNewDataVector;
++ n = rDataPoints.getLength();
++ aNewDataVector.reserve(n);
++ for (sal_Int32 i = 0; i < n; ++i)
++ {
++ if (aIndices.count(i))
++ // skip this value.
++ continue;
++
++ aNewDataVector.push_back(rDataPoints[i]);
++ }
++
++ n = aNewDataVector.size();
++ rDataPoints.realloc(n);
++ for (size_t i = 0; i < static_cast<size_t>(n); ++i)
++ rDataPoints[i] = aNewDataVector[i];
++}
++
+ } // namespace DataSeriesHelper
+ } // namespace chart
+
+diff --git chart2/source/inc/ExplicitCategoriesProvider.hxx chart2/source/inc/ExplicitCategoriesProvider.hxx
+index e6bf4fc..ad0b21e 100644
+--- chart2/source/inc/ExplicitCategoriesProvider.hxx
++++ chart2/source/inc/ExplicitCategoriesProvider.hxx
+@@ -56,11 +56,15 @@ public:
+ static ::rtl::OUString getCategoryByIndex(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel,
+- sal_Int32 nIndex );
++ sal_Int32 nIndex, bool bIncludeHiddenCells );
++
++ void setIncludeHiddenCells(bool b);
++ bool getIncludeHiddenCells() const;
+
+ private: //member
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aExplicitCategories;
+ bool volatile m_bDirty;
++ bool m_bIncludeHiddelCells;
+
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel;
+diff --git chart2/source/model/main/Diagram.cxx chart2/source/model/main/Diagram.cxx
+index b7c1eb7..cc6dc2c 100644
+--- chart2/source/model/main/Diagram.cxx
++++ chart2/source/model/main/Diagram.cxx
+@@ -79,6 +79,7 @@ enum
+ PROP_DIAGRAM_SORT_BY_X_VALUES,
+ PROP_DIAGRAM_CONNECT_BARS,
+ PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
++ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
+ PROP_DIAGRAM_STARTING_ANGLE,
+ PROP_DIAGRAM_RIGHT_ANGLED_AXES,
+ PROP_DIAGRAM_PERSPECTIVE,
+@@ -125,6 +126,13 @@ void lcl_AddPropertiesToVector(
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
++ Property( C2U("IncludeHiddenCells"),
++ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
++ ::getBooleanCppuType(),
++ beans::PropertyAttribute::BOUND
++ | beans::PropertyAttribute::MAYBEDEFAULT ));
++
++ rOutProperties.push_back(
+ Property( C2U( "StartingAngle" ),
+ PROP_DIAGRAM_STARTING_ANGLE,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0) ),
+@@ -163,6 +171,7 @@ void lcl_AddDefaultsToMap(
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_SORT_BY_X_VALUES, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_CONNECT_BARS, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_GROUP_BARS_PER_AXIS, true );
++ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_RIGHT_ANGLED_AXES, false );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
+ }
diff --git chart2/source/tools/ExplicitCategoriesProvider.cxx chart2/source/tools/ExplicitCategoriesProvider.cxx
-index acd9585..92ce516 100644
+index acd9585..c53a909 100644
--- chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ chart2/source/tools/ExplicitCategoriesProvider.cxx
-@@ -34,6 +34,10 @@
+@@ -32,8 +32,13 @@
+ #include "precompiled_chart2.hxx"
+
#include "ExplicitCategoriesProvider.hxx"
++#include "DataSeriesHelper.hxx"
#include "DiagramHelper.hxx"
#include "CommonConverters.hxx"
+#include "macros.hxx"
@@ -13,7 +226,7 @@
//.............................................................................
namespace chart
-@@ -45,6 +49,8 @@ using namespace ::com::sun::star::chart2;
+@@ -45,9 +50,12 @@ using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
using rtl::OUString;
@@ -22,37 +235,11 @@
ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2::XCoordinateSystem >& xCooSysModel )
: m_bDirty(true)
-@@ -63,15 +69,59 @@ ExplicitCategoriesProvider::~ExplicitCategoriesProvider()
++ , m_bIncludeHiddelCells(true)
+ , m_xCooSysModel( xCooSysModel )
+ , m_xCategories()
{
- }
-
-+static void lcl_removeHiddenIndices(Sequence<OUString>& rCategories, const Sequence<sal_Int32>& rHiddenValues)
-+{
-+ hash_set<sal_Int32> aIndices;
-+ sal_Int32 n = rHiddenValues.getLength();
-+ for (sal_Int32 i = 0; i < n; ++i)
-+ aIndices.insert(rHiddenValues[i]);
-+
-+ vector<OUString> aNewCatsVector;
-+ n = rCategories.getLength();
-+ aNewCatsVector.reserve(n);
-+ for (sal_Int32 i = 0; i < n; ++i)
-+ {
-+ if (aIndices.count(i))
-+ // skip this value.
-+ continue;
-+
-+ aNewCatsVector.push_back(rCategories[i]);
-+ }
-+
-+ n = aNewCatsVector.size();
-+ rCategories.realloc(n);
-+ for (size_t i = 0; i < n; ++i)
-+ rCategories[i] = aNewCatsVector[i];
-+}
-+
- //XTextualDataSequence
- Sequence< ::rtl::OUString > SAL_CALL ExplicitCategoriesProvider::getTextualData() throw( uno::RuntimeException)
+@@ -68,23 +76,55 @@ Sequence< ::rtl::OUString > SAL_CALL ExplicitCategoriesProvider::getTextualData(
{
if( m_bDirty )
{
@@ -73,10 +260,11 @@
+ xProp->getPropertyValue( C2U( "HiddenValues" ) ) >>= aHiddenValues;
+ }
+
-+ if (!bIsHidden)
++ if (!bIsHidden || m_bIncludeHiddelCells)
+ {
+ m_aExplicitCategories = DataSequenceToStringSequence(xValues);
-+ lcl_removeHiddenIndices(m_aExplicitCategories, aHiddenValues);
++ if (!m_bIncludeHiddelCells)
++ DataSeriesHelper::removeHiddenDataPoints(m_aExplicitCategories, aHiddenValues);
+
+ if(!m_aExplicitCategories.getLength())
+ m_aExplicitCategories = DiagramHelper::generateAutomaticCategories(
@@ -86,16 +274,307 @@
m_bDirty = false;
}
return m_aExplicitCategories;
+ }
+
++void ExplicitCategoriesProvider::setIncludeHiddenCells(bool b)
++{
++ m_bIncludeHiddelCells = b;
++}
++
++bool ExplicitCategoriesProvider::getIncludeHiddenCells() const
++{
++ return m_bIncludeHiddelCells;
++}
++
+ // static
+ OUString ExplicitCategoriesProvider::getCategoryByIndex(
+ const Reference< XCoordinateSystem >& xCooSysModel,
+- sal_Int32 nIndex )
++ sal_Int32 nIndex, bool bIncludeHiddenCells )
+ {
+ if( xCooSysModel.is())
+ {
+- Reference< XTextualDataSequence > xTemp( new ExplicitCategoriesProvider( xCooSysModel ));
++ ExplicitCategoriesProvider* p = new ExplicitCategoriesProvider(xCooSysModel);
++ p->setIncludeHiddenCells(bIncludeHiddenCells);
++ Reference< XTextualDataSequence > xTemp(p);
+ if( xTemp.is())
+ {
+ Sequence< OUString > aCategories( xTemp->getTextualData());
+diff --git chart2/source/tools/UncachedDataSequence.cxx chart2/source/tools/UncachedDataSequence.cxx
+index bcf99f7..1fa3b00 100644
+--- chart2/source/tools/UncachedDataSequence.cxx
++++ chart2/source/tools/UncachedDataSequence.cxx
+@@ -79,7 +79,7 @@ UncachedDataSequence::UncachedDataSequence(
+ const OUString & rRangeRepresentation )
+ : OPropertyContainer( GetBroadcastHelper()),
+ UncachedDataSequence_Base( GetMutex()),
+- m_bIsHidden( true ),
++ m_bIsHidden( false ),
+ m_xDataProvider( xIntDataProv ),
+ m_aSourceRepresentation( rRangeRepresentation ),
+ m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+@@ -93,7 +93,7 @@ UncachedDataSequence::UncachedDataSequence(
+ const OUString & rRole )
+ : OPropertyContainer( GetBroadcastHelper()),
+ UncachedDataSequence_Base( GetMutex()),
+- m_bIsHidden( true ),
++ m_bIsHidden( false ),
+ m_xDataProvider( xIntDataProv ),
+ m_aSourceRepresentation( rRangeRepresentation ),
+ m_xModifyEventForwarder( new ModifyListenerHelper::ModifyEventForwarder())
+diff --git chart2/source/view/axes/VCoordinateSystem.cxx chart2/source/view/axes/VCoordinateSystem.cxx
+index 148b28c..82a4538 100644
+--- chart2/source/view/axes/VCoordinateSystem.cxx
++++ chart2/source/view/axes/VCoordinateSystem.cxx
+@@ -598,6 +598,16 @@ void VCoordinateSystem::setSeriesNamesForAxis( const Sequence< rtl::OUString >&
+ m_aSeriesNamesForZAxis = rSeriesNames;
+ }
+
++void VCoordinateSystem::setIncludeHiddenCells(bool b)
++{
++ m_aExplicitCategoriesProvider->setIncludeHiddenCells(b);
++}
++
++bool VCoordinateSystem::getIncludeHiddenCells() const
++{
++ return m_aExplicitCategoriesProvider->getIncludeHiddenCells();
++}
++
+ sal_Int32 VCoordinateSystem::getNumberFormatKeyForAxis(
+ const Reference< chart2::XAxis >& xAxis
+ , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier )
+diff --git chart2/source/view/inc/VCoordinateSystem.hxx chart2/source/view/inc/VCoordinateSystem.hxx
+index cc0f512..d816e2e 100644
+--- chart2/source/view/inc/VCoordinateSystem.hxx
++++ chart2/source/view/inc/VCoordinateSystem.hxx
+@@ -133,6 +133,9 @@ public:
+ virtual bool needSeriesNamesForAxis() const;
+ void setSeriesNamesForAxis( const ::com::sun::star::uno::Sequence< rtl::OUString >& rSeriesNames );
+
++ void setIncludeHiddenCells(bool b);
++ bool getIncludeHiddenCells() const;
++
+ protected: //methods
+ VCoordinateSystem( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
+diff --git chart2/source/view/inc/VDataSeries.hxx chart2/source/view/inc/VDataSeries.hxx
+index 135fcf8..11a5bd8 100644
+--- chart2/source/view/inc/VDataSeries.hxx
++++ chart2/source/view/inc/VDataSeries.hxx
+@@ -59,7 +59,7 @@ class VDataSequence
+ {
+ public:
+ void init( const ::com::sun::star::uno::Reference<
+- ::com::sun::star::chart2::data::XDataSequence >& xModel);
++ ::com::sun::star::chart2::data::XDataSequence >& xModel, bool bIncludeHiddenCells );
+ bool is() const;
+ void clear();
+ double getValue( sal_Int32 index ) const;
+@@ -77,7 +77,7 @@ class VDataSeries
+ {
+ public:
+ VDataSeries( const ::com::sun::star::uno::Reference<
+- ::com::sun::star::chart2::XDataSeries >& xDataSeries );
++ ::com::sun::star::chart2::XDataSeries >& xDataSeries, bool bIncludeHiddenCells );
+ virtual ~VDataSeries();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >
+@@ -138,6 +138,9 @@ public:
+ void setGroupBarsPerAxis( sal_Bool bGroupBarsPerAxis );
+ sal_Bool getGroupBarsPerAxis() const;
+
++ void setIncludeHiddenCells( sal_Bool bIncludeHiddenCells );
++ sal_Bool getIncludeHiddenCells() const;
++
+ void setStartingAngle( sal_Int32 nStartingAngle );
+ sal_Int32 getStartingAngle() const;
+
+@@ -217,6 +220,8 @@ private: //member
+
+ sal_Bool m_bGroupBarsPerAxis;
+
++ sal_Bool m_bIncludeHiddenCells;
++
+ sal_Int32 m_nStartingAngle;
+
+ rtl::OUString m_aSeriesParticle;
+diff --git chart2/source/view/main/ChartView.cxx chart2/source/view/main/ChartView.cxx
+index a16fffd..63075dc 100644
+--- chart2/source/view/main/ChartView.cxx
++++ chart2/source/view/main/ChartView.cxx
+@@ -621,6 +621,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
+ sal_Bool bSortByXValues = sal_False;
+ sal_Bool bConnectBars = sal_False;
+ sal_Bool bGroupBarsPerAxis = sal_True;
++ sal_Bool bIncludeHiddenCells = sal_True;
+ sal_Int32 nStartingAngle = 90;
+ try
+ {
+@@ -628,6 +629,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
+ xDiaProp->getPropertyValue( C2U( "SortByXValues" ) ) >>= bSortByXValues;
+ xDiaProp->getPropertyValue( C2U( "ConnectBars" ) ) >>= bConnectBars;
+ xDiaProp->getPropertyValue( C2U( "GroupBarsPerAxis" ) ) >>= bGroupBarsPerAxis;
++ xDiaProp->getPropertyValue( C2U( "IncludeHiddenCells" ) ) >>= bIncludeHiddenCells;
+ xDiaProp->getPropertyValue( C2U( "StartingAngle" ) ) >>= nStartingAngle;
+ }
+ catch( const uno::Exception & ex )
+@@ -653,6 +655,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
+ {
+ uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] );
+ VCoordinateSystem* pVCooSys = addCooSysToList(m_rVCooSysList,xCooSys,xChartModel);
++ pVCooSys->setIncludeHiddenCells(bIncludeHiddenCells);
+
+ //iterate through all chart types in the current coordinate system
+ uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
+@@ -692,7 +695,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
+ uno::Reference< XDataSeries > xDataSeries( aSeriesList[nS], uno::UNO_QUERY );
+ if(!xDataSeries.is())
+ continue;
+- VDataSeries* pSeries = new VDataSeries( xDataSeries );
++ VDataSeries* pSeries = new VDataSeries( xDataSeries, bIncludeHiddenCells );
+
+ pSeries->setGlobalSeriesIndex(nGlobalSeriesIndex);
+ nGlobalSeriesIndex++;
diff --git chart2/source/view/main/VDataSeries.cxx chart2/source/view/main/VDataSeries.cxx
-index 7fdddce..608f548 100644
+index fdee8d7..c558a00 100644
--- chart2/source/view/main/VDataSeries.cxx
+++ chart2/source/view/main/VDataSeries.cxx
-@@ -108,7 +108,7 @@ namespace
+@@ -37,6 +37,7 @@
+ #include "LabelPositionHelper.hxx"
+ #include "ChartTypeHelper.hxx"
+ #include "ContainerHelper.hxx"
++#include "DataSeriesHelper.hxx"
+ #include "MeanValueRegressionCurveCalculator.hxx"
- void VDataSequence::init( const uno::Reference< data::XDataSequence >& xModel )
+ #include <com/sun/star/chart2/Symbol.hpp>
+@@ -70,50 +71,13 @@ namespace
+ return ( first < second );
+ }
+ };
+-
+- void lcl_removeIndices( uno::Sequence< double >& rValues, const uno::Sequence< sal_Int32 >& rIndicesToRemove )
+- {
+- if( !rIndicesToRemove.getLength() )
+- return;
+-
+- ::std::vector< sal_Int32 > aIndicesToRemove( ContainerHelper::SequenceToVector( rIndicesToRemove) );
+- ::std::sort( aIndicesToRemove.begin(), aIndicesToRemove.end(), lcl_LessIndex() );
+-
+- sal_Int32 nTarget=0;
+- sal_Int32 nR = 0;
+- sal_Int32 nRemove = aIndicesToRemove[nR];
+- for( sal_Int32 nSource=0; nSource<rValues.getLength(); nSource++ )
+- {
+- if( nSource<nRemove || nRemove==-1 )
+- {
+- if( nTarget < nSource )
+- rValues[nTarget]=rValues[nSource];
+- nTarget++;
+- continue;
+- }
+- if( nSource==nRemove )
+- {
+- ++nR;
+- if( nR<static_cast<sal_Int32>(aIndicesToRemove.size()) )
+- nRemove = aIndicesToRemove[nR];
+- else
+- nRemove = -1;
+- }
+- }
+-
+- if( nTarget>0 )
+- rValues.realloc( nTarget );
+- else
+- rValues.realloc(0);
+- }
+ }
+
+-void VDataSequence::init( const uno::Reference< data::XDataSequence >& xModel )
++void VDataSequence::init( const uno::Reference< data::XDataSequence >& xModel, bool bIncludeHiddenCells )
{
- bool bDisplayHiddenCells = true; //todo: make this configurable in future
-+ bool bDisplayHiddenCells = false; //todo: make this configurable in future
bool bIsHidden = false;
uno::Sequence< sal_Int32 > aHiddenValues;
- if( !bDisplayHiddenCells )
+- if( !bDisplayHiddenCells )
++ if( !bIncludeHiddenCells )
+ {
+ uno::Reference<beans::XPropertySet> xProp(xModel, uno::UNO_QUERY );
+ if( xProp.is())
+@@ -131,15 +95,15 @@ void VDataSequence::init( const uno::Reference< data::XDataSequence >& xModel )
+ }
+
+ Model = xModel;
+- if( bDisplayHiddenCells || !bIsHidden )
++ if( bIncludeHiddenCells || !bIsHidden )
+ Doubles = DataSequenceToDoubleSequence( xModel );
+
+- if( !bDisplayHiddenCells )
++ if( !bIncludeHiddenCells )
+ {
+ if( bIsHidden )
+ Doubles.realloc(0);
+ else if( aHiddenValues.getLength() )
+- lcl_removeIndices( Doubles, aHiddenValues );
++ DataSeriesHelper::removeHiddenDataPoints(Doubles, aHiddenValues);
+ }
+ }
+
+@@ -205,7 +169,7 @@ VDataSeries::VDataSeries()
+ DBG_ERROR("not implemented");
+ }
+
+-VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
++VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries, bool bIncludeHiddenCells )
+ : m_nPolygonIndex(0)
+ , m_fLogicMinX(0.0)
+ , m_fLogicMaxX(0.0)
+@@ -235,6 +199,7 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
+ , m_nAxisIndex(0)
+ , m_bConnectBars(sal_False)
+ , m_bGroupBarsPerAxis(sal_True)
++ , m_bIncludeHiddenCells(bIncludeHiddenCells)
+ , m_nStartingAngle(90)
+
+ , m_aSeriesParticle()
+@@ -278,17 +243,17 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries )
+ aARole >>= aRole;
+
+ if( aRole.equals(C2U("values-x")) )
+- m_aValues_X.init( xDataSequence );
++ m_aValues_X.init( xDataSequence, bIncludeHiddenCells );
+ else if( aRole.equals(C2U("values-y")) )
+- m_aValues_Y.init( xDataSequence );
++ m_aValues_Y.init( xDataSequence, bIncludeHiddenCells );
+ else if( aRole.equals(C2U("values-min")) )
+- m_aValues_Y_Min.init( xDataSequence );
++ m_aValues_Y_Min.init( xDataSequence, bIncludeHiddenCells );
+ else if( aRole.equals(C2U("values-max")) )
+- m_aValues_Y_Max.init( xDataSequence );
++ m_aValues_Y_Max.init( xDataSequence, bIncludeHiddenCells );
+ else if( aRole.equals(C2U("values-first")) )
+- m_aValues_Y_First.init( xDataSequence );
++ m_aValues_Y_First.init( xDataSequence, bIncludeHiddenCells );
+ else if( aRole.equals(C2U("values-last")) )
+- m_aValues_Y_Last.init( xDataSequence );
++ m_aValues_Y_Last.init( xDataSequence, bIncludeHiddenCells );
+ //@todo assign the other roles (+ error for unknown?)
+ }
+ catch( uno::Exception& e )
+@@ -483,6 +448,16 @@ sal_Bool VDataSeries::getGroupBarsPerAxis() const
+ return m_bGroupBarsPerAxis;
+ }
+
++void VDataSeries::setIncludeHiddenCells( sal_Bool bIncludeHiddenCells )
++{
++ m_bIncludeHiddenCells = bIncludeHiddenCells;
++}
++
++sal_Bool VDataSeries::getIncludeHiddenCells() const
++{
++ return m_bIncludeHiddenCells;
++}
++
+ void VDataSeries::setStartingAngle( sal_Int32 nStartingAngle )
+ {
+ m_nStartingAngle = nStartingAngle;
Modified: branches/ooo-build-3-0-1/patches/dev300/chart-skip-hidden-cells-sc.diff
==============================================================================
--- branches/ooo-build-3-0-1/patches/dev300/chart-skip-hidden-cells-sc.diff (original)
+++ branches/ooo-build-3-0-1/patches/dev300/chart-skip-hidden-cells-sc.diff Wed Jan 14 19:18:46 2009
@@ -1,24 +1,36 @@
diff --git sc/inc/chart2uno.hxx sc/inc/chart2uno.hxx
-index 2d98a5f..4f53e17 100644
+index aa13bef..5a7769b 100644
--- sc/inc/chart2uno.hxx
+++ sc/inc/chart2uno.hxx
-@@ -59,6 +59,7 @@
+@@ -33,6 +33,7 @@
+
+ #include "cellsuno.hxx" // for XModifyListenerArr_Impl / ScLinkListener
+ #include "rangelst.hxx"
++#include "chartlis.hxx"
+ #include <svtools/lstner.hxx>
+ #include <com/sun/star/chart2/data/XDataProvider.hpp>
+ #include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
+@@ -59,6 +60,8 @@
#include <map>
#include <list>
+#include <vector>
++#include <memory>
class ScDocument;
-@@ -382,6 +383,7 @@ public:
+@@ -379,6 +382,10 @@ public:
// static ScChart2DataSequence* getImplementation( const com::sun::star::uno::Reference<
// com::sun::star::uno::XInterface> xObj );
+private:
++ void markRangeDirty(const ScRange& rRange) const;
++ void setDataChangedHint(bool b);
++
// Implementation --------------------------------------------------------
ScRangeListRef GetRangeList() { return m_xRanges; }
-@@ -389,8 +391,26 @@ public:
+@@ -386,8 +393,38 @@ public:
void RefChanged();
DECL_LINK( ValueListenerHdl, SfxHint* );
@@ -39,17 +51,107 @@
+ Item();
+ };
+
++ class HiddenRangeListener : public ScChartHiddenRangeListener
++ {
++ public:
++ HiddenRangeListener(ScChart2DataSequence& rParent);
++ virtual ~HiddenRangeListener();
++
++ virtual void notify();
++
++ private:
++ ScChart2DataSequence& mrParent;
++ };
++
+ ::std::list<Item> m_aDataArray;
+ ::com::sun::star::uno::Sequence<sal_Int32> m_aHiddenValues;
+
// properties
::com::sun::star::chart2::data::DataSequenceRole m_aRole;
sal_Bool m_bHidden;
+@@ -398,6 +435,7 @@ private:
+ com::sun::star::uno::Reference < com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
+ SfxItemPropertySet m_aPropSet;
+
++ ::std::auto_ptr<HiddenRangeListener> m_pHiddenListener;
+ ScLinkListener* m_pValueListener;
+ sal_Bool m_bGotDataChangedHint;
+ XModifyListenerArr_Impl m_aValueListeners;
+diff --git sc/inc/chartlis.hxx sc/inc/chartlis.hxx
+index 0069085..60e77ce 100644
+--- sc/inc/chartlis.hxx
++++ sc/inc/chartlis.hxx
+@@ -37,6 +37,8 @@
+ #include "collect.hxx"
+ #include "rangelst.hxx"
+
++#include <list>
++
+ class ScDocument;
+ class ScChartUnoData;
+ #include <com/sun/star/chart/XChartData.hpp>
+@@ -97,9 +99,31 @@ public:
+ { return !operator==( r ); }
+ };
+
++// ============================================================================
++
++class ScChartHiddenRangeListener
++{
++public:
++ ScChartHiddenRangeListener();
++ virtual ~ScChartHiddenRangeListener();
++ virtual void notify() = 0;
++};
++
++// ============================================================================
++
+ class ScChartListenerCollection : public StrCollection
+ {
++public:
++ struct RangeListenerItem
++ {
++ ScRange maRange;
++ ScChartHiddenRangeListener* mpListener;
++ explicit RangeListenerItem(const ScRange& rRange, ScChartHiddenRangeListener* p);
++ };
++
+ private:
++ ::std::list<RangeListenerItem> maHiddenListeners;
++
+ Timer aTimer;
+ ScDocument* pDoc;
+
+@@ -139,6 +163,24 @@ public:
+ void UpdateChartsContainingTab( SCTAB nTab );
+
+ BOOL operator==( const ScChartListenerCollection& );
++
++ /**
++ * Start listening on hide/show change within specified cell range. A
++ * single listener may listen on multiple ranges when the caller passes
++ * the same pointer multiple times with different ranges.
++ *
++ * Note that the caller is responsible for managing the life-cycle of the
++ * listener instance.
++ */
++ void StartListeningHiddenRange( const ScRange& rRange,
++ ScChartHiddenRangeListener* pListener );
++
++ /**
++ * Remove all ranges associated with passed listener instance from the
++ * list of hidden range listeners. This does not delete the passed
++ * listener instance.
++ */
++ void EndListeningHiddenRange( ScChartHiddenRangeListener* pListener );
+ };
+
+
diff --git sc/inc/unonames.hxx sc/inc/unonames.hxx
-index 4193574..fcfd0fb 100644
+index ca77ea8..8bc928b 100644
--- sc/inc/unonames.hxx
+++ sc/inc/unonames.hxx
-@@ -606,6 +606,7 @@
+@@ -608,6 +608,7 @@
// Chart2
#define SC_UNONAME_ISHIDDEN "IsHidden"
#define SC_UNONAME_ROLE "Role"
@@ -57,11 +159,251 @@
// Solver
#define SC_UNONAME_TIMEOUT "Timeout"
+diff --git sc/source/core/data/table2.cxx sc/source/core/data/table2.cxx
+index 243a9c1..fb9fbd0 100644
+--- sc/source/core/data/table2.cxx
++++ sc/source/core/data/table2.cxx
+@@ -2224,7 +2224,7 @@ void ScTable::ShowCol(SCCOL nCol, BOOL bShow)
+ SetDrawPageSize();
+
+ ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
+- if ( pCharts && pCharts->GetCount() )
++ if ( pCharts )
+ pCharts->SetRangeDirty(ScRange( nCol, 0, nTab, nCol, MAXROW, nTab ));
+ }
+ }
+@@ -2261,7 +2261,7 @@ void ScTable::ShowRow(SCROW nRow, BOOL bShow)
+ SetDrawPageSize();
+
+ ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
+- if ( pCharts && pCharts->GetCount() )
++ if ( pCharts )
+ pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, MAXCOL, nRow, nTab ));
+ }
+ }
+@@ -2302,7 +2302,7 @@ void ScTable::DBShowRow(SCROW nRow, BOOL bShow)
+ if (bWasVis != bShow)
+ {
+ ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
+- if ( pCharts && pCharts->GetCount() )
++ if ( pCharts )
+ pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, MAXCOL, nRow, nTab ));
+
+ if (pOutlineTable)
+@@ -2350,7 +2350,7 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow)
+ if ( bChanged )
+ {
+ ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
+- if ( pCharts && pCharts->GetCount() )
++ if ( pCharts )
+ pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab ));
+ }
+
+@@ -2408,7 +2408,7 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow)
+ if ( bChanged )
+ {
+ ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
+- if ( pCharts && pCharts->GetCount() )
++ if ( pCharts )
+ pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab ));
+ }
+
+diff --git sc/source/core/tool/chartlis.cxx sc/source/core/tool/chartlis.cxx
+index 4d6b1b3..0196c9e 100644
+--- sc/source/core/tool/chartlis.cxx
++++ sc/source/core/tool/chartlis.cxx
+@@ -40,7 +40,7 @@
+ #include "document.hxx"
+
+ using namespace com::sun::star;
+-
++using ::std::list;
+
+ //2do: DocOption TimeOut?
+ //#define SC_CHARTTIMEOUT 1000 // eine Sekunde keine Aenderung/KeyEvent
+@@ -265,9 +265,24 @@ BOOL ScChartListener::operator==( const ScChartListener& r )
+ ;
+ }
+
++// ============================================================================
++
++ScChartHiddenRangeListener::ScChartHiddenRangeListener()
++{
++}
++
++ScChartHiddenRangeListener::~ScChartHiddenRangeListener()
++{
++ // empty d'tor
++}
+
+ // === ScChartListenerCollection ======================================
+
++ScChartListenerCollection::RangeListenerItem::RangeListenerItem(const ScRange& rRange, ScChartHiddenRangeListener* p) :
++ maRange(rRange), mpListener(p)
++{
++}
++
+ ScChartListenerCollection::ScChartListenerCollection( ScDocument* pDocP ) :
+ StrCollection( 4, 4, FALSE ),
+ pDoc( pDocP )
+@@ -454,6 +469,14 @@ void ScChartListenerCollection::SetRangeDirty( const ScRange& rRange )
+ }
+ if ( bDirty )
+ StartTimer();
++
++ // New hidden range listener implementation
++ for (list<RangeListenerItem>::iterator itr = maHiddenListeners.begin(), itrEnd = maHiddenListeners.end();
++ itr != itrEnd; ++itr)
++ {
++ if (itr->maRange.Intersects(rRange))
++ itr->mpListener->notify();
++ }
+ }
+
+
+@@ -493,6 +516,34 @@ BOOL ScChartListenerCollection::operator==( const ScChartListenerCollection& r )
+ return TRUE;
+ }
+
++void ScChartListenerCollection::StartListeningHiddenRange( const ScRange& rRange, ScChartHiddenRangeListener* pListener )
++{
++ RangeListenerItem aItem(rRange, pListener);
++ maHiddenListeners.push_back(aItem);
++}
+
++namespace {
+
++struct MatchListener : public ::std::unary_function<
++ ScChartListenerCollection::RangeListenerItem, bool>
++{
++ MatchListener(const ScChartHiddenRangeListener* pMatch) :
++ mpMatch(pMatch)
++ {
++ }
++
++ bool operator() (const ScChartListenerCollection::RangeListenerItem& rItem) const
++ {
++ return mpMatch == rItem.mpListener;
++ }
++
++private:
++ const ScChartHiddenRangeListener* mpMatch;
++};
++
++}
++void ScChartListenerCollection::EndListeningHiddenRange( ScChartHiddenRangeListener* pListener )
++{
++ maHiddenListeners.remove_if(MatchListener(pListener));
++}
+
+diff --git sc/source/filter/excel/xechart.cxx sc/source/filter/excel/xechart.cxx
+index 6e60c1a..8f71b6c 100644
+--- sc/source/filter/excel/xechart.cxx
++++ sc/source/filter/excel/xechart.cxx
+@@ -2660,7 +2660,7 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
+ maRect.mnWidth = static_cast< sal_Int32 >( aPtSize.Width() << 16 );
+ maRect.mnHeight = static_cast< sal_Int32 >( aPtSize.Height() << 16 );
+
+- // global chart properties
++ // global chart properties (default values)
+ ::set_flag( maProps.mnFlags, EXC_CHPROPS_MANSERIES );
+ ::set_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISCELLS, false );
+ maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP;
+@@ -2671,6 +2671,18 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
+
+ if( xChartDoc.is() )
+ {
++ Reference< XDiagram > xDiagram = xChartDoc->getFirstDiagram();
++
++ // global chart properties (only 'include hidden cells' attribute for now)
++ Reference< XPropertySet > xPropSet( xDiagram, UNO_QUERY );
++ if (xPropSet.is())
++ {
++ Any any = xPropSet->getPropertyValue( OUString::createFromAscii("IncludeHiddenCells") );
++ sal_Bool b = sal_True;
++ any >>= b;
++ ::set_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISCELLS, !b );
++ }
++
+ // initialize API conversion (remembers xChartDoc internally)
+ InitConversion( xChartDoc );
+
+@@ -2686,7 +2698,6 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot,
+ aSubTitle.Len() ? &aSubTitle : NULL );
+
+ // diagrams (axes sets)
+- Reference< XDiagram > xDiagram = xChartDoc->getFirstDiagram();
+ sal_uInt16 nFreeGroupIdx = mxPrimAxesSet->Convert( xDiagram, 0 );
+ if( !mxPrimAxesSet->Is3dChart() )
+ mxSecnAxesSet->Convert( xDiagram, nFreeGroupIdx );
+diff --git sc/source/filter/excel/xichart.cxx sc/source/filter/excel/xichart.cxx
+index 083e4bb..0c6f122 100644
+--- sc/source/filter/excel/xichart.cxx
++++ sc/source/filter/excel/xichart.cxx
+@@ -3228,7 +3228,7 @@ void XclImpChChart::ReadSubRecord( XclImpStream& rStrm )
+ ReadChSeries( rStrm );
+ break;
+ case EXC_ID_CHPROPERTIES:
+- rStrm >> maProps.mnFlags >> maProps.mnEmptyMode;
++ ReadChProperties( rStrm );
+ break;
+ case EXC_ID_CHDEFAULTTEXT:
+ ReadChDefaultText( rStrm );
+@@ -3330,6 +3330,16 @@ void XclImpChChart::Convert( Reference< XChartDocument > xChartDoc, ScfProgressB
+ if( xDiagram.is() && mxLegend.is() )
+ xDiagram->setLegend( mxLegend->CreateLegend() );
+
++ // properties
++ Reference< XPropertySet > xPropSet(xDiagram, UNO_QUERY);
++ if (xPropSet.is())
++ {
++ bool bShowVisCells = (maProps.mnFlags & EXC_CHPROPS_SHOWVISCELLS);
++ Any any;
++ any <<= static_cast<sal_Bool>(!bShowVisCells);
++ xPropSet->setPropertyValue(OUString::createFromAscii("IncludeHiddenCells"), any);
++ }
++
+ // unlock the model
+ FinishConversion( rProgress );
+ }
+@@ -3342,6 +3352,11 @@ void XclImpChChart::ReadChSeries( XclImpStream& rStrm )
+ maSeries.push_back( xSeries );
+ }
+
++void XclImpChChart::ReadChProperties( XclImpStream& rStrm )
++{
++ rStrm >> maProps.mnFlags >> maProps.mnEmptyMode;
++}
++
+ void XclImpChChart::ReadChAxesSet( XclImpStream& rStrm )
+ {
+ XclImpChAxesSetRef xAxesSet( new XclImpChAxesSet( GetChRoot(), EXC_CHAXESSET_NONE ) );
+diff --git sc/source/filter/inc/xichart.hxx sc/source/filter/inc/xichart.hxx
+index ada3f4e..2e79767 100644
+--- sc/source/filter/inc/xichart.hxx
++++ sc/source/filter/inc/xichart.hxx
+@@ -1337,6 +1337,8 @@ public:
+ private:
+ /** Reads a CHSERIES group (data series source and formatting). */
+ void ReadChSeries( XclImpStream& rStrm );
++ /** Reads a CHPROPERTIES record. */
++ void ReadChProperties( XclImpStream& rStrm );
+ /** Reads a CHAXESSET group (primary/secondary axes set). */
+ void ReadChAxesSet( XclImpStream& rStrm );
+ /** Reads a CHTEXT group (chart title and series/point captions). */
diff --git sc/source/ui/unoobj/chart2uno.cxx sc/source/ui/unoobj/chart2uno.cxx
-index 676ce91..926ec0b 100644
+index b10e00a..49f0617 100644
--- sc/source/ui/unoobj/chart2uno.cxx
+++ sc/source/ui/unoobj/chart2uno.cxx
-@@ -1287,6 +1287,11 @@ void SAL_CALL ScChart2LabeledDataSequence::removeModifyListener( const uno::Refe
+@@ -43,6 +43,7 @@
+ #include "rangeutl.hxx"
+ #include "hints.hxx"
+ #include "unoreflist.hxx"
++#include "chartlis.hxx"
+
+ #include <sfx2/objsh.hxx>
+
+@@ -1405,6 +1406,25 @@ void SAL_CALL ScChart2LabeledDataSequence::removeModifyListener( const uno::Refe
// DataSequence ==============================================================
@@ -70,11 +412,75 @@
+{
+}
+
++ScChart2DataSequence::HiddenRangeListener::HiddenRangeListener(ScChart2DataSequence& rParent) :
++ mrParent(rParent)
++{
++}
++
++ScChart2DataSequence::HiddenRangeListener::~HiddenRangeListener()
++{
++}
++
++void ScChart2DataSequence::HiddenRangeListener::notify()
++{
++ mrParent.setDataChangedHint(true);
++}
++
ScChart2DataSequence::ScChart2DataSequence( ScDocument* pDoc,
const uno::Reference < chart2::data::XDataProvider >& xDP,
const ScRangeListRef& rRangeList)
-@@ -1342,6 +1347,73 @@ void ScChart2DataSequence::RefChanged()
+@@ -1414,6 +1434,7 @@ ScChart2DataSequence::ScChart2DataSequence( ScDocument* pDoc,
+ , m_pDocument( pDoc)
+ , m_xDataProvider( xDP)
+ , m_aPropSet(lcl_GetDataSequencePropertyMap())
++ , m_pHiddenListener(NULL)
+ , m_pValueListener( NULL )
+ , m_bGotDataChangedHint( FALSE )
+ {
+@@ -1439,7 +1460,15 @@ ScChart2DataSequence::ScChart2DataSequence( ScDocument* pDoc,
+ ScChart2DataSequence::~ScChart2DataSequence()
+ {
+ if ( m_pDocument )
++ {
+ m_pDocument->RemoveUnoObject( *this);
++ if (m_pHiddenListener.get())
++ {
++ ScChartListenerCollection* pCLC = m_pDocument->GetChartListenerCollection();
++ if (pCLC)
++ pCLC->EndListeningHiddenRange(m_pHiddenListener.get());
++ }
++ }
+
+ delete m_pValueListener;
+ }
+@@ -1447,7 +1476,10 @@ ScChart2DataSequence::~ScChart2DataSequence()
+
+ void ScChart2DataSequence::RefChanged()
+ {
+- if( m_pValueListener && m_aValueListeners.Count() != 0 )
++ if (m_aValueListeners.Count() == 0)
++ return;
++
++ if( m_pValueListener )
+ {
+ m_pValueListener->EndListeningAll();
+
+@@ -1458,8 +1490,93 @@ void ScChart2DataSequence::RefChanged()
+ m_pDocument->StartListeningArea( *m_xRanges->GetObject(i), m_pValueListener );
+ }
}
++
++ if (m_pHiddenListener.get() && m_pDocument)
++ {
++ ScChartListenerCollection* pCLC = m_pDocument->GetChartListenerCollection();
++ if (pCLC)
++ {
++ pCLC->EndListeningHiddenRange(m_pHiddenListener.get());
++ ULONG nCount = m_xRanges->Count();
++ for (ULONG i = 0; i < nCount; ++i)
++ pCLC->StartListeningHiddenRange(*m_xRanges->GetObject(i), m_pHiddenListener.get());
++ }
++ }
}
+void ScChart2DataSequence::BuildDataArray()
@@ -113,6 +519,12 @@
+
+ if (pCell->HasStringData())
+ rItem.maString = pCell->GetStringData();
++ else
++ {
++ String aStr;
++ m_pDocument->GetString(nCol, nRow, nTab, aStr);
++ rItem.maString = aStr;
++ }
+
+ switch (pCell->GetCellType())
+ {
@@ -147,28 +559,26 @@
void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
{
-@@ -1356,8 +1428,10 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
- {
+@@ -1475,7 +1592,8 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
// delayed broadcast as in ScCellRangesBase
-- if ( m_bGotDataChangedHint && m_pDocument )
-+// if ( m_bGotDataChangedHint && m_pDocument )
-+ if (true)
- {
+ if ( m_bGotDataChangedHint && m_pDocument )
+- {
++ {
+ m_aDataArray.clear();
lang::EventObject aEvent;
aEvent.Source.set((cppu::OWeakObject*)this);
-@@ -1367,7 +1441,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
- m_pDocument->AddUnoListenerCall( *m_aValueListeners[n], aEvent );
- }
-
-- m_bGotDataChangedHint = FALSE;
-+// m_bGotDataChangedHint = FALSE;
- }
- }
+@@ -1538,7 +1656,7 @@ IMPL_LINK( ScChart2DataSequence, ValueListenerHdl, SfxHint*, pHint )
+ // in the range are notified. So only a flag is set that is checked when
+ // SFX_HINT_DATACHANGED is received.
+
+- m_bGotDataChangedHint = TRUE;
++ setDataChangedHint(true);
}
-@@ -1433,72 +1507,19 @@ uno::Sequence< uno::Any> SAL_CALL ScChart2DataSequence::getData()
+ return 0;
+ }
+@@ -1551,72 +1669,19 @@ uno::Sequence< uno::Any> SAL_CALL ScChart2DataSequence::getData()
if ( !m_pDocument)
throw uno::RuntimeException();
@@ -251,7 +661,7 @@
return aSeq;
}
-@@ -1511,67 +1532,18 @@ uno::Sequence< double > SAL_CALL ScChart2DataSequence::getNumericalData()
+@@ -1629,67 +1694,18 @@ uno::Sequence< double > SAL_CALL ScChart2DataSequence::getNumericalData()
if ( !m_pDocument)
throw uno::RuntimeException();
@@ -327,7 +737,7 @@
return aSeq;
}
-@@ -1583,49 +1555,15 @@ uno::Sequence< rtl::OUString > SAL_CALL ScChart2DataSequence::getTextualData( )
+@@ -1701,49 +1717,15 @@ uno::Sequence< rtl::OUString > SAL_CALL ScChart2DataSequence::getTextualData( )
if ( !m_pDocument)
throw uno::RuntimeException();
@@ -385,7 +795,45 @@
return aSeq;
}
-@@ -1926,6 +1864,13 @@ uno::Any SAL_CALL ScChart2DataSequence::getPropertyValue(
+@@ -1968,11 +1950,22 @@ void SAL_CALL ScChart2DataSequence::addModifyListener( const uno::Reference< uti
+ if (!m_pValueListener)
+ m_pValueListener = new ScLinkListener( LINK( this, ScChart2DataSequence, ValueListenerHdl ) );
+
++ if (!m_pHiddenListener.get())
++ m_pHiddenListener.reset(new HiddenRangeListener(*this));
++
+ if( m_pDocument )
+ {
+ ULONG nCount = m_xRanges->Count();
+ for (ULONG i=0; i<nCount; i++)
+- m_pDocument->StartListeningArea( *m_xRanges->GetObject(i), m_pValueListener );
++ {
++ ScRange aRange = *m_xRanges->GetObject(i);
++ m_pDocument->StartListeningArea( aRange, m_pValueListener );
++ ScChartListenerCollection* pCLC = m_pDocument->GetChartListenerCollection();
++ if (pCLC)
++ pCLC->StartListeningHiddenRange(aRange, m_pHiddenListener.get());
++
++ markRangeDirty(aRange);
++ }
+ }
+
+ acquire(); // don't lose this object (one ref for all listeners)
+@@ -2004,6 +1997,13 @@ void SAL_CALL ScChart2DataSequence::removeModifyListener( const uno::Reference<
+ if (m_pValueListener)
+ m_pValueListener->EndListeningAll();
+
++ if (m_pHiddenListener.get() && m_pDocument)
++ {
++ ScChartListenerCollection* pCLC = m_pDocument->GetChartListenerCollection();
++ if (pCLC)
++ pCLC->EndListeningHiddenRange(m_pHiddenListener.get());
++ }
++
+ release(); // release the ref for the listeners
+ }
+
+@@ -2059,6 +2059,13 @@ uno::Any SAL_CALL ScChart2DataSequence::getPropertyValue(
aRet <<= m_aRole;
else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ISHIDDEN)))
aRet <<= m_bHidden;
@@ -399,3 +847,46 @@
else
throw beans::UnknownPropertyException();
// TODO: support optional properties
+@@ -2113,6 +2120,42 @@ void SAL_CALL ScChart2DataSequence::removeVetoableChangeListener(
+ OSL_ENSURE( false, "Not yet implemented" );
+ }
+
++void ScChart2DataSequence::markRangeDirty(const ScRange& rRange) const
++{
++ if (!m_pDocument)
++ return;
++
++ const ScAddress &s = rRange.aStart, &e = rRange.aEnd;
++ SCTAB nTab1 = s.Tab(), nTab2 = e.Tab();
++ SCCOL nCol1 = s.Col(), nCol2 = e.Col();
++ SCROW nRow1 = s.Row(), nRow2 = e.Row();
++ for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
++ {
++ for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
++ {
++ for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
++ {
++ ScAddress aAddr(nCol, nRow, nTab);
++ ScBaseCell* pBaseCell = m_pDocument->GetCell(aAddr);
++ if (!pBaseCell || pBaseCell->GetCellType() != CELLTYPE_FORMULA)
++ continue;
++
++ ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pBaseCell);
++ ScTokenArray* pArray = pFCell->GetCode();
++ if (!pArray)
++ continue;
++
++ pFCell->SetDirty();
++ }
++ }
++ }
++}
++
++void ScChart2DataSequence::setDataChangedHint(bool b)
++{
++ m_bGotDataChangedHint = b;
++}
++
+ // XUnoTunnel
+
+ // sal_Int64 SAL_CALL ScChart2DataSequence::getSomething(
Added: branches/ooo-build-3-0-1/patches/dev300/chart-skip-hidden-cells-xmloff.diff
==============================================================================
--- (empty file)
+++ branches/ooo-build-3-0-1/patches/dev300/chart-skip-hidden-cells-xmloff.diff Wed Jan 14 19:18:46 2009
@@ -0,0 +1,36 @@
+diff --git xmloff/inc/xmloff/xmltoken.hxx xmloff/inc/xmloff/xmltoken.hxx
+index b012bb7..6f4141c 100644
+--- xmloff/inc/xmloff/xmltoken.hxx
++++ xmloff/inc/xmloff/xmltoken.hxx
+@@ -2972,6 +2972,7 @@ namespace xmloff { namespace token {
+ XML_PERCENTAGE_DATA_STYLE_NAME,
+ XML_VALUE_AND_PERCENTAGE,
+ XML_GROUP_BARS_PER_AXIS,
++ XML_INCLUDE_HIDEEN_CELLS,
+ XML_REVERSE_DIRECTION,
+ XML_LABEL_SEPARATOR,
+ XML_LABEL_POSITION,
+diff --git xmloff/source/chart/PropertyMap.hxx xmloff/source/chart/PropertyMap.hxx
+index c745746..37d9663 100644
+--- xmloff/source/chart/PropertyMap.hxx
++++ xmloff/source/chart/PropertyMap.hxx
+@@ -130,6 +130,7 @@ const XMLPropertyMapEntry aXMLChartPropMap[] =
+ MAP_CONTEXT( "NumberOfLines", CHART, XML_LINES_USED, XML_TYPE_NUMBER, LINES_USED ),
+ 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_HIDEEN_CELLS, XML_TYPE_BOOL ),
+ MAP_ENTRY_ODF12( "StartingAngle", CHART, XML_ANGLE_OFFSET, XML_TYPE_NUMBER ),
+ // spline settings
+ MAP_ENTRY( "SplineOrder", CHART, XML_SPLINE_ORDER, XML_TYPE_NUMBER ),
+diff --git xmloff/source/core/xmltoken.cxx xmloff/source/core/xmltoken.cxx
+index 651a3d4..e7b035a 100644
+--- xmloff/source/core/xmltoken.cxx
++++ xmloff/source/core/xmltoken.cxx
+@@ -2972,6 +2972,7 @@ namespace xmloff { namespace token {
+ TOKEN( "percentage-data-style-name", XML_PERCENTAGE_DATA_STYLE_NAME ),
+ TOKEN( "value-and-percentage", XML_VALUE_AND_PERCENTAGE ),
+ TOKEN( "group-bars-per-axis", XML_GROUP_BARS_PER_AXIS ),
++ TOKEN( "include-hidden-cells", XML_INCLUDE_HIDEEN_CELLS ),
+ TOKEN( "reverse-direction", XML_REVERSE_DIRECTION ),
+ TOKEN( "label-separator", XML_LABEL_SEPARATOR ),
+ TOKEN( "label-position", XML_LABEL_POSITION ),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]