convert SV_BMP_ constants to enum
Change-Id: I46cb7f649fa44d8967e0e7da03583157d2706f05 Reviewed-on: https://gerrit.libreoffice.org/12018 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
committed by
Noel Grandin
parent
6118ea49ae
commit
06562c6784
@@ -790,9 +790,9 @@ namespace accessibility
|
||||
SvTreeListEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
|
||||
SvButtonState state = getListBox()->GetCheckButtonState( pEntry );
|
||||
if ( state == SV_BUTTON_CHECKED )
|
||||
getListBox()->SetCheckButtonState(pEntry, (SvButtonState)SV_BMP_UNCHECKED);
|
||||
else if (state == SV_BMP_UNCHECKED)
|
||||
getListBox()->SetCheckButtonState(pEntry, (SvButtonState)SV_BUTTON_CHECKED);
|
||||
getListBox()->SetCheckButtonState(pEntry, SV_BUTTON_UNCHECKED);
|
||||
else if (state == SV_BUTTON_UNCHECKED)
|
||||
getListBox()->SetCheckButtonState(pEntry, SV_BUTTON_CHECKED);
|
||||
}
|
||||
}
|
||||
else if( (nIndex == 1 && (treeFlag & TREEFLAG_CHKBTN) ) || (nIndex == 0) )
|
||||
@@ -831,7 +831,7 @@ namespace accessibility
|
||||
{
|
||||
if ( state == SV_BUTTON_CHECKED )
|
||||
return sActionDesc2;
|
||||
else if (state == SV_BMP_UNCHECKED)
|
||||
else if (state == SV_BUTTON_UNCHECKED)
|
||||
return sActionDesc1;
|
||||
}
|
||||
else
|
||||
|
@@ -4545,12 +4545,12 @@ void SvxToolbarEntriesListBox::BuildCheckBoxButtonImages( SvLBoxButtonData* pDat
|
||||
CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT ));
|
||||
|
||||
// Fill button data struct with new images
|
||||
pData->aBmps[SV_BMP_UNCHECKED] = aImage;
|
||||
pData->aBmps[SV_BMP_CHECKED] = GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED ));
|
||||
pData->aBmps[SV_BMP_HICHECKED] = GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED ));
|
||||
pData->aBmps[SV_BMP_HIUNCHECKED] = GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED));
|
||||
pData->aBmps[SV_BMP_TRISTATE] = GetSizedImage( aDev, aSize, Image() ); // Use tristate bitmaps to have no checkbox for separator entries
|
||||
pData->aBmps[SV_BMP_HITRISTATE] = GetSizedImage( aDev, aSize, Image() );
|
||||
pData->SetImage(SvBmp::UNCHECKED, aImage);
|
||||
pData->SetImage(SvBmp::CHECKED, GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED )) );
|
||||
pData->SetImage(SvBmp::HICHECKED, GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED )) );
|
||||
pData->SetImage(SvBmp::HIUNCHECKED, GetSizedImage( aDev, aSize, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED)) );
|
||||
pData->SetImage(SvBmp::TRISTATE, GetSizedImage( aDev, aSize, Image() ) ); // Use tristate bitmaps to have no checkbox for separator entries
|
||||
pData->SetImage(SvBmp::HITRISTATE, GetSizedImage( aDev, aSize, Image() ) );
|
||||
|
||||
// Get image size
|
||||
m_aCheckBoxImageSizePixel = aImage.GetSizePixel();
|
||||
|
@@ -22,22 +22,23 @@
|
||||
#define INCLUDED_SVTOOLS_SVLBITM_HXX
|
||||
|
||||
#include <svtools/svtdllapi.h>
|
||||
|
||||
#include <tools/link.hxx>
|
||||
|
||||
#include <vcl/image.hxx>
|
||||
#include <svtools/treelistbox.hxx>
|
||||
|
||||
class SvTreeListEntry;
|
||||
|
||||
|
||||
#define SV_BMP_UNCHECKED 0
|
||||
#define SV_BMP_CHECKED 1
|
||||
#define SV_BMP_TRISTATE 2
|
||||
#define SV_BMP_HIUNCHECKED 3
|
||||
#define SV_BMP_HICHECKED 4
|
||||
#define SV_BMP_HITRISTATE 5
|
||||
#define SV_BMP_STATICIMAGE 6
|
||||
enum class SvBmp
|
||||
{
|
||||
UNCHECKED = 0,
|
||||
CHECKED = 1,
|
||||
TRISTATE = 2,
|
||||
HIUNCHECKED = 3,
|
||||
HICHECKED = 4,
|
||||
HITRISTATE = 5,
|
||||
STATICIMAGE = 6
|
||||
};
|
||||
|
||||
struct SvLBoxButtonData_Impl;
|
||||
|
||||
@@ -50,9 +51,10 @@ private:
|
||||
SvLBoxButtonData_Impl* pImpl;
|
||||
bool bDataOk;
|
||||
SvButtonState eState;
|
||||
std::vector<Image> aBmps; // Indizes siehe Konstanten BMP_ ....
|
||||
|
||||
SVT_DLLPRIVATE void SetWidthAndHeight();
|
||||
SVT_DLLPRIVATE void InitData( bool bImagesFromDefault,
|
||||
SVT_DLLPRIVATE void SetWidthAndHeight();
|
||||
SVT_DLLPRIVATE void InitData( bool bImagesFromDefault,
|
||||
bool _bRadioBtn, const Control* pControlForSettings = NULL );
|
||||
public:
|
||||
// include creating default images (CheckBox or RadioButton)
|
||||
@@ -61,7 +63,7 @@ public:
|
||||
|
||||
~SvLBoxButtonData();
|
||||
|
||||
sal_uInt16 GetIndex( sal_uInt16 nItemState );
|
||||
SvBmp GetIndex( sal_uInt16 nItemState );
|
||||
long Width();
|
||||
long Height();
|
||||
void SetLink( const Link& rLink) { aLink=rLink; }
|
||||
@@ -73,14 +75,12 @@ public:
|
||||
void StoreButtonState( SvTreeListEntry* pEntry, sal_uInt16 nItemFlags );
|
||||
SvButtonState ConvertToButtonState( sal_uInt16 nItemFlags ) const;
|
||||
|
||||
SvButtonState GetActButtonState() const
|
||||
{
|
||||
return eState;
|
||||
}
|
||||
SvButtonState GetActButtonState() const { return eState; }
|
||||
|
||||
SvTreeListEntry* GetActEntry() const;
|
||||
SvTreeListEntry* GetActEntry() const;
|
||||
|
||||
Image aBmps[24]; // Indizes siehe Konstanten BMP_ ....
|
||||
void SetImage(SvBmp nIndex, const Image& aImage) { aBmps[(int)nIndex] = aImage; }
|
||||
Image& GetImage(SvBmp nIndex) { return aBmps[(int)nIndex]; }
|
||||
|
||||
void SetDefaultImages( const Control* pControlForSettings = NULL );
|
||||
// set images acording to the color scheeme of the Control
|
||||
@@ -138,7 +138,6 @@ class SVT_DLLPUBLIC SvLBoxButton : public SvLBoxItem
|
||||
SvLBoxButtonData* pData;
|
||||
SvLBoxButtonKind eKind;
|
||||
sal_uInt16 nItemFlags;
|
||||
sal_uInt16 nBaseOffs;
|
||||
|
||||
void ImplAdjustBoxSize( Size& io_rCtrlSize, ControlType i_eType, vcl::Window* pParent );
|
||||
public:
|
||||
@@ -172,9 +171,6 @@ public:
|
||||
|
||||
SvLBoxButtonKind GetKind() const { return eKind; }
|
||||
|
||||
void SetBaseOffs( sal_uInt16 nOffs ) { nBaseOffs = nOffs; }
|
||||
sal_uInt16 GetBaseOffs() const { return nBaseOffs; }
|
||||
|
||||
// Check whether this button can be modified via UI
|
||||
bool CheckModification() const;
|
||||
SvLBoxButtonData* GetButtonData() const{ return pData;}
|
||||
|
@@ -76,33 +76,33 @@ void SvLBoxButtonData::CallLink()
|
||||
aLink.Call( this );
|
||||
}
|
||||
|
||||
sal_uInt16 SvLBoxButtonData::GetIndex( sal_uInt16 nItemState )
|
||||
SvBmp SvLBoxButtonData::GetIndex( sal_uInt16 nItemState )
|
||||
{
|
||||
nItemState &= 0x000F;
|
||||
sal_uInt16 nIdx;
|
||||
SvBmp nIdx;
|
||||
switch( nItemState )
|
||||
{
|
||||
case SV_ITEMSTATE_UNCHECKED:
|
||||
nIdx = SV_BMP_UNCHECKED; break;
|
||||
nIdx = SvBmp::UNCHECKED; break;
|
||||
case SV_ITEMSTATE_CHECKED:
|
||||
nIdx = SV_BMP_CHECKED; break;
|
||||
nIdx = SvBmp::CHECKED; break;
|
||||
case SV_ITEMSTATE_TRISTATE:
|
||||
nIdx = SV_BMP_TRISTATE; break;
|
||||
nIdx = SvBmp::TRISTATE; break;
|
||||
case SV_ITEMSTATE_UNCHECKED | SV_ITEMSTATE_HILIGHTED:
|
||||
nIdx = SV_BMP_HIUNCHECKED; break;
|
||||
nIdx = SvBmp::HIUNCHECKED; break;
|
||||
case SV_ITEMSTATE_CHECKED | SV_ITEMSTATE_HILIGHTED:
|
||||
nIdx = SV_BMP_HICHECKED; break;
|
||||
nIdx = SvBmp::HICHECKED; break;
|
||||
case SV_ITEMSTATE_TRISTATE | SV_ITEMSTATE_HILIGHTED:
|
||||
nIdx = SV_BMP_HITRISTATE; break;
|
||||
nIdx = SvBmp::HITRISTATE; break;
|
||||
default:
|
||||
nIdx = SV_BMP_UNCHECKED;
|
||||
nIdx = SvBmp::UNCHECKED;
|
||||
}
|
||||
return nIdx;
|
||||
}
|
||||
|
||||
void SvLBoxButtonData::SetWidthAndHeight()
|
||||
{
|
||||
Size aSize = aBmps[0].GetSizePixel();
|
||||
Size aSize = aBmps[(int)SvBmp::UNCHECKED].GetSizePixel();
|
||||
nWidth = aSize.Width();
|
||||
nHeight = aSize.Height();
|
||||
bDataOk = true;
|
||||
@@ -147,21 +147,21 @@ void SvLBoxButtonData::SetDefaultImages( const Control* pCtrl )
|
||||
|
||||
if ( pImpl->bShowRadioButton )
|
||||
{
|
||||
aBmps[ SV_BMP_UNCHECKED ] = RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_DEFAULT );
|
||||
aBmps[ SV_BMP_CHECKED ] = RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_CHECKED );
|
||||
aBmps[ SV_BMP_HICHECKED ] = RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED );
|
||||
aBmps[ SV_BMP_HIUNCHECKED ] = RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED );
|
||||
aBmps[ SV_BMP_TRISTATE ] = RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_DONTKNOW );
|
||||
aBmps[ SV_BMP_HITRISTATE ] = RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_DONTKNOW | BUTTON_DRAW_PRESSED );
|
||||
SetImage(SvBmp::UNCHECKED, RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_DEFAULT ) );
|
||||
SetImage(SvBmp::CHECKED, RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_CHECKED ) );
|
||||
SetImage(SvBmp::HICHECKED, RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED ) );
|
||||
SetImage(SvBmp::HIUNCHECKED, RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED ) );
|
||||
SetImage(SvBmp::TRISTATE, RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_DONTKNOW ) );
|
||||
SetImage(SvBmp::HITRISTATE, RadioButton::GetRadioImage( rSettings, BUTTON_DRAW_DONTKNOW | BUTTON_DRAW_PRESSED ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aBmps[ SV_BMP_UNCHECKED ] = CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT );
|
||||
aBmps[ SV_BMP_CHECKED ] = CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED );
|
||||
aBmps[ SV_BMP_HICHECKED ] = CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED );
|
||||
aBmps[ SV_BMP_HIUNCHECKED ] = CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED );
|
||||
aBmps[ SV_BMP_TRISTATE ] = CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DONTKNOW );
|
||||
aBmps[ SV_BMP_HITRISTATE ] = CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DONTKNOW | BUTTON_DRAW_PRESSED );
|
||||
SetImage(SvBmp::UNCHECKED, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT ) );
|
||||
SetImage(SvBmp::CHECKED, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED ) );
|
||||
SetImage(SvBmp::HICHECKED, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_CHECKED | BUTTON_DRAW_PRESSED ) );
|
||||
SetImage(SvBmp::HIUNCHECKED, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DEFAULT | BUTTON_DRAW_PRESSED ) );
|
||||
SetImage(SvBmp::TRISTATE, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DONTKNOW ) );
|
||||
SetImage(SvBmp::HITRISTATE, CheckBox::GetCheckImage( rSettings, BUTTON_DRAW_DONTKNOW | BUTTON_DRAW_PRESSED ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,6 @@ SvLBoxButton::SvLBoxButton( SvTreeListEntry* pEntry, SvLBoxButtonKind eTheKind,
|
||||
, pData(pBData)
|
||||
, eKind(eTheKind)
|
||||
, nItemFlags(0)
|
||||
, nBaseOffs(0)
|
||||
{
|
||||
SetStateUnchecked();
|
||||
}
|
||||
@@ -317,7 +316,6 @@ SvLBoxButton::SvLBoxButton()
|
||||
, pData(0)
|
||||
, eKind(SvLBoxButtonKind_enabledCheckbox)
|
||||
, nItemFlags(0)
|
||||
, nBaseOffs(0)
|
||||
{
|
||||
SetStateUnchecked();
|
||||
}
|
||||
@@ -349,15 +347,15 @@ void SvLBoxButton::Paint(
|
||||
const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/,
|
||||
const SvTreeListEntry* /*pEntry*/)
|
||||
{
|
||||
sal_uInt16 nIndex = eKind == SvLBoxButtonKind_staticImage
|
||||
? SV_BMP_STATICIMAGE : pData->GetIndex( nItemFlags );
|
||||
SvBmp nIndex = eKind == SvLBoxButtonKind_staticImage
|
||||
? SvBmp::STATICIMAGE : pData->GetIndex( nItemFlags );
|
||||
sal_uInt16 nStyle = eKind != SvLBoxButtonKind_disabledCheckbox &&
|
||||
rDev.IsEnabled() ? 0 : IMAGE_DRAW_DISABLE;
|
||||
|
||||
//Native drawing
|
||||
bool bNativeOK = false;
|
||||
ControlType eCtrlType = (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX;
|
||||
if ( nIndex != SV_BMP_STATICIMAGE && rDev.IsNativeControlSupported( eCtrlType, PART_ENTIRE_CONTROL) )
|
||||
if ( nIndex != SvBmp::STATICIMAGE && rDev.IsNativeControlSupported( eCtrlType, PART_ENTIRE_CONTROL) )
|
||||
|
||||
{
|
||||
Size aSize(pData->Width(), pData->Height());
|
||||
@@ -383,7 +381,7 @@ void SvLBoxButton::Paint(
|
||||
}
|
||||
|
||||
if( !bNativeOK && isVis )
|
||||
rDev.DrawImage( rPos, pData->aBmps[nIndex + nBaseOffs] ,nStyle);
|
||||
rDev.DrawImage( rPos, pData->GetImage(nIndex), nStyle);
|
||||
}
|
||||
|
||||
SvLBoxItem* SvLBoxButton::Create() const
|
||||
|
@@ -45,7 +45,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxCheckListBox(vcl::W
|
||||
|
||||
void SvxCheckListBox::SetNormalStaticImage(const Image& rNormalStaticImage)
|
||||
{
|
||||
pCheckButton->aBmps[SV_BMP_STATICIMAGE] = rNormalStaticImage;
|
||||
pCheckButton->SetImage(SvBmp::STATICIMAGE, rNormalStaticImage);
|
||||
}
|
||||
|
||||
SvxCheckListBox::~SvxCheckListBox()
|
||||
|
Reference in New Issue
Block a user