[Libreoffice-commits] core.git: Branch 'private/kohei/chart-bugs' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Wed Jun 18 12:22:26 PDT 2014
sc/inc/column.hxx | 6 +++++-
sc/inc/document.hxx | 1 +
sc/inc/table.hxx | 6 +++++-
sc/source/core/data/column.cxx | 12 ++++++++++--
sc/source/core/data/document.cxx | 6 +++++-
sc/source/core/data/table2.cxx | 5 +++--
6 files changed, 29 insertions(+), 7 deletions(-)
New commits:
commit df6e8ca0911dab7a2aa977dcb56c9faa74ea56bd
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Wed Jun 18 15:21:47 2014 -0400
Correctly map number formats when transferring them from one doc to another.
Change-Id: I7908ee84bfbe1ae2f53c0dd90b6d70503ac76312
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 547fd14..9bb6bd6 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -27,6 +27,7 @@
#include "types.hxx"
#include "mtvelements.hxx"
#include <formula/types.hxx>
+#include <svl/zforlist.hxx>
#include <set>
#include <vector>
@@ -232,7 +233,10 @@ public:
void CopyToClip(
sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const;
- void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol);
+
+ void CopyStaticToDocument(
+ SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol );
+
void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol );
bool InitBlockPosition( sc::ColumnBlockPosition& rBlockPos );
bool InitBlockPosition( sc::ColumnBlockConstPosition& rBlockPos ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index c00f55e..c1487c1 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -40,6 +40,7 @@
#include "calcconfig.hxx"
#include <tools/fract.hxx>
#include <tools/gen.hxx>
+#include <svl/zforlist.hxx>
#include <memory>
#include <map>
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 45f8912..b0d298b 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -412,7 +412,11 @@ public:
void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag);
void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable );
void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable );
- void CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab);
+
+ void CopyStaticToDocument(
+ SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const SvNumberFormatterMergeMap& rMap,
+ ScTable* pDestTab );
+
void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab );
bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 2c161f8..3e4c4ae 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;
@@ -1159,7 +1160,14 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol
// Dont' forget to copy the number formats over. Charts may reference them.
for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
- rDestCol.SetNumberFormat(nRow, GetNumberFormat(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();
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 928a478..65649f9 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2157,8 +2157,12 @@ void ScDocument::CopyStaticToDocument(const ScRange& rSrcRange, SCTAB nDestTab,
if (!pSrcTab || !pDestTab)
return;
+ pDestDoc->GetFormatTable()->MergeFormatter(*GetFormatTable());
+ SvNumberFormatterMergeMap aMap = pDestDoc->GetFormatTable()->ConvertMergeTableToMap();
+
pSrcTab->CopyStaticToDocument(
- rSrcRange.aStart.Col(), rSrcRange.aStart.Row(), rSrcRange.aEnd.Col(), rSrcRange.aEnd.Row(), pDestTab);
+ rSrcRange.aStart.Col(), rSrcRange.aStart.Row(), rSrcRange.aEnd.Col(), rSrcRange.aEnd.Row(),
+ aMap, pDestTab);
}
void ScDocument::CopyCellToDocument( const ScAddress& rSrcPos, const ScAddress& rDestPos, ScDocument& rDestDoc )
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index b16aaa2..4c75534 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -556,7 +556,8 @@ void ScTable::CopyToClip(
}
}
-void ScTable::CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab)
+void ScTable::CopyStaticToDocument(
+ SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScTable* pDestTab )
{
if (nCol1 > nCol2)
return;
@@ -565,7 +566,7 @@ void ScTable::CopyStaticToDocument(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW
{
ScColumn& rSrcCol = aCol[i];
ScColumn& rDestCol = pDestTab->aCol[i];
- rSrcCol.CopyStaticToDocument(nRow1, nRow2, rDestCol);
+ rSrcCol.CopyStaticToDocument(nRow1, nRow2, rMap, rDestCol);
}
}
More information about the Libreoffice-commits
mailing list