diff options
Diffstat (limited to 'sc')
26 files changed, 169 insertions, 81 deletions
diff --git a/sc/inc/documentlinkmgr.hxx b/sc/inc/documentlinkmgr.hxx index 86dba66f2d3d..1fd1bc231e8d 100644 --- a/sc/inc/documentlinkmgr.hxx +++ b/sc/inc/documentlinkmgr.hxx @@ -15,7 +15,7 @@ class ScDocument; class SfxObjectShell; -namespace vcl { class Window; } +namespace weld { class Window; } namespace sfx2 { @@ -57,7 +57,7 @@ public: bool hasDdeLinks() const; bool hasDdeOrOleOrWebServiceLinks() const; - bool updateDdeOrOleOrWebServiceLinks(vcl::Window* pWin); + bool updateDdeOrOleOrWebServiceLinks(weld::Window* pWin); void updateDdeLink( const OUString& rAppl, const OUString& rTopic, const OUString& rItem ); diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx index 7515b21e29e9..d1cb884ca756 100644 --- a/sc/inc/validat.hxx +++ b/sc/inc/validat.hxx @@ -25,6 +25,7 @@ #include "scdllapi.h" namespace vcl { class Window; } +namespace weld { class Window; } namespace sc { @@ -74,10 +75,10 @@ private: OUString aErrorMessage; bool DoMacro( const ScAddress& rPos, const OUString& rInput, - ScFormulaCell* pCell, vcl::Window* pParent ) const; + ScFormulaCell* pCell, weld::Window* pParent ) const; bool DoScript( const ScAddress& rPos, const OUString& rInput, - ScFormulaCell* pCell, vcl::Window* pParent ) const; + ScFormulaCell* pCell, weld::Window* pParent ) const; using ScConditionEntry::operator==; diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 48b9c443990f..293641ac9d68 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -45,6 +45,7 @@ #include <vcl/virdev.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <inputopt.hxx> #include <global.hxx> @@ -864,8 +865,10 @@ void ScDocument::UpdateExternalRefLinks(vcl::Window* pWin) aBuf.append(ScResId(SCSTR_EXTDOC_NOT_LOADED)); aBuf.append("\n\n"); aBuf.append(aFile); - ScopedVclPtrInstance< MessageDialog > aBox(pWin, aBuf.makeStringAndClear()); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + aBuf.makeStringAndClear())); + xBox->run(); } pExternalRefMgr->enableDocTimer(true); diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 946f964cda05..5eb776843018 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -32,7 +32,7 @@ #include <basic/sbx.hxx> #include <svl/zforlist.hxx> #include <svl/sharedstringpool.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <rtl/math.hxx> @@ -181,7 +181,7 @@ bool ScValidationData::GetErrMsg( OUString& rTitle, OUString& rMsg, } bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput, - ScFormulaCell* pCell, vcl::Window* pParent ) const + ScFormulaCell* pCell, weld::Window* pParent ) const { ScDocument* pDocument = GetDocument(); SfxObjectShell* pDocSh = pDocument->GetDocumentShell(); @@ -251,9 +251,10 @@ bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput, // Macro not found (only with input) { //TODO: different error message, if found, but not bAllowed ?? - - ScopedVclPtrInstance< MessageDialog > aBox( pParent, ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND)); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND))); + xBox->run(); } return bScriptReturnedFalse; @@ -262,7 +263,7 @@ bool ScValidationData::DoScript( const ScAddress& rPos, const OUString& rInput, // true -> abort bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput, - ScFormulaCell* pCell, vcl::Window* pParent ) const + ScFormulaCell* pCell, weld::Window* pParent ) const { if ( SfxApplication::IsXScriptURL( aErrorTitle ) ) { @@ -356,9 +357,10 @@ bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput, if ( !bDone && !pCell ) // Macro not found (only with input) { //TODO: different error message, if found, but not bAllowed ?? - - ScopedVclPtrInstance< MessageDialog > aBox(pParent, ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND)); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_VALID_MACRONOTFOUND))); + xBox->run(); } return bRet; @@ -376,7 +378,7 @@ bool ScValidationData::DoError( vcl::Window* pParent, const OUString& rInput, const ScAddress& rPos ) const { if ( eErrorStyle == SC_VALERR_MACRO ) - return DoMacro( rPos, rInput, nullptr, pParent ); + return DoMacro( rPos, rInput, nullptr, pParent ? pParent->GetFrameWeld() : nullptr); // Output error message diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index bcad163d8623..5df04c90d1ae 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -24,6 +24,7 @@ #include <comphelper/string.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <reffact.hxx> #include <document.hxx> @@ -38,7 +39,16 @@ class DBSaveData; static DBSaveData* pSaveObj = nullptr; -#define ERRORBOX(s) ScopedVclPtrInstance<MessageDialog>(this, s)->Execute() +namespace +{ + void ERRORBOX(weld::Window* pParent, const OUString& rString) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + rString)); + xBox->run(); + } +} // class DBSaveData @@ -479,14 +489,14 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, Button*, void) } else { - ERRORBOX( aStrInvalid ); + ERRORBOX(GetFrameWeld(), aStrInvalid); m_pEdAssign->SetSelection( Selection( 0, SELECTION_MAX ) ); m_pEdAssign->GrabFocus(); } } else { - ERRORBOX( ScGlobal::GetRscString(STR_INVALIDNAME) ); + ERRORBOX(GetFrameWeld(), ScGlobal::GetRscString(STR_INVALIDNAME)); m_pEdName->SetSelection( Selection( 0, SELECTION_MAX ) ); m_pEdName->GrabFocus(); } diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 53c77d2aa706..22635dc8491b 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -36,7 +36,7 @@ #include <strings.hrc> #include <filtdlg.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svl/sharedstringpool.hxx> #include <o3tl/make_unique.hxx> @@ -680,7 +680,10 @@ IMPL_LINK( ScFilterDlg, EndDlgHdl, Button*, pBtn, void ) if (!pExpander->get_expanded()) pExpander->set_expanded(true); - ScopedVclPtrInstance<MessageDialog>(this, ScGlobal::GetRscString(STR_INVALID_TABREF))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_INVALID_TABREF))); + xBox->run(); pEdCopyArea->GrabFocus(); bAreaInputOk = false; } diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index fe441db8bd16..0df2ed7769df 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -36,10 +36,20 @@ #include <filtdlg.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> // DEFINE -------------------------------------------------------------------- -#define ERRORBOX(rid) ScopedVclPtrInstance<MessageDialog>(this, ScGlobal::GetRscString(rid))->Execute() +namespace +{ + void ERRORBOX(weld::Window* pParent, const char* rid) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(rid))); + xBox->run(); + } +} // class ScSpecialFilterDialog @@ -309,7 +319,7 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void ) if (!pExpander->get_expanded()) pExpander->set_expanded(true); - ERRORBOX( STR_INVALID_TABREF ); + ERRORBOX(GetFrameWeld(), STR_INVALID_TABREF); pEdCopyArea->GrabFocus(); bEditInputOk = false; } @@ -321,7 +331,7 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void ) if ( (nResult & ScRefFlags::VALID) == ScRefFlags::ZERO ) { - ERRORBOX( STR_INVALID_TABREF ); + ERRORBOX(GetFrameWeld(), STR_INVALID_TABREF); pEdFilterArea->GrabFocus(); bEditInputOk = false; } @@ -379,7 +389,7 @@ IMPL_LINK( ScSpecialFilterDlg, EndDlgHdl, Button*, pBtn, void ) } else { - ERRORBOX( STR_INVALID_QUERYAREA ); + ERRORBOX(GetFrameWeld(), STR_INVALID_QUERYAREA); pEdFilterArea->GrabFocus(); } } diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index 9ad1b3898960..58d2a7594dd3 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -20,6 +20,7 @@ #undef SC_DLLIMPLEMENTATION #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <i18nlangtag/languagetag.hxx> #include <svtools/collatorres.hxx> #include <unotools/collatorwrapper.hxx> @@ -810,7 +811,10 @@ DeactivateRC ScTabPageSortOptions::DeactivatePage( SfxItemSet* pSetP ) if ( !bPosInputOk ) { - ScopedVclPtrInstance<MessageDialog>(this, ScGlobal::GetRscString( STR_INVALID_TABREF))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_INVALID_TABREF))); + xBox->run(); m_pEdOutPos->GrabFocus(); m_pEdOutPos->SetSelection( Selection( 0, SELECTION_MAX ) ); theOutPos.Set(0,0,0); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index fc4f8829ada7..8721cecc6a97 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -119,9 +119,10 @@ void ScDocShell::ReloadAllLinks() getEmbeddedObjectContainer().setUserAllowsLinkUpdate(true); ReloadTabLinks(); - aDocument.UpdateExternalRefLinks(GetActiveDialogParent()); + vcl::Window *pDialogParent = GetActiveDialogParent(); + aDocument.UpdateExternalRefLinks(pDialogParent); - bool bAnyDde = aDocument.GetDocLinkManager().updateDdeOrOleOrWebServiceLinks(GetActiveDialogParent()); + bool bAnyDde = aDocument.GetDocLinkManager().updateDdeOrOleOrWebServiceLinks(pDialogParent ? pDialogParent->GetFrameWeld() : nullptr); if (bAnyDde) { diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx index f71fe99d1bb3..c0fcfe0920ab 100644 --- a/sc/source/ui/docshell/documentlinkmgr.cxx +++ b/sc/source/ui/docshell/documentlinkmgr.cxx @@ -25,7 +25,8 @@ #include <scresid.hxx> #include <o3tl/deleter.hxx> #include <svx/svdoole2.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <memory> @@ -144,7 +145,7 @@ bool DocumentLinkManager::hasDdeOrOleOrWebServiceLinks(bool bDde, bool bOle, boo return false; } -bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(vcl::Window* pWin) +bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(weld::Window* pWin) { if (!mpImpl->mpLinkManager) return false; @@ -195,8 +196,10 @@ bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(vcl::Window* pWin) aBuf.append(aElem); aBuf.append("\nType : "); aBuf.append(aType); - ScopedVclPtrInstance< MessageDialog > aBox(pWin, aBuf.makeStringAndClear()); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin, + VclMessageType::Warning, VclButtonsType::Ok, + aBuf.makeStringAndClear())); + xBox->run(); } } diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index 445d6193b239..fd3cd6d7c700 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -303,8 +303,8 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell* pViewSh, // really store as link only? if( bAsLink && SvtMiscOptions().ShowLinkWarningDialog() ) { - ScopedVclPtrInstance< SvxLinkWarningDialog > aWarnDlg(pWin,aFileName); - if( aWarnDlg->Execute() != RET_OK ) + SvxLinkWarningDialog aWarnDlg(pWin ? pWin->GetFrameWeld() : nullptr, aFileName); + if (aWarnDlg.run() != RET_OK) bAsLink = false; // don't store as link } @@ -377,7 +377,7 @@ FuInsertMedia::FuInsertMedia( ScTabViewShell* pViewSh, pWin->LeaveWait(); if( !bAPI ) - ::avmedia::MediaWindow::executeFormatErrorBox( pWindow ); + ::avmedia::MediaWindow::executeFormatErrorBox(pWindow ? pWindow->GetFrameWeld() : nullptr); } else #endif diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx index 02e7a0b4cbb8..90e408290f40 100644 --- a/sc/source/ui/drawfunc/graphsh.cxx +++ b/sc/source/ui/drawfunc/graphsh.cxx @@ -271,7 +271,7 @@ void ScGraphicShell::ExecuteSaveGraphic( SAL_UNUSED_PARAMETER SfxRequest& /*rReq { if (pWin) { - nState = GraphicHelper::HasToSaveTransformedImage(pWin); + nState = GraphicHelper::HasToSaveTransformedImage(pWin->GetFrameWeld()); } } else diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 1931a73b5cc8..7eae143a4565 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -24,9 +24,19 @@ #include <docsh.hxx> #include <crnrdlg.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <memory> -#define ERRORBOX(s) ScopedVclPtrInstance<MessageDialog>(this, s)->Execute() +namespace +{ + void ERRORBOX(weld::Window* pParent, const OUString& rString) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + rString)); + } +} + #define QUERYBOX(m) ScopedVclPtrInstance<QueryBox>(this, MessBoxStyle::YesNo|MessBoxStyle::DefaultYes, m)->Execute() const sal_uLong nEntryDataCol = 0; @@ -563,7 +573,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, AddBtnHdl, Button*, void) } else { - ERRORBOX( ScGlobal::GetRscString(STR_INVALIDTABNAME) ); + ERRORBOX(GetFrameWeld(), ScGlobal::GetRscString(STR_INVALIDTABNAME)); if ( !bOk1 ) pEdAssign->GrabFocus(); else diff --git a/sc/source/ui/miscdlgs/filldlg.cxx b/sc/source/ui/miscdlgs/filldlg.cxx index ab336f0bd816..c6ea273083e5 100644 --- a/sc/source/ui/miscdlgs/filldlg.cxx +++ b/sc/source/ui/miscdlgs/filldlg.cxx @@ -20,7 +20,8 @@ #undef SC_DLLIMPLEMENTATION #include <svl/zforlist.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <limits.h> #include <scresid.hxx> @@ -321,7 +322,9 @@ IMPL_LINK_NOARG(ScFillSeriesDlg, OKHdl, Button*, void) EndDialog( RET_OK ); else { - ScopedVclPtrInstance<MessageDialog>(this, aErrMsgInvalidVal)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, + VclButtonsType::Ok, aErrMsgInvalidVal)); + xBox->run(); pEdWrong->GrabFocus(); } } diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index fd7aa9a20df9..f5b5dc11f51c 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -26,6 +26,7 @@ #include <svtools/ehdl.hxx> #include <svtools/sfxecode.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <global.hxx> #include <docsh.hxx> @@ -300,7 +301,9 @@ IMPL_LINK_NOARG(ScInsertTableDlg, DoEnterHdl, Button*, void) else { OUString aErrMsg ( ScGlobal::GetRscString( STR_INVALIDTABNAME ) ); - (void)ScopedVclPtrInstance<MessageDialog>(this, aErrMsg)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, + VclButtonsType::Ok, aErrMsg)); + xBox->run(); } } diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 89594f57ab5b..73141f48b822 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -24,6 +24,7 @@ #include <vcl/builderfactory.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <uiitems.hxx> @@ -778,7 +779,10 @@ IMPL_LINK( ScOptSolverDlg, CursorDownHdl, ScCursorRefEdit&, rEdit, void ) void ScOptSolverDlg::ShowError( bool bCondition, formula::RefEdit* pFocus ) { OUString aMessage = bCondition ? maConditionError : maInputError; - ScopedVclPtrInstance<MessageDialog>(this, aMessage)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + aMessage)); + xBox->run(); if (pFocus) { mpEdActive = pFocus; diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx index eb9276d77e60..455091f6f86e 100644 --- a/sc/source/ui/miscdlgs/scuiautofmt.cxx +++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx @@ -33,6 +33,7 @@ #include <editeng/wghtitem.hxx> #include <svl/zforlist.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <comphelper/processfactory.hxx> #include <sfx2/strings.hrc> #include <sfx2/sfxresid.hxx> @@ -262,11 +263,11 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, AddHdl, Button*, void) if ( !bFmtInserted ) { - sal_uInt16 nRet = ScopedVclPtrInstance<MessageDialog>(this, - ScGlobal::GetRscString(STR_INVALID_AFNAME), - VclMessageType::Error, - VclButtonsType::OkCancel - )->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Error, VclButtonsType::OkCancel, + ScGlobal::GetRscString(STR_INVALID_AFNAME))); + + sal_uInt16 nRet = xBox->run(); bOk = ( nRet == RET_CANCEL ); } @@ -381,11 +382,11 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RenameHdl, Button*, void) } if( !bFmtRenamed ) { - bOk = RET_CANCEL == ScopedVclPtrInstance<MessageDialog>( this, - ScGlobal::GetRscString(STR_INVALID_AFNAME), - VclMessageType::Error, - VclButtonsType::OkCancel - )->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Error, VclButtonsType::OkCancel, + ScGlobal::GetRscString(STR_INVALID_AFNAME))); + + bOk = RET_CANCEL == xBox->run(); } } else diff --git a/sc/source/ui/miscdlgs/solvrdlg.cxx b/sc/source/ui/miscdlgs/solvrdlg.cxx index a3b81600872a..919bf98b91c2 100644 --- a/sc/source/ui/miscdlgs/solvrdlg.cxx +++ b/sc/source/ui/miscdlgs/solvrdlg.cxx @@ -22,6 +22,7 @@ #include <sfx2/dispatch.hxx> #include <svl/zforlist.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <uiitems.hxx> #include <reffact.hxx> @@ -33,9 +34,12 @@ namespace { - void lclErrorDialog( vcl::Window* pParent, const OUString& aString ) + void lclErrorDialog(weld::Window* pParent, const OUString& rString) { - ScopedVclPtrInstance<MessageDialog>(pParent, aString)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + rString)); + xBox->run(); } } @@ -163,22 +167,22 @@ void ScSolverDlg::RaiseError( ScSolverErr eError ) switch ( eError ) { case SOLVERR_NOFORMULA: - lclErrorDialog( this, errMsgNoFormula ); + lclErrorDialog(GetFrameWeld() , errMsgNoFormula); m_pEdFormulaCell->GrabFocus(); break; case SOLVERR_INVALID_FORMULA: - lclErrorDialog( this, errMsgInvalidForm ); + lclErrorDialog(GetFrameWeld(), errMsgInvalidForm); m_pEdFormulaCell->GrabFocus(); break; case SOLVERR_INVALID_VARIABLE: - lclErrorDialog( this, errMsgInvalidVar ); + lclErrorDialog(GetFrameWeld(), errMsgInvalidVar); m_pEdVariableCell->GrabFocus(); break; case SOLVERR_INVALID_TARGETVALUE: - lclErrorDialog( this, errMsgInvalidVal ); + lclErrorDialog(GetFrameWeld(), errMsgInvalidVal); m_pEdTargetVal->GrabFocus(); break; } diff --git a/sc/source/ui/miscdlgs/tabopdlg.cxx b/sc/source/ui/miscdlgs/tabopdlg.cxx index 50bfa8180ec9..bb9e456bf822 100644 --- a/sc/source/ui/miscdlgs/tabopdlg.cxx +++ b/sc/source/ui/miscdlgs/tabopdlg.cxx @@ -19,7 +19,7 @@ #include <scitems.hxx> #include <sfx2/dispatch.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <uiitems.hxx> #include <global.hxx> @@ -224,7 +224,9 @@ void ScTabOpDlg::RaiseError( ScTabOpErr eError ) break; } - ScopedVclPtrInstance<MessageDialog>(this, *pMsg, VclMessageType::Error, VclButtonsType::OkCancel)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Error, VclButtonsType::OkCancel, *pMsg)); + xBox->run(); pEd->GrabFocus(); } diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx index 4a2e0a4e1a4a..3351289b43ce 100644 --- a/sc/source/ui/optdlg/tpcalc.cxx +++ b/sc/source/ui/optdlg/tpcalc.cxx @@ -21,6 +21,7 @@ #include <scitems.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <global.hxx> #include <globstr.hrc> @@ -235,9 +236,9 @@ DeactivateRC ScTpCalcOptions::DeactivatePage( SfxItemSet* pSetP ) if ( nReturn == DeactivateRC::KeepPage ) { - ScopedVclPtrInstance<MessageDialog>( this, - ScGlobal::GetRscString( STR_INVALID_EPS ) - )->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, + VclButtonsType::Ok, ScGlobal::GetRscString(STR_INVALID_EPS))); + xBox->run(); m_pEdEps->GrabFocus(); } diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index c43a82f5959a..4eb077076728 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -21,6 +21,7 @@ #include <comphelper/string.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <global.hxx> #include <document.hxx> @@ -692,9 +693,11 @@ IMPL_LINK( ScTpUserLists, BtnClickHdl, Button*, pBtn, void ) } else { - ScopedVclPtrInstance<MessageDialog>(this, - ScGlobal::GetRscString( STR_INVALID_TABREF ) - )->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_INVALID_TABREF))); + + xBox->run(); mpEdCopyFrom->GrabFocus(); mpEdCopyFrom->SetSelection( Selection( 0, SELECTION_MAX ) ); } diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index 1ad3ebf896e2..89082ccfa240 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -23,6 +23,7 @@ #include <sfx2/dispatch.hxx> #include <svl/stritem.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <unotools/charclass.hxx> #include <stdlib.h> @@ -51,7 +52,16 @@ enum { }; #define HDL(hdl) LINK( this, ScPrintAreasDlg, hdl ) -#define ERRORBOX(nId) ScopedVclPtrInstance<MessageDialog>(this, ScGlobal::GetRscString(nId))->Execute() +namespace +{ + void ERRORBOX(weld::Window* pParent, const char* rId) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(rId))); + xBox->run(); + } +} // global functions (->at the end of the file): @@ -381,7 +391,7 @@ bool ScPrintAreasDlg::Impl_CheckRefStrings() else if ( !bRepeatRowOk ) pEd = pEdRepeatRow; else if ( !bRepeatColOk ) pEd = pEdRepeatCol; - ERRORBOX( STR_INVALID_TABREF ); + ERRORBOX(GetFrameWeld(), STR_INVALID_TABREF); OSL_ASSERT(pEd); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index d40a11d2dd79..ce2c030ac55c 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -26,6 +26,7 @@ #include <sfx2/request.hxx> #include <svl/stritem.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sfx2/app.hxx> #include <globstr.hrc> #include <scmod.hxx> @@ -429,9 +430,11 @@ void ScCellShell::Execute( SfxRequest& rReq ) } else if( ! rReq.IsAPI() ) { - ScopedVclPtrInstance<MessageDialog> aErrorBox(pTabViewShell->GetDialogParent(), - ScGlobal::GetRscString(STR_NOAREASELECTED)); - aErrorBox->Execute(); + vcl::Window* pWin = pTabViewShell->GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_NOAREASELECTED))); + xErrorBox->run(); } } else @@ -883,8 +886,12 @@ void ScCellShell::Execute( SfxRequest& rReq ) } } else - ScopedVclPtrInstance<MessageDialog>(pDlgParent, - ScGlobal::GetRscString(STR_INVALID_AFAREA) )->Execute(); + { + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pDlgParent ? pDlgParent->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_INVALID_AFAREA))); + xErrorBox->run(); + } } break; diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 707a487c3067..f72d8bdecb35 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -21,6 +21,7 @@ #include <sfx2/app.hxx> #include <sfx2/bindings.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/sdbc/XResultSet.hpp> @@ -365,9 +366,11 @@ void ScDBFunc::ToggleAutoFilter() } else { - ScopedVclPtrInstance<MessageDialog> aErrorBox(GetViewData().GetDialogParent(), - ScGlobal::GetRscString(STR_ERR_AUTOFILTER)); - aErrorBox->Execute(); + vcl::Window* pWin = GetViewData().GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_ERR_AUTOFILTER))); + xErrorBox->run(); } } diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index f315b6cbe89f..75f2d375a2cb 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -30,6 +30,7 @@ #include <svl/stritem.hxx> #include <svl/whiter.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sfx2/objface.hxx> #include <svx/svxdlg.hxx> #include <editeng/colritem.hxx> @@ -428,9 +429,10 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) } else { - nRet = ScopedVclPtrInstance<MessageDialog>(GetDialogParent(), - aErrMsg - )->Execute(); + vcl::Window* pWin = GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, aErrMsg)); + nRet = xBox->run(); } } } diff --git a/sc/uiconfig/scalc/ui/queryrunstreamscriptdialog.ui b/sc/uiconfig/scalc/ui/queryrunstreamscriptdialog.ui index a46d426f18f1..a7f7ceb633a2 100644 --- a/sc/uiconfig/scalc/ui/queryrunstreamscriptdialog.ui +++ b/sc/uiconfig/scalc/ui/queryrunstreamscriptdialog.ui @@ -4,7 +4,6 @@ <requires lib="gtk+" version="3.0"/> <object class="GtkMessageDialog" id="QueryRunStreamScriptDialog"> <property name="can_focus">False</property> - <property name="border_width">6</property> <property name="resizable">False</property> <property name="type_hint">dialog</property> <property name="skip_taskbar_hint">True</property> @@ -19,7 +18,6 @@ <child internal-child="action_area"> <object class="GtkButtonBox" id="messagedialog-action_area"> <property name="can_focus">False</property> - <property name="layout_style">end</property> </object> <packing> <property name="expand">False</property> |