diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-07 23:12:55 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-11 22:33:32 -0500 |
commit | a112251d748ab74c5254e7e0ad1c8f3fb3d67b70 (patch) | |
tree | 69722e23ff099193a227767cd48ac7f17e3411e0 | |
parent | 4dab3a66173916ea7018abad84530aa820d4eb5e (diff) |
Import multi-line content into ScEditCell.
Change-Id: I4fc53ddb888ff31a78dc233dd487f0e70daa6522
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 2272e988862d..abe8353f8cfa 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -676,6 +676,27 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const } } +namespace { + +ScBaseCell* createEditCell(ScDocument* pDoc, const std::vector<OUString>& rParagraphs) +{ + // Create edit cell. + OUStringBuffer aBuf; + std::vector<OUString>::const_iterator it = rParagraphs.begin(), itEnd = rParagraphs.end(); + bool bFirst = true; + for (; it != itEnd; ++it) + { + if (bFirst) + bFirst = false; + else + aBuf.append('\n'); + aBuf.append(*it); + } + return ScBaseCell::CreateTextCell(aBuf.makeStringAndClear(), pDoc); +} + +} + void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos, const SCCOL nCurrentCol, const ::boost::optional< rtl::OUString >& pOUText ) { @@ -728,7 +749,7 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos, if (maStringValue) pNewCell = ScBaseCell::CreateTextCell( *maStringValue, pDoc ); else if (!maParagraphs.empty()) - pNewCell = ScBaseCell::CreateTextCell(maParagraphs.back(), pDoc); + pNewCell = createEditCell(pDoc, maParagraphs); else if ( nCurrentCol > 0 && pOUText && !pOUText->isEmpty() ) pNewCell = ScBaseCell::CreateTextCell( *pOUText, pDoc ); |