[Libreoffice-commits] .: 3 commits - sc/inc sc/qa sc/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Wed Feb 29 14:41:19 PST 2012


 sc/inc/cell.hxx                                              |   20 -
 sc/inc/column.hxx                                            |   17 
 sc/inc/document.hxx                                          |   16 
 sc/inc/postit.hxx                                            |   57 +++
 sc/inc/table.hxx                                             |   14 
 sc/qa/unit/filters-test.cxx                                  |    2 
 sc/qa/unit/ucalc.cxx                                         |   18 
 sc/source/core/data/cell.cxx                                 |   42 --
 sc/source/core/data/column.cxx                               |   11 
 sc/source/core/data/column2.cxx                              |   37 -
 sc/source/core/data/column3.cxx                              |  138 -------
 sc/source/core/data/document.cxx                             |   50 --
 sc/source/core/data/drwlayer.cxx                             |    2 
 sc/source/core/data/postit.cxx                               |  207 ++++++++++-
 sc/source/core/data/table1.cxx                               |   69 +++
 sc/source/core/data/table2.cxx                               |  174 +++++++--
 sc/source/core/data/table3.cxx                               |   17 
 sc/source/core/data/table6.cxx                               |   21 -
 sc/source/core/tool/detfunc.cxx                              |    2 
 sc/source/core/tool/interpr2.cxx                             |   22 -
 sc/source/filter/excel/excdoc.cxx                            |   17 
 sc/source/filter/excel/xetable.cxx                           |    6 
 sc/source/filter/inc/excdoc.hxx                              |    5 
 sc/source/filter/xml/xmlexprt.cxx                            |   18 
 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |    4 
 sc/source/ui/docshell/docfunc.cxx                            |    8 
 sc/source/ui/docshell/docsh.cxx                              |   12 
 sc/source/ui/drawfunc/futext3.cxx                            |    6 
 sc/source/ui/navipi/content.cxx                              |   37 +
 sc/source/ui/undo/undoblk3.cxx                               |    2 
 sc/source/ui/undo/undocell.cxx                               |   12 
 sc/source/ui/unoobj/cellsuno.cxx                             |   76 +---
 sc/source/ui/unoobj/docuno.cxx                               |   21 -
 sc/source/ui/unoobj/editsrc.cxx                              |    4 
 sc/source/ui/unoobj/notesuno.cxx                             |    4 
 sc/source/ui/view/cellsh.cxx                                 |   25 -
 sc/source/ui/view/cellsh1.cxx                                |    2 
 sc/source/ui/view/drawview.cxx                               |    2 
 sc/source/ui/view/gridwin.cxx                                |    2 
 sc/source/ui/view/gridwin5.cxx                               |    2 
 sc/source/ui/view/output.cxx                                 |   12 
 sc/source/ui/view/printfun.cxx                               |   26 -
 sc/source/ui/view/viewfun6.cxx                               |    2 
 43 files changed, 697 insertions(+), 544 deletions(-)

New commits:
commit 979cc1c00982f5cc20ad7da5276efe3ccb0bc36d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Feb 29 23:36:40 2012 +0100

    some more fixes to get note handling back
    
    there are still some issues that will be addressed in later commits

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 09c9f38..da09357 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -102,7 +102,7 @@ public:
 
     /** Returns a clone of this cell, clones cell note and caption object too
         (unless SC_CLONECELL_NOCAPTION flag is set). Broadcaster will not be cloned. */
-    ScBaseCell*     CloneWithNote( const ScAddress& rOwnPos, ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags = SC_CLONECELL_DEFAULT ) const;
+    ScBaseCell*     CloneWithNote( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags = SC_CLONECELL_DEFAULT ) const;
 
     /** Due to the fact that ScBaseCell does not have a vtable, this function
         deletes the cell by calling the appropriate d'tor of the derived class. */
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 11ac123..37285e7 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -240,7 +240,7 @@ ScBaseCell* ScBaseCell::CloneWithoutNote( ScDocument& rDestDoc, const ScAddress&
     return lclCloneCell( *this, rDestDoc, rDestPos, nCloneFlags );
 }
 
-ScBaseCell* ScBaseCell::CloneWithNote( const ScAddress& rOwnPos, ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags ) const
+ScBaseCell* ScBaseCell::CloneWithNote( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags ) const
 {
     ScBaseCell* pNewCell = lclCloneCell( *this, rDestDoc, rDestPos, nCloneFlags );
     return pNewCell;
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 4df060c..abee27e 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1219,7 +1219,7 @@ void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKee
         {
             aOwnPos.SetRow( maItems[i].nRow );
             aDestPos.SetRow( maItems[i].nRow );
-            ScBaseCell* pNewCell = maItems[i].pCell->CloneWithNote( aOwnPos, *rColumn.pDocument, aDestPos, nCloneFlags );
+            ScBaseCell* pNewCell = maItems[i].pCell->CloneWithNote( *rColumn.pDocument, aDestPos, nCloneFlags );
             rColumn.Append( aDestPos.Row(), pNewCell );
         }
     }
@@ -1347,7 +1347,7 @@ void ScColumn::CopyUpdated( const ScColumn& rPosCol, ScColumn& rDestCol ) const
         SCSIZE nThisIndex;
         if ( Search( aDestPos.Row(), nThisIndex ) )
         {
-            ScBaseCell* pNew = maItems[nThisIndex].pCell->CloneWithNote( aOwnPos, rDestDoc, aDestPos );
+            ScBaseCell* pNew = maItems[nThisIndex].pCell->CloneWithNote( rDestDoc, aDestPos );
             rDestCol.Insert( aDestPos.Row(), pNew );
         }
     }
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 50608c8..371f123 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -488,6 +488,9 @@ void ScTable::DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal
         }
     }
 
+    if (nDelFlag & IDF_CONTENTS)
+        maNotes.erase( nCol1, nRow1, nCol2, nRow2);
+
     if (IsStreamValid())
         // TODO: In the future we may want to check if the table has been
         // really modified before setting the stream invalid.
@@ -503,6 +506,16 @@ void ScTable::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark )
             aCol[i].DeleteSelection( nDelFlag, rMark );
     }
 
+    ScRangeList aRangeList;
+    rMark.FillRangeListWithMarks(&aRangeList, false);
+
+    for (size_t i = 0; i < aRangeList.size(); ++i)
+    {
+        ScRange* pRange = aRangeList[i];
+        if (nDelFlag & IDF_CONTENTS && pRange)
+            maNotes.erase(pRange->aStart.Col(), pRange->aStart.Row(), pRange->aEnd.Col(), pRange->aEnd.Row());
+    }
+
         //
         // Zellschutz auf geschuetzter Tabelle nicht setzen
         //
@@ -714,7 +727,7 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                     ScAddress aOwnPos( nCol, nRow, nTab );
                     if (pCell->GetCellType() == CELLTYPE_FORMULA)
                     {
-                        pNew = pCell->CloneWithNote( aOwnPos, *pDestDoc, aDestPos, SC_CLONECELL_STARTLISTENING );
+                        pNew = pCell->CloneWithNote( *pDestDoc, aDestPos, SC_CLONECELL_STARTLISTENING );
 
                         //  Referenzen drehen
                         //  bei Cut werden Referenzen spaeter per UpdateTranspose angepasst
@@ -724,7 +737,7 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                     }
                     else
                     {
-                        pNew = pCell->CloneWithNote( aOwnPos, *pDestDoc, aDestPos );
+                        pNew = pCell->CloneWithNote( *pDestDoc, aDestPos );
                     }
                 }
                 pTransClip->PutCell( static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1), pNew );
@@ -853,6 +866,17 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
     if (!bColRowFlags)      // Spaltenbreiten/Zeilenhoehen/Flags
         return;
 
+    //remove old notes
+    if (nFlags & IDF_CONTENTS)
+        pDestTab->maNotes.erase(nCol1, nRow1, nCol2, nRow2);
+
+    bool bAddNotes = nFlags & (IDF_NOTE | IDF_ADDNOTES);
+    if (bAddNotes)
+    {
+        bool bCloneCaption = (nFlags & IDF_NOCAPTIONS) == 0;
+        pDestTab->maNotes.CopyFromClip(maNotes, pDocument, nCol1, nRow1, nCol2, nRow2, 0, 0, pDestTab->nTab, bCloneCaption);
+    }
+
     if (pDBDataNoName)
     {
         ScDBData* pNewDBData = new ScDBData(*pDBDataNoName);
@@ -970,6 +994,17 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                 aCol[i].CopyToColumn(0, MAXROW, IDF_FORMULA, false, pDestTab->aCol[i]);
         }
 
+        //remove old notes
+        if (nFlags & IDF_CONTENTS)
+            pDestTab->maNotes.erase(nCol1, nRow1, nCol2, nRow2);
+
+        bool bAddNotes = nFlags & (IDF_NOTE | IDF_ADDNOTES);
+        if (bAddNotes)
+        {
+            bool bCloneCaption = (nFlags & IDF_NOCAPTIONS) == 0;
+            pDestTab->maNotes.CopyFromClip(maNotes, pDocument, nCol1, nRow1, nCol2, nRow2, 0, 0, pDestTab->nTab, bCloneCaption);
+        }
+
         if (bWidth||bHeight)
         {
             if (bWidth)
@@ -1473,8 +1508,18 @@ bool ScTable::IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
     bool bEmpty = true;
     for (SCCOL i=nCol1; i<=nCol2 && bEmpty; i++)
     {
-        //TODO:moggi
         bEmpty = aCol[i].IsEmptyBlock( nRow1, nRow2 );
+        if (!bIgnoreNotes)
+        {
+            for (ScNotes::const_iterator itr = maNotes.begin(); itr != maNotes.end() && bEmpty; ++itr)
+            {
+                SCCOL nCol = itr->first.first;
+                SCROW nRow = itr->first.second;
+
+                if (nCol >= nCol1 && nCol <= nCol2 && nRow >= nRow1 && nRow <= nRow2)
+                    bEmpty = false;
+            }
+        }
     }
     return bEmpty;
 }
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 0635eee..ca47dcb 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -1026,7 +1026,7 @@ bool ScTable::SearchRangeForAllEmptyCells(
                     if (pUndoDoc)
                     {
                         ScAddress aCellPos(nCol, nRow, nTab);
-                        pUndoDoc->PutCell(nCol, nRow, nTab, pCell->CloneWithNote(aCellPos, *pUndoDoc, aCellPos));
+                        pUndoDoc->PutCell(nCol, nRow, nTab, pCell->CloneWithNote(*pUndoDoc, aCellPos));
                     }
                     aCol[nCol].SetString(nRow, nTab, rSearchItem.GetReplaceString(), pDocument->GetAddressConvention());
                 }
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index b080ac0..c9233c5 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2178,7 +2178,6 @@ void ScOutputData::AddPDFNotes()
             for (SCCOL nX=nX1; nX<=nX2; nX++)
             {
                 CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1];
-                ScBaseCell* pCell = pInfo->pCell;
                 sal_Bool bIsMerged = false;
                 SCROW nY = pRowInfo[nArrY].nRowNo;
                 SCCOL nMergeX = nX;
@@ -2189,13 +2188,10 @@ void ScOutputData::AddPDFNotes()
                     // find start of merged cell
                     bIsMerged = sal_True;
                     pDoc->ExtendOverlapped( nMergeX, nMergeY, nX, nY, nTab );
-                    pCell = pDoc->GetCell( ScAddress(nMergeX,nMergeY,nTab) );
                     // use origin's pCell for NotePtr test below
                 }
 
-                //TODO: moggi search for a better way with new note handling
-                /*
-                if ( pCell && pCell->HasNote() && ( bIsMerged ||
+                if ( pDoc->GetNotes(nTab)->findByAddress(nMergeX, nMergeY) && ( bIsMerged ||
                         ( !pInfo->bHOverlapped && !pInfo->bVOverlapped ) ) )
                 {
                     long nNoteWidth = (long)( SC_CLIPMARK_SIZE * nPPTX );
@@ -2215,7 +2211,7 @@ void ScOutputData::AddPDFNotes()
                     if ( bLayoutRTL ? ( nMarkX >= 0 ) : ( nMarkX < nScrX+nScrW ) )
                     {
                         Rectangle aNoteRect( nMarkX, nPosY, nMarkX+nNoteWidth*nLayoutSign, nPosY+nNoteHeight );
-                        const ScPostIt* pNote = pCell->GetNote();
+                        const ScPostIt* pNote = pDoc->GetNotes(nTab)->findByAddress(nMergeX, nMergeY);
 
                         // Note title is the cell address (as on printed note pages)
                         String aTitle;
@@ -2234,7 +2230,6 @@ void ScOutputData::AddPDFNotes()
                         pPDFData->CreateNote( aNoteRect, aNote );
                     }
                 }
-                */
 
                 nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign;
             }
commit 33849f3fca52251eb7773802c78b6d8501921c37
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Feb 28 03:21:10 2012 +0100

    remove mpNote: fix copy/paste

diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index fb40347..16746d6 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -311,6 +311,8 @@ public:
     ScNotes* clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab);
     void CopyFromClip(const ScNotes& maNotes, ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, SCTAB nTab, bool bCloneCaption);
 
+    void erase(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
+
 
 };
 
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index a76f9f5..8ecacfa 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -1085,7 +1085,7 @@ void ScNotes::CopyFromClip(const ScNotes& rNotes, ScDocument* pDoc, SCCOL nCol1,
     {
         SCCOL nCol = itr->first.first;
         SCROW nRow = itr->first.second;
-        if (nCol >= nCol1 && nCol <= nCol2 && nRow >= nRow1 && nRow <= nRow2)
+        if (nCol+nDx >= nCol1 && nCol+nDx <= nCol2 && nRow+nDy >= nRow1 && nRow+nDy <= nRow2)
         {
             erase(nCol+nDx, nRow+nDy);
             insert(nCol+nDx, nRow+nDy, itr->second->Clone( ScAddress(nCol, nRow, nTab), *pDoc, ScAddress(nCol, nRow, nTab), bCloneCaption ));
@@ -1093,5 +1093,20 @@ void ScNotes::CopyFromClip(const ScNotes& rNotes, ScDocument* pDoc, SCCOL nCol1,
     }
 }
 
+void ScNotes::erase(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
+{
+    ScNotes::iterator itr = maNoteMap.begin();
+    while(itr != maNoteMap.end())
+    {
+        SCCOL nCol = itr->first.first;
+        SCROW nRow = itr->first.second;
+        ++itr;
+        if (nCol >= nCol1 && nCol <= nCol2 && nRow >= nRow1 && nRow <= nRow2)
+        {
+            erase(nCol, nRow);
+        }
+    }
+}
+
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index aef1446..50608c8 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -598,7 +598,11 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
         for ( i = nCol1; i <= nCol2; i++)
             aCol[i].CopyFromClip(nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]);
 
-        bool bAddNotes = (nInsFlag & (IDF_CONTENTS | IDF_ADDNOTES)) == (IDF_NOTE | IDF_ADDNOTES);
+        //remove old notes
+        if (nInsFlag & IDF_CONTENTS)
+            maNotes.erase(nCol1, nRow1, nCol2, nRow2);
+
+        bool bAddNotes = nInsFlag & (IDF_NOTE | IDF_ADDNOTES);
         if (bAddNotes)
         {
             bool bCloneCaption = (nInsFlag & IDF_NOCAPTIONS) == 0;
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 346a600..b080ac0 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2112,7 +2112,6 @@ void ScOutputData::DrawNoteMarks()
                     SCCOL nMergeX = nX;
                     SCROW nMergeY = nY;
                     pDoc->ExtendOverlapped( nMergeX, nMergeY, nX, nY, nTab );
-                    pCell = pDoc->GetCell( ScAddress(nMergeX,nMergeY,nTab) );
                     // use origin's pCell for NotePtr test below
                 }
 
commit c06dbbe7594c2a0b5a5b19f8e183d9c421e6e094
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Feb 23 23:36:49 2012 +0100

    remove mpNote from ScBaseCell

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 93fc09f..09c9f38 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -112,7 +112,7 @@ public:
 
     /** Returns true, if the cell is empty (neither value nor formula nor cell note).
         Returns false for formula cells returning nothing, use HasEmptyData() for that. */
-    bool            IsBlank( bool bIgnoreNotes = false ) const;
+    bool            IsBlank() const;
 
 // for idle-calculations
     inline sal_uInt16   GetTextWidth() const { return nTextWidth; }
@@ -121,19 +121,6 @@ public:
     inline sal_uInt8     GetScriptType() const { return nScriptType; }
     inline void     SetScriptType( sal_uInt8 nNew ) { nScriptType = nNew; }
 
-    /** Returns true, if the cell contains a note. */
-    inline bool     HasNote() const { return mpNote != 0; }
-    /** Returns the pointer to a cell note object (read-only). */
-    inline const ScPostIt* GetNote() const { return mpNote; }
-    /** Returns the pointer to a cell note object. */
-    inline ScPostIt* GetNote() { return mpNote; }
-    /** Takes ownership of the passed cell note object. */
-    void            TakeNote( ScPostIt* pNote );
-    /** Returns and forgets the own cell note object. Caller takes ownership! */
-    ScPostIt*       ReleaseNote();
-    /** Deletes the own cell note object. */
-    void            DeleteNote();
-
     /** Returns true, if the cell contains a broadcaster. */
     inline bool     HasBroadcaster() const { return mpBroadcaster != 0; }
     /** Returns the pointer to the cell broadcaster. */
@@ -169,7 +156,6 @@ private:
     ScBaseCell&     operator=( const ScBaseCell& );
 
 private:
-    ScPostIt*       mpNote;         /// The cell note. Cell takes ownership!
     SvtBroadcaster* mpBroadcaster;  /// Broadcaster for changed values. Cell takes ownership!
 
 protected:
@@ -189,8 +175,6 @@ public:
 
     /** Cell takes ownership of the passed broadcaster. */
     explicit        ScNoteCell( SvtBroadcaster* pBC = 0 );
-    /** Cell takes ownership of the passed note and broadcaster. */
-    explicit        ScNoteCell( ScPostIt* pNote, SvtBroadcaster* pBC = 0 );
 
 #if OSL_DEBUG_LEVEL > 0
                     ~ScNoteCell();
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index da5e168..8d715fb 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -158,20 +158,20 @@ public:
                                 SCCOL& rPaintCol, SCROW& rPaintRow,
                                 bool bRefresh );
 
-    bool               IsEmptyVisData(bool bNotes) const;              // without Broadcaster
+    bool               IsEmptyVisData() const;              // without Broadcaster
     bool               IsEmptyData() const;
     bool               IsEmptyAttr() const;
     bool               IsEmpty() const;
 
                 // data only:
-    bool               IsEmptyBlock(SCROW nStartRow, SCROW nEndRow, bool bIgnoreNotes = false) const;
+    bool               IsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
     SCSIZE         GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const;
     bool               HasDataAt(SCROW nRow) const;
     bool               HasVisibleDataAt(SCROW nRow) const;
     SCROW              GetFirstDataPos() const;
     SCROW              GetLastDataPos() const;
-    SCROW              GetLastVisDataPos(bool bNotes) const;                           // without Broadcaster
-    SCROW              GetFirstVisDataPos(bool bNotes) const;
+    SCROW              GetLastVisDataPos() const;                           // without Broadcaster
+    SCROW              GetFirstVisDataPos() const;
     bool               GetPrevDataPos(SCROW& rRow) const;
     bool               GetNextDataPos(SCROW& rRow) const;
     void               FindDataAreaPos(SCROW& rRow, long nMovY) const; // (without Broadcaster)
@@ -265,15 +265,6 @@ public:
     bool    HasValueData( SCROW nRow ) const;
     bool    HasStringCells( SCROW nStartRow, SCROW nEndRow ) const;
 
-    /** Returns the pointer to a cell note object at the passed row. */
-    ScPostIt*   GetNote( SCROW nRow );
-    /** Sets the passed cell note object at the passed row. Takes ownership! */
-    void        TakeNote( SCROW nRow, ScPostIt* pNote );
-    /** Returns and forgets a cell note object at the passed row. */
-    ScPostIt*   ReleaseNote( SCROW nRow );
-    /** Deletes the note at the passed row. */
-    void        DeleteNote( SCROW nRow );
-
     void        SetDirty();
     void        SetDirty( const ScRange& );
     void        SetDirtyVar();
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 34193d8..8634847 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -206,6 +206,9 @@ const sal_uInt8 SC_DDE_ENGLISH       = 1;
 const sal_uInt8 SC_DDE_TEXT          = 2;
 const sal_uInt8 SC_DDE_IGNOREMODE    = 255;       /// For usage in FindDdeLink() only!
 
+typedef std::pair<SCCOL, SCROW> ScAddress2D;
+typedef std::map<ScAddress2D, ScPostIt*> ScNoteMap;
+
 class ScDocument
 {
 friend class ScDocumentIterator;
@@ -804,16 +807,9 @@ public:
     /** Returns true, if there is any data to create a selection list for rPos. */
     bool            HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
 
-    /** Returns the pointer to a cell note object at the passed cell address. */
-    SC_DLLPUBLIC ScPostIt*       GetNote( const ScAddress& rPos );
-    /** Sets the passed note at the cell with the passed cell address. */
-    void            TakeNote( const ScAddress& rPos, ScPostIt*& rpNote );
-    /** Returns and forgets the cell note object at the passed cell address. */
-    ScPostIt*       ReleaseNote( const ScAddress& rPos );
-    /** Returns the pointer to an existing or created cell note object at the passed cell address. */
-    SC_DLLPUBLIC ScPostIt* GetOrCreateNote( const ScAddress& rPos );
-    /** Deletes the note at the passed cell address. */
-    void            DeleteNote( const ScAddress& rPos );
+    /** Returns a table notes container. */
+    SC_DLLPUBLIC ScNotes*       GetNotes(SCTAB nTab);
+
     /** Creates the captions of all uninitialized cell notes in the specified sheet.
         @param bForced  True = always create all captions, false = skip when Undo is disabled. */
     void            InitializeNoteCaptions( SCTAB nTab, bool bForced = false );
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 5d63b37..fb40347 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -35,6 +35,8 @@
 #include "address.hxx"
 #include "scdllapi.h"
 
+#include <map>
+
 class EditTextObject;
 class OutlinerParaObject;
 class SdrCaptionObj;
@@ -259,6 +261,59 @@ public:
                             bool bAlwaysCreateCaption );
 };
 
+class SC_DLLPUBLIC ScNotes
+{
+private:
+    typedef std::pair<SCCOL, SCROW> ScAddress2D;
+    typedef std::map<ScAddress2D, ScPostIt*> ScNoteMap;
+    ScNoteMap maNoteMap;
+
+    ScDocument* mpDoc;
+public:
+    ScNotes(ScDocument* pDoc);
+    ScNotes(const ScNotes& rNotes);
+    ~ScNotes();
+
+    typedef ScNoteMap::iterator iterator;
+    typedef ScNoteMap::const_iterator const_iterator;
+
+    iterator begin();
+    iterator end();
+
+    const_iterator begin() const;
+    const_iterator end() const;
+
+    size_t size() const;
+    bool empty() const;
+
+    ScPostIt* findByAddress(SCCOL nCol, SCROW nRow);
+    const ScPostIt* findByAddress(SCCOL nCol, SCROW nRow) const;
+
+    ScPostIt* findByAddress(const ScAddress& rAddress);
+    const ScPostIt* findByAddress(const ScAddress& rAddress) const;
+    /**
+     * takes ownership of the
+     */
+    bool insert( SCCOL nCol, SCROW nRow, ScPostIt* );
+    bool insert( const ScAddress& rPos, ScPostIt* );
+
+    void erase(SCCOL, SCROW);
+    void erase(const ScAddress& rPos);
+
+    /** Returns and forgets the cell note object at the passed cell address. */
+    ScPostIt*       ReleaseNote( const ScAddress& rPos );
+    ScPostIt*       ReleaseNote( SCCOL nCol, SCROW nRow );
+    /** Returns the pointer to an existing or created cell note object at the passed cell address. */
+    ScPostIt* GetOrCreateNote( const ScAddress& rPos );
+
+    void clear();
+
+    ScNotes* clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab);
+    void CopyFromClip(const ScNotes& maNotes, ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, SCTAB nTab, bool bCloneCaption);
+
+
+};
+
 // ============================================================================
 
 #endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index bb11dd5..b99caf8 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -37,8 +37,10 @@
 #include "column.hxx"
 #include "sortparam.hxx"
 #include "compressedarray.hxx"
+#include "postit.hxx"
 
 #include <set>
+#include <map>
 #include <boost/scoped_ptr.hpp>
 #include <boost/noncopyable.hpp>
 
@@ -66,7 +68,6 @@ class ScDrawLayer;
 class ScEditDataArray;
 class ScFormulaCell;
 class ScOutlineTable;
-class ScPostIt;
 class ScPrintSaverTab;
 class ScProgress;
 class ScRangeList;
@@ -168,6 +169,8 @@ private:
     ScDBData*       pDBDataNoName;
     mutable ScRangeName* mpRangeName;
 
+    ScNotes         maNotes;
+
     bool            bScenario:1;
     bool            bLayoutRTL:1;
     bool            bLoadingRTL:1;
@@ -336,14 +339,7 @@ public:
     void        GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const;
     void        GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
 
