Kaydet (Commit) 3146851b authored tarafından Noel Grandin's avatar Noel Grandin

convert CHILD_ constants to enum class

Change-Id: I1aca134fcc0384df4797cacafa9fbc1ed88d6617
üst fc4b79f7
...@@ -245,6 +245,23 @@ inline typename o3tl::typed_flags<E>::Self operator |=( ...@@ -245,6 +245,23 @@ inline typename o3tl::typed_flags<E>::Self operator |=(
return lhs; return lhs;
} }
template<typename E>
inline typename o3tl::typed_flags<E>::Self operator ^=(E & lhs, E rhs) {
assert(static_cast<typename o3tl::underlying_type<E>::type>(lhs) >= 0);
assert(static_cast<typename o3tl::underlying_type<E>::type>(rhs) >= 0);
lhs = lhs ^ rhs;
return lhs;
}
template<typename E>
inline typename o3tl::typed_flags<E>::Self operator ^=(
E & lhs, typename o3tl::typed_flags<E>::Wrap rhs)
{
assert(static_cast<typename o3tl::underlying_type<E>::type>(lhs) >= 0);
lhs = lhs ^ rhs;
return lhs;
}
#endif /* INCLUDED_O3TL_TYPED_FLAGS_SET_HXX */ #endif /* INCLUDED_O3TL_TYPED_FLAGS_SET_HXX */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -832,10 +832,10 @@ SvBorder SfxWorkWindow::Arrange_Impl() ...@@ -832,10 +832,10 @@ SvBorder SfxWorkWindow::Arrange_Impl()
continue; continue;
// First, we assume that there is room for the window. // First, we assume that there is room for the window.
pCli->nVisible |= CHILD_FITS_IN; pCli->nVisible |= SfxChildVisibility::FITS_IN;
// Skip invisiable windows // Skip invisiable windows
if (pCli->nVisible != CHILD_VISIBLE) if (pCli->nVisible != SfxChildVisibility::VISIBLE)
continue; continue;
if ( pCli->bResize ) if ( pCli->bResize )
...@@ -918,7 +918,7 @@ SvBorder SfxWorkWindow::Arrange_Impl() ...@@ -918,7 +918,7 @@ SvBorder SfxWorkWindow::Arrange_Impl()
pCli->aSize = aSize; pCli->aSize = aSize;
if( bAllowHiding && !RequestTopToolSpacePixel_Impl( aBorder ) ) if( bAllowHiding && !RequestTopToolSpacePixel_Impl( aBorder ) )
{ {
pCli->nVisible ^= CHILD_FITS_IN; pCli->nVisible ^= SfxChildVisibility::FITS_IN;
aBorder = aTemp; aBorder = aTemp;
} }
} }
...@@ -1065,7 +1065,7 @@ void SfxWorkWindow::ShowChildren_Impl() ...@@ -1065,7 +1065,7 @@ void SfxWorkWindow::ShowChildren_Impl()
bVisible = !bInvisible || ( nFlags & SfxChildWindowFlags::NEVERHIDE ); bVisible = !bInvisible || ( nFlags & SfxChildWindowFlags::NEVERHIDE );
} }
if ( CHILD_VISIBLE == (pCli->nVisible & CHILD_VISIBLE) && bVisible ) if ( SfxChildVisibility::VISIBLE == (pCli->nVisible & SfxChildVisibility::VISIBLE) && bVisible )
{ {
sal_uInt16 nFlags = pCli->bSetFocus ? 0 : SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE; sal_uInt16 nFlags = pCli->bSetFocus ? 0 : SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE;
switch ( pCli->pWin->GetType() ) switch ( pCli->pWin->GetType() )
...@@ -1455,7 +1455,7 @@ void SfxWorkWindow::UpdateChildWindows_Impl() ...@@ -1455,7 +1455,7 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
if ( !bAllChildrenVisible ) if ( !bAllChildrenVisible )
{ {
if ( pCW->pCli ) if ( pCW->pCli )
pCW->pCli->nVisible &= ~CHILD_ACTIVE; pCW->pCli->nVisible &= ~SfxChildVisibility::ACTIVE;
} }
} }
else if ( pChildWin ) else if ( pChildWin )
...@@ -1471,7 +1471,7 @@ void SfxWorkWindow::UpdateChildWindows_Impl() ...@@ -1471,7 +1471,7 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
{ {
// The window is a direct Child // The window is a direct Child
if ( bAllChildrenVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) ) if ( bAllChildrenVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) )
pCW->pCli->nVisible |= CHILD_NOT_HIDDEN; pCW->pCli->nVisible |= SfxChildVisibility::NOT_HIDDEN;
} }
else else
{ {
...@@ -1493,8 +1493,8 @@ void SfxWorkWindow::UpdateChildWindows_Impl() ...@@ -1493,8 +1493,8 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
{ {
if ( pCW->pCli ) if ( pCW->pCli )
{ {
if ( pCW->pCli->nVisible & CHILD_NOT_HIDDEN ) if ( pCW->pCli->nVisible & SfxChildVisibility::NOT_HIDDEN )
pCW->pCli->nVisible ^= CHILD_NOT_HIDDEN; pCW->pCli->nVisible ^= SfxChildVisibility::NOT_HIDDEN;
} }
else else
static_cast<SfxDockingWindow*>(pChildWin->GetWindow())->Disappear_Impl(); static_cast<SfxDockingWindow*>(pChildWin->GetWindow())->Disappear_Impl();
...@@ -1533,7 +1533,7 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, bool bSetFocus ) ...@@ -1533,7 +1533,7 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, bool bSetFocus )
if ( aChildren[TbxMatch(nPos)] )// && if ( aChildren[TbxMatch(nPos)] )// &&
{ {
// ChildWindow replaces ObjectBar // ChildWindow replaces ObjectBar
aChildren[TbxMatch(nPos)]->nVisible ^= CHILD_NOT_HIDDEN; aChildren[TbxMatch(nPos)]->nVisible ^= SfxChildVisibility::NOT_HIDDEN;
} }
} }
...@@ -1547,9 +1547,9 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, bool bSetFocus ) ...@@ -1547,9 +1547,9 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, bool bSetFocus )
// The window is not docked or docked outside of one split windows // The window is not docked or docked outside of one split windows
// and must therefore be registered explicitly as a Child // and must therefore be registered explicitly as a Child
pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment(), pChildWin->CanGetFocus()); pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment(), pChildWin->CanGetFocus());
pCW->pCli->nVisible = CHILD_VISIBLE; pCW->pCli->nVisible = SfxChildVisibility::VISIBLE;
if ( pChildWin->GetAlignment() != SFX_ALIGN_NOALIGNMENT && bIsFullScreen ) if ( pChildWin->GetAlignment() != SFX_ALIGN_NOALIGNMENT && bIsFullScreen )
pCW->pCli->nVisible ^= CHILD_ACTIVE; pCW->pCli->nVisible ^= SfxChildVisibility::ACTIVE;
pCW->pCli->bSetFocus = bSetFocus; pCW->pCli->bSetFocus = bSetFocus;
} }
else else
...@@ -1667,13 +1667,13 @@ void SfxWorkWindow::HidePopups_Impl(bool bHide, bool bParent, sal_uInt16 nId ) ...@@ -1667,13 +1667,13 @@ void SfxWorkWindow::HidePopups_Impl(bool bHide, bool bParent, sal_uInt16 nId )
SfxChild_Impl *pChild = FindChild_Impl(*pWin); SfxChild_Impl *pChild = FindChild_Impl(*pWin);
if (bHide) if (bHide)
{ {
pChild->nVisible &= ~CHILD_ACTIVE; pChild->nVisible &= ~SfxChildVisibility::ACTIVE;
pCW->Hide(); pCW->Hide();
} }
else else
{ {
pChild->nVisible |= CHILD_ACTIVE; pChild->nVisible |= SfxChildVisibility::ACTIVE;
if ( CHILD_VISIBLE == (pChild->nVisible & CHILD_VISIBLE) ) if ( SfxChildVisibility::VISIBLE == (pChild->nVisible & SfxChildVisibility::VISIBLE) )
pCW->Show( SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); pCW->Show( SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
} }
} }
...@@ -1724,7 +1724,7 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild, ...@@ -1724,7 +1724,7 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild,
{ {
// DockingWindow was dragged out of a SplitWindow // DockingWindow was dragged out of a SplitWindow
pCW->pCli = RegisterChild_Impl(*pDockWin, pDockWin->GetAlignment(), pCW->pWin->CanGetFocus()); pCW->pCli = RegisterChild_Impl(*pDockWin, pDockWin->GetAlignment(), pCW->pWin->CanGetFocus());
pCW->pCli->nVisible = CHILD_VISIBLE; pCW->pCli->nVisible = SfxChildVisibility::VISIBLE;
} }
pWin = pDockWin; pWin = pDockWin;
...@@ -1789,7 +1789,7 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild, ...@@ -1789,7 +1789,7 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild,
sal_uInt16 i=aSortedList[m]; sal_uInt16 i=aSortedList[m];
SfxChild_Impl* pCli = aChildren[i]; SfxChild_Impl* pCli = aChildren[i];
if ( pCli && pCli->nVisible == CHILD_VISIBLE && pCli->pWin ) if ( pCli && pCli->nVisible == SfxChildVisibility::VISIBLE && pCli->pWin )
{ {
switch ( pCli->eAlign ) switch ( pCli->eAlign )
{ {
...@@ -2266,7 +2266,7 @@ void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16 nId, bool bVisible, bool bSe ...@@ -2266,7 +2266,7 @@ void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16 nId, bool bVisible, bool bSe
if ( pCW->pCli ) if ( pCW->pCli )
{ {
pCW->pCli->bSetFocus = bSetFocus; pCW->pCli->bSetFocus = bSetFocus;
pCW->pCli->nVisible = CHILD_VISIBLE; pCW->pCli->nVisible = SfxChildVisibility::VISIBLE;
pChildWin->Show( bSetFocus && pChildWin->WantsFocus() ? 0 : SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); pChildWin->Show( bSetFocus && pChildWin->WantsFocus() ? 0 : SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
} }
else else
...@@ -2277,7 +2277,7 @@ void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16 nId, bool bVisible, bool bSe ...@@ -2277,7 +2277,7 @@ void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16 nId, bool bVisible, bool bSe
{ {
if ( pCW->pCli ) if ( pCW->pCli )
{ {
pCW->pCli->nVisible = CHILD_VISIBLE ^ CHILD_NOT_HIDDEN; pCW->pCli->nVisible = SfxChildVisibility::VISIBLE ^ SfxChildVisibility::NOT_HIDDEN;
pCW->pWin->Hide(); pCW->pWin->Hide();
} }
else else
...@@ -2515,7 +2515,7 @@ void SfxWorkWindow::MakeChildrenVisible_Impl( bool bVis ) ...@@ -2515,7 +2515,7 @@ void SfxWorkWindow::MakeChildrenVisible_Impl( bool bVis )
{ {
SfxChild_Impl* pCli = aChildren[aSortedList[n]]; SfxChild_Impl* pCli = aChildren[aSortedList[n]];
if ( (pCli->eAlign == SFX_ALIGN_NOALIGNMENT) || (IsDockingAllowed() && bInternalDockingAllowed) ) if ( (pCli->eAlign == SFX_ALIGN_NOALIGNMENT) || (IsDockingAllowed() && bInternalDockingAllowed) )
pCli->nVisible |= CHILD_ACTIVE; pCli->nVisible |= SfxChildVisibility::ACTIVE;
} }
} }
else else
...@@ -2525,7 +2525,7 @@ void SfxWorkWindow::MakeChildrenVisible_Impl( bool bVis ) ...@@ -2525,7 +2525,7 @@ void SfxWorkWindow::MakeChildrenVisible_Impl( bool bVis )
for ( sal_uInt16 n=0; n<aSortedList.size(); ++n ) for ( sal_uInt16 n=0; n<aSortedList.size(); ++n )
{ {
SfxChild_Impl* pCli = aChildren[aSortedList[n]]; SfxChild_Impl* pCli = aChildren[aSortedList[n]];
pCli->nVisible &= ~CHILD_ACTIVE; pCli->nVisible &= ~SfxChildVisibility::ACTIVE;
} }
} }
} }
......
...@@ -731,7 +731,7 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock, ...@@ -731,7 +731,7 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock,
SetPinned_Impl( false ); SetPinned_Impl( false );
pEmptyWin->Actualize(); pEmptyWin->Actualize();
OSL_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" ); OSL_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" );
pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, true )->nVisible = CHILD_VISIBLE; pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, true )->nVisible = SfxChildVisibility::VISIBLE;
pWorkWin->ArrangeChildren_Impl(); pWorkWin->ArrangeChildren_Impl();
if ( bFadeIn ) if ( bFadeIn )
FadeIn(); FadeIn();
...@@ -751,7 +751,7 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock, ...@@ -751,7 +751,7 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock,
OSL_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering real Splitwindow" ); OSL_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering real Splitwindow" );
} }
#endif #endif
pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, true )->nVisible = CHILD_VISIBLE; pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, true )->nVisible = SfxChildVisibility::VISIBLE;
pWorkWin->ArrangeChildren_Impl(); pWorkWin->ArrangeChildren_Impl();
if ( bFadeIn ) if ( bFadeIn )
FadeIn(); FadeIn();
...@@ -1105,7 +1105,7 @@ void SfxSplitWindow::SetPinned_Impl( bool bOn ) ...@@ -1105,7 +1105,7 @@ void SfxSplitWindow::SetPinned_Impl( bool bOn )
Hide(); Hide();
pEmptyWin->Actualize(); pEmptyWin->Actualize();
OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - registering empty Splitwindow" ); OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - registering empty Splitwindow" );
pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, true )->nVisible = CHILD_VISIBLE; pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, true )->nVisible = SfxChildVisibility::VISIBLE;
} }
Point aPos( GetPosPixel() ); Point aPos( GetPosPixel() );
...@@ -1130,7 +1130,7 @@ void SfxSplitWindow::SetPinned_Impl( bool bOn ) ...@@ -1130,7 +1130,7 @@ void SfxSplitWindow::SetPinned_Impl( bool bOn )
pWorkWin->ReleaseChild_Impl( *pEmptyWin ); pWorkWin->ReleaseChild_Impl( *pEmptyWin );
pEmptyWin->Hide(); pEmptyWin->Hide();
OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - registering real Splitwindow" ); OSL_TRACE( "SfxSplitWindow::SetPinned_Impl - registering real Splitwindow" );
pWorkWin->RegisterChild_Impl( *this, eAlign, true )->nVisible = CHILD_VISIBLE; pWorkWin->RegisterChild_Impl( *this, eAlign, true )->nVisible = SfxChildVisibility::VISIBLE;
} }
} }
...@@ -1164,7 +1164,7 @@ void SfxSplitWindow::SetFadeIn_Impl( bool bOn ) ...@@ -1164,7 +1164,7 @@ void SfxSplitWindow::SetFadeIn_Impl( bool bOn )
pWorkWin->ReleaseChild_Impl( *pEmptyWin ); pWorkWin->ReleaseChild_Impl( *pEmptyWin );
pEmptyWin->Hide(); pEmptyWin->Hide();
OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering real Splitwindow" ); OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering real Splitwindow" );
pWorkWin->RegisterChild_Impl( *this, eAlign, true )->nVisible = CHILD_VISIBLE; pWorkWin->RegisterChild_Impl( *this, eAlign, true )->nVisible = SfxChildVisibility::VISIBLE;
pWorkWin->ArrangeChildren_Impl(); pWorkWin->ArrangeChildren_Impl();
pWorkWin->ShowChildren_Impl(); pWorkWin->ShowChildren_Impl();
} }
...@@ -1181,7 +1181,7 @@ void SfxSplitWindow::SetFadeIn_Impl( bool bOn ) ...@@ -1181,7 +1181,7 @@ void SfxSplitWindow::SetFadeIn_Impl( bool bOn )
Hide(); Hide();
pEmptyWin->Actualize(); pEmptyWin->Actualize();
OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering empty Splitwindow" ); OSL_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering empty Splitwindow" );
pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, true )->nVisible = CHILD_VISIBLE; pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, true )->nVisible = SfxChildVisibility::VISIBLE;
pWorkWin->ArrangeChildren_Impl(); pWorkWin->ArrangeChildren_Impl();
pWorkWin->ShowChildren_Impl(); pWorkWin->ShowChildren_Impl();
pWorkWin->ArrangeAutoHideWindows( this ); pWorkWin->ArrangeAutoHideWindows( this );
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <sfx2/sfx.hrc> #include <sfx2/sfx.hrc>
#include <sfx2/childwin.hxx> #include <sfx2/childwin.hxx>
...@@ -49,7 +50,7 @@ struct SfxObjectBar_Impl ...@@ -49,7 +50,7 @@ struct SfxObjectBar_Impl
sal_uInt16 nMode; // special visibility flags sal_uInt16 nMode; // special visibility flags
sal_uInt16 nPos; sal_uInt16 nPos;
sal_uInt16 nIndex; sal_uInt16 nIndex;
bool bDestroy; bool bDestroy;
SfxInterface* pIFace; SfxInterface* pIFace;
SfxObjectBar_Impl() : SfxObjectBar_Impl() :
...@@ -67,7 +68,7 @@ struct SfxObjectBar_Impl ...@@ -67,7 +68,7 @@ struct SfxObjectBar_Impl
struct SfxStatBar_Impl struct SfxStatBar_Impl
{ {
sal_uInt16 nId; sal_uInt16 nId;
bool bOn; bool bOn;
bool bTemp; bool bTemp;
...@@ -79,19 +80,26 @@ struct SfxStatBar_Impl ...@@ -79,19 +80,26 @@ struct SfxStatBar_Impl
}; };
enum class SfxChildVisibility
{
NOT_VISIBLE = 0,
ACTIVE = 1, // not disabled through HidePopups
NOT_HIDDEN = 2, // not disabled through HideChildWindow
FITS_IN = 4, // not too large for output size of the parent
VISIBLE = 7, // NOT_HIDDEN | ACTIVE | FITS_IN)
};
namespace o3tl
{
template<> struct typed_flags<SfxChildVisibility> : is_typed_flags<SfxChildVisibility, 0x07> {};
}
#define CHILD_NOT_VISIBLE 0
#define CHILD_ACTIVE 1 // not disabled through HidePopups
#define CHILD_NOT_HIDDEN 2 // not disabled through HideChildWindow
#define CHILD_FITS_IN 4 // not too large for output size of the parent
#define CHILD_VISIBLE (CHILD_NOT_HIDDEN | CHILD_ACTIVE | CHILD_FITS_IN)
struct SfxChild_Impl struct SfxChild_Impl
{ {
vcl::Window* pWin; vcl::Window* pWin;
Size aSize; Size aSize;
SfxChildAlignment eAlign; SfxChildAlignment eAlign;
sal_uInt16 nVisible; SfxChildVisibility nVisible;
bool bResize; bool bResize;
bool bCanGetFocus; bool bCanGetFocus;
bool bSetFocus; bool bSetFocus;
...@@ -101,20 +109,20 @@ struct SfxChild_Impl ...@@ -101,20 +109,20 @@ struct SfxChild_Impl
pWin(&rChild), aSize(rSize), eAlign(eAlignment), bResize(false), pWin(&rChild), aSize(rSize), eAlign(eAlignment), bResize(false),
bCanGetFocus( false ), bSetFocus( false ) bCanGetFocus( false ), bSetFocus( false )
{ {
nVisible = bIsVisible ? CHILD_VISIBLE : CHILD_NOT_VISIBLE; nVisible = bIsVisible ? SfxChildVisibility::VISIBLE : SfxChildVisibility::NOT_VISIBLE;
} }
}; };
struct SfxChildWin_Impl struct SfxChildWin_Impl
{ {
sal_uInt16 nSaveId; // the ChildWindow-Id sal_uInt16 nSaveId; // the ChildWindow-Id
sal_uInt16 nInterfaceId; // the current context sal_uInt16 nInterfaceId; // the current context
sal_uInt16 nId; // current Id sal_uInt16 nId; // current Id
SfxChildWindow* pWin; SfxChildWindow* pWin;
bool bCreate; bool bCreate;
SfxChildWinInfo aInfo; SfxChildWinInfo aInfo;
SfxChild_Impl* pCli; // != 0 at direct Children SfxChild_Impl* pCli; // != 0 at direct Children
sal_uInt16 nVisibility; sal_uInt16 nVisibility;
bool bEnable; bool bEnable;
bool bDisabled; bool bDisabled;
......
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