From dabeb3d643c0ebd2cb7fdce333d0e6248b1488ad Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 18 Jun 2013 15:36:19 -0400 Subject: Move ScEditDataArray out of cell.?xx and into its own files. Change-Id: I107cec7d70f4d00ff52cb071d69a615fbab8d9f2 --- sc/Library_sc.mk | 1 + sc/inc/cell.hxx | 42 --------------- sc/inc/editdataarray.hxx | 75 +++++++++++++++++++++++++++ sc/source/core/data/attarray.cxx | 2 +- sc/source/core/data/cell2.cxx | 70 ------------------------- sc/source/core/data/cellvalue.cxx | 1 - sc/source/core/data/column.cxx | 1 - sc/source/core/data/column2.cxx | 1 - sc/source/core/data/column3.cxx | 1 - sc/source/core/data/dociter.cxx | 1 - sc/source/core/data/documen2.cxx | 1 - sc/source/core/data/documen3.cxx | 1 - sc/source/core/data/documen4.cxx | 1 - sc/source/core/data/documen6.cxx | 1 - sc/source/core/data/documen7.cxx | 1 - sc/source/core/data/documen8.cxx | 1 - sc/source/core/data/document.cxx | 1 - sc/source/core/data/documentimport.cxx | 1 - sc/source/core/tool/editdataarray.cxx | 93 ++++++++++++++++++++++++++++++++++ sc/source/ui/undo/undoblk3.cxx | 2 +- 20 files changed, 171 insertions(+), 127 deletions(-) create mode 100644 sc/inc/editdataarray.hxx create mode 100644 sc/source/core/tool/editdataarray.cxx diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index d5495b345116..36f92c95e065 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -211,6 +211,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/core/tool/detfunc \ sc/source/core/tool/docoptio \ sc/source/core/tool/doubleref \ + sc/source/core/tool/editdataarray \ sc/source/core/tool/editutil \ sc/source/core/tool/filtopt \ sc/source/core/tool/formulagroup \ diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx index 860104b4e68e..aef29df7d94a 100644 --- a/sc/inc/cell.hxx +++ b/sc/inc/cell.hxx @@ -199,48 +199,6 @@ public: void UpdateFields(SCTAB nTab); }; -class ScEditDataArray -{ -public: - class Item - { - public: - explicit Item(SCTAB nTab, SCCOL nCol, SCROW nRow, - EditTextObject* pOldData, EditTextObject* pNewData); - ~Item(); - - const EditTextObject* GetOldData() const; - const EditTextObject* GetNewData() const; - SCTAB GetTab() const; - SCCOL GetCol() const; - SCROW GetRow() const; - - private: - Item(); // disabled - - private: - ::boost::shared_ptr mpOldData; - ::boost::shared_ptr mpNewData; - SCTAB mnTab; - SCCOL mnCol; - SCROW mnRow; - - }; - - ScEditDataArray(); - ~ScEditDataArray(); - - void AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow, - EditTextObject* pOldData, EditTextObject* pNewData); - - const Item* First(); - const Item* Next(); - -private: - ::std::vector::const_iterator maIter; - ::std::vector maArray; -}; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/editdataarray.hxx b/sc/inc/editdataarray.hxx new file mode 100644 index 000000000000..fdcccbdd3aae --- /dev/null +++ b/sc/inc/editdataarray.hxx @@ -0,0 +1,75 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef SC_EDITDATAARRAY_HXX +#define SC_EDITDATAARRAY_HXX + +#include "address.hxx" +#include "editeng/editobj.hxx" + +#include +#include + +class EditTextObject; + +class ScEditDataArray +{ +public: + class Item + { + public: + explicit Item(SCTAB nTab, SCCOL nCol, SCROW nRow, + EditTextObject* pOldData, EditTextObject* pNewData); + ~Item(); + + const EditTextObject* GetOldData() const; + const EditTextObject* GetNewData() const; + SCTAB GetTab() const; + SCCOL GetCol() const; + SCROW GetRow() const; + + private: + Item(); // disabled + + private: + ::boost::shared_ptr mpOldData; + ::boost::shared_ptr mpNewData; + SCTAB mnTab; + SCCOL mnCol; + SCROW mnRow; + + }; + + ScEditDataArray(); + ~ScEditDataArray(); + + void AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow, + EditTextObject* pOldData, EditTextObject* pNewData); + + const Item* First(); + const Item* Next(); + +private: + ::std::vector::const_iterator maIter; + ::std::vector maArray; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index d0cee2f409b7..e9bfa5969a41 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -40,7 +40,7 @@ #include "rechead.hxx" #include "globstr.hrc" #include "segmenttree.hxx" -#include "cell.hxx" +#include "editdataarray.hxx" #include "formulacell.hxx" #include "cellvalue.hxx" #include "editutil.hxx" diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx index 0d46036bf07c..450308611c93 100644 --- a/sc/source/core/data/cell2.cxx +++ b/sc/source/core/data/cell2.cxx @@ -153,74 +153,4 @@ void ScEditCell::SetTextObject( mpData = ScEditUtil::Clone(*pObject, *mpDoc); } -ScEditDataArray::ScEditDataArray() -{ -} - -ScEditDataArray::~ScEditDataArray() -{ -} - -void ScEditDataArray::AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow, - EditTextObject* pOldData, EditTextObject* pNewData) -{ - maArray.push_back(Item(nTab, nCol, nRow, pOldData, pNewData)); -} - -const ScEditDataArray::Item* ScEditDataArray::First() -{ - maIter = maArray.begin(); - if (maIter == maArray.end()) - return NULL; - return &(*maIter++); -} - -const ScEditDataArray::Item* ScEditDataArray::Next() -{ - if (maIter == maArray.end()) - return NULL; - return &(*maIter++); -} - -// ============================================================================ - -ScEditDataArray::Item::Item(SCTAB nTab, SCCOL nCol, SCROW nRow, - EditTextObject* pOldData, EditTextObject* pNewData) : - mnTab(nTab), - mnCol(nCol), - mnRow(nRow) -{ - mpOldData.reset(pOldData); - mpNewData.reset(pNewData); -} - -ScEditDataArray::Item::~Item() -{ -} - -const EditTextObject* ScEditDataArray::Item::GetOldData() const -{ - return mpOldData.get(); -} - -const EditTextObject* ScEditDataArray::Item::GetNewData() const -{ - return mpNewData.get(); -} - -SCTAB ScEditDataArray::Item::GetTab() const -{ - return mnTab; -} - -SCCOL ScEditDataArray::Item::GetCol() const -{ - return mnCol; -} - -SCROW ScEditDataArray::Item::GetRow() const -{ - return mnRow; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx index abc1bbc5d5aa..f9575d501294 100644 --- a/sc/source/core/data/cellvalue.cxx +++ b/sc/source/core/data/cellvalue.cxx @@ -10,7 +10,6 @@ #include "cellvalue.hxx" #include "document.hxx" #include "column.hxx" -#include "cell.hxx" #include "formulacell.hxx" #include "editeng/editobj.hxx" #include "editeng/editstat.hxx" diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 1ac6471e9f74..82ccdf9f2296 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -19,7 +19,6 @@ #include "column.hxx" #include "scitems.hxx" -#include "cell.hxx" #include "formulacell.hxx" #include "document.hxx" #include "docpool.hxx" diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 3044ca3e039c..c9b90b85ca17 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -19,7 +19,6 @@ #include "column.hxx" #include "scitems.hxx" -#include "cell.hxx" #include "formulacell.hxx" #include "document.hxx" #include "docpool.hxx" diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 021eba9bbf6d..885d94848b5f 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -20,7 +20,6 @@ #include "column.hxx" #include "scitems.hxx" -#include "cell.hxx" #include "formulacell.hxx" #include "document.hxx" #include "attarray.hxx" diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index b3dab8d331e4..7f72f7233a4f 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -25,7 +25,6 @@ #include "document.hxx" #include "table.hxx" #include "column.hxx" -#include "cell.hxx" #include "formulacell.hxx" #include "attarray.hxx" #include "patattr.hxx" diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 512a5b109f10..7046194e9bda 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -84,7 +84,6 @@ #include "formulaparserpool.hxx" #include "clipparam.hxx" #include "macromgr.hxx" -#include "cell.hxx" #include "formulacell.hxx" #include "clipcontext.hxx" diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 3c20d736dd7c..a49ea8344914 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -29,7 +29,6 @@ #include #include "document.hxx" #include "attrib.hxx" -#include "cell.hxx" #include "table.hxx" #include "rangenam.hxx" #include "dbdata.hxx" diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 0595e109121f..f59c119f5cc5 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -41,7 +41,6 @@ #include "externalrefmgr.hxx" #include "colorscale.hxx" #include "attrib.hxx" -#include "cell.hxx" #include "formulacell.hxx" #include "tokenarray.hxx" diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx index b08c5a9f1289..a165f97a31ef 100644 --- a/sc/source/core/data/documen6.cxx +++ b/sc/source/core/data/documen6.cxx @@ -26,7 +26,6 @@ #include #include "document.hxx" -#include "cell.hxx" #include "cellform.hxx" #include "patattr.hxx" #include "scrdata.hxx" diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index 1c3f66545834..459888aa76e1 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -22,7 +22,6 @@ #include "document.hxx" #include "brdcst.hxx" #include "bcaslot.hxx" -#include "cell.hxx" #include "formulacell.hxx" #include "formula/errorcodes.hxx" // errCircularReference #include "scerrors.hxx" diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 3a2030e682e3..ec797f176215 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -52,7 +52,6 @@ #include "global.hxx" #include "table.hxx" #include "column.hxx" -#include "cell.hxx" #include "poolhelp.hxx" #include "docpool.hxx" #include "stlpool.hxx" diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index d33711df9343..b9bc16d2db4d 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -73,7 +73,6 @@ #include "scresid.hxx" #include "hints.hxx" #include "detdata.hxx" -#include "cell.hxx" #include "dpobject.hxx" #include "detfunc.hxx" // for UpdateAllComments #include "scmod.hxx" diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx index c3be0338ccda..679e04f6b040 100644 --- a/sc/source/core/data/documentimport.cxx +++ b/sc/source/core/data/documentimport.cxx @@ -11,7 +11,6 @@ #include "document.hxx" #include "table.hxx" #include "column.hxx" -#include "cell.hxx" #include "formulacell.hxx" #include "docoptio.hxx" #include "globalnames.hxx" diff --git a/sc/source/core/tool/editdataarray.cxx b/sc/source/core/tool/editdataarray.cxx new file mode 100644 index 000000000000..85be62c4cbbb --- /dev/null +++ b/sc/source/core/tool/editdataarray.cxx @@ -0,0 +1,93 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "editdataarray.hxx" + +ScEditDataArray::ScEditDataArray() +{ +} + +ScEditDataArray::~ScEditDataArray() +{ +} + +void ScEditDataArray::AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow, + EditTextObject* pOldData, EditTextObject* pNewData) +{ + maArray.push_back(Item(nTab, nCol, nRow, pOldData, pNewData)); +} + +const ScEditDataArray::Item* ScEditDataArray::First() +{ + maIter = maArray.begin(); + if (maIter == maArray.end()) + return NULL; + return &(*maIter++); +} + +const ScEditDataArray::Item* ScEditDataArray::Next() +{ + if (maIter == maArray.end()) + return NULL; + return &(*maIter++); +} + +// ============================================================================ + +ScEditDataArray::Item::Item(SCTAB nTab, SCCOL nCol, SCROW nRow, + EditTextObject* pOldData, EditTextObject* pNewData) : + mnTab(nTab), + mnCol(nCol), + mnRow(nRow) +{ + mpOldData.reset(pOldData); + mpNewData.reset(pNewData); +} + +ScEditDataArray::Item::~Item() +{ +} + +const EditTextObject* ScEditDataArray::Item::GetOldData() const +{ + return mpOldData.get(); +} + +const EditTextObject* ScEditDataArray::Item::GetNewData() const +{ + return mpNewData.get(); +} + +SCTAB ScEditDataArray::Item::GetTab() const +{ + return mnTab; +} + +SCCOL ScEditDataArray::Item::GetCol() const +{ + return mnCol; +} + +SCROW ScEditDataArray::Item::GetRow() const +{ + return mnRow; +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index e38010663024..124251f07097 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -50,7 +50,7 @@ #include "docuno.hxx" #include "progress.hxx" #include "editutil.hxx" -#include "cell.hxx" +#include "editdataarray.hxx" // STATIC DATA --------------------------------------------------------------- -- cgit