diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-07-12 15:45:22 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-07-15 18:16:48 +0000 |
commit | f12492f72e744bd5b5b016d9c6c85e735948cc4b (patch) | |
tree | 04efcc8d187a670c78e09e8e39cc529ab58f7506 | |
parent | e4001d9c652fe658c7c3d5fff03a315400530513 (diff) |
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 <vmiklos@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/27155
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | sw/source/core/crsr/findtxt.cxx | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 0011605a8e04..d37756fc869c 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; + } } } } |