diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-07-12 15:45:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-07-12 15:54:04 +0100 |
commit | 46b52c22bfb6b145af3c8407fd96321381e78d99 (patch) | |
tree | d49f0cfc2df9e4333be0dd9f21e5ce5814735c7c | |
parent | b43eece4680d149985382c8528119577ab3d7c2b (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
I think if I was trying this I'd fix regexp in editengine, then try add
searching/replacing in drawing boxes sort of at the end of searching in the
main document, something like how searching in frames works.
Change-Id: I2875b374a7ede8edd7f479254cbc2da36488abc8
-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; + } } } } |