[Libreoffice-commits] .: Branch 'feature/calc-matrix-rework' - 33 commits - chart2/source chart2/workbench scaddins/source sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Nov 12 19:16:52 PST 2010
chart2/source/controller/dialogs/ChartTypeDialogController.cxx | 5
chart2/source/controller/dialogs/TabPages.hrc | 28
chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hrc | 13
chart2/source/controller/drawinglayer/ViewElementListProvider.cxx | 41
chart2/source/controller/inc/HelpIds.hrc | 14
chart2/source/controller/main/SelectionHelper.hxx | 3
chart2/source/inc/chartview/servicenames_charttypes.hxx | 12
chart2/source/inc/servicenames.hxx | 36
chart2/source/inc/servicenames_charttypes.hxx | 20
chart2/source/inc/servicenames_coosystems.hxx | 8
chart2/source/inc/servicenames_dlwrapper.hxx | 4
chart2/source/model/main/ChartModel.cxx | 8
chart2/source/model/main/ChartModel_Persistence.cxx | 6
chart2/source/view/axes/VAxisProperties.cxx | 22
chart2/source/view/inc/PlotterBase.hxx | 17
chart2/source/view/inc/PlottingPositionHelper.hxx | 19
chart2/source/view/main/NumberFormatterWrapper.cxx | 29
chart2/source/view/main/PlottingPositionHelper.cxx | 21
chart2/source/view/main/PropertyMapper.cxx | 34
chart2/workbench/addin/sampleaddin.cxx | 59
sc/inc/document.hxx | 9
sc/inc/dpcachetable.hxx | 83 -
sc/inc/dpglobal.hxx | 55
sc/inc/dpshttab.hxx | 22
sc/inc/dptabdat.hxx | 2
sc/inc/dptablecache.hxx | 72
sc/inc/drwlayer.hxx | 3
sc/inc/global.hxx | 6
sc/inc/nameuno.hxx | 56
sc/inc/table.hxx | 4
sc/inc/tablink.hxx | 4
sc/inc/unonames.hxx | 5
sc/source/core/data/cell2.cxx | 5
sc/source/core/data/docpool.cxx | 28
sc/source/core/data/documen2.cxx | 5
sc/source/core/data/documen5.cxx | 14
sc/source/core/data/documen6.cxx | 3
sc/source/core/data/documen9.cxx | 5
sc/source/core/data/dpcachetable.cxx | 63
sc/source/core/data/dpglobal.cxx | 31
sc/source/core/data/dpgroup.cxx | 16
sc/source/core/data/dpobject.cxx | 73
sc/source/core/data/dpoutput.cxx | 11
sc/source/core/data/dpsave.cxx | 28
sc/source/core/data/dpsdbtab.cxx | 13
sc/source/core/data/dpshttab.cxx | 6
sc/source/core/data/dptabdat.cxx | 16
sc/source/core/data/dptablecache.cxx | 821 ++++------
sc/source/core/data/dptabsrc.cxx | 6
sc/source/core/data/drwlayer.cxx | 19
sc/source/core/data/globalx.cxx | 2
sc/source/core/data/table1.cxx | 6
sc/source/core/data/table3.cxx | 2
sc/source/core/data/tabprotection.cxx | 5
sc/source/core/tool/addincfg.cxx | 2
sc/source/core/tool/addincol.cxx | 39
sc/source/core/tool/appoptio.cxx | 14
sc/source/core/tool/cellkeywords.inl | 6
sc/source/core/tool/charthelper.cxx | 2
sc/source/core/tool/chartpos.cxx | 1
sc/source/core/tool/docoptio.cxx | 24
sc/source/core/tool/filtopt.cxx | 2
sc/source/core/tool/inputopt.cxx | 2
sc/source/core/tool/interpr1.cxx | 4
sc/source/core/tool/interpr3.cxx | 115 -
sc/source/core/tool/interpr4.cxx | 23
sc/source/core/tool/navicfg.cxx | 2
sc/source/core/tool/printopt.cxx | 2
sc/source/core/tool/unitconv.cxx | 8
sc/source/core/tool/viewopti.cxx | 14
sc/source/filter/excel/frmbase.cxx | 4
sc/source/filter/excel/xechart.cxx | 2
sc/source/filter/excel/xecontent.cxx | 4
sc/source/filter/excel/xeescher.cxx | 11
sc/source/filter/excel/xepivot.cxx | 2
sc/source/filter/excel/xestream.cxx | 4
sc/source/filter/excel/xestyle.cxx | 4
sc/source/filter/excel/xiname.cxx | 4
sc/source/filter/excel/xltoolbar.cxx | 15
sc/source/filter/inc/fprogressbar.hxx | 3
sc/source/filter/inc/ftools.hxx | 28
sc/source/filter/inc/xehelper.hxx | 21
sc/source/filter/inc/xicontent.hxx | 30
sc/source/filter/inc/xihelper.hxx | 20
sc/source/filter/inc/xistyle.hxx | 11
sc/source/filter/inc/xlpage.hxx | 3
sc/source/filter/inc/xltools.hxx | 12
sc/source/filter/xcl97/XclExpChangeTrack.cxx | 8
sc/source/filter/xcl97/xcl97rec.cxx | 40
sc/source/filter/xml/XMLCalculationSettingsContext.cxx | 3
sc/source/filter/xml/XMLConsolidationContext.cxx | 2
sc/source/filter/xml/XMLDetectiveContext.cxx | 3
sc/source/filter/xml/XMLStylesImportHelper.cxx | 6
sc/source/filter/xml/XMLTableShapeResizer.cxx | 5
sc/source/filter/xml/XMLTableSourceContext.cxx | 3
sc/source/filter/xml/xmlbodyi.cxx | 5
sc/source/filter/xml/xmlcoli.cxx | 3
sc/source/filter/xml/xmlexprt.cxx | 14
sc/source/filter/xml/xmlimprt.cxx | 250 +--
sc/source/filter/xml/xmlimprt.hxx | 12
sc/source/filter/xml/xmlrowi.cxx | 3
sc/source/filter/xml/xmlsorti.cxx | 14
sc/source/filter/xml/xmlsubti.cxx | 15
sc/source/filter/xml/xmltabi.cxx | 117 -
sc/source/filter/xml/xmlwrap.cxx | 7
sc/source/ui/Accessibility/AccessibleFilterMenu.cxx | 2
sc/source/ui/Accessibility/AccessibleFilterMenuItem.cxx | 4
sc/source/ui/Accessibility/AccessibleFilterTopWindow.cxx | 2
sc/source/ui/app/drwtrans.cxx | 8
sc/source/ui/app/inputwin.cxx | 4
sc/source/ui/app/scdll.cxx | 4
sc/source/ui/app/scmod.cxx | 2
sc/source/ui/app/scmod2.cxx | 2
sc/source/ui/app/seltrans.cxx | 2
sc/source/ui/dbgui/csvruler.cxx | 8
sc/source/ui/dbgui/dapidata.cxx | 6
sc/source/ui/dbgui/scuiasciiopt.cxx | 44
sc/source/ui/dbgui/sortdlg.cxx | 4
sc/source/ui/docshell/arealink.cxx | 1
sc/source/ui/docshell/dbdocimp.cxx | 12
sc/source/ui/docshell/docfunc.cxx | 19
sc/source/ui/docshell/docsh.cxx | 26
sc/source/ui/docshell/docsh4.cxx | 4
sc/source/ui/docshell/docsh8.cxx | 43
sc/source/ui/docshell/externalrefmgr.cxx | 4
sc/source/ui/docshell/impex.cxx | 2
sc/source/ui/drawfunc/drawsh5.cxx | 20
sc/source/ui/drawfunc/fuins2.cxx | 22
sc/source/ui/drawfunc/fusel.cxx | 2
sc/source/ui/inc/docfunc.hxx | 4
sc/source/ui/inc/drtxtob.hxx | 3
sc/source/ui/inc/drwtrans.hxx | 3
sc/source/ui/inc/fusel.hxx | 3
sc/source/ui/inc/linkarea.hxx | 5
sc/source/ui/inc/pfiltdlg.hxx | 3
sc/source/ui/inc/styledlg.hxx | 3
sc/source/ui/inc/subtdlg.hxx | 3
sc/source/ui/inc/tabview.hxx | 5
sc/source/ui/inc/transobj.hxx | 2
sc/source/ui/namedlg/namedlg.cxx | 2
sc/source/ui/navipi/content.cxx | 6
sc/source/ui/optdlg/opredlin.cxx | 16
sc/source/ui/unoobj/addruno.cxx | 2
sc/source/ui/unoobj/afmtuno.cxx | 4
sc/source/ui/unoobj/appluno.cxx | 26
sc/source/ui/unoobj/celllistsource.cxx | 2
sc/source/ui/unoobj/cellvaluebinding.cxx | 10
sc/source/ui/unoobj/chart2uno.cxx | 16
sc/source/ui/unoobj/chartuno.cxx | 10
sc/source/ui/unoobj/confuno.cxx | 6
sc/source/ui/unoobj/cursuno.cxx | 6
sc/source/ui/unoobj/dapiuno.cxx | 8
sc/source/ui/unoobj/datauno.cxx | 34
sc/source/ui/unoobj/docuno.cxx | 14
sc/source/ui/unoobj/eventuno.cxx | 6
sc/source/ui/unoobj/fielduno.cxx | 12
sc/source/ui/unoobj/filtuno.cxx | 6
sc/source/ui/unoobj/funcuno.cxx | 10
sc/source/ui/unoobj/linkuno.cxx | 8
sc/source/ui/unoobj/miscuno.cxx | 2
sc/source/ui/unoobj/nameuno.cxx | 68
sc/source/ui/unoobj/scdetect.cxx | 18
sc/source/ui/unoobj/srchuno.cxx | 6
sc/source/ui/unoobj/styleuno.cxx | 16
sc/source/ui/unoobj/viewuno.cxx | 6
sc/source/ui/vba/excelvbahelper.cxx | 2
sc/source/ui/vba/testvba/testvba.cxx | 32
sc/source/ui/vba/vbaaxes.cxx | 4
sc/source/ui/vba/vbachartobjects.cxx | 4
sc/source/ui/vba/vbafiledialog.cxx | 2
sc/source/ui/vba/vbamenubars.cxx | 2
sc/source/ui/vba/vbaname.cxx | 2
sc/source/ui/vba/vbanames.cxx | 6
sc/source/ui/vba/vbarange.hxx | 2
sc/source/ui/vba/vbawindow.cxx | 2
sc/source/ui/vba/vbawindows.cxx | 2
sc/source/ui/vba/vbaworkbooks.cxx | 2
sc/source/ui/view/dbfunc3.cxx | 2
sc/source/ui/view/drawvie4.cxx | 2
sc/source/ui/view/drawview.cxx | 2
sc/source/ui/view/gridwin3.cxx | 2
sc/source/ui/view/viewfun4.cxx | 4
scaddins/source/analysis/analysishelper.cxx | 2
scaddins/source/datefunc/datefunc.cxx | 14
184 files changed, 1541 insertions(+), 1996 deletions(-)
New commits:
commit d5dd7ae1f00420668bf74e12fd5ea6a379a55574
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Nov 12 18:03:35 2010 -0500
More cleanup, tab removal, bogus comments etc.
diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx
index c6bec4b..b3bb082 100644
--- a/sc/inc/dptablecache.hxx
+++ b/sc/inc/dptablecache.hxx
@@ -41,30 +41,24 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XRowSet.hpp>
-class ScDPTableDataCache;
-class TypedStrData;
struct ScQueryParam;
-// --------------------------------------------------------------------
-//
-// base class ScDPTableData to allow implementation with tabular data
-// by deriving only of this
-//
-
class SC_DLLPUBLIC ScDPTableDataCache
{
- long mnID;
ScDocument* mpDoc;
- long mnColumnCount; // Column count
+ long mnID;
+ long mnColumnCount;
+
+ std::vector<ScDPItemData*>* mpTableDataValues; //Data Pilot Table's index - value map
+ std::vector<SCROW>* mpSourceData; //Data Pilot Table's Source data
+ std::vector<SCROW>* mpGlobalOrder; //Sorted members index
+ std::vector<SCROW>* mpIndexOrder; //Index the sorted number
+ std::vector<ScDPItemData*> mrLabelNames; //Source Label data
+ std::vector<bool> mbEmptyRow; //If empty row?
+
+ mutable ScDPItemDataPool maAdditionalDatas;
- std::vector<ScDPItemData*>* mpTableDataValues; //Data Pilot Table's index - value map
- std::vector<SCROW>* mpSourceData; //Data Pilot Table's Source data
- std::vector<SCROW>* mpGlobalOrder; //Sorted members index
- std::vector<SCROW>* mpIndexOrder; //Index the sorted number
- std::vector<ScDPItemData*> mrLabelNames; //Source Label data
- std::vector<bool> mbEmptyRow; //If empty row?
- mutable ScDPItemDataPool maAdditionalDatas;
public:
SCROW GetOrder( long nDim, SCROW nIndex ) const;
SCROW GetIdByItemData( long nDim, String sItemData ) const;
@@ -83,22 +77,22 @@ public:
SCROW GetSortedItemDataId( SCCOL nDim, SCROW nOrder ) const;
const std::vector<ScDPItemData*>& GetDimMemberValues( SCCOL nDim )const;
- void SetId( long nId ){ mnID = nId;}
- void AddRow( ScDPItemData* pRow, USHORT nCount );
- bool InitFromDoc( ScDocument* pDoc, const ScRange& rRange );
+ void SetId( long nId ){ mnID = nId;}
+ void AddRow( ScDPItemData* pRow, USHORT nCount );
+ bool InitFromDoc( ScDocument* pDoc, const ScRange& rRange );
bool InitFromDataBase (const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& xRowSet, const Date& rNullDate);
- SCROW GetRowCount() const;
- SCROW GetItemDataId( USHORT nDim, SCROW nRow, bool bRepeatIfEmpty ) const;
- String GetDimensionName( USHORT nColumn ) const;
- bool IsEmptyMember( SCROW nRow, USHORT nColumn ) const;
- bool IsRowEmpty( SCROW nRow ) const;
- bool IsValid() const;
- bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, bool* pSpecial );
+ SCROW GetRowCount() const;
+ SCROW GetItemDataId( USHORT nDim, SCROW nRow, bool bRepeatIfEmpty ) const;
+ String GetDimensionName( USHORT nColumn ) const;
+ bool IsEmptyMember( SCROW nRow, USHORT nColumn ) const;
+ bool IsRowEmpty( SCROW nRow ) const;
+ bool IsValid() const;
+ bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, bool* pSpecial );
ScDocument* GetDoc() const;//ms-cache-core
long GetColumnCount() const;
- long GetId() const;
+ long GetId() const;
const ScDPItemData* GetItemDataById( long nDim, SCROW nId ) const;
@@ -107,12 +101,11 @@ public:
ScDPTableDataCache( ScDocument* pDoc );
virtual ~ScDPTableDataCache();
-protected:
private:
- void AddLabel( ScDPItemData* pData);
- bool AddData( long nDim, ScDPItemData* itemData );
+ void AddLabel( ScDPItemData* pData);
+ bool AddData( long nDim, ScDPItemData* itemData );
};
-#endif //DPTABLECACHE_HXX
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx
index a8585df..028b8ea 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -399,13 +399,13 @@ bool ScDPTableDataCache::operator== ( const ScDPTableDataCache& r ) const
ScDPTableDataCache::ScDPTableDataCache( ScDocument* pDoc ) :
mpDoc( pDoc ),
+ mnID(-1),
mnColumnCount ( 0 ),
mpTableDataValues ( NULL ),
mpSourceData ( NULL ),
mpGlobalOrder( NULL ),
mpIndexOrder( NULL)
{
- mnID = -1;
}
ScDPTableDataCache::~ScDPTableDataCache()
commit 8abe0590ec222baa617e4b2258e9cf4b817c352e
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Nov 12 16:49:01 2010 -0500
Oops. My bad - removing my own printf silliness.
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 3379152..adefdb9 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -194,7 +194,6 @@ static const sal_Char __FAR_DATA pFilterRtf[] = "Rich Text Format (StarCalc)";
SFX_IMPL_INTERFACE(ScDocShell,SfxObjectShell, ScResId(SCSTR_DOCSHELL))
{
- fprintf(stdout, "SFX_IMPL_INTERFACE: SID_HYPERLINK_INSERT = %d\n", SID_HYPERLINK_INSERT);
SFX_CHILDWINDOW_REGISTRATION( SID_HYPERLINK_INSERT );
}
commit f4c065a03439b86cc2053664f54c20162ad65da2
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Nov 12 16:39:45 2010 -0500
More cleanups - trailing whitespaces & more bogus comments.
diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx
index 5a8652a..0541bd7 100644
--- a/sc/inc/dpglobal.hxx
+++ b/sc/inc/dpglobal.hxx
@@ -131,7 +131,7 @@ private:
public:
ScDPItemData() : nNumFormat( 0 ), fValue(0.0), mbFlag( 0 ){}
ScDPItemData( ULONG nNF, const String & rS, double fV, BYTE bF ):nNumFormat(nNF), aString(rS), fValue(fV), mbFlag( bF ){}
- ScDPItemData( const String& rS, double fV = 0.0, bool bHV = FALSE, const ULONG nNumFormat = 0 , bool bData = TRUE) ;
+ ScDPItemData( const String& rS, double fV = 0.0, bool bHV = FALSE, const ULONG nNumFormat = 0 , bool bData = TRUE) ;
ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nDocTab );
void SetString( const String& rS ) { aString = rS; mbFlag &= ~(MK_VAL|MK_DATE); nNumFormat = 0; mbFlag |= MK_DATA; }
@@ -139,7 +139,7 @@ public:
bool IsCaseInsEqual( const ScDPItemData& r ) const;
size_t Hash() const;
-
+
// exact equality
bool operator==( const ScDPItemData& r ) const;
// case insensitive equality
@@ -160,7 +160,7 @@ public:
bool IsDate() const;
bool HasDatePart() const;
void SetDate( bool b ) ;
-
+
TypedStrData* CreateTypeString( );
sal_uInt8 GetType() const;
BYTE & GetFlag() throw() { return mbFlag; }
@@ -172,7 +172,7 @@ 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 );
@@ -192,18 +192,18 @@ protected:
namespace ScDPGlobal
{
// used for core data
- String GetFieldFuncString( const String& rSourceName, USHORT &rFuncMask, bool bIsValue );
+ String GetFieldFuncString( const String& rSourceName, USHORT &rFuncMask, bool bIsValue );
String GetFuncString( const String &rString, const USHORT nIndex );
com::sun::star::uno::Reference<com::sun::star::container::XNameAccess> DP_GetMembers( const com::sun::star::uno::Reference<
com::sun::star::sheet::XDimensionsSupplier>&rSrc, long nField );
// common operation
String operator + ( const String & rL, const String &rR );
Rectangle operator *( const Rectangle &rLeft, const std::pair<double,double> & rRight );
-// used for DataPilot Panel
+// used for DataPilot Panel
ScDPInfoWnd* GetDPInfoWnd( ScTabViewShell *pViewShell );
bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, bool bExcludeClip = FALSE );
}
-#endif
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx
index 0430eaa..ec0c483 100644
--- a/sc/inc/dpshttab.hxx
+++ b/sc/inc/dpshttab.hxx
@@ -42,10 +42,8 @@ namespace com { namespace sun { namespace star { namespace sheet {
}}}}
class ScDPDimension;
-// Wang Xu Ming -- 2009-8-17
-// DataPilot Migration - Cache&&Performance
class ScDPItemData;
-// End Comments
+
// --------------------------------------------------------------------
//
// implementation of ScDPTableData with sheet data
@@ -59,33 +57,27 @@ struct ScSheetSourceDesc
BOOL operator== ( const ScSheetSourceDesc& rOther ) const
{ return aSourceRange == rOther.aSourceRange &&
aQueryParam == rOther.aQueryParam; }
-// Wang Xu Ming - DataPilot migration
-// Buffer&&Performance
ScDPTableDataCache* CreateCache( ScDocument* pDoc, long nID = -1) const;
ULONG CheckValidate( ScDocument* pDoc ) const;
ScDPTableDataCache* GetCache( ScDocument* pDoc, long nID ) const;
ScDPTableDataCache* GetExistDPObjectCache ( ScDocument* pDoc ) const;
long GetCacheId( ScDocument* pDoc, long nID ) const;
-
-// End Comments
};
class SC_DLLPUBLIC ScSheetDPData : public ScDPTableData
{
private:
ScQueryParam aQuery;
- bool* pSpecial;
+ bool* pSpecial;
bool bIgnoreEmptyRows;
bool bRepeatIfEmpty;
- ScDPCacheTable aCacheTable;
+ ScDPCacheTable aCacheTable;
public:
- // Wang Xu Ming -- 2009-8-17
- // DataPilot Migration - Cache&&Performance
ScSheetDPData( ScDocument* pD, const ScSheetSourceDesc& rDesc, long nCacheId = -1 );
- virtual ~ScSheetDPData();
- // End Comments
+ virtual ~ScSheetDPData();
+
virtual long GetColumnCount();
virtual String getDimensionName(long nColumn);
virtual BOOL getIsDataLayoutDimension(long nColumn);
commit 42fdc726dc61794033cef93eea39cc82589f57ea
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Nov 12 16:34:27 2010 -0500
More datapilt-related cleanups.
New code should *never* use BOOL, TRUE, FALSE. Also the indentation
mistakes are pretty frequent.
diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index 392c0a3..1041a05 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -139,7 +139,7 @@ public:
/** Fill the internal table from the cell range provided. This function
assumes that the first row is the column header. */
- void fillTable( const ScQueryParam& rQuery, BOOL* pSpecial,
+ void fillTable( const ScQueryParam& rQuery, bool* pSpecial,
bool bIgnoreEmptyRows, bool bRepeatIfEmpty );
/** Fill the internal table from database connection object. This function
diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx
index b714f1f..5a8652a 100644
--- a/sc/inc/dpglobal.hxx
+++ b/sc/inc/dpglobal.hxx
@@ -29,9 +29,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-// Wang Xu Ming - DataPilot migration
-// Buffer&&Performance
-//
+
#ifndef _SC_DPGLOBAL_HXX
#define _SC_DPGLOBAL_HXX
@@ -107,6 +105,9 @@
class TypedStrData;
class ScDPObject;
+class ScDPInfoWnd;
+class ScDocShell;
+class ScTabViewShell;
class SC_DLLPUBLIC ScDPItemData
{
@@ -122,25 +123,25 @@ private:
String aString;
double fValue;
BYTE mbFlag;
- //BOOL bHasValue: 1 ;
- //BOOL bHasData: 1;
- //BOOL bErr: 1;
+ //bool bHasValue: 1 ;
+ //bool bHasData: 1;
+ //bool bErr: 1;
friend class ScDPTableDataCache;
public:
ScDPItemData() : nNumFormat( 0 ), fValue(0.0), mbFlag( 0 ){}
ScDPItemData( ULONG nNF, const String & rS, double fV, BYTE bF ):nNumFormat(nNF), aString(rS), fValue(fV), mbFlag( bF ){}
- ScDPItemData( const String& rS, double fV = 0.0, BOOL bHV = FALSE, const ULONG nNumFormat = 0 , BOOL bData = TRUE) ;
+ ScDPItemData( const String& rS, double fV = 0.0, bool bHV = FALSE, const ULONG nNumFormat = 0 , bool bData = TRUE) ;
ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nDocTab );
void SetString( const String& rS ) { aString = rS; mbFlag &= ~(MK_VAL|MK_DATE); nNumFormat = 0; mbFlag |= MK_DATA; }
// void SetValue ( double value , ULONG nNumFormat = 0 ) { bHasValue = TRUE; nNumFormat = 0;bHasData = TRUE; bDate = FALSE; fValue = value ;}
- BOOL IsCaseInsEqual( const ScDPItemData& r ) const;
+ bool IsCaseInsEqual( const ScDPItemData& r ) const;
size_t Hash() const;
// exact equality
- BOOL operator==( const ScDPItemData& r ) const;
+ bool operator==( const ScDPItemData& r ) const;
// case insensitive equality
static sal_Int32 Compare( const ScDPItemData& rA, const ScDPItemData& rB );
@@ -149,16 +150,16 @@ public:
#endif
public:
- BOOL IsHasData() const ;
- BOOL IsHasErr() const ;
- BOOL IsValue() const;
+ bool IsHasData() const ;
+ bool IsHasErr() const ;
+ bool IsValue() const;
String GetString() const ;
double GetValue() const ;
ULONG GetNumFormat() const ;
- BOOL HasStringData() const ;
- BOOL IsDate() const;
- BOOL HasDatePart() const;
- void SetDate( BOOL b ) ;
+ bool HasStringData() const ;
+ bool IsDate() const;
+ bool HasDatePart() const;
+ void SetDate( bool b ) ;
TypedStrData* CreateTypeString( );
sal_uInt8 GetType() const;
@@ -169,11 +170,10 @@ public:
class SC_DLLPUBLIC ScDPItemDataPool
{
public:
- // construct
- ScDPItemDataPool(void);
+ ScDPItemDataPool();
ScDPItemDataPool(const ScDPItemDataPool& r);
- virtual ~ScDPItemDataPool(void);
+ virtual ~ScDPItemDataPool();
virtual const ScDPItemData* getData( sal_Int32 nId );
virtual sal_Int32 getDataId( const ScDPItemData& aData );
virtual sal_Int32 insertData( const ScDPItemData& aData );
@@ -189,13 +189,10 @@ protected:
DataHash maItemIds;
};
-class ScDPInfoWnd;
-class ScDocShell;
-class ScTabViewShell;
namespace ScDPGlobal
{
// used for core data
- String GetFieldFuncString( const String& rSourceName, USHORT &rFuncMask, BOOL bIsValue );
+ String GetFieldFuncString( const String& rSourceName, USHORT &rFuncMask, bool bIsValue );
String GetFuncString( const String &rString, const USHORT nIndex );
com::sun::star::uno::Reference<com::sun::star::container::XNameAccess> DP_GetMembers( const com::sun::star::uno::Reference<
com::sun::star::sheet::XDimensionsSupplier>&rSrc, long nField );
@@ -204,7 +201,7 @@ namespace ScDPGlobal
Rectangle operator *( const Rectangle &rLeft, const std::pair<double,double> & rRight );
// used for DataPilot Panel
ScDPInfoWnd* GetDPInfoWnd( ScTabViewShell *pViewShell );
- bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, BOOL bExcludeClip = FALSE );
+ bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, bool bExcludeClip = FALSE );
}
#endif
diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx
index b2c618c..0430eaa 100644
--- a/sc/inc/dpshttab.hxx
+++ b/sc/inc/dpshttab.hxx
@@ -74,9 +74,9 @@ class SC_DLLPUBLIC ScSheetDPData : public ScDPTableData
{
private:
ScQueryParam aQuery;
- BOOL* pSpecial;
- BOOL bIgnoreEmptyRows;
- BOOL bRepeatIfEmpty;
+ bool* pSpecial;
+ bool bIgnoreEmptyRows;
+ bool bRepeatIfEmpty;
ScDPCacheTable aCacheTable;
diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx
index 1c1d71d..c6bec4b 100644
--- a/sc/inc/dptablecache.hxx
+++ b/sc/inc/dptablecache.hxx
@@ -29,14 +29,11 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef DPTABLECACHE_HXX
-#define DPTABLECACHE_HXX
-// Wang Xu Ming -- 12/21/2008
-// Add Data Cache Support.
+#ifndef SC_DPTABLECACHE_HXX
+#define SC_DPTABLECACHE_HXX
+
#include "global.hxx"
-//Added by PengYunQuan for SODC_16015
#include <svl/zforlist.hxx>
-//end
#include <vector>
#include "dpglobal.hxx"
@@ -66,7 +63,7 @@ class SC_DLLPUBLIC ScDPTableDataCache
std::vector<SCROW>* mpGlobalOrder; //Sorted members index
std::vector<SCROW>* mpIndexOrder; //Index the sorted number
std::vector<ScDPItemData*> mrLabelNames; //Source Label data
- std::vector<BOOL> mbEmptyRow; //If empty row?
+ std::vector<bool> mbEmptyRow; //If empty row?
mutable ScDPItemDataPool maAdditionalDatas;
public:
SCROW GetOrder( long nDim, SCROW nIndex ) const;
@@ -80,7 +77,7 @@ public:
const ScDPItemData* GetSortedItemData( SCCOL nDim, SCROW nOrder ) const;
ULONG GetNumType ( ULONG nFormat ) const;
ULONG GetNumberFormat( long nDim ) const;
- BOOL IsDateDimension( long nDim ) const ;
+ bool IsDateDimension( long nDim ) const ;
ULONG GetDimNumType( SCCOL nDim) const;
SCROW GetDimMemberCount( SCCOL nDim ) const;
@@ -92,12 +89,12 @@ public:
bool InitFromDataBase (const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& xRowSet, const Date& rNullDate);
SCROW GetRowCount() const;
- SCROW GetItemDataId( USHORT nDim, SCROW nRow, BOOL bRepeatIfEmpty ) const;
+ SCROW GetItemDataId( USHORT nDim, SCROW nRow, bool bRepeatIfEmpty ) const;
String GetDimensionName( USHORT nColumn ) const;
bool IsEmptyMember( SCROW nRow, USHORT nColumn ) const;
bool IsRowEmpty( SCROW nRow ) const;
bool IsValid() const;
- bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, BOOL* pSpecial );
+ bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, bool* pSpecial );
ScDocument* GetDoc() const;//ms-cache-core
long GetColumnCount() const;
@@ -105,17 +102,15 @@ public:
const ScDPItemData* GetItemDataById( long nDim, SCROW nId ) const;
- BOOL operator== ( const ScDPTableDataCache& r ) const;
+ bool operator== ( const ScDPTableDataCache& r ) const;
-//construction
ScDPTableDataCache( ScDocument* pDoc );
-//deconstruction
virtual ~ScDPTableDataCache();
protected:
private:
void AddLabel( ScDPItemData* pData);
- BOOL AddData( long nDim, ScDPItemData* itemData );
+ bool AddData( long nDim, ScDPItemData* itemData );
};
#endif //DPTABLECACHE_HXX
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx
index 5b85a59..2a1f5d7 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -186,8 +186,8 @@ sal_Int32 ScDPCacheTable::getColSize() const
return getCache()->GetColumnCount();
}
-void ScDPCacheTable::fillTable( const ScQueryParam& rQuery, BOOL* pSpecial,
- bool bIgnoreEmptyRows, bool bRepeatIfEmpty )
+void ScDPCacheTable::fillTable(
+ const ScQueryParam& rQuery, bool* pSpecial, bool bIgnoreEmptyRows, bool bRepeatIfEmpty)
{
// check cache
if ( mpCache == NULL )
diff --git a/sc/source/core/data/dpglobal.cxx b/sc/source/core/data/dpglobal.cxx
index 43ff45e..65039b4 100644
--- a/sc/source/core/data/dpglobal.cxx
+++ b/sc/source/core/data/dpglobal.cxx
@@ -60,56 +60,53 @@ namespace ScDPGlobal
return strRet;
}
- bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, BOOL bExcludeClip /*= FALSE*/ )
+ bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, BOOL bExcludeClip /*= FALSE*/ )
{
- if ( ScDPCollection* pDPCollection = pDestDoc->GetDPCollection() )
+ if (ScDPCollection* pDPCollection = pDestDoc->GetDPCollection())
{
USHORT nCount = pDPCollection->GetCount();
SCsCOL nOffsetX = nStartCol - nClipStartCol;
SCsROW nOffsetY = nStartRow - nClipStartRow;
- for( std::list<ScDPObject>::iterator iter = rClipboard.begin(); iter!=rClipboard.end(); iter++ )
+ for (std::list<ScDPObject>::iterator iter = rClipboard.begin(); iter!=rClipboard.end(); iter++)
{
ScRange aRange = iter->GetOutRange();
- for( USHORT nCurrTab = nStartTab; nCurrTab<=nEndTab; nCurrTab++ )
+ for (USHORT nCurrTab = nStartTab; nCurrTab<=nEndTab; nCurrTab++)
{
SCsTAB nOffsetZ = nCurrTab - aRange.aStart.Tab();
aRange.Move( nOffsetX, nOffsetY, nOffsetZ );
- for ( USHORT i = 0; i<nCount; i++)
+ for (USHORT i = 0; i<nCount; i++)
{
- if ( (*pDPCollection)[i] && aRange.Intersects( (*pDPCollection)[i]->GetOutRange()))
+ if ((*pDPCollection)[i] && aRange.Intersects( (*pDPCollection)[i]->GetOutRange()))
{
- if ( bExcludeClip && iter->GetOutRange() == (*pDPCollection)[i]->GetOutRange() )
+ if (bExcludeClip && iter->GetOutRange() == (*pDPCollection)[i]->GetOutRange())
{
continue;
}
- return false;
+ return false;
}
}
}
}
}
- return true;
-}
-//end
+ return true;
+ }
}
-// --------------------------------------------------------------------
-// ScDPItemDataPool
-// Construct
-ScDPItemDataPool::ScDPItemDataPool(void)
+
+ScDPItemDataPool::ScDPItemDataPool()
{
}
-//
+
ScDPItemDataPool::ScDPItemDataPool(const ScDPItemDataPool& r):
maItems(r.maItems),
maItemIds(r.maItemIds)
{
}
-ScDPItemDataPool::~ScDPItemDataPool(void)
+ScDPItemDataPool::~ScDPItemDataPool()
{
}
diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx
index d6aa936..0afce0b 100644
--- a/sc/source/core/data/dpshttab.cxx
+++ b/sc/source/core/data/dpshttab.cxx
@@ -71,7 +71,7 @@ ScSheetDPData::ScSheetDPData( ScDocument* pD, const ScSheetSourceDesc& rDesc , l
aCacheTable( pD, rDesc.GetCacheId( pD, nCacheId))
{
SCSIZE nEntryCount( aQuery.GetEntryCount());
- pSpecial = new BOOL[nEntryCount];
+ pSpecial = new bool[nEntryCount];
for (SCSIZE j = 0; j < nEntryCount; ++j )
{
ScQueryEntry& rEntry = aQuery.GetEntry(j);
diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx
index 849f29e..a8585df 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -61,15 +61,15 @@ using ::com::sun::star::uno::UNO_QUERY_THROW;
namespace {
-BOOL lcl_isDate( ULONG nNumType )
+bool lcl_isDate( ULONG nNumType )
{
return ( (nNumType & NUMBERFORMAT_DATE) != 0 )? 1:0 ;
}
-BOOL lcl_Search( const std::vector<ScDPItemData*>& list, const ::std::vector<SCROW>& rOrder, const ScDPItemData& item, SCROW& rIndex)
+bool lcl_Search( const std::vector<ScDPItemData*>& list, const ::std::vector<SCROW>& rOrder, const ScDPItemData& item, SCROW& rIndex)
{
rIndex = list.size();
- BOOL bFound = FALSE;
+ bool bFound = false;
SCROW nLo = 0;
SCROW nHi = list.size() - 1;
SCROW nIndex;
@@ -85,7 +85,7 @@ BOOL lcl_Search( const std::vector<ScDPItemData*>& list, const ::std::vector<SCR
nHi = nIndex - 1;
if (nCompare == 0)
{
- bFound = TRUE;
+ bFound = true;
nLo = nIndex;
}
}
@@ -109,7 +109,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy
{
nNumType = NUMBERFORMAT_LOGICAL;
fValue = xRow->getBoolean(nCol) ? 1 : 0;
- return new ScDPItemData( rStr, fValue,TRUE,nNumType);
+ return new ScDPItemData( rStr, fValue,true,nNumType);
}
case sdbc::DataType::TINYINT:
case sdbc::DataType::SMALLINT:
@@ -123,7 +123,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy
{
//! do the conversion here?
fValue = xRow->getDouble(nCol);
- return new ScDPItemData( rStr, fValue,TRUE);
+ return new ScDPItemData( rStr, fValue,true);
}
case sdbc::DataType::DATE:
{
@@ -131,7 +131,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy
util::Date aDate = xRow->getDate(nCol);
fValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate;
- return new ScDPItemData( rStr, fValue, TRUE, nNumType );
+ return new ScDPItemData( rStr, fValue, true, nNumType );
}
case sdbc::DataType::TIME:
{
@@ -140,7 +140,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy
util::Time aTime = xRow->getTime(nCol);
fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 +
aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
- return new ScDPItemData( rStr,fValue, TRUE, nNumType );
+ return new ScDPItemData( rStr,fValue, true, nNumType );
}
case sdbc::DataType::TIMESTAMP:
{
@@ -150,7 +150,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy
fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - rNullDate ) +
( aStamp.Hours * 3600 + aStamp.Minutes * 60 +
aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
- return new ScDPItemData( rStr,fValue, TRUE, nNumType );
+ return new ScDPItemData( rStr,fValue, true, nNumType );
}
case sdbc::DataType::CHAR:
case sdbc::DataType::VARCHAR:
@@ -172,9 +172,9 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy
}
-ScDPItemData::ScDPItemData( const String& rS, double fV/* = 0.0*/, BOOL bHV/* = FALSE*/, const ULONG nNumFormatP /*= 0*/ , BOOL bData/* = TRUE*/) :
+ScDPItemData::ScDPItemData( const String& rS, double fV/* = 0.0*/, bool bHV/* = false*/, const ULONG nNumFormatP /*= 0*/ , bool bData/* = true*/) :
nNumFormat( nNumFormatP ), aString(rS), fValue(fV),
- mbFlag( (MK_VAL*!!bHV) | (MK_DATA*!!bData) | (MK_ERR*!!FALSE) | (MK_DATE*!!lcl_isDate( nNumFormat ) ) )
+ mbFlag( (MK_VAL*!!bHV) | (MK_DATA*!!bData) | (MK_ERR*!!false) | (MK_DATE*!!lcl_isDate( nNumFormat ) ) )
{
}
@@ -207,7 +207,7 @@ ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nD
SetString ( aDocStr );
}
-BOOL ScDPItemData::IsCaseInsEqual( const ScDPItemData& r ) const
+bool ScDPItemData::IsCaseInsEqual( const ScDPItemData& r ) const
{
//! pass Transliteration?
//! inline?
@@ -226,22 +226,22 @@ size_t ScDPItemData::Hash() const
return rtl_ustr_hashCode_WithLength( aString.GetBuffer(), aString.Len() );
}
-BOOL ScDPItemData::operator==( const ScDPItemData& r ) const
+bool ScDPItemData::operator==( const ScDPItemData& r ) const
{
if ( IsValue() )
{
if( (HasDatePart() != r.HasDatePart()) || (HasDatePart() && mnDatePart != r.mnDatePart) )
- return FALSE;
+ return false;
if ( IsDate() != r.IsDate() )
- return FALSE;
+ return false;
else if ( r.IsValue() )
return rtl::math::approxEqual( fValue, r.fValue );
else
- return FALSE;
+ return false;
}
else if ( r.IsValue() )
- return FALSE;
+ return false;
else
// need exact equality until we have a safe case insensitive string hash
return aString == r.aString;
@@ -307,17 +307,17 @@ sal_uInt8 ScDPItemData::GetType() const
}
-BOOL ScDPItemData::IsHasData() const
+bool ScDPItemData::IsHasData() const
{
return !!(mbFlag&MK_DATA);
}
-BOOL ScDPItemData::IsHasErr() const
+bool ScDPItemData::IsHasErr() const
{
return !!(mbFlag&MK_ERR);
}
-BOOL ScDPItemData::IsValue() const
+bool ScDPItemData::IsValue() const
{
return !!(mbFlag&MK_VAL);
}
@@ -337,20 +337,20 @@ ULONG ScDPItemData::GetNumFormat() const
return nNumFormat;
}
-BOOL ScDPItemData::HasStringData() const
+bool ScDPItemData::HasStringData() const
{
return IsHasData()&&!IsHasErr()&&!IsValue();
}
-BOOL ScDPItemData::IsDate() const
+bool ScDPItemData::IsDate() const
{
return !!(mbFlag&MK_DATE);
}
-BOOL ScDPItemData::HasDatePart() const
+bool ScDPItemData::HasDatePart() const
{
return !!(mbFlag&MK_DATEPART);
}
-void ScDPItemData::SetDate( BOOL b )
+void ScDPItemData::SetDate( bool b )
{
b ? ( mbFlag |= MK_DATE ) : ( mbFlag &= ~MK_DATE );
}
@@ -359,17 +359,17 @@ void ScDPItemData::SetDate( BOOL b )
//class ScDPTableDataCache
//To cache the pivot table data source
-BOOL ScDPTableDataCache::operator== ( const ScDPTableDataCache& r ) const
+bool ScDPTableDataCache::operator== ( const ScDPTableDataCache& r ) const
{
if ( GetColumnCount() == r.GetColumnCount() )
{
for ( SCCOL i = 0 ; i < GetColumnCount(); i++ )
{ //check dim names
if ( GetDimensionName( i ) != r.GetDimensionName( i ) )
- return FALSE;
+ return false;
//check rows count
if ( GetRowCount() != r.GetRowCount() )
- return FALSE;
+ return false;
//check dim member values
size_t nMembersCount = GetDimMemberValues( i ).size();
if ( GetDimMemberValues( i ).size() == r. GetDimMemberValues( i ).size() )
@@ -379,22 +379,22 @@ BOOL ScDPTableDataCache::operator== ( const ScDPTableDataCache& r ) const
if ( *( GetDimMemberValues( i )[j] ) == *( r.GetDimMemberValues( i )[j] ) )
continue;
else
- return FALSE;
+ return false;
}
}
else
- return FALSE;
+ return false;
//check source table index
for ( SCROW k=0 ; k < GetRowCount(); k ++ )
{
- if ( GetItemDataId( i, k, FALSE ) == r.GetItemDataId( i,k,FALSE) )
+ if ( GetItemDataId( i, k, false ) == r.GetItemDataId( i,k,false) )
continue;
else
- return FALSE;
+ return false;
}
}
}
- return TRUE;
+ return true;
}
ScDPTableDataCache::ScDPTableDataCache( ScDocument* pDoc ) :
@@ -530,7 +530,7 @@ bool ScDPTableDataCache::InitFromDoc( ScDocument* pDoc, const ScRange& rRange )
AddData( nCol - nStartCol, new ScDPItemData( pDoc, nRow, nCol, nDocTab ) );
}
}
- return TRUE;
+ return true;
}
bool ScDPTableDataCache::InitFromDataBase (const Reference<sdbc::XRowSet>& xRowSet, const Date& rNullDate)
@@ -611,20 +611,20 @@ ULONG ScDPTableDataCache::GetDimNumType( SCCOL nDim) const
return GetNumType(mpTableDataValues[nDim][0]->nNumFormat);
}
-bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOOL *pSpecial)
+bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, bool *pSpecial)
{ //Copied and modified from ScTable::ValidQuery
if (!rParam.GetEntry(0).bDoQuery)
- return TRUE;
- BOOL bMatchWholeCell = mpDoc->GetDocOptions().IsMatchWholeCell();
+ return true;
+ bool bMatchWholeCell = mpDoc->GetDocOptions().IsMatchWholeCell();
//---------------------------------------------------------------
const SCSIZE nFixedBools = 32;
- BOOL aBool[nFixedBools];
- BOOL aTest[nFixedBools];
+ bool aBool[nFixedBools];
+ bool aTest[nFixedBools];
SCSIZE nEntryCount = rParam.GetEntryCount();
- BOOL* pPasst = ( nEntryCount <= nFixedBools ? &aBool[0] : new BOOL[nEntryCount] );
- BOOL* pTest = ( nEntryCount <= nFixedBools ? &aTest[0] : new BOOL[nEntryCount] );
+ bool* pPasst = ( nEntryCount <= nFixedBools ? &aBool[0] : new bool[nEntryCount] );
+ bool* pTest = ( nEntryCount <= nFixedBools ? &aTest[0] : new bool[nEntryCount] );
long nPos = -1;
SCSIZE i = 0;
@@ -637,11 +637,11 @@ bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOO
{
ScQueryEntry& rEntry = rParam.GetEntry(i);
// we can only handle one single direct query
- SCROW nId = GetItemDataId( (SCCOL)rEntry.nField, nRow, FALSE );
+ SCROW nId = GetItemDataId( (SCCOL)rEntry.nField, nRow, false );
const ScDPItemData* pCellData = GetItemDataById( (SCCOL)rEntry.nField, nId);
- BOOL bOk = FALSE;
- BOOL bTestEqual = FALSE;
+ bool bOk = false;
+ bool bTestEqual = false;
if (pSpecial && pSpecial[i])
{
@@ -675,7 +675,7 @@ bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOO
bOk = !::rtl::math::approxEqual( nCellVal, rEntry.nVal );
break;
default:
- bOk= FALSE;
+ bOk= false;
break;
}
}
@@ -686,19 +686,19 @@ bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOO
{ // by String
String aCellStr = pCellData->GetString();
- BOOL bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL)
+ bool bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL)
|| (rEntry.eOp == SC_NOT_EQUAL)));
- BOOL bTestRegExp = FALSE;
+ bool bTestRegExp = false;
if (bRealRegExp || bTestRegExp)
{
xub_StrLen nStart = 0;
xub_StrLen nEnd = aCellStr.Len();
- BOOL bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens )
+ bool bMatch = (bool) rEntry.GetSearchTextPtr( rParam.bCaseSens )
->SearchFrwrd( aCellStr, &nStart, &nEnd );
// from 614 on, nEnd is behind the found text
if (bMatch && bMatchWholeCell
&& (nStart != 0 || nEnd != aCellStr.Len()))
- bMatch = FALSE; // RegExp must match entire cell string
+ bMatch = false; // RegExp must match entire cell string
if (bRealRegExp)
bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch);
else
@@ -812,7 +812,7 @@ bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOO
pTest[0] = pTest[0] || pTest[j];
}
- BOOL bRet = pPasst[0];
+ bool bRet = pPasst[0];
if (pPasst != &aBool[0])
delete [] pPasst;
if (pTest != &aTest[0])
@@ -828,16 +828,16 @@ bool ScDPTableDataCache::IsRowEmpty( SCROW nRow ) const
bool ScDPTableDataCache::IsEmptyMember( SCROW nRow, USHORT nColumn ) const
{
- return !GetItemDataById( nColumn, GetItemDataId( nColumn, nRow, FALSE ) )->IsHasData();
+ return !GetItemDataById( nColumn, GetItemDataId( nColumn, nRow, false ) )->IsHasData();
}
-BOOL ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData)
+bool ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData)
{
DBG_ASSERT( IsValid(), " IsValid() == false " );
DBG_ASSERT( nDim < mnColumnCount && nDim >=0 , "dimension out of bound" );
SCROW nIndex = 0;
- BOOL bInserted = FALSE;
+ bool bInserted = false;
pitemData->SetDate( lcl_isDate( GetNumType( pitemData->nNumFormat ) ) );
@@ -847,7 +847,7 @@ BOOL ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData)
mpGlobalOrder[nDim].insert( mpGlobalOrder[nDim].begin()+nIndex, mpTableDataValues[nDim].size()-1 );
DBG_ASSERT( (size_t) mpGlobalOrder[nDim][nIndex] == mpTableDataValues[nDim].size()-1 ,"ScDPTableDataCache::AddData ");
mpSourceData[nDim].push_back( mpTableDataValues[nDim].size()-1 );
- bInserted = TRUE;
+ bInserted = true;
}
else
mpSourceData[nDim].push_back( mpGlobalOrder[nDim][nIndex] );
@@ -855,15 +855,15 @@ BOOL ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData)
size_t nCurRow = mpSourceData[nDim].size() -1 ;
while ( mbEmptyRow.size() <= nCurRow )
- mbEmptyRow.push_back( TRUE );
+ mbEmptyRow.push_back( true );
if ( pitemData->IsHasData() )
- mbEmptyRow[ nCurRow ] = FALSE;
+ mbEmptyRow[ nCurRow ] = false;
if ( !bInserted )
delete pitemData;
- return TRUE;
+ return true;
}
@@ -888,7 +888,7 @@ void ScDPTableDataCache::AddLabel(ScDPItemData *pData)
//reset name if needed
String strNewName = pData->aString;
- BOOL bFound = FALSE;
+ bool bFound = false;
long nIndex = 1;
do
{
@@ -899,7 +899,7 @@ void ScDPTableDataCache::AddLabel(ScDPItemData *pData)
strNewName = pData->aString;
strNewName += String::CreateFromInt32( nIndex );
nIndex ++ ;
- bFound = TRUE;
+ bFound = true;
}
}
bFound = !bFound;
@@ -910,7 +910,7 @@ void ScDPTableDataCache::AddLabel(ScDPItemData *pData)
mrLabelNames.push_back( pData );
}
-SCROW ScDPTableDataCache::GetItemDataId(USHORT nDim, SCROW nRow, BOOL bRepeatIfEmpty) const
+SCROW ScDPTableDataCache::GetItemDataId(USHORT nDim, SCROW nRow, bool bRepeatIfEmpty) const
{
DBG_ASSERT( IsValid(), " IsValid() == false " );
DBG_ASSERT( /* nDim >= 0 && */ nDim < mnColumnCount, "ScDPTableDataCache::GetItemDataId " );
@@ -977,7 +977,7 @@ ULONG ScDPTableDataCache::GetNumberFormat( long nDim ) const
return mpTableDataValues[nDim][0]->nNumFormat;
}
-BOOL ScDPTableDataCache::IsDateDimension( long nDim ) const
+bool ScDPTableDataCache::IsDateDimension( long nDim ) const
{
if ( nDim >= mnColumnCount )
return false;
commit e4d8f137d0fdadbd49b2883fa115de352fe77c02
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Nov 12 15:58:51 2010 -0500
Removed trailing whitespaces.
diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx
index cdddb74..849f29e 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -108,7 +108,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy
case sdbc::DataType::BOOLEAN:
{
nNumType = NUMBERFORMAT_LOGICAL;
- fValue = xRow->getBoolean(nCol) ? 1 : 0;
+ fValue = xRow->getBoolean(nCol) ? 1 : 0;
return new ScDPItemData( rStr, fValue,TRUE,nNumType);
}
case sdbc::DataType::TINYINT:
@@ -175,7 +175,7 @@ ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nTy
ScDPItemData::ScDPItemData( const String& rS, double fV/* = 0.0*/, BOOL bHV/* = FALSE*/, const ULONG nNumFormatP /*= 0*/ , BOOL bData/* = TRUE*/) :
nNumFormat( nNumFormatP ), aString(rS), fValue(fV),
mbFlag( (MK_VAL*!!bHV) | (MK_DATA*!!bData) | (MK_ERR*!!FALSE) | (MK_DATE*!!lcl_isDate( nNumFormat ) ) )
-{
+{
}
ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nDocTab ) :
@@ -183,9 +183,9 @@ ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nD
{
String aDocStr;
pDoc->GetString( nCol, nRow, nDocTab, aDocStr );
-
+
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-
+
ScAddress aPos( nCol, nRow, nDocTab );
ScBaseCell* pCell = pDoc->GetCell( aPos );
@@ -295,64 +295,64 @@ TypedStrData* ScDPItemData::CreateTypeString( )
sal_uInt8 ScDPItemData::GetType() const
{
-
+
if ( IsHasErr() )
return SC_VALTYPE_ERROR;
else if ( !IsHasData() )
return SC_VALTYPE_EMPTY;
else if ( IsValue())
return SC_VALTYPE_VALUE;
- else
+ else
return SC_VALTYPE_STRING;
}
-BOOL ScDPItemData::IsHasData() const
+BOOL ScDPItemData::IsHasData() const
{
return !!(mbFlag&MK_DATA);
}
-BOOL ScDPItemData::IsHasErr() const
-{
- return !!(mbFlag&MK_ERR);
+BOOL ScDPItemData::IsHasErr() const
+{
+ return !!(mbFlag&MK_ERR);
}
-BOOL ScDPItemData::IsValue() const
-{
+BOOL ScDPItemData::IsValue() const
+{
return !!(mbFlag&MK_VAL);
}
-String ScDPItemData::GetString() const
-{
+String ScDPItemData::GetString() const
+{
return aString;
}
-double ScDPItemData::GetValue() const
-{
+double ScDPItemData::GetValue() const
+{
return fValue;
}
-ULONG ScDPItemData::GetNumFormat() const
-{
+ULONG ScDPItemData::GetNumFormat() const
+{
return nNumFormat;
}
-BOOL ScDPItemData::HasStringData() const
+BOOL ScDPItemData::HasStringData() const
-{
+{
return IsHasData()&&!IsHasErr()&&!IsValue();
}
BOOL ScDPItemData::IsDate() const
-{
- return !!(mbFlag&MK_DATE);
+{
+ return !!(mbFlag&MK_DATE);
}
BOOL ScDPItemData::HasDatePart() const
{
- return !!(mbFlag&MK_DATEPART);
+ return !!(mbFlag&MK_DATEPART);
}
-void ScDPItemData::SetDate( BOOL b )
+void ScDPItemData::SetDate( BOOL b )
{
- b ? ( mbFlag |= MK_DATE ) : ( mbFlag &= ~MK_DATE );
+ b ? ( mbFlag |= MK_DATE ) : ( mbFlag &= ~MK_DATE );
}
// -----------------------------------------------------------------------
@@ -378,12 +378,12 @@ BOOL ScDPTableDataCache::operator== ( const ScDPTableDataCache& r ) const
{
if ( *( GetDimMemberValues( i )[j] ) == *( r.GetDimMemberValues( i )[j] ) )
continue;
- else
+ else
return FALSE;
}
}
- else
- return FALSE;
+ else
+ return FALSE;
//check source table index
for ( SCROW k=0 ; k < GetRowCount(); k ++ )
{
@@ -391,7 +391,7 @@ BOOL ScDPTableDataCache::operator== ( const ScDPTableDataCache& r ) const
continue;
else
return FALSE;
- }
+ }
}
}
return TRUE;
@@ -418,7 +418,7 @@ ScDPTableDataCache::~ScDPTableDataCache()
for ( ULONG row = 0 ; row < mpTableDataValues[nCol].size(); row++ )
delete mpTableDataValues[nCol][row];
}
- for ( nCol =0; nCol < mrLabelNames.size(); nCol++ )
+ for ( nCol =0; nCol < mrLabelNames.size(); nCol++ )
delete mrLabelNames[nCol];
mnColumnCount = 0;
@@ -434,7 +434,7 @@ ScDPTableDataCache::~ScDPTableDataCache()
}
void ScDPTableDataCache::AddRow( ScDPItemData* pRow, USHORT nCount )
-{
+{
DBG_ASSERT( pRow , " empty pointer" );
if ( !mrLabelNames.size() )
{
@@ -461,10 +461,10 @@ bool ScDPTableDataCache::IsValid() const
namespace {
-/**
- * While the macro interpret level is incremented, the formula cells are
- * (semi-)guaranteed to be interpreted.
- */
+/**
+ * While the macro interpret level is incremented, the formula cells are
+ * (semi-)guaranteed to be interpreted.
+ */
class MacroInterpretIncrementer
{
public:
@@ -485,7 +485,7 @@ private:
bool ScDPTableDataCache::InitFromDoc( ScDocument* pDoc, const ScRange& rRange )
{
- // Make sure the formula cells within the data range are interpreted
+ // Make sure the formula cells within the data range are interpreted
// during this call, for this method may be called from the interpretation
// of GETPIVOTDATA, which disables nested formula interpretation without
// increasing the macro level.
@@ -496,8 +496,8 @@ bool ScDPTableDataCache::InitFromDoc( ScDocument* pDoc, const ScRange& rRange )
USHORT nStartCol = rRange.aStart.Col();
USHORT nEndCol = rRange.aEnd.Col();
USHORT nDocTab = rRange.aStart.Tab();
-
- //init
+
+ //init
long nOldColumCount = mnColumnCount;
mnColumnCount = nEndCol - nStartCol + 1;
if ( IsValid() )
@@ -514,7 +514,7 @@ bool ScDPTableDataCache::InitFromDoc( ScDocument* pDoc, const ScRange& rRange )
delete [] mpIndexOrder;
mrLabelNames.clear();
}
-
+
mpTableDataValues = new std::vector<ScDPItemData*>[ mnColumnCount ];
mpSourceData = new std::vector<SCROW>[ mnColumnCount ];
mpGlobalOrder = new std::vector<SCROW>[ mnColumnCount ];
@@ -611,7 +611,7 @@ ULONG ScDPTableDataCache::GetDimNumType( SCCOL nDim) const
return GetNumType(mpTableDataValues[nDim][0]->nNumFormat);
}
-bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOOL *pSpecial)
+bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOOL *pSpecial)
{ //Copied and modified from ScTable::ValidQuery
if (!rParam.GetEntry(0).bDoQuery)
return TRUE;
@@ -637,8 +637,8 @@ bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOO
{
ScQueryEntry& rEntry = rParam.GetEntry(i);
// we can only handle one single direct query
- SCROW nId = GetItemDataId( (SCCOL)rEntry.nField, nRow, FALSE );
- const ScDPItemData* pCellData = GetItemDataById( (SCCOL)rEntry.nField, nId);
+ SCROW nId = GetItemDataId( (SCCOL)rEntry.nField, nRow, FALSE );
+ const ScDPItemData* pCellData = GetItemDataById( (SCCOL)rEntry.nField, nId);
BOOL bOk = FALSE;
BOOL bTestEqual = FALSE;
@@ -835,10 +835,10 @@ BOOL ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData)
{
DBG_ASSERT( IsValid(), " IsValid() == false " );
DBG_ASSERT( nDim < mnColumnCount && nDim >=0 , "dimension out of bound" );
- SCROW nIndex = 0;
+ SCROW nIndex = 0;
BOOL bInserted = FALSE;
-
+
pitemData->SetDate( lcl_isDate( GetNumType( pitemData->nNumFormat ) ) );
if ( !lcl_Search( mpTableDataValues[nDim], mpGlobalOrder[nDim], *pitemData, nIndex ) )
@@ -860,7 +860,7 @@ BOOL ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData)
if ( pitemData->IsHasData() )
mbEmptyRow[ nCurRow ] = FALSE;
- if ( !bInserted )
+ if ( !bInserted )
delete pitemData;
return TRUE;
@@ -872,7 +872,7 @@ String ScDPTableDataCache::GetDimensionName( USHORT nColumn ) const
DBG_ASSERT( /* nColumn>=0 && */ nColumn < mrLabelNames.size()-1 , "ScDPTableDataCache::GetDimensionName");
DBG_ASSERT( mrLabelNames.size() == static_cast <USHORT> (mnColumnCount+1), "ScDPTableDataCache::GetDimensionName");
if ( static_cast<size_t>(nColumn+1) < mrLabelNames.size() )
- {
+ {
return mrLabelNames[nColumn+1]->aString;
}
else
@@ -880,11 +880,11 @@ String ScDPTableDataCache::GetDimensionName( USHORT nColumn ) const
}
void ScDPTableDataCache::AddLabel(ScDPItemData *pData)
-{
+{
DBG_ASSERT( IsValid(), " IsValid() == false " );
if ( mrLabelNames.size() == 0 )
- mrLabelNames.push_back( new ScDPItemData( ScGlobal::GetRscString(STR_PIVOT_DATA) ) );
+ mrLabelNames.push_back( new ScDPItemData( ScGlobal::GetRscString(STR_PIVOT_DATA) ) );
//reset name if needed
String strNewName = pData->aString;
@@ -907,7 +907,7 @@ void ScDPTableDataCache::AddLabel(ScDPItemData *pData)
while ( !bFound );
pData->aString = strNewName;
- mrLabelNames.push_back( pData );
+ mrLabelNames.push_back( pData );
}
SCROW ScDPTableDataCache::GetItemDataId(USHORT nDim, SCROW nRow, BOOL bRepeatIfEmpty) const
@@ -916,7 +916,7 @@ SCROW ScDPTableDataCache::GetItemDataId(USHORT nDim, SCROW nRow, BOOL bRepeatIfE
DBG_ASSERT( /* nDim >= 0 && */ nDim < mnColumnCount, "ScDPTableDataCache::GetItemDataId " );
if ( bRepeatIfEmpty )
- {
+ {
while ( nRow >0 && !mpTableDataValues[nDim][ mpSourceData[nDim][nRow] ]->IsHasData() )
--nRow;
}
@@ -954,7 +954,7 @@ SCROW ScDPTableDataCache::GetSortedItemDataId(SCCOL nDim, SCROW nOrder) const
DBG_ASSERT ( IsValid(), "IsValid");
DBG_ASSERT( nDim>=0 && nDim < mnColumnCount, "nDim < mnColumnCount");
DBG_ASSERT( nOrder >= 0 && (size_t) nOrder < mpGlobalOrder[nDim].size(), "nOrder < mpGlobalOrder[nDim].size()" );
-
+
return mpGlobalOrder[nDim][nOrder];
}
@@ -977,7 +977,7 @@ ULONG ScDPTableDataCache::GetNumberFormat( long nDim ) const
return mpTableDataValues[nDim][0]->nNumFormat;
}
-BOOL ScDPTableDataCache::IsDateDimension( long nDim ) const
+BOOL ScDPTableDataCache::IsDateDimension( long nDim ) const
{
if ( nDim >= mnColumnCount )
return false;
@@ -1011,7 +1011,7 @@ SCCOL ScDPTableDataCache::GetDimensionIndex(String sName) const
}
SCROW ScDPTableDataCache::GetIdByItemData(long nDim, String sItemData ) const
-{
+{
if ( nDim < mnColumnCount && nDim >=0 )
{
for ( size_t n = 0; n< mpTableDataValues[nDim].size(); n++ )
@@ -1020,13 +1020,13 @@ SCROW ScDPTableDataCache::GetIdByItemData(long nDim, String sItemData ) const
return n;
}
}
-
+
ScDPItemData rData ( sItemData );
return GetRowCount() +maAdditionalDatas.getDataId(rData);
}
SCROW ScDPTableDataCache::GetIdByItemData( long nDim, const ScDPItemData& rData ) const
-{
+{
if ( nDim < mnColumnCount && nDim >=0 )
{
for ( size_t n = 0; n< mpTableDataValues[nDim].size(); n++ )
@@ -1048,7 +1048,7 @@ SCROW ScDPTableDataCache::GetAdditionalItemID( const ScDPItemData& rData )
{
return GetRowCount() + maAdditionalDatas.insertData( rData );
}
-
+
SCROW ScDPTableDataCache::GetOrder(long nDim, SCROW nIndex) const
{
@@ -1072,18 +1072,18 @@ SCROW ScDPTableDataCache::GetOrder(long nDim, SCROW nIndex) const
ScDocument* ScDPTableDataCache::GetDoc() const
{
- return mpDoc;
+ return mpDoc;
};
-long ScDPTableDataCache::GetColumnCount() const
+long ScDPTableDataCache::GetColumnCount() const
{
- return mnColumnCount;
+ return mnColumnCount;
}
-long ScDPTableDataCache::GetId() const
+long ScDPTableDataCache::GetId() const
{
- return mnID;
+ return mnID;
}
-
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit c2e1d9ca9e9cf058348024e85755e424f19e6b55
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Nov 12 15:57:16 2010 -0500
Removed more useless comments, fixed indentations etc.
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx
index 4c2e417..5b85a59 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -160,11 +160,11 @@ ScDPCacheTable::Criterion::Criterion() :
// ----------------------------------------------------------------------------
-ScDPCacheTable::ScDPCacheTable( ScDocument* pDoc,long nId ) :
+ScDPCacheTable::ScDPCacheTable( ScDocument* pDoc, long nId ) :
mpCache( NULL ),
mpNoneCache( NULL )
{
- if ( nId >= 0 )
+ if ( nId >= 0 )
mpCache = pDoc->GetDPObjectCache( nId );
else
{ //create a temp cache object
@@ -201,7 +201,6 @@ void ScDPCacheTable::fillTable( const ScQueryParam& rQuery, BOOL* pSpecial,
maRowsVisible.clear();
maRowsVisible.reserve(nRowCount);
-
// Initialize field entries container.
maFieldEntries.clear();
maFieldEntries.reserve(nColCount);
diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx
index af0d101..cdddb74 100644
--- a/sc/source/core/data/dptablecache.cxx
+++ b/sc/source/core/data/dptablecache.cxx
@@ -29,8 +29,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
- // MARKER(update_precomp.py): autogen include statement, do not remove
+// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
+
// INCLUDE ---------------------------------------------------------------
#include "dptablecache.hxx"
#include "document.hxx"
@@ -41,8 +42,8 @@
#include "queryparam.hxx"
#include "dpglobal.hxx"
-#include "docoptio.hxx" //for ValidQuery
-#include <unotools/textsearch.hxx> //for ValidQuery
+#include "docoptio.hxx"
+#include <unotools/textsearch.hxx>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -57,61 +58,59 @@ using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
-// -----------------------------------------------------------------------
-namespace
+
+namespace {
+
+BOOL lcl_isDate( ULONG nNumType )
{
- BOOL lcl_isDate( ULONG nNumType )
- {
- return ( (nNumType & NUMBERFORMAT_DATE) != 0 )? 1:0 ;
- }
+ return ( (nNumType & NUMBERFORMAT_DATE) != 0 )? 1:0 ;
+}
- BOOL lcl_Search( const std::vector<ScDPItemData*>& list, const ::std::vector<SCROW>& rOrder, const ScDPItemData& item, SCROW& rIndex)
+BOOL lcl_Search( const std::vector<ScDPItemData*>& list, const ::std::vector<SCROW>& rOrder, const ScDPItemData& item, SCROW& rIndex)
+{
+ rIndex = list.size();
+ BOOL bFound = FALSE;
+ SCROW nLo = 0;
+ SCROW nHi = list.size() - 1;
+ SCROW nIndex;
+ long nCompare;
+ while (nLo <= nHi)
{
- rIndex = list.size();
- BOOL bFound = FALSE;
- SCROW nLo = 0;
- SCROW nHi = list.size() - 1;
- SCROW nIndex;
- long nCompare;
- while (nLo <= nHi)
+ nIndex = (nLo + nHi) / 2;
+ nCompare = ScDPItemData::Compare( *list[rOrder[nIndex]], item );
+ if (nCompare < 0)
+ nLo = nIndex + 1;
+ else
{
- nIndex = (nLo + nHi) / 2;
- nCompare = ScDPItemData::Compare( *list[rOrder[nIndex]], item );
- if (nCompare < 0)
- nLo = nIndex + 1;
- else
+ nHi = nIndex - 1;
+ if (nCompare == 0)
{
- nHi = nIndex - 1;
- if (nCompare == 0)
- {
- bFound = TRUE;
- nLo = nIndex;
- }
+ bFound = TRUE;
+ nLo = nIndex;
}
}
- rIndex = nLo;
- return bFound;
}
-
- ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nType, long nCol,
- const Date& rNullDate )
+ rIndex = nLo;
+ return bFound;
+}
+
+ScDPItemData* lcl_GetItemValue(const Reference<sdbc::XRow>& xRow, sal_Int32 nType, long nCol,
+ const Date& rNullDate )
+{
+ short nNumType = NUMBERFORMAT_NUMBER;
+ try
{
- short nNumType = NUMBERFORMAT_NUMBER;
- try
+ String rStr = xRow->getString(nCol);
+ double fValue = 0.0;
+ switch (nType)
{
- String rStr = xRow->getString(nCol);
- double fValue = 0.0;
- switch (nType)
- {
case sdbc::DataType::BIT:
case sdbc::DataType::BOOLEAN:
- {
- nNumType = NUMBERFORMAT_LOGICAL;
- fValue = xRow->getBoolean(nCol) ? 1 : 0;
- return new ScDPItemData( rStr, fValue,TRUE,nNumType);
- }
- //break;
-
+ {
+ nNumType = NUMBERFORMAT_LOGICAL;
+ fValue = xRow->getBoolean(nCol) ? 1 : 0;
+ return new ScDPItemData( rStr, fValue,TRUE,nNumType);
+ }
case sdbc::DataType::TINYINT:
case sdbc::DataType::SMALLINT:
case sdbc::DataType::INTEGER:
@@ -121,45 +120,38 @@ namespace
case sdbc::DataType::DOUBLE:
case sdbc::DataType::NUMERIC:
case sdbc::DataType::DECIMAL:
- {
- //! do the conversion here?
- fValue = xRow->getDouble(nCol);
- return new ScDPItemData( rStr, fValue,TRUE);
- }
- //break;
-
+ {
+ //! do the conversion here?
+ fValue = xRow->getDouble(nCol);
+ return new ScDPItemData( rStr, fValue,TRUE);
+ }
case sdbc::DataType::DATE:
- {
- nNumType = NUMBERFORMAT_DATE;
-
- util::Date aDate = xRow->getDate(nCol);
- fValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate;
- return new ScDPItemData( rStr, fValue, TRUE, nNumType );
- }
- //break;
+ {
+ nNumType = NUMBERFORMAT_DATE;
+ util::Date aDate = xRow->getDate(nCol);
+ fValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate;
+ return new ScDPItemData( rStr, fValue, TRUE, nNumType );
+ }
case sdbc::DataType::TIME:
- {
- nNumType = NUMBERFORMAT_TIME;
-
- util::Time aTime = xRow->getTime(nCol);
- fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 +
- aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
- return new ScDPItemData( rStr,fValue, TRUE, nNumType );
- }
- //break;
+ {
+ nNumType = NUMBERFORMAT_TIME;
+ util::Time aTime = xRow->getTime(nCol);
+ fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 +
+ aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
+ return new ScDPItemData( rStr,fValue, TRUE, nNumType );
+ }
case sdbc::DataType::TIMESTAMP:
- {
- nNumType = NUMBERFORMAT_DATETIME;
+ {
+ nNumType = NUMBERFORMAT_DATETIME;
- util::DateTime aStamp = xRow->getTimestamp(nCol);
- fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - rNullDate ) +
- ( aStamp.Hours * 3600 + aStamp.Minutes * 60 +
- aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
- return new ScDPItemData( rStr,fValue, TRUE, nNumType );
- }
- //break;
+ util::DateTime aStamp = xRow->getTimestamp(nCol);
+ fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - rNullDate ) +
+ ( aStamp.Hours * 3600 + aStamp.Minutes * 60 +
+ aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
+ return new ScDPItemData( rStr,fValue, TRUE, nNumType );
+ }
case sdbc::DataType::CHAR:
case sdbc::DataType::VARCHAR:
case sdbc::DataType::LONGVARCHAR:
@@ -169,29 +161,25 @@ namespace
case sdbc::DataType::LONGVARBINARY:
default:
return new ScDPItemData ( rStr );
- //break;
- }
- }
- catch (uno::Exception&)
- {
}
- catch ( ... )
- {
-
- }
- return NULL;
}
+ catch (uno::Exception&)
+ {
+ }
+
+ return NULL;
+}
+
}
-// Wang Xu Ming -- 12/23/2008
-//Refactor cache data
+
ScDPItemData::ScDPItemData( const String& rS, double fV/* = 0.0*/, BOOL bHV/* = FALSE*/, const ULONG nNumFormatP /*= 0*/ , BOOL bData/* = TRUE*/) :
-nNumFormat( nNumFormatP ), aString(rS), fValue(fV),
-mbFlag( (MK_VAL*!!bHV) | (MK_DATA*!!bData) | (MK_ERR*!!FALSE) | (MK_DATE*!!lcl_isDate( nNumFormat ) ) )
+ nNumFormat( nNumFormatP ), aString(rS), fValue(fV),
+ mbFlag( (MK_VAL*!!bHV) | (MK_DATA*!!bData) | (MK_ERR*!!FALSE) | (MK_DATE*!!lcl_isDate( nNumFormat ) ) )
{
}
-ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nDocTab ):
- nNumFormat( 0 ), fValue(0.0), mbFlag( 0 )
+ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nDocTab ) :
+ nNumFormat( 0 ), fValue(0.0), mbFlag( 0 )
{
String aDocStr;
pDoc->GetString( nCol, nRow, nDocTab, aDocStr );
@@ -202,8 +190,7 @@ ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nD
ScBaseCell* pCell = pDoc->GetCell( aPos );
if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell)->GetErrCode() )
- SetString ( aDocStr ); //[SODC_19347] add liyi
- //bErr = TRUE; //[SODC_19347] del liyi
+ SetString ( aDocStr );
else if ( pDoc->HasValueData( nCol, nRow, nDocTab ) )
{
double fVal = pDoc->GetValue(ScAddress(nCol, nRow, nDocTab));
@@ -219,10 +206,9 @@ ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nD
else if ( pDoc->HasData( nCol,nRow, nDocTab ) )
SetString ( aDocStr );
}
-// End Comments
BOOL ScDPItemData::IsCaseInsEqual( const ScDPItemData& r ) const
-{ //TODO: indified Date?
+{
//! pass Transliteration?
//! inline?
return IsValue() ? ( r.IsValue() && rtl::math::approxEqual( fValue, r.fValue ) ) :
@@ -247,17 +233,12 @@ BOOL ScDPItemData::operator==( const ScDPItemData& r ) const
if( (HasDatePart() != r.HasDatePart()) || (HasDatePart() && mnDatePart != r.mnDatePart) )
return FALSE;
-// Wang Xu Ming -- 1/9/2009
-// Add Data Cache Support.
-// Identify date
if ( IsDate() != r.IsDate() )
return FALSE;
- else
- if ( r.IsValue() )
+ else if ( r.IsValue() )
return rtl::math::approxEqual( fValue, r.fValue );
else
return FALSE;
-// End Comments
}
else if ( r.IsValue() )
return FALSE;
@@ -275,14 +256,10 @@ sal_Int32 ScDPItemData::Compare( const ScDPItemData& rA,
{
if ( rtl::math::approxEqual( rA.fValue, rB.fValue ) )
{
-// Wang Xu Ming -- 1/9/2009
-// Add Data Cache Support.
-// Date > number
if ( rA.IsDate() == rB.IsDate() )
return 0;
else
return rA.IsDate() ? 1: -1;
-// End Comments
}
else if ( rA.fValue < rB.fValue )
return -1;
@@ -297,8 +274,7 @@ sal_Int32 ScDPItemData::Compare( const ScDPItemData& rA,
else
return ScGlobal::GetCollator()->compareString( rA.aString, rB.aString );
}
-//
-//Wang Xu Ming SODC_17561
+
#ifdef DEBUG
void ScDPItemData::dump() const
{
@@ -308,7 +284,6 @@ void ScDPItemData::dump() const
DBG_TRACE1( "mbFlag= %d", mbFlag);
}
#endif
-//End
TypedStrData* ScDPItemData::CreateTypeString( )
{
@@ -423,12 +398,12 @@ BOOL ScDPTableDataCache::operator== ( const ScDPTableDataCache& r ) const
}
ScDPTableDataCache::ScDPTableDataCache( ScDocument* pDoc ) :
-mpDoc( pDoc ),
-mnColumnCount ( 0 ),
-mpTableDataValues ( NULL ),
-mpSourceData ( NULL ),
-mpGlobalOrder( NULL ),
-mpIndexOrder( NULL)
+ mpDoc( pDoc ),
+ mnColumnCount ( 0 ),
+ mpTableDataValues ( NULL ),
+ mpSourceData ( NULL ),
+ mpGlobalOrder( NULL ),
+ mpIndexOrder( NULL)
{
mnID = -1;
}
@@ -437,8 +412,6 @@ ScDPTableDataCache::~ScDPTableDataCache()
{
if ( IsValid() )
{
-// Wang Xu Ming -- 2/17/2009
-// Performance issue
USHORT nCol;
for ( nCol=0; nCol < GetColumnCount() ; nCol++ )
{
@@ -446,8 +419,7 @@ ScDPTableDataCache::~ScDPTableDataCache()
delete mpTableDataValues[nCol][row];
}
for ( nCol =0; nCol < mrLabelNames.size(); nCol++ )
- delete mrLabelNames[nCol];
-// End Comments
+ delete mrLabelNames[nCol];
mnColumnCount = 0;
delete [] mpTableDataValues;
@@ -461,7 +433,6 @@ ScDPTableDataCache::~ScDPTableDataCache()
}
}
-// -----------------------------------------------------------------------
void ScDPTableDataCache::AddRow( ScDPItemData* pRow, USHORT nCount )
{
DBG_ASSERT( pRow , " empty pointer" );
@@ -483,14 +454,11 @@ void ScDPTableDataCache::AddRow( ScDPItemData* pRow, USHORT nCount )
}
}
-// -----------------------------------------------------------------------
bool ScDPTableDataCache::IsValid() const
-{ //TODO: continue check valid
+{
return mpTableDataValues!=NULL && mpSourceData!= NULL && mnColumnCount>0;
}
-// -----------------------------------------------------------------------
-
namespace {
/**
@@ -515,7 +483,6 @@ private:
}
-// -----------------------------------------------------------------------
bool ScDPTableDataCache::InitFromDoc( ScDocument* pDoc, const ScRange& rRange )
{
// Make sure the formula cells within the data range are interpreted
@@ -524,7 +491,6 @@ bool ScDPTableDataCache::InitFromDoc( ScDocument* pDoc, const ScRange& rRange )
// increasing the macro level.
MacroInterpretIncrementer aMacroInc(pDoc);
- //
SCROW nStartRow = rRange.aStart.Row(); // start of data
SCROW nEndRow = rRange.aEnd.Row();
USHORT nStartCol = rRange.aStart.Col();
@@ -567,10 +533,9 @@ bool ScDPTableDataCache::InitFromDoc( ScDocument* pDoc, const ScRange& rRange )
return TRUE;
}
-// -----------------------------------------------------------------------
bool ScDPTableDataCache::InitFromDataBase (const Reference<sdbc::XRowSet>& xRowSet, const Date& rNullDate)
{
- if (!xRowSet.is())
+ if (!xRowSet.is())
// Dont' even waste time to go any further.
return false;
try
@@ -580,62 +545,62 @@ bool ScDPTableDataCache::InitFromDataBase (const Reference<sdbc::XRowSet>& xRowS
if (!xMeta.is())
return false;
- long nOldColumCount = mnColumnCount;
- mnColumnCount = xMeta->getColumnCount();
- if ( IsValid() )
- {
- for ( USHORT nCol=0; nCol < nOldColumCount ; nCol++ )
+ long nOldColumCount = mnColumnCount;
+ mnColumnCount = xMeta->getColumnCount();
+ if (IsValid())
{
- for ( ULONG row = 0 ; row < mpTableDataValues[nCol].size(); row++ )
- delete mpTableDataValues[nCol][row];
- delete mrLabelNames[nCol];
+ for (USHORT nCol=0; nCol < nOldColumCount ; nCol++)
+ {
+ for (ULONG row = 0 ; row < mpTableDataValues[nCol].size(); row++)
+ delete mpTableDataValues[nCol][row];
+ delete mrLabelNames[nCol];
+ }
+ delete [] mpTableDataValues;
+ delete [] mpSourceData;
+ delete [] mpGlobalOrder;
+ delete [] mpIndexOrder;
+ mrLabelNames.clear();
}
- delete [] mpTableDataValues;
- delete [] mpSourceData;
- delete [] mpGlobalOrder;
- delete [] mpIndexOrder;
- mrLabelNames.clear();
- }
// Get column titles and types.
- mrLabelNames.reserve(mnColumnCount);
- mpTableDataValues = new std::vector<ScDPItemData*>[ mnColumnCount ];
- mpSourceData = new std::vector<SCROW>[ mnColumnCount ];
- mpGlobalOrder = new std::vector<SCROW>[ mnColumnCount ];
- mpIndexOrder = new std::vector<SCROW>[ mnColumnCount ];
+ mrLabelNames.reserve(mnColumnCount);
+ mpTableDataValues = new std::vector<ScDPItemData*>[ mnColumnCount ];
+ mpSourceData = new std::vector<SCROW>[ mnColumnCount ];
+ mpGlobalOrder = new std::vector<SCROW>[ mnColumnCount ];
+ mpIndexOrder = new std::vector<SCROW>[ mnColumnCount ];
- std::vector<sal_Int32> aColTypes(mnColumnCount);
+ std::vector<sal_Int32> aColTypes(mnColumnCount);
for (sal_Int32 nCol = 0; nCol < mnColumnCount; ++nCol)
{
String aColTitle = xMeta->getColumnLabel(nCol+1);
aColTypes[nCol] = xMeta->getColumnType(nCol+1);
- AddLabel( new ScDPItemData( aColTitle) );
+ AddLabel( new ScDPItemData( aColTitle) );
}
// Now get the data rows.
Reference<sdbc::XRow> xRow(xRowSet, UNO_QUERY_THROW);
xRowSet->first();
do
- {
+ {
for (sal_Int32 nCol = 0; nCol < mnColumnCount; ++nCol)
{
- ScDPItemData * pNew = lcl_GetItemValue( xRow, aColTypes[nCol], nCol+1, rNullDate );
- if ( pNew )
- AddData( nCol , pNew );
+ ScDPItemData * pNew = lcl_GetItemValue( xRow, aColTypes[nCol], nCol+1, rNullDate );
+ if (pNew)
+ AddData(nCol , pNew);
}
}
while (xRowSet->next());
- xRowSet->beforeFirst();
+ xRowSet->beforeFirst();
- return true;
+ return true;
}
catch (const Exception&)
{
return false;
}
}
-// -----------------------------------------------------------------------
+
ULONG ScDPTableDataCache::GetDimNumType( SCCOL nDim) const
{
DBG_ASSERT( IsValid(), " IsValid() == false " );
@@ -646,225 +611,221 @@ ULONG ScDPTableDataCache::GetDimNumType( SCCOL nDim) const
return GetNumType(mpTableDataValues[nDim][0]->nNumFormat);
}
-// -----------------------------------------------------------------------
bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOOL *pSpecial)
{ //Copied and modified from ScTable::ValidQuery
- if (!rParam.GetEntry(0).bDoQuery)
- return TRUE;
- BOOL bMatchWholeCell = mpDoc->GetDocOptions().IsMatchWholeCell();
-
- //---------------------------------------------------------------
-
- const SCSIZE nFixedBools = 32;
- BOOL aBool[nFixedBools];
- BOOL aTest[nFixedBools];
- SCSIZE nEntryCount = rParam.GetEntryCount();
- BOOL* pPasst = ( nEntryCount <= nFixedBools ? &aBool[0] : new BOOL[nEntryCount] );
- BOOL* pTest = ( nEntryCount <= nFixedBools ? &aTest[0] : new BOOL[nEntryCount] );
-
- long nPos = -1;
- SCSIZE i = 0;
- CollatorWrapper* pCollator = (rParam.bCaseSens ? ScGlobal::GetCaseCollator() :
- ScGlobal::GetCollator() );
- ::utl::TransliterationWrapper* pTransliteration = (rParam.bCaseSens ?
- ScGlobal::GetCaseTransliteration() : ScGlobal::GetpTransliteration());
-
- while ( (i < nEntryCount) && rParam.GetEntry(i).bDoQuery )
- {
- ScQueryEntry& rEntry = rParam.GetEntry(i);
- // we can only handle one single direct query
- SCROW nId = GetItemDataId( (SCCOL)rEntry.nField, nRow, FALSE );
- const ScDPItemData* pCellData = GetItemDataById( (SCCOL)rEntry.nField, nId);
+ if (!rParam.GetEntry(0).bDoQuery)
+ return TRUE;
+ BOOL bMatchWholeCell = mpDoc->GetDocOptions().IsMatchWholeCell();
+
+ //---------------------------------------------------------------
+
+ const SCSIZE nFixedBools = 32;
+ BOOL aBool[nFixedBools];
+ BOOL aTest[nFixedBools];
+ SCSIZE nEntryCount = rParam.GetEntryCount();
+ BOOL* pPasst = ( nEntryCount <= nFixedBools ? &aBool[0] : new BOOL[nEntryCount] );
+ BOOL* pTest = ( nEntryCount <= nFixedBools ? &aTest[0] : new BOOL[nEntryCount] );
+
+ long nPos = -1;
+ SCSIZE i = 0;
+ CollatorWrapper* pCollator = (rParam.bCaseSens ? ScGlobal::GetCaseCollator() :
+ ScGlobal::GetCollator() );
+ ::utl::TransliterationWrapper* pTransliteration = (rParam.bCaseSens ?
+ ScGlobal::GetCaseTransliteration() : ScGlobal::GetpTransliteration());
+
+ while ((i < nEntryCount) && rParam.GetEntry(i).bDoQuery)
+ {
+ ScQueryEntry& rEntry = rParam.GetEntry(i);
+ // we can only handle one single direct query
+ SCROW nId = GetItemDataId( (SCCOL)rEntry.nField, nRow, FALSE );
+ const ScDPItemData* pCellData = GetItemDataById( (SCCOL)rEntry.nField, nId);
+
+ BOOL bOk = FALSE;
+ BOOL bTestEqual = FALSE;
- BOOL bOk = FALSE;
- BOOL bTestEqual = FALSE;
+ if (pSpecial && pSpecial[i])
+ {
+ if (rEntry.nVal == SC_EMPTYFIELDS)
+ bOk = ! pCellData->IsHasData();
+ else // if (rEntry.nVal == SC_NONEMPTYFIELDS)
+ bOk = pCellData->IsHasData();
+ }
+ else if (!rEntry.bQueryByString && pCellData->IsValue())
+ { // by Value
+ double nCellVal = pCellData->GetValue();
- if ( pSpecial && pSpecial[i] )
+ switch (rEntry.eOp)
{
- if (rEntry.nVal == SC_EMPTYFIELDS)
- bOk = ! pCellData->IsHasData();
- else // if (rEntry.nVal == SC_NONEMPTYFIELDS)
- bOk = pCellData->IsHasData();
+ case SC_EQUAL :
+ bOk = ::rtl::math::approxEqual( nCellVal, rEntry.nVal );
+ break;
+ case SC_LESS :
+ bOk = (nCellVal < rEntry.nVal) && !::rtl::math::approxEqual( nCellVal, rEntry.nVal );
+ break;
+ case SC_GREATER :
+ bOk = (nCellVal > rEntry.nVal) && !::rtl::math::approxEqual( nCellVal, rEntry.nVal );
+ break;
+ case SC_LESS_EQUAL :
+ bOk = (nCellVal < rEntry.nVal) || ::rtl::math::approxEqual( nCellVal, rEntry.nVal );
+ break;
+ case SC_GREATER_EQUAL :
+ bOk = (nCellVal > rEntry.nVal) || ::rtl::math::approxEqual( nCellVal, rEntry.nVal );
+ break;
+ case SC_NOT_EQUAL :
+ bOk = !::rtl::math::approxEqual( nCellVal, rEntry.nVal );
+ break;
+ default:
+ bOk= FALSE;
+ break;
}
- else if ( !rEntry.bQueryByString && pCellData->IsValue() )
- { // by Value
- double nCellVal = pCellData->GetValue();
-
- switch (rEntry.eOp)
- {
- case SC_EQUAL :
- bOk = ::rtl::math::approxEqual( nCellVal, rEntry.nVal );
- break;
- case SC_LESS :
- bOk = (nCellVal < rEntry.nVal) && !::rtl::math::approxEqual( nCellVal, rEntry.nVal );
- break;
- case SC_GREATER :
- bOk = (nCellVal > rEntry.nVal) && !::rtl::math::approxEqual( nCellVal, rEntry.nVal );
- break;
- case SC_LESS_EQUAL :
- bOk = (nCellVal < rEntry.nVal) || ::rtl::math::approxEqual( nCellVal, rEntry.nVal );
- break;
- case SC_GREATER_EQUAL :
- bOk = (nCellVal > rEntry.nVal) || ::rtl::math::approxEqual( nCellVal, rEntry.nVal );
- break;
- case SC_NOT_EQUAL :
- bOk = !::rtl::math::approxEqual( nCellVal, rEntry.nVal );
- break;
- default:
- bOk= FALSE;
- break;
- }
- }
- else if ( (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL)
- || (rEntry.bQueryByString
- && pCellData->HasStringData() )
+ }
+ else if ((rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL)
+ || (rEntry.bQueryByString
+ && pCellData->HasStringData() )
)
- { // by String
- String aCellStr = pCellData->GetString();
+ { // by String
+ String aCellStr = pCellData->GetString();
- BOOL bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL)
- || (rEntry.eOp == SC_NOT_EQUAL)));
- BOOL bTestRegExp = FALSE;
- if ( bRealRegExp || bTestRegExp )
- {
- xub_StrLen nStart = 0;
- xub_StrLen nEnd = aCellStr.Len();
- BOOL bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens )
- ->SearchFrwrd( aCellStr, &nStart, &nEnd );
- // from 614 on, nEnd is behind the found text
- if ( bMatch && bMatchWholeCell
- && (nStart != 0 || nEnd != aCellStr.Len()) )
- bMatch = FALSE; // RegExp must match entire cell string
- if ( bRealRegExp )
- bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch);
- else
- bTestEqual = bMatch;
- }
- if ( !bRealRegExp )
+ BOOL bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL)
+ || (rEntry.eOp == SC_NOT_EQUAL)));
+ BOOL bTestRegExp = FALSE;
+ if (bRealRegExp || bTestRegExp)
+ {
+ xub_StrLen nStart = 0;
+ xub_StrLen nEnd = aCellStr.Len();
+ BOOL bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens )
+ ->SearchFrwrd( aCellStr, &nStart, &nEnd );
+ // from 614 on, nEnd is behind the found text
+ if (bMatch && bMatchWholeCell
+ && (nStart != 0 || nEnd != aCellStr.Len()))
+ bMatch = FALSE; // RegExp must match entire cell string
+ if (bRealRegExp)
+ bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch);
+ else
+ bTestEqual = bMatch;
+ }
+ if (!bRealRegExp)
+ {
+ if (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL)
{
- if ( rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL )
+ if (bMatchWholeCell)
{
- if ( bMatchWholeCell )
+ bOk = pTransliteration->isEqual( aCellStr, *rEntry.pStr );
+ //Added by zhaosz,for sodc_2702,20060808
+ String aStr = *rEntry.pStr;//"f*"
+ //modified by weihuaw,for SODC_16698
+ //use another way to find "*" in aStr
+ sal_Bool bHasStar = sal_False;
+ xub_StrLen nIndex;
+ if (( nIndex = aStr.Search('*') ) != STRING_NOTFOUND)
+ bHasStar = sal_True;
+ if (bHasStar && (nIndex>0))
{
- bOk = pTransliteration->isEqual( aCellStr, *rEntry.pStr );
- //Added by zhaosz,for sodc_2702,20060808
- String aStr = *rEntry.pStr;//"f*"
- //modified by weihuaw,for SODC_16698
- //use another way to find "*" in aStr
- sal_Bool bHasStar = sal_False;
- xub_StrLen nIndex;
- if( ( nIndex = aStr.Search('*') ) != STRING_NOTFOUND )
- bHasStar = sal_True;
- if(bHasStar && (nIndex>0))
+ for (i=0;(i<nIndex) && (i< aCellStr.Len()) ; i++)
{
- for(i=0;(i<nIndex) && (i< aCellStr.Len()) ; i++)
+ if (aCellStr.GetChar( (USHORT)i ) == aStr.GetChar((USHORT) i ))
{
- if(aCellStr.GetChar( (USHORT)i ) == aStr.GetChar((USHORT) i ))
- {
- bOk=1;
- }
- else
- {
- bOk=0;
- break;
- }
+ bOk=1;
+ }
+ else
+ {
+ bOk=0;
+ break;
}
}
- //end modified
- //Added end,20060808
- }
- else
- {
- ::com::sun::star::uno::Sequence< sal_Int32 > xOff;
- String aCell( pTransliteration->transliterate(
- aCellStr, ScGlobal::eLnge, 0, aCellStr.Len(),
- &xOff ) );
- String aQuer( pTransliteration->transliterate(
- *rEntry.pStr, ScGlobal::eLnge, 0, rEntry.pStr->Len(),
- &xOff ) );
- bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND);
}
- if ( rEntry.eOp == SC_NOT_EQUAL )
- bOk = !bOk;
+ //end modified
+ //Added end,20060808
}
else
- { // use collator here because data was probably sorted
- sal_Int32 nCompare = pCollator->compareString(
- aCellStr, *rEntry.pStr );
- switch (rEntry.eOp)
- {
- case SC_LESS :
- bOk = (nCompare < 0);
- break;
- case SC_GREATER :
- bOk = (nCompare > 0);
- break;
- case SC_LESS_EQUAL :
- bOk = (nCompare <= 0);
- break;
- case SC_GREATER_EQUAL :
- bOk = (nCompare >= 0);
- break;
- case SC_NOT_EQUAL:
- DBG_ASSERT( false , "SC_NOT_EQUAL");
- break;
- case SC_TOPVAL:
- case SC_BOTVAL:
- case SC_TOPPERC:
- case SC_BOTPERC:
- default:
- break;
- }
+ {
+ ::com::sun::star::uno::Sequence< sal_Int32 > xOff;
+ String aCell( pTransliteration->transliterate(
+ aCellStr, ScGlobal::eLnge, 0, aCellStr.Len(),
+ &xOff ) );
+ String aQuer( pTransliteration->transliterate(
+ *rEntry.pStr, ScGlobal::eLnge, 0, rEntry.pStr->Len(),
+ &xOff ) );
+ bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND);
+ }
+ if (rEntry.eOp == SC_NOT_EQUAL)
+ bOk = !bOk;
+ }
+ else
+ { // use collator here because data was probably sorted
+ sal_Int32 nCompare = pCollator->compareString(
+ aCellStr, *rEntry.pStr );
+ switch (rEntry.eOp)
+ {
+ case SC_LESS :
+ bOk = (nCompare < 0);
+ break;
+ case SC_GREATER :
+ bOk = (nCompare > 0);
+ break;
+ case SC_LESS_EQUAL :
+ bOk = (nCompare <= 0);
+ break;
+ case SC_GREATER_EQUAL :
+ bOk = (nCompare >= 0);
+ break;
+ case SC_NOT_EQUAL:
+ DBG_ASSERT( false , "SC_NOT_EQUAL");
+ break;
+ case SC_TOPVAL:
+ case SC_BOTVAL:
+ case SC_TOPPERC:
+ case SC_BOTPERC:
+ default:
+ break;
}
}
}
+ }
- if (nPos == -1)
+ if (nPos == -1)
+ {
+ nPos++;
+ pPasst[nPos] = bOk;
+ pTest[nPos] = bTestEqual;
+ }
+ else
+ {
+ if (rEntry.eConnect == SC_AND)
{
- nPos++;
- pPasst[nPos] = bOk;
- pTest[nPos] = bTestEqual;
+ pPasst[nPos] = pPasst[nPos] && bOk;
+ pTest[nPos] = pTest[nPos] && bTestEqual;
}
else
{
- if (rEntry.eConnect == SC_AND)
- {
- pPasst[nPos] = pPasst[nPos] && bOk;
- pTest[nPos] = pTest[nPos] && bTestEqual;
- }
- else
- {
- nPos++;
- pPasst[nPos] = bOk;
- pTest[nPos] = bTestEqual;
- }
+ nPos++;
+ pPasst[nPos] = bOk;
+ pTest[nPos] = bTestEqual;
}
- i++;
}
+ i++;
+ }
- for ( long j=1; j <= nPos; j++ )
- {
- pPasst[0] = pPasst[0] || pPasst[j];
- pTest[0] = pTest[0] || pTest[j];
- }
+ for (long j=1; j <= nPos; j++)
+ {
+ pPasst[0] = pPasst[0] || pPasst[j];
+ pTest[0] = pTest[0] || pTest[j];
+ }
- BOOL bRet = pPasst[0];
- if ( pPasst != &aBool[0] )
- delete [] pPasst;
- if ( pTest != &aTest[0] )
- delete [] pTest;
+ BOOL bRet = pPasst[0];
+ if (pPasst != &aBool[0])
+ delete [] pPasst;
+ if (pTest != &aTest[0])
+ delete [] pTest;
- return bRet;
+ return bRet;
}
-// -----------------------------------------------------------------------
bool ScDPTableDataCache::IsRowEmpty( SCROW nRow ) const
{
return mbEmptyRow[ nRow ];
-
}
-// -----------------------------------------------------------------------
bool ScDPTableDataCache::IsEmptyMember( SCROW nRow, USHORT nColumn ) const
{
return !GetItemDataById( nColumn, GetItemDataId( nColumn, nRow, FALSE ) )->IsHasData();
@@ -925,7 +886,6 @@ void ScDPTableDataCache::AddLabel(ScDPItemData *pData)
if ( mrLabelNames.size() == 0 )
mrLabelNames.push_back( new ScDPItemData( ScGlobal::GetRscString(STR_PIVOT_DATA) ) );
-
//reset name if needed
String strNewName = pData->aString;
BOOL bFound = FALSE;
@@ -951,7 +911,7 @@ void ScDPTableDataCache::AddLabel(ScDPItemData *pData)
}
SCROW ScDPTableDataCache::GetItemDataId(USHORT nDim, SCROW nRow, BOOL bRepeatIfEmpty) const
-{ //
+{
DBG_ASSERT( IsValid(), " IsValid() == false " );
DBG_ASSERT( /* nDim >= 0 && */ nDim < mnColumnCount, "ScDPTableDataCache::GetItemDataId " );
@@ -1042,7 +1002,7 @@ const ScDPItemData* ScDPTableDataCache::GetSortedItemData(SCCOL nDim, SCROW nOrd
SCCOL ScDPTableDataCache::GetDimensionIndex(String sName) const
{
- for ( size_t n = 1; n < mrLabelNames.size(); n ++ ) //defects, label name map wrong SODC_17590, SODC_18932,SODC_18827,SODC_18960,SODC_18923
+ for ( size_t n = 1; n < mrLabelNames.size(); n ++ )
{
if ( mrLabelNames[n]->GetString() == sName )
return (SCCOL)(n-1);
@@ -1119,6 +1079,7 @@ long ScDPTableDataCache::GetColumnCount() const
{
return mnColumnCount;
}
+
long ScDPTableDataCache::GetId() const
{
return mnID;
commit 53f024bbc23778c5f19fc968b0537f1a40c3a1dc
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Nov 12 15:34:51 2010 -0500
More formatting & indentation fix.
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx
index 57c2ef2..4c2e417 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -80,6 +80,7 @@ ScDPCacheTable::FilterItem::FilterItem() :
mbHasValue(false)
{
}
+
bool ScDPCacheTable::FilterItem::match( const ScDPItemData& rCellData ) const
{
if (rCellData.GetString()!= maString &&
@@ -87,6 +88,7 @@ bool ScDPCacheTable::FilterItem::match( const ScDPItemData& rCellData ) const
return false;
return true;
}
+
// ----------------------------------------------------------------------------
ScDPCacheTable::SingleFilter::SingleFilter(String aString, double fValue, bool bHasValue)
@@ -187,9 +189,10 @@ sal_Int32 ScDPCacheTable::getColSize() const
void ScDPCacheTable::fillTable( const ScQueryParam& rQuery, BOOL* pSpecial,
bool bIgnoreEmptyRows, bool bRepeatIfEmpty )
{
+ // check cache
if ( mpCache == NULL )
initNoneCache( NULL );
-//check cache
+
const SCROW nRowCount = getRowSize();
const SCCOL nColCount = (SCCOL) getColSize();
if ( nRowCount <= 0 || nColCount <= 0)
@@ -242,9 +245,10 @@ void ScDPCacheTable::fillTable( const ScQueryParam& rQuery, BOOL* pSpecial,
void ScDPCacheTable::fillTable()
{
+ // check cache
if ( mpCache == NULL )
initNoneCache( NULL );
-//check cache
+
const SCROW nRowCount = getRowSize();
const SCCOL nColCount = (SCCOL) getColSize();
if ( nRowCount <= 0 || nColCount <= 0)
@@ -285,7 +289,6 @@ void ScDPCacheTable::fillTable()
}
}
}
- return;
}
bool ScDPCacheTable::isRowActive(sal_Int32 nRow) const
@@ -330,7 +333,7 @@ void ScDPCacheTable::getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, boo
}
String ScDPCacheTable::getFieldName(SCCOL nIndex) const
{
- return (getCache()->GetDimensionName( nIndex ));
+ return getCache()->GetDimensionName( nIndex );
}
sal_Int32 ScDPCacheTable::getFieldIndex(const String& rStr) const
@@ -340,13 +343,13 @@ sal_Int32 ScDPCacheTable::getFieldIndex(const String& rStr) const
const ::std::vector<SCROW>& ScDPCacheTable::getFieldEntries( sal_Int32 nColumn ) const
{
- if (nColumn < 0 || static_cast<size_t>(nColumn) >= maFieldEntries.size())
+ if (nColumn < 0 || static_cast<size_t>(nColumn) >= maFieldEntries.size())
{
// index out of bound. Hopefully this code will never be reached.
static const ::std::vector<SCROW> emptyEntries;
return emptyEntries;
}
- return maFieldEntries[nColumn];
+ return maFieldEntries[nColumn];
}
void ScDPCacheTable::filterTable(const vector<Criterion>& rCriteria, Sequence< Sequence<Any> >& rTabData,
@@ -466,6 +469,5 @@ ScDPTableDataCache* ScDPCacheTable::getCache() const
return mpCache;
return mpNoneCache;
}
-// End Comments
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a2ae12db5e0171b50f1e6e7d97f6a8fa846e7618
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Nov 12 15:29:10 2010 -0500
A bit of cleanup of the data pilot code.
Removed unnecessary // this is done by <who> on <date> type of comments.
Plus renamed some method names to be consistent with its neighboring
method naming conventions.
And some indentation hiccups.
diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx
index 5e7312c..392c0a3 100644
--- a/sc/inc/dpcachetable.hxx
+++ b/sc/inc/dpcachetable.hxx
@@ -57,17 +57,11 @@ class ScDPDimension;
class ScDPCollection;
struct ScDPCacheCell;
struct ScQueryParam;
-// Wang Xu Ming -- 2009-8-17
-// DataPilot Migration - Cache&&Performance
class ScDPItemData;
-// End Comments
class Date;
-// Wang Xu Ming -- 2009-8-17
-// DataPilot Migration - Cache&&Performance
class ScDPTableDataCache;
struct ScDPValueData;
-// End Comments
// ----------------------------------------------------------------------------
class SC_DLLPUBLIC ScDPCacheTable
@@ -76,18 +70,12 @@ public:
/** individual filter item used in SingleFilter and GroupFilter. */
struct FilterItem
{
- // Wang Xu Ming -- 2009-8-17
- // DataPilot Migration - Cache&&Performance
- String maString;
- // End Comments
+ String maString;
double mfValue;
bool mbHasValue;
FilterItem();
-// Wang Xu Ming -- 2009-8-17
-// DataPilot Migration - Cache&&Performance
- bool match( const ScDPItemData& rCellData ) const;
-// End Comments
+ bool match( const ScDPItemData& rCellData ) const;
};
/** interface class used for filtering of rows. */
@@ -96,27 +84,19 @@ public:
public:
/** returns true if the matching condition is met for a single cell
value, or false otherwise. */
-// Wang Xu Ming -- 2009-8-17
-// DataPilot Migration - Cache&&Performance
virtual bool match( const ScDPItemData& rCellData ) const = 0;
-// End Comments
};
/** ordinary single-item filter. */
class SingleFilter : public FilterBase
{
public:
- // Wang Xu Ming -- 2009-8-17
- // DataPilot Migration - Cache&&Performance
explicit SingleFilter(String aString, double fValue, bool bHasValue);
- // End Comments
- virtual ~SingleFilter(){}
-
- // Wang Xu Ming -- 2009-8-17
- // DataPilot Migration - Cache&&Performance
- virtual bool match(const ScDPItemData& rCellData) const;
- // End Comments
- const String getMatchString();
+ virtual ~SingleFilter() {}
+
+ virtual bool match(const ScDPItemData& rCellData) const;
+
+ const String& getMatchString();
double getMatchValue() const;
bool hasValue() const;
@@ -130,20 +110,13 @@ public:
class GroupFilter : public FilterBase
{
public:
- // Wang Xu Ming -- 2009-8-17
- // DataPilot Migration - Cache&&Performance
GroupFilter();
- // End Comments
- virtual ~GroupFilter(){}
- // Wang Xu Ming -- 2009-8-17
- // DataPilot Migration - Cache&&Performance
+ virtual ~GroupFilter() {}
virtual bool match( const ScDPItemData& rCellData ) const;
- // End Comments
void addMatchItem(const String& rStr, double fVal, bool bHasValue);
size_t getMatchItemCount() const;
private:
-
::std::vector<FilterItem> maItems;
};
@@ -155,26 +128,23 @@ public:
Criterion();
};
- // Wang Xu Ming -- 2009-8-17
- // DataPilot Migration - Cache&&Performance
- ScDPCacheTable( ScDocument* pDoc,long nId );
- // End Comments
+
+ ScDPCacheTable( ScDocument* pDoc, long nId );
~ScDPCacheTable();
sal_Int32 getRowSize() const;
sal_Int32 getColSize() const;
- // Wang Xu Ming -- 2009-8-17
- // DataPilot Migration - Cache&&Performance
- ScDPTableDataCache* GetCache() const;
+ ScDPTableDataCache* getCache() const;
+
/** Fill the internal table from the cell range provided. This function
- assumes that the first row is the column header. */
+ assumes that the first row is the column header. */
void fillTable( const ScQueryParam& rQuery, BOOL* pSpecial,
bool bIgnoreEmptyRows, bool bRepeatIfEmpty );
+
/** Fill the internal table from database connection object. This function
assumes that the first row is the column header. */
void fillTable();
- // End Comments
/** 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
@@ -191,20 +161,17 @@ public:
const ScDPItemData* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const;
void getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const;
String getFieldName( SCCOL nIndex) const;
- //End Comments
/** 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;
- // Wang Xu Ming -- 2009-8-17
- // DataPilot Migration - Cache&&Performance
/** 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. */
+ make sure that the table is filled before calling function, or it will
+ get an empty collection. */
const ::std::vector<SCROW>& getFieldEntries( sal_Int32 nColumn ) const;
- // End Comments
+
/** 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. */
@@ -228,24 +195,18 @@ private:
*/
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list