-    /** Returns the pointer to a cell note object at the passed cell address. */
-    ScPostIt*   GetNote( SCCOL nCol, SCROW nRow );
-    /** Sets the passed cell note object at the passed cell address. Takes ownership! */
-    void        TakeNote( SCCOL nCol, SCROW nRow, ScPostIt*& rpNote );
-    /** Returns and forgets the cell note object at the passed cell address. */
-    ScPostIt*   ReleaseNote( SCCOL nCol, SCROW nRow );
-    /** Deletes the note at the passed cell address. */
-    void        DeleteNote( SCCOL nCol, SCROW nRow );
+    ScNotes*    GetNotes();
     /** Creates the captions of all uninitialized cell notes.
         @param bForced  True = always create all captions, false = skip when Undo is disabled. */
     void        InitializeNoteCaptions( bool bForced = false );
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index a7d9b6f..dc70d5e 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -346,7 +346,7 @@ void testContentImpl(ScDocument* pDoc) //same code for ods, xls, xlsx
     CPPUNIT_ASSERT_MESSAGE("merged cells are not imported", nCol == 5 && nRow == 2);
     //check notes import
     ScAddress aAddress(7, 2, 0);
-    ScPostIt* pNote = pDoc->GetNote(aAddress);
+    ScPostIt* pNote = pDoc->GetNotes(aAddress.Tab())->findByAddress(aAddress);
     CPPUNIT_ASSERT_MESSAGE("note not imported", pNote);
     CPPUNIT_ASSERT_MESSAGE("note text not imported correctly", pNote->GetText() == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Test")));
     //add additional checks here
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 89bc980..0079758 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2898,35 +2898,35 @@ void Test::testPostIts()
     m_pDoc->InsertTab(0, aTabName);
 
     ScAddress rAddr(2, 2, 0);
-    ScPostIt *pNote = m_pDoc->GetOrCreateNote(rAddr);
+    ScPostIt *pNote = m_pDoc->GetNotes(rAddr.Tab())->GetOrCreateNote(rAddr);
     pNote->SetText(rAddr, aHello);
     pNote->SetAuthor(aJimBob);
 
-    ScPostIt *pGetNote = m_pDoc->GetNote(rAddr);
+    ScPostIt *pGetNote = m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr);
     CPPUNIT_ASSERT_MESSAGE("note should be itself", pGetNote == pNote );
 
     bool bInsertRow = m_pDoc->InsertRow( 0, 0, 100, 0, 1, 1 );
     CPPUNIT_ASSERT_MESSAGE("failed to insert row", bInsertRow );
 
-    CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
+    CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == NULL);
     rAddr.IncRow();
-    CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
+    CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote);
 
     bool bInsertCol = m_pDoc->InsertCol( 0, 0, 100, 0, 1, 1 );
     CPPUNIT_ASSERT_MESSAGE("failed to insert column", bInsertCol );
 
-    CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
+    CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == NULL);
     rAddr.IncCol();
-    CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
+    CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote);
 
     m_pDoc->InsertTab(0, aTabName2);
-    CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNote(rAddr) == NULL);
+    CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == NULL);
     rAddr.IncTab();
-    CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
+    CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote);
 
     m_pDoc->DeleteTab(0);
     rAddr.IncTab(-1);
-    CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNote(rAddr) == pNote);
+    CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote);
 
     m_pDoc->DeleteTab(0);
 }
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index c8ac64f..11ac123 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -80,7 +80,6 @@ IMPL_FIXEDMEMPOOL_NEWDEL( ScNoteCell )
 // ============================================================================
 
 ScBaseCell::ScBaseCell( CellType eNewType ) :
-    mpNote( 0 ),
     mpBroadcaster( 0 ),
     nTextWidth( TEXTWIDTH_DIRTY ),
     eCellType( sal::static_int_cast<sal_uInt8>(eNewType) ),
@@ -89,7 +88,6 @@ ScBaseCell::ScBaseCell( CellType eNewType ) :
 }
 
 ScBaseCell::ScBaseCell( const ScBaseCell& rCell ) :
-    mpNote( 0 ),
     mpBroadcaster( 0 ),
     nTextWidth( rCell.nTextWidth ),
     eCellType( rCell.eCellType ),
@@ -99,7 +97,6 @@ ScBaseCell::ScBaseCell( const ScBaseCell& rCell ) :
 
 ScBaseCell::~ScBaseCell()
 {
-    delete mpNote;
     delete mpBroadcaster;
     OSL_ENSURE( eCellType == CELLTYPE_DESTROYED, "BaseCell Destructor" );
 }
@@ -246,19 +243,11 @@ ScBaseCell* ScBaseCell::CloneWithoutNote( ScDocument& rDestDoc, const ScAddress&
 ScBaseCell* ScBaseCell::CloneWithNote( const ScAddress& rOwnPos, ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags ) const
 {
     ScBaseCell* pNewCell = lclCloneCell( *this, rDestDoc, rDestPos, nCloneFlags );
-    if( mpNote )
-    {
-        if( !pNewCell )
-            pNewCell = new ScNoteCell;
-        bool bCloneCaption = (nCloneFlags & SC_CLONECELL_NOCAPTION) == 0;
-        pNewCell->TakeNote( mpNote->Clone( rOwnPos, rDestDoc, rDestPos, bCloneCaption ) );
-    }
     return pNewCell;
 }
 
 void ScBaseCell::Delete()
 {
-    DeleteNote();
     switch (eCellType)
     {
         case CELLTYPE_VALUE:
@@ -282,27 +271,9 @@ void ScBaseCell::Delete()
     }
 }
 
-bool ScBaseCell::IsBlank( bool bIgnoreNotes ) const
-{
-    return (eCellType == CELLTYPE_NOTE) && (bIgnoreNotes || !mpNote);
-}
-
-void ScBaseCell::TakeNote( ScPostIt* pNote )
+bool ScBaseCell::IsBlank() const
 {
-    delete mpNote;
-    mpNote = pNote;
-}
-
-ScPostIt* ScBaseCell::ReleaseNote()
-{
-    ScPostIt* pNote = mpNote;
-    mpNote = 0;
-    return pNote;
-}
-
-void ScBaseCell::DeleteNote()
-{
-    DELETEZ( mpNote );
+    return false;
 }
 
 void ScBaseCell::TakeBroadcaster( SvtBroadcaster* pBroadcaster )
@@ -662,13 +633,6 @@ ScNoteCell::ScNoteCell( SvtBroadcaster* pBC ) :
     TakeBroadcaster( pBC );
 }
 
-ScNoteCell::ScNoteCell( ScPostIt* pNote, SvtBroadcaster* pBC ) :
-    ScBaseCell( CELLTYPE_NOTE )
-{
-    TakeNote( pNote );
-    TakeBroadcaster( pBC );
-}
-
 #if OSL_DEBUG_LEVEL > 0
 ScNoteCell::~ScNoteCell()
 {
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 444cc67..4df060c 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -932,12 +932,9 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
                 }
             }
 
-            // do not swap formula cells with equal formulas, but swap notes
+            // do not swap formula cells with equal formulas
             if (bEqual)
             {
-                ScPostIt* pNote1 = pCell1->ReleaseNote();
-                pCell1->TakeNote( pCell2->ReleaseNote() );
-                pCell2->TakeNote( pNote1 );
                 return;
             }
         }
@@ -947,7 +944,6 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
         variable swapping above). Do not clone the note, but move pointer of
         old note to new cell. */
     ScBaseCell* pNew2 = pCell1->CloneWithoutNote( *pDocument, aPos2, SC_CLONECELL_ADJUST3DREL );
-    pNew2->TakeNote( pCell1->ReleaseNote() );
 
     /*  Create clone of pCell2 at position of pCell1. Do not clone the note,
         but move pointer of old note to new cell. */
@@ -955,7 +951,6 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
     if ( pCell2 )
     {
         pNew1 = pCell2->CloneWithoutNote( *pDocument, aPos1, SC_CLONECELL_ADJUST3DREL );
-        pNew1->TakeNote( pCell2->ReleaseNote() );
     }
 
     // move old broadcasters new cells at the same old position
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 865820a..1ca582d 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -933,7 +933,6 @@ void ScColumn::RemoveAutoSpellObj()
                 String aText = ScEditUtil::GetSpaceDelimitedString( *pEngine );
                 ScBaseCell* pNewCell = new ScStringCell( aText );
                 pNewCell->TakeBroadcaster( pOldCell->ReleaseBroadcaster() );
-                pNewCell->TakeNote( pOldCell->ReleaseNote() );
                 maItems[i].pCell = pNewCell;
                 delete pOldCell;
             }
@@ -1003,7 +1002,6 @@ void ScColumn::RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow )
                 String aText = ScEditUtil::GetSpaceDelimitedString( *pEngine );
                 ScBaseCell* pNewCell = new ScStringCell( aText );
                 pNewCell->TakeBroadcaster( pOldCell->ReleaseBroadcaster() );
-                pNewCell->TakeNote( pOldCell->ReleaseNote() );
                 maItems[i].pCell = pNewCell;
                 delete pOldCell;
             }
@@ -1124,7 +1122,7 @@ bool ScColumn::IsEmptyData() const
     return (maItems.empty());
 }
 
-bool ScColumn::IsEmptyVisData(bool bNotes) const
+bool ScColumn::IsEmptyVisData() const
 {
     if ( maItems.empty() )
         return true;
@@ -1134,9 +1132,7 @@ bool ScColumn::IsEmptyVisData(bool bNotes) const
         SCSIZE i;
         for (i=0; i<maItems.size() && !bVisData; i++)
         {
-            ScBaseCell* pCell = maItems[i].pCell;
-            if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->HasNote()) )
-                bVisData = true;
+            bVisData = true;
         }
         return !bVisData;
     }
@@ -1151,8 +1147,7 @@ SCSIZE ScColumn::VisibleCount( SCROW nStartRow, SCROW nEndRow ) const
     Search( nStartRow, nIndex );
     while ( nIndex < maItems.size() && maItems[nIndex].nRow <= nEndRow )
     {
-        if ( maItems[nIndex].nRow >= nStartRow &&
-             maItems[nIndex].pCell->GetCellType() != CELLTYPE_NOTE )
+        if ( maItems[nIndex].nRow >= nStartRow )
         {
             ++nVisCount;
         }
@@ -1161,7 +1156,7 @@ SCSIZE ScColumn::VisibleCount( SCROW nStartRow, SCROW nEndRow ) const
     return nVisCount;
 }
 
-SCROW ScColumn::GetLastVisDataPos(bool bNotes) const
+SCROW ScColumn::GetLastVisDataPos() const
 {
     SCROW nRet = 0;
     if ( !maItems.empty() )
@@ -1171,18 +1166,14 @@ SCROW ScColumn::GetLastVisDataPos(bool bNotes) const
         for (i=maItems.size(); i>0 && !bFound; )
         {
             --i;
-            ScBaseCell* pCell = maItems[i].pCell;
-            if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->HasNote()) )
-            {
-                bFound = true;
-                nRet = maItems[i].nRow;
-            }
+            bFound = true;
+            nRet = maItems[i].nRow;
         }
     }
     return nRet;
 }
 
-SCROW ScColumn::GetFirstVisDataPos(bool bNotes) const
+SCROW ScColumn::GetFirstVisDataPos() const
 {
     SCROW nRet = 0;
     if ( !maItems.empty() )
@@ -1191,12 +1182,8 @@ SCROW ScColumn::GetFirstVisDataPos(bool bNotes) const
         bool bFound = false;
         for (i=0; i<maItems.size() && !bFound; i++)
         {
-            ScBaseCell* pCell = maItems[i].pCell;
-            if ( pCell->GetCellType() != CELLTYPE_NOTE || (bNotes && pCell->HasNote()) )
-            {
-                bFound = true;
-                nRet = maItems[i].nRow;
-            }
+            bFound = true;
+            nRet = maItems[i].nRow;
         }
     }
     return nRet;
@@ -1225,7 +1212,7 @@ bool ScColumn::IsEmpty() const
     return (IsEmptyData() && IsEmptyAttr());
 }
 
-bool ScColumn::IsEmptyBlock(SCROW nStartRow, SCROW nEndRow, bool bIgnoreNotes) const
+bool ScColumn::IsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const
 {
     if ( maItems.empty() )
         return true;
@@ -1234,7 +1221,7 @@ bool ScColumn::IsEmptyBlock(SCROW nStartRow, SCROW nEndRow, bool bIgnoreNotes) c
     Search( nStartRow, nIndex );
     while ( nIndex < maItems.size() && maItems[nIndex].nRow <= nEndRow )
     {
-        if ( !maItems[nIndex].pCell->IsBlank( bIgnoreNotes ) )   // found a cell
+        if ( !maItems[nIndex].pCell->IsBlank() )   // found a cell
             return false;                           // not empty
         ++nIndex;
     }
@@ -1447,7 +1434,7 @@ bool ScColumn::GetLastVisibleAttr( SCROW& rLastRow ) const
     if (pAttrArray)
     {
         // row of last cell is needed
-        SCROW nLastData = GetLastVisDataPos( true );    // always including notes, 0 if none
+        SCROW nLastData = GetLastVisDataPos();    // always including notes, 0 if none
 
         return pAttrArray->GetLastVisibleAttr( rLastRow, nLastData );
     }
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index ab9f666..66db4ef 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -91,8 +91,6 @@ void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell )
             // move broadcaster and note to new cell, if not existing in new cell
             if (pOldCell->HasBroadcaster() && !pNewCell->HasBroadcaster())
                 pNewCell->TakeBroadcaster( pOldCell->ReleaseBroadcaster() );
