diff options
32 files changed, 186 insertions, 175 deletions
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 6a69e92d456b..2f14dafd7566 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -1217,7 +1217,7 @@ namespace pcr ::Rectangle aRect(aMePos,aSize); aSize.Height() = STD_HEIGHT; m_pFloatingEdit->SetOutputSizePixel(aSize); - m_pFloatingEdit->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN ); + m_pFloatingEdit->StartPopupMode( aRect, FloatWinPopupFlags::Down ); m_pFloatingEdit->Show(); m_pFloatingEdit->getEdit().GrabFocus(); diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx index a1617d111ae2..9965ebdeda8f 100644 --- a/include/vcl/dockwin.hxx +++ b/include/vcl/dockwin.hxx @@ -143,7 +143,7 @@ public: void Unlock(); bool IsLocked() const { return mbLocked;} - void StartPopupMode( ToolBox* pParentToolBox, sal_uLong nPopupModeFlags ); + void StartPopupMode( ToolBox* pParentToolBox, FloatWinPopupFlags nPopupModeFlags ); bool IsInPopupMode() const; void TitleButtonClick( sal_uInt16 nButton ); @@ -202,7 +202,7 @@ public: bool IsLocked( const vcl::Window *pWin ); void StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWin ); - void StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWin, sal_uLong nPopupModeFlags ); + void StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWin, FloatWinPopupFlags nPopupModeFlags ); bool IsInPopupMode( const vcl::Window *pWin ); void EndPopupMode( const vcl::Window *pWin ); diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx index fb542ddffb06..d02b191aa279 100644 --- a/include/vcl/floatwin.hxx +++ b/include/vcl/floatwin.hxx @@ -23,6 +23,7 @@ #include <tools/solar.h> #include <vcl/dllapi.h> #include <vcl/syswin.hxx> +#include <o3tl/typed_flags_set.hxx> class ToolBox; @@ -30,24 +31,32 @@ class ToolBox; // - FloatingWindow-Types - -#define FLOATWIN_POPUPMODE_ALLOWTEAROFF ((sal_uLong)0x00000001) -#define FLOATWIN_POPUPMODE_ANIMATIONSLIDE ((sal_uLong)0x00000002) -#define FLOATWIN_POPUPMODE_NOAUTOARRANGE ((sal_uLong)0x00000004) -#define FLOATWIN_POPUPMODE_NOANIMATION ((sal_uLong)0x00000008) -#define FLOATWIN_POPUPMODE_DOWN ((sal_uLong)0x00000010) -#define FLOATWIN_POPUPMODE_UP ((sal_uLong)0x00000020) -#define FLOATWIN_POPUPMODE_LEFT ((sal_uLong)0x00000040) -#define FLOATWIN_POPUPMODE_RIGHT ((sal_uLong)0x00000080) -#define FLOATWIN_POPUPMODE_NOFOCUSCLOSE ((sal_uLong)0x00000100) -#define FLOATWIN_POPUPMODE_NOKEYCLOSE ((sal_uLong)0x00000200) -#define FLOATWIN_POPUPMODE_NOMOUSECLOSE ((sal_uLong)0x00000400) -#define FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE ((sal_uLong)0x00000800) -#define FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE ((sal_uLong)0x00001000) -#define FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ((sal_uLong)0x00002000) -#define FLOATWIN_POPUPMODE_NEWLEVEL ((sal_uLong)0x00004000) -#define FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ((sal_uLong)0x00008000) -#define FLOATWIN_POPUPMODE_GRABFOCUS ((sal_uLong)0x00010000) -#define FLOATWIN_POPUPMODE_NOHORZPLACEMENT ((sal_uLong)0x00020000) +enum class FloatWinPopupFlags +{ + NONE = 0x000000, + AllowTearOff = 0x000001, + AnimationSlide = 0x000002, + NoAutoArrange = 0x000004, + NoAnimation = 0x000008, + Down = 0x000010, + Up = 0x000020, + Left = 0x000040, + Right = 0x000080, + NoFocusClose = 0x000100, + NoKeyClose = 0x000200, + NoMouseClose = 0x000400, + NoMouseRectClose = 0x000800, + AllMouseButtonClose = 0x001000, + NoAppFocusClose = 0x002000, + NewLevel = 0x004000, + NoMouseUpClose = 0x008000, + GrabFocus = 0x010000, + NoHorzPlacement = 0x020000, +}; +namespace o3tl +{ + template<> struct typed_flags<FloatWinPopupFlags> : is_typed_flags<FloatWinPopupFlags, 0x03ffff> {}; +} #define FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0001) #define FLOATWIN_POPUPMODEEND_TEAROFF ((sal_uInt16)0x0002) @@ -78,7 +87,7 @@ private: ImplData* mpImplData; Rectangle maFloatRect; ImplSVEvent * mnPostId; - sal_uLong mnPopupModeFlags; + FloatWinPopupFlags mnPopupModeFlags; sal_uInt16 mnTitle; sal_uInt16 mnOldTitle; bool mbInPopupMode; @@ -110,7 +119,7 @@ public: SAL_DLLPRIVATE void ImplSetMouseDown() { mbMouseDown = true; } SAL_DLLPRIVATE bool ImplIsMouseDown() const { return mbMouseDown; } SAL_DLLPRIVATE static Point ImplCalcPos( vcl::Window* pWindow, - const Rectangle& rRect, sal_uLong nFlags, + const Rectangle& rRect, FloatWinPopupFlags nFlags, sal_uInt16& rArrangeIndex ); SAL_DLLPRIVATE void ImplEndPopupMode( sal_uInt16 nFlags = 0, sal_uLong nFocusId = 0 ); SAL_DLLPRIVATE Rectangle& ImplGetItemEdgeClipRect(); @@ -133,12 +142,12 @@ public: void SetTitleType( sal_uInt16 nTitle ); sal_uInt16 GetTitleType() const { return mnTitle; } - void StartPopupMode( const Rectangle& rRect, sal_uLong nFlags = 0 ); - void StartPopupMode( ToolBox* pBox, sal_uLong nFlags = 0 ); + void StartPopupMode( const Rectangle& rRect, FloatWinPopupFlags nFlags = FloatWinPopupFlags::NONE ); + void StartPopupMode( ToolBox* pBox, FloatWinPopupFlags nFlags = FloatWinPopupFlags::NONE ); void EndPopupMode( sal_uInt16 nFlags = 0 ); void AddPopupModeWindow( vcl::Window* pWindow ); - sal_uLong GetPopupModeFlags() const { return mnPopupModeFlags; } - void SetPopupModeFlags( sal_uLong nFlags ) { mnPopupModeFlags = nFlags; } + FloatWinPopupFlags GetPopupModeFlags() const { return mnPopupModeFlags; } + void SetPopupModeFlags( FloatWinPopupFlags nFlags ) { mnPopupModeFlags = nFlags; } bool IsInPopupMode() const { return mbPopupMode; } bool IsInCleanUp() const { return mbInCleanUp; } bool IsPopupModeCanceled() const { return mbPopupModeCanceled; } @@ -149,7 +158,7 @@ public: bool GrabsFocus() const { return mbGrabFocus; } - static Point CalcFloatingPosition( vcl::Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex ); + static Point CalcFloatingPosition( vcl::Window* pWindow, const Rectangle& rRect, FloatWinPopupFlags nFlags, sal_uInt16& rArrangeIndex ); }; #endif // INCLUDED_VCL_FLOATWIN_HXX diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 7c570f0f646b..24c716daa466 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -48,6 +48,7 @@ namespace vcl { class Window; } class SalMenu; class IMenuBarWindow; struct SystemMenuData; +enum class FloatWinPopupFlags; namespace com { namespace sun { @@ -503,7 +504,7 @@ private: SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const; protected: - SAL_DLLPRIVATE sal_uInt16 ImplExecute( vcl::Window* pWindow, const Rectangle& rRect, sal_uLong nPopupFlags, Menu* pStaredFrom, bool bPreSelectFirst ); + SAL_DLLPRIVATE sal_uInt16 ImplExecute( vcl::Window* pWindow, const Rectangle& rRect, FloatWinPopupFlags nPopupFlags, Menu* pStaredFrom, bool bPreSelectFirst ); SAL_DLLPRIVATE long ImplCalcHeight( sal_uInt16 nEntries ) const; SAL_DLLPRIVATE sal_uInt16 ImplCalcVisEntries( long nMaxHeight, sal_uInt16 nStartEntry = 0, sal_uInt16* pLastVisible = NULL ) const; diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 6944b3bfb3be..8dd50aa67b47 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -557,11 +557,11 @@ void ScMenuFloatingWindow::launchSubMenu(bool bSetMenuPos) if (!pSubMenu) return; - sal_uInt32 nOldFlags = GetPopupModeFlags(); - SetPopupModeFlags(nOldFlags | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE); + FloatWinPopupFlags nOldFlags = GetPopupModeFlags(); + SetPopupModeFlags(nOldFlags | FloatWinPopupFlags::NoAppFocusClose); pSubMenu->resizeToFitMenuItems(); // set the size before launching the popup to get it positioned correctly. pSubMenu->StartPopupMode( - Rectangle(aPos,aSize), (FLOATWIN_POPUPMODE_RIGHT | FLOATWIN_POPUPMODE_GRABFOCUS)); + Rectangle(aPos,aSize), (FloatWinPopupFlags::Right | FloatWinPopupFlags::GrabFocus)); pSubMenu->AddPopupModeWindow(this); if (bSetMenuPos) pSubMenu->setSelectedMenuItem(0, false, false); // select menu item after the popup becomes fully visible. @@ -809,11 +809,11 @@ void ScMenuFloatingWindow::ensureSubMenuVisible(ScMenuFloatingWindow* pSubMenu) Size aSize; getMenuItemPosSize(nMenuPos, aPos, aSize); - sal_uInt32 nOldFlags = GetPopupModeFlags(); - SetPopupModeFlags(nOldFlags | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE); + FloatWinPopupFlags nOldFlags = GetPopupModeFlags(); + SetPopupModeFlags(nOldFlags | FloatWinPopupFlags::NoAppFocusClose); pSubMenu->resizeToFitMenuItems(); // set the size before launching the popup to get it positioned correctly. pSubMenu->StartPopupMode( - Rectangle(aPos,aSize), (FLOATWIN_POPUPMODE_RIGHT | FLOATWIN_POPUPMODE_GRABFOCUS)); + Rectangle(aPos,aSize), (FloatWinPopupFlags::Right | FloatWinPopupFlags::GrabFocus)); pSubMenu->AddPopupModeWindow(this); SetPopupModeFlags(nOldFlags); } @@ -1730,7 +1730,7 @@ void ScCheckListMenuWindow::launch(const Rectangle& rRect) aRect.Left() += nDiff; } - StartPopupMode(aRect, (FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_GRABFOCUS)); + StartPopupMode(aRect, (FloatWinPopupFlags::Down | FloatWinPopupFlags::GrabFocus)); cycleFocus(); // Set initial focus to the check list box. } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index e59acb922793..71bca6f8f2f7 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -1070,7 +1070,7 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange ) } mpFilterFloat->SetOutputSizePixel( aSize ); - mpFilterFloat->StartPopupMode( aCellRect, FLOATWIN_POPUPMODE_DOWN|FLOATWIN_POPUPMODE_GRABFOCUS ); + mpFilterFloat->StartPopupMode( aCellRect, FloatWinPopupFlags::Down|FloatWinPopupFlags::GrabFocus ); mpFilterBox->SetUpdateMode(true); mpFilterBox->GrabFocus(); @@ -1222,7 +1222,7 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelec mpFilterBox->SetUpdateMode(false); mpFilterFloat->SetOutputSizePixel(aSize); - mpFilterFloat->StartPopupMode(aCellRect, FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_GRABFOCUS); + mpFilterFloat->StartPopupMode(aCellRect, FloatWinPopupFlags::Down | FloatWinPopupFlags::GrabFocus); // Listbox fuellen bool bWait = aStrings.size() > 100; diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 9a0c861f84ca..606bddbdaf07 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -582,7 +582,7 @@ void AnnotationTag::OpenPopup( bool bEdit ) mpAnnotationWindow->setAnnotation(mxAnnotation); sal_uInt16 nArrangeIndex = 0; - Point aPopupPos( FloatingWindow::CalcFloatingPosition( mpAnnotationWindow.get(), aRect, FLOATWIN_POPUPMODE_RIGHT, nArrangeIndex ) ); + Point aPopupPos( FloatingWindow::CalcFloatingPosition( mpAnnotationWindow.get(), aRect, FloatWinPopupFlags::Right, nArrangeIndex ) ); Size aPopupSize( 320, 240 ); mpAnnotationWindow->SetPosSizePixel( aPopupPos, aPopupSize ); diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 4c2ba8bb638e..a60245646130 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -614,7 +614,7 @@ void LayoutMenu::Command (const CommandEvent& rEvent) FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow()); if (pMenuWindow != NULL) pMenuWindow->SetPopupModeFlags( - pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); + pMenuWindow->GetPopupModeFlags() | FloatWinPopupFlags::NoMouseUpClose); pMenu->SetSelectHdl(LINK(this, LayoutMenu, OnMenuItemSelected)); // Disable the SID_INSERTPAGE_LAYOUT_MENU item when diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx index 2c522c16a4ab..c91ea088e96e 100644 --- a/sd/source/ui/sidebar/MasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx @@ -229,7 +229,7 @@ void MasterPagesSelector::Command (const CommandEvent& rEvent) FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow()); if (pMenuWindow != NULL) pMenuWindow->SetPopupModeFlags( - pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); + pMenuWindow->GetPopupModeFlags() | FloatWinPopupFlags::NoMouseUpClose); pMenu->SetSelectHdl(LINK(this, MasterPagesSelector, OnMenuItemSelected)); ProcessPopupMenu(*pMenu); diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 65a6a6a8e22c..1a735738471e 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -1174,7 +1174,7 @@ namespace sfx2 FloatingWindow* pMenuWindow = static_cast< FloatingWindow* >( pMenu->GetWindow() ); if ( pMenuWindow != NULL ) { - pMenuWindow->SetPopupModeFlags ( pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ); + pMenuWindow->SetPopupModeFlags ( pMenuWindow->GetPopupModeFlags() | FloatWinPopupFlags::NoMouseUpClose ); } // Add one entry for every tool panel element to individually make diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 00e3f7f3701a..b7a32b013790 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -827,7 +827,7 @@ void SidebarController::ShowPopupMenu ( FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow()); if (pMenuWindow != NULL) { - pMenuWindow->SetPopupModeFlags(pMenuWindow->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE); + pMenuWindow->SetPopupModeFlags(pMenuWindow->GetPopupModeFlags() | FloatWinPopupFlags::NoMouseUpClose); } // Create sub menu for customization (hiding of deck tabs.) diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index e88fc0ebd5e9..74fb59f6b809 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -2361,7 +2361,7 @@ bool CalendarField::ShowDropDown( bool bShow ) mpCalendar->StartSelection(); mpCalendar->GrabFocus(); mpCalendar->Show(); - mpFloatWin->StartPopupMode( aRect, FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_DOWN ); + mpFloatWin->StartPopupMode( aRect, FloatWinPopupFlags::NoFocusClose|FloatWinPopupFlags::Down ); } else { diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index 87e64d475e62..39ceb320d424 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -215,10 +215,10 @@ Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow() th pWin->EnableDocking(true); mxImpl->SetPopupWindow(pWin,pToolBox); vcl::Window::GetDockingManager()->StartPopupMode( pToolBox, pWin, - FLOATWIN_POPUPMODE_GRABFOCUS | - FLOATWIN_POPUPMODE_NOFOCUSCLOSE | - FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE | - FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ); + FloatWinPopupFlags::GrabFocus | + FloatWinPopupFlags::NoFocusClose | + FloatWinPopupFlags::AllMouseButtonClose | + FloatWinPopupFlags::NoMouseUpClose ); } } return Reference< awt::XWindow >(); diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx index 4041ef6a887a..ae3eb8458f29 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx @@ -46,7 +46,7 @@ VclPtr<SfxPopupWindow> ParaLineSpacingPopup::CreatePopupWindow() { VclPtr<ParaLineSpacingControl> pControl = VclPtr<ParaLineSpacingControl>::Create(GetSlotId()); - pControl->StartPopupMode(&GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE); + pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus|FloatWinPopupFlags::NoAppFocusClose); SetPopupWindow(pControl); diff --git a/svx/source/sidebar/tools/Popup.cxx b/svx/source/sidebar/tools/Popup.cxx index 221af081cfb5..193bf85f783f 100644 --- a/svx/source/sidebar/tools/Popup.cxx +++ b/svx/source/sidebar/tools/Popup.cxx @@ -68,10 +68,10 @@ void Popup::Show (ToolBox& rToolBox) mxContainer->StartPopupMode( aRect, - FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_DOWN); + FloatWinPopupFlags::NoFocusClose|FloatWinPopupFlags::Down); mxContainer->SetPopupModeFlags( mxContainer->GetPopupModeFlags() - | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE); + | FloatWinPopupFlags::NoAppFocusClose); mxControl->GetFocus(); } diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index a36af3acf5b7..cf474801f3a5 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -745,7 +745,7 @@ VclPtr<SfxPopupWindow> SvxTableToolBoxControl::CreatePopupWindow() { ToolBox& rTbx = GetToolBox(); VclPtr<TableWindow> pWin = VclPtr<TableWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), rTbx, m_xFrame ); - pWin->StartPopupMode( &rTbx, FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE ); + pWin->StartPopupMode( &rTbx, FloatWinPopupFlags::GrabFocus|FloatWinPopupFlags::NoKeyClose ); SetPopupWindow( pWin ); return pWin; } @@ -800,7 +800,7 @@ VclPtr<SfxPopupWindow> SvxColumnsToolBoxControl::CreatePopupWindow() { pWin = VclPtr<ColumnsWindow>::Create( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame ); pWin->StartPopupMode( &GetToolBox(), - FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE ); + FloatWinPopupFlags::GrabFocus|FloatWinPopupFlags::NoKeyClose ); SetPopupWindow( pWin ); } return pWin; diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx index a517946bff0e..d83a587d90cd 100644 --- a/svx/source/tbxctrls/lboxctrl.cxx +++ b/svx/source/tbxctrls/lboxctrl.cxx @@ -178,7 +178,7 @@ void SvxListBoxControl::StateChanged( IMPL_LINK_NOARG(SvxListBoxControl, PopupModeEndHdl) { - if( pPopupWin && 0 == pPopupWin->GetPopupModeFlags() && + if( pPopupWin && FloatWinPopupFlags::NONE == pPopupWin->GetPopupModeFlags() && pPopupWin->IsUserSelected() ) { sal_uInt16 nCount = pPopupWin->GetListBox().GetSelectEntryCount(); @@ -308,7 +308,7 @@ VclPtr<SfxPopupWindow> SvxUndoRedoControl::CreatePopupWindow() // move focus in floating window without // closing it (GrabFocus() would close it!) - pPopupWin->StartPopupMode( &rBox, FLOATWIN_POPUPMODE_GRABFOCUS ); + pPopupWin->StartPopupMode( &rBox, FloatWinPopupFlags::GrabFocus ); //pPopupWin->GetListBox().GrabFocus(); return pPopupWin; diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 5f303bc76b98..101490079bda 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -634,9 +634,9 @@ VclPtr<SfxPopupWindow> SvxLineEndToolBoxControl::CreatePopupWindow() SvxLineEndWindow* pLineEndWin = VclPtr<SvxLineEndWindow>::Create( GetId(), m_xFrame, &GetToolBox(), SVX_RESSTR( RID_SVXSTR_LINEEND ) ); pLineEndWin->StartPopupMode( &GetToolBox(), - FLOATWIN_POPUPMODE_GRABFOCUS | - FLOATWIN_POPUPMODE_ALLOWTEAROFF | - FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); + FloatWinPopupFlags::GrabFocus | + FloatWinPopupFlags::AllowTearOff | + FloatWinPopupFlags::NoAppFocusClose ); pLineEndWin->StartSelection(); SetPopupWindow( pLineEndWin ); return pLineEndWin; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index ab09ae83df4e..2e962cc93946 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2634,7 +2634,7 @@ VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow() } pColorWin->StartPopupMode( &GetToolBox(), - FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); + FloatWinPopupFlags::AllowTearOff|FloatWinPopupFlags::NoAppFocusClose ); pColorWin->StartSelection(); SetPopupWindow( pColorWin ); if ( !bSidebarType ) @@ -2778,9 +2778,9 @@ VclPtr<SfxPopupWindow> SvxFrameToolBoxControl::CreatePopupWindow() GetSlotId(), m_xFrame, &GetToolBox() ); pFrameWin->StartPopupMode( &GetToolBox(), - FLOATWIN_POPUPMODE_GRABFOCUS | - FLOATWIN_POPUPMODE_ALLOWTEAROFF | - FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); + FloatWinPopupFlags::GrabFocus | + FloatWinPopupFlags::AllowTearOff | + FloatWinPopupFlags::NoAppFocusClose ); pFrameWin->StartSelection(); SetPopupWindow( pFrameWin ); @@ -2818,9 +2818,9 @@ VclPtr<SfxPopupWindow> SvxFrameLineStyleToolBoxControl::CreatePopupWindow() { VclPtr<SvxLineWindow_Impl> pLineWin = VclPtr<SvxLineWindow_Impl>::Create( GetSlotId(), m_xFrame, &GetToolBox() ); pLineWin->StartPopupMode( &GetToolBox(), - FLOATWIN_POPUPMODE_GRABFOCUS | - FLOATWIN_POPUPMODE_ALLOWTEAROFF | - FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); + FloatWinPopupFlags::GrabFocus | + FloatWinPopupFlags::AllowTearOff | + FloatWinPopupFlags::NoAppFocusClose ); SetPopupWindow( pLineWin ); return pLineWin; diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index f5556db78991..a86d367a3277 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -900,7 +900,7 @@ void SwView::ExecFieldPopup( const Point& rPt, IFieldmark *fieldBM ) m_pFieldPopup->SetPopupModeEndHdl( LINK( this, SwView, FieldPopupModeEndHdl ) ); Rectangle aRect( m_pEditWin->OutputToScreenPixel( aPixPos ), Size( 0, 0 ) ); - m_pFieldPopup->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN|FLOATWIN_POPUPMODE_GRABFOCUS ); + m_pFieldPopup->StartPopupMode( aRect, FloatWinPopupFlags::Down|FloatWinPopupFlags::GrabFocus ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 5a351fa79e75..2bbacde75afb 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -433,7 +433,7 @@ void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, bool bSetFocus Point aT1 = aRect.TopLeft(); aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox->OutputToAbsoluteScreenPixel(aT1))); aRect.SetPos(aT1); - pPopup->StartPopupMode(aRect, FLOATWIN_POPUPMODE_RIGHT|FLOATWIN_POPUPMODE_ALLOWTEAROFF); + pPopup->StartPopupMode(aRect, FloatWinPopupFlags::Right|FloatWinPopupFlags::AllowTearOff); SetPopupWindow( pPopup ); if(bSetFocus) { diff --git a/vcl/inc/salmenu.hxx b/vcl/inc/salmenu.hxx index ee9bdb76a6f5..aaea364f30b2 100644 --- a/vcl/inc/salmenu.hxx +++ b/vcl/inc/salmenu.hxx @@ -77,7 +77,7 @@ public: virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) = 0; virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) = 0; virtual void GetSystemMenuData( SystemMenuData* pData ) = 0; - virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, sal_uLong nFlags); + virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, FloatWinPopupFlags nFlags); virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false if not implemented or failure virtual void RemoveMenuBarButton( sal_uInt16 nId ); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index e05b73480148..c51f4f60d954 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -130,7 +130,7 @@ SalMenu::~SalMenu() { } -bool SalMenu::ShowNativePopupMenu(FloatingWindow *, const Rectangle&, sal_uLong ) +bool SalMenu::ShowNativePopupMenu(FloatingWindow *, const Rectangle&, FloatWinPopupFlags ) { return false; } diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index f1b9c23e4476..bd1935cf0577 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -2973,7 +2973,7 @@ void ImplListBoxFloatingWindow::setPosSizePixel( long nX, long nY, long nWidth, aPos.Y() = nY; sal_uInt16 nIndex; - SetPosPixel( ImplCalcPos( this, Rectangle( aPos, GetParent()->GetSizePixel() ), FLOATWIN_POPUPMODE_DOWN, nIndex ) ); + SetPosPixel( ImplCalcPos( this, Rectangle( aPos, GetParent()->GetSizePixel() ), FloatWinPopupFlags::Down, nIndex ) ); } // if( !IsReallyVisible() ) @@ -3105,7 +3105,7 @@ void ImplListBoxFloatingWindow::StartFloat( bool bStartTracking ) pGrandparentOutDev->ReMirror( aRect ); // mouse-button right: close the List-Box-Float-win and don't stop the handling fdo#84795 - StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE ); + StartPopupMode( aRect, FloatWinPopupFlags::Down | FloatWinPopupFlags::AllMouseButtonClose ); if( nPos != LISTBOX_ENTRY_NOTFOUND ) mpImplLB->ShowProminentEntry( nPos ); diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 684f444fe40d..2d8d937a9669 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -368,7 +368,7 @@ void DockingManager::SetFloatingMode( const vcl::Window *pWindow, bool bFloating pWrapper->SetFloatingMode( bFloating ); } -void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWindow, sal_uLong nFlags ) +void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWindow, FloatWinPopupFlags nFlags ) { ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow ); if( pWrapper ) @@ -377,10 +377,10 @@ void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const vcl::Window void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWindow ) { - StartPopupMode( pParentToolBox, pWindow, FLOATWIN_POPUPMODE_ALLOWTEAROFF | - FLOATWIN_POPUPMODE_NOFOCUSCLOSE | - FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE | - FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ); + StartPopupMode( pParentToolBox, pWindow, FloatWinPopupFlags::AllowTearOff | + FloatWinPopupFlags::NoFocusClose | + FloatWinPopupFlags::AllMouseButtonClose | + FloatWinPopupFlags::NoMouseUpClose ); } bool DockingManager::IsInPopupMode( const vcl::Window *pWindow ) @@ -1098,7 +1098,7 @@ void ImplDockingWindowWrapper::ShowTitleButton( sal_uInt16 nButton, bool bVisibl } } -void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, sal_uLong nFlags ) +void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWinPopupFlags nFlags ) { // do nothing if window is floating if( IsFloatingMode() ) @@ -1113,7 +1113,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, sal_uLon mpOldBorderWin = NULL; // no border window found // the new parent for popup mode - VclPtrInstance<ImplPopupFloatWin> pWin( mpParent, this, (nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) != 0 ); + VclPtrInstance<ImplPopupFloatWin> pWin( mpParent, this, bool(nFlags & FloatWinPopupFlags::AllowTearOff) ); pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) ); pWin->SetText( GetWindow()->GetText() ); @@ -1146,7 +1146,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, sal_uLon // if the subtoolbar was opened via keyboard make sure that key events // will go into subtoolbar if( pParentToolBox->IsKeyEvent() ) - nFlags |= FLOATWIN_POPUPMODE_GRABFOCUS; + nFlags |= FloatWinPopupFlags::GrabFocus; mpFloatWin->StartPopupMode( pParentToolBox, nFlags ); GetWindow()->Show(); diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 0e2f5cc459e3..f66f92e8cc58 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -123,7 +123,7 @@ void FloatingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle ) mnPostId = 0; mnTitle = (nStyle & (WB_MOVEABLE | WB_POPUP)) ? FLOATWIN_TITLE_NORMAL : FLOATWIN_TITLE_NONE; mnOldTitle = mnTitle; - mnPopupModeFlags = 0; + mnPopupModeFlags = FloatWinPopupFlags::NONE; mbInPopupMode = false; mbPopupMode = false; mbPopupModeCanceled = false; @@ -159,7 +159,7 @@ FloatingWindow::FloatingWindow(vcl::Window* pParent, const OString& rID, const O , mpFirstPopupModeWin(0) , mpImplData(0) , mnPostId(0) - , mnPopupModeFlags(0) + , mnPopupModeFlags(FloatWinPopupFlags::NONE) , mnTitle(0) , mnOldTitle(0) , mbInPopupMode(false) @@ -218,13 +218,13 @@ void FloatingWindow::dispose() SystemWindow::dispose(); } -Point FloatingWindow::CalcFloatingPosition( vcl::Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex ) +Point FloatingWindow::CalcFloatingPosition( vcl::Window* pWindow, const Rectangle& rRect, FloatWinPopupFlags nFlags, sal_uInt16& rArrangeIndex ) { return ImplCalcPos( pWindow, rRect, nFlags, rArrangeIndex ); } Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow, - const Rectangle& rRect, sal_uLong nFlags, + const Rectangle& rRect, FloatWinPopupFlags nFlags, sal_uInt16& rArrangeIndex ) { // get window position @@ -254,43 +254,43 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow, aScreenRect = Application::GetScreenPosSizePixel( Application::GetBestScreen( bRTL ? devRectRTL : devRect ) ); - sal_uInt16 nArrangeAry[5]; - sal_uInt16 nArrangeIndex; - Point e1,e2; // the common edge between the item rect and the floating window + FloatWinPopupFlags nArrangeAry[5]; + sal_uInt16 nArrangeIndex; + Point e1,e2; // the common edge between the item rect and the floating window - if ( nFlags & FLOATWIN_POPUPMODE_LEFT ) + if ( nFlags & FloatWinPopupFlags::Left ) { - nArrangeAry[0] = FLOATWIN_POPUPMODE_LEFT; - nArrangeAry[1] = FLOATWIN_POPUPMODE_RIGHT; - nArrangeAry[2] = FLOATWIN_POPUPMODE_UP; - nArrangeAry[3] = FLOATWIN_POPUPMODE_DOWN; - nArrangeAry[4] = FLOATWIN_POPUPMODE_LEFT; + nArrangeAry[0] = FloatWinPopupFlags::Left; + nArrangeAry[1] = FloatWinPopupFlags::Right; + nArrangeAry[2] = FloatWinPopupFlags::Up; + nArrangeAry[3] = FloatWinPopupFlags::Down; + nArrangeAry[4] = FloatWinPopupFlags::Left; } - else if ( nFlags & FLOATWIN_POPUPMODE_RIGHT ) + else if ( nFlags & FloatWinPopupFlags::Right ) { - nArrangeAry[0] = FLOATWIN_POPUPMODE_RIGHT; - nArrangeAry[1] = FLOATWIN_POPUPMODE_LEFT; - nArrangeAry[2] = FLOATWIN_POPUPMODE_UP; - nArrangeAry[3] = FLOATWIN_POPUPMODE_DOWN; - nArrangeAry[4] = FLOATWIN_POPUPMODE_RIGHT; + nArrangeAry[0] = FloatWinPopupFlags::Right; + nArrangeAry[1] = FloatWinPopupFlags::Left; + nArrangeAry[2] = FloatWinPopupFlags::Up; + nArrangeAry[3] = FloatWinPopupFlags::Down; + nArrangeAry[4] = FloatWinPopupFlags::Right; } - else if ( nFlags & FLOATWIN_POPUPMODE_UP ) + else if ( nFlags & FloatWinPopupFlags::Up ) { - nArrangeAry[0] = FLOATWIN_POPUPMODE_UP; - nArrangeAry[1] = FLOATWIN_POPUPMODE_DOWN; - nArrangeAry[2] = FLOATWIN_POPUPMODE_RIGHT; - nArrangeAry[3] = FLOATWIN_POPUPMODE_LEFT; - nArrangeAry[4] = FLOATWIN_POPUPMODE_UP; + nArrangeAry[0] = FloatWinPopupFlags::Up; + nArrangeAry[1] = FloatWinPopupFlags::Down; + nArrangeAry[2] = FloatWinPopupFlags::Right; + nArrangeAry[3] = FloatWinPopupFlags::Left; + nArrangeAry[4] = FloatWinPopupFlags::Up; } else { - nArrangeAry[0] = FLOATWIN_POPUPMODE_DOWN; - nArrangeAry[1] = FLOATWIN_POPUPMODE_UP; - nArrangeAry[2] = FLOATWIN_POPUPMODE_RIGHT; - nArrangeAry[3] = FLOATWIN_POPUPMODE_LEFT; - nArrangeAry[4] = FLOATWIN_POPUPMODE_DOWN; + nArrangeAry[0] = FloatWinPopupFlags::Down; + nArrangeAry[1] = FloatWinPopupFlags::Up; + nArrangeAry[2] = FloatWinPopupFlags::Right; + nArrangeAry[3] = FloatWinPopupFlags::Left; + nArrangeAry[4] = FloatWinPopupFlags::Down; } - if ( nFlags & FLOATWIN_POPUPMODE_NOAUTOARRANGE ) + if ( nFlags & FloatWinPopupFlags::NoAutoArrange ) nArrangeIndex = 4; else nArrangeIndex = 0; @@ -301,7 +301,7 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow, switch ( nArrangeAry[nArrangeIndex] ) { - case FLOATWIN_POPUPMODE_LEFT: + case FloatWinPopupFlags::Left: aPos.X() = devRect.Left()-aSize.Width()+1; aPos.Y() = devRect.Top(); aPos.Y() -= pWindow->mpWindowImpl->mnTopBorder; @@ -326,7 +326,7 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow, e2.Y()--; } break; - case FLOATWIN_POPUPMODE_RIGHT: + case FloatWinPopupFlags::Right: aPos = devRect.TopRight(); aPos.Y() -= pWindow->mpWindowImpl->mnTopBorder; if( bRTL ) // --- RTL --- we're comparing screen coordinates here @@ -350,7 +350,7 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow, e2.Y()--; } break; - case FLOATWIN_POPUPMODE_UP: + case FloatWinPopupFlags::Up: aPos.X() = devRect.Left(); aPos.Y() = devRect.Top()-aSize.Height()+1; if ( aPos.Y() < aScreenRect.Top() ) @@ -366,7 +366,7 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow, e2.X()--; } break; - case FLOATWIN_POPUPMODE_DOWN: + case FloatWinPopupFlags::Down: aPos = devRect.BottomLeft(); if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() ) bBreak = false; @@ -381,13 +381,14 @@ Point FloatingWindow::ImplCalcPos( vcl::Window* pWindow, e2.X()--; } break; + default: break; } // adjust if necessary - if ( bBreak && !(nFlags & FLOATWIN_POPUPMODE_NOAUTOARRANGE) ) + if ( bBreak && !(nFlags & FloatWinPopupFlags::NoAutoArrange) ) { - if ( (nArrangeAry[nArrangeIndex] == FLOATWIN_POPUPMODE_LEFT) || - (nArrangeAry[nArrangeIndex] == FLOATWIN_POPUPMODE_RIGHT) ) + if ( (nArrangeAry[nArrangeIndex] == FloatWinPopupFlags::Left) || + (nArrangeAry[nArrangeIndex] == FloatWinPopupFlags::Right) ) { if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() ) { @@ -496,7 +497,7 @@ FloatingWindow* FloatingWindow::ImplFindLastLevelFloat() do { - if ( pWin->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NEWLEVEL ) + if ( pWin->GetPopupModeFlags() & FloatWinPopupFlags::NewLevel ) pLastFoundWin = pWin; pWin = pWin->mpNextFloat; @@ -526,7 +527,7 @@ IMPL_LINK_NOARG(FloatingWindow, ImplEndPopupModeHdl) { VclPtr<FloatingWindow> pThis(this); mnPostId = 0; - mnPopupModeFlags = 0; + mnPopupModeFlags = FloatWinPopupFlags::NONE; mbPopupMode = false; PopupModeEnd(); return 0; @@ -618,7 +619,7 @@ void FloatingWindow::SetTitleType( sal_uInt16 nTitle ) } } -void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags ) +void FloatingWindow::StartPopupMode( const Rectangle& rRect, FloatWinPopupFlags nFlags ) { // avoid flickering if ( IsVisible() ) @@ -631,19 +632,19 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags ) mnOldTitle = mnTitle; if ( ( mpWindowImpl->mnStyle & WB_POPUP ) && !GetText().isEmpty() ) SetTitleType( FLOATWIN_TITLE_POPUP ); - else if ( nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF ) + else if ( nFlags & FloatWinPopupFlags::AllowTearOff ) SetTitleType( FLOATWIN_TITLE_TEAROFF ); else SetTitleType( FLOATWIN_TITLE_NONE ); // avoid close on focus change for decorated floating windows only if( mpWindowImpl->mbFrame && (GetStyle() & WB_MOVEABLE) ) - nFlags |= FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; + nFlags |= FloatWinPopupFlags::NoAppFocusClose; // #102010# For debugging Accessibility static const char* pEnv = getenv("SAL_FLOATWIN_NOAPPFOCUSCLOSE" ); if( pEnv && *pEnv ) - nFlags |= FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; + nFlags |= FloatWinPopupFlags::NoAppFocusClose; // compute window position according to flags and arrangement sal_uInt16 nArrangeIndex; @@ -691,7 +692,7 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags ) ImplSVData* pSVData = ImplGetSVData(); mpNextFloat = pSVData->maWinData.mpFirstFloat; pSVData->maWinData.mpFirstFloat = this; - if( nFlags & FLOATWIN_POPUPMODE_GRABFOCUS ) + if( nFlags & FloatWinPopupFlags::GrabFocus ) { // force key input even without focus (useful for menus) mbGrabFocus = true; @@ -699,7 +700,7 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags ) Show( true, SHOW_NOACTIVATE ); } -void FloatingWindow::StartPopupMode( ToolBox* pBox, sal_uLong nFlags ) +void FloatingWindow::StartPopupMode( ToolBox* pBox, FloatWinPopupFlags nFlags ) { // get selected button sal_uInt16 nItemId = pBox->GetDownItemId(); @@ -717,27 +718,27 @@ void FloatingWindow::StartPopupMode( ToolBox* pBox, sal_uLong nFlags ) aRect.SetPos( aPos ); nFlags |= - FLOATWIN_POPUPMODE_NOFOCUSCLOSE | -// FLOATWIN_POPUPMODE_NOMOUSECLOSE | - FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE | -// FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE | // #105968# floating toolboxes should close when clicked in (parent's) float rect - FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE; -// | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE; + FloatWinPopupFlags::NoFocusClose | +// FloatWinPopupFlags::NoMouseClose | + FloatWinPopupFlags::AllMouseButtonClose | +// FloatWinPopupFlags::NoMouseRectClose | // #105968# floating toolboxes should close when clicked in (parent's) float rect + FloatWinPopupFlags::NoMouseUpClose; +// | FloatWinPopupFlags::NoAppFocusClose; /* - * FLOATWIN_POPUPMODE_NOKEYCLOSE | + * FloatWinPopupFlags::NoKeyClose | * don't set since it disables closing floaters with escape */ // set Flags for positioning - if ( !(nFlags & (FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_UP | - FLOATWIN_POPUPMODE_LEFT | FLOATWIN_POPUPMODE_RIGHT | - FLOATWIN_POPUPMODE_NOAUTOARRANGE)) ) + if ( !(nFlags & (FloatWinPopupFlags::Down | FloatWinPopupFlags::Up | + FloatWinPopupFlags::Left | FloatWinPopupFlags::Right | + FloatWinPopupFlags::NoAutoArrange)) ) { if ( pBox->IsHorizontal() ) - nFlags |= FLOATWIN_POPUPMODE_DOWN; + nFlags |= FloatWinPopupFlags::Down; else - nFlags |= FLOATWIN_POPUPMODE_RIGHT; + nFlags |= FloatWinPopupFlags::Right; } // start FloatingMode @@ -761,11 +762,11 @@ void FloatingWindow::ImplEndPopupMode( sal_uInt16 nFlags, sal_uLong nFocusId ) pSVData->maWinData.mpFirstFloat = mpNextFloat; mpNextFloat = NULL; - sal_uLong nPopupModeFlags = mnPopupModeFlags; + FloatWinPopupFlags nPopupModeFlags = mnPopupModeFlags; // hide window again if it was not deleted if ( !(nFlags & FLOATWIN_POPUPMODEEND_TEAROFF) || - !(nPopupModeFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) ) + !(nPopupModeFlags & FloatWinPopupFlags::AllowTearOff) ) { Show( false, SHOW_NOFOCUSCHANGE ); @@ -804,7 +805,7 @@ void FloatingWindow::ImplEndPopupMode( sal_uInt16 nFlags, sal_uLong nFocusId ) // close all other windows depending on parameter if ( nFlags & FLOATWIN_POPUPMODEEND_CLOSEALL ) { - if ( !(nPopupModeFlags & FLOATWIN_POPUPMODE_NEWLEVEL) ) + if ( !(nPopupModeFlags & FloatWinPopupFlags::NewLevel) ) { if ( pSVData->maWinData.mpFirstFloat ) { diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 2e6d8c6a3dcb..762eaa264064 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2811,28 +2811,28 @@ sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow, const Rectangle& rRect, { ENSURE_OR_RETURN( pExecWindow, "PopupMenu::Execute: need a non-NULL window!", 0 ); - sal_uLong nPopupModeFlags = 0; + FloatWinPopupFlags nPopupModeFlags = FloatWinPopupFlags::NONE; if ( nFlags & POPUPMENU_EXECUTE_DOWN ) - nPopupModeFlags = FLOATWIN_POPUPMODE_DOWN; + nPopupModeFlags = FloatWinPopupFlags::Down; else if ( nFlags & POPUPMENU_EXECUTE_UP ) - nPopupModeFlags = FLOATWIN_POPUPMODE_UP; + nPopupModeFlags = FloatWinPopupFlags::Up; else if ( nFlags & POPUPMENU_EXECUTE_LEFT ) - nPopupModeFlags = FLOATWIN_POPUPMODE_LEFT; + nPopupModeFlags = FloatWinPopupFlags::Left; else if ( nFlags & POPUPMENU_EXECUTE_RIGHT ) - nPopupModeFlags = FLOATWIN_POPUPMODE_RIGHT; + nPopupModeFlags = FloatWinPopupFlags::Right; else - nPopupModeFlags = FLOATWIN_POPUPMODE_DOWN; + nPopupModeFlags = FloatWinPopupFlags::Down; if (nFlags & POPUPMENU_NOMOUSEUPCLOSE ) // allow popup menus to stay open on mouse button up - nPopupModeFlags |= FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE; // useful if the menu was opened on mousebutton down (eg toolbox configuration) + nPopupModeFlags |= FloatWinPopupFlags::NoMouseUpClose; // useful if the menu was opened on mousebutton down (eg toolbox configuration) if (nFlags & POPUPMENU_NOHORZ_PLACEMENT) - nPopupModeFlags |= FLOATWIN_POPUPMODE_NOHORZPLACEMENT; + nPopupModeFlags |= FloatWinPopupFlags::NoHorzPlacement; return ImplExecute( pExecWindow, rRect, nPopupModeFlags, 0, false ); } -sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_uLong nPopupModeFlags, Menu* pSFrom, bool bPreSelectFirst ) +sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom, bool bPreSelectFirst ) { if ( !pSFrom && ( PopupMenu::IsInExecute() || !GetItemCount() ) ) return 0; @@ -2866,11 +2866,11 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_ WinBits nStyle = WB_BORDER; if (bRealExecute) - nPopupModeFlags |= FLOATWIN_POPUPMODE_NEWLEVEL; - nPopupModeFlags |= FLOATWIN_POPUPMODE_NOKEYCLOSE | FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE; + nPopupModeFlags |= FloatWinPopupFlags::NewLevel; + nPopupModeFlags |= FloatWinPopupFlags::NoKeyClose | FloatWinPopupFlags::AllMouseButtonClose; // could be useful during debugging. - // nPopupModeFlags |= FLOATWIN_POPUPMODE_NOFOCUSCLOSE; + // nPopupModeFlags |= FloatWinPopupFlags::NoFocusClose; ImplDelData aDelData; pW->ImplAddDel( &aDelData ); @@ -2952,7 +2952,7 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_ //mode is to place it somewhere it will fit. e.g. above, left, right. For //some cases, e.g. menubars, it's desirable to limit the options to //above/below and force the menu to scroll if it won't fit - if (nPopupModeFlags & FLOATWIN_POPUPMODE_NOHORZPLACEMENT) + if (nPopupModeFlags & FloatWinPopupFlags::NoHorzPlacement) { vcl::Window* pRef = pWin; if ( pRef->GetParent() ) @@ -2984,13 +2984,13 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_ // #102158# menus must never grab the focus, otherwise // they will be closed immediately // from now on focus grabbing is only prohibited automatically if - // FLOATWIN_POPUPMODE_GRABFOCUS was set (which is done below), because some + // FloatWinPopupFlags::GrabFocus was set (which is done below), because some // floaters (like floating toolboxes) may grab the focus // pWin->GrabFocus(); if ( GetItemCount() ) { SalMenu* pMenu = ImplGetSalMenu(); - if( pMenu && bRealExecute && pMenu->ShowNativePopupMenu( pWin, aRect, nPopupModeFlags | FLOATWIN_POPUPMODE_GRABFOCUS ) ) + if( pMenu && bRealExecute && pMenu->ShowNativePopupMenu( pWin, aRect, nPopupModeFlags | FloatWinPopupFlags::GrabFocus ) ) { pWin->StopExecute(0); pWin->doShutdown(); @@ -3000,7 +3000,7 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_ } else { - pWin->StartPopupMode( aRect, nPopupModeFlags | FLOATWIN_POPUPMODE_GRABFOCUS ); + pWin->StartPopupMode( aRect, nPopupModeFlags | FloatWinPopupFlags::GrabFocus ); } if( pSFrom ) { diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 6a8de205b0de..942f184e8c3d 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -336,7 +336,7 @@ void MenuBarWindow::ImplCreatePopup( bool bPreSelectFirst ) // #99071# do not grab the focus, otherwise it will be restored to the menubar // when the frame is reactivated later //GrabFocus(); - pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_NOHORZPLACEMENT, pMenu, bPreSelectFirst ); + pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FloatWinPopupFlags::Down | FloatWinPopupFlags::NoHorzPlacement, pMenu, bPreSelectFirst ); // does not have a window, if aborted before or if there are no entries if ( pActivePopup->ImplGetFloatingWindow() ) pActivePopup->ImplGetFloatingWindow()->AddPopupModeWindow( this ); diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index f9340105152e..4345e16c2caf 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -282,8 +282,8 @@ IMPL_LINK_TYPED( MenuFloatingWindow, HighlightChanged, Timer*, pTimer, void ) { if ( pActivePopup && ( pActivePopup != pItemData->pSubMenu ) ) { - sal_uLong nOldFlags = GetPopupModeFlags(); - SetPopupModeFlags( GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); + FloatWinPopupFlags nOldFlags = GetPopupModeFlags(); + SetPopupModeFlags( GetPopupModeFlags() | FloatWinPopupFlags::NoAppFocusClose ); KillActivePopup(); SetPopupModeFlags( nOldFlags ); } @@ -321,9 +321,9 @@ IMPL_LINK_TYPED( MenuFloatingWindow, HighlightChanged, Timer*, pTimer, void ) // were for long in Activate Rescheduled and which should not be // displayed now. Menu* pTest = pActivePopup; - sal_uLong nOldFlags = GetPopupModeFlags(); - SetPopupModeFlags( GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); - sal_uInt16 nRet = pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_RIGHT, pMenu, pTimer == nullptr ); + FloatWinPopupFlags nOldFlags = GetPopupModeFlags(); + SetPopupModeFlags( GetPopupModeFlags() | FloatWinPopupFlags::NoAppFocusClose ); + sal_uInt16 nRet = pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FloatWinPopupFlags::Right, pMenu, pTimer == nullptr ); SetPopupModeFlags( nOldFlags ); // nRet != 0, wenn es waerend Activate() abgeschossen wurde... diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 0874091f37f2..2f5d8b54d332 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -76,7 +76,7 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo HitTest nHitTest = HITTEST_OUTSIDE; FloatingWindow* pFloat = pSVData->maWinData.mpFirstFloat->ImplFloatHitTest( pChild, rMousePos, nHitTest ); FloatingWindow* pLastLevelFloat; - sal_uLong nPopupFlags; + FloatWinPopupFlags nPopupFlags; if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE ) { if ( bMouseLeave ) @@ -105,7 +105,7 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo } else if ( nHitTest == HITTEST_RECT ) { - if ( !(pFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE) ) + if ( !(pFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoMouseRectClose) ) pFloat->ImplSetMouseDown(); return true; } @@ -125,7 +125,7 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo { pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat(); nPopupFlags = pLastLevelFloat->GetPopupModeFlags(); - if ( !(nPopupFlags & FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE) ) + if ( !(nPopupFlags & FloatWinPopupFlags::NoMouseUpClose) ) { pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); return true; @@ -139,9 +139,9 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo { pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat(); nPopupFlags = pLastLevelFloat->GetPopupModeFlags(); - if ( nPopupFlags & FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE ) + if ( nPopupFlags & FloatWinPopupFlags::AllMouseButtonClose ) { - if ( (nPopupFlags & FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE) && + if ( (nPopupFlags & FloatWinPopupFlags::NoMouseUpClose) && (nSVEvent == MouseNotifyEvent::MOUSEBUTTONUP) ) return true; pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); @@ -953,7 +953,7 @@ static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, if ( pSVData->maWinData.mpFirstFloat ) { FloatingWindow* pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat(); - if ( !(pLastLevelFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOKEYCLOSE) ) + if ( !(pLastLevelFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoKeyClose) ) { sal_uInt16 nEscCode = aKeyCode.GetCode(); @@ -976,7 +976,7 @@ static bool ImplHandleKey( vcl::Window* pWindow, MouseNotifyEvent nSVEvent, if ( pSVData->maWinData.mpFirstFloat ) { FloatingWindow* pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat(); - if ( !(pLastLevelFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOKEYCLOSE) ) + if ( !(pLastLevelFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoKeyClose) ) { sal_uInt16 nCode = aKeyCode.GetCode(); @@ -1651,7 +1651,7 @@ static void KillOwnPopups( vcl::Window* pWindow ) vcl::Window *pChild = pSVData->maWinData.mpFirstFloat; if ( pChild && pParent->ImplIsWindowOrChild( pChild, true ) ) { - if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE) ) + if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoAppFocusClose) ) pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); } } @@ -1916,7 +1916,7 @@ static void ImplHandleLoseFocus( vcl::Window* pWindow ) // is set, such that we do not show windows during the switch if ( pSVData->maWinData.mpFirstFloat ) { - if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE) ) + if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoAppFocusClose) ) pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); } diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index e16074b15b04..06d47483a9f2 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2988,7 +2988,7 @@ long X11SalFrame::HandleMouseEvent( XEvent *pEvent ) if ( pSVData->maWinData.mpFirstFloat ) { static const char* pEnv = getenv( "SAL_FLOATWIN_NOAPPFOCUSCLOSE" ); - if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE) && !(pEnv && *pEnv) ) + if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoAppFocusClose) && !(pEnv && *pEnv) ) pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); } } @@ -3498,9 +3498,9 @@ long X11SalFrame::HandleFocusEvent( XFocusChangeEvent *pEvent ) if ((mpParent != NULL && nStyle_ == 0) && pSVData->maWinData.mpFirstFloat ) { - sal_uLong nMode = pSVData->maWinData.mpFirstFloat->GetPopupModeFlags(); + FloatWinPopupFlags nMode = pSVData->maWinData.mpFirstFloat->GetPopupModeFlags(); pSVData->maWinData.mpFirstFloat->SetPopupModeFlags( - nMode & ~(FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE)); + nMode & ~(FloatWinPopupFlags::NoAppFocusClose)); } return nRet; } diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 357393328638..e349aa1a2e4b 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -3292,7 +3292,7 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer if ( pSVData->maWinData.mpFirstFloat ) { static const char* pEnv = getenv( "SAL_FLOATWIN_NOAPPFOCUSCLOSE" ); - if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE) && !(pEnv && *pEnv) ) + if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoAppFocusClose) && !(pEnv && *pEnv) ) pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); } } |