cui/source/dialogs/colorpicker.cxx                         |  182 ++++++-------
 dbaccess/source/ui/inc/RTableConnectionData.hxx            |   11 
 dbaccess/source/ui/inc/TableWindow.hxx                     |   30 +-
 dbaccess/source/ui/querydesign/TableWindow.cxx             |   50 +--
 dbaccess/source/ui/relationdesign/RTableConnection.cxx     |    9 
 dbaccess/source/ui/relationdesign/RTableConnectionData.cxx |   12 
 editeng/source/misc/svxacorr.cxx                           |   31 +-
 7 files changed, 164 insertions(+), 161 deletions(-)

New commits:
commit a1720f3a01f4c44364ce8f93e6fc6de225a4a48b
Author: Noel Grandin <n...@peralex.com>
Date:   Wed Sep 21 16:09:53 2016 +0200

    convert C_ constants to typed_flags
    
    Change-Id: Ia80cef26edce3e0a664044f3ca65d33998546d0f

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 9a2a597..247d03b 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -75,10 +75,15 @@ using namespace ::com::sun::star;
 using namespace ::xmloff::token;
 using namespace ::utl;
 
-static const int C_NONE             = 0x00;
-static const int C_FULL_STOP        = 0x01;
-static const int C_EXCLAMATION_MARK = 0x02;
-static const int C_QUESTION_MARK    = 0x04;
+enum class Flags {
+    NONE            = 0x00,
+    FullStop        = 0x01,
+    ExclamationMark = 0x02,
+    QuestionMark    = 0x04,
+};
+namespace o3tl {
+    template<> struct typed_flags<Flags> : is_typed_flags<Flags, 0x07> {};
+}
 static const sal_Unicode cNonBreakingSpace = 0xA0;
 
 static const sal_Char pXMLImplWrdStt_ExcptLstStr[] = "WordExceptList.xml";
