2f373570c5
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.
234 lines
7.4 KiB
C++
234 lines
7.4 KiB
C++
/*************************************************************************
|
|
*
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
*
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
|
*
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
*
|
|
* $RCSfile: dpcachetable.hxx,v $
|
|
*
|
|
* $Revision: 1.4 $
|
|
*
|
|
* This file is part of OpenOffice.org.
|
|
*
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
* only, as published by the Free Software Foundation.
|
|
*
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License version 3 for more details
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
* <http://www.openoffice.org/license.html>
|
|
* for a copy of the LGPLv3 License.
|
|
*
|
|
************************************************************************/
|
|
|
|
#ifndef SC_DPCACHETABLE_HXX
|
|
#define SC_DPCACHETABLE_HXX
|
|
|
|
#include "sal/types.h"
|
|
#include "osl/mutex.hxx"
|
|
#include "global.hxx"
|
|
#include "collect.hxx"
|
|
|
|
#include <vector>
|
|
#include <hash_map>
|
|
#include <hash_set>
|
|
#include <boost/shared_ptr.hpp>
|
|
#include <com/sun/star/uno/Reference.hxx>
|
|
|
|
namespace com { namespace sun { namespace star {
|
|
namespace sdbc {
|
|
class XRowSet;
|
|
}
|
|
namespace sheet {
|
|
struct DataPilotFieldFilter;
|
|
}
|
|
}}}
|
|
|
|
class Date;
|
|
|
|
class ScDocument;
|
|
class ScRange;
|
|
class ScDPDimension;
|
|
class ScDPCollection;
|
|
struct ScDPCacheCell;
|
|
struct ScDPItemData;
|
|
class Date;
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
class ScDPCacheTable
|
|
{
|
|
public:
|
|
|
|
struct Cell
|
|
{
|
|
SCROW mnCategoryRef;
|
|
ScDPCacheCell* mpContent;
|
|
|
|
Cell();
|
|
~Cell();
|
|
};
|
|
|
|
/** individual filter item used in SingleFilter and GroupFilter. */
|
|
struct FilterItem
|
|
{
|
|
sal_Int32 mnMatchStrId;
|
|
double mfValue;
|
|
bool mbHasValue;
|
|
|
|
FilterItem();
|
|
};
|
|
|
|
/** interface class used for filtering of rows. */
|
|
class FilterBase
|
|
{
|
|
public:
|
|
/** returns true if the matching condition is met for a single cell
|
|
value, or false otherwise. */
|
|
virtual bool match(const ScDPCacheCell& rCell) const = 0;
|
|
};
|
|
|
|
/** ordinary single-item filter. */
|
|
class SingleFilter : public FilterBase
|
|
{
|
|
public:
|
|
explicit SingleFilter(ScSimpleSharedString& rSharedString,
|
|
sal_Int32 nMatchStrId, double fValue, bool bHasValue);
|
|
virtual ~SingleFilter(){}
|
|
|
|
virtual bool match(const ScDPCacheCell& rCell) const;
|
|
|
|
const String getMatchString();
|
|
double getMatchValue() const;
|
|
bool hasValue() const;
|
|
|
|
private:
|
|
explicit SingleFilter();
|
|
|
|
FilterItem maItem;
|
|
ScSimpleSharedString mrSharedString;
|
|
};
|
|
|
|
/** multi-item (group) filter. */
|
|
class GroupFilter : public FilterBase
|
|
{
|
|
public:
|
|
GroupFilter(ScSimpleSharedString& rSharedString);
|
|
virtual ~GroupFilter(){}
|
|
virtual bool match(const ScDPCacheCell& rCell) const;
|
|
|
|
void addMatchItem(const String& rStr, double fVal, bool bHasValue);
|
|
size_t getMatchItemCount() const;
|
|
|
|
private:
|
|
GroupFilter();
|
|
|
|
::std::vector<FilterItem> maItems;
|
|
ScSimpleSharedString mrSharedString;
|
|
};
|
|
|
|
/** single filtering criterion. */
|
|
struct Criterion
|
|
{
|
|
sal_Int32 mnFieldIndex;
|
|
::boost::shared_ptr<FilterBase> mpFilter;
|
|
|
|
Criterion();
|
|
};
|
|
|
|
ScDPCacheTable(ScDPCollection* pCollection);
|
|
~ScDPCacheTable();
|
|
|
|
sal_Int32 getRowSize() const;
|
|
sal_Int32 getColSize() const;
|
|
|
|
/** Fill the internal table from the cell range provided. This function
|
|
assumes that the first row is the column header. */
|
|
void fillTable(ScDocument* pDoc, const ScRange& rRange, const ScQueryParam& rQuery, BOOL* pSpecial,
|
|
bool bIgnoreEmptyRows);
|
|
|
|
/** Fill the internal table from database connection object. This function
|
|
assumes that the first row is the column header. */
|
|
void fillTable(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xRowSet,
|
|
const Date& rNullDate);
|
|
|
|
/** Check whether a specified row is active or not. When a row is active,
|
|
it is used in calculation of the results data. A row becomes inactive
|
|
when it is filtered out by page field. */
|
|
bool isRowActive(sal_Int32 nRow) const;
|
|
|
|
/** Set filter on/off flag to each row to control visibility. The caller
|
|
must ensure that the table is filled before calling this function. */
|
|
void filterByPageDimension(const ::std::vector<Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rRepeatIfEmptyDims);
|
|
|
|
/** Get the cell instance at specified location within the data grid. Note
|
|
that the data grid doesn't include the header row. Don't delete the
|
|
returned object! */
|
|
const ScDPCacheCell* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const;
|
|
|
|
const String* getFieldName(sal_Int32 nIndex) const;
|
|
|
|
/** Get the field index (i.e. column ID in the original data source) based
|
|
on the string value that corresponds with the column title. It returns
|
|
-1 if no field matching the string value exists. */
|
|
sal_Int32 getFieldIndex(const String& rStr) const;
|
|
|
|
/** Get the unique entries for a field specified by index. The caller must
|
|
make sure that the table is filled before calling function, or it will
|
|
get an empty collection. */
|
|
const TypedScStrCollection& getFieldEntries(sal_Int32 nIndex) const;
|
|
|
|
/** Filter the table based on the specified criteria, and copy the
|
|
result to rTabData. This method is used, for example, to generate
|
|
a drill-down data table. */
|
|
void filterTable(const ::std::vector<Criterion>& rCriteria,
|
|
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rTabData,
|
|
const ::std::hash_set<sal_Int32>& rRepeatIfEmptyDims);
|
|
|
|
void clear();
|
|
void swap(ScDPCacheTable& rOther);
|
|
bool empty() const;
|
|
|
|
private:
|
|
ScDPCacheTable();
|
|
ScDPCacheTable(const ScDPCacheTable&);
|
|
|
|
/**
|
|
* Check if a given row meets all specified criteria.
|
|
*
|
|
* @param nRow index of row to be tested.
|
|
* @param rCriteria a list of criteria
|
|
*/
|
|
bool isRowQualified(sal_Int32 nRow, const ::std::vector<Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rRepeatIfEmptyDims) const;
|
|
void getValueData(ScDocument* pDoc, const ScAddress& rPos, ScDPCacheCell& rCell);
|
|
|
|
private:
|
|
typedef ::boost::shared_ptr<TypedScStrCollection> TypedScStrCollectionPtr;
|
|
|
|
/** main data table. */
|
|
::std::vector< ::std::vector< ::ScDPCacheTable::Cell > > maTable;
|
|
|
|
/** header string IDs */
|
|
::std::vector<sal_Int32> maHeader;
|
|
|
|
/** unique field entires for each field (column). */
|
|
::std::vector<TypedScStrCollectionPtr> maFieldEntries;
|
|
|
|
/** used to track visibility of rows. The first row below the header row
|
|
has the index of 0. */
|
|
::std::vector<bool> maRowsVisible;
|
|
|
|
ScSimpleSharedString& mrSharedString;
|
|
ScDPCollection* mpCollection;
|
|
};
|
|
|
|
|
|
#endif
|