summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx39
-rw-r--r--sc/source/ui/docshell/docfunc.cxx11
-rw-r--r--sc/source/ui/docshell/docsh.cxx28
-rw-r--r--sc/source/ui/docshell/docsh3.cxx9
-rw-r--r--sc/source/ui/docshell/docsh4.cxx27
5 files changed, 77 insertions, 37 deletions
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 1c413903a35a..841b1c792486 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1298,9 +1298,12 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
// OutRange of pOldObj (pDestObj) is still old area
if (!lcl_EmptyExcept(&rDoc, aNewOut, pOldObj->GetOutRange()))
{
- ScopedVclPtrInstance<QueryBox> aBox( ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
- ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) );
- if (aBox->Execute() == RET_NO)
+ vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo,
+ ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY)));
+ xQueryBox->set_default_response(RET_YES);
+ if (xQueryBox->run() == RET_NO)
{
//! like above (not editable)
*pOldObj = aUndoDPObj;
@@ -1349,10 +1352,12 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
if (pModel && !aListOfObjects.empty())
{
- ScopedVclPtrInstance<QueryBox> aBox(
- ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
- ScGlobal::GetRscString(STR_PIVOT_REMOVE_PIVOTCHART));
- if (aBox->Execute() == RET_NO)
+ vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo,
+ ScGlobal::GetRscString(STR_PIVOT_REMOVE_PIVOTCHART)));
+ xQueryBox->set_default_response(RET_YES);
+ if (xQueryBox->run() == RET_NO)
{
return false;
}
@@ -1493,11 +1498,12 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
if (!bEmpty)
{
- ScopedVclPtrInstance<QueryBox> aBox(
- ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
- ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY));
-
- if (aBox->Execute() == RET_NO)
+ vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo,
+ ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY)));
+ xQueryBox->set_default_response(RET_YES);
+ if (xQueryBox->run() == RET_NO)
{
//! like above (not editable)
return false;
@@ -1567,9 +1573,12 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
{
if (!lcl_EmptyExcept(&rDoc, aNewOut, rDPObj.GetOutRange()))
{
- ScopedVclPtrInstance<QueryBox> aBox( ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
- ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) );
- if (aBox->Execute() == RET_NO)
+ vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo,
+ ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY)));
+ xQueryBox->set_default_response(RET_YES);
+ if (xQueryBox->run() == RET_NO)
{
rDPObj = aUndoDPObj;
return false;
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 4ac78e1b67a0..e8705d760aa0 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5106,9 +5106,14 @@ void ScDocFunc::CreateOneName( ScRangeName& rList,
aMessage += aName;
aMessage += aTemplate.getToken( 1, '#' );
- short nResult = ScopedVclPtrInstance<QueryBox>( ScDocShell::GetActiveDialogParent(),
- MessBoxStyle::YesNoCancel | MessBoxStyle::DefaultYes,
- aMessage )->Execute();
+ vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo,
+ aMessage));
+ xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
+ xQueryBox->set_default_response(RET_YES);
+
+ short nResult = xQueryBox->run();
if ( nResult == RET_YES )
{
rList.erase(*pOld);
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 7815e68d5566..767d5a502827 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -26,6 +26,7 @@
#include <comphelper/classids.hxx>
#include <formula/errorcodes.hxx>
#include <vcl/msgbox.hxx>
+#include <vcl/weld.hxx>
#include <vcl/virdev.hxx>
#include <vcl/waitobj.hxx>
#include <rtl/bootstrap.hxx>
@@ -473,14 +474,29 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css
{
// Generator is not LibreOffice. Ask if the user wants to perform
// full re-calculation.
- ScopedVclPtrInstance<QueryBox> aBox(
- GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
- ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS));
- aBox->SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED));
+ vcl::Window* pWin = GetActiveDialogParent();
- bHardRecalc = aBox->Execute() == RET_YES;
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr,
+ "modules/scalc/ui/recalcquerydialog.ui"));
+ std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("RecalcQueryDialog"));
+ xQueryBox->set_primary_text(ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS));
+ xQueryBox->set_default_response(RET_YES);
+ std::unique_ptr<weld::CheckButton> xWarningOnBox(xBuilder->weld_check_button("ask"));
- if (aBox->GetCheckBoxState())
+ //fdo#75121, a bit tricky because the widgets we want to align with
+ //don't actually exist in the ui description, they're implied
+ std::unique_ptr<weld::Container> xOrigParent(xWarningOnBox->weld_parent());
+ std::unique_ptr<weld::Container> xContentArea(xQueryBox->weld_message_area());
+ xOrigParent->remove(xWarningOnBox.get());
+ xContentArea->add(xWarningOnBox.get());
+
+ bHardRecalc = xQueryBox->run() == RET_YES;
+
+ //put them back as they were
+ xContentArea->remove(xWarningOnBox.get());
+ xOrigParent->add(xWarningOnBox.get());
+
+ if (xWarningOnBox->get_active())
{
// Always perform selected action in the future.
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index f13a23113498..582f39aad829 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -1204,9 +1204,12 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell )
ScopedVclPtrInstance< ScConflictsDlg > aDlg( GetActiveDialogParent(), GetViewData(), &rSharedDoc, aConflictsList );
if ( aDlg->Execute() == RET_CANCEL )
{
- ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
- ScGlobal::GetRscString( STR_DOC_WILLNOTBESAVED ) );
- if ( aBox->Execute() == RET_YES )
+ vcl::Window* pWin = GetActiveDialogParent();
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo,
+ ScGlobal::GetRscString(STR_DOC_WILLNOTBESAVED)));
+ xQueryBox->set_default_response(RET_YES);
+ if (xQueryBox->run() == RET_YES)
{
return false;
}
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 749ec29784a7..17f597270876 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -261,8 +261,11 @@ void ScDocShell::Execute( SfxRequest& rReq )
aMessage += sTarget;
aMessage += aTemplate.getToken( 1, '#' );
- ScopedVclPtrInstance< QueryBox > aBox( nullptr, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, aMessage );
- bDo = ( aBox->Execute() == RET_YES );
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo,
+ aMessage));
+ xQueryBox->set_default_response(RET_YES);
+ bDo = xQueryBox->run() == RET_YES;
}
if (bDo)
@@ -521,9 +524,12 @@ void ScDocShell::Execute( SfxRequest& rReq )
OSL_ENSURE(pViewSh,"SID_REIMPORT_AFTER_LOAD: no View");
if (pViewSh && pDBColl)
{
- ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
- ScGlobal::GetRscString(STR_REIMPORT_AFTER_LOAD) );
- if (aBox->Execute() == RET_YES)
+ vcl::Window* pWin = GetActiveDialogParent();
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo,
+ ScGlobal::GetRscString(STR_REIMPORT_AFTER_LOAD)));
+ xQueryBox->set_default_response(RET_YES);
+ if (xQueryBox->run() == RET_YES)
{
ScDBCollection::NamedDBs& rDBs = pDBColl->getNamedDBs();
ScDBCollection::NamedDBs::iterator itr = rDBs.begin(), itrEnd = rDBs.end();
@@ -973,11 +979,12 @@ void ScDocShell::Execute( SfxRequest& rReq )
bool bContinue = true;
if ( HasName() )
{
- ScopedVclPtrInstance<QueryBox> aBox(
- GetActiveDialogParent(),
- MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
- ScGlobal::GetRscString( STR_DOC_WILLBESAVED ) );
- if ( aBox->Execute() == RET_NO )
+ vcl::Window* pWin = GetActiveDialogParent();
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo,
+ ScGlobal::GetRscString(STR_REIMPORT_AFTER_LOAD)));
+ xQueryBox->set_default_response(RET_YES);
+ if (xQueryBox->run() == RET_NO)
{
bContinue = false;
}