[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Wed May 22 17:30:27 PDT 2013
sc/inc/columniterator.hxx | 4 +--
sc/inc/mtvelements.hxx | 41 +++++++++++++++++++++++++++------
sc/source/core/data/column2.cxx | 20 ++++++++--------
sc/source/core/data/columniterator.cxx | 6 ++--
4 files changed, 49 insertions(+), 22 deletions(-)
New commits:
commit 2e77d3e3e38b5ba667329493382b793477abb5d6
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed May 22 20:27:24 2013 -0400
Define block types for string, edit text and formula cell elements.
Also, remove the custom_ prefix from block names.
Change-Id: If3dfdbdacc2d0113fa8d631bec7a914b51668115
diff --git a/sc/inc/columniterator.hxx b/sc/inc/columniterator.hxx
index 69929aa..f15d6d5 100644
--- a/sc/inc/columniterator.hxx
+++ b/sc/inc/columniterator.hxx
@@ -21,8 +21,8 @@ class ScColumnTextWidthIterator : boost::noncopyable
size_t mnCurPos;
sc::CellTextAttrStoreType::iterator miBlockCur;
sc::CellTextAttrStoreType::iterator miBlockEnd;
- sc::custom_celltextattr_block::iterator miDataCur;
- sc::custom_celltextattr_block::iterator miDataEnd;
+ sc::celltextattr_block::iterator miDataCur;
+ sc::celltextattr_block::iterator miDataEnd;
public:
ScColumnTextWidthIterator(ScColumn& rCol, SCROW nStartRow, SCROW nEndRow);
diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx
index 1628381..941c1a24a 100644
--- a/sc/inc/mtvelements.hxx
+++ b/sc/inc/mtvelements.hxx
@@ -11,7 +11,9 @@
#define SC_MTVELEMENTS_HXX
#include "address.hxx"
+#include "formulacell.hxx"
#include "svl/broadcast.hxx"
+#include "editeng/editobj.hxx"
#define DEBUG_COLUMN_STORAGE 0
@@ -25,6 +27,7 @@
#include <mdds/multi_type_vector_macro.hpp>
#include <mdds/multi_type_vector.hpp>
#include <mdds/multi_type_vector_custom_func1.hpp>
+#include <mdds/multi_type_vector_custom_func3.hpp>
#include <boost/unordered_map.hpp>
@@ -47,29 +50,53 @@ struct CellTextAttr
const mdds::mtv::element_t element_type_broadcaster = mdds::mtv::element_type_user_start;
const mdds::mtv::element_t element_type_celltextattr = mdds::mtv::element_type_user_start + 1;
+const mdds::mtv::element_t element_type_string = mdds::mtv::element_type_user_start + 2;
+const mdds::mtv::element_t element_type_edittext = mdds::mtv::element_type_user_start + 3;
+const mdds::mtv::element_t element_type_formula = mdds::mtv::element_type_user_start + 4;
+
+const mdds::mtv::element_t element_type_numeric = mdds::mtv::element_type_numeric;
+
// Custom element blocks.
-typedef mdds::mtv::noncopyable_managed_element_block<element_type_broadcaster, SvtBroadcaster> custom_broadcaster_block;
-typedef mdds::mtv::default_element_block<element_type_celltextattr, CellTextAttr> custom_celltextattr_block;
+typedef mdds::mtv::noncopyable_managed_element_block<element_type_broadcaster, SvtBroadcaster> broadcaster_block;
+typedef mdds::mtv::default_element_block<element_type_celltextattr, CellTextAttr> celltextattr_block;
+typedef mdds::mtv::default_element_block<element_type_string, rtl::OUString> string_block;
+typedef mdds::mtv::noncopyable_managed_element_block<element_type_edittext, EditTextObject> edittext_block;
+typedef mdds::mtv::noncopyable_managed_element_block<element_type_formula, ScFormulaCell> formula_block;
// This needs to be in the same namespace as CellTextAttr.
-MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(CellTextAttr, element_type_celltextattr, CellTextAttr(), custom_celltextattr_block)
+MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(CellTextAttr, element_type_celltextattr, CellTextAttr(), celltextattr_block)
}
-// This needs to be in global namespace just like SvtBroacaster is.
-MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(SvtBroadcaster, sc::element_type_broadcaster, NULL, sc::custom_broadcaster_block)
+// These need to be in global namespace just like their respective types are.
+MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(SvtBroadcaster, sc::element_type_broadcaster, NULL, sc::broadcaster_block)
+MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(ScFormulaCell, sc::element_type_formula, NULL, sc::formula_block)
+MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(EditTextObject, sc::element_type_edittext, NULL, sc::edittext_block)
+
+namespace rtl {
+
+MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(OUString, sc::element_type_string, OUString(), sc::string_block)
+
+}
namespace sc {
// Broadcaster storage container
-typedef mdds::mtv::custom_block_func1<sc::element_type_broadcaster, sc::custom_broadcaster_block> BCBlkFunc;
+typedef mdds::mtv::custom_block_func1<sc::element_type_broadcaster, sc::broadcaster_block> BCBlkFunc;
typedef mdds::multi_type_vector<BCBlkFunc> BroadcasterStoreType;
// Cell text attribute container.
-typedef mdds::mtv::custom_block_func1<sc::element_type_celltextattr, sc::custom_celltextattr_block> CTAttrFunc;
+typedef mdds::mtv::custom_block_func1<sc::element_type_celltextattr, sc::celltextattr_block> CTAttrFunc;
typedef mdds::multi_type_vector<CTAttrFunc> CellTextAttrStoreType;
+// Cell container
+typedef mdds::mtv::custom_block_func3<
+ sc::element_type_string, sc::string_block,
+ sc::element_type_edittext, sc::edittext_block,
+ sc::element_type_formula, sc::formula_block> CellFunc;
+typedef mdds::multi_type_vector<CellFunc> CellStoreType;
+
/**
* Store position data for column array storage.
*/
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index eec2b96..e43b84b 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1432,7 +1432,7 @@ void ScColumn::CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& r
nRowPos = static_cast<size_t>(nRow2); // End row position.
// Keep copying until we hit the end row position.
- sc::custom_celltextattr_block::const_iterator itData, itDataEnd;
+ sc::celltextattr_block::const_iterator itData, itDataEnd;
for (; itBlk != itBlkEnd; ++itBlk, nBlockStart = nBlockEnd, nOffsetInBlock = 0)
{
nBlockEnd = nBlockStart + itBlk->size;
@@ -1449,15 +1449,15 @@ void ScColumn::CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& r
}
// Non-empty block.
- itData = sc::custom_celltextattr_block::begin(*itBlk->data);
- itDataEnd = sc::custom_celltextattr_block::end(*itBlk->data);
+ itData = sc::celltextattr_block::begin(*itBlk->data);
+ itDataEnd = sc::celltextattr_block::end(*itBlk->data);
std::advance(itData, nOffsetInBlock);
if (nBlockStart <= nRowPos && nRowPos <= nBlockEnd)
{
// This block contains the end row. Only copy partially.
size_t nOffset = nRowPos - nBlockStart + 1;
- itDataEnd = sc::custom_celltextattr_block::begin(*itBlk->data);
+ itDataEnd = sc::celltextattr_block::begin(*itBlk->data);
std::advance(itDataEnd, nOffset);
rDestCol.maCellTextAttrs.set(nBlockStart + nOffsetInBlock, itData, itDataEnd);
@@ -1652,8 +1652,8 @@ sal_uInt8 ScColumn::GetRangeScriptType(
if (itPos->type == sc::element_type_celltextattr)
{
- sc::custom_celltextattr_block::iterator it = sc::custom_celltextattr_block::begin(*itPos->data);
- sc::custom_celltextattr_block::iterator itEnd = sc::custom_celltextattr_block::end(*itPos->data);
+ sc::celltextattr_block::iterator it = sc::celltextattr_block::begin(*itPos->data);
+ sc::celltextattr_block::iterator itEnd = sc::celltextattr_block::end(*itPos->data);
std::advance(it, aRet.second);
for (; it != itEnd; ++it, ++nRow)
{
@@ -1684,8 +1684,8 @@ sal_uInt8 ScColumn::GetRangeScriptType(
continue;
}
- sc::custom_celltextattr_block::iterator it = sc::custom_celltextattr_block::begin(*itPos->data);
- sc::custom_celltextattr_block::iterator itEnd = sc::custom_celltextattr_block::end(*itPos->data);
+ sc::celltextattr_block::iterator it = sc::celltextattr_block::begin(*itPos->data);
+ sc::celltextattr_block::iterator itEnd = sc::celltextattr_block::end(*itPos->data);
for (; it != itEnd; ++it, ++nRow)
{
if (nRow > nRow2)
@@ -2030,7 +2030,7 @@ void startListening(
case sc::element_type_broadcaster:
{
// Broadcaster already exists here.
- SvtBroadcaster* pBC = sc::custom_broadcaster_block::at(*itBlockPos->data, nElemPos);
+ SvtBroadcaster* pBC = sc::broadcaster_block::at(*itBlockPos->data, nElemPos);
rLst.StartListening(*pBC);
}
break;
@@ -2123,7 +2123,7 @@ void ScColumn::EndListening( sc::EndListeningContext& rCxt, SCROW nRow, SvtListe
if (it->type != sc::element_type_broadcaster)
return;
- SvtBroadcaster* pBC = sc::custom_broadcaster_block::at(*it->data, aPos.second);
+ SvtBroadcaster* pBC = sc::broadcaster_block::at(*it->data, aPos.second);
OSL_ASSERT(pBC);
rListener.EndListening(*pBC);
diff --git a/sc/source/core/data/columniterator.cxx b/sc/source/core/data/columniterator.cxx
index ec4b927..6b5c1a4 100644
--- a/sc/source/core/data/columniterator.cxx
+++ b/sc/source/core/data/columniterator.cxx
@@ -147,11 +147,11 @@ void ScColumnTextWidthIterator::getDataIterators(size_t nOffsetInBlock)
OSL_ENSURE(miBlockCur != miBlockEnd, "block is at end position");
#if 0
// Does not compile
- OSL_ENSURE(miBlockCur->type == sc::custom_celltextattr_block,
+ OSL_ENSURE(miBlockCur->type == sc::celltextattr_block,
"wrong block type - unsigned short block expected.");
#endif
- miDataCur = sc::custom_celltextattr_block::begin(*miBlockCur->data);
- miDataEnd = sc::custom_celltextattr_block::end(*miBlockCur->data);
+ miDataCur = sc::celltextattr_block::begin(*miBlockCur->data);
+ miDataEnd = sc::celltextattr_block::end(*miBlockCur->data);
std::advance(miDataCur, nOffsetInBlock);
}
More information about the Libreoffice-commits
mailing list