replace and drop SvtExtendedSecurityOptions class
Change-Id: Ibe3443531c83eb44080217b61f5746be9cce9c49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99695 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
parent
f3c67b783a
commit
b6f03ac06b
@ -21,6 +21,7 @@
|
||||
#include <vcl/weld.hxx>
|
||||
#include <i18nlangtag/languagetag.hxx>
|
||||
#include <i18nlangtag/mslangid.hxx>
|
||||
#include <officecfg/Office/Security.hxx>
|
||||
#include <unotools/lingucfg.hxx>
|
||||
#include <unotools/linguprops.hxx>
|
||||
#include <editeng/unolingu.hxx>
|
||||
@ -870,7 +871,7 @@ SvxLinguTabPage::SvxLinguTabPage(weld::Container* pPage, weld::DialogController*
|
||||
m_xLinguOptionsCLB->connect_changed( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
|
||||
m_xLinguOptionsCLB->connect_row_activated(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl));
|
||||
|
||||
if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() == SvtExtendedSecurityOptions::OPEN_NEVER )
|
||||
if (officecfg::Office::Security::Hyperlinks::Open::get() == SvtExtendedSecurityOptions::OPEN_NEVER)
|
||||
m_xMoreDictsLink->hide();
|
||||
|
||||
xProp = LinguMgr::GetLinguPropertySet();
|
||||
@ -1527,8 +1528,7 @@ void SvxLinguTabPage::HideGroups( sal_uInt16 nGrp )
|
||||
m_xLinguModulesCLB->hide();
|
||||
m_xLinguModulesEditPB->hide();
|
||||
|
||||
if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
|
||||
!= SvtExtendedSecurityOptions::OPEN_NEVER )
|
||||
if (officecfg::Office::Security::Hyperlinks::Open::get() != SvtExtendedSecurityOptions::OPEN_NEVER)
|
||||
{
|
||||
m_xMoreDictsLink->show();
|
||||
}
|
||||
@ -1568,7 +1568,7 @@ SvxEditModulesDlg::SvxEditModulesDlg(weld::Window* pParent, SvxLinguData_Impl& r
|
||||
m_xPrioUpPB->set_sensitive( false );
|
||||
m_xPrioDownPB->set_sensitive( false );
|
||||
|
||||
if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() == SvtExtendedSecurityOptions::OPEN_NEVER )
|
||||
if (officecfg::Office::Security::Hyperlinks::Open::get() == SvtExtendedSecurityOptions::OPEN_NEVER)
|
||||
m_xMoreDictsLink->hide();
|
||||
|
||||
// set that we want the checkbox shown if spellchecking is available
|
||||
|
@ -16,66 +16,17 @@
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
#ifndef INCLUDED_UNOTOOLS_EXTENDEDSECURITYOPTIONS_HXX
|
||||
#define INCLUDED_UNOTOOLS_EXTENDEDSECURITYOPTIONS_HXX
|
||||
|
||||
#include <unotools/unotoolsdllapi.h>
|
||||
#include <sal/types.h>
|
||||
#include <unotools/options.hxx>
|
||||
#include <memory>
|
||||
#pragma once
|
||||
|
||||
namespace osl { class Mutex; }
|
||||
|
||||
/*-************************************************************************************************************
|
||||
@short forward declaration to our private date container implementation
|
||||
@descr We use these class as internal member to support small memory requirements.
|
||||
You can create the container if it is necessary. The class which use these mechanism
|
||||
is faster and smaller then a complete implementation!
|
||||
*//*-*************************************************************************************************************/
|
||||
|
||||
class SvtExtendedSecurityOptions_Impl;
|
||||
|
||||
/*-************************************************************************************************************
|
||||
@short collect information about security features
|
||||
@ATTENTION This class is partially threadsafe.
|
||||
|
||||
@devstatus ready to use
|
||||
*//*-*************************************************************************************************************/
|
||||
|
||||
class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtExtendedSecurityOptions final : public utl::detail::Options
|
||||
namespace SvtExtendedSecurityOptions
|
||||
{
|
||||
public:
|
||||
// Must be zero based!
|
||||
enum OpenHyperlinkMode
|
||||
{
|
||||
OPEN_NEVER = 0,
|
||||
OPEN_WITHSECURITYCHECK,
|
||||
};
|
||||
|
||||
SvtExtendedSecurityOptions();
|
||||
virtual ~SvtExtendedSecurityOptions() override;
|
||||
|
||||
OpenHyperlinkMode GetOpenHyperlinkMode() const;
|
||||
|
||||
private:
|
||||
|
||||
/*-****************************************************************************************************
|
||||
@short return a reference to a static mutex
|
||||
@descr These class is partially threadsafe (for de-/initialization only).
|
||||
All access methods aren't safe!
|
||||
We create a static mutex only for one ime and use at different times.
|
||||
@return A reference to a static mutex member.
|
||||
*//*-*****************************************************************************************************/
|
||||
|
||||
UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetInitMutex();
|
||||
|
||||
// private member
|
||||
|
||||
private:
|
||||
std::shared_ptr<SvtExtendedSecurityOptions_Impl> m_pImpl;
|
||||
|
||||
}; // class SvtExtendedSecurityOptions
|
||||
|
||||
#endif // INCLUDED_UNOTOOLS_EXTENDEDSECURITYOPTIONS_HXX
|
||||
// Must be zero based!
|
||||
enum OpenHyperlinkMode
|
||||
{
|
||||
OPEN_NEVER = 0,
|
||||
OPEN_WITHSECURITYCHECK,
|
||||
};
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@ -43,7 +43,6 @@ enum class EItem
|
||||
DynamicMenuOptions ,
|
||||
|
||||
EventConfig ,
|
||||
ExtendedSecurityOptions ,
|
||||
|
||||
HelpOptions , // 2
|
||||
HistoryOptions ,
|
||||
|
@ -86,6 +86,7 @@
|
||||
#include <openuriexternally.hxx>
|
||||
|
||||
#include <officecfg/Office/ProtocolHandler.hxx>
|
||||
#include <officecfg/Office/Security.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::beans;
|
||||
@ -827,8 +828,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
|
||||
xTrans->parseStrict( aURL );
|
||||
|
||||
INetProtocol aINetProtocol = INetURLObject( aURL.Complete ).GetProtocol();
|
||||
SvtExtendedSecurityOptions aExtendedSecurityOptions;
|
||||
SvtExtendedSecurityOptions::OpenHyperlinkMode eMode = aExtendedSecurityOptions.GetOpenHyperlinkMode();
|
||||
auto eMode = officecfg::Office::Security::Hyperlinks::Open::get();
|
||||
|
||||
if ( eMode == SvtExtendedSecurityOptions::OPEN_NEVER && aINetProtocol != INetProtocol::VndSunStarHelp )
|
||||
{
|
||||
|
@ -16266,7 +16266,6 @@ unotools/source/config/defaultoptions.cxx
|
||||
unotools/source/config/docinfohelper.cxx
|
||||
unotools/source/config/dynamicmenuoptions.cxx
|
||||
unotools/source/config/eventcfg.cxx
|
||||
unotools/source/config/extendedsecurityoptions.cxx
|
||||
unotools/source/config/fltrcfg.cxx
|
||||
unotools/source/config/fontcfg.cxx
|
||||
unotools/source/config/historyoptions.cxx
|
||||
|
@ -68,7 +68,6 @@ $(eval $(call gb_Library_add_exception_objects,utl,\
|
||||
unotools/source/config/docinfohelper \
|
||||
unotools/source/config/dynamicmenuoptions \
|
||||
unotools/source/config/eventcfg \
|
||||
unotools/source/config/extendedsecurityoptions \
|
||||
unotools/source/config/fltrcfg \
|
||||
unotools/source/config/fontcfg \
|
||||
unotools/source/config/historyoptions \
|
||||
|
@ -1,226 +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 <sal/config.h>
|
||||
|
||||
#include <unotools/extendedsecurityoptions.hxx>
|
||||
#include <unotools/configitem.hxx>
|
||||
#include <tools/debug.hxx>
|
||||
#include <com/sun/star/uno/Any.hxx>
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
|
||||
#include "itemholder1.hxx"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace ::utl;
|
||||
using namespace ::osl;
|
||||
using namespace ::com::sun::star::uno;
|
||||
|
||||
#define ROOTNODE_SECURITY "Office.Security"
|
||||
|
||||
#define SECURE_EXTENSIONS_SET OUString("SecureExtensions")
|
||||
|
||||
#define PROPERTYNAME_HYPERLINKS_OPEN OUString("Hyperlinks/Open")
|
||||
|
||||
#define PROPERTYHANDLE_HYPERLINKS_OPEN 0
|
||||
|
||||
#define PROPERTYCOUNT 1
|
||||
|
||||
typedef std::unordered_map<OUString, sal_Int32>
|
||||
ExtensionHashMap;
|
||||
|
||||
class SvtExtendedSecurityOptions_Impl : public ConfigItem
|
||||
{
|
||||
public:
|
||||
SvtExtendedSecurityOptions_Impl();
|
||||
virtual ~SvtExtendedSecurityOptions_Impl() override;
|
||||
|
||||
/*-****************************************************************************************************
|
||||
@short called for notify of configmanager
|
||||
@descr This method is called from the ConfigManager before the application ends or from the
|
||||
PropertyChangeListener if the sub tree broadcasts changes. You must update your
|
||||
internal values.
|
||||
|
||||
@seealso baseclass ConfigItem
|
||||
|
||||
@param "seqPropertyNames" is the list of properties which should be updated.
|
||||
*//*-*****************************************************************************************************/
|
||||
|
||||
virtual void Notify( const Sequence< OUString >& seqPropertyNames ) override;
|
||||
|
||||
SvtExtendedSecurityOptions::OpenHyperlinkMode GetOpenHyperlinkMode() const { return m_eOpenHyperlinkMode;}
|
||||
|
||||
private:
|
||||
virtual void ImplCommit() override;
|
||||
|
||||
/*-****************************************************************************************************
|
||||
@short return list of key names of our configuration management which represent our module tree
|
||||
@descr This method returns a static const list of key names. We need it to get needed values from our
|
||||
configuration management.
|
||||
@return A list of needed configuration keys is returned.
|
||||
*//*-*****************************************************************************************************/
|
||||
|
||||
static Sequence< OUString > GetPropertyNames();
|
||||
|
||||
SvtExtendedSecurityOptions::OpenHyperlinkMode m_eOpenHyperlinkMode;
|
||||
};
|
||||
|
||||
// constructor
|
||||
|
||||
SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl()
|
||||
// Init baseclasses first
|
||||
: ConfigItem ( ROOTNODE_SECURITY )
|
||||
, m_eOpenHyperlinkMode(SvtExtendedSecurityOptions::OPEN_NEVER)
|
||||
// Init member then.
|
||||
{
|
||||
Sequence< OUString > seqNames = GetPropertyNames();
|
||||
Sequence< Any > seqValues = GetProperties( seqNames );
|
||||
|
||||
sal_Int32 nPropertyCount = seqValues.getLength();
|
||||
for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
|
||||
{
|
||||
// Safe impossible cases.
|
||||
// Check any for valid value.
|
||||
DBG_ASSERT( seqValues[nProperty].hasValue(), "SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl()\nInvalid property value detected!\n" );
|
||||
switch( nProperty )
|
||||
{
|
||||
case PROPERTYHANDLE_HYPERLINKS_OPEN:
|
||||
{
|
||||
DBG_ASSERT( ( seqValues[nProperty].getValueTypeClass() == TypeClass_LONG ), "SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl()\nWho has changed the value type of 'Hyperlink/Open'?" );
|
||||
|
||||
sal_Int32 nMode = SvtExtendedSecurityOptions::OPEN_WITHSECURITYCHECK;
|
||||
if ( seqValues[nProperty] >>= nMode )
|
||||
m_eOpenHyperlinkMode = static_cast<SvtExtendedSecurityOptions::OpenHyperlinkMode>(nMode);
|
||||
else {
|
||||
OSL_FAIL("Wrong type for Open mode!");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Enable notification mechanism of our baseclass.
|
||||
// We need it to get information about changes outside these class on our used configuration keys!
|
||||
Sequence<OUString> seqNotifyNames { SECURE_EXTENSIONS_SET };
|
||||
EnableNotification( seqNotifyNames );
|
||||
}
|
||||
|
||||
// destructor
|
||||
|
||||
SvtExtendedSecurityOptions_Impl::~SvtExtendedSecurityOptions_Impl()
|
||||
{
|
||||
assert(!IsModified()); // should have been committed
|
||||
}
|
||||
|
||||
// public method
|
||||
|
||||
void SvtExtendedSecurityOptions_Impl::Notify( const Sequence< OUString >& )
|
||||
{
|
||||
// Not implemented
|
||||
}
|
||||
|
||||
// public method
|
||||
|
||||
void SvtExtendedSecurityOptions_Impl::ImplCommit()
|
||||
{
|
||||
// Get names of supported properties, create a list for values and copy current values to it.
|
||||
Sequence< OUString > seqNames = GetPropertyNames ();
|
||||
sal_Int32 nCount = seqNames.getLength();
|
||||
Sequence< Any > seqValues ( nCount );
|
||||
for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty )
|
||||
{
|
||||
switch( nProperty )
|
||||
{
|
||||
case PROPERTYHANDLE_HYPERLINKS_OPEN: {
|
||||
seqValues[nProperty] <<= static_cast<sal_Int32>(m_eOpenHyperlinkMode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set properties in configuration.
|
||||
PutProperties( seqNames, seqValues );
|
||||
}
|
||||
|
||||
// private method (currently not used)
|
||||
|
||||
Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetPropertyNames()
|
||||
{
|
||||
// Build list of configuration key names.
|
||||
const OUString pProperties[] =
|
||||
{
|
||||
PROPERTYNAME_HYPERLINKS_OPEN
|
||||
};
|
||||
// Initialize return sequence with these list ...
|
||||
const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
|
||||
// ... and return it.
|
||||
return seqPropertyNames;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
std::weak_ptr<SvtExtendedSecurityOptions_Impl> g_pExtendedSecurityOptions;
|
||||
|
||||
}
|
||||
|
||||
SvtExtendedSecurityOptions::SvtExtendedSecurityOptions()
|
||||
{
|
||||
// Global access, must be guarded (multithreading!).
|
||||
MutexGuard aGuard( GetInitMutex() );
|
||||
|
||||
m_pImpl = g_pExtendedSecurityOptions.lock();
|
||||
if( !m_pImpl )
|
||||
{
|
||||
m_pImpl = std::make_shared<SvtExtendedSecurityOptions_Impl>();
|
||||
g_pExtendedSecurityOptions = m_pImpl;
|
||||
ItemHolder1::holdConfigItem(EItem::ExtendedSecurityOptions);
|
||||
}
|
||||
}
|
||||
|
||||
SvtExtendedSecurityOptions::~SvtExtendedSecurityOptions()
|
||||
{
|
||||
// Global access, must be guarded (multithreading!)
|
||||
MutexGuard aGuard( GetInitMutex() );
|
||||
|
||||
m_pImpl.reset();
|
||||
}
|
||||
|
||||
// public method
|
||||
|
||||
SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions::GetOpenHyperlinkMode() const
|
||||
{
|
||||
MutexGuard aGuard( GetInitMutex() );
|
||||
return m_pImpl->GetOpenHyperlinkMode();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
class theExtendedSecurityOptionsMutex : public rtl::Static<osl::Mutex, theExtendedSecurityOptionsMutex>{};
|
||||
}
|
||||
|
||||
// private method
|
||||
|
||||
Mutex& SvtExtendedSecurityOptions::GetInitMutex()
|
||||
{
|
||||
return theExtendedSecurityOptionsMutex::get();
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@ -28,7 +28,6 @@
|
||||
#include <unotools/compatibility.hxx>
|
||||
#include <unotools/defaultoptions.hxx>
|
||||
#include <unotools/dynamicmenuoptions.hxx>
|
||||
#include <unotools/extendedsecurityoptions.hxx>
|
||||
#include <unotools/historyoptions.hxx>
|
||||
#include <unotools/lingucfg.hxx>
|
||||
#include <unotools/moduleoptions.hxx>
|
||||
@ -138,10 +137,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem)
|
||||
//rItem.pItem.reset( new GlobalEventConfig() );
|
||||
break;
|
||||
|
||||
case EItem::ExtendedSecurityOptions :
|
||||
rItem.pItem.reset( new SvtExtendedSecurityOptions() );
|
||||
break;
|
||||
|
||||
case EItem::HistoryOptions :
|
||||
rItem.pItem.reset( new SvtHistoryOptions() );
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user