summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2013-10-23 13:17:00 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-10-23 15:44:12 -0400
commit3347f41a9b13c317c1d001e7ff501a4b0ee8f896 (patch)
treeb4c9a82e46e52ad3a8d0969a10989b59bec457bd /sc
parentc1cc1861ea6a656645885938dac9e4442d96510b (diff)
Avoid exposing the internal cell note storage outside ScDocument.
Let's try to avoid including mtvelements.hxx in document.hxx... mtvelements.hxx is very parser-heavy, and document.hxx is included everywhere... Change-Id: I2768ba6e25f8ff10f61f9cfd4a7cbc4844230630
Diffstat (limited to 'sc')
-rw-r--r--sc/Library_scopencl.mk1
-rw-r--r--sc/inc/column.hxx37
-rw-r--r--sc/inc/document.hxx30
-rw-r--r--sc/inc/postit.hxx12
-rw-r--r--sc/inc/table.hxx36
-rw-r--r--sc/source/core/data/column2.cxx76
-rw-r--r--sc/source/core/data/document.cxx72
-rw-r--r--sc/source/core/data/postit.cxx8
-rw-r--r--sc/source/core/data/table2.cxx22
-rw-r--r--sc/source/filter/excel/excdoc.cxx34
-rw-r--r--sc/source/ui/navipi/content.cxx116
-rw-r--r--sc/source/ui/unoobj/docuno.cxx41
12 files changed, 269 insertions, 216 deletions
diff --git a/sc/Library_scopencl.mk b/sc/Library_scopencl.mk
index 75dcaf093c95..cb702e867eda 100644
--- a/sc/Library_scopencl.mk
+++ b/sc/Library_scopencl.mk
@@ -21,7 +21,6 @@ $(eval $(call gb_Library_use_sdk_api,scopencl))
$(eval $(call gb_Library_use_externals,scopencl,\
boost_headers \
- mdds_headers \
))
$(eval $(call gb_Library_use_libraries,scopencl,\
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 042cd7235813..ca0374e97c53 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -38,21 +38,24 @@ namespace editeng { class SvxBorderLine; }
namespace formula { struct VectorRefArray; }
namespace sc {
- struct FormulaGroupContext;
- class StartListeningContext;
- class EndListeningContext;
- class CopyFromClipContext;
- class CopyToClipContext;
- class CopyToDocContext;
- class MixDocContext;
- class ColumnSpanSet;
- struct ColumnBlockPosition;
- class SingleColumnSpanSet;
- struct RefUpdateContext;
- struct RefUpdateInsertTabContext;
- struct RefUpdateDeleteTabContext;
- struct RefUpdateMoveTabContext;
- class EditTextIterator;
+
+struct FormulaGroupContext;
+class StartListeningContext;
+class EndListeningContext;
+class CopyFromClipContext;
+class CopyToClipContext;
+class CopyToDocContext;
+class MixDocContext;
+class ColumnSpanSet;
+struct ColumnBlockPosition;
+class SingleColumnSpanSet;
+struct RefUpdateContext;
+struct RefUpdateInsertTabContext;
+struct RefUpdateDeleteTabContext;
+struct RefUpdateMoveTabContext;
+class EditTextIterator;
+struct NoteEntry;
+
}
class Fraction;
@@ -500,6 +503,10 @@ public:
void SetCellNote( SCROW nRow, ScPostIt* pNote);
bool IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
+ size_t GetNoteCount() const;
+ SCROW GetNotePosition( size_t nIndex ) const;
+ void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
+
SCROW GetCellNotesMaxRow() const;
SCROW GetCellNotesMinRow() const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 516ccc0d11e8..752984d3dd22 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -48,8 +48,6 @@
#include <boost/scoped_ptr.hpp>
#include "markdata.hxx"
-#include "mtvelements.hxx"
-
namespace editeng { class SvxBorderLine; }
namespace formula { struct VectorRefArray; }
namespace svl {
@@ -60,14 +58,17 @@ class SharedStringPool;
}
namespace sc {
- struct FormulaGroupContext;
- class StartListeningContext;
- class EndListeningContext;
- class CopyFromClipContext;
- class ColumnSpanSet;
- struct ColumnBlockPosition;
- struct RefUpdateContext;
- class EditTextIterator;
+
+struct FormulaGroupContext;
+class StartListeningContext;
+class EndListeningContext;
+class CopyFromClipContext;
+class ColumnSpanSet;
+struct ColumnBlockPosition;
+struct RefUpdateContext;
+class EditTextIterator;
+struct NoteEntry;
+
}
class SvxFontItem;
@@ -905,8 +906,13 @@ public:
SC_DLLPUBLIC ScPostIt* ReleaseNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
SC_DLLPUBLIC ScPostIt* GetOrCreateNote(const ScAddress& rPos);
SC_DLLPUBLIC ScPostIt* CreateNote(const ScAddress& rPos);
- sal_uLong CountNotes();
- SC_DLLPUBLIC sc::CellNoteStoreType& GetColNotes(SCCOL nCol, SCTAB nTab);
+ size_t CountNotes() const;
+ size_t GetNoteCount( SCTAB nTab, SCCOL nCol ) const;
+
+ ScAddress GetNotePosition( size_t nIndex ) const;
+ SCROW GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const;
+
+ SC_DLLPUBLIC void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab);
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 9a7c60a2d5ea..d31dcfd2b032 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -244,5 +244,17 @@ public:
};
+namespace sc {
+
+struct NoteEntry
+{
+ ScAddress maPos;
+ const ScPostIt* mpNote;
+
+ NoteEntry( const ScAddress& rPos, const ScPostIt* pNote );
+};
+
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 586cf82c58d9..3c7aa0e6fd0c 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -51,20 +51,23 @@ namespace com { namespace sun { namespace star {
namespace formula { struct VectorRefArray; }
namespace sc {
- struct FormulaGroupContext;
- class StartListeningContext;
- class EndListeningContext;
- class CopyFromClipContext;
- class CopyToClipContext;
- class CopyToDocContext;
- class MixDocContext;
- class ColumnSpanSet;
- class ColumnSet;
- struct ColumnBlockPosition;
- struct RefUpdateContext;
- struct RefUpdateInsertTabContext;
- struct RefUpdateDeleteTabContext;
- struct RefUpdateMoveTabContext;
+
+struct FormulaGroupContext;
+class StartListeningContext;
+class EndListeningContext;
+class CopyFromClipContext;
+class CopyToClipContext;
+class CopyToDocContext;
+class MixDocContext;
+class ColumnSpanSet;
+class ColumnSet;
+struct ColumnBlockPosition;
+struct RefUpdateContext;
+struct RefUpdateInsertTabContext;
+struct RefUpdateDeleteTabContext;
+struct RefUpdateMoveTabContext;
+struct NoteEntry;
+
}
class SfxItemSet;
@@ -375,6 +378,11 @@ public:
ScPostIt* GetNote(const SCCOL nCol, const SCROW nRow);
+ size_t GetNoteCount( SCCOL nCol ) const;
+ SCROW GetNotePosition( SCCOL nCol, size_t nIndex ) const;
+
+ void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
+
bool TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ) const;
void InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
void DeleteRow(
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 0027ed8d2a91..a3bdef50f9d0 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1214,6 +1214,82 @@ bool ScColumn::IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const
return nEndRow < nNextRow;
}
+size_t ScColumn::GetNoteCount() const
+{
+ size_t nCount = 0;
+ sc::CellNoteStoreType::const_iterator it = maCellNotes.begin(), itEnd = maCellNotes.end();
+ for (; it != itEnd; ++it)
+ {
+ if (it->type != sc::element_type_cellnote)
+ continue;
+
+ nCount += it->size;
+ }
+
+ return nCount;
+}
+
+SCROW ScColumn::GetNotePosition( size_t nIndex ) const
+{
+ // Return the row position of the nth note in the column.
+
+ sc::CellNoteStoreType::const_iterator it = maCellNotes.begin(), itEnd = maCellNotes.end();
+
+ size_t nCount = 0; // Number of notes encountered so far.
+ for (; it != itEnd; ++it)
+ {
+ if (!it->type != sc::element_type_cellnote)
+ // Skip the empty blocks.
+ continue;
+
+ if (nIndex < nCount + it->size)
+ {
+ // Index falls within this block.
+ size_t nOffset = nIndex - nCount;
+ return it->position + nOffset;
+ }
+
+ nCount += it->size;
+ }
+
+ return -1;
+}
+
+namespace {
+
+class NoteEntryCollector
+{
+ std::vector<sc::NoteEntry>& mrNotes;
+ SCTAB mnTab;
+ SCCOL mnCol;
+public:
+ NoteEntryCollector( std::vector<sc::NoteEntry>& rNotes, SCTAB nTab, SCCOL nCol ) :
+ mrNotes(rNotes), mnTab(nTab), mnCol(nCol) {}
+
+ void operator() (const sc::CellNoteStoreType::value_type& node) const
+ {
+ if (node.type != sc::element_type_cellnote)
+ return;
+
+ size_t nTopRow = node.position;
+ sc::cellnote_block::const_iterator it = sc::cellnote_block::begin(*node.data);
+ sc::cellnote_block::const_iterator itEnd = sc::cellnote_block::end(*node.data);
+ size_t nOffset = 0;
+ for (; it != itEnd; ++it, ++nOffset)
+ {
+ ScAddress aPos(mnCol, nTopRow + nOffset, mnTab);
+ mrNotes.push_back(sc::NoteEntry(aPos, *it));
+ }
+ }
+};
+
+}
+
+void ScColumn::GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const
+{
+ std::for_each(maCellNotes.begin(), maCellNotes.end(), NoteEntryCollector(rNotes, nTab, nCol));
+}
+
SCSIZE ScColumn::GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const
{
// Given a range of rows, find a top or bottom empty segment.
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index a6180bc946b4..30c92563b7fa 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6073,10 +6073,7 @@ ScPostIt* ScDocument::GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab)
return NULL;
}
-sc::CellNoteStoreType& ScDocument::GetColNotes(SCCOL nCol, SCTAB nTab)
-{
- return maTabs[nTab]->aCol[nCol].maCellNotes;
-}
+
void ScDocument::SetNote(const ScAddress& rPos, ScPostIt* pNote)
{
return SetNote(rPos.Col(), rPos.Row(), rPos.Tab(), pNote);
@@ -6138,24 +6135,75 @@ ScPostIt* ScDocument::CreateNote(const ScAddress& rPos)
return pPostIt;
}
-sal_uLong ScDocument::CountNotes()
+size_t ScDocument::CountNotes() const
{
- sal_uLong nCount = 0;
+ size_t nCount = 0;
SCTAB nTabCount = GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
{
for (SCCOL nCol=0; nCol<MAXCOLCOUNT; nCol++)
+ nCount += GetNoteCount(nTab, nCol);
+ }
+ return nCount;
+}
+
+size_t ScDocument::GetNoteCount( SCTAB nTab, SCCOL nCol ) const
+{
+ const ScTable* pTab = FetchTable(nTab);
+ if (!pTab)
+ return 0;
+
+ return pTab->GetNoteCount(nCol);
+}
+
+ScAddress ScDocument::GetNotePosition( size_t nIndex ) const
+{
+ for (size_t nTab = 0; nTab < maTabs.size(); ++nTab)
+ {
+ for (SCCOL nCol=0; nCol<MAXCOLCOUNT; nCol++)
{
- sc::CellNoteStoreType& maCellNotes = GetColNotes(nCol, nTab);
- sc::CellNoteStoreType::const_iterator it = maCellNotes.begin(), itEnd = maCellNotes.end();
- for (; it != itEnd; ++it)
+ size_t nColNoteCount = GetNoteCount(nTab, nCol);
+ if (!nColNoteCount)
+ continue;
+
+ if (nIndex >= nColNoteCount)
{
- if (it->type == sc::element_type_cellnote)
- nCount +=it->size;
+ nIndex -= nColNoteCount;
+ continue;
}
+
+ SCROW nRow = GetNotePosition(nTab, nCol, nIndex);
+ if (nRow >= 0)
+ return ScAddress(nCol, nRow, nTab);
+
+ OSL_FAIL("note not found");
+ return ScAddress();
}
}
- return nCount;
+
+ OSL_FAIL("note not found");
+ return ScAddress();
+}
+
+SCROW ScDocument::GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const
+{
+ const ScTable* pTab = FetchTable(nTab);
+ if (!pTab)
+ return -1;
+
+ return pTab->GetNotePosition(nCol, nIndex);
+}
+
+void ScDocument::GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const
+{
+ for (size_t nTab = 0; nTab < maTabs.size(); ++nTab)
+ {
+ const ScTable* pTab = maTabs[nTab];
+ if (!pTab)
+ continue;
+
+ pTab->GetAllNoteEntries(rNotes);
+ }
}
void ScDocument::SetAutoNameCache( ScAutoNameCache* pCache )
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 67f730344ca5..dfd143dfd803 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -936,4 +936,12 @@ ScPostIt* ScNoteUtil::CreateNoteFromString(
}
return pNote;
}
+
+namespace sc {
+
+NoteEntry::NoteEntry( const ScAddress& rPos, const ScPostIt* pNote ) :
+ maPos(rPos), mpNote(pNote) {}
+
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 312aa22b77a4..5295af6c5e5c 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1502,6 +1502,28 @@ ScPostIt* ScTable::GetNote(const SCCOL nCol, const SCROW nRow)
return pDocument->GetNote(nCol, nRow, nTab);
}
+size_t ScTable::GetNoteCount( SCCOL nCol ) const
+{
+ if (!ValidCol(nCol))
+ return 0;
+
+ return aCol[nCol].GetNoteCount();
+}
+
+SCROW ScTable::GetNotePosition( SCCOL nCol, size_t nIndex ) const
+{
+ if (!ValidCol(nCol))
+ return -1;
+
+ return aCol[nCol].GetNotePosition(nIndex);
+}
+
+void ScTable::GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const
+{
+ for (SCCOL nCol = 0; nCol < MAXCOLCOUNT; ++nCol)
+ aCol[nCol].GetAllNoteEntries(rNotes);
+}
+
CellType ScTable::GetCellType( SCCOL nCol, SCROW nRow ) const
{
if (ValidColRow( nCol, nRow ))
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index 32db2e80c81f..574dcbb09bb7 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -417,35 +417,11 @@ void ExcTable::FillAsTable( SCTAB nCodeNameIdx )
mxCellTable.reset( new XclExpCellTable( GetRoot() ) );
//export cell notes
- for (SCCOL nCol=0; nCol<MAXCOLCOUNT; nCol++)
- {
- if ( rDoc.HasColNotes(nCol, mnScTab) )
- {
- sc::CellNoteStoreType& maCellNotes = rDoc.GetColNotes(nCol, mnScTab);
-
- sc::CellNoteStoreType::const_iterator itBlk = maCellNotes.begin(), itBlkEnd = maCellNotes.end();
- sc::cellnote_block::const_iterator itData, itDataEnd;
-
- for(;itBlk != itBlkEnd; ++itBlk)
- {
- if (itBlk->data)
- {
- SCROW nRow = itBlk->position;
- itData = sc::cellnote_block::begin(*itBlk->data);
- itDataEnd = sc::cellnote_block::end(*itBlk->data);
- for (; itData != itDataEnd; ++itData, ++nRow)
- {
- ScPostIt* pScNote = *itData;
- if (pScNote)
- {
- ScAddress aScPos( nCol, nRow, mnScTab );
- mxNoteList->AppendNewRecord( new XclExpNote( GetRoot(), aScPos, pScNote, OUString() ) );
- }
- }
- }
- }
- }
- }
+ std::vector<sc::NoteEntry> aNotes;
+ rDoc.GetAllNoteEntries(aNotes);
+ std::vector<sc::NoteEntry>::const_iterator it = aNotes.begin(), itEnd = aNotes.end();
+ for (; it != itEnd; ++it)
+ mxNoteList->AppendNewRecord(new XclExpNote(GetRoot(), it->maPos, it->mpNote, OUString()));
if( GetOutput() != EXC_OUTPUT_BINARY )
{
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 844ed81dfde6..fc70ef67f76f 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -848,7 +848,6 @@ static OUString lcl_NoteString( const ScPostIt& rNote )
return aText;
}
-
void ScContentTree::GetNoteStrings()
{
if ( nRootType && nRootType != SC_CONTENT_NOTE ) // ausgeblendet ?
@@ -859,36 +858,11 @@ void ScContentTree::GetNoteStrings()
return;
// loop over cell notes
- SCTAB nTabCount = pDoc->GetTableCount();
- for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- {
- for (SCCOL nCol=0; nCol<MAXCOLCOUNT; nCol++)
- {
- if ( pDoc->HasColNotes(nCol, nTab) )
- {
- sc::CellNoteStoreType& maCellNotes = pDoc->GetColNotes(nCol, nTab);
-
- sc::CellNoteStoreType::const_iterator itBlk = maCellNotes.begin(), itBlkEnd = maCellNotes.end();
- sc::cellnote_block::const_iterator itData, itDataEnd;
-
- for(;itBlk != itBlkEnd; ++itBlk)
- {
- if (itBlk->data)
- {
- itData = sc::cellnote_block::begin(*itBlk->data);
- itDataEnd = sc::cellnote_block::end(*itBlk->data);
- for (; itData != itDataEnd; ++itData)
- {
- ScPostIt* pNote = *itData;
- if (pNote)
- InsertContent(SC_CONTENT_NOTE, lcl_NoteString( *pNote ));
- }
- }
-
- }
- }
- }
- }
+ std::vector<sc::NoteEntry> aEntries;
+ pDoc->GetAllNoteEntries(aEntries);
+ std::vector<sc::NoteEntry>::const_iterator it = aEntries.begin(), itEnd = aEntries.end();
+ for (; it != itEnd; ++it)
+ InsertContent(SC_CONTENT_NOTE, lcl_NoteString(*it->mpNote));
}
ScAddress ScContentTree::GetNotePos( sal_uLong nIndex )
@@ -897,48 +871,9 @@ ScAddress ScContentTree::GetNotePos( sal_uLong nIndex )
if (!pDoc)
return ScAddress();
- sal_uLong nFound = 0;
- SCTAB nTabCount = pDoc->GetTableCount();
-
- for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- {
- for (SCCOL nCol=0; nCol<MAXCOLCOUNT; nCol++)
- {
- if ( pDoc->HasColNotes(nCol, nTab) )
- {
- sc::CellNoteStoreType& maCellNotes = pDoc->GetColNotes(nCol, nTab);
-
- sc::CellNoteStoreType::const_iterator itBlk = maCellNotes.begin(), itBlkEnd = maCellNotes.end();
- sc::cellnote_block::const_iterator itData, itDataEnd;
-
- for(;itBlk != itBlkEnd; ++itBlk)
- {
- if (itBlk->data)
- {
- SCROW nRow = itBlk->position;
- itData = sc::cellnote_block::begin(*itBlk->data);
- itDataEnd = sc::cellnote_block::end(*itBlk->data);
- for (; itData != itDataEnd; ++itData, ++nRow)
- {
- ScPostIt* pNote = *itData;
- if (pNote)
- {
- if (nFound == nIndex)
- return ScAddress(nCol, nRow, nTab);
- ++nFound;
- }
- }
- }
- }
- }
- }
- }
-
- OSL_FAIL("note not found");
- return ScAddress();
+ return pDoc->GetNotePosition(nIndex);
}
-
sal_Bool ScContentTree::NoteStringsChanged()
{
ScDocument* pDoc = GetSourceDocument();
@@ -952,35 +887,20 @@ sal_Bool ScContentTree::NoteStringsChanged()
SvTreeListEntry* pEntry = FirstChild( pParent );
bool bEqual = true;
- SCTAB nTabCount = pDoc->GetTableCount();
- for (SCTAB nTab=0; nTab<nTabCount && bEqual; nTab++)
+ std::vector<sc::NoteEntry> aEntries;
+ pDoc->GetAllNoteEntries(aEntries);
+ std::vector<sc::NoteEntry>::const_iterator it = aEntries.begin(), itEnd = aEntries.end();
+ for (; it != itEnd; ++it)
{
- for (SCCOL nCol=0; nCol<MAXCOLCOUNT; nCol++)
+ const ScPostIt* pNote = it->mpNote;
+ if (!pEntry)
+ bEqual = false;
+ else
{
- if ( pDoc->HasColNotes(nCol, nTab) )
- {
- sc::CellNoteStoreType& maCellNotes = pDoc->GetColNotes(nCol, nTab);
- sc::CellNoteStoreType::const_iterator it = maCellNotes.begin(), itEnd = maCellNotes.end();
- for (; it != itEnd; ++it)
- {
- if (it->type == sc::element_type_cellnote)
- {
- SCROW nRow = it->position;
- ScPostIt* pNote = maCellNotes.get<ScPostIt*>(nRow);
- if (pNote)
- {
- if ( !pEntry )
- bEqual = false;
- else
- {
- if ( lcl_NoteString( *pNote ) != GetEntryText(pEntry) )
- bEqual = false;
- pEntry = NextSibling( pEntry );
- }
- }
- }
- }
- }
+ if (lcl_NoteString(*pNote) != GetEntryText(pEntry))
+ bEqual = false;
+
+ pEntry = NextSibling(pEntry);
}
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 4f1430f99791..8123f4593b0b 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -3429,41 +3429,12 @@ void ScAnnotationsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
bool ScAnnotationsObj::GetAddressByIndex_Impl( sal_Int32 nIndex, ScAddress& rPos ) const
{
- if (pDocShell)
- {
- sal_Int32 nFound = 0;
- ScDocument* pDoc = pDocShell->GetDocument();
- SCTAB nTabCount = pDoc->GetTableCount();
- for (SCTAB aTab=0; aTab<nTabCount; aTab++)
- {
- for (SCCOL nCol=0; nCol<MAXCOLCOUNT; nCol++)
- {
- sc::CellNoteStoreType& maNotes = pDoc->GetColNotes(nCol, aTab);
- std::pair<sc::CellNoteStoreType::const_iterator,size_t> aPos = maNotes.position(0);
- sc::CellNoteStoreType::const_iterator it = aPos.first;
- size_t nOffset = aPos.second;
- size_t nDataSize = 0;
- size_t nRow = 0;
- sal_Int32 nNotesSize = maNotes.size();
- if (nFound + nNotesSize >= nIndex)
- {
- for (; it != maNotes.end(); ++it, nOffset = 0, nRow += nDataSize)
- {
- nDataSize = it->size - nOffset;
- if (nFound == nIndex)
- {
- rPos = ScAddress(nCol, nRow, nTab);
- return true;
- }
- ++nFound;
- }
- }
- else
- nFound += nNotesSize;
- }
- }
- }
- return false;
+ if (!pDocShell)
+ return false;
+
+ ScDocument* pDoc = pDocShell->GetDocument();
+ rPos = pDoc->GetNotePosition(nIndex);
+ return rPos.IsValid();
}
ScAnnotationObj* ScAnnotationsObj::GetObjectByIndex_Impl( sal_Int32 nIndex ) const