summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-05-09 17:49:24 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-05-20 20:13:04 -0400
commitc9bfa396e32b07d88eec742232636a517032b108 (patch)
tree75b9ee1bdddd9cbbddcdf63a4db38ba396b9cf1f
parentcb706bac6a02fcfb10c00e5473b5b4ac916c84c9 (diff)
Block definition for CellTextAttr.
This block will be used to merge the text width and script type vectors that are currently separate. Text widths and script types should really be stored together. Change-Id: I6783769cc03180b513319e0a98a0773bd20ba941
-rw-r--r--sc/Library_sc.mk1
-rw-r--r--sc/inc/cell.hxx4
-rw-r--r--sc/inc/globalnames.hxx4
-rw-r--r--sc/inc/mtvelements.hxx19
-rw-r--r--sc/source/core/data/documen6.cxx1
-rw-r--r--sc/source/core/data/mtvelements.cxx29
6 files changed, 52 insertions, 6 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 9383e30b721c..e628605c3c04 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -141,6 +141,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/data/globalx \
sc/source/core/data/markarr \
sc/source/core/data/markdata \
+ sc/source/core/data/mtvelements \
sc/source/core/data/olinetab \
sc/source/core/data/pagepar \
sc/source/core/data/patattr \
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 909c89d6f777..597feb85719c 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -29,10 +29,6 @@
#define USE_MEMPOOL
-// in addition to SCRIPTTYPE_... flags from scripttypeitem.hxx:
-// set (in nScriptType) if type has not been determined yet
-#define SC_SCRIPTTYPE_UNKNOWN 0x08
-
class ScDocument;
class EditTextObject;
class ScMatrix;
diff --git a/sc/inc/globalnames.hxx b/sc/inc/globalnames.hxx
index 384ab3f13d69..a7f00530d95c 100644
--- a/sc/inc/globalnames.hxx
+++ b/sc/inc/globalnames.hxx
@@ -19,6 +19,10 @@
#define DATE_TIME_FACTOR 86400.0
+// in addition to SCRIPTTYPE_... flags from scripttypeitem.hxx:
+// set (in nScriptType) if type has not been determined yet
+#define SC_SCRIPTTYPE_UNKNOWN 0x08
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx
index 41c5175c0e09..9fc5947ea2e1 100644
--- a/sc/inc/mtvelements.hxx
+++ b/sc/inc/mtvelements.hxx
@@ -7,8 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef SC_MTVBLOCKFUNC_HXX
-#define SC_MTVBLOCKFUNC_HXX
+#ifndef SC_MTVELEMENTS_HXX
+#define SC_MTVELEMENTS_HXX
#include "svl/broadcast.hxx"
@@ -17,13 +17,28 @@
namespace sc {
+struct CellTextAttr
+{
+ sal_uInt16 mnTextWidth;
+ sal_uInt8 mnScriptType;
+
+ CellTextAttr();
+ CellTextAttr(const CellTextAttr& r);
+ CellTextAttr(sal_uInt16 nTextWidth, sal_uInt8 nScriptType);
+};
+
// Custom element type IDs for multi_type_vector.
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;
// 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;
+
+// This needs to be in the same namespace as CellTextAttr.
+MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(CellTextAttr, element_type_celltextattr, CellTextAttr(), custom_celltextattr_block)
}
diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx
index fbd00bc61869..bd55fc4931b4 100644
--- a/sc/source/core/data/documen6.cxx
+++ b/sc/source/core/data/documen6.cxx
@@ -32,6 +32,7 @@
#include "scrdata.hxx"
#include "poolhelp.hxx"
#include "attrib.hxx"
+#include "globalnames.hxx"
using namespace com::sun::star;
diff --git a/sc/source/core/data/mtvelements.cxx b/sc/source/core/data/mtvelements.cxx
new file mode 100644
index 000000000000..45c06dd4506b
--- /dev/null
+++ b/sc/source/core/data/mtvelements.cxx
@@ -0,0 +1,29 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "mtvelements.hxx"
+#include "globalnames.hxx"
+
+namespace sc {
+
+CellTextAttr::CellTextAttr() :
+ mnTextWidth(TEXTWIDTH_DIRTY),
+ mnScriptType(SC_SCRIPTTYPE_UNKNOWN) {}
+
+CellTextAttr::CellTextAttr(const CellTextAttr& r) :
+ mnTextWidth(r.mnTextWidth),
+ mnScriptType(r.mnScriptType) {}
+
+CellTextAttr::CellTextAttr(sal_uInt16 nTextWidth, sal_uInt8 nScriptType) :
+ mnTextWidth(nTextWidth),
+ mnScriptType(nScriptType) {}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */