[Libreoffice-commits] core.git: basctl/source include/svl include/svx sc/source sd/source svx/source sw/source

Noel Grandin noel at peralex.com
Mon Apr 20 01:24:55 PDT 2015


 basctl/source/basicide/baside2.cxx   |   20 +++++------
 basctl/source/basicide/baside2.hxx   |    2 -
 basctl/source/basicide/basides1.cxx  |    4 +-
 basctl/source/basicide/bastypes.cxx  |    5 +-
 basctl/source/inc/bastypes.hxx       |    3 +
 include/svl/srchdefs.hxx             |   43 +++++++++++++++----------
 include/svx/srchdlg.hxx              |    4 +-
 sc/source/ui/view/tabvwsha.cxx       |    6 +--
 sd/source/ui/docshell/docshell.cxx   |   20 +++++------
 svx/source/dialog/srchctrl.cxx       |    4 +-
 svx/source/dialog/srchdlg.cxx        |   60 +++++++++++++++++------------------
 sw/source/uibase/uiview/srcview.cxx  |    8 ++--
 sw/source/uibase/uiview/viewsrch.cxx |    8 ++--
 13 files changed, 99 insertions(+), 88 deletions(-)

New commits:
commit 9c50c39fb4410d966d12aee915f6dc9ed53d0211
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Apr 16 13:44:05 2015 +0200

    convert SEARCH_OPTIONS constants to scoped enum
    
    Change-Id: Id0f0c7d692410cf5e1477c5180e7cfb8e7b0f52b
    Reviewed-on: https://gerrit.libreoffice.org/15345
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 64c1343..1c11bb1 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1295,20 +1295,20 @@ sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem,
     return NULL;
 }
 
-sal_uInt16 ModulWindow::GetSearchOptions()
+SearchOptionFlags ModulWindow::GetSearchOptions()
 {
-    sal_uInt16 nOptions = SEARCH_OPTIONS_SEARCH |
-                      SEARCH_OPTIONS_WHOLE_WORDS |
-                      SEARCH_OPTIONS_BACKWARDS |
-                      SEARCH_OPTIONS_REG_EXP |
-                      SEARCH_OPTIONS_EXACT |
-                      SEARCH_OPTIONS_SELECTION |
-                      SEARCH_OPTIONS_SIMILARITY;
+    SearchOptionFlags nOptions = SearchOptionFlags::SEARCH |
+                      SearchOptionFlags::WHOLE_WORDS |
+                      SearchOptionFlags::BACKWARDS |
+                      SearchOptionFlags::REG_EXP |
+                      SearchOptionFlags::EXACT |
+                      SearchOptionFlags::SELECTION |
+                      SearchOptionFlags::SIMILARITY;
 
     if ( !IsReadOnly() )
     {
-        nOptions |= SEARCH_OPTIONS_REPLACE;
-        nOptions |= SEARCH_OPTIONS_REPLACE_ALL;
+        nOptions |= SearchOptionFlags::REPLACE;
+        nOptions |= SearchOptionFlags::REPLACE_ALL;
     }
 
     return nOptions;
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 595db9e..3d840d8 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -383,7 +383,7 @@ public:
 
     void            ShowCursor( bool bOn );
 
-    virtual sal_uInt16  GetSearchOptions() SAL_OVERRIDE;
+    virtual SearchOptionFlags GetSearchOptions() SAL_OVERRIDE;
     virtual sal_uInt16  StartSearchAndReplace (SvxSearchItem const&, bool bFromStart = false) SAL_OVERRIDE;
 
     EditorWindow&       GetEditorWindow()       { return aXEditorWindow.GetEdtWindow(); }
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 4a952ca..1a620ce 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -826,10 +826,10 @@ void Shell::GetState(SfxItemSet &rSet)
             break;
             case SID_SEARCH_OPTIONS:
             {
-                sal_uInt16 nOptions = 0;
+                SearchOptionFlags nOptions = SearchOptionFlags::NONE;
                 if( pCurWin )
                     nOptions = pCurWin->GetSearchOptions();
-                rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, nOptions ) );
+                rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, static_cast<sal_uInt16>(nOptions) ) );
             }
             break;
             case SID_BASICIDE_LIBSELECTOR:
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 88fd1ce..854621f 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -32,6 +32,7 @@
 #include <sfx2/passwd.hxx>
 #include <svl/intitem.hxx>
 #include <svl/stritem.hxx>
