summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/svx/dialogs.hrc3
-rw-r--r--include/svx/hdft.hxx24
-rw-r--r--include/vcl/layout.hxx17
-rw-r--r--include/vcl/vclenum.hxx4
-rw-r--r--svx/AllLangResTarget_svx.mk1
-rw-r--r--svx/UIConfig_svx.mk2
-rw-r--r--svx/source/dialog/hdft.cxx9
-rw-r--r--svx/source/dialog/hdft.src29
-rw-r--r--svx/uiconfig/ui/deletefooterdialog.ui34
-rw-r--r--svx/uiconfig/ui/deleteheaderdialog.ui34
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx11
-rw-r--r--vcl/source/window/layout.cxx108
12 files changed, 217 insertions, 59 deletions
diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index e714c3941fd9..24279aafc878 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -155,9 +155,6 @@
//---------------------------------------------------------------------
-// ResId fuer die PageDialog
-#define RID_SVXQBX_DELETE_HEADFOOT (RID_SVX_START + 28)
-
// ResId's fuer Dialoge aus StarDraw
#define RID_SVXSW_FRAMEPOSITIONS (RID_SVX_START + 289)
diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx
index 3af1316aba10..4a40479f2232 100644
--- a/include/svx/hdft.hxx
+++ b/include/svx/hdft.hxx
@@ -22,10 +22,10 @@
#include <sfx2/tabdlg.hxx>
#include <vcl/fixed.hxx>
-
#include <vcl/field.hxx>
-
#include <vcl/group.hxx>
+#include <vcl/layout.hxx>
+
#include <svx/pagectrl.hxx>
#include "svx/svxdllapi.h"
@@ -120,6 +120,26 @@ private:
SVX_DLLPRIVATE SvxFooterPage( Window* pParent, const SfxItemSet& rSet );
};
+class SVX_DLLPUBLIC DeleteHeaderDialog : public MessageDialog
+{
+public:
+ DeleteHeaderDialog(Window *pParent)
+ : MessageDialog(pParent, "DeleteHeaderDialog",
+ "svx/ui/deleteheaderdialog.ui")
+ {
+ }
+};
+
+class SVX_DLLPUBLIC DeleteFooterDialog : public MessageDialog
+{
+public:
+ DeleteFooterDialog(Window *pParent)
+ : MessageDialog(pParent, "DeleteFooterDialog",
+ "svx/ui/deletefooterdialog.ui")
+ {
+ }
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 5237c72c9bce..2b8fa8abb574 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -647,18 +647,33 @@ public:
bool set_property(const OString &rKey, const OString &rValue);
};
+enum VclButtonsType
+{
+ VCL_BUTTONS_NONE,
+ VCL_BUTTONS_OK,
+ VCL_BUTTONS_CLOSE,
+ VCL_BUTTONS_CANCEL,
+ VCL_BUTTONS_YES_NO,
+ VCL_BUTTONS_OK_CANCEL
+};
+
class VCL_DLLPUBLIC MessageDialog : public Dialog
{
private:
+ VclButtonsType m_eType;
VclGrid* m_pGrid;
FixedImage* m_pImage;
VclMultiLineEdit* m_pPrimaryMessage;
VclMultiLineEdit* m_pSecondaryMessage;
+ std::vector<PushButton*> m_aOwnedButtons;
+ std::map<const Window*, short> m_aResponses;
OUString m_sPrimaryString;
OUString m_sSecondaryString;
DECL_DLLPRIVATE_LINK(ButtonHdl, Button *);
- void setButtonHandlers();
+ void setButtonHandlers(VclButtonBox *pButtonBox);
+ short get_response(const Window *pWindow) const;
public:
+
MessageDialog(Window* pParent, WinBits nStyle);
MessageDialog(Window* pParent, const OString& rID, const OUString& rUIXMLDescription);
virtual bool set_property(const OString &rKey, const OString &rValue);
diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx
index d37b11b71881..f0ea2fca77fe 100644
--- a/include/vcl/vclenum.hxx
+++ b/include/vcl/vclenum.hxx
@@ -143,6 +143,10 @@ enum VclResponseType
RET_NO = 3,
RET_RETRY = 4,
RET_IGNORE = 5,
+ RET_ACCEPT = 6,
+ RET_CLOSE = 7,
+ RET_APPLY = 8,
+ RET_NONE = 9,
RET_HELP = 10
};
diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk
index 9bc8b0bb0419..11f04186e4b7 100644
--- a/svx/AllLangResTarget_svx.mk
+++ b/svx/AllLangResTarget_svx.mk
@@ -45,7 +45,6 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\
svx/source/dialog/docrecovery.src \
svx/source/dialog/fontwork.src \
svx/source/dialog/frmsel.src \
- svx/source/dialog/hdft.src \
svx/source/dialog/imapdlg.src \
svx/source/dialog/langbox.src \
svx/source/dialog/language.src \
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index 5b1e63dc92c3..75d0e677a0b7 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -14,6 +14,8 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
svx/uiconfig/ui/asianphoneticguidedialog \
svx/uiconfig/ui/chineseconversiondialog \
svx/uiconfig/ui/compressgraphicdialog \
+ svx/uiconfig/ui/deleteheaderdialog \
+ svx/uiconfig/ui/deletefooterdialog \
svx/uiconfig/ui/headfootformatpage \
svx/uiconfig/ui/findreplacedialog \
svx/uiconfig/ui/redlinecontrol \
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index 606c7970ce18..6e65cae8a8be 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -485,7 +485,14 @@ IMPL_LINK( SvxHFPage, TurnOnHdl, CheckBox *, pBox )
bool bDelete = true;
if ( !bDisableQueryBox && pBox && m_pTurnOnBox->GetSavedValue() == sal_True )
- bDelete = ( QueryBox( this, SVX_RES( RID_SVXQBX_DELETE_HEADFOOT ) ).Execute() == RET_YES );
+ {
+ short nResult;
+ if (nId == SID_ATTR_PAGE_HEADERSET)
+ nResult = DeleteHeaderDialog(this).Execute();
+ else
+ nResult = DeleteFooterDialog(this).Execute();
+ bDelete = nResult == RET_YES;
+ }
if ( bDelete )
{
diff --git a/svx/source/dialog/hdft.src b/svx/source/dialog/hdft.src
deleted file mode 100644
index b6ff2eb089be..000000000000
--- a/svx/source/dialog/hdft.src
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <svx/dialogs.hrc>
-
-QueryBox RID_SVXQBX_DELETE_HEADFOOT
-{
- Buttons = WB_YES_NO ;
- DefButton = WB_DEF_NO ;
- Message [ en-US ] = "Removing headers or footers deletes the contents.\nDo you want to delete this text?" ;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/deletefooterdialog.ui b/svx/uiconfig/ui/deletefooterdialog.ui
new file mode 100644
index 000000000000..54321260f898
--- /dev/null
+++ b/svx/uiconfig/ui/deletefooterdialog.ui
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkMessageDialog" id="DeleteFooterDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="title" translatable="yes">Delete footer</property>
+ <property name="type_hint">dialog</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="message_type">warning</property>
+ <property name="buttons">yes-no</property>
+ <property name="text" translatable="yes">Are you sure you want to delete the footer?</property>
+ <property name="secondary_text" translatable="yes">All contents of the footer will be deleted and can not be restored.</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="messagedialog-vbox">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">24</property>
+ <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>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/svx/uiconfig/ui/deleteheaderdialog.ui b/svx/uiconfig/ui/deleteheaderdialog.ui
new file mode 100644
index 000000000000..a2099c613614
--- /dev/null
+++ b/svx/uiconfig/ui/deleteheaderdialog.ui
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkMessageDialog" id="DeleteHeaderDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="title" translatable="yes">Delete header</property>
+ <property name="type_hint">dialog</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="message_type">warning</property>
+ <property name="buttons">yes-no</property>
+ <property name="text" translatable="yes">Are you sure you want to delete the header?</property>
+ <property name="secondary_text" translatable="yes">All contents of the header will be deleted and can not be restored.</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="messagedialog-vbox">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">24</property>
+ <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>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index f38099e4eb22..87e126b98a61 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -31,6 +31,7 @@
#include <math.h>
#include <hintids.hxx>
+#include <svx/hdft.hxx>
#include <svx/svdview.hxx>
#include <sot/factory.hxx>
#include <svl/itemiter.hxx>
@@ -1754,9 +1755,13 @@ void SwWrtShell::ChangeHeaderOrFooter(
EndAllAction();
Window* pParent = &GetView().GetViewFrame()->GetWindow();
- bool bRet = RET_YES == QueryBox( pParent, ResId( RID_SVXQBX_DELETE_HEADFOOT,
- DIALOG_MGR() ) ).Execute();
- bExecute = bRet;
+ short nResult;
+ if (bHeader)
+ nResult = DeleteHeaderDialog(pParent).Execute();
+ else
+ nResult = DeleteFooterDialog(pParent).Execute();
+ bExecute = nResult == RET_YES;
+
StartAllAction();
}
if( bExecute )
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 4714f1ede104..a4760992ee9c 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1672,6 +1672,7 @@ bool VclSizeGroup::set_property(const OString &rKey, const OString &rValue)
MessageDialog::MessageDialog(Window* pParent, WinBits nStyle)
: Dialog(pParent, nStyle)
+ , m_eType(VCL_BUTTONS_NONE)
, m_pGrid(NULL)
, m_pImage(NULL)
, m_pPrimaryMessage(NULL)
@@ -1682,6 +1683,7 @@ MessageDialog::MessageDialog(Window* pParent, WinBits nStyle)
MessageDialog::MessageDialog(Window* pParent, const OString& rID, const OUString& rUIXMLDescription)
: Dialog(pParent, rID, rUIXMLDescription, WINDOW_MESSBOX)
+ , m_eType(VCL_BUTTONS_NONE)
, m_pGrid(NULL)
, m_pImage(NULL)
, m_pPrimaryMessage(NULL)
@@ -1691,6 +1693,8 @@ MessageDialog::MessageDialog(Window* pParent, const OString& rID, const OUString
MessageDialog::~MessageDialog()
{
+ for (size_t i = 0; i < m_aOwnedButtons.size(); ++i)
+ delete m_aOwnedButtons[i];
delete m_pSecondaryMessage;
delete m_pPrimaryMessage;
delete m_pImage;
@@ -1699,19 +1703,20 @@ MessageDialog::~MessageDialog()
IMPL_LINK(MessageDialog, ButtonHdl, Button *, pButton)
{
- //for now insist that we have a builder, we can relax that in
- //the future if we need it
- assert(m_pUIBuilder);
- EndDialog(m_pUIBuilder->get_response(pButton));
+ EndDialog(get_response(pButton));
return 0;
}
-void MessageDialog::setButtonHandlers()
+short MessageDialog::get_response(const Window *pWindow) const
+{
+ std::map<const Window*, short>::const_iterator aFind = m_aResponses.find(pWindow);
+ if (aFind != m_aResponses.end())
+ return aFind->second;
+ return m_pUIBuilder->get_response(pWindow);
+}
+
+void MessageDialog::setButtonHandlers(VclButtonBox *pButtonBox)
{
- SAL_WARN_IF(!m_pUIBuilder, "vcl.layout", "MessageDialog non-ui load button responses not implemented yet");
- if (!m_pUIBuilder)
- return;
- VclButtonBox *pButtonBox = get_action_area();
assert(pButtonBox);
for (Window* pChild = pButtonBox->GetWindow(WINDOW_FIRSTCHILD); pChild;
pChild = pChild->GetWindow(WINDOW_NEXT))
@@ -1724,17 +1729,16 @@ void MessageDialog::setButtonHandlers()
pButton->SetClickHdl(LINK(this, MessageDialog, ButtonHdl));
break;
}
- //for now at least, insist that the response ids match
- //the default actions for those widgets, and leave
- //their default handlers in place
+ //insist that the response ids match the default actions for those
+ //widgets, and leave their default handlers in place
case WINDOW_OKBUTTON:
- assert(m_pUIBuilder->get_response(pChild) == RET_OK);
+ assert(get_response(pChild) == RET_OK);
break;
case WINDOW_CANCELBUTTON:
- assert(m_pUIBuilder->get_response(pChild) == RET_CANCEL);
+ assert(get_response(pChild) == RET_CANCEL);
break;
case WINDOW_HELPBUTTON:
- assert(m_pUIBuilder->get_response(pChild) == RET_HELP);
+ assert(get_response(pChild) == RET_HELP);
break;
default:
SAL_WARN("vcl.layout", "The type of widget " <<
@@ -1793,13 +1797,58 @@ short MessageDialog::Execute()
m_pSecondaryMessage->SetText(m_sSecondaryString);
m_pSecondaryMessage->Show(!m_sSecondaryString.isEmpty());
- m_pGrid->Show();
-
- setButtonHandlers();
-
VclButtonBox *pButtonBox = get_action_area();
assert(pButtonBox);
+ PushButton *pBtn;
+ switch (m_eType)
+ {
+ case VCL_BUTTONS_NONE:
+ break;
+ case VCL_BUTTONS_OK:
+ pBtn = new OKButton(pButtonBox);
+ pBtn->Show();
+ m_aOwnedButtons.push_back(pBtn);
+ m_aResponses[pBtn] = RET_OK;
+ break;
+ case VCL_BUTTONS_CLOSE:
+ pBtn = new CloseButton(pButtonBox);
+ pBtn->Show();
+ m_aOwnedButtons.push_back(pBtn);
+ m_aResponses[pBtn] = RET_CLOSE;
+ break;
+ case VCL_BUTTONS_CANCEL:
+ pBtn = new CancelButton(pButtonBox);
+ m_aOwnedButtons.push_back(pBtn);
+ m_aResponses[pBtn] = RET_CANCEL;
+ break;
+ case VCL_BUTTONS_YES_NO:
+ pBtn = new PushButton(pButtonBox);
+ pBtn->SetText(Button::GetStandardText(BUTTON_YES));
+ pBtn->Show();
+ m_aOwnedButtons.push_back(pBtn);
+ m_aResponses[pBtn] = RET_YES;
+
+ pBtn = new PushButton(pButtonBox);
+ pBtn->SetText(Button::GetStandardText(BUTTON_NO));
+ pBtn->Show();
+ m_aOwnedButtons.push_back(pBtn);
+ m_aResponses[pBtn] = RET_NO;
+ break;
+ case VCL_BUTTONS_OK_CANCEL:
+ pBtn = new OKButton(pButtonBox);
+ pBtn->Show();
+ m_aOwnedButtons.push_back(pBtn);
+ m_aResponses[pBtn] = RET_OK;
+
+ pBtn = new CancelButton(pButtonBox);
+ pBtn->Show();
+ m_aOwnedButtons.push_back(pBtn);
+ m_aResponses[pBtn] = RET_CANCEL;
+ break;
+ }
+ setButtonHandlers(pButtonBox);
pButtonBox->sort_native_button_order();
+ m_pGrid->Show();
}
return Dialog::Execute();
@@ -1825,6 +1874,27 @@ bool MessageDialog::set_property(const OString &rKey, const OString &rValue)
set_primary_text(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
else if (rKey == "secondary-text")
set_secondary_text(OStringToOUString(rValue, RTL_TEXTENCODING_UTF8));
+ else if (rKey == "buttons")
+ {
+ VclButtonsType eMode = VCL_BUTTONS_NONE;
+ if (rValue.equals("none"))
+ eMode = VCL_BUTTONS_NONE;
+ else if (rValue.equals("ok"))
+ eMode = VCL_BUTTONS_OK;
+ else if (rValue.equals("cancel"))
+ eMode = VCL_BUTTONS_CANCEL;
+ else if (rValue.equals("close"))
+ eMode = VCL_BUTTONS_CLOSE;
+ else if (rValue.equals("yes-no"))
+ eMode = VCL_BUTTONS_YES_NO;
+ else if (rValue.equals("ok-cancel"))
+ eMode = VCL_BUTTONS_OK_CANCEL;
+ else
+ {
+ SAL_WARN("vcl.layout", "unknown buttons type mode" << rValue.getStr());
+ }
+ m_eType = eMode;
+ }
else
return Dialog::set_property(rKey, rValue);
return true;