Kaydet (Commit) 9127763d authored tarafından Caolán McNamara's avatar Caolán McNamara

weld MacroSecurity cluster

MacroSecurity, MacroSecurityLevelTP and MacroSecurityTrustedSourcesTP

Change-Id: I0c3494a051cdac2723710484d5e00146d3f3dfe7
Reviewed-on: https://gerrit.libreoffice.org/67797
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst bb9481a4
......@@ -822,7 +822,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MacroSecPBHdl, Button*, void)
{
Reference< security::XDocumentDigitalSignatures > xD(
security::DocumentDigitalSignatures::createDefault(comphelper::getProcessComponentContext() ) );
xD->setParentWindow(VCLUnoHelper::GetInterface(GetTabDialog()));
xD->setParentWindow(VCLUnoHelper::GetInterface(GetParentDialog()));
xD->manageTrustedSources();
}
catch (const Exception& e)
......
......@@ -1885,7 +1885,6 @@ OfaAutoCompleteTabPage::OfaAutoCompleteTabPage(TabPageParent pParent,
{
m_xCBRemoveList->set_label_line_wrap(true);
m_xCBRemoveList->set_size_request(nMaxWidth, -1);
aPrefSize = m_xCBRemoveList->get_preferred_size();
}
m_xLBEntries->set_size_request(m_xLBEntries->get_approximate_digit_width() * 30,
......
......@@ -20,13 +20,7 @@
#ifndef INCLUDED_XMLSECURITY_INC_MACROSECURITY_HXX
#define INCLUDED_XMLSECURITY_INC_MACROSECURITY_HXX
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/tabdlg.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
#include <svtools/simptabl.hxx>
#include <vcl/weld.hxx>
#include <unotools/securityoptions.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
......@@ -40,103 +34,99 @@ namespace xml { namespace crypto {
class MacroSecurityTP;
class MacroSecurity : public TabDialog
class MacroSecurity : public weld::GenericDialogController
{
private:
friend class MacroSecurityLevelTP;
friend class MacroSecurityTrustedSourcesTP;
VclPtr<TabControl> m_pTabCtrl;
VclPtr<OKButton> m_pOkBtn;
VclPtr<PushButton> m_pResetBtn;
css::uno::Reference<css::xml::crypto::XSecurityEnvironment> m_xSecurityEnvironment;
SvtSecurityOptions m_aSecOptions;
css::uno::Reference< css::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment;
SvtSecurityOptions maSecOptions;
std::unique_ptr<weld::Notebook> m_xTabCtrl;
std::unique_ptr<weld::Button> m_xOkBtn;
std::unique_ptr<weld::Button> m_xResetBtn;
sal_uInt16 m_nSecLevelId;
sal_uInt16 m_nSecTrustId;
std::unique_ptr<MacroSecurityTP> m_xLevelTP;
std::unique_ptr<MacroSecurityTP> m_xTrustSrcTP;
VclPtr<MacroSecurityTP> mpLevelTP;
VclPtr<MacroSecurityTP> mpTrustSrcTP;
DECL_LINK( OkBtnHdl, Button*, void );
DECL_LINK(ActivatePageHdl, const OString&, void);
DECL_LINK(OkBtnHdl, weld::Button&, void);
public:
MacroSecurity(vcl::Window* pParent,
const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment);
virtual ~MacroSecurity() override;
virtual void dispose() override;
MacroSecurity(weld::Window* pParent,
const css::uno::Reference<css::xml::crypto::XSecurityEnvironment>& rxSecurityEnvironment);
void EnableReset(bool _bEnable = true)
void EnableReset(bool bEnable = true)
{
m_pResetBtn->Enable ( _bEnable );
m_xResetBtn->set_sensitive(bEnable);
}
};
class MacroSecurityTP : public TabPage
class MacroSecurityTP
{
protected:
VclPtr<MacroSecurity> mpDlg;
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::Container> m_xContainer;
MacroSecurity* m_pDlg;
public:
MacroSecurityTP(vcl::Window* _pParent, const OString& rID,
const OUString& rUIXMLDescription, MacroSecurity* _pDlg);
virtual ~MacroSecurityTP() override;
virtual void dispose() override;
MacroSecurityTP(weld::Container* pParent, const OUString& rUIXMLDescription,
const OString& rID, MacroSecurity* pDlg);
virtual ~MacroSecurityTP();
virtual void ClosePage() = 0;
virtual void ActivatePage();
virtual void ClosePage() = 0;
};
class MacroSecurityLevelTP : public MacroSecurityTP
{
private:
VclPtr<RadioButton> m_pVeryHighRB;
VclPtr<RadioButton> m_pHighRB;
VclPtr<RadioButton> m_pMediumRB;
VclPtr<RadioButton> m_pLowRB;
sal_uInt16 mnCurLevel;
DECL_LINK(RadioButtonHdl, Button*, void);
std::unique_ptr<weld::RadioButton> m_xVeryHighRB;
std::unique_ptr<weld::RadioButton> m_xHighRB;
std::unique_ptr<weld::RadioButton> m_xMediumRB;
std::unique_ptr<weld::RadioButton> m_xLowRB;
std::unique_ptr<weld::Widget> m_xVHighImg;
std::unique_ptr<weld::Widget> m_xHighImg;
std::unique_ptr<weld::Widget> m_xMedImg;
std::unique_ptr<weld::Widget> m_xLowImg;
DECL_LINK(RadioButtonHdl, weld::ToggleButton&, void);
public:
MacroSecurityLevelTP( vcl::Window* pParent, MacroSecurity* _pDlg );
virtual ~MacroSecurityLevelTP() override;
virtual void dispose() override;
virtual void ClosePage() override;
MacroSecurityLevelTP(weld::Container* pParent, MacroSecurity* pDlg);
virtual void ClosePage() override;
};
class MacroSecurityTrustedSourcesTP : public MacroSecurityTP
{
private:
VclPtr<FixedImage> m_pTrustCertROFI;
VclPtr<SvSimpleTable> m_pTrustCertLB;
VclPtr<PushButton> m_pViewCertPB;
VclPtr<PushButton> m_pRemoveCertPB;
VclPtr<FixedImage> m_pTrustFileROFI;
VclPtr<ListBox> m_pTrustFileLocLB;
VclPtr<PushButton> m_pAddLocPB;
VclPtr<PushButton> m_pRemoveLocPB;
css::uno::Sequence< SvtSecurityOptions::Certificate > maTrustedAuthors;
css::uno::Sequence< SvtSecurityOptions::Certificate > m_aTrustedAuthors;
bool mbAuthorsReadonly;
bool mbURLsReadonly;
DECL_LINK( ViewCertPBHdl, Button*, void );
DECL_LINK( RemoveCertPBHdl, Button*, void );
DECL_LINK( AddLocPBHdl, Button*, void );
DECL_LINK( RemoveLocPBHdl, Button*, void );
DECL_LINK( TrustCertLBSelectHdl, SvTreeListBox*, void );
DECL_LINK( TrustFileLocLBSelectHdl, ListBox&, void );
void FillCertLB();
void ImplCheckButtons();
std::unique_ptr<weld::Image> m_xTrustCertROFI;
std::unique_ptr<weld::TreeView> m_xTrustCertLB;
std::unique_ptr<weld::Button> m_xViewCertPB;
std::unique_ptr<weld::Button> m_xRemoveCertPB;
std::unique_ptr<weld::Image> m_xTrustFileROFI;
std::unique_ptr<weld::TreeView> m_xTrustFileLocLB;
std::unique_ptr<weld::Button> m_xAddLocPB;
std::unique_ptr<weld::Button> m_xRemoveLocPB;
DECL_LINK(ViewCertPBHdl, weld::Button&, void);
DECL_LINK(RemoveCertPBHdl, weld::Button&, void);
DECL_LINK(AddLocPBHdl, weld::Button&, void);
DECL_LINK(RemoveLocPBHdl, weld::Button&, void);
DECL_LINK(TrustCertLBSelectHdl, weld::TreeView&, void);
DECL_LINK(TrustFileLocLBSelectHdl, weld::TreeView&, void);
void FillCertLB();
void ImplCheckButtons();
public:
MacroSecurityTrustedSourcesTP(vcl::Window* pParent, MacroSecurity* _pDlg);
virtual ~MacroSecurityTrustedSourcesTP() override;
virtual void dispose() override;
MacroSecurityTrustedSourcesTP(weld::Container* pParent, MacroSecurity* pDlg);
virtual void ActivatePage() override;
virtual void ClosePage() override;
......
......@@ -120,7 +120,6 @@
#include <vcl/ctrl.hxx>
#include <vcl/cursor.hxx>
#include <vcl/devicecoordinate.hxx>
#include <vcl/dialog.hxx>
#include <vcl/dllapi.h>
#include <vcl/dndhelp.hxx>
#include <vcl/edit.hxx>
......
......@@ -591,8 +591,8 @@ void DocumentDigitalSignatures::manageTrustedSources( )
if (aSignatureManager.init())
xSecEnv = aSignatureManager.getSecurityEnvironment();
ScopedVclPtrInstance< MacroSecurity > aDlg( nullptr, xSecEnv );
aDlg->Execute();
MacroSecurity aDlg(Application::GetFrameWeld(mxParentWindow), xSecEnv);
aDlg.run();
}
void DocumentDigitalSignatures::showCertificate(
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="xsc">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="MacroSecurityDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="macrosecuritydialog|MacroSecurityDialog">Macro Security</property>
<property name="resizable">False</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>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
......@@ -18,12 +23,10 @@
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<object class="GtkButton" id="reset">
<property name="label">gtk-revert-to-saved</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>
</object>
......@@ -34,10 +37,12 @@
</packing>
</child>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<object class="GtkButton" id="ok">
<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>
</object>
......@@ -48,8 +53,8 @@
</packing>
</child>
<child>
<object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
......@@ -59,12 +64,11 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="secondary">True</property>
</packing>
</child>
<child>
<object class="GtkButton" id="reset">
<property name="label">gtk-revert-to-saved</property>
<object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
......@@ -74,6 +78,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
......@@ -99,6 +104,30 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="tab">
......@@ -118,6 +147,30 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">1</property>
......@@ -144,10 +197,10 @@
</object>
</child>
<action-widgets>
<action-widget response="101">reset</action-widget>
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
<action-widget response="0">reset</action-widget>
</action-widgets>
</object>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="xsc">
<requires lib="gtk+" version="3.18"/>
<object class="GtkGrid" id="SecurityLevelPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="row_homogeneous">True</property>
<child>
<object class="GtkRadioButton" id="low:wrap">
<object class="GtkRadioButton" id="low">
<property name="label" translatable="yes" context="securitylevelpage|low">_Low (not recommended).
All macros will be executed without confirmation.
Use this setting only if you are certain that all documents that will be opened are safe.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">vhigh:wrap</property>
<property name="group">high</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -28,16 +32,17 @@ Use this setting only if you are certain that all documents that will be opened
</packing>
</child>
<child>
<object class="GtkRadioButton" id="med:wrap">
<object class="GtkRadioButton" id="med">
<property name="label" translatable="yes" context="securitylevelpage|med">_Medium.
Confirmation required before executing macros from untrusted sources.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">low:wrap</property>
<property name="group">high</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -45,18 +50,18 @@ Confirmation required before executing macros from untrusted sources.</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="high:wrap">
<object class="GtkRadioButton" id="high">
<property name="label" translatable="yes" context="securitylevelpage|high">H_igh.
Only signed macros from trusted sources are allowed to run.
Unsigned macros are disabled.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">med:wrap</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -64,17 +69,18 @@ Unsigned macros are disabled.</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="vhigh:wrap">
<object class="GtkRadioButton" id="vhigh">
<property name="label" translatable="yes" context="securitylevelpage|vhigh">_Very high.
Only macros from trusted file locations are allowed to run.
All other macros, regardless whether signed or not, are disabled.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="hexpand">True</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">high:wrap</property>
<property name="group">high</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -87,7 +93,7 @@ All other macros, regardless whether signed or not, are disabled.</property>
<property name="no_show_all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="pixbuf">res/lock.png</property>
<property name="icon_name">res/lock.png</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -100,7 +106,7 @@ All other macros, regardless whether signed or not, are disabled.</property>
<property name="no_show_all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="pixbuf">res/lock.png</property>
<property name="icon_name">res/lock.png</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -113,7 +119,7 @@ All other macros, regardless whether signed or not, are disabled.</property>
<property name="no_show_all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="pixbuf">res/lock.png</property>
<property name="icon_name">res/lock.png</property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -126,7 +132,7 @@ All other macros, regardless whether signed or not, are disabled.</property>
<property name="no_show_all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="pixbuf">res/lock.png</property>
<property name="icon_name">res/lock.png</property>
</object>
<packing>
<property name="left_attach">0</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment