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 10:05:45 +0200
commitce05c5e4b0b0b9e910b4d90013a993395dd9ed8c (patch)
tree0f4e730ebe2c9f6a017eff2fb946adcfbb60a443
parent355c3cbb16b0bab705050dd24205878bcecd5687 (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);