diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-05-18 16:46:40 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2009-05-18 16:46:40 +0000 |
commit | 73c534f79edb26667cf7ce355716aad15f33a58e (patch) | |
tree | e7ed3c010da288b1d0582c4162f7f928e1e48732 /sc | |
parent | 1e669a0e87ac5e4c56d41412700bcff3398f1a59 (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 'sc')
-rw-r--r-- | sc/inc/chart2uno.hxx | 82 | ||||
-rw-r--r-- | sc/inc/chartlis.hxx | 41 | ||||
-rw-r--r-- | sc/inc/unonames.hxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/tool/chartlis.cxx | 52 | ||||
-rw-r--r-- | sc/source/core/tool/chartpos.cxx | 94 | ||||
-rw-r--r-- | sc/source/filter/excel/xechart.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/excel/xichart.cxx | 15 | ||||
-rw-r--r-- | sc/source/filter/inc/xichart.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/inc/xlchart.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chart2uno.cxx | 231 |
11 files changed, 425 insertions, 120 deletions
diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx index 288de0003..93afe6491 100644 --- a/sc/inc/chart2uno.hxx +++ b/sc/inc/chart2uno.hxx @@ -35,6 +35,7 @@ #include "rangelst.hxx" #include "externalrefmgr.hxx" #include "token.hxx" +#include "chartlis.hxx" #include <svtools/lstner.hxx> #include <com/sun/star/chart/ChartDataRowSource.hpp> @@ -54,7 +55,6 @@ // #include <com/sun/star/lang/XUnoTunnel.hpp> // #endif #include <cppuhelper/implbase2.hxx> -#include <cppuhelper/implbase3.hxx> #include <cppuhelper/implbase4.hxx> #include <cppuhelper/implbase6.hxx> #include <cppuhelper/implbase7.hxx> @@ -74,9 +74,10 @@ class ScDocument; // DataProvider ============================================================== class ScChart2DataProvider : public - ::cppu::WeakImplHelper3< + ::cppu::WeakImplHelper4< ::com::sun::star::chart2::data::XDataProvider, ::com::sun::star::chart2::data::XRangeXMLConversion, + ::com::sun::star::beans::XPropertySet, ::com::sun::star::lang::XServiceInfo>, SfxListener { @@ -125,6 +126,59 @@ public: virtual ::rtl::OUString SAL_CALL convertRangeFromXML( const ::rtl::OUString& sXMLRange ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException ); + // XPropertySet ---------------------------------------------------------- + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySetInfo> SAL_CALL + getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL setPropertyValue( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Any& rValue) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& rPropertyName) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL addPropertyChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener>& xListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removePropertyChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL addVetoableChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removeVetoableChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + // XServiceInfo ---------------------------------------------------------- virtual ::rtl::OUString SAL_CALL getImplementationName() throw( @@ -158,6 +212,8 @@ private: private: ScDocument* m_pDocument; + SfxItemPropertySet m_aPropSet; + sal_Bool m_bIncludeHiddenCells; }; @@ -287,7 +343,7 @@ class ScChart2DataSequence : public public: explicit ScChart2DataSequence( ScDocument* pDoc, const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider >& xDP, - ::std::vector<ScSharedTokenRef>* pTokens); + ::std::vector<ScSharedTokenRef>* pTokens, bool bIncludeHiddenCells ); virtual ~ScChart2DataSequence(); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); @@ -404,6 +460,9 @@ public: // static ScChart2DataSequence* getImplementation( const com::sun::star::uno::Reference< // com::sun::star::uno::XInterface> xObj ); +private: + void setDataChangedHint(bool b); + // Implementation -------------------------------------------------------- void RefChanged(); @@ -461,12 +520,24 @@ private: 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; + sal_Bool m_bIncludeHiddenCells; // internals typedef ::std::auto_ptr< ::std::vector<ScSharedTokenRef> > TokenListPtr; @@ -481,6 +552,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; XModifyListenerArr_Impl m_aValueListeners; @@ -625,7 +697,7 @@ private: // properties ::com::sun::star::chart2::data::DataSequenceRole m_aRole; - sal_Bool m_bHidden; + sal_Bool m_bIncludeHiddenCells; // internals ScRangeListRef m_xRanges; ScDocument* m_pDocument; diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx index 33650ddb4..a8a97d3b4 100644 --- a/sc/inc/chartlis.hxx +++ b/sc/inc/chartlis.hxx @@ -41,6 +41,7 @@ #include <memory> #include <vector> +#include <list> #include <hash_set> class ScDocument; @@ -131,9 +132,31 @@ public: { return !operator==( r ); } }; +// ============================================================================ + +class ScChartHiddenRangeListener +{ +public: + ScChartHiddenRangeListener(); + virtual ~ScChartHiddenRangeListener(); + virtual void notify() = 0; +}; + +// ============================================================================ + class ScChartListenerCollection : public ScStrCollection { +public: + struct RangeListenerItem + { + ScRange maRange; + ScChartHiddenRangeListener* mpListener; + explicit RangeListenerItem(const ScRange& rRange, ScChartHiddenRangeListener* p); + }; + private: + ::std::list<RangeListenerItem> maHiddenListeners; + Timer aTimer; ScDocument* pDoc; @@ -173,6 +196,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 a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 9cccc82a0..9df643fa0 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -608,8 +608,9 @@ #define SC_UNO_COMPILEFAP "CompileFAP" // Chart2 -#define SC_UNONAME_ISHIDDEN "IsHidden" -#define SC_UNONAME_ROLE "Role" +#define SC_UNONAME_ROLE "Role" +#define SC_UNONAME_HIDDENVALUES "HiddenValues" +#define SC_UNONAME_INCLUDEHIDDENCELLS "IncludeHiddenCells" #define SC_UNONAME_HIDDENVALUES "HiddenValues" // Solver diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 707e34683..e84d3e43f 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -623,8 +623,6 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, { // Charts muessen beim Ein-/Ausblenden angepasst werden ScChartListenerCollection* pCharts = pDestTab->pDocument->GetChartListenerCollection(); - if ( pCharts && !pCharts->GetCount() ) - pCharts = NULL; BOOL bWidth = (nRow1==0 && nRow2==MAXROW && pColWidth && pDestTab->pColWidth); BOOL bHeight = (nCol1==0 && nCol2==MAXCOL && pRowHeight && pDestTab->pRowHeight); @@ -2254,7 +2252,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 )); } } @@ -2291,7 +2289,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 )); } } @@ -2332,7 +2330,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) @@ -2380,7 +2378,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 )); } @@ -2432,7 +2430,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 a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx index 8c4e87638..00af942cd 100644 --- a/sc/source/core/tool/chartlis.cxx +++ b/sc/source/core/tool/chartlis.cxx @@ -42,6 +42,7 @@ using namespace com::sun::star; using ::std::vector; +using ::std::list; using ::std::hash_set; using ::std::auto_ptr; using ::std::unary_function; @@ -454,9 +455,24 @@ BOOL ScChartListener::operator==( const ScChartListener& r ) return *mpTokens == *r.mpTokens; } +// ============================================================================ + +ScChartHiddenRangeListener::ScChartHiddenRangeListener() +{ +} + +ScChartHiddenRangeListener::~ScChartHiddenRangeListener() +{ + // empty d'tor +} // === ScChartListenerCollection ====================================== +ScChartListenerCollection::RangeListenerItem::RangeListenerItem(const ScRange& rRange, ScChartHiddenRangeListener* p) : + maRange(rRange), mpListener(p) +{ +} + ScChartListenerCollection::ScChartListenerCollection( ScDocument* pDocP ) : ScStrCollection( 4, 4, FALSE ), pDoc( pDocP ) @@ -643,6 +659,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(); + } } @@ -682,6 +706,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 a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx index 36ea08299..2327555de 100644 --- a/sc/source/core/tool/chartpos.cxx +++ b/sc/source/core/tool/chartpos.cxx @@ -307,27 +307,18 @@ void ScChartPositioner::CheckColRowHeaders() if ( aRangeListRef->Count() == 1 ) { aRangeListRef->First()->GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 ); - // Beschriftungen auch nach hidden Cols/Rows finden - while ( nCol1 <= nCol2 && (pDocument->GetColFlags( - nCol1, nTab1) & CR_HIDDEN) != 0 ) - nCol1++; - while ( nRow1 <= nRow2 && (pDocument->GetRowFlags( - nRow1, nTab1) & CR_HIDDEN) != 0 ) - nRow1++; if ( nCol1 > nCol2 || nRow1 > nRow2 ) bColStrings = bRowStrings = FALSE; else { for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++) { - if ( iCol==nCol1 || (pDocument->GetColFlags( iCol, nTab1) & CR_HIDDEN) == 0 ) - if (pDocument->HasValueData( iCol, nRow1, nTab1 )) + if (pDocument->HasValueData( iCol, nRow1, nTab1 )) bColStrings = FALSE; } for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++) { - if ( iRow==nRow1 || (pDocument->GetRowFlags( iRow, nTab1) & CR_HIDDEN) == 0 ) - if (pDocument->HasValueData( nCol1, iRow, nTab1 )) + if (pDocument->HasValueData( nCol1, iRow, nTab1 )) bRowStrings = FALSE; } } @@ -341,43 +332,22 @@ void ScChartPositioner::CheckColRowHeaders() { pR->GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 ); BOOL bTopRow = (nRow1 == nStartRow); - BOOL bHidOk; if ( bRowStrings && (bVert || nCol1 == nStartCol) ) { // NONE oder ROWS: RowStrings in jeder Selektion moeglich // COLS oder BOTH: nur aus der ersten Spalte - while ( nCol1 <= nCol2 && (pDocument->GetColFlags( - nCol1, nTab1) & CR_HIDDEN) != 0 ) - nCol1++; - while ( nRow1 <= nRow2 && (pDocument->GetRowFlags( - nRow1, nTab1) & CR_HIDDEN) != 0 ) - nRow1++; if ( nCol1 <= nCol2 ) for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++) { - if ( iRow==nRow1 || (pDocument->GetRowFlags( iRow, nTab1) & CR_HIDDEN) == 0 ) - if (pDocument->HasValueData( nCol1, iRow, nTab1 )) + if (pDocument->HasValueData( nCol1, iRow, nTab1 )) bRowStrings = FALSE; } - bHidOk = TRUE; } - else - bHidOk = FALSE; if ( bColStrings && bTopRow ) { // ColStrings nur aus der ersten Zeile - if ( !bHidOk ) - { - while ( nCol1 <= nCol2 && (pDocument->GetColFlags( - nCol1, nTab1) & CR_HIDDEN) != 0 ) - nCol1++; - while ( nRow1 <= nRow2 && (pDocument->GetRowFlags( - nRow1, nTab1) & CR_HIDDEN) != 0 ) - nRow1++; - } if ( nRow1 <= nRow2 ) for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++) { - if ( iCol==nCol1 || (pDocument->GetColFlags( iCol, nTab1) & CR_HIDDEN) == 0 ) - if (pDocument->HasValueData( iCol, nRow1, nTab1 )) + if (pDocument->HasValueData( iCol, nRow1, nTab1 )) bColStrings = FALSE; } } @@ -439,40 +409,34 @@ void ScChartPositioner::CreatePositionMap() static_cast<ULONG>(nCol1)); for ( nCol = nCol1; nCol <= nCol2; ++nCol, ++nInsCol ) { - if ( (pDocument->GetColFlags( nCol, nTab) & CR_HIDDEN) == 0 ) - { - if ( bNoGlue || eGlue == SC_CHARTGLUE_ROWS ) - { // meistens gleiche Cols - if ( (pCol = (Table*) pCols->Get( nInsCol ))==NULL ) - { - pCols->Insert( nInsCol, pNewRowTable ); - pCol = pNewRowTable; - pNewRowTable = new Table; - } + if ( bNoGlue || eGlue == SC_CHARTGLUE_ROWS ) + { // meistens gleiche Cols + if ( (pCol = (Table*) pCols->Get( nInsCol ))==NULL ) + { + pCols->Insert( nInsCol, pNewRowTable ); + pCol = pNewRowTable; + pNewRowTable = new Table; } - else - { // meistens neue Cols - if ( pCols->Insert( nInsCol, pNewRowTable ) ) - { - pCol = pNewRowTable; - pNewRowTable = new Table; - } - else - pCol = (Table*) pCols->Get( nInsCol ); + } + else + { // meistens neue Cols + if ( pCols->Insert( nInsCol, pNewRowTable ) ) + { + pCol = pNewRowTable; + pNewRowTable = new Table; } - // bei anderer Tabelle wurde bereits neuer ColKey erzeugt, - // die Zeilen muessen fuer's Dummy fuellen gleich sein! - ULONG nInsRow = (bNoGlue ? nNoGlueRow : nRow1); - for ( nRow = nRow1; nRow <= nRow2; nRow++, nInsRow++ ) + else + pCol = (Table*) pCols->Get( nInsCol ); + } + // bei anderer Tabelle wurde bereits neuer ColKey erzeugt, + // die Zeilen muessen fuer's Dummy fuellen gleich sein! + ULONG nInsRow = (bNoGlue ? nNoGlueRow : nRow1); + for ( nRow = nRow1; nRow <= nRow2; nRow++, nInsRow++ ) + { + if ( pCol->Insert( nInsRow, pNewAddress ) ) { - if ( (pDocument->GetRowFlags( nRow, nTab) & CR_HIDDEN) == 0 ) - { - if ( pCol->Insert( nInsRow, pNewAddress ) ) - { - pNewAddress->Set( nCol, nRow, nTab ); - pNewAddress = new ScAddress; - } - } + pNewAddress->Set( nCol, nRow, nTab ); + pNewAddress = new ScAddress; } } } diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 36e528f86..a1ccd4ed1 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -2740,7 +2740,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_SHOWVISIBLEONLY, false ); maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP; @@ -2751,6 +2751,13 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot, if( xChartDoc.is() ) { + Reference< XDiagram > xDiagram = xChartDoc->getFirstDiagram(); + + // global chart properties (only 'include hidden cells' attribute for now) + ScfPropertySet aDiagramProp( xDiagram ); + bool bIncludeHidden = aDiagramProp.GetBoolProperty( EXC_CHPROP_INCLUDEHIDDENCELLS ); + ::set_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISCELLS, !bIncludeHidden ); + // initialize API conversion (remembers xChartDoc internally) InitConversion( xChartDoc ); @@ -2763,7 +2770,6 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot, mxTitle = lclCreateTitle( GetChRoot(), xTitled, EXC_CHOBJLINK_TITLE ); // diagrams (axes sets) - Reference< XDiagram > xDiagram = xChartDoc->getFirstDiagram(); sal_uInt16 nFreeGroupIdx = mxPrimAxesSet->Convert( xDiagram, 0 ); if( !mxPrimAxesSet->Is3dChart() ) mxSecnAxesSet->Convert( xDiagram, nFreeGroupIdx ); diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index a4e518c87..9aac9dcca 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/drawing/ProjectionMode.hpp> #include <com/sun/star/drawing/ShadeMode.hpp> #include <com/sun/star/chart/ChartAxisPosition.hpp> +#include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDiagram.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> @@ -3415,6 +3416,15 @@ void XclImpChChart::Convert( Reference< XChartDocument > xChartDoc, ScfProgressB if( xDiagram.is() && mxLegend.is() ) xDiagram->setLegend( mxLegend->CreateLegend() ); + // set the IncludeHiddenCells property via the old API as only this ensures that the data provider and al created sequences get this flag correctly + Reference< com::sun::star::chart::XChartDocument > xStandardApiChartDoc( xChartDoc, UNO_QUERY ); + if( xStandardApiChartDoc.is() ) + { + ScfPropertySet aDiagramProp( xStandardApiChartDoc->getDiagram() ); + bool bShowVisCells = (maProps.mnFlags & EXC_CHPROPS_SHOWVISCELLS); + aDiagramProp.SetBoolProperty( EXC_CHPROP_INCLUDEHIDDENCELLS, !bShowVisCells ); + } + // unlock the model FinishConversion( rProgress ); } @@ -3427,6 +3437,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 a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx index b87eaf58b..d85f25167 100644 --- a/sc/source/filter/inc/xichart.hxx +++ b/sc/source/filter/inc/xichart.hxx @@ -1348,6 +1348,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 a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx index ffc7d8264..7038fc1c5 100644 --- a/sc/source/filter/inc/xlchart.hxx +++ b/sc/source/filter/inc/xlchart.hxx @@ -97,6 +97,7 @@ namespace com { namespace sun { namespace star { #define EXC_CHPROP_FILLSTYLE CREATE_OUSTRING( "FillStyle" ) #define EXC_CHPROP_GAPWIDTHSEQ CREATE_OUSTRING( "GapwidthSequence" ) #define EXC_CHPROP_GEOMETRY3D CREATE_OUSTRING( "Geometry3D" ) +#define EXC_CHPROP_INCLUDEHIDDENCELLS CREATE_OUSTRING( "IncludeHiddenCells" ) #define EXC_CHPROP_JAPANESE CREATE_OUSTRING( "Japanese" ) #define EXC_CHPROP_LABEL CREATE_OUSTRING( "Label" ) #define EXC_CHPROP_LABELPLACEMENT CREATE_OUSTRING( "LabelPlacement" ) diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index f73ca2064..a4439bb40 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -45,6 +45,7 @@ #include "unoreflist.hxx" #include "compiler.hxx" #include "reftokenhelper.hxx" +#include "chartlis.hxx" #include <sfx2/objsh.hxx> #include <tools/table.hxx> @@ -89,12 +90,23 @@ using ::boost::shared_ptr; namespace { +const SfxItemPropertyMap* lcl_GetDataProviderPropertyMap() +{ + static SfxItemPropertyMap aDataProviderPropertyMap_Impl[] = + { + {MAP_CHAR_LEN(SC_UNONAME_INCLUDEHIDDENCELLS), 0, &getBooleanCppuType(), 0, 0 }, + {0,0,0,0,0,0} + }; + return aDataProviderPropertyMap_Impl; +} + const SfxItemPropertyMap* lcl_GetDataSequencePropertyMap() { static SfxItemPropertyMap aDataSequencePropertyMap_Impl[] = { - {MAP_CHAR_LEN(SC_UNONAME_ISHIDDEN), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_HIDDENVALUES), 0, &getCppuType((uno::Sequence<sal_Int32>*)0 ), 0, 0 }, {MAP_CHAR_LEN(SC_UNONAME_ROLE), 0, &getCppuType((::com::sun::star::chart2::data::DataSequenceRole*)0), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_INCLUDEHIDDENCELLS), 0, &getBooleanCppuType(), 0, 0 }, {0,0,0,0,0,0} }; return aDataSequencePropertyMap_Impl; @@ -656,9 +668,6 @@ void Chart2Positioner::createPositionMap() (bNoGlue ? 0 : static_cast<sal_uInt32>(nCol1)); for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol, ++nInsCol) { - if ((mpDoc->GetColFlags(nCol, nTab) & CR_HIDDEN) != 0) - continue; - if (bNoGlue || meGlue == GLUETYPE_ROWS) { pCol = static_cast<Table*>(pCols->Get(nInsCol)); @@ -683,9 +692,6 @@ void Chart2Positioner::createPositionMap() sal_uInt32 nInsRow = static_cast<sal_uInt32>(bNoGlue ? nNoGlueRow : nRow1); for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow, ++nInsRow) { - if ((mpDoc->GetRowFlags(nRow, nTab) & CR_HIDDEN) != 0) - continue; - ScSingleRefData aCellData; aCellData.InitFlags(); aCellData.SetFlag3D(true); @@ -966,6 +972,8 @@ void lcl_convertTokenToString(OUString& rStr, const ScSharedTokenRef& rToken, Sc ScChart2DataProvider::ScChart2DataProvider( ScDocument* pDoc ) : m_pDocument( pDoc) + , m_aPropSet(lcl_GetDataProviderPropertyMap()) + , m_bIncludeHiddenCells( sal_True) { if ( m_pDocument ) m_pDocument->AddUnoObject( *this); @@ -1348,7 +1356,7 @@ private: { bool bExternal = ScRefTokenHelper::isExternalRef(mpHeaderCell); if (bExternal != ScRefTokenHelper::isExternalRef(pRange)) - // internval vs external. + // internal vs external. return false; if (bExternal) @@ -1498,7 +1506,7 @@ ScChart2DataProvider::createDataSource( { auto_ptr< vector<ScSharedTokenRef> > pTokens(new vector<ScSharedTokenRef>); pTokens->push_back(pLabelToken); - Reference < chart2::data::XDataSequence > xLabelSeq(new ScChart2DataSequence(m_pDocument, this, pTokens.release())); + Reference < chart2::data::XDataSequence > xLabelSeq(new ScChart2DataSequence(m_pDocument, this, pTokens.release(), m_bIncludeHiddenCells)); Reference< beans::XPropertySet > xLabelProps(xLabelSeq, uno::UNO_QUERY); if (xLabelProps.is()) xLabelProps->setPropertyValue( @@ -1511,7 +1519,7 @@ ScChart2DataProvider::createDataSource( } auto_ptr< vector<ScSharedTokenRef> > pTokens(new vector<ScSharedTokenRef>); pTokens->swap(aRefTokens2); - uno::Reference< chart2::data::XDataSequence > xSeq( new ScChart2DataSequence( m_pDocument, this, pTokens.release()) ); + uno::Reference< chart2::data::XDataSequence > xSeq( new ScChart2DataSequence( m_pDocument, this, pTokens.release(), m_bIncludeHiddenCells) ); pHeader->setValues(xSeq); } if (pHeader) @@ -1569,7 +1577,7 @@ ScChart2DataProvider::createDataSource( auto_ptr< vector<ScSharedTokenRef> > pTokens(new vector<ScSharedTokenRef>); pTokens->reserve(1); pTokens->push_back(pHeaderCell); - xLabelSeq.set(new ScChart2DataSequence(m_pDocument, this, pTokens.release())); + xLabelSeq.set(new ScChart2DataSequence(m_pDocument, this, pTokens.release(), m_bIncludeHiddenCells)); uno::Reference< beans::XPropertySet > xLabelProps(xLabelSeq, uno::UNO_QUERY); if (xLabelProps.is()) xLabelProps->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_ROLE)), uno::makeAny(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("label")))); @@ -1586,7 +1594,7 @@ ScChart2DataProvider::createDataSource( // FIXME: if there are no labels the column or row name should be taken - uno::Reference < chart2::data::XDataSequence > xSeq(new ScChart2DataSequence(m_pDocument, this, pRanges.release())); + uno::Reference < chart2::data::XDataSequence > xSeq(new ScChart2DataSequence(m_pDocument, this, pRanges.release(), m_bIncludeHiddenCells)); pLabeled->setValues(xSeq); pLabeled->setLabel(xLabelSeq); @@ -2197,7 +2205,7 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL // ScChart2DataSequence manages the life cycle of pRefTokens. vector<ScSharedTokenRef>* pRefTokens = new vector<ScSharedTokenRef>(); pRefTokens->swap(aRefTokens); - xResult.set(new ScChart2DataSequence(m_pDocument, this, pRefTokens)); + xResult.set(new ScChart2DataSequence(m_pDocument, this, pRefTokens, m_bIncludeHiddenCells)); return xResult; } @@ -2375,6 +2383,88 @@ private: } +// DataProvider XPropertySet ------------------------------------------------- + +uno::Reference< beans::XPropertySetInfo> SAL_CALL +ScChart2DataProvider::getPropertySetInfo() throw( uno::RuntimeException) +{ + ScUnoGuard aGuard; + static uno::Reference<beans::XPropertySetInfo> aRef = + new SfxItemPropertySetInfo( m_aPropSet.getPropertyMap() ); + return aRef; +} + + +void SAL_CALL ScChart2DataProvider::setPropertyValue( + const ::rtl::OUString& rPropertyName, const uno::Any& rValue) + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, uno::RuntimeException) +{ + if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS))) + { + if ( !(rValue >>= m_bIncludeHiddenCells)) + throw lang::IllegalArgumentException(); + } + else + throw beans::UnknownPropertyException(); +} + + +uno::Any SAL_CALL ScChart2DataProvider::getPropertyValue( + const ::rtl::OUString& rPropertyName) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + uno::Any aRet; + if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS))) + aRet <<= m_bIncludeHiddenCells; + else + throw beans::UnknownPropertyException(); + return aRet; +} + + +void SAL_CALL ScChart2DataProvider::addPropertyChangeListener( + const ::rtl::OUString& /*rPropertyName*/, + const uno::Reference< beans::XPropertyChangeListener>& /*xListener*/) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + OSL_ENSURE( false, "Not yet implemented" ); +} + + +void SAL_CALL ScChart2DataProvider::removePropertyChangeListener( + const ::rtl::OUString& /*rPropertyName*/, + const uno::Reference< beans::XPropertyChangeListener>& /*rListener*/) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + OSL_ENSURE( false, "Not yet implemented" ); +} + + +void SAL_CALL ScChart2DataProvider::addVetoableChangeListener( + const ::rtl::OUString& /*rPropertyName*/, + const uno::Reference< beans::XVetoableChangeListener>& /*rListener*/) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + OSL_ENSURE( false, "Not yet implemented" ); +} + + +void SAL_CALL ScChart2DataProvider::removeVetoableChangeListener( + const ::rtl::OUString& /*rPropertyName*/, + const uno::Reference< beans::XVetoableChangeListener>& /*rListener*/ ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException) +{ + OSL_ENSURE( false, "Not yet implemented" ); +} + void ScChart2DataProvider::detectRangesFromDataSource(vector<ScSharedTokenRef>& rRefTokens, chart::ChartDataRowSource& rRowSource, bool& rRowSourceDetected, @@ -2660,10 +2750,25 @@ ScChart2DataSequence::Item::Item() : ::rtl::math::setNan(&mfValue); } +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, - vector<ScSharedTokenRef>* pTokens) - : m_bHidden( sal_False) + vector<ScSharedTokenRef>* pTokens, + bool bIncludeHiddenCells ) + : m_bIncludeHiddenCells( bIncludeHiddenCells) , m_nObjectId( 0 ) , m_pDocument( pDoc) , m_pTokens(pTokens) @@ -2671,6 +2776,7 @@ ScChart2DataSequence::ScChart2DataSequence( ScDocument* pDoc, , m_pExtRefListener(NULL) , m_xDataProvider( xDP) , m_aPropSet(lcl_GetDataSequencePropertyMap()) + , m_pHiddenListener(NULL) , m_pValueListener( NULL ) , m_bGotDataChangedHint(false) , m_bExtDataRebuildQueued(false) @@ -2700,6 +2806,12 @@ 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()); + } StopListeningToAllExternalRefs(); } @@ -2714,6 +2826,14 @@ void ScChart2DataSequence::RefChanged() if( m_pDocument ) { + ScChartListenerCollection* pCLC = NULL; + if (m_pHiddenListener.get()) + { + pCLC = m_pDocument->GetChartListenerCollection(); + if (pCLC) + pCLC->EndListeningHiddenRange(m_pHiddenListener.get()); + } + vector<ScSharedTokenRef>::const_iterator itr = m_pTokens->begin(), itrEnd = m_pTokens->end(); for (; itr != itrEnd; ++itr) { @@ -2722,6 +2842,8 @@ void ScChart2DataSequence::RefChanged() continue; m_pDocument->StartListeningArea(aRange, m_pValueListener); + if (pCLC) + pCLC->StartListeningHiddenRange(aRange, m_pHiddenListener.get()); } } } @@ -2765,17 +2887,21 @@ void ScChart2DataSequence::BuildDataCache() { for (SCROW nRow = aRange.aStart.Row(); nRow <= aRange.aEnd.Row(); ++nRow) { - m_aDataArray.push_back(Item()); - Item& rItem = m_aDataArray.back(); - ++nDataCount; - USHORT nWidth = m_pDocument->GetColWidth(nCol, nTab); - USHORT nHeight = m_pDocument->GetRowHeight(nRow, nTab); - if (!nWidth || !nHeight) + bool bColHidden = (m_pDocument->GetColFlags(nCol, nTab) & CR_HIDDEN); + bool bRowHidden = (m_pDocument->GetRowFlags(nRow, nTab) & CR_HIDDEN); + if (bColHidden || bRowHidden) { // hidden cell ++nHiddenValueCount; aHiddenValues.push_back(nDataCount-1); + + if( !m_bIncludeHiddenCells ) + continue; } + + m_aDataArray.push_back(Item()); + Item& rItem = m_aDataArray.back(); + ++nDataCount; ScAddress aAdr(nCol, nRow, nTab); ScBaseCell* pCell = m_pDocument->GetCell(aAdr); @@ -2987,7 +3113,6 @@ void ScChart2DataSequence::CopyData(const ScChart2DataSequence& r) m_aHiddenValues = r.m_aHiddenValues; m_aRole = r.m_aRole; - m_bHidden = r.m_bHidden; if (r.m_pRangeIndices.get()) m_pRangeIndices.reset(new vector<sal_uInt32>(*r.m_pRangeIndices)); @@ -3023,7 +3148,8 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint // delayed broadcast as in ScCellRangesBase if ( m_bGotDataChangedHint && m_pDocument ) - { + { + m_aDataArray.clear(); m_aDataArray.clear(); lang::EventObject aEvent; aEvent.Source.set((cppu::OWeakObject*)this); @@ -3124,7 +3250,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); } return 0; } @@ -3513,7 +3639,7 @@ uno::Reference< util::XCloneable > SAL_CALL ScChart2DataSequence::createClone() } } - auto_ptr<ScChart2DataSequence> p(new ScChart2DataSequence(m_pDocument, m_xDataProvider, pTokensNew.release())); + auto_ptr<ScChart2DataSequence> p(new ScChart2DataSequence(m_pDocument, m_xDataProvider, pTokensNew.release(), m_bIncludeHiddenCells)); p->CopyData(*this); Reference< util::XCloneable > xClone(p.release()); @@ -3541,11 +3667,23 @@ 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 = aRanges.Count(); - for (ULONG i=0; i<nCount; i++) - m_pDocument->StartListeningArea( *aRanges.GetObject(i), m_pValueListener ); + ScChartListenerCollection* pCLC = m_pDocument->GetChartListenerCollection(); + vector<ScSharedTokenRef>::const_iterator itr = m_pTokens->begin(), itrEnd = m_pTokens->end(); + for (; itr != itrEnd; ++itr) + { + ScRange aRange; + if (!ScRefTokenHelper::getRangeFromToken(aRange, *itr)) + continue; + + m_pDocument->StartListeningArea( aRange, m_pValueListener ); + if (pCLC) + pCLC->StartListeningHiddenRange(aRange, m_pHiddenListener.get()); + } } acquire(); // don't lose this object (one ref for all listeners) @@ -3576,6 +3714,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 } @@ -3610,10 +3755,13 @@ void SAL_CALL ScChart2DataSequence::setPropertyValue( if ( !(rValue >>= m_aRole)) throw lang::IllegalArgumentException(); } - else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ISHIDDEN))) + else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS))) { - if ( !(rValue >>= m_bHidden)) + sal_Bool bOldValue = m_bIncludeHiddenCells; + if ( !(rValue >>= m_bIncludeHiddenCells)) throw lang::IllegalArgumentException(); + if( bOldValue != m_bIncludeHiddenCells ) + m_aDataArray.clear();//data array is dirty now } else throw beans::UnknownPropertyException(); @@ -3629,8 +3777,8 @@ uno::Any SAL_CALL ScChart2DataSequence::getPropertyValue( uno::Any aRet; if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ROLE))) aRet <<= m_aRole; - else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ISHIDDEN))) - aRet <<= m_bHidden; + else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS))) + aRet <<= m_bIncludeHiddenCells; else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(SC_UNONAME_HIDDENVALUES))) { // This property is read-only thus cannot be set externally via @@ -3692,6 +3840,11 @@ void SAL_CALL ScChart2DataSequence::removeVetoableChangeListener( OSL_ENSURE( false, "Not yet implemented" ); } +void ScChart2DataSequence::setDataChangedHint(bool b) +{ + m_bGotDataChangedHint = b; +} + // XUnoTunnel // sal_Int64 SAL_CALL ScChart2DataSequence::getSomething( @@ -3740,7 +3893,7 @@ ScChart2EmptyDataSequence::ScChart2EmptyDataSequence( ScDocument* pDoc, const uno::Reference < chart2::data::XDataProvider >& xDP, const ScRangeListRef& rRangeList, sal_Bool bColumn) - : m_bHidden( sal_False) + : m_bIncludeHiddenCells( sal_True) , m_xRanges( rRangeList) , m_pDocument( pDoc) , m_xDataProvider( xDP) @@ -3889,8 +4042,8 @@ uno::Reference< util::XCloneable > SAL_CALL ScChart2EmptyDataSequence::createClo { xProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ROLE )), uno::makeAny( m_aRole )); - xProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ISHIDDEN )), - uno::makeAny( m_bHidden )); + xProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS )), + uno::makeAny( m_bIncludeHiddenCells )); } return xClone; } @@ -3935,9 +4088,9 @@ void SAL_CALL ScChart2EmptyDataSequence::setPropertyValue( if ( !(rValue >>= m_aRole)) throw lang::IllegalArgumentException(); } - else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ISHIDDEN))) + else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS))) { - if ( !(rValue >>= m_bHidden)) + if ( !(rValue >>= m_bIncludeHiddenCells)) throw lang::IllegalArgumentException(); } else @@ -3954,8 +4107,8 @@ uno::Any SAL_CALL ScChart2EmptyDataSequence::getPropertyValue( uno::Any aRet; if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ROLE))) aRet <<= m_aRole; - else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_ISHIDDEN))) - aRet <<= m_bHidden; + else if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_UNONAME_INCLUDEHIDDENCELLS))) + aRet <<= m_bIncludeHiddenCells; else throw beans::UnknownPropertyException(); // TODO: support optional properties |