-            if (pOldCell->HasNote() && !pNewCell->HasNote())
-                pNewCell->TakeNote( pOldCell->ReleaseNote() );
 
             if ( pOldCell->GetCellType() == CELLTYPE_FORMULA && !pDocument->IsClipOrUndo() )
             {
@@ -310,12 +308,6 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
         have to forget the pointers to them. This is used e.g. while undoing a
         "paste cells" operation, which removes the caption objects later in
         drawing undo. */
-    bool bDeleteNote = (nDelFlag & IDF_NOTE) != 0;
-    bool bNoCaptions = (nDelFlag & IDF_NOCAPTIONS) != 0;
-    if (bDeleteNote && bNoCaptions)
-        for ( SCSIZE nIdx = nStartIndex; nIdx <= nEndIndex; ++nIdx )
-            if ( ScPostIt* pNote = maItems[ nIdx ].pCell->GetNote() )
-                pNote->ForgetCaption();
 
     ScHint aHint( SC_HINT_DYING, ScAddress( nCol, 0, nTab ), 0 );
 
@@ -395,7 +387,7 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
 
                     case CELLTYPE_NOTE:
                         // do note delete note cell with broadcaster
-                        bDelete = bDeleteNote && !pOldCell->GetBroadcaster();
+                        bDelete = !pOldCell->GetBroadcaster();
                         break;
 
                     default:;   // added to avoid warnings
@@ -408,24 +400,9 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
                 ScNoteCell* pNoteCell = NULL;
                 SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
                 bool bKeepBC = pBC && pBC->HasListeners();
-                if (eCellType == CELLTYPE_NOTE)
-                {
-                    if (bKeepBC)
-                    {
-                        // We need to keep this "note" cell to keep the broadcaster.
-                        pNoteCell = static_cast<ScNoteCell*>(pOldCell);
-                        if (bDeleteNote)
-                            pOldCell->DeleteNote();
-                    }
-                }
-                else
-                {
-                    // do not rescue note if it has to be deleted according to passed flags
-                    ScPostIt* pNote = bDeleteNote ? 0 : pOldCell->ReleaseNote();
-                    // #i99844# do not release broadcaster from old cell, it still has to notify deleted content
-                    if (pNote || bKeepBC)
-                        pNoteCell = new ScNoteCell( pNote, pBC );
-                }
+                // #i99844# do not release broadcaster from old cell, it still has to notify deleted content
+                if ( bKeepBC)
+                        pNoteCell = new ScNoteCell( pBC );
 
                 // remove cell entry in cell item list
                 SCROW nOldRow = maItems[nIdx].nRow;
@@ -457,12 +434,6 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
                     }
                 }
             }
-            else
-            {
-                // delete cell note
-                if (bDeleteNote)
-                    maItems[nIdx].pCell->DeleteNote();
-            }
 
             if (!bDelete)
             {
@@ -753,9 +724,6 @@ void ScColumn::CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
         Resize( nNew );
     }
 
-    // IDF_ADDNOTES must be passed without other content flags than IDF_NOTE
-    bool bAddNotes = (nInsFlag & (IDF_CONTENTS | IDF_ADDNOTES)) == (IDF_NOTE | IDF_ADDNOTES);
-
     sal_Bool bAtEnd = false;
     for (SCSIZE i = 0; i < nColCount && !bAtEnd; i++)
     {
@@ -769,37 +737,11 @@ void ScColumn::CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy,
 
             ScAddress aDestPos( nCol, (SCROW)nDestRow, nTab );
 
-            /*  #i102056# Paste from clipboard needs to paste the cell notes in
-                a second pass. This must not overwrite the existing cells
-                already copied to the destination position in the first pass.
-                To indicate this special case, the modifier IDF_ADDNOTES is
-                passed together with IDF_NOTE in nInsFlag. Of course, there is
-                still the need to create a new cell, if there is no cell at the
-                destination position at all. */
-            ScBaseCell* pAddNoteCell = bAddNotes ? GetCell( aDestPos.Row() ) : 0;
-            if (pAddNoteCell)
-            {
-                // do nothing if source cell does not contain a note
-                const ScBaseCell* pSourceCell = rColumn.maItems[i].pCell;
-                const ScPostIt* pSourceNote = pSourceCell ? pSourceCell->GetNote() : 0;
-                if (pSourceNote)
-                {
-                    OSL_ENSURE( !pAddNoteCell->HasNote(), "ScColumn::CopyFromClip - unexpected note at destination cell" );
-                    bool bCloneCaption = (nInsFlag & IDF_NOCAPTIONS) == 0;
-                    // #i52342# if caption is cloned, the note must be constructed with the destination document
-                    ScAddress aSourcePos( rColumn.nCol, rColumn.maItems[i].nRow, rColumn.nTab );
-                    ScPostIt* pNewNote = pSourceNote->Clone( aSourcePos, *pDocument, aDestPos, bCloneCaption );
-                    pAddNoteCell->TakeNote( pNewNote );
-                }
-            }
-            else
-            {
-                ScBaseCell* pNewCell = bAsLink ?
-                    rColumn.CreateRefCell( pDocument, aDestPos, i, nInsFlag ) :
-                    rColumn.CloneCell( i, nInsFlag, *pDocument, aDestPos );
-                if (pNewCell)
-                    Insert( aDestPos.Row(), pNewCell );
-            }
+            ScBaseCell* pNewCell = bAsLink ?
+                rColumn.CreateRefCell( pDocument, aDestPos, i, nInsFlag ) :
+                rColumn.CloneCell( i, nInsFlag, *pDocument, aDestPos );
+            if (pNewCell)
+                Insert( aDestPos.Row(), pNewCell );
         }
     }
 }
@@ -831,7 +773,6 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rD
     bool bCloneString   = (nFlags & IDF_STRING) != 0;
     bool bCloneSpecialBoolean  = (nFlags & IDF_SPECIAL_BOOLEAN) != 0;
     bool bCloneFormula  = (nFlags & IDF_FORMULA) != 0;
-    bool bCloneNote     = (nFlags & IDF_NOTE) != 0;
     bool bForceFormula  = false;
 
     ScBaseCell* pNew = 0;
@@ -918,22 +859,6 @@ ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rD
         default: OSL_FAIL( "ScColumn::CloneCell - unknown cell type" );
     }
 
-    // clone the cell note
-    if (bCloneNote)
-    {
-        if (ScPostIt* pNote = rSource.GetNote())
-        {
-            bool bCloneCaption = (nFlags & IDF_NOCAPTIONS) == 0;
-            // #i52342# if caption is cloned, the note must be constructed with the destination document
-            ScAddress aOwnPos( nCol, maItems[nIndex].nRow, nTab );
-            ScPostIt* pNewNote = pNote->Clone( aOwnPos, rDestDoc, rDestPos, bCloneCaption );
-            if (!pNew)
-                pNew = new ScNoteCell( pNewNote );
-            else
-                pNew->TakeNote( pNewNote );
-        }
-    }
-
     return pNew;
 }
 
