summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/dialogs/SpellDialog.cxx2
-rw-r--r--cui/source/tabpages/numfmt.cxx4
-rw-r--r--include/vcl/lstbox.h17
-rw-r--r--include/vcl/lstbox.hxx12
-rw-r--r--sd/source/ui/animations/CustomAnimationCreateDialog.cxx4
-rw-r--r--vcl/inc/ilstbox.hxx18
-rw-r--r--vcl/source/control/ilstbox.cxx28
-rw-r--r--vcl/source/control/lstbox.cxx4
-rw-r--r--vcl/source/control/tabctrl.cxx2
9 files changed, 50 insertions, 41 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index dad2575114b5..1d72e70e172c 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -359,7 +359,7 @@ void SpellDialog::UpdateBoxes_Impl()
if ( LISTBOX_ENTRY_NOTFOUND == m_pSuggestionLB->GetEntryPos( aTmp ) )
{
m_pSuggestionLB->InsertEntry( aTmp );
- m_pSuggestionLB->SetEntryFlags(m_pSuggestionLB->GetEntryCount() - 1, LISTBOX_ENTRY_FLAG_MULTILINE);
+ m_pSuggestionLB->SetEntryFlags(m_pSuggestionLB->GetEntryCount() - 1, ListBoxEntryFlags::MultiLine);
}
}
if(!nSize)
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index f972859cecd3..a8974af76baf 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -557,7 +557,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet )
sal_Int32 nPos = pNumFmtShell->GetCurrencySymbol();
if (nPos == 0)
// Enable "Automatically" if currently used so it is selectable.
- m_pLbCurrency->SetEntryFlags( nPos, 0);
+ m_pLbCurrency->SetEntryFlags( nPos, ListBoxEntryFlags::NONE );
m_pLbCurrency->SelectEntryPos(nPos);
}
@@ -1738,7 +1738,7 @@ void SvxNumberFormatTabPage::FillCurrencyBox()
// is selected, else if the to be disabled (first) entry was selected it
// would be sticky when disabled and could not be deselected!
m_pLbCurrency->SetNoSelection();
- m_pLbCurrency->SetEntryFlags( 0, LISTBOX_ENTRY_FLAG_DISABLE_SELECTION | LISTBOX_ENTRY_FLAG_DRAW_DISABLED);
+ m_pLbCurrency->SetEntryFlags( 0, ListBoxEntryFlags::DisableSelection | ListBoxEntryFlags::DrawDisabled);
m_pLbCurrency->SelectEntryPos(nSelPos);
}
diff --git a/include/vcl/lstbox.h b/include/vcl/lstbox.h
index 50e121fad6fc..b6e654ae9774 100644
--- a/include/vcl/lstbox.h
+++ b/include/vcl/lstbox.h
@@ -21,6 +21,7 @@
#define INCLUDED_VCL_LSTBOX_H
#include <sal/types.h>
+#include <o3tl/typed_flags_set.hxx>
#define LISTBOX_APPEND (SAL_MAX_INT32)
#define LISTBOX_ENTRY_NOTFOUND (SAL_MAX_INT32)
@@ -36,24 +37,32 @@
// !! to change the internal behaviour of the ListBox implementation !!
// !! for specific entries. !!
+enum class ListBoxEntryFlags
+{
+ NONE = 0x0000,
/** this flag disables a selection of an entry completely. It is not
possible to select such entries either from the user interface
nor from the ListBox methods. Cursor traveling is handled correctly.
This flag can be used to add titles to a ListBox.
*/
-#define LISTBOX_ENTRY_FLAG_DISABLE_SELECTION 0x0000001
+ DisableSelection = 0x0001,
/** this flag can be used to make an entry multine capable
A normal entry is single line and will therefore be clipped
at the right listbox border. Setting this flag enables
word breaks for the entry text.
*/
-#define LISTBOX_ENTRY_FLAG_MULTILINE 0x0000002
+ MultiLine = 0x0002,
/** this flags lets the item be drawn disabled (e.g. in grey text)
- usage only guaranteed with LISTBOX_ENTRY_FLAG_DISABLE_SELECTION
+ usage only guaranteed with ListBoxEntryFlags::DisableSelection
*/
-#define LISTBOX_ENTRY_FLAG_DRAW_DISABLED 0x0000004
+ DrawDisabled = 0x0004,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ListBoxEntryFlags> : is_typed_flags<ListBoxEntryFlags, 0x0007> {};
+}
#endif // INCLUDED_VCL_LSTBOX_H
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index bd13541337c3..4cbdd499dde0 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -145,21 +145,21 @@ public:
void* GetSelectEntryData() const { return GetEntryData(GetSelectEntryPos()); }
/** this methods stores a combination of flags from the
- LISTBOX_ENTRY_FLAG_* defines at the given entry.
- See description of the possible LISTBOX_ENTRY_FLAG_* flags
+ ListBoxEntryFlags::* defines at the given entry.
+ See description of the possible ListBoxEntryFlags::* flags
for details.
Do not use these flags for user data as they are reserved
to change the internal behaviour of the ListBox implementation
for specific entries.
*/
- void SetEntryFlags( sal_Int32 nPos, long nFlags );
+ void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
/** this methods gets the current combination of flags from the
- LISTBOX_ENTRY_FLAG_* defines from the given entry.
- See description of the possible LISTBOX_ENTRY_FLAG_* flags
+ ListBoxEntryFlags::* defines from the given entry.
+ See description of the possible ListBoxEntryFlags::* flags
for details.
*/
- long GetEntryFlags( sal_Int32 nPos ) const;
+ ListBoxEntryFlags GetEntryFlags( sal_Int32 nPos ) const;
void SetTopEntry( sal_Int32 nPos );
sal_Int32 GetTopEntry() const;
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
index 7f73b5c89bf3..5fa9de5a7258 100644
--- a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
@@ -100,7 +100,7 @@ sal_Int32 CategoryListBox::InsertCategory( const OUString& rStr, sal_Int32 nPo
{
sal_Int32 n = ListBox::InsertEntry( rStr, nPos );
if( n != LISTBOX_ENTRY_NOTFOUND )
- ListBox::SetEntryFlags( n, ListBox::GetEntryFlags(n) | LISTBOX_ENTRY_FLAG_DISABLE_SELECTION );
+ ListBox::SetEntryFlags( n, ListBox::GetEntryFlags(n) | ListBoxEntryFlags::DisableSelection );
return n;
}
@@ -109,7 +109,7 @@ void CategoryListBox::UserDraw( const UserDrawEvent& rUDEvt )
{
const sal_uInt16 nItem = rUDEvt.GetItemId();
- if( ListBox::GetEntryFlags(nItem) & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION )
+ if( ListBox::GetEntryFlags(nItem) & ListBoxEntryFlags::DisableSelection )
{
Rectangle aOutRect( rUDEvt.GetRect() );
OutputDevice* pDev = rUDEvt.GetDevice();
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index 155e03f17000..da69ac82f425 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -52,13 +52,13 @@ struct ImplEntryType
Image maImage;
void* mpUserData;
bool mbIsSelected;
- long mnFlags;
+ ListBoxEntryFlags mnFlags;
long mnHeight;
ImplEntryType( const OUString& rStr, const Image& rImage ) :
maStr( rStr ),
maImage( rImage ),
- mnFlags( 0 ),
+ mnFlags( ListBoxEntryFlags::NONE ),
mnHeight( 0 )
{
mbIsSelected = false;
@@ -67,7 +67,7 @@ struct ImplEntryType
ImplEntryType( const OUString& rStr ) :
maStr( rStr ),
- mnFlags( 0 ),
+ mnFlags( ListBoxEntryFlags::NONE ),
mnHeight( 0 )
{
mbIsSelected = false;
@@ -76,7 +76,7 @@ struct ImplEntryType
ImplEntryType( const Image& rImage ) :
maImage( rImage ),
- mnFlags( 0 ),
+ mnFlags( ListBoxEntryFlags::NONE ),
mnHeight( 0 )
{
mbIsSelected = false;
@@ -138,8 +138,8 @@ public:
void SetEntryData( sal_Int32 nPos, void* pNewData );
void* GetEntryData( sal_Int32 nPos ) const;
- void SetEntryFlags( sal_Int32 nPos, long nFlags );
- long GetEntryFlags( sal_Int32 nPos ) const;
+ void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
+ ListBoxEntryFlags GetEntryFlags( sal_Int32 nPos ) const;
void SelectEntry( sal_Int32 nPos, bool bSelect );
@@ -164,7 +164,7 @@ public:
sal_Int32 GetMaxMRUCount() const { return mnMaxMRUCount; }
/** An Entry is selectable if its mnFlags does not have the
- LISTBOX_ENTRY_FLAG_DISABLE_SELECTION flag set. */
+ ListBoxEntryFlags::DisableSelection flag set. */
bool IsEntrySelectable( sal_Int32 nPos ) const;
/** @return the first entry found from the given position nPos that is selectable
@@ -277,7 +277,7 @@ public:
void ResetCurrentPos() { mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; }
sal_Int32 GetCurrentPos() const { return mnCurrentPos; }
sal_uInt16 GetDisplayLineCount() const;
- void SetEntryFlags( sal_Int32 nPos, long nFlags );
+ void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
void DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 nPos, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos = false, bool bLayout = false);
@@ -428,7 +428,7 @@ public:
void SetEntryData( sal_Int32 nPos, void* pNewData ) { maLBWindow->GetEntryList()->SetEntryData( nPos, pNewData ); }
void Clear();
- void SetEntryFlags( sal_Int32 nPos, long nFlags );
+ void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
void SelectEntry( sal_Int32 nPos, bool bSelect );
void SetNoSelection();
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index f44583cc5496..296e923671ca 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -118,7 +118,7 @@ void ImplEntryList::SelectEntry( sal_Int32 nPos, bool bSelect )
boost::ptr_vector<ImplEntryType>::iterator iter = maEntries.begin()+nPos;
if ( ( iter->mbIsSelected != bSelect ) &&
- ( (iter->mnFlags & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION) == 0 ) )
+ ( (iter->mnFlags & ListBoxEntryFlags::DisableSelection) == ListBoxEntryFlags::NONE ) )
{
iter->mbIsSelected = bSelect;
if ( mbCallSelectionChangedHdl )
@@ -398,17 +398,17 @@ void* ImplEntryList::GetEntryData( sal_Int32 nPos ) const
return pImplEntry ? pImplEntry->mpUserData : NULL;
}
-void ImplEntryList::SetEntryFlags( sal_Int32 nPos, long nFlags )
+void ImplEntryList::SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags )
{
ImplEntryType* pImplEntry = GetEntry( nPos );
if ( pImplEntry )
pImplEntry->mnFlags = nFlags;
}
-long ImplEntryList::GetEntryFlags( sal_Int32 nPos ) const
+ListBoxEntryFlags ImplEntryList::GetEntryFlags( sal_Int32 nPos ) const
{
ImplEntryType* pImplEntry = GetEntry( nPos );
- return pImplEntry ? pImplEntry->mnFlags : 0;
+ return pImplEntry ? pImplEntry->mnFlags : ListBoxEntryFlags::NONE;
}
sal_Int32 ImplEntryList::GetSelectEntryCount() const
@@ -460,7 +460,7 @@ bool ImplEntryList::IsEntryPosSelected( sal_Int32 nIndex ) const
bool ImplEntryList::IsEntrySelectable( sal_Int32 nPos ) const
{
ImplEntryType* pImplEntry = GetEntry( nPos );
- return pImplEntry == nullptr || ((pImplEntry->mnFlags & LISTBOX_ENTRY_FLAG_DISABLE_SELECTION) == 0);
+ return pImplEntry == nullptr || ((pImplEntry->mnFlags & ListBoxEntryFlags::DisableSelection) == ListBoxEntryFlags::NONE);
}
sal_Int32 ImplEntryList::FindFirstSelectable( sal_Int32 nPos, bool bForward /* = true */ )
@@ -638,7 +638,7 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry )
if ( aMetrics.bText )
{
- if( (rEntry.mnFlags & LISTBOX_ENTRY_FLAG_MULTILINE) )
+ if( (rEntry.mnFlags & ListBoxEntryFlags::MultiLine) )
{
// multiline case
Size aCurSize( PixelToLogic( GetSizePixel() ) );
@@ -757,7 +757,7 @@ sal_Int32 ImplListBoxWindow::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEnt
sal_Int32 nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, mbSort );
if( (GetStyle() & WB_WORDBREAK) )
- pNewEntry->mnFlags |= LISTBOX_ENTRY_FLAG_MULTILINE;
+ pNewEntry->mnFlags |= ListBoxEntryFlags::MultiLine;
ImplUpdateEntryMetrics( *pNewEntry );
return nNewPos;
@@ -772,7 +772,7 @@ void ImplListBoxWindow::RemoveEntry( sal_Int32 nPos )
ImplCalcMetrics();
}
-void ImplListBoxWindow::SetEntryFlags( sal_Int32 nPos, long nFlags )
+void ImplListBoxWindow::SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags )
{
mpEntryList->SetEntryFlags( nPos, nFlags );
ImplEntryType* pEntry = mpEntryList->GetMutableEntryPtr( nPos );
@@ -1825,7 +1825,7 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32
{
long nMaxWidth = std::max(static_cast< long >(mnMaxWidth), rRenderContext.GetOutputSizePixel().Width() - 2 * mnBorder);
// a multiline entry should only be as wide a the window
- if ((pEntry->mnFlags & LISTBOX_ENTRY_FLAG_MULTILINE))
+ if ((pEntry->mnFlags & ListBoxEntryFlags::MultiLine))
nMaxWidth = rRenderContext.GetOutputSizePixel().Width() - 2 * mnBorder;
Rectangle aTextRect(Point(mnBorder - mnLeft, nY),
@@ -1850,9 +1850,9 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32
}
sal_uInt16 nDrawStyle = ImplGetTextStyle();
- if ((pEntry->mnFlags & LISTBOX_ENTRY_FLAG_MULTILINE))
+ if ((pEntry->mnFlags & ListBoxEntryFlags::MultiLine))
nDrawStyle |= MULTILINE_ENTRY_DRAW_FLAGS;
- if ((pEntry->mnFlags & LISTBOX_ENTRY_FLAG_DRAW_DISABLED))
+ if ((pEntry->mnFlags & ListBoxEntryFlags::DrawDisabled))
nDrawStyle |= TEXT_DRAW_DISABLE;
rRenderContext.DrawText(aTextRect, aStr, nDrawStyle, pVector, pDisplayText);
@@ -1920,7 +1920,7 @@ void ImplListBoxWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangl
sal_uInt16 ImplListBoxWindow::GetDisplayLineCount() const
{
- // FIXME: LISTBOX_ENTRY_FLAG_MULTILINE
+ // FIXME: ListBoxEntryFlags::MultiLine
sal_Int32 nCount = mpEntryList->GetEntryCount();
long nHeight = GetOutputSizePixel().Height();// - mnMaxHeight + mnBorder;
@@ -2050,7 +2050,7 @@ void ImplListBoxWindow::ScrollHorz( long n )
Size ImplListBoxWindow::CalcSize(sal_Int32 nMaxLines) const
{
- // FIXME: LISTBOX_ENTRY_FLAG_MULTILINE
+ // FIXME: ListBoxEntryFlags::MultiLine
Size aSz;
aSz.Height() = nMaxLines * mnMaxHeight;
@@ -2225,7 +2225,7 @@ void ImplListBox::RemoveEntry( sal_Int32 nPos )
StateChanged( StateChangedType::Data );
}
-void ImplListBox::SetEntryFlags( sal_Int32 nPos, long nFlags )
+void ImplListBox::SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags )
{
maLBWindow->SetEntryFlags( nPos, nFlags );
}
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 8db825e8880d..2c3566b89ade 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -1130,12 +1130,12 @@ void* ListBox::GetEntryData( sal_Int32 nPos ) const
return mpImplLB->GetEntryList()->GetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
}
-void ListBox::SetEntryFlags( sal_Int32 nPos, long nFlags )
+void ListBox::SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags )
{
mpImplLB->SetEntryFlags( nPos + mpImplLB->GetEntryList()->GetMRUCount(), nFlags );
}
-long ListBox::GetEntryFlags( sal_Int32 nPos ) const
+ListBoxEntryFlags ListBox::GetEntryFlags( sal_Int32 nPos ) const
{
return mpImplLB->GetEntryList()->GetEntryFlags( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
}
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index e121896f2d16..419f63675e28 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -1775,7 +1775,7 @@ void TabControl::EnablePage( sal_uInt16 i_nPageId, bool i_bEnable )
mbFormat = true;
if( mpTabCtrlData->mpListBox )
mpTabCtrlData->mpListBox->SetEntryFlags( GetPagePos( i_nPageId ),
- i_bEnable ? 0 : (LISTBOX_ENTRY_FLAG_DISABLE_SELECTION | LISTBOX_ENTRY_FLAG_DRAW_DISABLED) );
+ i_bEnable ? ListBoxEntryFlags::NONE : (ListBoxEntryFlags::DisableSelection | ListBoxEntryFlags::DrawDisabled) );
if( pItem->mnId == mnCurPageId )
{
// SetCurPageId will change to an enabled page