sw/source/core/crsr/findtxt.cxx | 48 +++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 22 deletions(-)
New commits: commit e4f935f138d941f537227a344d4b93b05f951457 Author: Caolán McNamara <caol...@redhat.com> Date: Tue Jul 12 15:45:22 2016 +0100 Resolves: tdf#100538 make searching in shape text a libreoffice-kit only thing This effectively reverts for the normal-app commit bdc1824ea7acfa2fe9d71cdbe57882acce155577 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue May 19 17:20:10 2015 +0200 SwPaM::Find: search in shapes anchored to the range The catches are that... writer will use SvxSearchCmd::Find and not SvxSearchCmd::Replace when Replacing text, and replacing it afterwards. So replace doesn't work. It might be possible to mitigate that by passing down the m_bReplace to SwPam::Find and do a SvxSearchCmd::Replace on the editeng SearchAndReplace in that case and then change the return code to not-found/found-in-writer/found-in-drawing to figure out what to do there. regexps are disabled in the ui for draw/impress, maybe because they seem not be fully implemented right wrt matching empty paragraphs, so using regexps in writer and letting them into editeng via this loophole is new territory for the editengine (cherry picked from commit 46b52c22bfb6b145af3c8407fd96321381e78d99) Change-Id: I2875b374a7ede8edd7f479254cbc2da36488abc8 Reviewed-on: https://gerrit.libreoffice.org/27154 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 0011605..d37756f 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/util/SearchOptions2.hpp> #include <com/sun/star/util/SearchFlags.hpp> +#include <comphelper/lok.hxx> #include <comphelper/string.hxx> #include <vcl/svapp.hxx> #include <vcl/window.hxx> @@ -343,33 +344,36 @@ bool SwPaM::Find( const SearchOptions2& rSearchOpt, bool bSearchInNotes , utl::T } } - // Writer and editeng selections are not supported in parallel. - SvxSearchItem* pSearchItem = SwView::GetSearchItem(); - // If we just finished search in shape text, don't attempt to do that again. - if (!bEndedTextEdit && !(pSearchItem && pSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL)) + if (comphelper::LibreOfficeKit::isActive()) { - // If there are any shapes anchored to this node, search there. - SwPaM aPaM(pNode->GetDoc()->GetNodes().GetEndOfContent()); - aPaM.GetPoint()->nNode = rTextNode; - aPaM.GetPoint()->nContent.Assign(aPaM.GetPoint()->nNode.GetNode().GetTextNode(), nStart); - aPaM.SetMark(); - aPaM.GetMark()->nNode = rTextNode.GetIndex() + 1; - aPaM.GetMark()->nContent.Assign(aPaM.GetMark()->nNode.GetNode().GetTextNode(), 0); - if (pNode->GetDoc()->getIDocumentDrawModelAccess().Search(aPaM, aSearchItem) && pSdrView) + // Writer and editeng selections are not supported in parallel. + SvxSearchItem* pSearchItem = SwView::GetSearchItem(); + // If we just finished search in shape text, don't attempt to do that again. + if (!bEndedTextEdit && !(pSearchItem && pSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL)) { - if (SdrObject* pObject = pSdrView->GetTextEditObject()) + // If there are any shapes anchored to this node, search there. + SwPaM aPaM(pNode->GetDoc()->GetNodes().GetEndOfContent()); + aPaM.GetPoint()->nNode = rTextNode; + aPaM.GetPoint()->nContent.Assign(aPaM.GetPoint()->nNode.GetNode().GetTextNode(), nStart); + aPaM.SetMark(); + aPaM.GetMark()->nNode = rTextNode.GetIndex() + 1; + aPaM.GetMark()->nContent.Assign(aPaM.GetMark()->nNode.GetNode().GetTextNode(), 0); + if (pNode->GetDoc()->getIDocumentDrawModelAccess().Search(aPaM, aSearchItem) && pSdrView) { - if (SwFrameFormat* pFrameFormat = FindFrameFormat(pObject)) + if (SdrObject* pObject = pSdrView->GetTextEditObject()) { - const SwPosition* pPosition = pFrameFormat->GetAnchor().GetContentAnchor(); - if (pPosition) + if (SwFrameFormat* pFrameFormat = FindFrameFormat(pObject)) { - // Set search position to the shape's anchor point. - *GetPoint() = *pPosition; - GetPoint()->nContent.Assign(pPosition->nNode.GetNode().GetContentNode(), 0); - SetMark(); - bFound = true; - break; + const SwPosition* pPosition = pFrameFormat->GetAnchor().GetContentAnchor(); + if (pPosition) + { + // Set search position to the shape's anchor point. + *GetPoint() = *pPosition; + GetPoint()->nContent.Assign(pPosition->nNode.GetNode().GetContentNode(), 0); + SetMark(); + bFound = true; + break; + } } } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits