summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorDennis Francis <dennisfrancis.in@gmail.com>2016-02-13 02:29:12 +0530
committerEike Rathke <erack@redhat.com>2016-03-14 18:32:00 +0000
commit4c9b861e43ea6efc193107a25def6a748994ad5b (patch)
tree0de7ac77a82fb257ca1a92a28216ded7171ea1d5 /sc/source
parent620a1351a7627246f139a54a8cc3b35fa7ef8434 (diff)
tdf#94561 : Create notes drawing objects only once on sheet copy
Skip copying notes in CopyToColumn() and then call CopyCellNotesToDocument() only after copying hidden rows and filtered rows info. Skip copying notes drawing objects in ScDocument::DrawCopyPage() when inside ScDocument::CopyTab(). Change-Id: I38296bb5d1cc062d473ea4a5a3143f6c1787fc4a Reviewed-on: https://gerrit.libreoffice.org/22331 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 7c0f6b9d0fb8d7d9e54865ccf1047bb8f8148101) Reviewed-on: https://gerrit.libreoffice.org/23122
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/documen2.cxx4
-rw-r--r--sc/source/core/data/documen9.cxx4
-rw-r--r--sc/source/core/data/drwlayer.cxx7
-rw-r--r--sc/source/core/data/table2.cxx16
4 files changed, 25 insertions, 6 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index d27a5e6d63c3..f43636393d9b 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -897,8 +897,8 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM
sc::SetFormulaDirtyContext aFormulaDirtyCxt;
SetAllFormulasDirty(aFormulaDirtyCxt);
- if (pDrawLayer)
- DrawCopyPage( static_cast<sal_uInt16>(nOldPos), static_cast<sal_uInt16>(nNewPos) );
+ if (pDrawLayer) // Skip cloning Note caption object
+ DrawCopyPage( static_cast<sal_uInt16>(nOldPos), static_cast<sal_uInt16>(nNewPos), true );
if (pDPCollection)
pDPCollection->CopyToTab(nOldPos, nNewPos);
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index e438b1e4d4c1..3185a2d68e02 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -261,10 +261,10 @@ void ScDocument::DrawMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos )
pDrawLayer->ScMovePage(nOldPos,nNewPos);
}
-void ScDocument::DrawCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos )
+void ScDocument::DrawCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos, bool bSkipNotes )
{
// page is already created in ScTable ctor
- pDrawLayer->ScCopyPage( nOldPos, nNewPos );
+ pDrawLayer->ScCopyPage( nOldPos, nNewPos, bSkipNotes );
}
void ScDocument::DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index dbf1fe7285f1..2886926d3386 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -434,7 +434,7 @@ void ScDrawLayer::ScMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos )
ResetTab(nMinPos, pDoc->GetTableCount()-1);
}
-void ScDrawLayer::ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos)
+void ScDrawLayer::ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos, bool bSkipNotes )
{
if (bDrawIsInUndo)
return;
@@ -453,6 +453,11 @@ void ScDrawLayer::ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos)
SdrObject* pOldObject = aIter.Next();
while (pOldObject)
{
+ if ( bSkipNotes && IsNoteCaption( pOldObject ) )
+ {
+ pOldObject = aIter.Next();
+ continue;
+ }
ScDrawObjData* pOldData = GetObjData(pOldObject);
if (pOldData)
{
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 11c0d58c7bd9..24fde8a7205f 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1081,9 +1081,13 @@ void ScTable::CopyToTable(
return;
if (nFlags != InsertDeleteFlags::NONE)
+ {
+ InsertDeleteFlags nTempFlags( nFlags &
+ ~InsertDeleteFlags( InsertDeleteFlags::NOTE | InsertDeleteFlags::ADDNOTES));
for (SCCOL i = nCol1; i <= nCol2; i++)
- aCol[i].CopyToColumn(rCxt, nRow1, nRow2, nFlags, bMarked,
+ aCol[i].CopyToColumn(rCxt, nRow1, nRow2, nTempFlags, bMarked,
pDestTab->aCol[i], pMarkData, bAsLink);
+ }
if (!bColRowFlags) // Column widths/Row heights/Flags
return;
@@ -1190,6 +1194,16 @@ void ScTable::CopyToTable(
if(nFlags & InsertDeleteFlags::OUTLINE) // also only when bColRowFlags
pDestTab->SetOutlineTable( pOutlineTable );
+
+ if (nFlags & (InsertDeleteFlags::NOTE|InsertDeleteFlags::ADDNOTES))
+ {
+ bool bCloneCaption = (nFlags & InsertDeleteFlags::NOCAPTIONS) == InsertDeleteFlags::NONE;
+ for (SCCOL i = nCol1; i <= nCol2; i++)
+ {
+ aCol[i].CopyCellNotesToDocument(nRow1, nRow2, pDestTab->aCol[i], bCloneCaption);
+ pDestTab->aCol[i].UpdateNoteCaptions(nRow1, nRow2);
+ }
+ }
}
void ScTable::UndoToTable(