[Libreoffice-commits] core.git: Branch 'feature/notes-refactoring' - sc/inc sc/source
Laurent Godard
lgodard.libre at laposte.net
Fri Nov 22 05:55:10 PST 2013
sc/inc/document.hxx | 1 +
sc/source/core/data/document.cxx | 11 +++++++----
sc/source/filter/xml/xmlexprt.cxx | 25 ++++++++++++-------------
3 files changed, 20 insertions(+), 17 deletions(-)
New commits:
commit ef3d1f622e777828f488b67440e4cf4d796c01be
Author: Laurent Godard <lgodard.libre at laposte.net>
Date: Fri Nov 22 14:51:43 2013 +0100
refactoring notes iterator to create shape in DrawPage
Change-Id: I414b792139c8cd34c1850993573b4220febdeed7
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index fb3a175..a1d70b6 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -917,6 +917,7 @@ public:
SCROW GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const;
SC_DLLPUBLIC void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
+ SC_DLLPUBLIC void GetTabNoteEntries( SCTAB nTab, std::vector<sc::NoteEntry>& rNotes ) const;
SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab);
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index f8a6d92..503a9e8 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6202,12 +6202,15 @@ void ScDocument::GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const
{
for (size_t nTab = 0; nTab < maTabs.size(); ++nTab)
{
- const ScTable* pTab = maTabs[nTab];
- if (!pTab)
- continue;
+ GetTabNoteEntries(nTab, rNotes);
+ }
+}
+void ScDocument::GetTabNoteEntries( SCTAB nTab, std::vector<sc::NoteEntry>& rNotes ) const
+{
+ const ScTable* pTab = maTabs[nTab];
+ if (pTab)
pTab->GetAllNoteEntries(rNotes);
- }
}
void ScDocument::SetAutoNameCache( ScAutoNameCache* pCache )
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 3da5848..3f79ec4 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -653,18 +653,6 @@ void ScXMLExport::CollectSharedData(sal_Int32& nTableCount, sal_Int32& nShapesCo
pCellStyles->AddNewTable(nTableCount - 1);
- // create Note shape in draw page
- std::vector<sc::NoteEntry> aEntries;
- pDoc->GetAllNoteEntries(aEntries);
- std::vector<sc::NoteEntry>::const_iterator it = aEntries.begin(), itEnd = aEntries.end();
- for (; it != itEnd; ++it)
- {
- ScPostIt& rNote = *it->mpNote;
- ScAddress aPos = it->maPos;
- SdrCaptionObj* pCaption = rNote.GetOrCreateCaption(aPos);
- pDoc->GetDrawLayer()->GetPage( static_cast< sal_uInt16 >( aPos.Tab() ) )->InsertObject( pCaption );
- }
-
for (SCTAB nTable = 0; nTable < nTableCount; ++nTable)
{
nCurrentTable = sal::static_int_cast<sal_uInt16>(nTable);
@@ -672,6 +660,18 @@ void ScXMLExport::CollectSharedData(sal_Int32& nTableCount, sal_Int32& nShapesCo
if (!xDrawPageSupplier.is())
continue;
+ // create Note shape in draw page
+ std::vector<sc::NoteEntry> aEntries;
+ pDoc->GetTabNoteEntries(nTable, aEntries);
+ std::vector<sc::NoteEntry>::const_iterator it = aEntries.begin(), itEnd = aEntries.end();
+ for (; it != itEnd; ++it)
+ {
+ ScPostIt& rNote = *it->mpNote;
+ ScAddress aPos = it->maPos;
+ SdrCaptionObj* pCaption = rNote.GetOrCreateCaption(aPos);
+ pDoc->GetDrawLayer()->GetPage( static_cast< sal_uInt16 >( aPos.Tab() ) )->InsertObject( pCaption );
+ }
+
uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage());
ScMyDrawPage aDrawPage;
aDrawPage.bHasForms = false;
@@ -3704,7 +3704,6 @@ void ScXMLExport::WriteAnnotation(ScMyCell& rMyCell)
pCurrentCell = &rMyCell;
SdrCaptionObj* pNoteCaption = pNote->GetOrCreateCaption(aCellPos);
- // pDoc->GetDrawLayer()->GetPage( static_cast< sal_uInt16 >( aCellPos.Tab() ) )->InsertObject( pCaption );
Reference<drawing::XShape> xShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY );
More information about the Libreoffice-commits
mailing list