diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-03-02 16:52:14 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-03-09 11:13:28 -0500 |
commit | 246521c9578e3cb66e610850716ba72f1e9981bc (patch) | |
tree | 8ce6cba13a105c6732f6e3284577e31ee809dc63 /sc/inc/dpitemdata.hxx | |
parent | 98b4beebce3720c55ff3302a43d482db8adbc6fe (diff) |
Massive rework to reduce the size of ScDPItemData.
Currently lots of things are broken.
Diffstat (limited to 'sc/inc/dpitemdata.hxx')
-rw-r--r-- | sc/inc/dpitemdata.hxx | 74 |
1 files changed, 30 insertions, 44 deletions
diff --git a/sc/inc/dpitemdata.hxx b/sc/inc/dpitemdata.hxx index 7b26674e400e..ec95038b53af 100644 --- a/sc/inc/dpitemdata.hxx +++ b/sc/inc/dpitemdata.hxx @@ -45,69 +45,55 @@ class ScDocument; class SC_DLLPUBLIC ScDPItemData { friend class ScDPCache; + public: - enum { - MK_VAL = 0x01, - MK_DATA = 0x02, - MK_ERR = 0x04, - MK_DATE = 0x08 - }; + enum Type { String, Value, Error, Empty, GroupValue }; - static bool isDate( sal_uLong nNumType ); + struct GroupValueAttr + { + sal_Int32 mnGroupType; + sal_Int32 mnValue; + }; private: - rtl::OUString maString; - double mfValue; - sal_uInt8 mbFlag; + + union { + rtl::OUString* mpString; + GroupValueAttr maGroupValue; + double mfValue; + }; + + Type meType; public: + // case insensitive equality + static sal_Int32 Compare(const ScDPItemData& rA, const ScDPItemData& rB); + ScDPItemData(); - ScDPItemData(const rtl::OUString& rS, double fV, sal_uInt8 bF); - ScDPItemData(const rtl::OUString& rS, double fV = 0.0, bool bHV = false, bool bData = true); + ScDPItemData(const rtl::OUString& rStr); + ScDPItemData(double fVal); + ScDPItemData(sal_Int32 nGroupType, sal_Int32 nValue); + ~ScDPItemData(); - void Set(const rtl::OUString& rS, double fVal, sal_uInt8 nFlag); void SetString(const rtl::OUString& rS); + void SetValue(double fVal); + void SetGroupValue(sal_Int32 nGroupType, sal_Int32 nValue); void SetErrorString(const rtl::OUString& rS); bool IsCaseInsEqual(const ScDPItemData& r) const; size_t Hash() const; // exact equality - bool operator==( const ScDPItemData& r ) const; - // case insensitive equality - static sal_Int32 Compare( const ScDPItemData& rA, const ScDPItemData& rB ); + bool operator==(const ScDPItemData& r) const; -public: - bool IsHasData() const ; - bool IsHasErr() const ; + bool IsEmpty() const; bool IsValue() const; - const rtl::OUString& GetString() const; - double GetValue() const ; + rtl::OUString GetString() const; + double GetValue() const; + GroupValueAttr GetGroupValue() const; bool HasStringData() const ; - sal_uInt8 GetType() const; -}; - -class SC_DLLPUBLIC ScDPItemDataPool -{ -public: - ScDPItemDataPool(); - ScDPItemDataPool(const ScDPItemDataPool& r); - - virtual ~ScDPItemDataPool(); - virtual const ScDPItemData* getData( sal_Int32 nId ); - virtual sal_Int32 getDataId( const ScDPItemData& aData ); - virtual sal_Int32 insertData( const ScDPItemData& aData ); -protected: - struct DataHashFunc : public std::unary_function< const ScDPItemData &, size_t > - { - size_t operator() (const ScDPItemData &rData) const { return rData.Hash(); } - }; - - typedef ::boost::unordered_multimap< ScDPItemData, sal_Int32, DataHashFunc > DataHash; - - ::std::vector< ScDPItemData > maItems; - DataHash maItemIds; + sal_uInt8 GetCellType() const; }; #endif |