diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-06 14:07:17 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-05-06 12:12:26 +0000 |
commit | 39078c247d31674544901f8449f5141185f79f7f (patch) | |
tree | cedf9386e7ddd05996a7755853e6eb2e6adac5fd | |
parent | 7847a338f13071dcd591617f0e8d8fd69b2b0818 (diff) |
cleanup DIALOG_NO_PARENT, follow on to tdf#91090
remove the DIALOG_NO_PARENT abomination and replace it with a flags
parameter
Change-Id: I71b7dc46c619f2db56af6d4dc2c17daf0a2c8534
Reviewed-on: https://gerrit.libreoffice.org/15645
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_dialog2.cxx | 4 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_dialog2.hxx | 2 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 8 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfilterdialogcomponent.cxx | 9 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 5 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltersettingsdialog.hxx | 3 | ||||
-rw-r--r-- | include/toolkit/awt/scrollabledialog.hxx | 2 | ||||
-rw-r--r-- | include/vcl/dialog.hxx | 17 | ||||
-rw-r--r-- | sw/qa/tiledrendering/tiledrendering.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/awt/scrollabledialog.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 5 | ||||
-rw-r--r-- | vcl/source/uipreviewer/previewer.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 18 |
13 files changed, 40 insertions, 41 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 7978b440688a..4b3fb8fcee37 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -668,8 +668,8 @@ void DialogHelper::PostUserEvent( const Link<>& rLink, void* pCaller ) } // ExtMgrDialog -ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager) - : ModelessDialog(pParent, "ExtensionManagerDialog", "desktop/ui/extensionmanager.ui") +ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager, Dialog::InitFlag eFlag) + : ModelessDialog(pParent, "ExtensionManagerDialog", "desktop/ui/extensionmanager.ui", eFlag) , DialogHelper(pManager->getContext(), (Dialog*) this) , m_sAddPackages(getResourceString(RID_STR_ADD_PACKAGES)) , m_bHasProgress(false) diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 75e52f0c1f9c..46a0c9e3f448 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -139,7 +139,7 @@ class ExtMgrDialog : public ModelessDialog, DECL_DLLPRIVATE_LINK( startProgress, void * ); public: - ExtMgrDialog( vcl::Window * pParent, TheExtensionManager *pManager ); + ExtMgrDialog( vcl::Window * pParent, TheExtensionManager *pManager, Dialog::InitFlag eFlag = Dialog::InitFlag::Default ); virtual ~ExtMgrDialog(); virtual void dispose() SAL_OVERRIDE; diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index fa42dc29ff94..ccf0b54ff150 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -120,12 +120,10 @@ void TheExtensionManager::createDialog( const bool bCreateUpdDlg ) } else if ( !m_pExtMgrDialog ) { - // FIXME: horrible ... - vcl::Window* pParent = DIALOG_NO_PARENT; if (m_xParent.is()) - pParent = VCLUnoHelper::GetWindow(m_xParent); - - m_pExtMgrDialog = VclPtr<ExtMgrDialog>::Create( pParent, this ); + m_pExtMgrDialog = VclPtr<ExtMgrDialog>::Create( VCLUnoHelper::GetWindow(m_xParent), this ); + else + m_pExtMgrDialog = VclPtr<ExtMgrDialog>::Create( nullptr, this, Dialog::InitFlag::NoParent ); delete m_pExecuteCmdQueue; m_pExecuteCmdQueue = new ExtensionCmdQueue( m_pExtMgrDialog.get(), this, m_xContext ); m_pExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL ); diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index 5d710e5b8e5d..ef70707dfd11 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -326,12 +326,11 @@ sal_Int16 SAL_CALL XMLFilterDialogComponent::execute( ) throw(RuntimeException, if( nullptr == mpDialog ) { - vcl::Window* pParent = DIALOG_NO_PARENT; - if (mxParent.is()) - pParent = VCLUnoHelper::GetWindow(mxParent); - Reference< XComponent > xComp( this ); - mpDialog = VclPtr<XMLFilterSettingsDialog>::Create(pParent, mxContext); + if (mxParent.is()) + mpDialog = VclPtr<XMLFilterSettingsDialog>::Create(VCLUnoHelper::GetWindow(mxParent), mxContext); + else + mpDialog = VclPtr<XMLFilterSettingsDialog>::Create(nullptr, mxContext, Dialog::InitFlag::NoParent); mpDialog->Execute(); } else if( !mpDialog->IsVisible() ) diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 98e356c2a7fa..3a09f866b350 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -56,8 +56,9 @@ using namespace com::sun::star::util; using ::rtl::Uri; XMLFilterSettingsDialog::XMLFilterSettingsDialog(vcl::Window* pParent, - const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext) - : ModelessDialog(pParent, "XMLFilterSettingsDialog", "filter/ui/xmlfiltersettings.ui") + const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, + Dialog::InitFlag eFlag) + : ModelessDialog(pParent, "XMLFilterSettingsDialog", "filter/ui/xmlfiltersettings.ui", eFlag) , mxContext( rxContext ) , m_bIsClosable(true) , m_sTemplatePath("$(user)/template/") diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx index a6ef194eb081..0e40a14a24f3 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx @@ -86,7 +86,8 @@ class XMLFilterSettingsDialog : public ModelessDialog { public: XMLFilterSettingsDialog(vcl::Window* pParent, - const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext); + const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, + Dialog::InitFlag eFlag = Dialog::InitFlag::Default); virtual ~XMLFilterSettingsDialog(); virtual void dispose() SAL_OVERRIDE; diff --git a/include/toolkit/awt/scrollabledialog.hxx b/include/toolkit/awt/scrollabledialog.hxx index 70e2b32be919..a085e652b3f9 100644 --- a/include/toolkit/awt/scrollabledialog.hxx +++ b/include/toolkit/awt/scrollabledialog.hxx @@ -57,7 +57,7 @@ namespace toolkit ScrollBarVisibility maScrollVis; void lcl_Scroll( long nX, long nY ); public: - ScrollableWrapper( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG ); + ScrollableWrapper( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG, Dialog::InitFlag eFlag = Dialog::InitFlag::Default ); virtual ~ScrollableWrapper(); virtual void dispose() SAL_OVERRIDE; virtual void SetScrollWidth( long nWidth ) SAL_OVERRIDE; diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index cf71d70d3443..4678645a60cf 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -26,11 +26,6 @@ #include <vcl/timer.hxx> #include <vcl/vclptr.hxx> -// parameter to pass to the dialog constructor if really no parent is wanted -// whereas NULL chooses the default dialog parent -#define DIALOG_NO_PARENT (reinterpret_cast<vcl::Window*>(sal_IntPtr(-1))) - - // - Dialog - struct DialogImpl; @@ -39,6 +34,9 @@ class VclButtonBox; class VCL_DLLPUBLIC Dialog : public SystemWindow { +public: + enum class InitFlag { Default, NoParent }; + private: VclPtr<Dialog> mpPrevExecuteDlg; DialogImpl* mpDialogImpl; @@ -47,6 +45,7 @@ private: bool mbOldSaveBack; bool mbInClose; bool mbModalMode; + InitFlag mnInitFlag; // used for deferred init VclPtr<VclButtonBox> mpActionArea; VclPtr<VclBox> mpContentArea; @@ -61,7 +60,7 @@ private: protected: using Window::ImplInit; - SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag = InitFlag::Default ); public: SAL_DLLPRIVATE bool IsInClose() const { return mbInClose; } @@ -69,7 +68,7 @@ public: protected: explicit Dialog( WindowType nType ); - explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType ); + explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType, InitFlag eFlag = InitFlag::Default ); virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; virtual void settingOptimalLayoutSize(Window *pBox) SAL_OVERRIDE; @@ -79,7 +78,7 @@ protected: void set_content_area(VclBox* pBox); public: - explicit Dialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG ); + explicit Dialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG, InitFlag eFlag = InitFlag::Default ); explicit Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ); virtual ~Dialog(); virtual void dispose() SAL_OVERRIDE; @@ -131,7 +130,7 @@ class VCL_DLLPUBLIC ModelessDialog : public Dialog ModelessDialog & operator= (const ModelessDialog &) SAL_DELETED_FUNCTION; public: - explicit ModelessDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ); + explicit ModelessDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, Dialog::InitFlag eFlag = Dialog::InitFlag::Default ); }; // - ModalDialog - diff --git a/sw/qa/tiledrendering/tiledrendering.cxx b/sw/qa/tiledrendering/tiledrendering.cxx index af67aee607d8..8aade3602440 100644 --- a/sw/qa/tiledrendering/tiledrendering.cxx +++ b/sw/qa/tiledrendering/tiledrendering.cxx @@ -68,7 +68,7 @@ private: public: TiledRenderingDialog(TiledRenderingApp * app) : - ModalDialog(DIALOG_NO_PARENT, "TiledRendering", "qa/sw/ui/tiledrendering.ui"), + ModalDialog(nullptr, "TiledRendering", "qa/sw/ui/tiledrendering.ui", Dialog::InitFlag::NoParent), mpApp(app) { VclPtr<PushButton> renderButton; diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx index 08c72bb8c92c..4e552d3e3fc4 100644 --- a/toolkit/source/awt/scrollabledialog.cxx +++ b/toolkit/source/awt/scrollabledialog.cxx @@ -31,8 +31,8 @@ namespace toolkit // in the same bitmap :-( WB_VSCROLL & WB_HSCROLL apparently are only for // child classes ( whole thing is a mess if you ask me ) template< class T> -ScrollableWrapper<T>::ScrollableWrapper( vcl::Window* pParent, WinBits nStyle ) - : T( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) ), +ScrollableWrapper<T>::ScrollableWrapper( vcl::Window* pParent, WinBits nStyle, Dialog::InitFlag eFlag ) + : T( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ), eFlag ), maHScrollBar( VclPtr<ScrollBar>::Create(this, WB_HSCROLL | WB_DRAG) ), maVScrollBar( VclPtr<ScrollBar>::Create(this, WB_VSCROLL | WB_DRAG) ), mbHasHoriBar( false ), diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 05b233013916..9ef383ddf35b 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -917,8 +917,9 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp, { // Modal/Modeless nur durch Show/Execute if ( (pParent == NULL ) && ( rDescriptor.ParentIndex == -1 ) ) - pParent = DIALOG_NO_PARENT; - pNewWindow = new toolkit::ScrollableWrapper<Dialog>( pParent, nWinBits ); + pNewWindow = new toolkit::ScrollableWrapper<Dialog>( nullptr, nWinBits, Dialog::InitFlag::NoParent ); + else + pNewWindow = new toolkit::ScrollableWrapper<Dialog>( pParent, nWinBits ); // #i70217# Don't always create a new component object. It's possible that VCL has called // GetComponentInterface( sal_True ) in the Dialog ctor itself (see Window::IsTopWindow() ) // which creates a component object. diff --git a/vcl/source/uipreviewer/previewer.cxx b/vcl/source/uipreviewer/previewer.cxx index 47a5c28e7d3a..de041495b92c 100644 --- a/vcl/source/uipreviewer/previewer.cxx +++ b/vcl/source/uipreviewer/previewer.cxx @@ -68,7 +68,7 @@ int UIPreviewApp::Main() try { - VclPtrInstance<Dialog> pDialog(DIALOG_NO_PARENT, WB_STDDIALOG | WB_SIZEABLE); + VclPtrInstance<Dialog> pDialog(nullptr, WB_STDDIALOG | WB_SIZEABLE, Dialog::InitFlag::NoParent); { VclBuilder aBuilder(pDialog, OUString(), uifiles[0]); vcl::Window *pRoot = aBuilder.get_widget_root(); diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index e72bf4f383c8..0e55548c2edb 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -353,7 +353,7 @@ void Dialog::ImplInitDialogData() mpDialogImpl = new DialogImpl; } -void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle ) +void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag ) { SystemWindowFlags nSysWinMode = Application::GetSystemWindowMode(); @@ -392,8 +392,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle ) } } } - // DIALOG_NO_PARENT: explicitly don't have a parent for this Dialog - else if( pParent == DIALOG_NO_PARENT ) + else if( eFlag == InitFlag::Default ) pParent = NULL; if ( !pParent || (nStyle & WB_SYSTEMWINDOW) || @@ -490,7 +489,7 @@ void Dialog::doDeferredInit(WinBits nBits) { VclPtr<vcl::Window> pParent = mpDialogParent; mpDialogParent = NULL; - ImplInit(pParent, nBits); + ImplInit(pParent, nBits, mnInitFlag); mbIsDefferedInit = false; } @@ -501,18 +500,19 @@ Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXML loadUI(pParent, OUStringToOString(rID, RTL_TEXTENCODING_UTF8), rUIXMLDescription); } -Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType) +Dialog::Dialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, WindowType nType, InitFlag eFlag) : SystemWindow(nType) { ImplInitDialogData(); loadUI(pParent, OUStringToOString(rID, RTL_TEXTENCODING_UTF8), rUIXMLDescription); + mnInitFlag = eFlag; } -Dialog::Dialog(vcl::Window* pParent, WinBits nStyle) +Dialog::Dialog(vcl::Window* pParent, WinBits nStyle, InitFlag eFlag) : SystemWindow(WINDOW_DIALOG) { ImplInitDialogData(); - ImplInit( pParent, nStyle ); + ImplInit( pParent, nStyle, eFlag ); } void Dialog::set_action_area(VclButtonBox* pBox) @@ -1130,8 +1130,8 @@ VclBuilderContainer::~VclBuilderContainer() delete m_pUIBuilder; } -ModelessDialog::ModelessDialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription) - : Dialog(pParent, rID, rUIXMLDescription, WINDOW_MODELESSDIALOG) +ModelessDialog::ModelessDialog(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, InitFlag eFlag) + : Dialog(pParent, rID, rUIXMLDescription, WINDOW_MODELESSDIALOG, eFlag) { } |