[Libreoffice-commits] core.git: include/sfx2 include/svl sfx2/sdi svl/source sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Mar 17 07:34:46 UTC 2016


 include/sfx2/msg.hxx                           |    2 +-
 include/svl/memberid.hrc                       |    1 +
 include/svl/srchitem.hxx                       |    4 ++++
 sfx2/sdi/sfxitems.sdi                          |    1 +
 svl/source/items/srchitem.cxx                  |   16 ++++++++++++++--
 sw/qa/extras/tiledrendering/tiledrendering.cxx |    3 ++-
 sw/source/core/crsr/findtxt.cxx                |    6 +++++-
 7 files changed, 28 insertions(+), 5 deletions(-)

New commits:
commit 8e0b08c3053ed5472409b1ea7e02653aad38f7d6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Mar 17 08:33:51 2016 +0100

    tdf#98458 sw: make search in shape text optional
    
    Instead of forcing it silently on everyone, add a new search option and
    enable it only in case it's requested, as shape search is expensive for
    large documents.
    
    (Regression from commit bdc1824ea7acfa2fe9d71cdbe57882acce155577.)
    
    Change-Id: Ibb6e76ad5c870dfd63b36429e16ef6d572f5f1fd

diff --git a/include/sfx2/msg.hxx b/include/sfx2/msg.hxx
index 6753181..03972d5 100644
--- a/include/sfx2/msg.hxx
+++ b/include/sfx2/msg.hxx
@@ -146,7 +146,7 @@ SFX_DECL_TYPE(13); // for SwAddPrinterItem, Sd...
 SFX_DECL_TYPE(14);
 SFX_DECL_TYPE(16); // for SwDocDisplayItem
 SFX_DECL_TYPE(17); // for SvxAddressItem
-SFX_DECL_TYPE(23); // for SvxSearchItem
+SFX_DECL_TYPE(24); // for SvxSearchItem
 
 // all SfxTypes must be in this header
 #undef SFX_DECL_TYPE
diff --git a/include/svl/memberid.hrc b/include/svl/memberid.hrc
index b5a2262..fb467b3 100644
--- a/include/svl/memberid.hrc
+++ b/include/svl/memberid.hrc
@@ -61,6 +61,7 @@
 #define MID_SEARCH_STARTPOINTY          21
 #define MID_SEARCH_SEARCHFORMATTED      22
 #define MID_SEARCH_ALGORITHMTYPE2       23
+#define MID_SEARCH_INSHAPES             24
 
 #endif
 
diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx
index 472f1ac..d67fff8 100644
--- a/include/svl/srchitem.hxx
+++ b/include/svl/srchitem.hxx
@@ -90,6 +90,9 @@ class SVL_DLLPUBLIC SvxSearchItem :
     sal_Int32       m_nStartPointX;
     sal_Int32       m_nStartPointY;
 
+    /// Writer-specific: search in shape text.
+    bool            m_bSearchInShapes;
+
     virtual void    ImplCommit() override;
 
 public:
@@ -198,6 +201,7 @@ public:
     sal_Int32 GetStartPointY() const;
     /// Either x or y start point is set.
     bool HasStartPoint() const;
+    bool IsSearchInShapes() const;
 };
 
 const OUString& SvxSearchItem::GetSearchString() const
diff --git a/sfx2/sdi/sfxitems.sdi b/sfx2/sdi/sfxitems.sdi
index ab1b3fd..1900868 100644
--- a/sfx2/sdi/sfxitems.sdi
+++ b/sfx2/sdi/sfxitems.sdi
@@ -91,6 +91,7 @@
         INT32       SearchStartPointY MID_SEARCH_STARTPOINTY;
         BOOL        SearchFormatted MID_SEARCH_SEARCHFORMATTED;
         INT16       AlgorithmType2  MID_SEARCH_ALGORITHMTYPE2;
+        BOOL        SearchInShapes  MID_SEARCH_INSHAPES;
     };
     item SvxSearch SvxSearchItem;
 
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index 881c464..752a888 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -127,7 +127,8 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) :
     m_bContent        ( false ),
     m_bAsianOptions   ( false ),
     m_nStartPointX(0),
-    m_nStartPointY(0)
+    m_nStartPointY(0),
+    m_bSearchInShapes(false)
 {
     EnableNotification( lcl_GetNotifyNames() );
 
@@ -226,7 +227,8 @@ SvxSearchItem::SvxSearchItem( const SvxSearchItem& rItem ) :
     m_bContent        ( rItem.m_bContent ),
     m_bAsianOptions   ( rItem.m_bAsianOptions ),
     m_nStartPointX(rItem.m_nStartPointX),
-    m_nStartPointY(rItem.m_nStartPointY)
+    m_nStartPointY(rItem.m_nStartPointY),
+    m_bSearchInShapes(rItem.m_bSearchInShapes)
 {
     EnableNotification( lcl_GetNotifyNames() );
 }
@@ -670,6 +672,11 @@ bool SvxSearchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
             bRet = (rVal >>= m_nStartPointY);
             break;
         }
+        case MID_SEARCH_INSHAPES:
+        {
+            bRet = (rVal >>= m_bSearchInShapes);
+            break;
+        }
         default:
             OSL_FAIL( "Unknown MemberId" );
     }
@@ -692,4 +699,9 @@ bool SvxSearchItem::HasStartPoint() const
     return m_nStartPointX > 0 || m_nStartPointY > 0;
 }
 
+bool SvxSearchItem::IsSearchInShapes() const
+{
+    return m_bSearchInShapes;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index cf0afae..62be3e6 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -328,7 +328,8 @@ void lcl_search(bool bBackward)
     uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
     {
         {"SearchItem.SearchString", uno::makeAny(OUString("shape"))},
-        {"SearchItem.Backward", uno::makeAny(bBackward)}
+        {"SearchItem.Backward", uno::makeAny(bBackward)},
+        {"SearchItem.SearchInShapes", uno::makeAny(true)}
     }));
     comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
 }
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 1a8924c..62f4e8c 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -301,6 +301,10 @@ bool SwPaM::Find( const SearchOptions2& rSearchOpt, bool bSearchInNotes , utl::T
             SwWrtShell *const pWrtShell = (pDocShell) ? pDocShell->GetWrtShell() : nullptr;
             SwPostItMgr *const pPostItMgr = (pWrtShell) ? pWrtShell->GetPostItMgr() : nullptr;
 
+            SvxSearchItem* pSearchItem = SwView::GetSearchItem();
+            if (pSearchItem && pSearchItem->IsSearchInShapes())
+            {
+            // Search in shapes only if explicitly requested.
             SvxSearchItem aSearchItem(SID_SEARCH_ITEM);
             aSearchItem.SetSearchOptions(rSearchOpt);
             aSearchItem.SetBackward(!bSrchForward);
@@ -344,7 +348,6 @@ 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))
             {
@@ -375,6 +378,7 @@ bool SwPaM::Find( const SearchOptions2& rSearchOpt, bool bSearchInNotes , utl::T
                     }
                 }
             }
+            }
 
             sal_Int32 aStart = 0;
             // do we need to finish a note?


More information about the Libreoffice-commits mailing list