sw/inc/swabstdlg.hxx | 2 sw/source/ui/dialog/swdlgfact.cxx | 9 ++- sw/source/ui/dialog/swdlgfact.hxx | 16 +++++- sw/source/ui/dialog/swuiexp.cxx | 1 sw/source/uibase/dialog/SignatureLineDialog.cxx | 58 +++++++++++------------- sw/source/uibase/inc/SignatureLineDialog.hxx | 29 +++++------- sw/source/uibase/uiview/viewdlg2.cxx | 8 +-- sw/uiconfig/swriter/ui/signatureline.ui | 54 ++++++++++++++-------- 8 files changed, 101 insertions(+), 76 deletions(-)
New commits: commit d416fa9a212e0421a7c925507ddee07132f3cab3 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Mar 16 12:02:17 2018 +0000 weld SignatureLineDialog Change-Id: I14cbc7e1aa70696abdeb21eae31176566f17e066 Reviewed-on: https://gerrit.libreoffice.org/51422 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 0c9a77babacd..7c7861797d03 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -400,7 +400,7 @@ public: SwCharDlgMode nDialogMode, const OUString* pFormatStr = nullptr) = 0; virtual VclPtr<AbstractSwConvertTableDlg> CreateSwConvertTableDlg(SwView& rView, bool bToTable) = 0; virtual VclPtr<VclAbstractDialog> CreateSwCaptionDialog ( vcl::Window *pParent, SwView &rV) = 0; - virtual VclPtr<VclAbstractDialog> CreateSignatureLineDialog(vcl::Window* pParent, SwView& rView) = 0; + virtual VclPtr<VclAbstractDialog> CreateSignatureLineDialog(weld::Window* pParent, SwView& rView) = 0; virtual VclPtr<AbstractSwInsertDBColAutoPilot> CreateSwInsertDBColAutoPilot(SwView& rView, css::uno::Reference< css::sdbc::XDataSource> rxSource, diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 4ddbae92c8b3..b0724dcf18e7 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -104,6 +104,10 @@ short AbstractSwSortDlg_Impl::Execute() { return m_xDlg->execute(); } +short AbstractSignatureLineDialog_Impl::Execute() +{ + return m_xDlg->execute(); +} IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); short AbstractSwConvertTableDlg_Impl::Execute() { @@ -724,10 +728,9 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwCaptionDialog ( return VclPtr<VclAbstractDialog_Impl>::Create( pDlg ); } -VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSignatureLineDialog(vcl::Window* pParent, SwView& rV) +VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateSignatureLineDialog(weld::Window* pParent, SwView& rV) { - VclPtr<Dialog> pDlg = VclPtr<SignatureLineDialog>::Create(pParent, rV); - return VclPtr<VclAbstractDialog_Impl>::Create(pDlg); + return VclPtr<AbstractSignatureLineDialog_Impl>::Create(new SignatureLineDialog(pParent, rV)); } VclPtr<AbstractSwInsertDBColAutoPilot> SwAbstractDialogFactory_Impl::CreateSwInsertDBColAutoPilot( SwView& rView, diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index b24f08177d0d..33db10f8cb49 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -26,6 +26,7 @@ class SwAsciiFilterDlg; class Dialog; class SwBreakDlg; class SwSortDlg; +class SignatureLineDialog; class SfxTabDialog; class SwConvertTableDlg; class SwInsertDBColAutoPilot; @@ -114,6 +115,18 @@ public: virtual short Execute() override; }; +class AbstractSignatureLineDialog_Impl : public VclAbstractDialog +{ +protected: + std::unique_ptr<SignatureLineDialog> m_xDlg; +public: + explicit AbstractSignatureLineDialog_Impl(SignatureLineDialog* p) + : m_xDlg(p) + { + } + virtual short Execute() override; +}; + class AbstractSwBreakDlg_Impl : public AbstractSwBreakDlg { protected: @@ -438,8 +451,7 @@ public: SwCharDlgMode nDialogMode, const OUString* pFormatStr = nullptr) override; virtual VclPtr<AbstractSwConvertTableDlg> CreateSwConvertTableDlg(SwView& rView, bool bToTable) override; virtual VclPtr<VclAbstractDialog> CreateSwCaptionDialog ( vcl::Window *pParent, SwView &rV) override; - virtual VclPtr<VclAbstractDialog> CreateSignatureLineDialog(vcl::Window* pParent, - SwView& rView) override; + virtual VclPtr<VclAbstractDialog> CreateSignatureLineDialog(weld::Window* pParent, SwView& rView) override; virtual VclPtr<AbstractSwInsertDBColAutoPilot> CreateSwInsertDBColAutoPilot(SwView& rView, css::uno::Reference< css::sdbc::XDataSource> rxSource, diff --git a/sw/source/ui/dialog/swuiexp.cxx b/sw/source/ui/dialog/swuiexp.cxx index b6f412435c33..f938df0b3ff0 100644 --- a/sw/source/ui/dialog/swuiexp.cxx +++ b/sw/source/ui/dialog/swuiexp.cxx @@ -39,6 +39,7 @@ #include <selglos.hxx> #include <splittbl.hxx> #include <tautofmt.hxx> +#include <SignatureLineDialog.hxx> #include <swmodalredlineacceptdlg.hxx> #include <swrenamexnameddlg.hxx> #include <swuiidxmrk.hxx> diff --git a/sw/source/uibase/dialog/SignatureLineDialog.cxx b/sw/source/uibase/dialog/SignatureLineDialog.cxx index c7832e4078e9..815636d86ab9 100644 --- a/sw/source/uibase/dialog/SignatureLineDialog.cxx +++ b/sw/source/uibase/dialog/SignatureLineDialog.cxx @@ -37,16 +37,18 @@ using namespace css::view; using namespace css::drawing; using namespace css::graphic; -SignatureLineDialog::SignatureLineDialog(vcl::Window* pParent, SwView& rView) - : SvxStandardDialog(pParent, "SignatureLineDialog", "modules/swriter/ui/signatureline.ui") +SignatureLineDialog::SignatureLineDialog(weld::Window* pParent, SwView& rView) + : GenericDialogController(pParent, "modules/swriter/ui/signatureline.ui", "SignatureLineDialog") + , m_xEditName(m_xBuilder->weld_entry("edit_name")) + , m_xEditTitle(m_xBuilder->weld_entry("edit_title")) + , m_xEditEmail(m_xBuilder->weld_entry("edit_email")) + , m_xEditInstructions(m_xBuilder->weld_text_view("edit_instructions")) + , m_xCheckboxCanAddComments(m_xBuilder->weld_check_button("checkbox_can_add_comments")) + , m_xCheckboxShowSignDate(m_xBuilder->weld_check_button("checkbox_show_sign_date")) , mrView(rView) { - get(m_pEditName, "edit_name"); - get(m_pEditTitle, "edit_title"); - get(m_pEditEmail, "edit_email"); - get(m_pEditInstructions, "edit_instructions"); - get(m_pCheckboxCanAddComments, "checkbox_can_add_comments"); - get(m_pCheckboxShowSignDate, "checkbox_show_sign_date"); + m_xEditInstructions->set_size_request(m_xEditInstructions->get_approximate_char_width() * 24, + m_xEditInstructions->get_text_height() * 5); // No signature line selected - start with empty dialog and generate a new one if (!rView.isSignatureLineSelected()) @@ -60,39 +62,33 @@ SignatureLineDialog::SignatureLineDialog(vcl::Window* pParent, SwView& rView) xProps->getPropertyValue("SignatureLineId") >>= m_aSignatureLineId; OUString aSuggestedSignerName; xProps->getPropertyValue("SignatureLineSuggestedSignerName") >>= aSuggestedSignerName; - m_pEditName->SetText(aSuggestedSignerName); + m_xEditName->set_text(aSuggestedSignerName); OUString aSuggestedSignerTitle; xProps->getPropertyValue("SignatureLineSuggestedSignerTitle") >>= aSuggestedSignerTitle; - m_pEditTitle->SetText(aSuggestedSignerTitle); + m_xEditTitle->set_text(aSuggestedSignerTitle); OUString aSuggestedSignerEmail; xProps->getPropertyValue("SignatureLineSuggestedSignerEmail") >>= aSuggestedSignerEmail; - m_pEditEmail->SetText(aSuggestedSignerEmail); + m_xEditEmail->set_text(aSuggestedSignerEmail); OUString aSigningInstructions; xProps->getPropertyValue("SignatureLineSigningInstructions") >>= aSigningInstructions; - m_pEditInstructions->SetText(aSigningInstructions); + m_xEditInstructions->set_text(aSigningInstructions); bool bCanAddComments = false; xProps->getPropertyValue("SignatureLineShowSignDate") >>= bCanAddComments; - m_pCheckboxCanAddComments->Check(bCanAddComments); + m_xCheckboxCanAddComments->set_active(bCanAddComments); bool bShowSignDate = false; xProps->getPropertyValue("SignatureLineShowSignDate") >>= bShowSignDate; - m_pCheckboxShowSignDate->Check(bShowSignDate); + m_xCheckboxShowSignDate->set_active(bShowSignDate); // Mark this as existing shape m_xExistingShapeProperties = xProps; } -SignatureLineDialog::~SignatureLineDialog() { disposeOnce(); } - -void SignatureLineDialog::dispose() +short SignatureLineDialog::execute() { - m_pEditName.clear(); - m_pEditTitle.clear(); - m_pEditEmail.clear(); - m_pEditInstructions.clear(); - m_pCheckboxCanAddComments.clear(); - m_pCheckboxShowSignDate.clear(); - - SvxStandardDialog::dispose(); + short nRet = run(); + if (nRet == RET_OK) + Apply(); + return nRet; } void SignatureLineDialog::Apply() @@ -100,12 +96,12 @@ void SignatureLineDialog::Apply() if (m_aSignatureLineId.isEmpty()) m_aSignatureLineId = OStringToOUString(comphelper::xml::generateGUIDString(), RTL_TEXTENCODING_ASCII_US); - OUString aSignerName(m_pEditName->GetText()); - OUString aSignerTitle(m_pEditTitle->GetText()); - OUString aSignerEmail(m_pEditEmail->GetText()); - OUString aSigningInstructions(m_pEditInstructions->GetText()); - bool bCanAddComments(m_pCheckboxCanAddComments->IsChecked()); - bool bShowSignDate(m_pCheckboxShowSignDate->IsChecked()); + OUString aSignerName(m_xEditName->get_text()); + OUString aSignerTitle(m_xEditTitle->get_text()); + OUString aSignerEmail(m_xEditEmail->get_text()); + OUString aSigningInstructions(m_xEditInstructions->get_text()); + bool bCanAddComments(m_xCheckboxCanAddComments->get_active()); + bool bShowSignDate(m_xCheckboxShowSignDate->get_active()); // Read svg and replace placeholder texts OUString aSvgImage(getSignatureImage()); diff --git a/sw/source/uibase/inc/SignatureLineDialog.hxx b/sw/source/uibase/inc/SignatureLineDialog.hxx index f85ebcc39fbb..f3da0ba0bad2 100644 --- a/sw/source/uibase/inc/SignatureLineDialog.hxx +++ b/sw/source/uibase/inc/SignatureLineDialog.hxx @@ -11,36 +11,33 @@ #include <svx/stddlg.hxx> #include <swdllapi.h> -#include <vcl/button.hxx> -#include <vcl/edit.hxx> +#include <vcl/weld.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/uno/Reference.hxx> class SwView; -class SW_DLLPUBLIC SignatureLineDialog : public SvxStandardDialog +class SW_DLLPUBLIC SignatureLineDialog : public weld::GenericDialogController { public: - SignatureLineDialog(vcl::Window* pParent, SwView& rView); - virtual ~SignatureLineDialog() override; - virtual void dispose() override; + SignatureLineDialog(weld::Window* pParent, SwView& rView); - virtual void Apply() override; + short execute(); private: - OUString getSignatureImage(); - + std::unique_ptr<weld::Entry> m_xEditName; + std::unique_ptr<weld::Entry> m_xEditTitle; + std::unique_ptr<weld::Entry> m_xEditEmail; + std::unique_ptr<weld::TextView> m_xEditInstructions; + std::unique_ptr<weld::CheckButton> m_xCheckboxCanAddComments; + std::unique_ptr<weld::CheckButton> m_xCheckboxShowSignDate; SwView& mrView; - css::uno::Reference<css::beans::XPropertySet> m_xExistingShapeProperties; OUString m_aSignatureLineId; - VclPtr<Edit> m_pEditName; - VclPtr<Edit> m_pEditTitle; - VclPtr<Edit> m_pEditEmail; - VclPtr<Edit> m_pEditInstructions; - VclPtr<CheckBox> m_pCheckboxCanAddComments; - VclPtr<CheckBox> m_pCheckboxShowSignDate; + + OUString getSignatureImage(); + void Apply(); }; #endif diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx index 9de01bf198ba..ec56e4df9c66 100644 --- a/sw/source/uibase/uiview/viewdlg2.cxx +++ b/sw/source/uibase/uiview/viewdlg2.cxx @@ -44,7 +44,7 @@ void SwView::ExecDlgExt(SfxRequest const &rReq) { - vcl::Window *pMDI = &GetViewFrame()->GetWindow(); + vcl::Window& rMDI = GetViewFrame()->GetWindow(); switch ( rReq.GetSlot() ) { @@ -53,7 +53,7 @@ void SwView::ExecDlgExt(SfxRequest const &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); assert(pFact && "SwAbstractDialogFactory fail!"); - ScopedVclPtr<VclAbstractDialog> pDialog(pFact->CreateSwCaptionDialog( pMDI, *this )); + ScopedVclPtr<VclAbstractDialog> pDialog(pFact->CreateSwCaptionDialog( &rMDI, *this )); assert(pDialog && "Dialog creation failed!"); if ( pDialog ) { @@ -67,7 +67,7 @@ void SwView::ExecDlgExt(SfxRequest const &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); assert(pFact && "SwAbstractDialogFactory fail!"); - ScopedVclPtr<VclAbstractDialog> pDialog(pFact->CreateSignatureLineDialog(pMDI, *this)); + ScopedVclPtr<VclAbstractDialog> pDialog(pFact->CreateSignatureLineDialog(rMDI.GetFrameWeld(), *this)); assert(pDialog && "Dialog creation failed!"); if (pDialog) pDialog->Execute(); @@ -78,7 +78,7 @@ void SwView::ExecDlgExt(SfxRequest const &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); assert(pFact && "Dialog creation failed!"); ScopedVclPtr<AbstractInsFootNoteDlg> pDlg(pFact->CreateInsFootNoteDlg( - pMDI, *m_pWrtShell, true)); + &rMDI, *m_pWrtShell, true)); assert(pDlg && "Dialog creation failed!"); pDlg->SetHelpId(GetStaticInterface()->GetSlot(FN_EDIT_FOOTNOTE)->GetCommand()); diff --git a/sw/uiconfig/swriter/ui/signatureline.ui b/sw/uiconfig/swriter/ui/signatureline.ui index 8b9395ab8295..edf50bf5e884 100644 --- a/sw/uiconfig/swriter/ui/signatureline.ui +++ b/sw/uiconfig/swriter/ui/signatureline.ui @@ -1,10 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.20.2 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="SignatureLineDialog"> <property name="can_focus">False</property> <property name="title" translatable="yes" context="signatureline|SignatureLineDialog">Signature Line</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox"> @@ -34,6 +37,7 @@ <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> @@ -66,6 +70,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="placeholder_text" translatable="yes" context="signatureline|edit_name">John Doe</property> </object> <packing> @@ -78,6 +83,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="placeholder_text" translatable="yes" context="signatureline|edit_title">Director</property> </object> <packing> @@ -90,6 +96,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="placeholder_text" translatable="yes" context="signatureline|edit_email">john....@example.org</property> </object> <packing> @@ -175,7 +182,6 @@ <property name="halign">start</property> <property name="label" translatable="yes" context="signatureline|label_instructions">Instructions to the signer:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">edit_instructions</property> </object> <packing> <property name="left_attach">0</property> @@ -184,20 +190,6 @@ </packing> </child> <child> - <object class="GtkTextView" id="edit_instructions"> - <property name="height_request">60</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">8</property> - <property name="width">2</property> - </packing> - </child> - <child> <object class="GtkCheckButton" id="checkbox_can_add_comments"> <property name="label" translatable="yes" context="signatureline|checkbox_can_add_comments">Signer can add comments</property> <property name="visible">True</property> @@ -227,6 +219,27 @@ <property name="width">2</property> </packing> </child> + <child> + <object class="GtkScrolledWindow"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTextView" id="edit_instructions"> + <property name="height_request">60</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">8</property> + <property name="width">2</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> @@ -236,9 +249,12 @@ </child> </object> </child> - <action-widgets> - <action-widget response="-5">ok</action-widget> + <action-widgets> <action-widget response="-6">cancel</action-widget> - </action-widgets> + <action-widget response="-5">ok</action-widget> + </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits