sc/inc/postit.hxx | 2 ++ sc/source/core/data/postit.cxx | 9 +++++++++ sc/source/core/data/table6.cxx | 23 +++++++++++++++++++---- 3 files changed, 30 insertions(+), 4 deletions(-)
New commits: commit 7c84a219e3cc8d623826343f547ba8adacca6d56 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Jul 27 11:32:49 2016 +0100 Resolves: tdf#65334 cannot search in cell notes regression since... commit c06dbbe7594c2a0b5a5b19f8e183d9c421e6e094 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Feb 23 23:36:49 2012 +0100 remove mpNote from ScBaseCell and requires restoring some code subsequently removed in commit a1a1131c16227327d17bcf5ad2a5209ddc0f01a1 Date: Sun Mar 4 15:27:27 2012 +0800 Remove unused code Change-Id: If931c3162cacaeb126e730e3e79c1c47be4ce434 diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index 8a7dec8..fb962442 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -118,6 +118,8 @@ public: /** Returns the caption text of this note. */ OUString GetText() const; + /** Returns true, if the caption text of this note contains line breaks. */ + bool HasMultiLineText() const; /** Changes the caption text of this note. All text formatting will be lost. */ void SetText( const ScAddress& rPos, const OUString& rText ); diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 8eb8331..64f47a5 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -562,6 +562,15 @@ OUString ScPostIt::GetText() const return OUString(); } +bool ScPostIt::HasMultiLineText() const +{ + if( const EditTextObject* pEditObj = GetEditTextObject() ) + return pEditObj->GetParagraphCount() > 1; + if( maNoteData.mxInitData.get() ) + return maNoteData.mxInitData->maSimpleText.indexOf( '\n' ) >= 0; + return false; +} + void ScPostIt::SetText( const ScAddress& rPos, const OUString& rText ) { CreateCaptionFromInitData( rPos ); diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx index 2c63ed4..b5a4499 100644 --- a/sc/source/core/data/table6.cxx +++ b/sc/source/core/data/table6.cxx @@ -73,6 +73,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo return false; bool bMultiLine = false; + ScPostIt* pNote = nullptr; CellType eCellType = aCell.meType; switch (rSearchItem.GetCellType()) { @@ -89,8 +90,8 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo else aCol[nCol].GetString( nRow, aString ); } + break; } - break; case SvxSearchCellType::VALUE: if ( eCellType == CELLTYPE_EDIT ) bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, pDocument, aString); @@ -103,7 +104,15 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo } break; case SvxSearchCellType::NOTE: - break; // don't search this case here + { + pNote = aCol[nCol].GetCellNote(nRow); + if (pNote) + { + aString = pNote->GetText(); + bMultiLine = pNote->HasMultiLineText(); + } + break; + } default: break; } @@ -212,8 +221,14 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo } } while (bRepeat); - - if ( cMatrixFlag != MM_NONE ) + if (rSearchItem.GetCellType() == SvxSearchCellType::NOTE) + { + // NB: rich text format is lost. + // This is also true of Cells. + if (pNote) + pNote->SetText( ScAddress( nCol, nRow, nTab ), aString ); + } + else if ( cMatrixFlag != MM_NONE ) { // don't split Matrix if ( aString.getLength() > 2 ) { // remove {} here so that "{=" can be replaced by "{=..."
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits