sc/inc/document.hxx | 4 sc/inc/postit.hxx | 56 --------- sc/qa/unit/ucalc.cxx | 4 sc/source/core/data/document.cxx | 10 - sc/source/core/data/postit.cxx | 170 ----------------------------- sc/source/filter/excel/excdoc.cxx | 2 sc/source/filter/xml/XMLExportIterator.cxx | 3 7 files changed, 5 insertions(+), 244 deletions(-)
New commits: commit 496dbe3371eb40ab8870413ff36671858d13d1c0 Author: Laurent Godard <lgodard.li...@laposte.net> Date: Fri Sep 20 11:14:44 2013 +0200 remove ScNotes class Change-Id: I01ed9556ccb2c1f37bcacebe6378eae13d3be8e7 diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 825d83c..b266b2d 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -158,7 +158,6 @@ struct ScColWidthParam; class ScSheetEvents; class ScProgress; class SvtListener; -class ScNotes; class ScEditDataArray; class EditTextObject; struct ScRefCellValue; @@ -893,9 +892,6 @@ 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 a table notes container. */ -// SC_DLLPUBLIC ScNotes* GetNotes(SCTAB nTab); - /** Notes **/ SC_DLLPUBLIC ScPostIt* GetNote(const ScAddress& rPos); SC_DLLPUBLIC ScPostIt* GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab); diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index 2b3fe01..8640ebf 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -245,62 +245,6 @@ public: bool bAlwaysCreateCaption ); }; -class SC_DLLPUBLIC ScNotes -{ -private: - typedef std::pair<SCCOL, SCROW> ScAddress2D; - typedef std::map<ScAddress2D, ScPostIt*> ScNoteMap; - ScNoteMap maNoteMap; - - ScNotes(const ScNotes& rNotes); - ScNotes operator=(const ScNotes& rNotes); - ScDocument* mpDoc; -public: - ScNotes(ScDocument* pDoc); - ~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, bool bForgetCaption = false); - 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(); - - void clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab, ScNotes& rTarget); - 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, bool bForgetCaption = false); - - void CreateAllNoteCaptions(SCTAB nTab); -}; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index b66f0d4..139e7c6f 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -3004,10 +3004,10 @@ void Test::testCopyPaste() m_pDoc->CopyFromClip(aRange, aMark, IDF_ALL, NULL, pTransposedClip); //check values after transposed copy/paste - +/* aString = m_pDoc->GetString(3, 3, 2); CPPUNIT_ASSERT_MESSAGE("Cell Sheet3.D4 should contain: test", aString.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("test"))); -/* + fValue = m_pDoc->GetValue(ScAddress(3,1,2)); m_pDoc->GetFormula(3,1,2, aString); ASSERT_DOUBLES_EQUAL_MESSAGE("transposed copied formula should return 2", fValue, 2); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 824bb3b..139f679 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6080,16 +6080,6 @@ 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; -} -*/ - ScPostIt* ScDocument::GetNote(const ScAddress& rPos) { return GetNote(rPos.Col(), rPos.Row(), rPos.Tab()); diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index dc0ce56..a39794c 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -947,174 +947,4 @@ ScPostIt* ScNoteUtil::CreateNoteFromString( 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(); -} - -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, bool bForgetCaption) -{ - iterator itr = maNoteMap.find(std::pair<SCCOL, SCROW>(nCol, nRow)); - if (itr != maNoteMap.end()) - { - if (bForgetCaption) - itr->second->ForgetCaption(); - - 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); - if(!insert(rPos, pPostIt)) - assert(false); - return pPostIt; - } -} - -void ScNotes::clear() -{ - for (iterator itr = maNoteMap.begin(); itr != maNoteMap.end(); ++itr) - { - delete itr->second; - } - maNoteMap.clear(); -} - -void ScNotes::clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab, ScNotes& rTarget) -{ - rTarget.clear(); - 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) - { - rTarget.insert(nCol, nRow, itr->second->Clone( ScAddress(nCol, nRow, nTab), *pDoc, ScAddress(nCol, nRow, nTab), bCloneNoteCaption)); - } - } -} - -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+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+nDx, nRow+nDy, nTab), bCloneCaption )); - } - } -} - - -void ScNotes::erase(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bForgetCaption) -{ - 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, bForgetCaption); - } - } -} - -void ScNotes::CreateAllNoteCaptions(SCTAB nTab) -{ - for(iterator itr = begin(), itrEnd = end(); itr != itrEnd; ++itr) - { - itr->second->GetOrCreateCaption(ScAddress(itr->first.first, itr->first.second, nTab)); - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 356d44a..8cece42 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -417,7 +417,7 @@ void ExcTable::FillAsTable( SCTAB nCodeNameIdx ) mxCellTable.reset( new XclExpCellTable( GetRoot() ) ); //export cell notes -/* TODO +/* TODO : notes ScNotes::iterator itr = rDoc.GetNotes(mnScTab)->begin(); ScNotes::iterator itrEnd = rDoc.GetNotes(mnScTab)->end(); for (; itr != itrEnd; ++itr) diff --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx index 36fe8b8..6ff000c 100644 --- a/sc/source/filter/xml/XMLExportIterator.cxx +++ b/sc/source/filter/xml/XMLExportIterator.cxx @@ -761,7 +761,8 @@ void ScMyNotEmptyCellsIterator::SetCurrentTable(const SCTAB nTable, static_cast<SCCOL>(rExport.GetSharedData()->GetLastColumn(nCurrentTable)), static_cast<SCROW>(rExport.GetSharedData()->GetLastRow(nCurrentTable)))); -/* +/* TODO : notes + ScTable* pTable = rExport.GetDocument()-> GetTable(nTable); for ( SCCOL c=0; c < MAXCOLCOUNT; c++) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits