summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-05-05 08:00:36 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-05-08 09:19:25 +0000
commitff1a7a59434f5f793d4044aad615bcf78148e963 (patch)
tree9f64199265f4bace340fad6abc400b642c5e2612 /include
parent10314b5d8b653864c92d392cbb774438633b2fe1 (diff)
RFC: add IsValueChangedFromSaved to VCL button and listbox
Add a method bool IsValueChangedFromSaved() to the various Button and Listbox classes. Use it to simplify code like if ( maBoldAppFont.GetSavedValue() != TriState(maBoldAppFont.IsChecked()) ) to if ( maBoldAppFont.IsValueChangedFromSaved() ) Change-Id: I26b291d0980237497063ee301d63a49c7d2bc227 Reviewed-on: https://gerrit.libreoffice.org/9250 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/vcl/button.hxx13
-rw-r--r--include/vcl/edit.hxx1
-rw-r--r--include/vcl/lstbox.hxx3
-rw-r--r--include/vcl/vclmedit.hxx1
4 files changed, 13 insertions, 5 deletions
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index 84718fe00711..1c283aff5f47 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -48,9 +48,9 @@ private:
SAL_DLLPRIVATE Button (const Button &);
SAL_DLLPRIVATE Button & operator= (const Button &);
public:
- SAL_DLLPRIVATE sal_uInt16 ImplGetButtonState() const;
- SAL_DLLPRIVATE sal_uInt16& ImplGetButtonState();
- SAL_DLLPRIVATE sal_uInt16 ImplGetTextStyle( OUString& rText, WinBits nWinStyle, sal_uLong nDrawFlags );
+ SAL_DLLPRIVATE sal_uInt16 ImplGetButtonState() const;
+ SAL_DLLPRIVATE sal_uInt16& ImplGetButtonState();
+ SAL_DLLPRIVATE sal_uInt16 ImplGetTextStyle( OUString& rText, WinBits nWinStyle, sal_uLong nDrawFlags );
SAL_DLLPRIVATE void ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize,
bool bLayout, sal_uLong nImageSep, sal_uLong nDrawFlags,
sal_uInt16 nTextStyle, Rectangle *pSymbolRect=NULL, bool bAddImageSep = false );
@@ -106,7 +106,7 @@ protected:
SymbolType meSymbol;
TriState meState;
TriState meSaveValue;
- sal_uInt16 mnDDStyle;
+ sal_uInt16 mnDDStyle;
bool mbPressed;
bool mbInUserDraw;
Link maToggleHdl;
@@ -185,6 +185,7 @@ public:
void SaveValue() { meSaveValue = GetState(); }
TriState GetSavedValue() const { return meSaveValue; }
+ bool IsValueChangedFromSaved() const { return meSaveValue != GetState(); }
Size CalcMinimumSize( long nMaxWidth = 0 ) const;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
@@ -367,7 +368,7 @@ public:
void EnableRadioCheck( bool bRadioCheck = true ) { mbRadioCheck = bRadioCheck; }
bool IsRadioCheckEnabled() const { return mbRadioCheck; }
- bool SetModeRadioImage( const Image& rImage );
+ bool SetModeRadioImage( const Image& rImage );
const Image& GetModeRadioImage( ) const;
void SetState( bool bCheck );
@@ -376,6 +377,7 @@ public:
void SaveValue() { mbSaveValue = IsChecked(); }
bool GetSavedValue() const { return mbSaveValue; }
+ bool IsValueChangedFromSaved() const { return mbSaveValue != IsChecked(); }
static Image GetRadioImage( const AllSettings& rSettings, sal_uInt16 nFlags );
@@ -488,6 +490,7 @@ public:
void SaveValue() { meSaveValue = GetState(); }
TriState GetSavedValue() const { return meSaveValue; }
+ bool IsValueChangedFromSaved() const { return meSaveValue != GetState(); }
static Image GetCheckImage( const AllSettings& rSettings, sal_uInt16 nFlags );
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 8c06faa72ee9..e0d968950b6c 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -218,6 +218,7 @@ public:
void SaveValue() { maSaveValue = GetText(); }
const OUString& GetSavedValue() const { return maSaveValue; }
+ bool IsValueChangedFromSaved() const { return maSaveValue != GetText(); }
virtual void SetModifyHdl( const Link& rLink ) { maModifyHdl = rLink; }
virtual const Link& GetModifyHdl() const { return maModifyHdl; }
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index 791f9a360019..f8b76b113d8d 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -164,6 +164,7 @@ public:
void SaveValue() { mnSaveValue = GetSelectEntryPos(); }
sal_Int32 GetSavedValue() const { return mnSaveValue; }
+ bool IsValueChangedFromSaved() const { return mnSaveValue != GetSelectEntryPos(); }
void SetSeparatorPos( sal_Int32 n = LISTBOX_ENTRY_NOTFOUND );
sal_Int32 GetSeparatorPos() const;
@@ -244,10 +245,12 @@ class VCL_DLLPUBLIC MultiListBox : public ListBox
public:
using ListBox::SaveValue;
using ListBox::GetSavedValue;
+ using ListBox::IsValueChangedFromSaved;
private:
// Bei MultiListBox nicht erlaubt...
void SaveValue();
sal_Int32 GetSavedValue();
+ bool IsValueChangedFromSaved() const;
public:
explicit MultiListBox( Window* pParent, WinBits nStyle = 0 );
diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index b29436f55fc3..6e292a41050b 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -108,6 +108,7 @@ public:
void SaveValue() { aSaveValue = GetText(); }
const OUString& GetSavedValue() const { return aSaveValue; }
+ bool IsValueChangedFromSaved() const { return aSaveValue != GetText(); }
void SetModifyHdl( const Link& rLink ) SAL_OVERRIDE { aModifyHdlLink = rLink; }
const Link& GetModifyHdl() const SAL_OVERRIDE { return aModifyHdlLink; }