summaryrefslogtreecommitdiff
path: root/sc/inc/chart2uno.hxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-03-03 15:05:33 +0000
committerOliver Bolte <obo@openoffice.org>2009-03-03 15:05:33 +0000
commit2f373570c51e13baf0530605ef59808462e6ca71 (patch)
treed732e498aab12219bb7163e6e90f5d0c8b3ae118 /sc/inc/chart2uno.hxx
parent6b741821d6ac3bca21a98a3ce5b069b24abba41f (diff)
CWS-TOOLING: integrate CWS koheiformula02
2009-02-19 13:18:02 +0100 iha r268276 : #i99400# Missing value plotting broken 2009-02-11 03:39:50 +0100 kohei r267579 : forgot to add an in-line comment. 2009-02-11 00:26:03 +0100 kohei r267578 : Handle also the single cell references when exporting chart ranges. 2009-02-10 19:50:37 +0100 kohei r267576 : removed a compiler warning. 2009-02-10 06:48:55 +0100 kohei r267536 : got xls export filter to correctly write external references in charts. However, Excel doesn't entirely like my chart output if the chart contains external references. The data are all there, but it refuses to draw it. It works fine with charts with internal references. 2009-02-10 03:33:13 +0100 kohei r267533 : correctly import external references used in chart objects, by using a token array instead of a range list to represent the data ranges. 2009-02-04 15:22:30 +0100 kohei r267387 : return aRet instead of the sRangeRepresentation, just to be consistent with the rest of the code there. Both strings are empty so this is just for aesthetic reasons. 2009-02-04 15:07:49 +0100 kohei r267384 : #i98872# allow export of empty data range, in order to allow saving of documents with an empty chart. 2009-02-03 19:20:38 +0100 kohei r267340 : #i98801# added a special case handler for parsing range address syntax used by the older version of OOo. In the old syntax, the sheet name was dropped for the 2nd reference of a range if the 1st and 2nd references are on the same sheet. In the new syntax this is not the case. Also fixed unintential display of the sheet name for the end range address of a single-sheet range. 2009-01-28 20:46:11 +0100 kohei r267085 : call GetIndex() and GetString() only when the token is external ref, to avoid triggering assertions in a non-pro build. 2009-01-28 19:30:58 +0100 kohei r267080 : When listeners are being destroyed, don't bother unregistering them with the external ref manager if the document itself is being destroyed. 2009-01-28 18:56:52 +0100 kohei r267079 : fixed a heap corruption. The Table instance stores instances of FormulaToken type, not of ScAddress type. 2009-01-26 18:59:14 +0100 kohei r266945 : removed another warning on win32 build. 2009-01-26 18:50:56 +0100 kohei r266943 : removed warnings on windows build. 2009-01-26 17:16:09 +0100 kohei r266939 : added const to a returned reference value that is never used to modify its value. 2009-01-26 16:49:33 +0100 kohei r266937 : Assume that the document instance is not null, or else don't copy any data at all. 2009-01-26 16:19:50 +0100 kohei r266935 : create a clone of ScChart2DataSeqeunce without calling its copy constructor, since explicit definition of copy constructor would cause a serious compiler warning that's too ugly to fix. 2009-01-26 05:26:58 +0100 kohei r266894 : removed unused variable and changed function signature. 2009-01-26 05:02:58 +0100 kohei r266893 : removed unused variables to remove compiler warnings. 2009-01-25 18:07:31 +0100 kohei r266890 : fixed indentation inconsistencies in ctor initializers. 2009-01-25 18:01:41 +0100 kohei r266889 : * removed a compiler warning. * tab -> whitespace conversion in some code. 2009-01-25 03:57:37 +0100 kohei r266888 : removed a mis-leading comment. 2009-01-25 02:37:45 +0100 kohei r266887 : * moved the ref token join method from chart2uno local to ScRefTokenHelper. * a little code cleanup. 2009-01-24 09:29:26 +0100 kohei r266865 : Don't re-link external files if their link has been broken once. 2009-01-24 09:16:28 +0100 kohei r266864 : a typo in an in-line comment. 2009-01-24 09:14:29 +0100 kohei r266863 : Treat non-cached cells as empty cells only when the source document is not reachable. 2009-01-24 07:23:44 +0100 kohei r266862 : Don't purge the external ref cache when the link is broken. 2009-01-24 03:25:46 +0100 kohei r266861 : When a cell outside the cached range is queried, we should return an emtpy cell token instead of NULL, to be consistent with the old behavior. 2009-01-24 02:34:38 +0100 kohei r266860 : Remove corresponding listeners when an external doc link is broken. 2009-01-23 23:18:44 +0100 kohei r266856 : more work on handling external ref update listeners. 2009-01-23 18:10:09 +0100 kohei r266846 : Handle loading of chart objects when their external link is updated. 2009-01-23 06:57:34 +0100 kohei r266765 : more work on ref-tokenizing ScChartListener. 2009-01-22 22:57:52 +0100 kohei r266760 : More work on moving ref token helper code to reftokenhelper & ref-tokenizing ScChartListener. 2009-01-22 21:52:38 +0100 kohei r266758 : moved the code that converts XML range string into Calc's internal range string from chart2uno to rangeutl & compile the range string to generate ref tokens upon ods import. 2009-01-22 18:56:14 +0100 kohei r266749 : fixed a build breakage. 2009-01-22 18:53:43 +0100 kohei r266748 : Initial work toward using ref tokens in ScChartListener class. I'll start moving some of local ref token handling functions from chart2uno.cxx to ScRefTokenHelper class to make them available in other places. 2009-01-22 17:38:20 +0100 kohei r266746 : Add a big, fat warning against mixed use of ScSharedTokenRef and ScTokenRef. 2009-01-22 08:33:28 +0100 kohei r266711 : #i98338# fixed slicing of external ref token classes by adding their own Clone() method. 2009-01-22 05:02:25 +0100 kohei r266710 : Applied the same fix that npower/oj applied to fix a crasher (from #i98317#). 2009-01-21 23:02:42 +0100 kohei r266705 : fix build breakages as a result of rebase to m39. Mostly due to the new formula module and its associated changes esp. wrt token classes. 2009-01-21 19:14:40 +0100 kohei r266699 : CWS-TOOLING: rebase CWS koheiformula02 to trunk@266428 (milestone: DEV300:m39) 2009-01-21 17:55:10 +0100 kohei r266698 : moved the shared ScToken typedef to token.hxx, and use it instead of ScChart2TokenRef, since I need this typedef in the odf importer. In the future this can also replace the similar typedef in ScExternalRefManager. 2009-01-21 06:54:04 +0100 kohei r266627 : Added external ref listener framework so that objects listening to external ref changes can get notified when the link is updated. The work is not done yet. 2009-01-20 23:07:38 +0100 kohei r266626 : When exporting a range to ODF, we don't want to prepend a sheet name with '$' even for an external sheet. 2009-01-20 23:06:40 +0100 kohei r266625 : 1) code cleanup to remove compiler warnings. 2) fixed convertRangesToXML to convert ref tokens into correct ODF range format. 2009-01-20 19:40:45 +0100 kohei r266620 : extracted the code that fills cache from external ref into its own method. 2009-01-20 18:26:47 +0100 kohei r266616 : added javadoc parameter descriptions. 2009-01-20 18:01:17 +0100 kohei r266615 : disable ScChart2EmptyDataSequence entirely since that class doesn't appear to be used any more. 2009-01-20 17:42:59 +0100 kohei r266608 : fixed a crash when the data source range is empty at time of chart creation. 2009-01-20 17:13:34 +0100 kohei r266601 : a simple locale variable rename. 2009-01-20 16:57:04 +0100 kohei r266598 : #i97563# applied my patch, to fix incorrect export attempts of color values as a number formatter key, and change the condition of one assertion to prevent it from being triggered incorrectly in non-pro build. 2009-01-17 07:41:01 +0100 kohei r266458 : a little code cleanup. 2009-01-17 07:30:48 +0100 kohei r266457 : removed a method that it no longer used. 2009-01-17 07:29:15 +0100 kohei r266456 : fixed a crash when no external data is available for a given range. 2009-01-17 07:14:50 +0100 kohei r266455 : Even more work on range list to ref token migration. The chart now retains external data after editing of chart. 2009-01-16 18:54:35 +0100 kohei r266453 : More work on replacing flat ranges and addresses with ref tokens. 2009-01-16 17:07:51 +0100 kohei r266438 : extracted a large code block into its own local method. 2009-01-16 15:22:57 +0100 kohei r266423 : Initial work toward replacing the chart positioner and its related code in order to use reference tokens instead of range list. The basis of that code is the old ScChartPositioner and ScChartPositionMap duplicated to avoid breaking any existing legacy code that might still use it. It appears to be used by the StarOffice 1.0 filter only. Still not working with the external references. 2009-01-15 05:33:39 +0100 kohei r266334 : renamed chackRanges() to overlaps() to make it more descriptive of what it does. 2009-01-13 23:25:50 +0100 kohei r266260 : Moved the token-to-string conversion code up so that other parts of the code can use it. 2009-01-13 22:14:35 +0100 kohei r266256 : generateLabels() now uses reference token list. 2009-01-13 18:42:23 +0100 kohei r266246 : Finally, build data array for external data sources. This will now allow the data to be displayed in the diagram. 2009-01-13 16:34:03 +0100 kohei r266235 : We now need to verify range representation by compiling it instead of parsing it. 2009-01-13 15:41:48 +0100 kohei r266230 : cosmetic function name change & added javadoc comment for it. 2009-01-13 06:32:06 +0100 kohei r266194 : Fixed a typo. 2009-01-13 06:04:23 +0100 kohei r266193 : Generate data source range string by compiling reference tokens. This way we can also display external reference addresses correctly. 2009-01-13 05:55:44 +0100 kohei r266192 : moved compileRangeRepresentation from being a class member method to a local function. 2009-01-13 05:41:53 +0100 kohei r266191 : nuked one unused method & tab -> whitespace conversion. 2009-01-13 05:35:10 +0100 kohei r266190 : A little code cleanup & consolidated all range-joining code into a single function object class. 2009-01-13 03:58:51 +0100 kohei r266189 : removed the unused method. 2009-01-13 03:53:01 +0100 kohei r266188 : This time I (hopefully) fixed the range consolidation problem for real. I forgot to join the missing upper-left corner cell with the existing range list. Also, I needed to join ranges recursively instead of just doing it once. 2009-01-13 02:15:48 +0100 kohei r266187 : fixed the "add corner if missing" thing. 2009-01-12 23:36:19 +0100 kohei r266185 : More work on range list -> ref tokens. 2009-01-12 23:12:28 +0100 kohei r266184 : More work on switching to reference tokens from range list. Still in progress. 2009-01-10 08:15:39 +0100 kohei r266125 : More code change for switching to reference tokens, especially in ScChart2DataProvider. Created another addUpperLeftCornerIfMissing method that can take a list of reference tokens instead of range list. 2009-01-09 19:22:33 +0100 kohei r266110 : entirely removed the range list data member from ScChart2DataSequence class. From now on we will use a list of tokens to track data source ranges. Now, if I haven't introduced any bugs in the process, normal charts with no external references should work as before. But I still need to get the external refs to work. 2009-01-09 19:11:45 +0100 kohei r266108 : Convert ranges to token list before instantiating ScChart2DataSequence. 2009-01-09 18:27:13 +0100 kohei r266107 : Extracted a common code block into its own method. 2009-01-09 18:18:36 +0100 kohei r266106 : More progress on chart2uno implementation change. Still more to do. 2009-01-09 06:24:36 +0100 kohei r266043 : another place to swap the use of range list with token list. 2009-01-09 06:18:57 +0100 kohei r266042 : Started re-working the chart2uno implementation, to use a list of ScToken instances instead of ScRangeList, to keep track of data source ranges. This way, the chart2uno code can tell whether the ranges are external or internal, and act accordingly. I'm not finished with it yet. Some things are still not working. 2009-01-08 19:28:51 +0100 kohei r266034 : yet another place to hardcode CONV_OOO for cell range address parsing. 2009-01-08 19:19:21 +0100 kohei r266033 : transferred the BuildArray() method from the koheichart01 cws and its associated changes. I need to be changing code around this area, and I don't want to redo my changes once koheichart01 gets integrated for 3.2. 2009-01-08 18:07:08 +0100 kohei r266030 : Have convertRangeFromXML convert external ranges into the appropriate OOO A1 format. I also added a helper method to append a table name because this is useful in a lot of other places. 2009-01-07 06:57:52 +0100 kohei r265944 : These places also need a hard-coded CONV_OOO address convention, for Excel chart import and export to function properly. 2009-01-06 16:41:07 +0100 kohei r265932 : removed unused variable. 2009-01-06 16:30:36 +0100 kohei r265931 : removed unused ScDPCacheTable::GroupFilter::setMatchIfFound() method and its associated member variable (per Caolan's callcatcher output). I added that method to allow reverse matching in some code but later retracted that logic. I guess I forgot to remove the method itself afterwards... 2009-01-06 06:39:51 +0100 kohei r265891 : #i97735# Always write cell and cell range addresses using the OOo A1 (CONV_OOO) address convention when exporting to ODF, regardless of current address convention. Same for reading from ODF documents. 2009-01-06 05:46:40 +0100 kohei r265890 : #i94696# Use the current address convention in the chart wizard dialog.
Diffstat (limited to 'sc/inc/chart2uno.hxx')
-rw-r--r--sc/inc/chart2uno.hxx103
1 files changed, 95 insertions, 8 deletions
diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx
index ffd212efe91b..b0b34f200cdb 100644
--- a/sc/inc/chart2uno.hxx
+++ b/sc/inc/chart2uno.hxx
@@ -33,7 +33,11 @@
#include "cellsuno.hxx" // for XModifyListenerArr_Impl / ScLinkListener
#include "rangelst.hxx"
+#include "externalrefmgr.hxx"
+#include "token.hxx"
+
#include <svtools/lstner.hxx>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart2/data/XDataProvider.hpp>
#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
#include <com/sun/star/chart2/data/XDataSource.hpp>
@@ -57,8 +61,13 @@
#include <rtl/ustring.hxx>
#include <svtools/itemprop.hxx>
-#include <map>
+#include <hash_set>
#include <list>
+#include <vector>
+#include <memory>
+#include <boost/shared_ptr.hpp>
+
+#define USE_CHART2_EMPTYDATASEQUENCE 0
class ScDocument;
@@ -128,7 +137,23 @@ public:
getSupportedServiceNames() throw(
::com::sun::star::uno::RuntimeException);
- static bool addUpperLeftCornerIfMissing( ScRangeListRef& xRanges );//returns true if the corner was added
+ /**
+ * Check the current list of reference tokens, and add the upper left
+ * corner of the minimum range that encloses all ranges if certain
+ * conditions are met.
+ *
+ * @param rRefTokens list of reference tokens
+ *
+ * @return true if the corner was added, false otherwise.
+ */
+ static bool addUpperLeftCornerIfMissing(::std::vector<ScSharedTokenRef>& rRefTokens);
+
+private:
+
+ void detectRangesFromDataSource(::std::vector<ScSharedTokenRef>& rRefTokens,
+ ::com::sun::star::chart::ChartDataRowSource& rRowSource,
+ bool& rRowSourceDetected,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource);
private:
@@ -260,10 +285,10 @@ class ScChart2DataSequence : public
SfxListener
{
public:
-
explicit ScChart2DataSequence( ScDocument* pDoc,
const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider >& xDP,
- const ScRangeListRef& rRangeList );
+ ::std::vector<ScSharedTokenRef>* pTokens);
+
virtual ~ScChart2DataSequence();
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
@@ -381,28 +406,89 @@ public:
// Implementation --------------------------------------------------------
- ScRangeListRef GetRangeList() { return m_xRanges; }
-
void RefChanged();
DECL_LINK( ValueListenerHdl, SfxHint* );
private:
+ ScChart2DataSequence(); // disabled
+ ScChart2DataSequence(const ScChart2DataSequence& r); // disabled
+
+ class ExternalRefListener : public ScExternalRefManager::LinkListener
+ {
+ public:
+ ExternalRefListener(ScChart2DataSequence& rParent, ScDocument* pDoc);
+ virtual ~ExternalRefListener();
+ virtual void notify(sal_uInt16 nFileId, ScExternalRefManager::LinkUpdateType eType);
+ void addFileId(sal_uInt16 nFileId);
+ void removeFileId(sal_uInt16 nFileId);
+ const ::std::hash_set<sal_uInt16>& getAllFileIds();
+
+ private:
+ ExternalRefListener();
+ ExternalRefListener(const ExternalRefListener& r);
+
+ ScChart2DataSequence& mrParent;
+ ::std::hash_set<sal_uInt16> maFileIds;
+ ScDocument* mpDoc;
+ };
+
+ /**
+ * Build an internal data array to cache the data ranges, and other
+ * information such as hidden values.
+ */
+ void BuildDataCache();
+
+ void RebuildDataCache();
+
+ sal_Int32 FillCacheFromExternalRef(const ScSharedTokenRef& pToken);
+
+ void UpdateTokensFromRanges(const ScRangeList& rRanges);
+
+ ExternalRefListener* GetExtRefListener();
+
+ void StopListeningToAllExternalRefs();
+
+ void CopyData(const ScChart2DataSequence& r);
+
+private:
+
+ // data array
+ struct Item
+ {
+ double mfValue;
+ ::rtl::OUString maString;
+ bool mbIsValue;
+ Item();
+ };
+
+ ::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;
+
// internals
- ScRangeListRef m_xRanges;
+ typedef ::std::auto_ptr< ::std::vector<ScSharedTokenRef> > TokenListPtr;
+ typedef ::std::auto_ptr< ::std::vector<sal_uInt32> > RangeIndexMapPtr;
+ typedef ::std::auto_ptr<ExternalRefListener> ExtRefListenerPtr;
+
sal_Int64 m_nObjectId;
ScDocument* m_pDocument;
+ TokenListPtr m_pTokens;
+ RangeIndexMapPtr m_pRangeIndices;
+ ExtRefListenerPtr m_pExtRefListener;
com::sun::star::uno::Reference < com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
SfxItemPropertySet m_aPropSet;
ScLinkListener* m_pValueListener;
- sal_Bool m_bGotDataChangedHint;
XModifyListenerArr_Impl m_aValueListeners;
+
+ bool m_bGotDataChangedHint;
+ bool m_bExtDataRebuildQueued;
};
+#if USE_CHART2_EMPTYDATASEQUENCE
// DataSequence ==============================================================
class ScChart2EmptyDataSequence : public
@@ -548,5 +634,6 @@ private:
sal_Bool m_bColumn; // defines the orientation to create the right labels
};
+#endif
#endif // SC_CHART2UNO_HXX