summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-04-15 10:12:58 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-04-15 10:15:40 -0400
commita0752fa4246dc71b64907c679657a1af3cb617e1 (patch)
tree8fbeccf1eb3056628ff1003c8c240f1da91af292
parentc21f2497c6339f0c456e4a0dae24962bfbb5eda3 (diff)
fdo#76409: Write output cell string to <text:p> element when saving to ods.
The change was made by accident. Change-Id: Ife2461b0fca6e3ea5a65d72d985d1e0976737b5a
-rw-r--r--sc/inc/cellform.hxx3
-rw-r--r--sc/source/core/tool/cellform.cxx32
-rw-r--r--sc/source/filter/xml/XMLExportIterator.cxx3
-rw-r--r--sc/source/filter/xml/XMLExportIterator.hxx4
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx9
5 files changed, 47 insertions, 4 deletions
diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx
index 1f6b13a9254a..caea246ca2c3 100644
--- a/sc/inc/cellform.hxx
+++ b/sc/inc/cellform.hxx
@@ -54,6 +54,9 @@ public:
static void GetInputString(
ScRefCellValue& rCell, sal_uLong nFormat, OUString& rString, SvNumberFormatter& rFormatter,
const ScDocument* pDoc );
+
+ static OUString GetOutputString(
+ ScDocument& rDoc, const ScAddress& rPos, ScRefCellValue& rCell );
};
#endif
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 3e155173cdc6..804088dcfcf6 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -29,6 +29,7 @@
#include "cellvalue.hxx"
#include "formula/errorcodes.hxx"
#include "sc.hrc"
+#include <editutil.hxx>
// STATIC DATA
// Err527 Workaround
@@ -268,4 +269,35 @@ void ScCellFormat::GetInputString(
rString = aString;
}
+OUString ScCellFormat::GetOutputString( ScDocument& rDoc, const ScAddress& rPos, ScRefCellValue& rCell )
+{
+ if (rCell.isEmpty())
+ return EMPTY_OUSTRING;
+
+ OUString aVal;
+
+ if (rCell.meType == CELLTYPE_EDIT)
+ {
+ // GetString an der EditCell macht Leerzeichen aus Umbruechen,
+ // hier werden die Umbrueche aber gebraucht
+ const EditTextObject* pData = rCell.mpEditText;
+ if (pData)
+ {
+ ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
+ rEngine.SetText(*pData);
+ aVal = rEngine.GetText(LINEEND_LF);
+ }
+ // Edit-Zellen auch nicht per NumberFormatter formatieren
+ // (passend zur Ausgabe)
+ }
+ else
+ {
+ // wie in GetString am Dokument (column)
+ Color* pColor;
+ sal_uLong nNumFmt = rDoc.GetNumberFormat(rPos);
+ aVal = GetString(rDoc, rPos, nNumFmt, &pColor, *rDoc.GetFormatTable());
+ }
+ return aVal;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx
index 4ec1be58a976..ff0b41950dcd 100644
--- a/sc/source/filter/xml/XMLExportIterator.cxx
+++ b/sc/source/filter/xml/XMLExportIterator.cxx
@@ -641,10 +641,11 @@ void ScMyNotEmptyCellsIterator::UpdateAddress( table::CellAddress& rAddress )
}
}
-void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& rMyCell, table::CellAddress& rAddress )
+void ScMyNotEmptyCellsIterator::SetCellData( ScMyCell& rMyCell, const table::CellAddress& rAddress )
{
rMyCell.maBaseCell.clear();
rMyCell.aCellAddress = rAddress;
+ ScUnoConversion::FillScAddress(rMyCell.maCellAddress, rMyCell.aCellAddress);
if( (nCellCol == rAddress.Column) && (nCellRow == rAddress.Row) )
{
diff --git a/sc/source/filter/xml/XMLExportIterator.hxx b/sc/source/filter/xml/XMLExportIterator.hxx
index 0275dd37f7fa..e2180e9873e8 100644
--- a/sc/source/filter/xml/XMLExportIterator.hxx
+++ b/sc/source/filter/xml/XMLExportIterator.hxx
@@ -278,6 +278,8 @@ public:
// contains data to export for the current cell position
struct ScMyCell
{
+ ScAddress maCellAddress; /// Use this instead of the UNO one.
+
com::sun::star::table::CellAddress aCellAddress;
com::sun::star::table::CellRangeAddress aMergeRange;
com::sun::star::table::CellRangeAddress aMatrixRange;
@@ -336,7 +338,7 @@ class ScMyNotEmptyCellsIterator : boost::noncopyable
SCTAB nCurrentTable;
void UpdateAddress( ::com::sun::star::table::CellAddress& rAddress );
- void SetCellData( ScMyCell& rMyCell, ::com::sun::star::table::CellAddress& rAddress );
+ void SetCellData( ScMyCell& rMyCell, const css::table::CellAddress& rAddress );
void HasAnnotation( ScMyCell& aCell );
public:
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 89badd5c01e7..2603d0585d94 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -67,6 +67,7 @@
#include <datastream.hxx>
#include <documentlinkmgr.hxx>
#include <tokenstringcontext.hxx>
+#include <cellform.hxx>
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmlnmspe.hxx>
@@ -3287,8 +3288,12 @@ void ScXMLExport::WriteCell(ScMyCell& aCell, sal_Int32 nEqualCellCount)
else
{
SvXMLElementExport aElemP(*this, sElemP, true, false);
- bool bPrevCharWasSpace(true);
- GetTextParagraphExport()->exportText(aCell.maBaseCell.getString(pDoc), bPrevCharWasSpace);
+
+ OUString aParaStr =
+ ScCellFormat::GetOutputString(*pDoc, aCell.maCellAddress, aCell.maBaseCell);
+
+ bool bPrevCharWasSpace = true;
+ GetTextParagraphExport()->exportText(aParaStr, bPrevCharWasSpace);
}
}
WriteShapes(aCell);