summaryrefslogtreecommitdiff
path: root/sc/source/core/data/column.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-06-13 11:12:50 -0400
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-06-23 15:02:14 +0000
commit22cd19eeeb476c40b68bb1ff040fce6103fdeba4 (patch)
treec4550dfcfbc10ebb75e3b6130ca44d44a28484ec /sc/source/core/data/column.cxx
parenta28256553dcc29d67c530b29727bfbf3ba6aa81a (diff)
fdo#71076, fdo#71767: Preserve number formats when charts are copied.
(cherry picked from commit 1d38cb365543924f9c50014e6b2227e77de1d0c9) Conflicts: sd/source/ui/view/sdview3.cxx xmloff/source/chart/SchXMLExport.cxx Change-Id: If5ae8852152012483237e7602e56a0c46ea8748a Reviewed-on: https://gerrit.libreoffice.org/9836 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/source/core/data/column.cxx')
-rw-r--r--sc/source/core/data/column.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index f0dc03af9be9..3e4c4ae87633 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1048,7 +1048,8 @@ void ScColumn::CopyToClip(
rColumn.CellStorageModified();
}
-void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol)
+void ScColumn::CopyStaticToDocument(
+ SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol )
{
if (nRow1 > nRow2)
return;
@@ -1157,6 +1158,17 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol
break;
}
+ // Dont' forget to copy the number formats over. Charts may reference them.
+ for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
+ {
+ sal_uInt32 nNumFmt = GetNumberFormat(nRow);
+ SvNumberFormatterMergeMap::const_iterator itNum = rMap.find(nNumFmt);
+ if (itNum != rMap.end())
+ nNumFmt = itNum->second;
+
+ rDestCol.SetNumberFormat(nRow, nNumFmt);
+ }
+
rDestCol.CellStorageModified();
}