[Libreoffice-commits] core.git: Branch 'feature/notes-refactoring' - sc/inc sc/source

Laurent Godard lgodard.libre at laposte.net
Fri Nov 22 03:38:25 PST 2013


 sc/inc/postit.hxx                 |    4 ++--
 sc/source/core/data/postit.cxx    |    3 +--
 sc/source/filter/xml/xmlannoi.cxx |    3 ++-
 sc/source/filter/xml/xmlexprt.cxx |   14 ++++++++++++++
 4 files changed, 19 insertions(+), 5 deletions(-)

New commits:
commit b374fa432a19986d920fb33bb18f4d7c05e10003
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Fri Nov 22 12:26:07 2013 +0100

    all notes are now exported
    
    put the caption of each note in draw layer
    slow both on export and subsquent import --> need to review
    
    Change-Id: Ie5484c83156f0f4de96f8012a466dd166312a41b

diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index d31dcfd..4b402fd 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -249,9 +249,9 @@ namespace sc {
 struct NoteEntry
 {
     ScAddress maPos;
-    const ScPostIt* mpNote;
+    ScPostIt* mpNote;
 
-    NoteEntry( const ScAddress& rPos, const ScPostIt* pNote );
+    NoteEntry( ScAddress& rPos, ScPostIt* pNote );
 };
 
 }
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 9d138cc..c7476fb 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -938,9 +938,8 @@ ScPostIt* ScNoteUtil::CreateNoteFromString(
 
 namespace sc {
 
-NoteEntry::NoteEntry( const ScAddress& rPos, const ScPostIt* pNote ) :
+NoteEntry::NoteEntry( ScAddress& rPos, ScPostIt* pNote ) :
     maPos(rPos), mpNote(pNote) {}
-
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/xml/xmlannoi.cxx b/sc/source/filter/xml/xmlannoi.cxx
index 7aa509c..c388aac 100644
--- a/sc/source/filter/xml/xmlannoi.cxx
+++ b/sc/source/filter/xml/xmlannoi.cxx
@@ -388,11 +388,12 @@ void ScXMLAnnotationContext::PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, const
     rFmt.maSelection.nStartPos = nBegin;
     rFmt.maSelection.nEndPos = nEnd;
 
+/*
     // Store the used text styles for export.
     ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData();
     ScAddress aCellPos = GetScImport().GetTables().GetCurrentCellPos();
     pSheetData->AddTextStyle(rStyleName, aCellPos, rFmt.maSelection);
-
+*/
     boost::scoped_ptr<SfxPoolItem> pPoolItem;
     sal_uInt16 nLastItemID = EE_CHAR_END + 1;
 
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index e317f58..3da5848 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -653,6 +653,18 @@ 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);
@@ -3692,6 +3704,8 @@ 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 );
 
         GetShapeExport()->exportShape(xShape, SEF_DEFAULT|SEF_EXPORT_ANNOTATION, NULL);


More information about the Libreoffice-commits mailing list