summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-06-26 14:19:28 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-06-27 09:09:19 +0200
commit7ef0bfb07312918f8db23dcc2995ce14ce3e808a (patch)
tree1309c030463a4a82b03c303f035ba7f7bf99de13
parent77d36ad464f1d451c6a427f99b3e9ca3d158fb6d (diff)
fix incorrect ScAnnotationsObj UNO API, fdo#80551
The used index was a sheet local index but the returned position was from a global container. Change-Id: I0b9e9e7e9618c72daf8e6417bca9d3a1cb23abb1
-rw-r--r--sc/inc/document.hxx1
-rw-r--r--sc/source/core/data/document.cxx26
2 files changed, 27 insertions, 0 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 00649b77c10e..d7f87520c39f 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -951,6 +951,7 @@ public:
void ForgetNoteCaptions( const ScRangeList& rRanges );
ScAddress GetNotePosition( size_t nIndex ) const;
+ ScAddress GetNotePosition( size_t nIndex, SCTAB nTab ) const;
SCROW GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const;
SC_DLLPUBLIC void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 30b9a75c5a2b..e68758c4ca24 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6097,6 +6097,32 @@ ScAddress ScDocument::GetNotePosition( size_t nIndex ) const
return ScAddress(ScAddress::INITIALIZE_INVALID);
}
+ScAddress ScDocument::GetNotePosition( size_t nIndex, SCTAB nTab ) const
+{
+ for (SCCOL nCol=0; nCol<MAXCOLCOUNT; nCol++)
+ {
+ size_t nColNoteCount = GetNoteCount(nTab, nCol);
+ if (!nColNoteCount)
+ continue;
+
+ if (nIndex >= nColNoteCount)
+ {
+ nIndex -= nColNoteCount;
+ continue;
+ }
+
+ SCROW nRow = GetNotePosition(nTab, nCol, nIndex);
+ if (nRow >= 0)
+ return ScAddress(nCol, nRow, nTab);
+
+ OSL_FAIL("note not found");
+ return ScAddress(ScAddress::INITIALIZE_INVALID);
+ }
+
+ OSL_FAIL("note not found");
+ return ScAddress(ScAddress::INITIALIZE_INVALID);
+}
+
SCROW ScDocument::GetNotePosition( SCTAB nTab, SCCOL nCol, size_t nIndex ) const
{
const ScTable* pTab = FetchTable(nTab);