24#include <com/sun/star/uno/Any.hxx>
25#include <com/sun/star/uno/Sequence.hxx>
27#include <com/sun/star/beans/PropertyValue.hpp>
33#include <officecfg/Office/Common.hxx>
54 bReadonly = officecfg::Office::Common::Security::Scripting::SecureURL::isReadOnly();
57 bReadonly = officecfg::Office::Common::Security::Scripting::WarnSaveOrSendDoc::isReadOnly();
60 bReadonly = officecfg::Office::Common::Security::Scripting::WarnSignDoc::isReadOnly();
63 bReadonly = officecfg::Office::Common::Security::Scripting::WarnPrintDoc::isReadOnly();
66 bReadonly = officecfg::Office::Common::Security::Scripting::WarnCreatePDF::isReadOnly();
69 bReadonly = officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::isReadOnly();
72 bReadonly = officecfg::Office::Common::Security::Scripting::RecommendPasswordProtection::isReadOnly();
75 bReadonly = officecfg::Office::Common::Security::Scripting::MacroSecurityLevel::isReadOnly();
81 bReadonly = officecfg::Office::Common::Security::Scripting::HyperlinksWithCtrlClick::isReadOnly();
84 bReadonly = officecfg::Office::Common::Security::Scripting::BlockUntrustedRefererLinks::isReadOnly();
99 std::vector<OUString> aRet = comphelper::sequenceToContainer<std::vector<OUString>>(
102 std::transform(aRet.begin(), aRet.end(), aRet.begin(),
103 [&aOpt](
const OUString& rUrl) -> OUString { return aOpt.SubstituteVariable( rUrl ); });
112 std::vector< OUString > lURLs( std::move(urlList) );
114 std::transform(lURLs.begin(), lURLs.end(), lURLs.begin(),
115 [&aOpt](
const OUString& rUrl) -> OUString { return aOpt.UseVariable( rUrl ); });
122 OUString
const & uri, OUString
const & referer)
125 case INetProtocol::Macro:
126 if (uri.startsWithIgnoreAsciiCase(
"macro:///")) {
132 case INetProtocol::Slot:
133 return referer.equalsIgnoreAsciiCase(
"private:user")
143 && !(referer.isEmpty() || referer.startsWithIgnoreAsciiCase(
"private:")
162 || uri.startsWithIgnoreAsciiCase(
"private:")
176 if( _nLevel > 3 || _nLevel < 0 )
180 officecfg::Office::Common::Security::Scripting::MacroSecurityLevel::set(_nLevel, xChanges);
193 sal_Int32 c1 = lAuthors.getLength();
197 sal_Int32 c2 = c1 * 3;
199 auto plAllAuthors = lAllAuthors.getArray();
201 OUString aSep(
"/" );
202 for(
const auto& rAuthor : lAuthors )
213 if( lValues.getLength() != c2 )
216 std::vector< SvtSecurityOptions::Certificate > aTrustedAuthors;
219 for( sal_Int32 i1 = 0; i1 < c1; ++i1 )
225 lValues[ i2 ] >>= aCert.
RawData;
233 aTrustedAuthors.push_back( aCert );
236 return aTrustedAuthors;
246 sal_Int32 nCnt = rAuthors.size();
247 for( sal_Int32
i = 0;
i < nCnt; ++
i )
251 + OUString::number(
i) +
"/");
252 Sequence< css::beans::PropertyValue > lPropertyValues{
254 rAuthors[
i].SubjectName),
256 rAuthors[
i].SerialNumber),
310 officecfg::Office::Common::Security::Scripting::WarnSaveOrSendDoc::set(bValue, xChanges);
313 officecfg::Office::Common::Security::Scripting::WarnSignDoc::set(bValue, xChanges);
316 officecfg::Office::Common::Security::Scripting::WarnPrintDoc::set(bValue, xChanges);
319 officecfg::Office::Common::Security::Scripting::WarnCreatePDF::set(bValue, xChanges);
322 officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(bValue, xChanges);
325 officecfg::Office::Common::Security::Scripting::RecommendPasswordProtection::set(bValue, xChanges);
328 officecfg::Office::Common::Security::Scripting::HyperlinksWithCtrlClick::set(bValue, xChanges);
331 officecfg::Office::Common::Security::Scripting::BlockUntrustedRefererLinks::set(bValue, xChanges);
346 auto aIter =
aInfoIDs.find( sPersonalInfo );
349 size_t nNewID =
aInfoIDs.size() + 1;
354 return aIter->second;
std::unordered_map< OUString, size_t > aInfoIDs
size_t GetInfoID(const OUString sPersonalInfo)
static std::shared_ptr< ConfigurationChanges > create()
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
bool SetSetProperties(const OUString &rNode, const css::uno::Sequence< css::beans::PropertyValue > &rValues)
css::uno::Sequence< OUString > GetNodeNames(const OUString &rNode)
static SAL_DLLPRIVATE css::uno::Reference< css::container::XHierarchicalNameAccess > acquireTree(utl::ConfigItem const &item)
void SetMacroSecurityLevel(sal_Int32 _nLevel)
bool isTrustedLocationUri(OUString const &uri)
Check whether the given uri is a trusted location.
bool IsReadOnly(EOption eOption)
@ DocWarnRemovePersonalInfo
@ DocWarnRecommendPassword
@ BlockUntrustedRefererLinks
void SetSecureURLs(std::vector< OUString > &&urlList)
void SetTrustedAuthors(const std::vector< Certificate > &rAuthors)
sal_Int32 GetMacroSecurityLevel()
bool isSecureMacroUri(OUString const &uri, OUString const &referer)
Check whether the given uri is either no dangerous macro-execution URI at all or else the given refer...
bool isTrustedLocationUriForUpdatingLinks(OUString const &uri)
std::vector< SvtSecurityOptions::Certificate > GetTrustedAuthors()
bool isUntrustedReferer(OUString const &referer)
Check whether the given referer URI is untrusted, and links originating from it should not be accesse...
void SetOption(EOption eOption, bool bValue)
std::vector< OUString > GetSecureURLs()
bool IsOptionSet(EOption eOption)
OUString get(TranslateId sContextAndId, const std::locale &loc)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
UNOTOOLS_DLLPUBLIC bool IsSubPath(OUString const &parent, OUString const &child)
constexpr OUStringLiteral PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA
constexpr OUStringLiteral PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER
constexpr OUStringLiteral PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME
constexpr OUStringLiteral PROPERTYNAME_MACRO_TRUSTEDAUTHORS