diff options
-rw-r--r-- | sc/inc/dpcachetable.hxx | 11 | ||||
-rw-r--r-- | sc/inc/dpgroup.hxx | 5 | ||||
-rw-r--r-- | sc/inc/dpsdbtab.hxx | 3 | ||||
-rw-r--r-- | sc/inc/dpshttab.hxx | 3 | ||||
-rw-r--r-- | sc/inc/dptabdat.hxx | 4 | ||||
-rw-r--r-- | sc/inc/dptabsrc.hxx | 16 | ||||
-rw-r--r-- | sc/source/core/data/dpcachetable.cxx | 16 | ||||
-rw-r--r-- | sc/source/core/data/dpgroup.cxx | 13 | ||||
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 27 | ||||
-rw-r--r-- | sc/source/core/data/dpsdbtab.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/data/dpshttab.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/data/dptabdat.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dptabsrc.cxx | 109 | ||||
-rw-r--r-- | sc/source/core/data/makefile.mk | 1 | ||||
-rw-r--r-- | sc/source/core/tool/cellkeywords.inl | 55 | ||||
-rw-r--r-- | sc/source/filter/excel/xipivot.cxx | 3 | ||||
-rw-r--r-- | sc/workben/celltrans/keywords_utf16.txt | bin | 3 -> 1830 bytes | |||
-rwxr-xr-x | sc/workben/celltrans/parse.py | 2 |
18 files changed, 229 insertions, 65 deletions
diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx index f011d727de2a..95b5c9c9c13d 100644 --- a/sc/inc/dpcachetable.hxx +++ b/sc/inc/dpcachetable.hxx @@ -169,12 +169,12 @@ public: /** 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, bool bRepeatIfEmpty = false); + 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 = false) const; + const ScDPCacheCell* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const; const String* getFieldName(sal_Int32 nIndex) const; @@ -193,7 +193,7 @@ public: 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, - bool bRepeatIfEmpty = false); + const ::std::hash_set<sal_Int32>& rRepeatIfEmptyDims); void clear(); void swap(ScDPCacheTable& rOther); @@ -205,8 +205,11 @@ private: /** * 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, bool bRepeatIfEmpty) const; + 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: diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx index c93998e366b1..99dac0e517db 100644 --- a/sc/inc/dpgroup.hxx +++ b/sc/inc/dpgroup.hxx @@ -218,9 +218,12 @@ public: virtual void DisposeData(); virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty ); + virtual bool IsRepeatIfEmpty(); + virtual void CreateCacheTable(); - virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria); + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rDataDims); virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::std::hash_set<sal_Int32>& rCatDims, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData); virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow); virtual const ScDPCacheTable& GetCacheTable() const; diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx index 40a376c7b33a..b837b5811aad 100644 --- a/sc/inc/dpsdbtab.hxx +++ b/sc/inc/dpsdbtab.hxx @@ -82,8 +82,9 @@ public: virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty ); virtual void CreateCacheTable(); - virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria); + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rDataDims); virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::std::hash_set<sal_Int32>& rCatDims, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData); virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow); virtual const ScDPCacheTable& GetCacheTable() const; diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx index 841517ef7e17..0bcdbeee517e 100644 --- a/sc/inc/dpshttab.hxx +++ b/sc/inc/dpshttab.hxx @@ -83,8 +83,9 @@ public: virtual bool IsRepeatIfEmpty(); virtual void CreateCacheTable(); - virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria); + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rCatDims); virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::std::hash_set<sal_Int32>& rCatDims, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData); virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow); virtual const ScDPCacheTable& GetCacheTable() const; diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx index e97237186443..46c26b3f0bbe 100644 --- a/sc/inc/dptabdat.hxx +++ b/sc/inc/dptabdat.hxx @@ -40,6 +40,7 @@ #include <vector> #include <set> #include <hash_map> +#include <hash_set> namespace com { namespace sun { namespace star { namespace sheet { struct DataPilotFieldFilter; @@ -169,8 +170,9 @@ public: virtual bool IsRepeatIfEmpty(); virtual void CreateCacheTable() = 0; - virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria) = 0; + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rDataDims) = 0; virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::std::hash_set<sal_Int32>& rCatDims, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData) = 0; virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow) = 0; virtual const ScDPCacheTable& GetCacheTable() const = 0; diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx index 2fda053e510b..59996d08b8aa 100644 --- a/sc/inc/dptabsrc.hxx +++ b/sc/inc/dptabsrc.hxx @@ -108,9 +108,6 @@ class ScDPSource : public cppu::WeakImplHelper6< com::sun::star::lang::XServiceInfo > { private: - void FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool &bHasAutoShow); - -private: ScDPTableData* pData; // data source ScDPDimensions* pDimensions; // api objects // settings: @@ -142,6 +139,19 @@ private: void CreateRes_Impl(); void FillMemberResults(); void FillLevelList( USHORT nOrientation, List& rList ); + void FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool &bHasAutoShow); + + /** + * Compile a list of dimension indices that are either, column, row or + * page dimensions (i.e. all but data dimensions). + */ + void GetCategoryDimensionIndices(::std::hash_set<sal_Int32>& rCatDims); + + /** + * Set visibilities of individual rows in the cache table based on the + * page field data. + */ + void FilterCacheTableByPageDimensions(); void SetDupCount( long nNew ); diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx index 7ac813dd5a57..1f843f5ac57f 100644 --- a/sc/source/core/data/dpcachetable.cxx +++ b/sc/source/core/data/dpcachetable.cxx @@ -57,6 +57,7 @@ using ::rtl::OUString; using ::std::vector; using ::std::pair; using ::std::hash_map; +using ::std::hash_set; using ::std::auto_ptr; using ::com::sun::star::i18n::LocaleDataItem; using ::com::sun::star::uno::Exception; @@ -489,7 +490,7 @@ bool ScDPCacheTable::isRowActive(sal_Int32 nRow) const return maRowsVisible[nRow]; } -void ScDPCacheTable::filterByPageDimension(const vector<Criterion>& rCriteria, bool bRepeatIfEmpty) +void ScDPCacheTable::filterByPageDimension(const vector<Criterion>& rCriteria, const hash_set<sal_Int32>& rRepeatIfEmptyDims) { sal_Int32 nRowSize = getRowSize(); if (nRowSize != static_cast<sal_Int32>(maRowsVisible.size())) @@ -499,7 +500,7 @@ void ScDPCacheTable::filterByPageDimension(const vector<Criterion>& rCriteria, b } for (sal_Int32 nRow = 0; nRow < nRowSize; ++nRow) - maRowsVisible[nRow] = isRowQualified(nRow, rCriteria, bRepeatIfEmpty); + maRowsVisible[nRow] = isRowQualified(nRow, rCriteria, rRepeatIfEmptyDims); } const ScDPCacheCell* ScDPCacheTable::getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const @@ -556,7 +557,8 @@ const TypedScStrCollection& ScDPCacheTable::getFieldEntries(sal_Int32 nIndex) co return *maFieldEntries[nIndex].get(); } -void ScDPCacheTable::filterTable(const vector<Criterion>& rCriteria, Sequence< Sequence<Any> >& rTabData, bool bRepeatIfEmpty) +void ScDPCacheTable::filterTable(const vector<Criterion>& rCriteria, Sequence< Sequence<Any> >& rTabData, + const hash_set<sal_Int32>& rRepeatIfEmptyDims) { sal_Int32 nRowSize = getRowSize(); sal_Int32 nColSize = getColSize(); @@ -591,7 +593,7 @@ void ScDPCacheTable::filterTable(const vector<Criterion>& rCriteria, Sequence< S // This row is filtered out. continue; - if (!isRowQualified(nRow, rCriteria, bRepeatIfEmpty)) + if (!isRowQualified(nRow, rCriteria, rRepeatIfEmptyDims)) continue; // Insert this row into table. @@ -600,6 +602,7 @@ void ScDPCacheTable::filterTable(const vector<Criterion>& rCriteria, Sequence< S for (SCCOL nCol = 0; nCol < nColSize; ++nCol) { Any any; + bool bRepeatIfEmpty = rRepeatIfEmptyDims.count(nCol) > 0; const ScDPCacheCell* pCell = getCell(nCol, nRow, bRepeatIfEmpty); if (!pCell) { @@ -654,7 +657,8 @@ bool ScDPCacheTable::empty() const return maTable.empty(); } -bool ScDPCacheTable::isRowQualified(sal_Int32 nRow, const vector<Criterion>& rCriteria, bool bRepeatIfEmpty) const +bool ScDPCacheTable::isRowQualified(sal_Int32 nRow, const vector<Criterion>& rCriteria, + const hash_set<sal_Int32>& rRepeatIfEmptyDims) const { sal_Int32 nColSize = getColSize(); vector<Criterion>::const_iterator itrEnd = rCriteria.end(); @@ -665,6 +669,8 @@ bool ScDPCacheTable::isRowQualified(sal_Int32 nRow, const vector<Criterion>& rCr // use this criterion. continue; + // Check if the 'repeat if empty' flag is set for this field. + bool bRepeatIfEmpty = rRepeatIfEmptyDims.count(itr->mnFieldIndex) > 0; const ScDPCacheCell* pCell = getCell(static_cast<SCCOL>(itr->mnFieldIndex), nRow, bRepeatIfEmpty); if (!pCell) // This should never happen, but just in case... diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx index d220a791f3e0..a92d1681ec0e 100644 --- a/sc/source/core/data/dpgroup.cxx +++ b/sc/source/core/data/dpgroup.cxx @@ -1133,6 +1133,11 @@ void ScDPGroupTableData::SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmp pSourceData->SetEmptyFlags( bIgnoreEmptyRows, bRepeatIfEmpty ); } +bool ScDPGroupTableData::IsRepeatIfEmpty() +{ + return pSourceData->IsRepeatIfEmpty(); +} + void ScDPGroupTableData::CreateCacheTable() { pSourceData->CreateCacheTable(); @@ -1240,18 +1245,18 @@ void ScDPGroupTableData::ModifyFilterCriteria(vector<ScDPCacheTable::Criterion>& rCriteria.swap(aNewCriteria); } -void ScDPGroupTableData::FilterCacheTable(const vector<ScDPCacheTable::Criterion>& rCriteria) +void ScDPGroupTableData::FilterCacheTable(const vector<ScDPCacheTable::Criterion>& rCriteria, const hash_set<sal_Int32>& rCatDims) { vector<ScDPCacheTable::Criterion> aNewCriteria(rCriteria); ModifyFilterCriteria(aNewCriteria); - pSourceData->FilterCacheTable(aNewCriteria); + pSourceData->FilterCacheTable(aNewCriteria, rCatDims); } -void ScDPGroupTableData::GetDrillDownData(const vector<ScDPCacheTable::Criterion>& rCriteria, Sequence< Sequence<Any> >& rData) +void ScDPGroupTableData::GetDrillDownData(const vector<ScDPCacheTable::Criterion>& rCriteria, const hash_set<sal_Int32>& rCatDims, Sequence< Sequence<Any> >& rData) { vector<ScDPCacheTable::Criterion> aNewCriteria(rCriteria); ModifyFilterCriteria(aNewCriteria); - pSourceData->GetDrillDownData(aNewCriteria, rData); + pSourceData->GetDrillDownData(aNewCriteria, rCatDims, rData); } void ScDPGroupTableData::CalcResults(CalcInfo& rInfo, bool bAutoShow) diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 9b4feb66a161..22ae204474ec 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -56,6 +56,7 @@ #include "scitems.hxx" #include "unonames.hxx" +#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/sheet/GeneralFunction.hpp> #include <com/sun/star/sheet/DataPilotFieldFilter.hpp> #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> @@ -83,6 +84,8 @@ using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::Any; using ::com::sun::star::sheet::DataPilotTableHeaderData; using ::com::sun::star::sheet::DataPilotTablePositionData; +using ::com::sun::star::beans::XPropertySet; +using ::rtl::OUString; // ----------------------------------------------------------------------- @@ -835,16 +838,24 @@ void ScDPObject::FillPageList( TypedScStrCollection& rStrings, long nField ) uno::Sequence<rtl::OUString> aNames = xMembers->getElementNames(); long nNameCount = aNames.getLength(); const rtl::OUString* pNameArr = aNames.getConstArray(); - for (long nPos=0; nPos<nNameCount; nPos++) + for (long nPos = 0; nPos < nNameCount; ++nPos) { - TypedStrData* pData = new TypedStrData( pNameArr[nPos] ); - -// if ( !rStrings.Insert( pData ) ) -// delete pData; // duplicate + // Make sure to insert only visible members. + Reference<XPropertySet> xPropSet(xMembers->getByName(pNameArr[nPos]), UNO_QUERY); + sal_Bool bVisible = false; + if (xPropSet.is()) + { + Any any = xPropSet->getPropertyValue(OUString::createFromAscii(SC_UNO_ISVISIBL)); + any >>= bVisible; + } - // use the order from getElementNames - if ( !rStrings.AtInsert( rStrings.GetCount(), pData ) ) - delete pData; + if (bVisible) + { + // use the order from getElementNames + TypedStrData* pData = new TypedStrData( pNameArr[nPos] ); + if ( !rStrings.AtInsert( rStrings.GetCount(), pData ) ) + delete pData; + } } // add "-all-" entry to the top (unsorted) diff --git a/sc/source/core/data/dpsdbtab.cxx b/sc/source/core/data/dpsdbtab.cxx index 82b4eb0bc5a1..777ea3f38935 100644 --- a/sc/source/core/data/dpsdbtab.cxx +++ b/sc/source/core/data/dpsdbtab.cxx @@ -64,8 +64,8 @@ using namespace com::sun::star; using ::std::vector; -using ::std::set; using ::std::hash_map; +using ::std::hash_set; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; @@ -293,20 +293,22 @@ void ScDatabaseDPData::CreateCacheTable() pImpl->aCacheTable.fillTable(pImpl->xRowSet, *pImpl->pFormatter->GetNullDate()); } -void ScDatabaseDPData::FilterCacheTable(const vector<ScDPCacheTable::Criterion>& rCriteria) +void ScDatabaseDPData::FilterCacheTable(const vector<ScDPCacheTable::Criterion>& rCriteria, const hash_set<sal_Int32>& rCatDims) { CreateCacheTable(); - pImpl->aCacheTable.filterByPageDimension(rCriteria, IsRepeatIfEmpty()); + pImpl->aCacheTable.filterByPageDimension( + rCriteria, (IsRepeatIfEmpty() ? rCatDims : hash_set<sal_Int32>())); } -void ScDatabaseDPData::GetDrillDownData(const vector<ScDPCacheTable::Criterion>& rCriteria, Sequence< Sequence<Any> >& rData) +void ScDatabaseDPData::GetDrillDownData(const vector<ScDPCacheTable::Criterion>& rCriteria, const hash_set<sal_Int32>& rCatDims, Sequence< Sequence<Any> >& rData) { CreateCacheTable(); sal_Int32 nRowSize = pImpl->aCacheTable.getRowSize(); if (!nRowSize) return; - pImpl->aCacheTable.filterTable(rCriteria, rData, IsRepeatIfEmpty()); + pImpl->aCacheTable.filterTable( + rCriteria, rData, IsRepeatIfEmpty() ? rCatDims : hash_set<sal_Int32>()); } void ScDatabaseDPData::CalcResults(CalcInfo& rInfo, bool bAutoShow) diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx index 632066934bb3..1e8c5627ee19 100644 --- a/sc/source/core/data/dpshttab.cxx +++ b/sc/source/core/data/dpshttab.cxx @@ -56,8 +56,8 @@ using namespace ::com::sun::star; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Sequence; using ::std::vector; -using ::std::set; using ::std::hash_map; +using ::std::hash_set; // ----------------------------------------------------------------------- @@ -269,20 +269,22 @@ void ScSheetDPData::CreateCacheTable() pImpl->bIgnoreEmptyRows); } -void ScSheetDPData::FilterCacheTable(const vector<ScDPCacheTable::Criterion>& rCriteria) +void ScSheetDPData::FilterCacheTable(const vector<ScDPCacheTable::Criterion>& rCriteria, const hash_set<sal_Int32>& rCatDims) { CreateCacheTable(); - pImpl->aCacheTable.filterByPageDimension(rCriteria, IsRepeatIfEmpty()); + pImpl->aCacheTable.filterByPageDimension( + rCriteria, (IsRepeatIfEmpty() ? rCatDims : hash_set<sal_Int32>())); } -void ScSheetDPData::GetDrillDownData(const vector<ScDPCacheTable::Criterion>& rCriteria, Sequence< Sequence<Any> >& rData) +void ScSheetDPData::GetDrillDownData(const vector<ScDPCacheTable::Criterion>& rCriteria, const hash_set<sal_Int32>& rCatDims, Sequence< Sequence<Any> >& rData) { CreateCacheTable(); sal_Int32 nRowSize = pImpl->aCacheTable.getRowSize(); if (!nRowSize) return; - pImpl->aCacheTable.filterTable(rCriteria, rData, IsRepeatIfEmpty()); + pImpl->aCacheTable.filterTable( + rCriteria, rData, IsRepeatIfEmpty() ? rCatDims : hash_set<sal_Int32>()); } void ScSheetDPData::CalcResults(CalcInfo& rInfo, bool bAutoShow) diff --git a/sc/source/core/data/dptabdat.cxx b/sc/source/core/data/dptabdat.cxx index 70f73ea67579..a58241cea416 100644 --- a/sc/source/core/data/dptabdat.cxx +++ b/sc/source/core/data/dptabdat.cxx @@ -247,7 +247,7 @@ void ScDPTableData::FillRowDataFromCacheTable(sal_Int32 nRow, const ScDPCacheTab rData.aValues.push_back( ScDPValueData() ); ScDPValueData& rVal = rData.aValues.back(); const ScDPCacheCell* pCell = rCacheTable.getCell( - static_cast<SCCOL>(nDim), static_cast<SCROW>(nRow)); + static_cast<SCCOL>(nDim), static_cast<SCROW>(nRow), false); if (pCell) { rVal.fValue = pCell->mbNumeric ? pCell->mfValue : 0.0; diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index 05ad86aa8234..c6a48a8f1925 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -40,6 +40,7 @@ #include <vector> #include <set> #include <hash_map> +#include <hash_set> #include <tools/debug.hxx> #include <rtl/math.hxx> @@ -79,6 +80,7 @@ using namespace com::sun::star; using ::std::vector; using ::std::set; using ::std::hash_map; +using ::std::hash_set; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; @@ -470,7 +472,9 @@ Sequence< Sequence<Any> > SAL_CALL ScDPSource::getDrillDownData(const Sequence<s aResVisData.fillFieldFilters(aFilterCriteria); Sequence< Sequence<Any> > aTabData; - pData->GetDrillDownData(aFilterCriteria, aTabData); + hash_set<sal_Int32> aCatDims; + GetCategoryDimensionIndices(aCatDims); + pData->GetDrillDownData(aFilterCriteria, aCatDims, aTabData); return aTabData; } @@ -685,6 +689,86 @@ void ScDPSource::FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool } } +void ScDPSource::GetCategoryDimensionIndices(hash_set<sal_Int32>& rCatDims) +{ + hash_set<sal_Int32> aCatDims; + for (long i = 0; i < nColDimCount; ++i) + { + sal_Int32 nDim = static_cast<sal_Int32>(nColDims[i]); + if (!IsDataLayoutDimension(nDim)) + aCatDims.insert(nDim); + } + + for (long i = 0; i < nRowDimCount; ++i) + { + sal_Int32 nDim = static_cast<sal_Int32>(nRowDims[i]); + if (!IsDataLayoutDimension(nDim)) + aCatDims.insert(nDim); + } + + for (long i = 0; i < nPageDimCount; ++i) + { + sal_Int32 nDim = static_cast<sal_Int32>(nPageDims[i]); + if (!IsDataLayoutDimension(nDim)) + aCatDims.insert(nDim); + } + + rCatDims.swap(aCatDims); +} + +void ScDPSource::FilterCacheTableByPageDimensions() +{ + ScSimpleSharedString& rSharedString = GetData()->GetSharedString(); + + // filter table by page dimensions. + vector<ScDPCacheTable::Criterion> aCriteria; + for (long i = 0; i < nPageDimCount; ++i) + { + ScDPDimension* pDim = GetDimensionsObject()->getByIndex(nPageDims[i]); + long nField = pDim->GetDimension(); + + ScDPMembers* pMems = pDim->GetHierarchiesObject()->getByIndex(0)-> + GetLevelsObject()->getByIndex(0)->GetMembersObject(); + + long nMemCount = pMems->getCount(); + ScDPCacheTable::Criterion aFilter; + aFilter.mnFieldIndex = static_cast<sal_Int32>(nField); + aFilter.mpFilter.reset(new ScDPCacheTable::GroupFilter(rSharedString)); + ScDPCacheTable::GroupFilter* pGrpFilter = + static_cast<ScDPCacheTable::GroupFilter*>(aFilter.mpFilter.get()); + for (long j = 0; j < nMemCount; ++j) + { + ScDPMember* pMem = pMems->getByIndex(j); + if (pMem->getIsVisible()) + { + ScDPItemData aData; + pMem->FillItemData(aData); + pGrpFilter->addMatchItem(aData.aString, aData.fValue, aData.bHasValue); + } + } + if (pGrpFilter->getMatchItemCount() < static_cast<size_t>(nMemCount)) + // there is at least one invisible item. Add this filter criterion to the mix. + aCriteria.push_back(aFilter); + + if (!pDim || !pDim->HasSelectedPage()) + continue; + + const ScDPItemData& rData = pDim->GetSelectedData(); + aCriteria.push_back(ScDPCacheTable::Criterion()); + ScDPCacheTable::Criterion& r = aCriteria.back(); + r.mnFieldIndex = static_cast<sal_Int32>(nField); + sal_Int32 nStrId = rSharedString.getStringId(rData.aString); + r.mpFilter.reset( + new ScDPCacheTable::SingleFilter(rSharedString, nStrId, rData.fValue, rData.bHasValue)); + } + if (!aCriteria.empty()) + { + hash_set<sal_Int32> aCatDims; + GetCategoryDimensionIndices(aCatDims); + pData->FilterCacheTable(aCriteria, aCatDims); + } +} + void ScDPSource::CreateRes_Impl() { if ( !pResData ) @@ -850,29 +934,8 @@ void ScDPSource::CreateRes_Impl() } else { - { - ScSimpleSharedString& rSharedString = GetData()->GetSharedString(); + FilterCacheTableByPageDimensions(); - // filter table by page dimensions. - vector<ScDPCacheTable::Criterion> aCriteria; - for (i = 0; i < nPageDimCount; ++i) - { - ScDPDimension* pDim = GetDimensionsObject()->getByIndex(nPageDims[i]); - if (!pDim || !pDim->HasSelectedPage()) - continue; - - long nField = pDim->GetDimension(); - const ScDPItemData& rData = pDim->GetSelectedData(); - aCriteria.push_back(ScDPCacheTable::Criterion()); - ScDPCacheTable::Criterion& r = aCriteria.back(); - r.mnFieldIndex = static_cast<sal_Int32>(nField); - sal_Int32 nStrId = rSharedString.getStringId(rData.aString); - r.mpFilter.reset( - new ScDPCacheTable::SingleFilter(rSharedString, nStrId, rData.fValue, rData.bHasValue)); - } - if (!aCriteria.empty()) - pData->FilterCacheTable(aCriteria); - } aInfo.aPageDims.reserve(nPageDimCount); for (i = 0; i < nPageDimCount; ++i) aInfo.aPageDims.push_back(nPageDims[i]); diff --git a/sc/source/core/data/makefile.mk b/sc/source/core/data/makefile.mk index 7ca3c096b239..1803661dd530 100644 --- a/sc/source/core/data/makefile.mk +++ b/sc/source/core/data/makefile.mk @@ -121,6 +121,7 @@ EXCEPTIONSFILES= \ $(SLO)$/document.obj \ $(SLO)$/dpdimsave.obj \ $(SLO)$/dpgroup.obj \ + $(SLO)$/dpshttab.obj \ $(SLO)$/dptabres.obj \ $(SLO)$/dptabdat.obj \ $(SLO)$/global2.obj \ diff --git a/sc/source/core/tool/cellkeywords.inl b/sc/source/core/tool/cellkeywords.inl index 1b293afc1ee8..9fb58c02797b 100644 --- a/sc/source/core/tool/cellkeywords.inl +++ b/sc/source/core/tool/cellkeywords.inl @@ -124,3 +124,58 @@ static const TransItem pHu[] = { }; addToMap(pHu, aHu); + +// --------------------------------------------------------------------------- +// German language locale (automatically generated) +// --------------------------------------------------------------------------- +static const Locale aDe(OUString::createFromAscii("de"), OUString(), OUString()); + +// pre instantiations of localized function names +static const sal_Unicode cell_row_de[] = { + 0x005A, 0x0045, 0x0049, 0x004C, 0x0045, 0x0000}; +static const sal_Unicode cell_col_de[] = { + 0x0053, 0x0050, 0x0041, 0x004C, 0x0054, 0x0045, 0x0000}; +static const sal_Unicode cell_width_de[] = { + 0x0042, 0x0052, 0x0045, 0x0049, 0x0054, 0x0045, 0x0000}; +static const sal_Unicode cell_address_de[] = { + 0x0041, 0x0044, 0x0052, 0x0045, 0x0053, 0x0053, 0x0045, 0x0000}; +static const sal_Unicode cell_filename_de[] = { + 0x0044, 0x0041, 0x0054, 0x0045, 0x0049, 0x004E, 0x0041, 0x004D, 0x0045, 0x0000}; +static const sal_Unicode cell_color_de[] = { + 0x0046, 0x0041, 0x0052, 0x0042, 0x0045, 0x0000}; +static const sal_Unicode cell_format_de[] = { + 0x0046, 0x004F, 0x0052, 0x004D, 0x0041, 0x0054, 0x0000}; +static const sal_Unicode cell_contents_de[] = { + 0x0049, 0x004E, 0x0048, 0x0041, 0x004C, 0x0054, 0x0000}; +static const sal_Unicode cell_parentheses_de[] = { + 0x004B, 0x004C, 0x0041, 0x004D, 0x004D, 0x0045, 0x0052, 0x004E, 0x0000}; +static const sal_Unicode cell_protect_de[] = { + 0x0053, 0x0043, 0x0048, 0x0055, 0x0054, 0x005A, 0x0000}; +static const sal_Unicode cell_type_de[] = { + 0x0054, 0x0059, 0x0050, 0x0000}; +static const sal_Unicode cell_prefix_de[] = { + 0x0050, 0x0052, 0x00C4, 0x0046, 0x0049, 0x0058, 0x0000}; +static const sal_Unicode cell_sheet_de[] = { + 0x0042, 0x004C, 0x0041, 0x0054, 0x0054, 0x0000}; +static const sal_Unicode cell_coord_de[] = { + 0x004B, 0x004F, 0x004F, 0x0052, 0x0044, 0x0000}; + +static const TransItem pDe[] = { + {cell_row_de, "ROW", ocCell}, + {cell_col_de, "COL", ocCell}, + {cell_width_de, "WIDTH", ocCell}, + {cell_address_de, "ADDRESS", ocCell}, + {cell_filename_de, "FILENAME", ocCell}, + {cell_color_de, "COLOR", ocCell}, + {cell_format_de, "FORMAT", ocCell}, + {cell_contents_de, "CONTENTS", ocCell}, + {cell_parentheses_de, "PARENTHESES", ocCell}, + {cell_protect_de, "PROTECT", ocCell}, + {cell_type_de, "TYPE", ocCell}, + {cell_prefix_de, "PREFIX", ocCell}, + {cell_sheet_de, "SHEET", ocCell}, + {cell_coord_de, "COORD", ocCell}, + {NULL, NULL, ocNone} +}; + +addToMap(pDe, aDe); diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx index f0796b99de57..acd371f43f7d 100644 --- a/sc/source/filter/excel/xipivot.cxx +++ b/sc/source/filter/excel/xipivot.cxx @@ -286,9 +286,8 @@ void XclImpPCField::ReadSxfield( XclImpStream& rStrm ) // for now, ignore data type of calculated fields DBG_ASSERT( bCalced || bType || bTypeNone, "XclImpPCField::ReadSxfield - unknown item data type" ); - if( nVisC > 0 ) + if( nVisC > 0 || bPostp ) { - DBG_ASSERT( !bItems || !bPostp, "XclImpPCField::ReadSxfield - postponed field with inline items" ); if( bItems && !bPostp ) { if( !bCalced ) diff --git a/sc/workben/celltrans/keywords_utf16.txt b/sc/workben/celltrans/keywords_utf16.txt Binary files differindex 52e71ed3e170..5b00a5ffb7d2 100644 --- a/sc/workben/celltrans/keywords_utf16.txt +++ b/sc/workben/celltrans/keywords_utf16.txt diff --git a/sc/workben/celltrans/parse.py b/sc/workben/celltrans/parse.py index a6641b3b8a44..e5f8d30ca77d 100755 --- a/sc/workben/celltrans/parse.py +++ b/sc/workben/celltrans/parse.py @@ -32,7 +32,7 @@ import sys -localeNames = {'fr': 'French', 'hu': 'Hungarian'} +localeNames = {'fr': 'French', 'hu': 'Hungarian', 'de': 'German'} def getLocaleName (code): global localeNames if localeNames.has_key(code): |