+#include <svl/srchdefs.hxx>
 
 namespace basctl
 {
@@ -207,9 +208,9 @@ bool BaseWindow::IsPasteAllowed ()
     return NULL;
 }
 
-sal_uInt16 BaseWindow::GetSearchOptions()
+SearchOptionFlags BaseWindow::GetSearchOptions()
 {
-    return 0;
+    return SearchOptionFlags::NONE;
 }
 
 sal_uInt16 BaseWindow::StartSearchAndReplace (SvxSearchItem const&, bool bFromStart)
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
index 646fb32..c7e1e1d 100644
--- a/basctl/source/inc/bastypes.hxx
+++ b/basctl/source/inc/bastypes.hxx
@@ -33,6 +33,7 @@ class SfxItemSet;
 class SfxRequest;
 class SvxSearchItem;
 class Printer;
+enum class SearchOptionFlags;
 
 namespace svl
 {
@@ -211,7 +212,7 @@ public:
 
     virtual svl::IUndoManager* GetUndoManager ();
 
-    virtual sal_uInt16  GetSearchOptions();
+    virtual SearchOptionFlags  GetSearchOptions();
     virtual sal_uInt16  StartSearchAndReplace (SvxSearchItem const&, bool bFromStart = false);
 
     virtual void    BasicStarted();
diff --git a/include/svl/srchdefs.hxx b/include/svl/srchdefs.hxx
index 39017f6..8fb303c 100644
--- a/include/svl/srchdefs.hxx
+++ b/include/svl/srchdefs.hxx
@@ -8,11 +8,11 @@
  *
  * This file incorporates work covered by the following license notice:
  *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   Licensed to the Apache Software Foundation (ASF, under one or more
  *   contributor license agreements. See the NOTICE file distributed
  *   with this work for additional information regarding copyright
  *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
+ *   License, Version 2.0 (the "License",; you may not use this file
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
@@ -20,22 +20,31 @@
 #ifndef INCLUDED_SVL_SRCHDEFS_HXX
 #define INCLUDED_SVL_SRCHDEFS_HXX
 
+#include <o3tl/typed_flags_set.hxx>
 
-#define SEARCH_OPTIONS_SEARCH       ((sal_uInt16)0x0001)
-#define SEARCH_OPTIONS_SEARCH_ALL   ((sal_uInt16)0x0002)
-#define SEARCH_OPTIONS_REPLACE      ((sal_uInt16)0x0004)
-#define SEARCH_OPTIONS_REPLACE_ALL  ((sal_uInt16)0x0008)
-#define SEARCH_OPTIONS_WHOLE_WORDS  ((sal_uInt16)0x0010)
-#define SEARCH_OPTIONS_BACKWARDS    ((sal_uInt16)0x0020)
-#define SEARCH_OPTIONS_REG_EXP      ((sal_uInt16)0x0040)
-#define SEARCH_OPTIONS_EXACT        ((sal_uInt16)0x0080)
-#define SEARCH_OPTIONS_SELECTION    ((sal_uInt16)0x0100)
-#define SEARCH_OPTIONS_FAMILIES     ((sal_uInt16)0x0200)
-#define SEARCH_OPTIONS_FORMAT       ((sal_uInt16)0x0400)
-#define SEARCH_OPTIONS_MORE         ((sal_uInt16)0x0800)
-#define SEARCH_OPTIONS_SIMILARITY   ((sal_uInt16)0x1000)
-#define SEARCH_OPTIONS_CONTENT      ((sal_uInt16)0x2000)
-
+enum class SearchOptionFlags
+{
+    NONE          = 0x0000,
+    SEARCH        = 0x0001,
+    SEARCHALL     = 0x0002, // named to this way to avoid conflict with macro on Windows.
+    REPLACE       = 0x0004,
+    REPLACE_ALL   = 0x0008,
+    WHOLE_WORDS   = 0x0010,
+    BACKWARDS     = 0x0020,
+    REG_EXP       = 0x0040,
+    EXACT         = 0x0080,
+    SELECTION     = 0x0100,
+    FAMILIES      = 0x0200,
+    FORMAT        = 0x0400,
+    MORE          = 0x0800,
+    SIMILARITY    = 0x1000,
+    CONTENT       = 0x2000,
+    ALL           = 0x3fff
+};
+namespace o3tl
+{
+    template<> struct typed_flags<SearchOptionFlags> : is_typed_flags<SearchOptionFlags, 0x3fff> {};
+}
 
 #endif
 
diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index 15d221b..5750ca0 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -206,7 +206,7 @@ private:
     bool            bWriter;
     bool            bSearch;
     bool            bFormat;
-    sal_uInt16          nOptions;
+    SearchOptionFlags  nOptions;
     bool            bSet;
     bool            bReadOnly;
     bool            bConstruct;
@@ -255,7 +255,7 @@ private:
     OUString&       BuildAttrText_Impl( OUString& rStr, bool bSrchFlag ) const;
 
     void            TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool );
-    void            EnableControls_Impl( const sal_uInt16 nFlags );
+    void            EnableControls_Impl( const SearchOptionFlags nFlags );
     void            EnableControl_Impl( Control* pCtrl );
     void            SetItem_Impl( const SvxSearchItem* pItem );
 
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 57ad8c8..b7ae582 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -211,12 +211,12 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
             case SID_SEARCH_OPTIONS:
                 {
                     // Anything goes
-                    sal_uInt16 nOptions = 0xffff;
+                    SearchOptionFlags nOptions = SearchOptionFlags::ALL;
 
                     // No replacement if ReadOnly
                     if (GetViewData().GetDocShell()->IsReadOnly())
-                        nOptions &= ~( SEARCH_OPTIONS_REPLACE | SEARCH_OPTIONS_REPLACE_ALL );
-                    rSet.Put( SfxUInt16Item( nWhich, nOptions ) );
+                        nOptions &= ~SearchOptionFlags( SearchOptionFlags::REPLACE | SearchOptionFlags::REPLACE_ALL );
+                    rSet.Put( SfxUInt16Item( nWhich, static_cast<sal_uInt16>(nOptions) ) );
                 }
                 break;
 
diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx
index f51d934..f49f523 100644
--- a/sd/source/ui/docshell/docshell.cxx
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -228,21 +228,21 @@ void DrawDocShell::GetState(SfxItemSet &rSet)
 
             case SID_SEARCH_OPTIONS:
             {
-                sal_uInt16 nOpt = SEARCH_OPTIONS_SEARCH      |
-                              SEARCH_OPTIONS_WHOLE_WORDS |
-                              SEARCH_OPTIONS_BACKWARDS   |
-                              SEARCH_OPTIONS_REG_EXP     |
-                              SEARCH_OPTIONS_EXACT       |
-                              SEARCH_OPTIONS_SIMILARITY  |
-                              SEARCH_OPTIONS_SELECTION;
+                SearchOptionFlags nOpt = SearchOptionFlags::SEARCH |
+                              SearchOptionFlags::WHOLE_WORDS |
+                              SearchOptionFlags::BACKWARDS   |
+                              SearchOptionFlags::REG_EXP     |
+                              SearchOptionFlags::EXACT       |
+                              SearchOptionFlags::SIMILARITY  |
+                              SearchOptionFlags::SELECTION;
 
                 if (!IsReadOnly())
                 {
-                    nOpt |= SEARCH_OPTIONS_REPLACE;
-                    nOpt |= SEARCH_OPTIONS_REPLACE_ALL;
+                    nOpt |= SearchOptionFlags::REPLACE;
+                    nOpt |= SearchOptionFlags::REPLACE_ALL;
                 }
 
-                rSet.Put(SfxUInt16Item(nWhich, nOpt));
+                rSet.Put(SfxUInt16Item(nWhich, static_cast<sal_uInt16>(nOpt)));
             }
             break;
 
diff --git a/svx/source/dialog/srchctrl.cxx b/svx/source/dialog/srchctrl.cxx
index e26a85a..460ebad 100644
--- a/svx/source/dialog/srchctrl.cxx
+++ b/svx/source/dialog/srchctrl.cxx
@@ -55,7 +55,7 @@ void SvxSearchController::StateChanged( sal_uInt16 nSID, SfxItemState eState,
         else if ( SID_SEARCH_OPTIONS == nSID )
         {
             DBG_ASSERT( pState->ISA(SfxUInt16Item), "wrong item type" );
-            sal_uInt16 nFlags = (sal_uInt16) static_cast<const SfxUInt16Item*>(pState)->GetValue();
+            SearchOptionFlags nFlags = (SearchOptionFlags) static_cast<const SfxUInt16Item*>(pState)->GetValue();
             rSrchDlg.EnableControls_Impl( nFlags );
         }
         else if ( SID_SEARCH_ITEM == nSID )
@@ -65,7 +65,7 @@ void SvxSearchController::StateChanged( sal_uInt16 nSID, SfxItemState eState,
         }
     }
     else if ( SID_SEARCH_OPTIONS == nSID || SID_SEARCH_ITEM == nSID )
-        rSrchDlg.EnableControls_Impl( 0 );
+        rSrchDlg.EnableControls_Impl( SearchOptionFlags::NONE );
 }
 
 
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index a8b7267..72ad275 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -255,7 +255,7 @@ SvxSearchDialog::SvxSearchDialog( vcl::Window* pParent, SfxChildWindow* pChildWi
     , bWriter(false)
     , bSearch(true)
     , bFormat(false)
-    , nOptions(USHRT_MAX)
+    , nOptions(SearchOptionFlags::ALL)
     , bSet(false)
     , bReadOnly(false)
     , bConstruct(true)
@@ -368,7 +368,7 @@ void SvxSearchDialog::Construct_Impl()
     pImpl->aSelectionTimer.SetTimeout( 500 );
     pImpl->aSelectionTimer.SetTimeoutHdl(
         LINK( this, SvxSearchDialog, TimeoutHdl_Impl ) );
-    EnableControls_Impl( 0 );
+    EnableControls_Impl( SearchOptionFlags::NONE );
 
     // Store old Text from m_pWordBtn
     aCalcStr += "#";
@@ -1543,14 +1543,14 @@ void SvxSearchDialog::TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool )
 
 
 
-void SvxSearchDialog::EnableControls_Impl( const sal_uInt16 nFlags )
+void SvxSearchDialog::EnableControls_Impl( const SearchOptionFlags nFlags )
 {
     if ( nFlags == nOptions )
         return;
     else
         nOptions = nFlags;
 
-    if ( !nOptions )
+    if ( nOptions == SearchOptionFlags::NONE )
     {
         if ( IsVisible() )
         {
@@ -1562,21 +1562,21 @@ void SvxSearchDialog::EnableControls_Impl( const sal_uInt16 nFlags )
         Show();
     bool bNoSearch = true;
 
-    bool bEnableSearch = ( SEARCH_OPTIONS_SEARCH & nOptions ) != 0;
+    bool bEnableSearch = bool( SearchOptionFlags::SEARCH & nOptions );
     m_pSearchBtn->Enable(bEnableSearch);
 
     if( bEnableSearch )
         bNoSearch = false;
 
 
-    if ( ( SEARCH_OPTIONS_SEARCH_ALL & nOptions ) != 0 )
+    if ( ( SearchOptionFlags::SEARCHALL & nOptions ) )
     {
         m_pSearchAllBtn->Enable();
         bNoSearch = false;
     }
     else
         m_pSearchAllBtn->Disable();
-    if ( ( SEARCH_OPTIONS_REPLACE & nOptions ) != 0 )
+    if ( ( SearchOptionFlags::REPLACE & nOptions ) )
     {
         m_pReplaceBtn->Enable();
         m_pReplaceFrame->get_label_widget()->Enable();
@@ -1591,7 +1591,7 @@ void SvxSearchDialog::EnableControls_Impl( const sal_uInt16 nFlags )
         m_pReplaceLB->Disable();
         m_pReplaceTmplLB->Disable();
     }
-    if ( ( SEARCH_OPTIONS_REPLACE_ALL & nOptions ) != 0 )
+    if ( ( SearchOptionFlags::REPLACE_ALL & nOptions ) )
     {
         m_pReplaceAllBtn->Enable();
         bNoSearch = false;
@@ -1604,31 +1604,31 @@ void SvxSearchDialog::EnableControls_Impl( const sal_uInt16 nFlags )
     m_pSearchLB->Enable( !bNoSearch );
     m_pNotesBtn->Enable();
 
-    if ( ( SEARCH_OPTIONS_WHOLE_WORDS & nOptions ) != 0 )
+    if ( ( SearchOptionFlags::WHOLE_WORDS & nOptions ) )
         m_pWordBtn->Enable();
     else
         m_pWordBtn->Disable();
-    if ( ( SEARCH_OPTIONS_BACKWARDS & nOptions ) != 0 )
+    if ( ( SearchOptionFlags::BACKWARDS & nOptions ) )
         m_pBackwardsBtn->Enable();
     else
         m_pBackwardsBtn->Disable();
-    if ( ( SEARCH_OPTIONS_REG_EXP & nOptions ) != 0 )
+    if ( ( SearchOptionFlags::REG_EXP & nOptions ) )
         m_pRegExpBtn->Enable();
     else
         m_pRegExpBtn->Disable();
-    if ( ( SEARCH_OPTIONS_EXACT & nOptions ) != 0 )
+    if ( ( SearchOptionFlags::EXACT & nOptions ) )
         m_pMatchCaseCB->Enable();
     else
         m_pMatchCaseCB->Disable();
-    if ( ( SEARCH_OPTIONS_SELECTION & nOptions ) != 0 )
+    if ( ( SearchOptionFlags::SELECTION & nOptions ) )
         m_pSelectionBtn->Enable();
     else
         m_pSelectionBtn->Disable();
-    if ( ( SEARCH_OPTIONS_FAMILIES & nOptions ) != 0 )
+    if ( ( SearchOptionFlags::FAMILIES & nOptions ) )
         m_pLayoutBtn->Enable();
     else
         m_pLayoutBtn->Disable();
-    if ( ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 )
+    if ( ( SearchOptionFlags::FORMAT & nOptions ) )
     {
         m_pAttributeBtn->Enable();
         m_pFormatBtn->Enable();
@@ -1641,7 +1641,7 @@ void SvxSearchDialog::EnableControls_Impl( const sal_uInt16 nFlags )
         m_pNoFormatBtn->Disable();
     }
 
-    if ( ( SEARCH_OPTIONS_SIMILARITY & nOptions ) != 0 )
+    if ( ( SearchOptionFlags::SIMILARITY & nOptions ) )
     {
         m_pSimilarityBox->Enable();
         m_pSimilarityBtn->Enable();
@@ -1661,35 +1661,35 @@ void SvxSearchDialog::EnableControls_Impl( const sal_uInt16 nFlags )
 
 void SvxSearchDialog::EnableControl_Impl( Control* pCtrl )
 {
-    if (m_pSearchBtn == pCtrl && ( SEARCH_OPTIONS_SEARCH & nOptions ) != 0)
+    if (m_pSearchBtn == pCtrl && ( SearchOptionFlags::SEARCH & nOptions ) )
     {
         m_pComponentFrame->Enable();
         m_pSearchBtn->Enable();
         return;
     }
     if ( m_pSearchAllBtn == pCtrl &&
-         ( SEARCH_OPTIONS_SEARCH_ALL & nOptions ) != 0 )
+         ( SearchOptionFlags::SEARCHALL & nOptions )  )
     {
         m_pSearchAllBtn->Enable( true );
         return;
     }
-    if ( m_pReplaceBtn == pCtrl && ( SEARCH_OPTIONS_REPLACE & nOptions ) != 0 )
+    if ( m_pReplaceBtn == pCtrl && ( SearchOptionFlags::REPLACE & nOptions )  )
     {
         m_pReplaceBtn->Enable();
         return;
     }
     if ( m_pReplaceAllBtn == pCtrl &&
-         ( SEARCH_OPTIONS_REPLACE_ALL & nOptions ) != 0 )
+         ( SearchOptionFlags::REPLACE_ALL & nOptions ) )
     {
         m_pReplaceAllBtn->Enable();
         return;
     }
-    if ( m_pWordBtn == pCtrl && ( SEARCH_OPTIONS_WHOLE_WORDS & nOptions ) != 0 )
+    if ( m_pWordBtn == pCtrl && ( SearchOptionFlags::WHOLE_WORDS & nOptions ) )
     {
         m_pWordBtn->Enable();
         return;
     }
-    if ( m_pBackwardsBtn == pCtrl && ( SEARCH_OPTIONS_BACKWARDS & nOptions ) != 0 )
+    if ( m_pBackwardsBtn == pCtrl && ( SearchOptionFlags::BACKWARDS & nOptions ) )
     {
         m_pBackwardsBtn->Enable();
         return;
@@ -1699,46 +1699,46 @@ void SvxSearchDialog::EnableControl_Impl( Control* pCtrl )
         m_pNotesBtn->Enable();
         return;
     }
-    if ( m_pRegExpBtn == pCtrl && ( SEARCH_OPTIONS_REG_EXP & nOptions ) != 0
+    if ( m_pRegExpBtn == pCtrl && ( SearchOptionFlags::REG_EXP & nOptions )
         && !m_pSimilarityBox->IsChecked())
     {
         m_pRegExpBtn->Enable();
         return;
     }
-    if ( m_pMatchCaseCB == pCtrl && ( SEARCH_OPTIONS_EXACT & nOptions ) != 0 )
+    if ( m_pMatchCaseCB == pCtrl && ( SearchOptionFlags::EXACT & nOptions ) )
     {
         if (!m_pJapOptionsCB->IsChecked())
             m_pMatchCaseCB->Enable();
         return;
     }
-    if ( m_pSelectionBtn == pCtrl && ( SEARCH_OPTIONS_SELECTION & nOptions ) != 0 )
+    if ( m_pSelectionBtn == pCtrl && ( SearchOptionFlags::SELECTION & nOptions ) )
     {
         m_pSelectionBtn->Enable();
         return;
     }
-    if ( m_pLayoutBtn == pCtrl && ( SEARCH_OPTIONS_FAMILIES & nOptions ) != 0 )
+    if ( m_pLayoutBtn == pCtrl && ( SearchOptionFlags::FAMILIES & nOptions ) )
     {
         m_pLayoutBtn->Enable();
         return;
     }
     if ( m_pAttributeBtn == pCtrl
-         && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0
+         && ( SearchOptionFlags::FORMAT & nOptions )
          && pSearchList )
     {
         m_pAttributeBtn->Enable( pImpl->bFocusOnSearch );
     }
-    if ( m_pFormatBtn == pCtrl && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 )
+    if ( m_pFormatBtn == pCtrl && ( SearchOptionFlags::FORMAT & nOptions ) )
     {
         m_pFormatBtn->Enable();
         return;
     }
-    if ( m_pNoFormatBtn == pCtrl && ( SEARCH_OPTIONS_FORMAT & nOptions ) != 0 )
+    if ( m_pNoFormatBtn == pCtrl && ( SearchOptionFlags::FORMAT & nOptions ) )
     {
         m_pNoFormatBtn->Enable();
         return;
     }
     if ( m_pSimilarityBox == pCtrl &&
-         ( SEARCH_OPTIONS_SIMILARITY & nOptions ) != 0 )
+         ( SearchOptionFlags::SIMILARITY & nOptions ) )
     {
         m_pSimilarityBox->Enable();
 
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 48989d5..bb5696c 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -100,7 +100,7 @@ using ::com::sun::star::util::SearchOptions;
 
 #define SWSRCVIEWFLAGS ( SfxViewShellFlags::CAN_PRINT | SfxViewShellFlags::NO_NEWWINDOW )
 
-#define SRC_SEARCHOPTIONS (0xFFFF & ~(SEARCH_OPTIONS_FORMAT|SEARCH_OPTIONS_FAMILIES|SEARCH_OPTIONS_SEARCH_ALL))
+#define SRC_SEARCHOPTIONS (SearchOptionFlags::ALL & ~SearchOptionFlags(SearchOptionFlags::FORMAT|SearchOptionFlags::FAMILIES|SearchOptionFlags::SEARCHALL))
 
 // Printing margins -> like Basic - Ide
 #define LMARGPRN        1700
@@ -458,11 +458,11 @@ void SwSrcView::GetState(SfxItemSet& rSet)
             break;
             case SID_SEARCH_OPTIONS:
             {
-                sal_uInt16 nOpt = SRC_SEARCHOPTIONS;
+                SearchOptionFlags nOpt = SRC_SEARCHOPTIONS;
                 if(GetDocShell()->IsReadOnly())
-                    nOpt &= ~(SEARCH_OPTIONS_REPLACE|SEARCH_OPTIONS_REPLACE_ALL);
+                    nOpt &= ~SearchOptionFlags(SearchOptionFlags::REPLACE|SearchOptionFlags::REPLACE_ALL);
 
-                rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS,  nOpt) );
+                rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS,  static_cast<sal_uInt16>(nOpt) ) );
             }
             break;
             case SID_SEARCH_ITEM:
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index 8ed5c40..e23c53c 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -798,11 +798,11 @@ void SwView::StateSearch(SfxItemSet &rSet)
         {
             case SID_SEARCH_OPTIONS:
             {
-                sal_uInt16 nOpt = 0xFFFF;
+                SearchOptionFlags nOpt = SearchOptionFlags::ALL;
                 if( GetDocShell()->IsReadOnly() )
-                    nOpt &= ~( SEARCH_OPTIONS_REPLACE |
-                               SEARCH_OPTIONS_REPLACE_ALL );
-                rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, nOpt));
+                    nOpt &= ~SearchOptionFlags( SearchOptionFlags::REPLACE |
+                               SearchOptionFlags::REPLACE_ALL );
+                rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, static_cast<sal_uInt16>(nOpt) ));
             }
             break;
             case SID_SEARCH_ITEM:


More information about the Libreoffice-commits mailing list