sc/source/ui/navipi/content.cxx | 43 +++++++++++++++++++++++++++------------- sc/source/ui/view/printfun.cxx | 1 2 files changed, 30 insertions(+), 14 deletions(-)
New commits: commit 8c576e8050290a8fb63f504cefe2bb7195d698bc Author: Laurent Godard <lgodard.li...@laposte.net> Date: Mon Oct 7 11:40:15 2013 +0200 refactor note loops Change-Id: I41dc2a4a0f6bb82b6a9186844479bf802bc6e66d diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 58634c4..8b65d0d 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -870,16 +870,24 @@ void ScContentTree::GetNoteStrings() if ( pDoc->HasColNotes(nCol, nTab) ) { sc::CellNoteStoreType& maCellNotes = pDoc->GetColNotes(nCol, nTab); - for (SCROW nRow=0; nRow < MAXROWCOUNT; nRow++) // TODO : notes suboptimal ? + + sc::CellNoteStoreType::const_iterator itBlk = maCellNotes.begin(), itBlkEnd = maCellNotes.end(); + sc::cellnote_block::const_iterator itData, itDataEnd; + + for(;itBlk != itBlkEnd; ++itBlk) { - sc::CellNoteStoreType::position_type aPos = maCellNotes.position(nRow); - sc::CellNoteStoreType::iterator it = aPos.first; - if (it->type == sc::element_type_cellnote) + if (itBlk->data) { - ScPostIt* pNote = maCellNotes.get<ScPostIt*>(nRow); - if (pNote) - InsertContent(SC_CONTENT_NOTE, lcl_NoteString( *pNote )); + 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 )); + } } + } } } @@ -902,20 +910,29 @@ ScAddress ScContentTree::GetNotePos( sal_uLong nIndex ) if ( pDoc->HasColNotes(nCol, nTab) ) { sc::CellNoteStoreType& maCellNotes = pDoc->GetColNotes(nCol, nTab); - for (SCROW nRow=0; nRow < MAXROWCOUNT; nRow++) // TODO : notes suboptimal ? + + sc::CellNoteStoreType::const_iterator itBlk = maCellNotes.begin(), itBlkEnd = maCellNotes.end(); + sc::cellnote_block::const_iterator itData, itDataEnd; + + for(;itBlk != itBlkEnd; ++itBlk) { - sc::CellNoteStoreType::position_type aPos = maCellNotes.position(nRow); - sc::CellNoteStoreType::iterator it = aPos.first; - if (it->type == sc::element_type_cellnote) + if (itBlk->data) { - ScPostIt* pNote = maCellNotes.get<ScPostIt*>(nRow); - if (pNote) + 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; } + } } + } } } diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 3b4b382..ac87a28 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -2493,7 +2493,6 @@ long ScPrintFunc::CountNotePages() if (bDoThis) { - // TODO : notes for ( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol ) { if (pDoc->HasColNotes(nCol, nPrintTab)) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits