Kaydet (Commit) 3e5a0161 authored tarafından Noel Grandin's avatar Noel Grandin

Convert BORDERWINDOW_STYLE to scoped enum

Change-Id: Idbd538c69ebb40a319decc1e3a9cf06c99eb6423
üst 28d200d4
...@@ -29,11 +29,17 @@ ...@@ -29,11 +29,17 @@
class ImplBorderWindowView; class ImplBorderWindowView;
enum class DrawButtonFlags; enum class DrawButtonFlags;
#define BORDERWINDOW_STYLE_OVERLAP ((sal_uInt16)0x0001) enum class BorderWindowStyle {
#define BORDERWINDOW_STYLE_BORDER ((sal_uInt16)0x0002) NONE = 0x0000,
#define BORDERWINDOW_STYLE_FLOAT ((sal_uInt16)0x0004) Overlap = 0x0001,
#define BORDERWINDOW_STYLE_FRAME ((sal_uInt16)0x0008) Border = 0x0002,
#define BORDERWINDOW_STYLE_APP ((sal_uInt16)0x0010) Float = 0x0004,
Frame = 0x0008,
App = 0x0010
};
namespace o3tl {
template<> struct typed_flags<BorderWindowStyle> : is_typed_flags<BorderWindowStyle, 0x001f> {};
};
enum class BorderWindowHitTest { enum class BorderWindowHitTest {
NONE = 0x0000, NONE = 0x0000,
...@@ -118,10 +124,10 @@ private: ...@@ -118,10 +124,10 @@ private:
using Window::ImplInit; using Window::ImplInit;
void ImplInit( vcl::Window* pParent, void ImplInit( vcl::Window* pParent,
WinBits nStyle, sal_uInt16 nTypeStyle, WinBits nStyle, BorderWindowStyle nTypeStyle,
SystemParentData* pParentData ); SystemParentData* pParentData );
void ImplInit( vcl::Window* pParent, void ImplInit( vcl::Window* pParent,
WinBits nStyle, sal_uInt16 nTypeStyle, WinBits nStyle, BorderWindowStyle nTypeStyle,
const css::uno::Any& ); const css::uno::Any& );
ImplBorderWindow (const ImplBorderWindow &) = delete; ImplBorderWindow (const ImplBorderWindow &) = delete;
...@@ -131,9 +137,9 @@ public: ...@@ -131,9 +137,9 @@ public:
ImplBorderWindow( vcl::Window* pParent, ImplBorderWindow( vcl::Window* pParent,
SystemParentData* pParentData, SystemParentData* pParentData,
WinBits nStyle = 0, WinBits nStyle = 0,
sal_uInt16 nTypeStyle = 0 ); BorderWindowStyle nTypeStyle = BorderWindowStyle::NONE );
ImplBorderWindow( vcl::Window* pParent, WinBits nStyle = 0, ImplBorderWindow( vcl::Window* pParent, WinBits nStyle = 0,
sal_uInt16 nTypeStyle = 0 ); BorderWindowStyle nTypeStyle = BorderWindowStyle::NONE );
virtual ~ImplBorderWindow(); virtual ~ImplBorderWindow();
virtual void dispose() override; virtual void dispose() override;
......
...@@ -1723,27 +1723,27 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, Bor ...@@ -1723,27 +1723,27 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, Bor
} }
void ImplBorderWindow::ImplInit( vcl::Window* pParent, void ImplBorderWindow::ImplInit( vcl::Window* pParent,
WinBits nStyle, sal_uInt16 nTypeStyle, WinBits nStyle, BorderWindowStyle nTypeStyle,
const css::uno::Any& ) const css::uno::Any& )
{ {
ImplInit( pParent, nStyle, nTypeStyle, nullptr ); ImplInit( pParent, nStyle, nTypeStyle, nullptr );
} }
void ImplBorderWindow::ImplInit( vcl::Window* pParent, void ImplBorderWindow::ImplInit( vcl::Window* pParent,
WinBits nStyle, sal_uInt16 nTypeStyle, WinBits nStyle, BorderWindowStyle nTypeStyle,
SystemParentData* pSystemParentData SystemParentData* pSystemParentData
) )
{ {
// remove all unwanted WindowBits // remove all unwanted WindowBits
WinBits nOrgStyle = nStyle; WinBits nOrgStyle = nStyle;
WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_PINABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_SYSTEMFLOATWIN | WB_INTROWIN | WB_DEFAULTWIN | WB_TOOLTIPWIN | WB_NOSHADOW | WB_OWNERDRAWDECORATION | WB_SYSTEMCHILDWINDOW | WB_POPUP); WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_PINABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_SYSTEMFLOATWIN | WB_INTROWIN | WB_DEFAULTWIN | WB_TOOLTIPWIN | WB_NOSHADOW | WB_OWNERDRAWDECORATION | WB_SYSTEMCHILDWINDOW | WB_POPUP);
if ( nTypeStyle & BORDERWINDOW_STYLE_APP ) if ( nTypeStyle & BorderWindowStyle::App )
nTestStyle |= WB_APP; nTestStyle |= WB_APP;
nStyle &= nTestStyle; nStyle &= nTestStyle;
mpWindowImpl->mbBorderWin = true; mpWindowImpl->mbBorderWin = true;
mbSmallOutBorder = false; mbSmallOutBorder = false;
if ( nTypeStyle & BORDERWINDOW_STYLE_FRAME ) if ( nTypeStyle & BorderWindowStyle::Frame )
{ {
if( (nStyle & WB_SYSTEMCHILDWINDOW) ) if( (nStyle & WB_SYSTEMCHILDWINDOW) )
{ {
...@@ -1767,7 +1767,7 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent, ...@@ -1767,7 +1767,7 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent,
mbSmallOutBorder = true; mbSmallOutBorder = true;
} }
} }
else if ( nTypeStyle & BORDERWINDOW_STYLE_OVERLAP ) else if ( nTypeStyle & BorderWindowStyle::Overlap )
{ {
mpWindowImpl->mbOverlapWin = true; mpWindowImpl->mbOverlapWin = true;
mbFrameBorder = true; mbFrameBorder = true;
...@@ -1775,7 +1775,7 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent, ...@@ -1775,7 +1775,7 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent,
else else
mbFrameBorder = false; mbFrameBorder = false;
if ( nTypeStyle & BORDERWINDOW_STYLE_FLOAT ) if ( nTypeStyle & BorderWindowStyle::Float )
mbFloatWindow = true; mbFloatWindow = true;
else else
mbFloatWindow = false; mbFloatWindow = false;
...@@ -1799,7 +1799,7 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent, ...@@ -1799,7 +1799,7 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent,
mbHideBtn = false; mbHideBtn = false;
mbDisplayActive = IsActive(); mbDisplayActive = IsActive();
if ( nTypeStyle & BORDERWINDOW_STYLE_FLOAT ) if ( nTypeStyle & BorderWindowStyle::Float )
mnTitleType = BorderWindowTitleType::Small; mnTitleType = BorderWindowTitleType::Small;
else else
mnTitleType = BorderWindowTitleType::Normal; mnTitleType = BorderWindowTitleType::Normal;
...@@ -1809,14 +1809,14 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent, ...@@ -1809,14 +1809,14 @@ void ImplBorderWindow::ImplInit( vcl::Window* pParent,
ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent, ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent,
SystemParentData* pSystemParentData, SystemParentData* pSystemParentData,
WinBits nStyle, sal_uInt16 nTypeStyle WinBits nStyle, BorderWindowStyle nTypeStyle
) : Window( WINDOW_BORDERWINDOW ) ) : Window( WINDOW_BORDERWINDOW )
{ {
ImplInit( pParent, nStyle, nTypeStyle, pSystemParentData ); ImplInit( pParent, nStyle, nTypeStyle, pSystemParentData );
} }
ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent, WinBits nStyle , ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent, WinBits nStyle ,
sal_uInt16 nTypeStyle ) : BorderWindowStyle nTypeStyle ) :
Window( WINDOW_BORDERWINDOW ) Window( WINDOW_BORDERWINDOW )
{ {
ImplInit( pParent, nStyle, nTypeStyle, css::uno::Any() ); ImplInit( pParent, nStyle, nTypeStyle, css::uno::Any() );
......
...@@ -413,7 +413,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag ) ...@@ -413,7 +413,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag )
// create window with a small border ? // create window with a small border ?
if ( (nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER ) if ( (nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER )
{ {
VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BORDERWINDOW_STYLE_FRAME ); VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BorderWindowStyle::Frame );
SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, nullptr ); SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, nullptr );
pBorderWin->mpWindowImpl->mpClientWindow = this; pBorderWin->mpWindowImpl->mpClientWindow = this;
pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
...@@ -431,7 +431,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag ) ...@@ -431,7 +431,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag )
} }
else else
{ {
VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BORDERWINDOW_STYLE_OVERLAP | BORDERWINDOW_STYLE_BORDER ); VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BorderWindowStyle::Overlap | BorderWindowStyle::Border );
SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, nullptr ); SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, nullptr );
pBorderWin->mpWindowImpl->mpClientWindow = this; pBorderWin->mpWindowImpl->mpClientWindow = this;
pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
...@@ -1112,7 +1112,7 @@ void Dialog::GrabFocusToFirstControl() ...@@ -1112,7 +1112,7 @@ void Dialog::GrabFocusToFirstControl()
void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
{ {
ScopedVclPtrInstance<ImplBorderWindow> aImplWin( static_cast<vcl::Window*>(const_cast<Dialog *>(this)), WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP ); ScopedVclPtrInstance<ImplBorderWindow> aImplWin( static_cast<vcl::Window*>(const_cast<Dialog *>(this)), WB_BORDER|WB_STDWORK, BorderWindowStyle::Overlap );
aImplWin->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder ); aImplWin->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder );
} }
...@@ -1139,7 +1139,7 @@ void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, Dra ...@@ -1139,7 +1139,7 @@ void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, Dra
if (!( GetStyle() & WB_NOBORDER )) if (!( GetStyle() & WB_NOBORDER ))
{ {
ScopedVclPtrInstance< ImplBorderWindow > aImplWin( this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP ); ScopedVclPtrInstance< ImplBorderWindow > aImplWin( this, WB_BORDER|WB_STDWORK, BorderWindowStyle::Overlap );
aImplWin->SetText( GetText() ); aImplWin->SetText( GetText() );
aImplWin->setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() ); aImplWin->setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
aImplWin->SetDisplayActive( true ); aImplWin->SetDisplayActive( true );
......
...@@ -97,16 +97,16 @@ void FloatingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -97,16 +97,16 @@ void FloatingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle )
else else
{ {
VclPtr<ImplBorderWindow> pBorderWin; VclPtr<ImplBorderWindow> pBorderWin;
sal_uInt16 nBorderStyle = BORDERWINDOW_STYLE_BORDER | BORDERWINDOW_STYLE_FLOAT; BorderWindowStyle nBorderStyle = BorderWindowStyle::Border | BorderWindowStyle::Float;
if (nStyle & WB_OWNERDRAWDECORATION) if (nStyle & WB_OWNERDRAWDECORATION)
nBorderStyle |= BORDERWINDOW_STYLE_FRAME; nBorderStyle |= BorderWindowStyle::Frame;
else else
nBorderStyle |= BORDERWINDOW_STYLE_OVERLAP; nBorderStyle |= BorderWindowStyle::Overlap;
if ((nStyle & WB_SYSTEMWINDOW) && !(nStyle & (WB_MOVEABLE | WB_SIZEABLE))) if ((nStyle & WB_SYSTEMWINDOW) && !(nStyle & (WB_MOVEABLE | WB_SIZEABLE)))
{ {
nBorderStyle |= BORDERWINDOW_STYLE_FRAME; nBorderStyle |= BorderWindowStyle::Frame;
nStyle |= WB_CLOSEABLE; // make undecorated floaters closeable nStyle |= WB_CLOSEABLE; // make undecorated floaters closeable
} }
pBorderWin = VclPtr<ImplBorderWindow>::Create(pParent, nStyle, nBorderStyle); pBorderWin = VclPtr<ImplBorderWindow>::Create(pParent, nStyle, nBorderStyle);
......
...@@ -903,14 +903,14 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p ...@@ -903,14 +903,14 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p
if ( !mpWindowImpl->mbFrame && !mpWindowImpl->mbBorderWin && !mpWindowImpl->mpBorderWindow if ( !mpWindowImpl->mbFrame && !mpWindowImpl->mbBorderWin && !mpWindowImpl->mpBorderWindow
&& (nStyle & (WB_BORDER | WB_SYSTEMCHILDWINDOW) ) ) && (nStyle & (WB_BORDER | WB_SYSTEMCHILDWINDOW) ) )
{ {
sal_uInt16 nBorderTypeStyle = 0; BorderWindowStyle nBorderTypeStyle = BorderWindowStyle::NONE;
if( (nStyle & WB_SYSTEMCHILDWINDOW) ) if( (nStyle & WB_SYSTEMCHILDWINDOW) )
{ {
// handle WB_SYSTEMCHILDWINDOW // handle WB_SYSTEMCHILDWINDOW
// these should be analogous to a top level frame; meaning they // these should be analogous to a top level frame; meaning they
// should have a border window with style BORDERWINDOW_STYLE_FRAME // should have a border window with style BorderWindowStyle::Frame
// which controls their size // which controls their size
nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME; nBorderTypeStyle |= BorderWindowStyle::Frame;
nStyle |= WB_BORDER; nStyle |= WB_BORDER;
} }
VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL), nBorderTypeStyle ); VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL), nBorderTypeStyle );
......
...@@ -45,9 +45,9 @@ void WorkWindow::ImplInitWorkWindowData() ...@@ -45,9 +45,9 @@ void WorkWindow::ImplInitWorkWindowData()
void WorkWindow::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData ) void WorkWindow::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData )
{ {
sal_uInt16 nFrameStyle = BORDERWINDOW_STYLE_FRAME; BorderWindowStyle nFrameStyle = BorderWindowStyle::Frame;
if ( nStyle & WB_APP ) if ( nStyle & WB_APP )
nFrameStyle |= BORDERWINDOW_STYLE_APP; nFrameStyle |= BorderWindowStyle::App;
VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, pSystemParentData, nStyle, nFrameStyle ); VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, pSystemParentData, nStyle, nFrameStyle );
Window::ImplInit( pBorderWin, nStyle & (WB_3DLOOK | WB_CLIPCHILDREN | WB_DIALOGCONTROL | WB_SYSTEMFLOATWIN), nullptr ); Window::ImplInit( pBorderWin, nStyle & (WB_3DLOOK | WB_CLIPCHILDREN | WB_DIALOGCONTROL | WB_SYSTEMFLOATWIN), nullptr );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment