diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-10-03 14:24:28 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-10-04 19:15:24 -0400 |
commit | 875f47cb5a20e2ce6ed54d88fd5bbf1d6128a47d (patch) | |
tree | d052055b297e3c8de85390a85482202349731976 /sc/source/core/data/column3.cxx | |
parent | f6ec66727379fef56f0972e2a6181e39ab6d4ec1 (diff) |
Add methods to turn cell strings into numeric IDs for comparison.
Both in case sensitive and case insensitive comparisons.
Change-Id: I356a655273f0f37157810c86e1cf3f87ea2afa09
Diffstat (limited to 'sc/source/core/data/column3.cxx')
-rw-r--r-- | sc/source/core/data/column3.cxx | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index f5eccae3daea..6c964ca060c6 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -1732,6 +1732,64 @@ bool ScColumn::SetGroupFormulaCell( SCROW nRow, ScFormulaCell* pCell ) return true; } +sal_uIntPtr ScColumn::GetCellStringID( SCROW nRow ) const +{ + sc::CellStoreType::const_position_type aPos = maCells.position(nRow); + switch (aPos.first->type) + { + case sc::element_type_string: + { + const OUString& rStr = sc::string_block::at(*aPos.first->data, aPos.second); + return pDocument->GetCellStringPool().getIdentifier(rStr); + } + break; + case sc::element_type_edittext: + { + std::vector<sal_uIntPtr> aIDs; + const EditTextObject* pObj = sc::edittext_block::at(*aPos.first->data, aPos.second); + pObj->GetStringIDs(pDocument->GetCellStringPool(), aIDs); + if (aIDs.size() != 1) + // We don't handle multiline content for now. + return 0; + + return aIDs[0]; + } + break; + default: + ; + } + return 0; +} + +sal_uIntPtr ScColumn::GetCellStringIDIgnoreCase( SCROW nRow ) const +{ + sc::CellStoreType::const_position_type aPos = maCells.position(nRow); + switch (aPos.first->type) + { + case sc::element_type_string: + { + const OUString& rStr = sc::string_block::at(*aPos.first->data, aPos.second); + return pDocument->GetCellStringPool().getIdentifierIgnoreCase(rStr); + } + break; + case sc::element_type_edittext: + { + std::vector<sal_uIntPtr> aIDs; + const EditTextObject* pObj = sc::edittext_block::at(*aPos.first->data, aPos.second); + pObj->GetStringIDsIgnoreCase(pDocument->GetCellStringPool(), aIDs); + if (aIDs.size() != 1) + // We don't handle multiline content for now. + return 0; + + return aIDs[0]; + } + break; + default: + ; + } + return 0; +} + namespace { class FilterEntriesHandler |