@@ -1465,14 +1390,9 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString,
         if (Search(nRow, i))
         {
             ScBaseCell* pOldCell = maItems[i].pCell;
-            ScPostIt* pNote = pOldCell->ReleaseNote();
             SvtBroadcaster* pBC = pOldCell->ReleaseBroadcaster();
-            if (pNewCell || pNote || pBC)
+            if (pNewCell || pBC)
             {
-                if (pNewCell)
-                    pNewCell->TakeNote( pNote );
-                else
-                    pNewCell = new ScNoteCell( pNote );
                 if (pBC)
                 {
                     pNewCell->TakeBroadcaster(pBC);
@@ -1883,44 +1803,6 @@ bool ScColumn::HasStringCells( SCROW nStartRow, SCROW nEndRow ) const
 }
 
 
-ScPostIt* ScColumn::GetNote( SCROW nRow )
-{
-    SCSIZE nIndex;
-    return Search( nRow, nIndex ) ? maItems[ nIndex ].pCell->GetNote() : 0;
-}
-
-
-void ScColumn::TakeNote( SCROW nRow, ScPostIt* pNote )
-{
-    SCSIZE nIndex;
-    if( Search( nRow, nIndex ) )
-        maItems[ nIndex ].pCell->TakeNote( pNote );
-    else
-        Insert( nRow, new ScNoteCell( pNote ) );
-}
-
-
-ScPostIt* ScColumn::ReleaseNote( SCROW nRow )
-{
-    ScPostIt* pNote = 0;
-    SCSIZE nIndex;
-    if( Search( nRow, nIndex ) )
-    {
-        ScBaseCell* pCell = maItems[ nIndex ].pCell;
-        pNote = pCell->ReleaseNote();
-        if( (pCell->GetCellType() == CELLTYPE_NOTE) && !pCell->GetBroadcaster() )
-            DeleteAtIndex( nIndex );
-    }
-    return pNote;
-}
-
-
-void ScColumn::DeleteNote( SCROW nRow )
-{
-    delete ReleaseNote( nRow );
-}
-
-
 sal_Int32 ScColumn::GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const
 {
     sal_Int32 nStringLen = 0;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 22e7ac4..2a5c751 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3259,48 +3259,6 @@ bool ScDocument::HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
 }
 
 
-ScPostIt* ScDocument::GetNote( const ScAddress& rPos )
-{
-    ScTable* pTable = ValidTab( rPos.Tab() ) && rPos.Tab() < static_cast<SCTAB>(maTabs.size()) ? maTabs[ rPos.Tab() ] : 0;
-    return pTable ? pTable->GetNote( rPos.Col(), rPos.Row() ) : 0;
-}
-
-
-void ScDocument::TakeNote( const ScAddress& rPos, ScPostIt*& rpNote )
-{
-    if( ValidTab( rPos.Tab() ) && rPos.Tab() < static_cast<SCTAB>(maTabs.size()) && maTabs[ rPos.Tab() ] )
-        maTabs[ rPos.Tab() ]->TakeNote( rPos.Col(), rPos.Row(), rpNote );
-    else
-        DELETEZ( rpNote );
-}
-
-
-ScPostIt* ScDocument::ReleaseNote( const ScAddress& rPos )
-{
-    ScTable* pTable = ValidTab( rPos.Tab() ) && rPos.Tab() < static_cast<SCTAB>(maTabs.size())? maTabs[ rPos.Tab() ] : 0;
-    return pTable ? pTable->ReleaseNote( rPos.Col(), rPos.Row() ) : 0;
-}
-
-
-ScPostIt* ScDocument::GetOrCreateNote( const ScAddress& rPos )
-{
-    ScPostIt* pNote = GetNote( rPos );
-    if( !pNote )
-    {
-        pNote = new ScPostIt( *this, rPos, false );
-        TakeNote( rPos, pNote );
-    }
-    return pNote;
-}
-
-
-void ScDocument::DeleteNote( const ScAddress& rPos )
-{
-    if( ValidTab( rPos.Tab() ) && rPos.Tab() < static_cast<SCTAB>(maTabs.size()) && maTabs[ rPos.Tab() ] )
-        maTabs[ rPos.Tab() ]->DeleteNote( rPos.Col(), rPos.Row() );
-}
-
-
 void ScDocument::InitializeNoteCaptions( SCTAB nTab, bool bForced )
 {
     if( ValidTab( nTab ) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[ nTab ] )
@@ -5777,4 +5735,12 @@ bool ScDocument::IsInVBAMode() const
     return false;
 }
 
+ScNotes* ScDocument::GetNotes(SCTAB nTab)
+{
+    if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
+        return maTabs[nTab]->GetNotes();
+
+    return NULL;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index e781e60..5d84a27 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -638,7 +638,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
                 where cell note is already deleted (thus document cannot find
                 the note object anymore). The caption will be deleted later
                 with drawing undo. */
-            if( ScPostIt* pNote = pDoc->GetNote( rData.maStart ) )
+            if( ScPostIt* pNote = pDoc->GetNotes( rData.maStart.Tab() )->findByAddress( rData.maStart ) )
                 pNote->UpdateCaptionPos( rData.maStart );
         return;
     }
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 5c6eed7..a76f9f5 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -54,6 +54,8 @@
 #include "userdat.hxx"
 #include "detfunc.hxx"
 
+#include <utility>
+
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
 
@@ -780,7 +782,7 @@ void ScNoteUtil::UpdateCaptionPositions( ScDocument& rDoc, const ScRange& rRange
     for( ScAddress aPos( rRange.aStart ); aPos.Tab() <= rRange.aEnd.Tab(); aPos.IncTab() )
         for( aPos.SetCol( rRange.aStart.Col() ); aPos.Col() <= rRange.aEnd.Col(); aPos.IncCol() )
             for( aPos.SetRow( rRange.aStart.Row() ); aPos.Row() <= rRange.aEnd.Row(); aPos.IncRow() )
-                if( ScPostIt* pNote = rDoc.GetNote( aPos ) )
+                if( ScPostIt* pNote = rDoc.GetNotes(aPos.Tab())->findByAddress( aPos ) )
                     pNote->UpdateCaptionPos( aPos );
 }
 
@@ -791,7 +793,7 @@ SdrCaptionObj* ScNoteUtil::CreateTempCaption(
     OUStringBuffer aBuffer( rUserText );
     // add plain text of invisible (!) cell note (no formatting etc.)
     SdrCaptionObj* pNoteCaption = 0;
-    const ScPostIt* pNote = rDoc.GetNote( rPos );
+    const ScPostIt* pNote = rDoc.GetNotes(rPos.Tab())->findByAddress( rPos );
     if( pNote && !pNote->IsCaptionShown() )
     {
         if( aBuffer.getLength() > 0 )
@@ -853,9 +855,9 @@ ScPostIt* ScNoteUtil::CreateNoteFromCaption(
     aNoteData.mpCaption = &rCaption;
     ScPostIt* pNote = new ScPostIt( rDoc, rPos, aNoteData, false );
     pNote->AutoStamp();
-    rDoc.TakeNote( rPos, pNote );
+
     // if pNote still points to the note after TakeNote(), insertion was successful
-    if( pNote )
+    if( rDoc.GetNotes(rPos.Tab())->insert( rPos, pNote ) )
     {
         // ScNoteCaptionCreator c'tor updates the caption object to be part of a note
         ScNoteCaptionCreator aCreator( rDoc, rPos, rCaption, bShown );
@@ -890,9 +892,10 @@ ScPostIt* ScNoteUtil::CreateNoteFromObjectData(
         visible, the caption object will be created automatically. */
     ScPostIt* pNote = new ScPostIt( rDoc, rPos, aNoteData, bAlwaysCreateCaption );
     pNote->AutoStamp();
-    rDoc.TakeNote( rPos, pNote );
-    // if pNote still points to the note after TakeNote(), insertion was successful
-    return pNote;
+    if(rDoc.GetNotes(rPos.Tab())->insert( rPos, pNote ))
+        return pNote;
+    else
+        return NULL;
 }
 
 ScPostIt* ScNoteUtil::CreateNoteFromString(
@@ -912,12 +915,183 @@ ScPostIt* ScNoteUtil::CreateNoteFromString(
             visible, the caption object will be created automatically. */
         pNote = new ScPostIt( rDoc, rPos, aNoteData, bAlwaysCreateCaption );
         pNote->AutoStamp();
-        rDoc.TakeNote( rPos, pNote );
-        // if pNote still points to the note after TakeNote(), insertion was successful
+        //insert takes ownership
+        if(!rDoc.GetNotes(rPos.Tab())->insert( rPos, pNote ))
+            pNote = NULL;
     }
     return pNote;
 }
 
 // ============================================================================
+// ScNotes
+// ============================================================================
+
+ScNotes::ScNotes(ScDocument* pDoc):
+    mpDoc(pDoc)
+{
+
+}
+
+ScNotes::~ScNotes()
+{
+    clear();
+}
+
+ScNotes::iterator ScNotes::begin()
+{
+    return maNoteMap.begin();
+}
+
+ScNotes::iterator ScNotes::end()
+{
+    return maNoteMap.end();
+}
+
+ScNotes::const_iterator ScNotes::begin() const
+{
+    return maNoteMap.begin();
+}
+
+ScNotes::const_iterator ScNotes::end() const
+{
+    return maNoteMap.end();
+}
+
+size_t ScNotes::size() const
+{
+    return maNoteMap.size();
+}
+
+bool ScNotes::empty() const
+{
+    return maNoteMap.empty();
+}
+
+ScPostIt* ScNotes::findByAddress(SCCOL nCol, SCROW nRow)
+{
+    ScNoteMap::iterator itr = maNoteMap.find(std::pair<SCCOL, SCROW>(nCol, nRow));
+    if (itr != maNoteMap.end())
+        return itr->second;
+
+    return NULL;
+}
+
+const ScPostIt* ScNotes::findByAddress(SCCOL nCol, SCROW nRow) const
+{
+    ScNoteMap::const_iterator itr = maNoteMap.find(std::pair<SCCOL, SCROW>(nCol, nRow));
+    if (itr != maNoteMap.end())
+        return itr->second;
+
+    return NULL;
+}
+
+ScPostIt* ScNotes::findByAddress(const ScAddress& rPos)
+{
+    return findByAddress(rPos.Col(), rPos.Row());
+}
+
+const ScPostIt* ScNotes::findByAddress(const ScAddress& rPos) const
+{
+    return findByAddress(rPos.Col(), rPos.Row());
+}
+
+bool ScNotes::insert(SCCOL nCol, SCROW nRow, ScPostIt* pPostIt)
+{
+    std::pair<iterator, bool> aResult = maNoteMap.insert(std::pair<ScAddress2D, ScPostIt*>(std::pair<SCCOL, SCROW>(nCol, nRow), pPostIt));
+    if (!aResult.second)
+        delete pPostIt;
+
+    return aResult.second;
+}
+
+bool ScNotes::insert(const ScAddress& rPos, ScPostIt* pPostIt)
+{
+    return insert(rPos.Col(), rPos.Row(), pPostIt);
+}
+
+void ScNotes::erase(SCCOL nCol, SCROW nRow)
+{
+    iterator itr = maNoteMap.find(std::pair<SCCOL, SCROW>(nCol, nRow));
+    if (itr != maNoteMap.end())
+    {
+        delete itr->second;
+        maNoteMap.erase(itr);
+    }
+}
+
+void ScNotes::erase(const ScAddress& rPos)
+{
+    erase(rPos.Col(), rPos.Row());
+}
+
+ScPostIt* ScNotes::ReleaseNote(SCCOL nCol, SCROW nRow)
+{
+    ScPostIt* pPostIt = NULL;
+    iterator itr = maNoteMap.find(std::pair<SCCOL, SCROW>(nCol, nRow));
+    if (itr!= maNoteMap.end())
+    {
+        pPostIt = itr->second;
+        maNoteMap.erase(itr);
+    }
+    return pPostIt;
+}
+
+ScPostIt* ScNotes::ReleaseNote(const ScAddress& rPos)
+{
+    return ReleaseNote(rPos.Col(), rPos.Row());
+}
+
+ScPostIt* ScNotes::GetOrCreateNote(const ScAddress& rPos)
+{
+    iterator itr = maNoteMap.find(std::pair<SCCOL, SCROW>(rPos.Col(), rPos.Row()));
+    if (itr != maNoteMap.end())
+        return itr->second;
+    else
+    {
+        ScPostIt* pPostIt = new ScPostIt(*mpDoc, rPos, false);
+        insert(rPos, pPostIt);
+        return pPostIt;
+    }
+}
+
+void ScNotes::clear()
+{
+    for (iterator itr = maNoteMap.begin(); itr != maNoteMap.end(); ++itr)
+    {
+        delete itr->second;
+    }
+    maNoteMap.clear();
+}
+
+ScNotes* ScNotes::clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab)
+{
+    ScNotes* pNotes = new ScNotes(pDoc);
+    for (ScNotes::iterator itr = maNoteMap.begin(); itr != maNoteMap.end(); ++itr)
+    {
+        SCCOL nCol = itr->first.first;
+        SCROW nRow = itr->first.second;
+
+        if (nCol >= nCol1 && nCol <= nCol2 && nRow >= nRow1 && nRow <= nRow2)
+        {
+            pNotes->insert(nCol, nRow, itr->second->Clone( ScAddress(nCol, nRow, nTab),*pDoc, ScAddress(nCol, nRow, nTab), bCloneNoteCaption));
+        }
+    }
+    return pNotes;
+}
+
+void ScNotes::CopyFromClip(const ScNotes& rNotes, ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, SCTAB nTab, bool bCloneCaption)
+{
+    for (ScNotes::const_iterator itr = rNotes.begin(); itr != rNotes.end(); ++itr)
+    {
+        SCCOL nCol = itr->first.first;
+        SCROW nRow = itr->first.second;
+        if (nCol >= nCol1 && nCol <= nCol2 && nRow >= nRow1 && nRow <= nRow2)
+        {
+            erase(nCol+nDx, nRow+nDy);
+            insert(nCol+nDx, nRow+nDy, itr->second->Clone( ScAddress(nCol, nRow, nTab), *pDoc, ScAddress(nCol, nRow, nTab), bCloneCaption ));
+        }
+    }
+}
+
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 4493a71..ccae115 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -267,6 +267,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const rtl::OUString& rNewName
     nScenarioFlags( 0 ),
     pDBDataNoName(NULL),
     mpRangeName(NULL),
+    maNotes(pDoc),
     bScenario(false),
     bLayoutRTL(false),
     bLoadingRTL(false),
@@ -527,15 +528,26 @@ bool ScTable::GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const
     SCCOL nMaxX = 0;
     SCROW nMaxY = 0;
     for (SCCOL i=0; i<=MAXCOL; i++)
-        if (!aCol[i].IsEmptyVisData(true))      // true = Notizen zaehlen auch
+        if (!aCol[i].IsEmptyVisData())
         {
             bFound = true;
             nMaxX = i;
-            SCROW nColY = aCol[i].GetLastVisDataPos(true);
+            SCROW nColY = aCol[i].GetLastVisDataPos();
             if (nColY > nMaxY)
                 nMaxY = nColY;
         }
 
+    for (ScNotes::const_iterator itr = maNotes.begin(); itr != maNotes.end(); ++itr)
+    {
+        SCCOL nCol = itr->first.first;
+        SCROW nRow = itr->first.second;
+
+        if (nMaxX < nCol)
+            nMaxX = nCol;
+        if (nMaxY < nRow)
+            nMaxY = nRow;
+    }
+
     rEndCol = nMaxX;
     rEndRow = nMaxY;
     return bFound;
@@ -564,16 +576,30 @@ bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes ) const
     SCCOL i;
 
     for (i=0; i<=MAXCOL; i++)               // Daten testen
-        if (!aCol[i].IsEmptyVisData(bNotes))
+        if (!aCol[i].IsEmptyVisData())
         {
             bFound = true;
             if (i>nMaxX)
                 nMaxX = i;
-            SCROW nColY = aCol[i].GetLastVisDataPos(bNotes);
+            SCROW nColY = aCol[i].GetLastVisDataPos();
             if (nColY > nMaxY)
                 nMaxY = nColY;
         }
 
+    if (bNotes)
+    {
+        for (ScNotes::const_iterator itr = maNotes.begin(); itr != maNotes.end(); ++itr)
+        {
+            SCCOL nCol = itr->first.first;
+            SCROW nRow = itr->first.second;
+
+            if (nMaxX < nCol)
+                nMaxX = nCol;
+            if (nMaxY < nRow)
+                nMaxY = nRow;
+        }
+    }
+
     SCCOL nMaxDataX = nMaxX;
 
     for (i=0; i<=MAXCOL; i++)               // Attribute testen
@@ -683,14 +709,29 @@ bool ScTable::GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
     }
 
     for (i=nStartCol; i<=nEndCol; i++)              // Daten testen
-        if (!aCol[i].IsEmptyVisData(bNotes))
+        if (!aCol[i].IsEmptyVisData())
         {
             bFound = true;
-            SCROW nColY = aCol[i].GetLastVisDataPos(bNotes);
+            SCROW nColY = aCol[i].GetLastVisDataPos();
             if (nColY > nMaxY)
                 nMaxY = nColY;
         }
 
+    if (bNotes)
+    {
+        for (ScNotes::const_iterator itr = maNotes.begin(); itr != maNotes.end(); ++itr)
+        {
+            SCCOL nCol = itr->first.first;
+            SCROW nRow = itr->first.second;
+
+            if (nStartCol > nCol || nEndCol < nCol)
+                continue;
+
+            if (nMaxY < nRow)
+                nMaxY = nRow;
+        }
+    }
+
     rEndRow = nMaxY;
     return bFound;
 }
@@ -727,16 +768,28 @@ bool ScTable::GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const
 
     bool bDatFound = false;
     for (i=0; i<=MAXCOL; i++)                   // Daten testen
-        if (!aCol[i].IsEmptyVisData(true))
+        if (!aCol[i].IsEmptyVisData())
         {
             if (!bDatFound && i<nMinX)
                 nMinX = i;
             bFound = bDatFound = true;
-            SCROW nColY = aCol[i].GetFirstVisDataPos(true);
+            SCROW nColY = aCol[i].GetFirstVisDataPos();
             if (nColY < nMinY)
                 nMinY = nColY;
         }
 
+    for (ScNotes::const_iterator itr = maNotes.begin(); itr != maNotes.end(); ++itr)
+    {
+        bFound = bDatFound = true;
+        SCCOL nCol = itr->first.first;
+        SCROW nRow = itr->first.second;
+
+        if (nMinX > nCol)
+            nMinX = nCol;
+        if (nMinY > nRow)
+            nMinY = nRow;
+    }
+
     rStartCol = nMinX;
     rStartRow = nMinY;
     return bFound;
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 2c40a5c..aef1446 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -173,6 +173,22 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
 
     for (SCCOL j=nStartCol; j<=nEndCol; j++)
         aCol[j].InsertRow( nStartRow, nSize );
+
+    ScNotes aNotes(pDocument);
+    for ( ScNotes::iterator itr = maNotes.begin(); itr != maNotes.end(); ++itr)
+    {
+        if (itr->first.second >= nStartRow)
+        {
+            aNotes.insert(itr->first.first, itr->first.second + nSize, itr->second);
+            maNotes.ReleaseNote(itr->first.first, itr->first.second);
+        }
+    }
+    for ( ScNotes::iterator itr = aNotes.begin(); itr != aNotes.end(); ++itr)
+    {
+        maNotes.insert( itr->first.first, itr->first.second, itr->second);
+        aNotes.ReleaseNote(itr->first.first, itr->first.second);
+    }
+
     DecRecalcLevel( false );
 
     InvalidatePageBreaks();
@@ -225,6 +241,21 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE
         }
     }
 