@@ -915,7 +920,7 @@ bool SvxAutoCorrect::FnCapitalStartSentence( 
SvxAutoCorrDoc& rDoc,
     if( !bAtStart )
     {
         bool bContinue = true;
-        int nFlag = C_NONE;
+        Flags nFlag = Flags::NONE;
         do {
             switch( *pStr )
             {
@@ -933,30 +938,30 @@ bool SvxAutoCorrect::FnCapitalStartSentence( 
SvxAutoCorrDoc& rDoc,
                         //previous sentence, so don't autocapitalize this word
                         return false;
                     }
-                    if( nFlag & C_FULL_STOP )
+                    if( nFlag & Flags::FullStop )
                         return false;  // no valid separator -> no replacement
-                    nFlag |= C_FULL_STOP;
+                    nFlag |= Flags::FullStop;
                     pExceptStt = pStr;
                 }
                 break;
             case '!':
             case 0xFF01 :
                 {
-                    if( nFlag & C_EXCLAMATION_MARK )
+                    if( nFlag & Flags::ExclamationMark )
                         return false;   // no valid separator -> no replacement
-                    nFlag |= C_EXCLAMATION_MARK;
+                    nFlag |= Flags::ExclamationMark;
                 }
                 break;
             case '?':
             case 0xFF1F :
                 {
-                    if( nFlag & C_QUESTION_MARK)
+                    if( nFlag & Flags::QuestionMark)
                         return false;   // no valid separator -> no replacement
-                    nFlag |= C_QUESTION_MARK;
+                    nFlag |= Flags::QuestionMark;
                 }
                 break;
             default:
-                if( !nFlag )
+                if( nFlag == Flags::NONE )
                     return false;       // no valid separator -> no replacement
                 else
                     bContinue = false;
@@ -968,7 +973,7 @@ bool SvxAutoCorrect::FnCapitalStartSentence( 
SvxAutoCorrDoc& rDoc,
                 return false;       // no valid separator -> no replacement
             }
         } while( bContinue );
-        if( C_FULL_STOP != nFlag )
+        if( Flags::FullStop != nFlag )
             pExceptStt = nullptr;
     }
 
commit 12a2f6dfefb13cfcb75f191f835601357fbc7538
Author: Noel Grandin <n...@peralex.com>
Date:   Wed Sep 21 16:04:12 2016 +0200

    convert SIZING constants to scoped typed_flags
    
    Change-Id: Ibd504cd7059bcaae0a37c0df25d805efff573b99

diff --git a/dbaccess/source/ui/inc/TableWindow.hxx 
b/dbaccess/source/ui/inc/TableWindow.hxx
index 181cd66..aa9aa6c 100644
--- a/dbaccess/source/ui/inc/TableWindow.hxx
+++ b/dbaccess/source/ui/inc/TableWindow.hxx
@@ -30,17 +30,25 @@
 
 #include <comphelper/containermultiplexer.hxx>
 #include "cppuhelper/basemutex.hxx"
+#include <o3tl/typed_flags_set.hxx>
 
 class SvTreeListEntry;
+
+// Flags for the size adjustment of SbaJoinTabWins
+enum class SizingFlags {
+    NONE    = 0x0000,
+    Top     = 0x0001,
+    Bottom  = 0x0002,
+    Left    = 0x0004,
+    Right   = 0x0008,
+};
+namespace o3tl {
+    template<> struct typed_flags<SizingFlags> : is_typed_flags<SizingFlags, 
0x0f> {};
+}
+
+
 namespace dbaui
 {
-    // Flags for the size adjustment of SbaJoinTabWins
-    const sal_uInt16 SIZING_NONE    = 0x0000;
-    const sal_uInt16 SIZING_TOP     = 0x0001;
-    const sal_uInt16 SIZING_BOTTOM  = 0x0002;
-    const sal_uInt16 SIZING_LEFT    = 0x0004;
-    const sal_uInt16 SIZING_RIGHT   = 0x0008;
-
     class OJoinDesignView;
     class OJoinTableView;
     class OTableWindowAccess;
@@ -65,8 +73,8 @@ namespace dbaui
                                 m_pContainerListener;
         sal_Int32               m_nMoveCount;           // how often the arrow 
keys was pressed
         sal_Int32               m_nMoveIncrement;       // how many pixel we 
should move
-        sal_uInt16              m_nSizingFlags;
-        bool                m_bActive;
+        SizingFlags             m_nSizingFlags;
+        bool                    m_bActive;
 
         // OContainerListener
         virtual void _elementInserted( const css::container::ContainerEvent& 
_rEvent ) throw(css::uno::RuntimeException, std::exception) override;
@@ -157,7 +165,7 @@ namespace dbaui
         inline css::uno::Reference< css::container::XNameAccess > 
GetOriginalColumns() const { return m_pData->getColumns(); }
         inline css::uno::Reference< css::beans::XPropertySet >    GetTable() 
const { return m_pData->getTable(); }
 
-        sal_uInt16                      GetSizingFlags() const { return 
m_nSizingFlags; }
+        SizingFlags                 GetSizingFlags() const { return 
m_nSizingFlags; }
         /** set the sizing flag to the direction
             @param  _rPos
                 The EndPosition after resizing.
@@ -165,7 +173,7 @@ namespace dbaui
         void                        setSizingFlag(const Point& _rPos);
         /** set the resizing flag to NONE.
         */
-        void                        resetSizingFlag() { m_nSizingFlags = 
SIZING_NONE; }
+        void                        resetSizingFlag() { m_nSizingFlags = 
SizingFlags::NONE; }
 
         /** returns the new sizing
         */
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx 
b/dbaccess/source/ui/querydesign/TableWindow.cxx
index b699f0d..9e87906 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -99,7 +99,7 @@ OTableWindow::OTableWindow( vcl::Window* pParent, const 
TTableWindowData::value_
           ,m_pData( pTabWinData )
           ,m_nMoveCount(0)
           ,m_nMoveIncrement(1)
-          ,m_nSizingFlags( SIZING_NONE )
+          ,m_nSizingFlags( SizingFlags::NONE )
           ,m_bActive( false )
 {
 
@@ -345,9 +345,9 @@ void OTableWindow::Paint(vcl::RenderContext& 
rRenderContext, const Rectangle& rR
 Rectangle OTableWindow::getSizingRect(const Point& _rPos,const Size& 
_rOutputSize) const
 {
     Rectangle aSizingRect = Rectangle( GetPosPixel(), GetSizePixel() );
-    sal_uInt16 nSizingFlags = GetSizingFlags();
+    SizingFlags nSizingFlags = GetSizingFlags();
 
-    if( nSizingFlags & SIZING_TOP )
+    if( nSizingFlags & SizingFlags::Top )
     {
         if( _rPos.Y() < 0 )
             aSizingRect.Top() = 0;
@@ -355,7 +355,7 @@ Rectangle OTableWindow::getSizingRect(const Point& 
_rPos,const Size& _rOutputSiz
             aSizingRect.Top() = _rPos.Y();
     }
 
-    if( nSizingFlags & SIZING_BOTTOM )
+    if( nSizingFlags & SizingFlags::Bottom )
     {
         if( _rPos.Y() > _rOutputSize.Height() )
             aSizingRect.Bottom() = _rOutputSize.Height();
@@ -363,7 +363,7 @@ Rectangle OTableWindow::getSizingRect(const Point& 
_rPos,const Size& _rOutputSiz
             aSizingRect.Bottom() = _rPos.Y();
     }
 
-    if( nSizingFlags & SIZING_RIGHT )
+    if( nSizingFlags & SizingFlags::Right )
     {
         if( _rPos.X() > _rOutputSize.Width() )
             aSizingRect.Right() = _rOutputSize.Width();
@@ -371,7 +371,7 @@ Rectangle OTableWindow::getSizingRect(const Point& 
_rPos,const Size& _rOutputSiz
             aSizingRect.Right() = _rPos.X();
     }
 
-    if( nSizingFlags & SIZING_LEFT )
+    if( nSizingFlags & SizingFlags::Left )
     {
         if( _rPos.X() < 0 )
             aSizingRect.Left() = 0;
@@ -385,19 +385,19 @@ void OTableWindow::setSizingFlag(const Point& _rPos)
 {
     Size    aOutSize = GetOutputSizePixel();
     // Set the flags when the mouse cursor is in the sizing area
-    m_nSizingFlags = SIZING_NONE;
+    m_nSizingFlags = SizingFlags::NONE;
 
     if( _rPos.X() < TABWIN_SIZING_AREA )
-        m_nSizingFlags |= SIZING_LEFT;
+        m_nSizingFlags |= SizingFlags::Left;
 
     if( _rPos.Y() < TABWIN_SIZING_AREA )
-        m_nSizingFlags |= SIZING_TOP;
+        m_nSizingFlags |= SizingFlags::Top;
 
     if( _rPos.X() > aOutSize.Width()-TABWIN_SIZING_AREA )
-        m_nSizingFlags |= SIZING_RIGHT;
+        m_nSizingFlags |= SizingFlags::Right;
 
     if( _rPos.Y() > aOutSize.Height()-TABWIN_SIZING_AREA )
-        m_nSizingFlags |= SIZING_BOTTOM;
+        m_nSizingFlags |= SizingFlags::Bottom;
 }
 
 void OTableWindow::MouseMove( const MouseEvent& rEvt )
@@ -413,28 +413,18 @@ void OTableWindow::MouseMove( const MouseEvent& rEvt )
     Pointer aPointer;
 
     // Set the mouse cursor when it is in the sizing area
-    switch( m_nSizingFlags )
-    {
-    case SIZING_TOP:
-    case SIZING_BOTTOM:
+    if ( m_nSizingFlags == SizingFlags::Top ||
+         m_nSizingFlags == SizingFlags::Bottom )
         aPointer = Pointer( PointerStyle::SSize );
-        break;
-
-    case SIZING_LEFT:
-    case SIZING_RIGHT:
+    else if ( m_nSizingFlags == SizingFlags::Left ||
+              m_nSizingFlags ==SizingFlags::Right )
         aPointer = Pointer( PointerStyle::ESize );
-        break;
-
-    case SIZING_LEFT+SIZING_TOP:
-    case SIZING_RIGHT+SIZING_BOTTOM:
+    else if ( m_nSizingFlags == (SizingFlags::Left | SizingFlags::Top) ||
+              m_nSizingFlags == (SizingFlags::Right | SizingFlags::Bottom) )
         aPointer = Pointer( PointerStyle::SESize );
-        break;
-
-    case SIZING_RIGHT+SIZING_TOP:
-    case SIZING_LEFT+SIZING_BOTTOM:
+    else if ( m_nSizingFlags == (SizingFlags::Right | SizingFlags::Top) ||
+              m_nSizingFlags == (SizingFlags::Left | SizingFlags::Bottom) )
         aPointer = Pointer( PointerStyle::NESize );
-        break;
-    }
 
     SetPointer( aPointer );
 }
@@ -443,7 +433,7 @@ void OTableWindow::MouseButtonDown( const MouseEvent& rEvt )
 {
     // When resizing, the parent must be informed that
     // the window size of its child has changed
-    if( m_nSizingFlags )
+    if( m_nSizingFlags != SizingFlags::NONE )
         getTableView()->BeginChildSizing( this, GetPointer() );
 
     Window::MouseButtonDown( rEvt );
commit 37acd3c0ca1b57834e02ea71b996cdd50743572c
Author: Noel Grandin <n...@peralex.com>
Date:   Wed Sep 21 15:58:43 2016 +0200

    convert CARDINALITY constants to scoped enum
    
    Change-Id: I35cc98086850e62a2ea8703fc4b086ed2adff66a

diff --git a/dbaccess/source/ui/inc/RTableConnectionData.hxx 
b/dbaccess/source/ui/inc/RTableConnectionData.hxx
index ccd644b..c90e987 100644
--- a/dbaccess/source/ui/inc/RTableConnectionData.hxx
+++ b/dbaccess/source/ui/inc/RTableConnectionData.hxx
@@ -26,10 +26,9 @@
 
 namespace dbaui
 {
-    const sal_uInt16 CARDINAL_UNDEFINED = 0x0000;
-    const sal_uInt16 CARDINAL_ONE_MANY  = 0x0001;
-    const sal_uInt16 CARDINAL_MANY_ONE  = 0x0002;
-    const sal_uInt16 CARDINAL_ONE_ONE   = 0x0004;
+    enum class Cardinality {
+        Undefined, OneMany, ManyOne, OneOne
+    };
 
     class OConnectionLineData;
     class ORelationTableConnectionData :    public OTableConnectionData
@@ -41,7 +40,7 @@ namespace dbaui
         // @see com.sun.star.sdbc.KeyRule
         sal_Int32 m_nUpdateRules;
         sal_Int32 m_nDeleteRules;
-        sal_Int32 m_nCardinality;
+        Cardinality m_nCardinality;
 
         bool checkPrimaryKey(const css::uno::Reference< 
css::beans::XPropertySet>& i_xTable, EConnectionSide _eEConnectionSide) const;
         bool IsSourcePrimKey()  const { return 
checkPrimaryKey(getReferencingTable()->getTable(),JTCS_FROM);    }
@@ -74,7 +73,7 @@ namespace dbaui
 
         inline sal_Int32    GetUpdateRules() const { return m_nUpdateRules; }
         inline sal_Int32    GetDeleteRules() const { return m_nDeleteRules; }
-        inline sal_Int32    GetCardinality() const { return m_nCardinality; }
+        inline Cardinality  GetCardinality() const { return m_nCardinality; }
 
         bool        IsConnectionPossible();
         void        ChangeOrientation();
diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.cxx 
b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
index 35d9798..6183423 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnection.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
@@ -52,7 +52,7 @@ void ORelationTableConnection::Draw(vcl::RenderContext& 
rRenderContext, const Re
 {
     OTableConnection::Draw(rRenderContext, rRect);
     ORelationTableConnectionData* pData = static_cast< 
ORelationTableConnectionData* >(GetData().get());
-    if (pData && (pData->GetCardinality() == CARDINAL_UNDEFINED))
+    if (pData && (pData->GetCardinality() == Cardinality::Undefined))
         return;
 
     // search lines for top line
@@ -91,20 +91,21 @@ void ORelationTableConnection::Draw(vcl::RenderContext& 
rRenderContext, const Re
 
     switch (pData->GetCardinality())
     {
-    case CARDINAL_ONE_MANY:
+    case Cardinality::OneMany:
         aSourceText = "1";
         aDestText   = "n";
         break;
 
-    case CARDINAL_MANY_ONE:
+    case Cardinality::ManyOne:
         aSourceText = "n";
         aDestText   = "1";
         break;
 
-    case CARDINAL_ONE_ONE:
+    case Cardinality::OneOne:
         aSourceText = "1";
         aDestText   = "1";
         break;
+    default: break;
     }
 
     if (IsSelected())
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx 
b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index 88654ee..59733aa 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -47,7 +47,7 @@ ORelationTableConnectionData::ORelationTableConnectionData()
     :OTableConnectionData()
     ,m_nUpdateRules(KeyRule::NO_ACTION)
     ,m_nDeleteRules(KeyRule::NO_ACTION)
-    ,m_nCardinality(CARDINAL_UNDEFINED)
+    ,m_nCardinality(Cardinality::Undefined)
 {
 }
 
@@ -57,7 +57,7 @@ ORelationTableConnectionData::ORelationTableConnectionData( 
const TTableWindowDa
     :OTableConnectionData( _pReferencingTable, _pReferencedTable )
     ,m_nUpdateRules(KeyRule::NO_ACTION)
     ,m_nDeleteRules(KeyRule::NO_ACTION)
-    ,m_nCardinality(CARDINAL_UNDEFINED)
+    ,m_nCardinality(Cardinality::Undefined)
 {
     m_aConnName = rConnName;
 
@@ -127,20 +127,20 @@ void ORelationTableConnectionData::ChangeOrientation()
 void ORelationTableConnectionData::SetCardinality()
 {
     ::osl::MutexGuard aGuard( m_aMutex );
-    m_nCardinality = CARDINAL_UNDEFINED;
+    m_nCardinality = Cardinality::Undefined;
 
     if( IsSourcePrimKey() )
     {
         if( IsDestPrimKey() )
-            m_nCardinality = CARDINAL_ONE_ONE;
+            m_nCardinality = Cardinality::OneOne;
         else
-            m_nCardinality = CARDINAL_ONE_MANY;
+            m_nCardinality = Cardinality::OneMany;
     }
 
     if( IsDestPrimKey() )
     {
         if( !IsSourcePrimKey() )
-            m_nCardinality = CARDINAL_MANY_ONE;
+            m_nCardinality = Cardinality::ManyOne;
     }
 
 }
commit 394b8e396541d5620714204118a6fcda7465270b
Author: Noel Grandin <n...@peralex.com>
Date:   Wed Sep 21 15:40:48 2016 +0200

    convert UPDATE constants to typed_flags
    
    Change-Id: If32ec675678acf08febc82a48ae43f2358026f76

diff --git a/cui/source/dialogs/colorpicker.cxx 
b/cui/source/dialogs/colorpicker.cxx
index 6d3ed54..c9161b7 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -47,6 +47,7 @@
 #include "colorpicker.hxx"
 #include <cmath>
 #include <limits>
+#include <o3tl/typed_flags_set.hxx>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -54,6 +55,22 @@ using namespace ::com::sun::star::ui::dialogs;
 using namespace ::com::sun::star::beans;
 using namespace ::basegfx;
 
+enum class UpdateFlags
+{
+    NONE         = 0x00,
+    RGB          = 0x01,
+    CMYK         = 0x02,
+    HSB          = 0x04,
+    ColorChooser = 0x08,
+    ColorSlider  = 0x10,
+    Hex          = 0x20,
+    All          = 0x3f,
+};
+namespace o3tl {
+    template<> struct typed_flags<UpdateFlags> : is_typed_flags<UpdateFlags, 
0x3f> {};
+}
+
+
 namespace cui
 {
 
@@ -853,14 +870,6 @@ void ColorSliderControl::SetValue(const Color& rColor, 
ColorMode eMode, double d
     }
 }
 
-const sal_uInt16 UPDATE_RGB = 0x01;
-const sal_uInt16 UPDATE_CMYK = 0x02;
-const sal_uInt16 UPDATE_HSB = 0x04;
-const sal_uInt16 UPDATE_COLORCHOOSER = 0x08;
-const sal_uInt16 UPDATE_COLORSLIDER = 0x10;
-const sal_uInt16 UPDATE_HEX = 0x20;
-const sal_uInt16 UPDATE_ALL = 0xff;
-
 class ColorPickerDialog : public ModalDialog
 {
 public:
@@ -871,7 +880,7 @@ public:
     }
     virtual void dispose() override;
 
-    void update_color(sal_uInt16 n = UPDATE_ALL);
+    void update_color(UpdateFlags n = UpdateFlags::All);
 
     DECL_LINK_TYPED(ColorFieldControlModifydl, ColorFieldControl&, void);
     DECL_LINK_TYPED(ColorSliderControlModifyHdl, ColorSliderControl&, void);
@@ -1063,7 +1072,7 @@ sal_Int32 ColorPickerDialog::GetColor() const
     return Color( toInt(mdRed,255.0), toInt(mdGreen,255.0), 
toInt(mdBlue,255.0) ).GetColor();
 }
 
-void ColorPickerDialog::update_color( sal_uInt16 n )
+void ColorPickerDialog::update_color( UpdateFlags n )
 {
     sal_uInt8 nRed = toInt(mdRed,255.0);
     sal_uInt8 nGreen = toInt(mdGreen,255.0);
@@ -1071,14 +1080,14 @@ void ColorPickerDialog::update_color( sal_uInt16 n )
 
     Color aColor(nRed, nGreen, nBlue);
 
-    if (n & UPDATE_RGB) // update RGB
+    if (n & UpdateFlags::RGB) // update RGB
     {
         mpMFRed->SetValue(nRed);
         mpMFGreen->SetValue(nGreen);
         mpMFBlue->SetValue(nBlue);
     }
 
-    if (n & UPDATE_CMYK) // update CMYK
+    if (n & UpdateFlags::CMYK) // update CMYK
     {
         mpMFCyan->SetValue(toInt(mdCyan, 100.0));
         mpMFMagenta->SetValue(toInt(mdMagenta, 100.0));
@@ -1086,14 +1095,14 @@ void ColorPickerDialog::update_color( sal_uInt16 n )
         mpMFKey->SetValue(toInt(mdKey, 100.0));
     }
 
-    if (n & UPDATE_HSB ) // update HSB
+    if (n & UpdateFlags::HSB ) // update HSB
     {
         mpMFHue->SetValue(toInt(mdHue, 1.0));
         mpMFSaturation->SetValue(toInt( mdSat, 100.0));
         mpMFBrightness->SetValue(toInt( mdBri, 100.0));
     }
 
-    if (n & UPDATE_COLORCHOOSER ) // update Color Chooser 1
+    if (n & UpdateFlags::ColorChooser ) // update Color Chooser 1
     {
         switch( meMode )
         {
@@ -1118,7 +1127,7 @@ void ColorPickerDialog::update_color( sal_uInt16 n )
         }
     }
 
-    if (n & UPDATE_COLORSLIDER) // update Color Chooser 2
+    if (n & UpdateFlags::ColorSlider) // update Color Chooser 2
     {
         switch (meMode)
         {
@@ -1143,7 +1152,7 @@ void ColorPickerDialog::update_color( sal_uInt16 n )
         }
     }
 
-    if (n & UPDATE_HEX) // update hex
+    if (n & UpdateFlags::Hex) // update hex
     {
         mpEDHex->SetColor(aColor.GetColor());
     }
@@ -1166,8 +1175,6 @@ void ColorPickerDialog::update_color( sal_uInt16 n )
 
 IMPL_LINK_NOARG_TYPED(ColorPickerDialog, ColorFieldControlModifydl, 
ColorFieldControl&, void)
 {
-    sal_uInt16 n = 0;
-
     double x = mpColorField->GetX();
     double y = mpColorField->GetY();
 
@@ -1199,16 +1206,11 @@ IMPL_LINK_NOARG_TYPED(ColorPickerDialog, 
ColorFieldControlModifydl, ColorFieldCo
         break;
     }
 
-    n = UPDATE_ALL &~ (UPDATE_COLORCHOOSER);
-
-    if (n)
-        update_color(n);
-
+    update_color(UpdateFlags::All & ~(UpdateFlags::ColorChooser));
 }
+
 IMPL_LINK_NOARG_TYPED(ColorPickerDialog, ColorSliderControlModifyHdl, 
ColorSliderControl&, void)
 {
-    sal_uInt16 n = 0;
-
     double dValue = mpColorSlider->GetValue();
     switch (meMode)
     {
@@ -1232,63 +1234,62 @@ IMPL_LINK_NOARG_TYPED(ColorPickerDialog, 
ColorSliderControlModifyHdl, ColorSlide
         break;
     }
 
-    n = UPDATE_ALL&~(UPDATE_COLORSLIDER);
-    if (n)
-        update_color(n);
+    update_color(UpdateFlags::All & ~(UpdateFlags::ColorSlider));
 }
+
 IMPL_LINK_TYPED(ColorPickerDialog, ColorModifyEditHdl, Edit&, rEdit, void)
 {
-    sal_uInt16 n = 0;
+    UpdateFlags n = UpdateFlags::NONE;
 
     if (&rEdit == mpMFRed)
     {
         setColorComponent( ColorComponent::Red, ((double)mpMFRed->GetValue()) 
/ 255.0 );
-        n = UPDATE_ALL &~ (UPDATE_RGB);
+        n = UpdateFlags::All & ~(UpdateFlags::RGB);
     }
     else if (&rEdit == mpMFGreen)
     {
         setColorComponent( ColorComponent::Green, 
((double)mpMFGreen->GetValue()) / 255.0 );
-        n = UPDATE_ALL &~ (UPDATE_RGB);
+        n = UpdateFlags::All & ~(UpdateFlags::RGB);
     }
     else if (&rEdit == mpMFBlue)
     {
         setColorComponent( ColorComponent::Blue, 
((double)mpMFBlue->GetValue()) / 255.0 );
-        n = UPDATE_ALL &~ (UPDATE_RGB);
+        n = UpdateFlags::All & ~(UpdateFlags::RGB);
     }
     else if (&rEdit == mpMFHue)
     {
         setColorComponent( ColorComponent::Hue, (double)mpMFHue->GetValue() );
-        n = UPDATE_ALL &~ (UPDATE_HSB);
+        n = UpdateFlags::All & ~(UpdateFlags::HSB);
     }
     else if (&rEdit == mpMFSaturation)
     {
         setColorComponent( ColorComponent::Saturation, 
((double)mpMFSaturation->GetValue()) / 100.0 );
-        n = UPDATE_ALL &~ (UPDATE_HSB);
+        n = UpdateFlags::All & ~(UpdateFlags::HSB);
     }
     else if (&rEdit == mpMFBrightness)
     {
         setColorComponent( ColorComponent::Brightness, 
((double)mpMFBrightness->GetValue()) / 100.0 );
-        n = UPDATE_ALL &~ (UPDATE_HSB);
+        n = UpdateFlags::All & ~(UpdateFlags::HSB);
     }
     else if (&rEdit == mpMFCyan)
     {
         setColorComponent( ColorComponent::Cyan, 
((double)mpMFCyan->GetValue()) / 100.0 );
-        n = UPDATE_ALL &~ (UPDATE_CMYK);
+        n = UpdateFlags::All & ~(UpdateFlags::CMYK);
     }
     else if (&rEdit == mpMFMagenta)
     {
         setColorComponent( ColorComponent::Magenta, 
((double)mpMFMagenta->GetValue()) / 100.0 );
-        n = UPDATE_ALL &~ (UPDATE_CMYK);
+        n = UpdateFlags::All & ~(UpdateFlags::CMYK);
     }
     else if (&rEdit == mpMFYellow)
     {
         setColorComponent( ColorComponent::Yellow, 
((double)mpMFYellow->GetValue()) / 100.0 );
-        n = UPDATE_ALL &~ (UPDATE_CMYK);
+        n = UpdateFlags::All & ~(UpdateFlags::CMYK);
     }
     else if (&rEdit == mpMFKey)
     {
         setColorComponent( ColorComponent::Key, ((double)mpMFKey->GetValue()) 
/ 100.0 );
-        n = UPDATE_ALL&~(UPDATE_CMYK);
+        n = UpdateFlags::All & ~(UpdateFlags::CMYK);
     }
     else if (&rEdit == mpEDHex)
     {
@@ -1306,12 +1307,12 @@ IMPL_LINK_TYPED(ColorPickerDialog, ColorModifyEditHdl, 
Edit&, rEdit, void)
 
                 RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri );
                 RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, 
mdYellow, mdKey );
-                n = UPDATE_ALL &~ (UPDATE_HEX);
+                n = UpdateFlags::All & ~(UpdateFlags::Hex);
             }
         }
     }
 
-    if (n)
+    if (n != UpdateFlags::NONE)
         update_color(n);
 }
 
@@ -1343,7 +1344,7 @@ IMPL_LINK_NOARG_TYPED(ColorPickerDialog, ModeModifyHdl, 
RadioButton&, void)
     if (meMode != eMode)
     {
         meMode = eMode;
-        update_color(UPDATE_COLORCHOOSER | UPDATE_COLORSLIDER);
+        update_color(UpdateFlags::ColorChooser | UpdateFlags::ColorSlider);
     }
 }
 
commit 6a23621be34edea5082382f63f6dde47f9735b71
Author: Noel Grandin <n...@peralex.com>
Date:   Wed Sep 21 15:32:16 2016 +0200

    convert COLORMODE_RGB constants to scoped enum
    
    Change-Id: I41d13e08d721402442fe807181bac19f5853debe

diff --git a/cui/source/dialogs/colorpicker.cxx 
b/cui/source/dialogs/colorpicker.cxx
index bc3c578..6d3ed54 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -56,21 +56,20 @@ using namespace ::basegfx;
 
 namespace cui
 {
-const sal_uInt16 COLORMODE_RGB =  0x10;
-const sal_uInt16 COLORMODE_HSV =  0x20;
 
-const sal_uInt16 COLORCOMP_RED   = 0x10;
-const sal_uInt16 COLORCOMP_GREEN = 0x11;
-const sal_uInt16 COLORCOMP_BLUE  = 0x12;
-
-const sal_uInt16 COLORCOMP_HUE  = 0x20;
-const sal_uInt16 COLORCOMP_SAT  = 0x21;
-const sal_uInt16 COLORCOMP_BRI  = 0x22;
+enum class ColorComponent {
+    Red,
+    Green,
+    Blue,
+    Hue,
+    Saturation,
+    Brightness,
+    Cyan,
+    Yellow,
+    Magenta,
+    Key,
+};
 
-const sal_uInt16 COLORCOMP_CYAN    = 0x40;
-const sal_uInt16 COLORCOMP_YELLOW  = 0x41;
-const sal_uInt16 COLORCOMP_MAGENTA = 0x42;
-const sal_uInt16 COLORCOMP_KEY     = 0x43;
 
 // color space conversion helpers
 
@@ -881,7 +880,7 @@ public:
 
     sal_Int32 GetColor() const;
 
-    void setColorComponent(sal_uInt16 nComp, double dValue);
+    void setColorComponent(ColorComponent nComp, double dValue);
 
 private:
     sal_Int16 mnDialogMode;
@@ -1176,27 +1175,27 @@ IMPL_LINK_NOARG_TYPED(ColorPickerDialog, 
ColorFieldControlModifydl, ColorFieldCo
     {
     case HUE:
         mdSat = x;
-        setColorComponent( COLORCOMP_BRI, y );
+        setColorComponent( ColorComponent::Brightness, y );
         break;
     case SATURATION:
         mdHue = x * 360.0;
-        setColorComponent( COLORCOMP_BRI, y );
+        setColorComponent( ColorComponent::Brightness, y );
         break;
     case BRIGHTNESS:
         mdHue = x * 360.0;
-        setColorComponent( COLORCOMP_SAT, y );
+        setColorComponent( ColorComponent::Saturation, y );
         break;
     case RED:
         mdBlue = x;
-        setColorComponent( COLORCOMP_GREEN, y );
+        setColorComponent( ColorComponent::Green, y );
         break;
     case GREEN:
         mdBlue = x;
-        setColorComponent( COLORCOMP_RED, y );
+        setColorComponent( ColorComponent::Red, y );
         break;
     case BLUE:
         mdRed = x;
-        setColorComponent( COLORCOMP_GREEN, y );
+        setColorComponent( ColorComponent::Green, y );
         break;
     }
 
@@ -1214,22 +1213,22 @@ IMPL_LINK_NOARG_TYPED(ColorPickerDialog, 
ColorSliderControlModifyHdl, ColorSlide
     switch (meMode)
     {
     case HUE:
-        setColorComponent( COLORCOMP_HUE, dValue * 360.0 );
+        setColorComponent( ColorComponent::Hue, dValue * 360.0 );
         break;
     case SATURATION:
-        setColorComponent( COLORCOMP_SAT, dValue );
+        setColorComponent( ColorComponent::Saturation, dValue );
         break;
     case BRIGHTNESS:
-        setColorComponent( COLORCOMP_BRI, dValue );
+        setColorComponent( ColorComponent::Brightness, dValue );
         break;
     case RED:
-        setColorComponent( COLORCOMP_RED, dValue );
+        setColorComponent( ColorComponent::Red, dValue );
         break;
     case GREEN:
-        setColorComponent( COLORCOMP_GREEN, dValue );
+        setColorComponent( ColorComponent::Green, dValue );
         break;
     case BLUE:
-        setColorComponent( COLORCOMP_BLUE, dValue );
+        setColorComponent( ColorComponent::Blue, dValue );
         break;
     }
 
@@ -1243,52 +1242,52 @@ IMPL_LINK_TYPED(ColorPickerDialog, ColorModifyEditHdl, 
Edit&, rEdit, void)
 
     if (&rEdit == mpMFRed)
     {
-        setColorComponent( COLORCOMP_RED, ((double)mpMFRed->GetValue()) / 
255.0 );
+        setColorComponent( ColorComponent::Red, ((double)mpMFRed->GetValue()) 
/ 255.0 );
         n = UPDATE_ALL &~ (UPDATE_RGB);
     }
     else if (&rEdit == mpMFGreen)
     {
-        setColorComponent( COLORCOMP_GREEN, ((double)mpMFGreen->GetValue()) / 
255.0 );
+        setColorComponent( ColorComponent::Green, 
((double)mpMFGreen->GetValue()) / 255.0 );
         n = UPDATE_ALL &~ (UPDATE_RGB);
     }
     else if (&rEdit == mpMFBlue)
     {
-        setColorComponent( COLORCOMP_BLUE, ((double)mpMFBlue->GetValue()) / 
255.0 );
+        setColorComponent( ColorComponent::Blue, 
((double)mpMFBlue->GetValue()) / 255.0 );
         n = UPDATE_ALL &~ (UPDATE_RGB);
     }
     else if (&rEdit == mpMFHue)
     {
-        setColorComponent( COLORCOMP_HUE, (double)mpMFHue->GetValue() );
+        setColorComponent( ColorComponent::Hue, (double)mpMFHue->GetValue() );
         n = UPDATE_ALL &~ (UPDATE_HSB);
     }
     else if (&rEdit == mpMFSaturation)
     {
-        setColorComponent( COLORCOMP_SAT, ((double)mpMFSaturation->GetValue()) 
/ 100.0 );
+        setColorComponent( ColorComponent::Saturation, 
((double)mpMFSaturation->GetValue()) / 100.0 );
         n = UPDATE_ALL &~ (UPDATE_HSB);
     }
     else if (&rEdit == mpMFBrightness)
     {
-        setColorComponent( COLORCOMP_BRI, ((double)mpMFBrightness->GetValue()) 
/ 100.0 );
+        setColorComponent( ColorComponent::Brightness, 
((double)mpMFBrightness->GetValue()) / 100.0 );
         n = UPDATE_ALL &~ (UPDATE_HSB);
     }
     else if (&rEdit == mpMFCyan)
     {
-        setColorComponent( COLORCOMP_CYAN, ((double)mpMFCyan->GetValue()) / 
100.0 );
+        setColorComponent( ColorComponent::Cyan, 
((double)mpMFCyan->GetValue()) / 100.0 );
         n = UPDATE_ALL &~ (UPDATE_CMYK);
     }
     else if (&rEdit == mpMFMagenta)
     {
-        setColorComponent( COLORCOMP_MAGENTA, 
((double)mpMFMagenta->GetValue()) / 100.0 );
+        setColorComponent( ColorComponent::Magenta, 
((double)mpMFMagenta->GetValue()) / 100.0 );
         n = UPDATE_ALL &~ (UPDATE_CMYK);
     }
     else if (&rEdit == mpMFYellow)
     {
-        setColorComponent( COLORCOMP_YELLOW, ((double)mpMFYellow->GetValue()) 
/ 100.0 );
+        setColorComponent( ColorComponent::Yellow, 
((double)mpMFYellow->GetValue()) / 100.0 );
         n = UPDATE_ALL &~ (UPDATE_CMYK);
     }
     else if (&rEdit == mpMFKey)
     {
-        setColorComponent( COLORCOMP_KEY, ((double)mpMFKey->GetValue()) / 
100.0 );
+        setColorComponent( ColorComponent::Key, ((double)mpMFKey->GetValue()) 
/ 100.0 );
         n = UPDATE_ALL&~(UPDATE_CMYK);
     }
     else if (&rEdit == mpEDHex)
@@ -1348,48 +1347,48 @@ IMPL_LINK_NOARG_TYPED(ColorPickerDialog, ModeModifyHdl, 
RadioButton&, void)
     }
 }
 
-void ColorPickerDialog::setColorComponent( sal_uInt16 nComp, double dValue )
+void ColorPickerDialog::setColorComponent( ColorComponent nComp, double dValue 
)
 {
     switch( nComp )
     {
-    case COLORCOMP_RED:
+    case ColorComponent::Red:
         mdRed = dValue;
         break;
-    case COLORCOMP_GREEN:
+    case ColorComponent::Green:
         mdGreen = dValue;
         break;
-    case COLORCOMP_BLUE:
+    case ColorComponent::Blue:
         mdBlue = dValue;
         break;
-    case COLORCOMP_HUE:
+    case ColorComponent::Hue:
         mdHue = dValue;
         break;
-    case COLORCOMP_SAT:
+    case ColorComponent::Saturation:
         mdSat = dValue;
         break;
-    case COLORCOMP_BRI:
+    case ColorComponent::Brightness:
         mdBri = dValue;
         break;
-    case COLORCOMP_CYAN:
+    case ColorComponent::Cyan:
         mdCyan = dValue;
         break;
-    case COLORCOMP_YELLOW:
+    case ColorComponent::Yellow:
         mdYellow = dValue;
         break;
-    case COLORCOMP_MAGENTA:
+    case ColorComponent::Magenta:
         mdMagenta = dValue;
         break;
-    case COLORCOMP_KEY:
+    case ColorComponent::Key:
         mdKey = dValue;
         break;
     }
 
-    if (nComp & COLORMODE_RGB)
+    if (nComp == ColorComponent::Red || nComp == ColorComponent::Green || 
nComp == ColorComponent::Blue)
     {
         RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri );
         RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey 
);
     }
-    else if (nComp & COLORMODE_HSV)
+    else if (nComp == ColorComponent::Hue || nComp == 
ColorComponent::Saturation || nComp == ColorComponent::Brightness)
     {
         HSVtoRGB( mdHue, mdSat, mdBri, mdRed, mdGreen, mdBlue );
         RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey 
);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to