summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-08 15:28:27 +0200
committerNoel Grandin <noel@peralex.com>2015-03-11 10:16:55 +0200
commit3146851b6984dff768a88770785c5573ec7f6bbb (patch)
treef9d86a684576db57e6d2baae29687f01e8f644bd /sfx2/source
parentfc4b79f76cf030015c5fdc9609afc0482223d198 (diff)
convert CHILD_ constants to enum class
Change-Id: I1aca134fcc0384df4797cacafa9fbc1ed88d6617
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/workwin.cxx40
-rw-r--r--sfx2/source/dialog/splitwin.cxx12
-rw-r--r--sfx2/source/inc/workwin.hxx38
3 files changed, 49 insertions, 41 deletions
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 5af1678b5924..d27f2243d0a2 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -832,10 +832,10 @@ SvBorder SfxWorkWindow::Arrange_Impl()
continue;
// First, we assume that there is room for the window.
- pCli->nVisible |= CHILD_FITS_IN;
+ pCli->nVisible |= SfxChildVisibility::FITS_IN;
// Skip invisiable windows
- if (pCli->nVisible != CHILD_VISIBLE)
+ if (pCli->nVisible != SfxChildVisibility::VISIBLE)
continue;
if ( pCli->bResize )
@@ -918,7 +918,7 @@ SvBorder SfxWorkWindow::Arrange_Impl()
pCli->aSize = aSize;
if( bAllowHiding && !RequestTopToolSpacePixel_Impl( aBorder ) )
{
- pCli->nVisible ^= CHILD_FITS_IN;
+ pCli->nVisible ^= SfxChildVisibility::FITS_IN;
aBorder = aTemp;
}
}
@@ -1065,7 +1065,7 @@ void SfxWorkWindow::ShowChildren_Impl()
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;
switch ( pCli->pWin->GetType() )
@@ -1455,7 +1455,7 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
if ( !bAllChildrenVisible )
{
if ( pCW->pCli )
- pCW->pCli->nVisible &= ~CHILD_ACTIVE;
+ pCW->pCli->nVisible &= ~SfxChildVisibility::ACTIVE;
}
}
else if ( pChildWin )
@@ -1471,7 +1471,7 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
{
// The window is a direct Child
if ( bAllChildrenVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SFX_ALIGN_NOALIGNMENT ) )
- pCW->pCli->nVisible |= CHILD_NOT_HIDDEN;
+ pCW->pCli->nVisible |= SfxChildVisibility::NOT_HIDDEN;
}
else
{
@@ -1493,8 +1493,8 @@ void SfxWorkWindow::UpdateChildWindows_Impl()
{
if ( pCW->pCli )
{
- if ( pCW->pCli->nVisible & CHILD_NOT_HIDDEN )
- pCW->pCli->nVisible ^= CHILD_NOT_HIDDEN;
+ if ( pCW->pCli->nVisible & SfxChildVisibility::NOT_HIDDEN )
+ pCW->pCli->nVisible ^= SfxChildVisibility::NOT_HIDDEN;
}
else
static_cast<SfxDockingWindow*>(pChildWin->GetWindow())->Disappear_Impl();
@@ -1533,7 +1533,7 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, bool bSetFocus )
if ( aChildren[TbxMatch(nPos)] )// &&
{
// 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 )
// The window is not docked or docked outside of one split windows
// and must therefore be registered explicitly as a Child
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 )
- pCW->pCli->nVisible ^= CHILD_ACTIVE;
+ pCW->pCli->nVisible ^= SfxChildVisibility::ACTIVE;
pCW->pCli->bSetFocus = bSetFocus;
}
else
@@ -1667,13 +1667,13 @@ void SfxWorkWindow::HidePopups_Impl(bool bHide, bool bParent, sal_uInt16 nId )
SfxChild_Impl *pChild = FindChild_Impl(*pWin);
if (bHide)
{
- pChild->nVisible &= ~CHILD_ACTIVE;
+ pChild->nVisible &= ~SfxChildVisibility::ACTIVE;
pCW->Hide();
}
else
{
- pChild->nVisible |= CHILD_ACTIVE;
- if ( CHILD_VISIBLE == (pChild->nVisible & CHILD_VISIBLE) )
+ pChild->nVisible |= SfxChildVisibility::ACTIVE;
+ if ( SfxChildVisibility::VISIBLE == (pChild->nVisible & SfxChildVisibility::VISIBLE) )
pCW->Show( SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
}
}
@@ -1724,7 +1724,7 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild,
{
// DockingWindow was dragged out of a SplitWindow
pCW->pCli = RegisterChild_Impl(*pDockWin, pDockWin->GetAlignment(), pCW->pWin->CanGetFocus());
- pCW->pCli->nVisible = CHILD_VISIBLE;
+ pCW->pCli->nVisible = SfxChildVisibility::VISIBLE;
}
pWin = pDockWin;
@@ -1789,7 +1789,7 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild,
sal_uInt16 i=aSortedList[m];
SfxChild_Impl* pCli = aChildren[i];
- if ( pCli && pCli->nVisible == CHILD_VISIBLE && pCli->pWin )
+ if ( pCli && pCli->nVisible == SfxChildVisibility::VISIBLE && pCli->pWin )
{
switch ( pCli->eAlign )
{
@@ -2266,7 +2266,7 @@ void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16 nId, bool bVisible, bool bSe
if ( pCW->pCli )
{
pCW->pCli->bSetFocus = bSetFocus;
- pCW->pCli->nVisible = CHILD_VISIBLE;
+ pCW->pCli->nVisible = SfxChildVisibility::VISIBLE;
pChildWin->Show( bSetFocus && pChildWin->WantsFocus() ? 0 : SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
}
else
@@ -2277,7 +2277,7 @@ void SfxWorkWindow::ShowChildWindow_Impl(sal_uInt16 nId, bool bVisible, bool bSe
{
if ( pCW->pCli )
{
- pCW->pCli->nVisible = CHILD_VISIBLE ^ CHILD_NOT_HIDDEN;
+ pCW->pCli->nVisible = SfxChildVisibility::VISIBLE ^ SfxChildVisibility::NOT_HIDDEN;
pCW->pWin->Hide();
}
else
@@ -2515,7 +2515,7 @@ void SfxWorkWindow::MakeChildrenVisible_Impl( bool bVis )
{
SfxChild_Impl* pCli = aChildren[aSortedList[n]];
if ( (pCli->eAlign == SFX_ALIGN_NOALIGNMENT) || (IsDockingAllowed() && bInternalDockingAllowed) )
- pCli->nVisible |= CHILD_ACTIVE;
+ pCli->nVisible |= SfxChildVisibility::ACTIVE;
}
}
else
@@ -2525,7 +2525,7 @@ void SfxWorkWindow::MakeChildrenVisible_Impl( bool bVis )
for ( sal_uInt16 n=0; n<aSortedList.size(); ++n )
{
SfxChild_Impl* pCli = aChildren[aSortedList[n]];
- pCli->nVisible &= ~CHILD_ACTIVE;
+ pCli->nVisible &= ~SfxChildVisibility::ACTIVE;
}
}
}
diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index c58505a244b6..ca6f7be22812 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -731,7 +731,7 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock,
SetPinned_Impl( false );
pEmptyWin->Actualize();
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();
if ( bFadeIn )
FadeIn();
@@ -751,7 +751,7 @@ void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock,
OSL_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering real Splitwindow" );
}
#endif
- pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, true )->nVisible = CHILD_VISIBLE;
+ pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, true )->nVisible = SfxChildVisibility::VISIBLE;
pWorkWin->ArrangeChildren_Impl();
if ( bFadeIn )
FadeIn();
@@ -1105,7 +1105,7 @@ void SfxSplitWindow::SetPinned_Impl( bool bOn )
Hide();
pEmptyWin->Actualize();
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() );
@@ -1130,7 +1130,7 @@ void SfxSplitWindow::SetPinned_Impl( bool bOn )
pWorkWin->ReleaseChild_Impl( *pEmptyWin );
pEmptyWin->Hide();
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 )
pWorkWin->ReleaseChild_Impl( *pEmptyWin );
pEmptyWin->Hide();
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->ShowChildren_Impl();
}
@@ -1181,7 +1181,7 @@ void SfxSplitWindow::SetFadeIn_Impl( bool bOn )
Hide();
pEmptyWin->Actualize();
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->ShowChildren_Impl();
pWorkWin->ArrangeAutoHideWindows( this );
diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx
index 762a2ff002e4..1d5281746f2c 100644
--- a/sfx2/source/inc/workwin.hxx
+++ b/sfx2/source/inc/workwin.hxx
@@ -31,6 +31,7 @@
#include <rtl/ustring.hxx>
#include <osl/mutex.hxx>
+#include <o3tl/typed_flags_set.hxx>
#include <sfx2/sfx.hrc>
#include <sfx2/childwin.hxx>
@@ -49,7 +50,7 @@ struct SfxObjectBar_Impl
sal_uInt16 nMode; // special visibility flags
sal_uInt16 nPos;
sal_uInt16 nIndex;
- bool bDestroy;
+ bool bDestroy;
SfxInterface* pIFace;
SfxObjectBar_Impl() :
@@ -67,7 +68,7 @@ struct SfxObjectBar_Impl
struct SfxStatBar_Impl
{
- sal_uInt16 nId;
+ sal_uInt16 nId;
bool bOn;
bool bTemp;
@@ -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
{
- vcl::Window* pWin;
+ vcl::Window* pWin;
Size aSize;
SfxChildAlignment eAlign;
- sal_uInt16 nVisible;
+ SfxChildVisibility nVisible;
bool bResize;
bool bCanGetFocus;
bool bSetFocus;
@@ -101,20 +109,20 @@ struct SfxChild_Impl
pWin(&rChild), aSize(rSize), eAlign(eAlignment), bResize(false),
bCanGetFocus( false ), bSetFocus( false )
{
- nVisible = bIsVisible ? CHILD_VISIBLE : CHILD_NOT_VISIBLE;
+ nVisible = bIsVisible ? SfxChildVisibility::VISIBLE : SfxChildVisibility::NOT_VISIBLE;
}
};
struct SfxChildWin_Impl
{
- sal_uInt16 nSaveId; // the ChildWindow-Id
- sal_uInt16 nInterfaceId; // the current context
- sal_uInt16 nId; // current Id
+ sal_uInt16 nSaveId; // the ChildWindow-Id
+ sal_uInt16 nInterfaceId; // the current context
+ sal_uInt16 nId; // current Id
SfxChildWindow* pWin;
bool bCreate;
SfxChildWinInfo aInfo;
- SfxChild_Impl* pCli; // != 0 at direct Children
- sal_uInt16 nVisibility;
+ SfxChild_Impl* pCli; // != 0 at direct Children
+ sal_uInt16 nVisibility;
bool bEnable;
bool bDisabled;