+    ScNotes aNotes(pDocument);
+    for ( ScNotes::iterator itr = maNotes.begin(); itr != maNotes.end(); ++itr)
+    {
+        if (itr->first.second >= nStartRow)
+        {
+            aNotes.insert(itr->first.first, itr->first.second - nSize, itr->second);
+            maNotes.ReleaseNote(itr->first.first, itr->first.second);
+        }
+    }
+    for ( ScNotes::iterator itr = aNotes.begin(); itr != aNotes.end(); ++itr)
+    {
+        maNotes.insert( itr->first.first, itr->first.second, itr->second);
+        aNotes.ReleaseNote(itr->first.first, itr->first.second);
+    }
+
     {   // scope for bulk broadcast
         ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM());
         for (SCCOL j=nStartCol; j<=nEndCol; j++)
@@ -307,6 +338,23 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
             aCol[MAXCOL - nSize - i].MoveTo(nStartRow, nEndRow, aCol[MAXCOL - i]);
     }
 
+    ScNotes aNotes(pDocument);
+    for ( ScNotes::iterator itr = maNotes.begin(); itr != maNotes.end(); ++itr)
+    {
+        if (itr->first.first > nStartCol)
+        {
+            aNotes.insert(itr->first.first + nSize, itr->first.second, itr->second);
+            maNotes.ReleaseNote(itr->first.first, itr->first.second);
+        }
+        else
+            aNotes.insert( itr->first.first, itr->first.second, itr->second);
+    }
+    for ( ScNotes::iterator itr = aNotes.begin(); itr != aNotes.end(); ++itr)
+    {
+        maNotes.insert( itr->first.first, itr->first.second, itr->second);
+        aNotes.ReleaseNote(itr->first.first, itr->first.second);
+    }
+
     if (nStartCol>0)                        // copy old attributes
     {
         sal_uInt16 nWhichArray[2];
@@ -387,6 +435,24 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
         for (SCSIZE i=0; static_cast<SCCOL>(i+nSize)+nStartCol <= MAXCOL; i++)
             aCol[nStartCol + nSize + i].MoveTo(nStartRow, nEndRow, aCol[nStartCol + i]);
     }
+
+    ScNotes aNotes(pDocument);
+    for ( ScNotes::iterator itr = maNotes.begin(); itr != maNotes.end(); ++itr)
+    {
+        if (itr->first.first > nStartCol)
+        {
+            aNotes.insert(itr->first.first - nSize, itr->first.second, itr->second);
+            maNotes.ReleaseNote(itr->first.first, itr->first.second);
+        }
+        else
+            aNotes.insert( itr->first.first, itr->first.second, itr->second);
+    }
+    for ( ScNotes::iterator itr = aNotes.begin(); itr != aNotes.end(); ++itr)
+    {
+        maNotes.insert( itr->first.first, itr->first.second, itr->second);
+        aNotes.ReleaseNote(itr->first.first, itr->first.second);
+    }
+
     DecRecalcLevel();
 
     InvalidatePageBreaks();
@@ -467,6 +533,10 @@ void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
         //local range names need to be copied first for formula cells
         if (!pTable->mpRangeName && mpRangeName)
             pTable->mpRangeName = new ScRangeName(*mpRangeName);
+
+        // notes
+        pTable->maNotes = *maNotes.clone(pTable->pDocument, nCol1, nRow1, nCol2, nRow2, bCloneNoteCaptions, nTab);
+
         SCCOL i;
 
         for ( i = nCol1; i <= nCol2; i++)
@@ -528,6 +598,14 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
         for ( i = nCol1; i <= nCol2; i++)
             aCol[i].CopyFromClip(nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]);
 
+        bool bAddNotes = (nInsFlag & (IDF_CONTENTS | IDF_ADDNOTES)) == (IDF_NOTE | IDF_ADDNOTES);
+        if (bAddNotes)
+        {
+            bool bCloneCaption = (nInsFlag & IDF_NOCAPTIONS) == 0;
+            maNotes.CopyFromClip(pTable->maNotes, pDocument, nCol1, nRow1, nCol2, nRow2, nDx, nDy, nTab, bCloneCaption);
+        }
+
+
         if ((nInsFlag & IDF_ATTRIB) != 0)
         {
             if (nRow1==0 && nRow2==MAXROW && pColWidth && pTable->pColWidth)
@@ -1091,41 +1169,9 @@ void ScTable::GetFormula( SCCOL nCol, SCROW nRow, rtl::OUString& rFormula )
         rFormula = rtl::OUString();
 }
 
-
-ScPostIt* ScTable::GetNote( SCCOL nCol, SCROW nRow )
+ScNotes* ScTable::GetNotes()
 {
-    return ValidColRow( nCol, nRow ) ? aCol[ nCol ].GetNote( nRow ) : 0;
-}
-
-
-void ScTable::TakeNote( SCCOL nCol, SCROW nRow, ScPostIt*& rpNote )
-{
-    if( ValidColRow( nCol, nRow ) )
-    {
-        aCol[ nCol ].TakeNote( nRow, rpNote );
-        if( rpNote && rpNote->GetNoteData().mxInitData.get() )
-        {
-            if( !mxUninitNotes.get() )
-                mxUninitNotes.reset( new ScAddress2DVec );
-            mxUninitNotes->push_back( ScAddress2D( nCol, nRow ) );
-        }
-        InvalidateTableArea();
-    }
-    else
-        DELETEZ( rpNote );
-}
-
-
-ScPostIt* ScTable::ReleaseNote( SCCOL nCol, SCROW nRow )
-{
-    return ValidColRow( nCol, nRow ) ? aCol[ nCol ].ReleaseNote( nRow ) : 0;
-}
-
-
-void ScTable::DeleteNote( SCCOL nCol, SCROW nRow )
-{
-    if( ValidColRow( nCol, nRow ) )
-        aCol[ nCol ].DeleteNote( nRow );
+    return &maNotes;
 }
 
 
@@ -1134,7 +1180,7 @@ void ScTable::InitializeNoteCaptions( bool bForced )
     if( mxUninitNotes.get() && (bForced || pDocument->IsUndoEnabled()) )
     {
         for( ScAddress2DVec::iterator aIt = mxUninitNotes->begin(), aEnd = mxUninitNotes->end(); aIt != aEnd; ++aIt )
-            if( ScPostIt* pNote = GetNote( aIt->first, aIt->second ) )
+            if( ScPostIt* pNote = maNotes.findByAddress( aIt->first, aIt->second ) )
                 pNote->GetOrCreateCaption( ScAddress( aIt->first, aIt->second, nTab ) );
         mxUninitNotes.reset();
     }
@@ -1422,7 +1468,10 @@ bool ScTable::IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
     }
     bool bEmpty = true;
     for (SCCOL i=nCol1; i<=nCol2 && bEmpty; i++)
-        bEmpty = aCol[i].IsEmptyBlock( nRow1, nRow2, bIgnoreNotes );
+    {
+        //TODO:moggi
+        bEmpty = aCol[i].IsEmptyBlock( nRow1, nRow2 );
+    }
     return bEmpty;
 }
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index b15703e..db0c249 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -580,6 +580,14 @@ void ScTable::SwapCol(SCCOL nCol1, SCCOL nCol2)
             }
         }
     }
+    for (ScNotes::iterator itr = maNotes.begin(); itr != maNotes.end(); ++itr)
+    {
+        if (itr->first.first == nCol1 || itr->first.first == nCol2)
+        {
+            //only then we need to swap
+            //TODO: implement it
+        }
+    }
 }
 
 void ScTable::SwapRow(SCROW nRow1, SCROW nRow2)
@@ -610,6 +618,15 @@ void ScTable::SwapRow(SCROW nRow1, SCROW nRow2)
         SetRowFiltered(nRow1, nRow1, bRow2Filtered);
         SetRowFiltered(nRow2, nRow2, bRow1Filtered);
     }
+
+    for (ScNotes::iterator itr = maNotes.begin(); itr != maNotes.end(); ++itr)
+    {
+        if (itr->first.second == nRow1 || itr->first.second == nRow2)
+        {
+            //only then we need to swap
+            //TODO:implement it
+        }
+    }
 }
 
 short ScTable::Compare(SCCOLROW nIndex1, SCCOLROW nIndex2)
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 381ee2d..0635eee 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -105,14 +105,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
                 }
                 break;
             case SVX_SEARCHIN_NOTE:
-                {
-                    if(const ScPostIt* pNote = pCell->GetNote())
-                    {
-                        aString = pNote->GetText();
-                        bMultiLine = pNote->HasMultiLineText();
-                    }
-                }
-                break;
+                break; // don't search this case here
             default:
                 break;
         }
@@ -219,14 +212,8 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
                 }
             }
             while (bRepeat);
