diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-27 20:35:34 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-28 01:12:50 -0400 |
commit | 49f9492358944b45cb9878aea0d6158df8301869 (patch) | |
tree | 235a79143c5a0815ad2559794f6f594430b26db5 /sc/source/core/data/attarray.cxx | |
parent | f861f02ac9eadd9b3ab9f0b6c3c42e570805f537 (diff) |
attrarray.cxx is now free of ScBaseCell.
Change-Id: I9a323062fc341ef5fc20f2922503a88f3a45ce0d
Diffstat (limited to 'sc/source/core/data/attarray.cxx')
-rw-r--r-- | sc/source/core/data/attarray.cxx | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 9d1996aac3f2..29522130e0f1 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include "attarray.hxx" #include "scitems.hxx" #include <svx/algitem.hxx> #include <editeng/boxitem.hxx> @@ -29,7 +30,6 @@ #include <editeng/fontitem.hxx> #include <unotools/fontcvt.hxx> -#include "attarray.hxx" #include "global.hxx" #include "document.hxx" #include "docpool.hxx" @@ -41,6 +41,8 @@ #include "globstr.hrc" #include "segmenttree.hxx" #include "cell.hxx" +#include "cellvalue.hxx" +#include "editutil.hxx" #include <rtl/strbuf.hxx> // STATIC DATA ----------------------------------------------------------- @@ -352,20 +354,24 @@ void ScAttrArray::RemoveCellCharAttribs( SCROW nStartRow, SCROW nEndRow, { for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow) { - ScBaseCell* pCell; - pDocument->GetCell(nCol, nRow, nTab, pCell); - if (pCell && pCell->GetCellType() == CELLTYPE_EDIT) + ScAddress aPos(nCol, nRow, nTab); + ScRefCellValue aCell; + aCell.assign(*pDocument, aPos); + if (aCell.meType != CELLTYPE_EDIT || !aCell.mpEditText) + continue; + + EditTextObject* pOldData = NULL; + if (pDataArray) + pOldData = aCell.mpEditText->Clone(); + + // Direct modification of cell content - something to watch out for if + // we decide to share edit text instances in the future. + ScEditUtil::RemoveCharAttribs(const_cast<EditTextObject&>(*aCell.mpEditText), *pPattern); + + if (pDataArray) { - EditTextObject* pOldData = NULL; - ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell); - if (pDataArray) - pOldData = pEditCell->GetData()->Clone(); - pEditCell->RemoveCharAttribs(*pPattern); - if (pDataArray) - { - EditTextObject* pNewData = pEditCell->GetData()->Clone(); - pDataArray->AddItem(nTab, nCol, nRow, pOldData, pNewData); - } + EditTextObject* pNewData = aCell.mpEditText->Clone(); + pDataArray->AddItem(nTab, nCol, nRow, pOldData, pNewData); } } } |