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

Laurent Godard lgodard.libre at laposte.net
Mon Oct 7 04:44:43 PDT 2013


 sc/inc/document.hxx               |    4 +--
 sc/source/filter/excel/excdoc.cxx |   40 +++++++++++++++++++++++++++-----------
 sc/source/ui/navipi/content.cxx   |    1 
 3 files changed, 31 insertions(+), 14 deletions(-)

New commits:
commit 7b9a38f7755855f07e4cc7a58378162bbbf43816
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Mon Oct 7 13:43:42 2013 +0200

    excel notes export
    
    Change-Id: I3ba9b1ab45803ab2b51d727596d0702181375476

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index d681728..e1c13c5 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -895,17 +895,17 @@ public:
     /** Notes **/
     SC_DLLPUBLIC ScPostIt*       GetNote(const ScAddress& rPos);
     SC_DLLPUBLIC ScPostIt*       GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
-    sc::CellNoteStoreType&       GetColNotes(SCCOL nCol, SCTAB nTab);
     void                         SetNote(const ScAddress& rPos, ScPostIt* pNote);
     void                         SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt* pNote);
     bool                         HasNote(const ScAddress& rPos);
     bool                         HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
-    bool                         HasColNotes(SCCOL nCol, SCTAB nTab);
+    SC_DLLPUBLIC bool            HasColNotes(SCCOL nCol, SCTAB nTab);
     SC_DLLPUBLIC ScPostIt*       ReleaseNote(const ScAddress& rPos);
     SC_DLLPUBLIC ScPostIt*       ReleaseNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
     SC_DLLPUBLIC ScPostIt*       GetOrCreateNote(const ScAddress& rPos);
     SC_DLLPUBLIC ScPostIt*       CreateNote(const ScAddress& rPos);
     sal_uLong                    CountNotes();
+    SC_DLLPUBLIC sc::CellNoteStoreType&  GetColNotes(SCCOL nCol, SCTAB nTab);
 
     SC_DLLPUBLIC void            SetDrawPageSize(SCTAB nTab);
 
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index 8cece42..3846dbc 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -417,17 +417,35 @@ void ExcTable::FillAsTable( SCTAB nCodeNameIdx )
     mxCellTable.reset( new XclExpCellTable( GetRoot() ) );
 
     //export cell notes
-/* TODO : notes
-    ScNotes::iterator itr = rDoc.GetNotes(mnScTab)->begin();
-    ScNotes::iterator itrEnd = rDoc.GetNotes(mnScTab)->end();
-    for (; itr != itrEnd; ++itr)
-    {
-        // notes
-        const ScPostIt* pScNote = itr->second;
-        ScAddress aScPos( itr->first.first, itr->first.second, mnScTab );
-        mxNoteList->AppendNewRecord( new XclExpNote( GetRoot(), aScPos, pScNote, OUString() ) );
-    }
-*/
+        for (SCCOL nCol=0; nCol<MAXCOLCOUNT; nCol++)
+        {
+            if ( rDoc.HasColNotes(nCol, mnScTab) )
+            {
+                sc::CellNoteStoreType& maCellNotes = rDoc.GetColNotes(nCol, mnScTab);
+
+                sc::CellNoteStoreType::const_iterator itBlk = maCellNotes.begin(), itBlkEnd = maCellNotes.end();
+                sc::cellnote_block::const_iterator itData, itDataEnd;
+
+                for(;itBlk != itBlkEnd; ++itBlk)
+                {
+                    if (itBlk->data)
+                    {
+                        SCROW nRow = itBlk->position;
+                        itData = sc::cellnote_block::begin(*itBlk->data);
+                        itDataEnd = sc::cellnote_block::end(*itBlk->data);
+                        for (; itData != itDataEnd; ++itData, ++nRow)
+                        {
+                            ScPostIt* pScNote = *itData;
+                            if (pScNote)
+                            {
+                                ScAddress aScPos( nCol, nRow, mnScTab );
+                                mxNoteList->AppendNewRecord( new XclExpNote( GetRoot(), aScPos, pScNote, OUString() ) );
+                            }
+                        }
+                    }
+                }
+            }
+        }
 
     if( GetOutput() != EXC_OUTPUT_BINARY )
     {
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 8b65d0d..cb67b2a 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -932,7 +932,6 @@ ScAddress ScContentTree::GetNotePos( sal_uLong nIndex )
                             }
                         }
                     }
-
                 }
             }
         }


More information about the Libreoffice-commits mailing list