-            if (rSearchItem.GetCellType() == SVX_SEARCHIN_NOTE)
-            {
-                // NB: rich text format is lost.
-                // This is also true of Cells.
-                if( ScPostIt* pNote = pCell->GetNote() )
-                    pNote->SetText( ScAddress( nCol, nRow, nTab ), aString );
-            }
-            else if ( cMatrixFlag != MM_NONE )
+
+            if ( cMatrixFlag != MM_NONE )
             {   // Matrix nicht zerreissen
                 if ( aString.Len() > 2 )
                 {   // {} raus, erst hier damit auch "{=" durch "{=..." ersetzt werden kann
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 9c6d65f..4c9c87f 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -1483,7 +1483,7 @@ void ScDetectiveFunc::UpdateAllComments( ScDocument& rDoc )
             {
                 if ( ScDrawObjData* pData = ScDrawLayer::GetNoteCaptionData( pObject, nObjTab ) )
                 {
-                    ScPostIt* pNote = rDoc.GetNote( pData->maStart );
+                    ScPostIt* pNote = rDoc.GetNotes( pData->maStart.Tab() )->findByAddress( pData->maStart );
                     // caption should exist, we iterate over drawing objects...
                     OSL_ENSURE( pNote && (pNote->GetCaption() == pObject), "ScDetectiveFunc::UpdateAllComments - invalid cell note" );
                     if( pNote )
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 31e5e84..f022e9c 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1613,25 +1613,15 @@ void ScInterpreter::ScBackSolver()
         {
             ScBaseCell* pVCell = GetCell( aValueAdr );
             // CELLTYPE_NOTE: kein Value aber von Formel referiert
-            bool bTempCell = (!pVCell || pVCell->GetCellType() == CELLTYPE_NOTE);
             ScBaseCell* pFCell = GetCell( aFormulaAdr );
 
-            if ( ((pVCell && pVCell->GetCellType() == CELLTYPE_VALUE) || bTempCell)
+            if ( ((pVCell && pVCell->GetCellType() == CELLTYPE_VALUE))
                 && pFCell && pFCell->GetCellType() == CELLTYPE_FORMULA )
             {
                 ScRange aVRange( aValueAdr, aValueAdr );    // fuer SetDirty
                 double fSaveVal; // Original value to be restored later if necessary
-                ScPostIt* pNote = 0;
 
-                if ( bTempCell )
-                {
-                    pNote = pVCell ? pVCell->ReleaseNote() : 0;
-                    fSaveVal = 0.0;
-                    pVCell = new ScValueCell( fSaveVal );
-                    pDok->PutCell( aValueAdr, pVCell );
-                }
-                else
-                    fSaveVal = GetCellValue( aValueAdr, pVCell );
+                fSaveVal = GetCellValue( aValueAdr, pVCell );
 
                 const sal_uInt16 nMaxIter = 100;
                 const double fEps = 1E-10;
@@ -1772,13 +1762,7 @@ void ScInterpreter::ScBackSolver()
                 {
                     nX = fBestX;
                 }
-                if ( bTempCell )
-                {
-                    pVCell = pNote ? new ScNoteCell( pNote ) : 0;
-                    pDok->PutCell( aValueAdr, pVCell );
-                }
-                else
-                    pValue->SetValue( fSaveVal );
+                pValue->SetValue( fSaveVal );
                 pDok->SetDirty( aVRange );
                 pFormula->Interpret();
                 if ( !bDoneIteration )
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index d427350..f77f4e7 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -149,7 +149,8 @@ ExcTable::ExcTable( const XclExpRoot& rRoot ) :
     XclExpRoot( rRoot ),
     mnScTab( SCTAB_GLOBAL ),
     nExcTab( EXC_NOTAB ),
-    pTabNames( new NameBuffer( 0, 16 ) )
+    pTabNames( new NameBuffer( 0, 16 ) ),
+    mxNoteList( new XclExpNoteList )
 {
 }
 
@@ -158,7 +159,8 @@ ExcTable::ExcTable( const XclExpRoot& rRoot, SCTAB nScTab ) :
     XclExpRoot( rRoot ),
     mnScTab( nScTab ),
     nExcTab( rRoot.GetTabInfo().GetXclTab( nScTab ) ),
-    pTabNames( new NameBuffer( 0, 16 ) )
+    pTabNames( new NameBuffer( 0, 16 ) ),
+    mxNoteList( new XclExpNoteList )
 {
 }
 
@@ -428,6 +430,17 @@ void ExcTable::FillAsTable( SCTAB nCodeNameIdx )
     // cell table: DEFROWHEIGHT, DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records
     mxCellTable.reset( new XclExpCellTable( GetRoot() ) );
 
+    //export cell 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, rtl::OUString() ) );
+    }
+
     if( GetOutput() != EXC_OUTPUT_BINARY )
     {
         FillAsXmlTable( nCodeNameIdx );
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 88b3f83..955425e 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2337,10 +2337,8 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
         if( xCell )
             maRowBfr.AppendCell( xCell, bIsMergedBase );
 
-        // notes
-        const ScPostIt* pScNote = pScCell ? pScCell->GetNote() : 0;
-        if( pScNote || (aAddNoteText.Len() > 0) )
-            mxNoteList->AppendNewRecord( new XclExpNote( GetRoot(), aScPos, pScNote, aAddNoteText ) );
+        if ( aAddNoteText.Len()  )
+            mxNoteList->AppendNewRecord( new XclExpNote( GetRoot(), aScPos, NULL, aAddNoteText ) );
 
         // other sheet contents
         if( pPattern )
diff --git a/sc/source/filter/inc/excdoc.hxx b/sc/source/filter/inc/excdoc.hxx
index 75c0f24..500ab12 100644
--- a/sc/source/filter/inc/excdoc.hxx
+++ b/sc/source/filter/inc/excdoc.hxx
@@ -33,6 +33,7 @@
 #include "excrecds.hxx"
 #include "xeroot.hxx"
 #include "root.hxx"
+#include "xeescher.hxx"
 #include <boost/shared_ptr.hpp>
 
 //------------------------------------------------------------------ Forwards -
@@ -57,6 +58,8 @@ class ExcTable : public XclExpRecordBase, public XclExpRoot
 private:
     typedef XclExpRecordList< ExcBundlesheetBase >  ExcBoundsheetList;
     typedef boost::shared_ptr< XclExpCellTable >    XclExpCellTableRef;
+    typedef XclExpRecordList< XclExpNote >      XclExpNoteList;
+    typedef boost::shared_ptr< XclExpNoteList >     XclExpNoteListRef;
 
     XclExpRecordList<>          aRecList;
     XclExpCellTableRef          mxCellTable;
@@ -68,6 +71,8 @@ private:
 
     NameBuffer*                 pTabNames;
 
+    XclExpNoteListRef   mxNoteList;
+
     // pRec mit new anlegen und vergessen, delete macht ExcTable selber!
     void                        Add( XclExpRecordBase* pRec );
 
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 4770839..b246f73 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2195,13 +2195,13 @@ void ScXMLExport::_ExportAutoStyles()
             while (aNoteIter != aNoteEnd)
             {
                 ScAddress aPos = aNoteIter->maCellPos;
-                sal_Int32 nTable = aPos.Tab();
-                bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
+                SCTAB nTable = aPos.Tab();
+                bool bCopySheet = pDoc->IsStreamValid( nTable );
                 if (bCopySheet)
                 {
                     //! separate method AddStyleFromNote needed?
 
-                    ScPostIt* pNote = pDoc->GetNote( aPos );
+                    ScPostIt* pNote = pDoc->GetNotes( nTable )->findByAddress(aPos);
                     OSL_ENSURE( pNote, "note not found" );
                     if (pNote)
                     {
@@ -2243,11 +2243,11 @@ void ScXMLExport::_ExportAutoStyles()
             while (aNoteParaIter != aNoteParaEnd)
             {
                 ScAddress aPos = aNoteParaIter->maCellPos;
-                sal_Int32 nTable = aPos.Tab();
-                bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
+                SCTAB nTable = aPos.Tab();
+                bool bCopySheet = pDoc->IsStreamValid( nTable );
                 if (bCopySheet)
                 {
-                    ScPostIt* pNote = pDoc->GetNote( aPos );
+                    ScPostIt* pNote = pDoc->GetNotes(nTable)->findByAddress( aPos );
                     OSL_ENSURE( pNote, "note not found" );
                     if (pNote)
                     {
@@ -2278,11 +2278,11 @@ void ScXMLExport::_ExportAutoStyles()
             while (aNoteTextIter != aNoteTextEnd)
             {
                 ScAddress aPos = aNoteTextIter->maCellPos;
-                sal_Int32 nTable = aPos.Tab();
-                bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
+                SCTAB nTable = aPos.Tab();
+                bool bCopySheet = pDoc->IsStreamValid( nTable );
                 if (bCopySheet)
                 {
-                    ScPostIt* pNote = pDoc->GetNote( aPos );
+                    ScPostIt* pNote = pDoc->GetNotes(nTable)->findByAddress( aPos );
                     OSL_ENSURE( pNote, "note not found" );
                     if (pNote)
                     {
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index fc08ca8..f3ccf18 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -191,7 +191,7 @@ sal_Int32 ScNotesChildren::AddNotes(const ScPreviewLocationData& rData, const Re
                 }
                 else
                 {
-                    if( ScPostIt* pNote = pDoc->GetNote( aNote.maNoteCell ) )
+                    if( ScPostIt* pNote = pDoc->GetNotes( aNote.maNoteCell.Tab() )->findByAddress( aNote.maNoteCell ) )
                         aNote.maNoteText = pNote->GetText();
                     aNote.mpTextHelper = CreateTextHelper(aNote.maNoteText, aNote.maRect, aNote.maNoteCell, aNote.mbMarkNote, nParagraphs + mnOffset);
                     if (aNote.mpTextHelper)
@@ -368,7 +368,7 @@ sal_Int32 ScNotesChildren::CheckChanges(const ScPreviewLocationData& rData,
                 }
                 else
                 {
-                    if( ScPostIt* pNote = pDoc->GetNote( aNote.maNoteCell ) )
+                    if( ScPostIt* pNote = pDoc->GetNotes( aNote.maNoteCell.Tab() )->findByAddress( aNote.maNoteCell ) )
                         aNote.maNoteText = pNote->GetText();
                 }
 
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 5804190..b8c995b 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1108,7 +1108,7 @@ sal_Bool ScDocFunc::SetCellText( const ScAddress& rPos, const String& rText,
 bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
 {
     ScDocument& rDoc = *rDocShell.GetDocument();
-    ScPostIt* pNote = rDoc.GetNote( rPos );
+    ScPostIt* pNote = rDoc.GetNotes( rPos.Tab() )->findByAddress( rPos );
     if( !pNote || (bShow == pNote->IsCaptionShown()) ) return false;
 
     // move the caption to internal or hidden layer and create undo action
@@ -1141,7 +1141,7 @@ bool ScDocFunc::SetNoteText( const ScAddress& rPos, const String& rText, sal_Boo
 
     String aNewText = convertLineEnd(rText, GetSystemLineEnd()); //! ist das noetig ???
 
-    if( ScPostIt* pNote = (aNewText.Len() > 0) ? pDoc->GetOrCreateNote( rPos ) : pDoc->GetNote( rPos ) )
+    if( ScPostIt* pNote = (aNewText.Len() > 0) ? pDoc->GetNotes(rPos.Tab())->GetOrCreateNote( rPos ) : pDoc->GetNotes( rPos.Tab() )->findByAddress(rPos) )
         pNote->SetText( rPos, aNewText );
 
     //! Undo !!!
@@ -1170,7 +1170,7 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, con
         ::svl::IUndoManager* pUndoMgr = (pDrawLayer && rDoc.IsUndoEnabled()) ? rDocShell.GetUndoManager() : 0;
 
         ScNoteData aOldData;
-        ScPostIt* pOldNote = rDoc.ReleaseNote( rPos );
+        ScPostIt* pOldNote = rDoc.GetNotes(rPos.Tab())->ReleaseNote( rPos );
         if( pOldNote )
         {
             // ensure existing caption object before draw undo tracking starts
@@ -4406,7 +4406,7 @@ sal_Bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, sal_Bool bCont
             bool bHasNotes = false;
             for( ScAddress aPos( nStartCol, nStartRow, nTab ); !bHasNotes && (aPos.Col() <= nEndCol); aPos.IncCol() )
                 for( aPos.SetRow( nStartRow ); !bHasNotes && (aPos.Row() <= nEndRow); aPos.IncRow() )
-                    bHasNotes = ((aPos.Col() != nStartCol) || (aPos.Row() != nStartRow)) && (pDoc->GetNote( aPos ) != 0);
+                    bHasNotes = ((aPos.Col() != nStartCol) || (aPos.Row() != nStartRow)) && (pDoc->GetNotes( aPos.Tab() )->findByAddress(aPos) != 0);
 
             if (!pUndoDoc)
             {
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 7a8c06c..62c8633 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -263,15 +263,11 @@ sal_uInt16 ScDocShell::GetHiddenInformationState( sal_uInt16 nStates )
     if ( nStates & HIDDENINFORMATION_NOTES )
     {
         SCTAB nTableCount = aDocument.GetTableCount();
-        SCTAB nTable = 0;
-        sal_Bool bFound(false);
-        while ( nTable < nTableCount && !bFound )
+        bool bFound = false;
+        for (SCTAB nTab = 0; nTab < nTableCount && !bFound; ++nTab)
         {
-            ScCellIterator aCellIter( &aDocument, 0,0, nTable, MAXCOL,MAXROW, nTable );
-            for( ScBaseCell* pCell = aCellIter.GetFirst(); pCell && !bFound; pCell = aCellIter.GetNext() )
-                if (pCell->HasNote())
-                    bFound = sal_True;
-            nTable++;
+            if (!aDocument.GetNotes(nTab)->empty())
+                bFound = true;
         }
 
         if (bFound)
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index 3bc52a5..6a3387b 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -79,7 +79,7 @@ void FuText::StopEditMode(sal_Bool /*bTextDirection*/)
     if( const ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObject, rViewData.GetTabNo() ) )
     {
         aNotePos = pCaptData->maStart;
-        pNote = rDoc.GetNote( aNotePos );
+        pNote = rDoc.GetNotes( aNotePos.Tab() )->findByAddress( aNotePos );
         OSL_ENSURE( pNote && (pNote->GetCaption() == pObject), "FuText::StopEditMode - missing or invalid cell note" );
     }
 
@@ -147,13 +147,13 @@ void FuText::StopEditMode(sal_Bool /*bTextDirection*/)
                 // rescue note data before deletion
                 ScNoteData aNoteData( pNote->GetNoteData() );
                 // delete note from document (removes caption, but does not delete it)
-                rDoc.DeleteNote( aNotePos );
+                rDoc.GetNotes( aNotePos.Tab() )->erase( aNotePos );
                 // create undo action for removed note
                 pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, aNotePos, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
             }
             else
             {
-                rDoc.DeleteNote( aNotePos );
+                rDoc.GetNotes( aNotePos.Tab() )->erase( aNotePos );
             }
             // ScDocument::DeleteNote has deleted the note that pNote points to
             pNote = 0;
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index c80ca02..6b9b620 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -850,7 +850,7 @@ const ScAreaLink* ScContentTree::GetLink( sal_uLong nIndex )
         }
     }
 
-    OSL_FAIL("Link nicht gefunden");
+    OSL_FAIL("link not found");
     return NULL;
 }
 
@@ -875,10 +875,12 @@ void ScContentTree::GetNoteStrings()
     SCTAB nTabCount = pDoc->GetTableCount();
     for (SCTAB nTab=0; nTab<nTabCount; nTab++)
     {
-        ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab );
-        for( ScBaseCell* pCell = aIter.GetFirst(); pCell; pCell = aIter.GetNext() )
-            if( const ScPostIt* pNote = pCell->GetNote() )
-                InsertContent( SC_CONTENT_NOTE, lcl_NoteString( *pNote ) );
+        ScNotes::iterator itr = pDoc->GetNotes(nTab)->begin();
+        ScNotes::iterator itrEnd = pDoc->GetNotes(nTab)->end();
+        for (; itr != itrEnd; ++itr)
+        {
+//TODO: moggi
+        }
     }
 }
 
@@ -892,21 +894,22 @@ ScAddress ScContentTree::GetNotePos( sal_uLong nIndex )
     SCTAB nTabCount = pDoc->GetTableCount();
     for (SCTAB nTab=0; nTab<nTabCount; nTab++)
     {
-        ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab );
-        ScBaseCell* pCell = aIter.GetFirst();
-        while (pCell)
+        ScNotes* pNotes = pDoc->GetNotes(nTab);
+        if (nFound + pNotes->size() >= nIndex)
         {
-            if( pCell->HasNote() )
+            for (ScNotes::const_iterator itr = pNotes->begin(); itr != pNotes->end(); ++itr)
             {
                 if (nFound == nIndex)
-                    return ScAddress( aIter.GetCol(), aIter.GetRow(), nTab );   // gefunden
+                    return ScAddress( itr->first.first, itr->first.second, nTab );   // gefunden
+
                 ++nFound;
             }
-            pCell = aIter.GetNext();
         }
+        else
+            nFound += pNotes->size();
     }
 
-    OSL_FAIL("Notiz nicht gefunden");
+    OSL_FAIL("note not found");
     return ScAddress();
 }
 
@@ -922,15 +925,14 @@ sal_Bool ScContentTree::NoteStringsChanged()
 
     SvLBoxEntry* pEntry = FirstChild( pParent );
 
-    sal_Bool bEqual = sal_True;
+    bool bEqual = true;
     SCTAB nTabCount = pDoc->GetTableCount();
     for (SCTAB nTab=0; nTab<nTabCount && bEqual; nTab++)
     {
-        ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab );
-        ScBaseCell* pCell = aIter.GetFirst();
-        while (pCell && bEqual)
+        ScNotes* pNotes = pDoc->GetNotes(nTab);
+        for (ScNotes::const_iterator itr = pNotes->begin(); itr != pNotes->end(); ++itr)
         {
-            if( const ScPostIt* pNote = pCell->GetNote() )
+            if( const ScPostIt* pNote = itr->second )
             {
                 if ( !pEntry )
                     bEqual = false;
@@ -942,7 +944,6 @@ sal_Bool ScContentTree::NoteStringsChanged()
                     pEntry = NextSibling( pEntry );
                 }
             }
-            pCell = aIter.GetNext();
         }
     }
 
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 00f3b6e..3286614 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -1210,7 +1210,7 @@ void ScUndoReplace::Undo()
     }
     else if (pSearchItem->GetCellType() == SVX_SEARCHIN_NOTE)
     {
-        ScPostIt* pNote = pDoc->GetNote( aCursorPos );
+        ScPostIt* pNote = pDoc->GetNotes( aCursorPos.Tab() )->findByAddress( aCursorPos );
         OSL_ENSURE( pNote, "ScUndoReplace::Undo - cell does not contain a note" );
         if (pNote)
             pNote->SetText( aCursorPos, aUndoStr );
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 1149642..a0198bb 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -897,9 +897,9 @@ void ScUndoReplaceNote::DoInsertNote( const ScNoteData& rNoteData )
     if( rNoteData.mpCaption )
     {
         ScDocument& rDoc = *pDocShell->GetDocument();
-        OSL_ENSURE( !rDoc.GetNote( maPos ), "ScUndoReplaceNote::DoInsertNote - unexpected cell note" );
+        OSL_ENSURE( !rDoc.GetNotes( maPos.Tab() )->findByAddress(maPos), "ScUndoReplaceNote::DoInsertNote - unexpected cell note" );
         ScPostIt* pNote = new ScPostIt( rDoc, maPos, rNoteData, false );
-        rDoc.TakeNote( maPos, pNote );
+        rDoc.GetNotes(maPos.Tab())->insert( maPos, pNote );
     }
 }
 
@@ -908,8 +908,8 @@ void ScUndoReplaceNote::DoRemoveNote( const ScNoteData& rNoteData )
     if( rNoteData.mpCaption )
     {
         ScDocument& rDoc = *pDocShell->GetDocument();
-        OSL_ENSURE( rDoc.GetNote( maPos ), "ScUndoReplaceNote::DoRemoveNote - missing cell note" );
-        if( ScPostIt* pNote = rDoc.ReleaseNote( maPos ) )
+        OSL_ENSURE( rDoc.GetNotes( maPos.Tab() )->findByAddress(maPos), "ScUndoReplaceNote::DoRemoveNote - missing cell note" );
+        if( ScPostIt* pNote = rDoc.GetNotes(maPos.Tab())->ReleaseNote( maPos ) )
         {
             /*  Forget pointer to caption object to suppress removing the
                 caption object from the drawing layer while deleting pNote
@@ -936,7 +936,7 @@ ScUndoShowHideNote::~ScUndoShowHideNote()
 void ScUndoShowHideNote::Undo()
 {
     BeginUndo();
-    if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( maPos ) )
+    if( ScPostIt* pNote = pDocShell->GetDocument()->GetNotes( maPos.Tab() )->findByAddress(maPos) )
         pNote->ShowCaption( maPos, !mbShown );
     EndUndo();
 }
@@ -944,7 +944,7 @@ void ScUndoShowHideNote::Undo()
 void ScUndoShowHideNote::Redo()
 {
     BeginRedo();
-    if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( maPos ) )
+    if( ScPostIt* pNote = pDocShell->GetDocument()->GetNotes( maPos.Tab() )->findByAddress(maPos) )
         pNote->ShowCaption( maPos, mbShown );
     EndRedo();
 }
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 10a4ac7..3ab1978 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -3581,53 +3581,50 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC
             while (pCell)
             {
                 sal_Bool bAdd = false;
-                if ( pCell->HasNote() && ( nContentFlags & sheet::CellFlags::ANNOTATION ) )
-                    bAdd = sal_True;
-                else
-                    switch ( pCell->GetCellType() )
-                    {
-                        case CELLTYPE_STRING:
-                            if ( nContentFlags & sheet::CellFlags::STRING )
-                                bAdd = sal_True;
-                            break;
-                        case CELLTYPE_EDIT:
-                            if ( (nContentFlags & sheet::CellFlags::STRING) || (nContentFlags & sheet::CellFlags::FORMATTED) )
-                                bAdd = sal_True;
-                            break;
-                        case CELLTYPE_FORMULA:
-                            if ( nContentFlags & sheet::CellFlags::FORMULA )
-                                bAdd = sal_True;
-                            break;
-                        case CELLTYPE_VALUE:
-                            if ( (nContentFlags & (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME))
-                                    == (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME) )
-                                bAdd = sal_True;
-                            else
-                            {
-                                //  Date/Time Erkennung
+                switch ( pCell->GetCellType() )
+                {
+                    case CELLTYPE_STRING:
+                        if ( nContentFlags & sheet::CellFlags::STRING )
+                            bAdd = sal_True;
+                        break;
+                    case CELLTYPE_EDIT:
+                        if ( (nContentFlags & sheet::CellFlags::STRING) || (nContentFlags & sheet::CellFlags::FORMATTED) )
+                            bAdd = sal_True;
+                        break;
+                    case CELLTYPE_FORMULA:
+                        if ( nContentFlags & sheet::CellFlags::FORMULA )
+                            bAdd = sal_True;
+                        break;
+                    case CELLTYPE_VALUE:
+                        if ( (nContentFlags & (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME))
+                                == (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME) )
+                            bAdd = sal_True;
+                        else
+                        {
+                            //  Date/Time Erkennung
 
-                                sal_uLong nIndex = (sal_uLong)((SfxUInt32Item*)pDoc->GetAttr(
+                            sal_uLong nIndex = (sal_uLong)((SfxUInt32Item*)pDoc->GetAttr(
                                         aIter.GetCol(), aIter.GetRow(), aIter.GetTab(),
                                         ATTR_VALUE_FORMAT ))->GetValue();
-                                short nTyp = pDoc->GetFormatTable()->GetType(nIndex);
-                                if ((nTyp == NUMBERFORMAT_DATE) || (nTyp == NUMBERFORMAT_TIME) ||
+                            short nTyp = pDoc->GetFormatTable()->GetType(nIndex);
+                            if ((nTyp == NUMBERFORMAT_DATE) || (nTyp == NUMBERFORMAT_TIME) ||
                                     (nTyp == NUMBERFORMAT_DATETIME))
-                                {
-                                    if ( nContentFlags & sheet::CellFlags::DATETIME )
-                                        bAdd = sal_True;
-                                }
-                                else
-                                {
-                                    if ( nContentFlags & sheet::CellFlags::VALUE )
-                                        bAdd = sal_True;
-                                }
+                            {
+                                if ( nContentFlags & sheet::CellFlags::DATETIME )
+                                    bAdd = sal_True;
                             }
-                            break;
-                        default:
+                            else
+                            {
+                                if ( nContentFlags & sheet::CellFlags::VALUE )
+                                    bAdd = sal_True;
+                            }
+                        }
+                        break;
+                    default:
                         {
                             // added to avoid warnings
                         }
-                    }
+                }
 
                 if (bAdd)
                     aMarkData.SetMultiMarkArea(
@@ -3636,6 +3633,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC
 
                 pCell = aIter.GetNext();
             }
+
         }
 
         ScRangeList aNewRanges;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 0b3b231..147c10d 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -3493,18 +3493,15 @@ bool ScAnnotationsObj::GetAddressByIndex_Impl( sal_Int32 nIndex, ScAddress& rPos
     {
         sal_Int32 nFound = 0;
         ScDocument* pDoc = pDocShell->GetDocument();
-        ScCellIterator aCellIter( pDoc, 0,0, nTab, MAXCOL,MAXROW, nTab );
-        for( ScBaseCell* pCell = aCellIter.GetFirst(); pCell; pCell = aCellIter.GetNext() )
+        const ScNotes* pNotes = pDoc->GetNotes(nTab);
+        for (ScNotes::const_iterator itr = pNotes->begin(); itr != pNotes->end(); ++itr)
         {
-            if (pCell->HasNote())
+            if (nFound == nIndex)
             {
-                if (nFound == nIndex)
-                {
-                    rPos = ScAddress( aCellIter.GetCol(), aCellIter.GetRow(), aCellIter.GetTab() );
-                    return true;
-                }
-                ++nFound;
+                rPos = ScAddress( itr->first.first, itr->first.second, nTab );
+                return true;
             }
+            ++nFound;
         }
     }
     return false;
@@ -3575,10 +3572,8 @@ sal_Int32 SAL_CALL ScAnnotationsObj::getCount() throw(uno::RuntimeException)
     sal_uLong nCount = 0;
     if (pDocShell)
     {
-        ScCellIterator aCellIter( pDocShell->GetDocument(), 0,0, nTab, MAXCOL,MAXROW, nTab );
-        for( ScBaseCell* pCell = aCellIter.GetFirst(); pCell; pCell = aCellIter.GetNext() )
-            if (pCell->HasNote())
-                ++nCount;
+        ScDocument* pDoc = pDocShell->GetDocument();
+        nCount = pDoc->GetNotes(nTab)->size();
     }
     return nCount;
 }
diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx
index 03d0b1c..e21282c 100644
--- a/sc/source/ui/unoobj/editsrc.cxx
+++ b/sc/source/ui/unoobj/editsrc.cxx
@@ -219,7 +219,7 @@ SvxEditSource* ScAnnotationEditSource::Clone() const
 
 SdrObject* ScAnnotationEditSource::GetCaptionObj()
 {
-    ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos );
+    ScPostIt* pNote = pDocShell->GetDocument()->GetNotes( aCellPos.Tab() )->findByAddress(aCellPos);
     return pNote ? pNote->GetOrCreateCaption( aCellPos ) : 0;
 }
 
@@ -245,7 +245,7 @@ SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder()
         return pForwarder;
 
     if ( pDocShell )
-        if ( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos ) )
+        if ( ScPostIt* pNote = pDocShell->GetDocument()->GetNotes( aCellPos.Tab() )->findByAddress(aCellPos) )
             if ( const EditTextObject* pEditObj = pNote->GetEditTextObject() )
                 pEditEngine->SetText( *pEditObj );      // incl. Umbrueche
 
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index 7eec85f..8fcfc1d 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -268,7 +268,7 @@ SvxUnoText& ScAnnotationObj::GetUnoText()
 
 const ScPostIt* ScAnnotationObj::ImplGetNote() const
 {
-    return pDocShell ? pDocShell->GetDocument()->GetNote( aCellPos ) : 0;
+    return pDocShell ? pDocShell->GetDocument()->GetNotes( aCellPos.Tab() )->findByAddress(aCellPos) : 0;
 }
 //------------------------------------------------------------------------
 
@@ -298,7 +298,7 @@ SvxUnoText& ScAnnotationShapeObj::GetUnoText()
 uno::Reference < drawing::XShape > ScAnnotationShapeObj::GetXShape()
 {
     if (!xShape.is())
-        if( ScPostIt* pNote = pDocShell->GetDocument()->GetNote( aCellPos ) )
+        if( ScPostIt* pNote = pDocShell->GetDocument()->GetNotes( aCellPos.Tab() )->findByAddress(aCellPos) )
             if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) )

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list