[Libreoffice-commits] core.git: include/unotools sfx2/source unotools/source

2022-05-14 Thread Noel Grandin (via logerrit)
 include/unotools/eventcfg.hxx|3 +++
 sfx2/source/inc/eventsupplier.hxx|4 ++--
 sfx2/source/notify/eventsupplier.cxx |   14 +-
 sfx2/source/notify/globalevents.cxx  |   12 +++-
 unotools/source/config/eventcfg.cxx  |   12 +++-
 5 files changed, 24 insertions(+), 21 deletions(-)

New commits:
commit ce214d56727ecf8fb212910a711b4e3ef38e4b63
Author: Noel Grandin 
AuthorDate: Fri May 13 15:30:37 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat May 14 17:30:08 2022 +0200

bypass some unnecessary wrapping in Any in SfxEvents_Impl

Change-Id: I96d1194253207642e7abe83b0b18c82eb3782824
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134316
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/unotools/eventcfg.hxx b/include/unotools/eventcfg.hxx
index 5999d0bc1ea3..7ddca4a96be0 100644
--- a/include/unotools/eventcfg.hxx
+++ b/include/unotools/eventcfg.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_UNOTOOLS_EVENTCFG_HXX
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -75,6 +76,8 @@ class UNOTOOLS_DLLPUBLIC GlobalEventConfig final :
 sal_Bool SAL_CALL hasElements(  ) override;
 static OUString GetEventName( GlobalEventId nID );
 
+css::uno::Sequence < css::beans::PropertyValue > getByName2( const 
OUString& aName );
+
 private:
 static GlobalEventConfig_Impl* m_pImpl;
 static sal_Int32 m_nRefCount;
diff --git a/sfx2/source/inc/eventsupplier.hxx 
b/sfx2/source/inc/eventsupplier.hxx
index 0a6c1a971daf..56aa8f95e75f 100644
--- a/sfx2/source/inc/eventsupplier.hxx
+++ b/sfx2/source/inc/eventsupplier.hxx
@@ -44,7 +44,7 @@ class SvxMacro;
 class SfxEvents_Impl final : public ::cppu::WeakImplHelper< 
css::container::XNameReplace, css::document::XDocumentEventListener >
 {
 css::uno::Sequence< OUString > maEventNames;
-std::vector< css::uno::Any >   maEventData;
+std::vector< css::uno::Sequence < css::beans::PropertyValue > >  
maEventData;
 css::uno::Reference< css::document::XDocumentEventBroadcaster >  
mxBroadcaster;
 std::mutex maMutex;
 SfxObjectShell *mpObjShell;
@@ -79,7 +79,7 @@ public:
 const ::comphelper::NamedValueCollection& 
i_eventDescriptor,
 ::comphelper::NamedValueCollection& 
o_normalizedDescriptor,
 SfxObjectShell* i_document );
-static void Execute( css::uno::Any const & aEventData, const 
css::document::DocumentEvent& aTrigger, SfxObjectShell* pDoc );
+static void Execute( css::uno::Sequence < css::beans::PropertyValue > 
const & aEventData, const css::document::DocumentEvent& aTrigger, 
SfxObjectShell* pDoc );
 
 private:
 /// Check if script URL whitelist exists, and if so, if current script url 
is part of it
diff --git a/sfx2/source/notify/eventsupplier.cxx 
b/sfx2/source/notify/eventsupplier.cxx
index 7ac2fd7d830d..d6bff98de8f0 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -98,11 +98,11 @@ void SAL_CALL SfxEvents_Impl::replaceByName( const OUString 
& aName, const uno::
 
 if ( !aNormalizedDescriptor.empty() )
 {
-maEventData[nIndex] <<= aNormalizedDescriptor.getPropertyValues();
+maEventData[nIndex] = aNormalizedDescriptor.getPropertyValues();
 }
 else
 {
-maEventData[nIndex].clear();
+maEventData[nIndex] = {};
 }
 }
 
@@ -117,7 +117,7 @@ uno::Any SAL_CALL SfxEvents_Impl::getByName( const 
OUString& aName )
 
 auto nIndex = comphelper::findValue(maEventNames, aName);
 if (nIndex != -1)
-return maEventData[nIndex];
+return uno::Any(maEventData[nIndex]);
 
 throw container::NoSuchElementException();
 }
@@ -180,12 +180,8 @@ bool SfxEvents_Impl::isScriptURLAllowed(const OUString& 
aScriptURL)
 return false;
 }
 
-void SfxEvents_Impl::Execute( uno::Any const & aEventData, const 
document::DocumentEvent& aTrigger, SfxObjectShell* pDoc )
+void SfxEvents_Impl::Execute( css::uno::Sequence < css::beans::PropertyValue > 
const & aProperties, const document::DocumentEvent& aTrigger, SfxObjectShell* 
pDoc )
 {
-uno::Sequence < beans::PropertyValue > aProperties;
-if ( !(aEventData >>= aProperties) )
-return;
-
 OUString aType;
 OUString aScript;
 OUString aLibrary;
@@ -292,7 +288,7 @@ void SAL_CALL SfxEvents_Impl::documentEventOccured( const 
document::DocumentEven
 if ( nIndex == -1 )
 return;
 
-uno::Any aEventData = maEventData[ nIndex ];
+css::uno::Sequence < css::beans::PropertyValue > aEventData = maEventData[ 
nIndex ];
 aGuard.unlock();
 Execute( aEventData, aEvent, mpObjShell );
 }
diff --git a/sfx2/source/notify/globalevents.cxx 
b/sfx2/source/notify/globalevents.cxx
index 87564e74ed65..cd6b08007115 100644
--- a/sfx2/source/notify/globalevents.cxx
+++ 

[Libreoffice-commits] core.git: include/unotools sfx2/source unotools/source xmlsecurity/source

2021-10-11 Thread Noel Grandin (via logerrit)
 include/unotools/securityoptions.hxx   |2 +-
 sfx2/source/appl/appcfg.cxx|2 +-
 unotools/source/config/securityoptions.cxx |4 ++--
 xmlsecurity/source/component/documentdigitalsignatures.cxx |2 +-
 xmlsecurity/source/dialogs/macrosecurity.cxx   |2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 64937ff98a970050b0d5d89e3a4734d93e13ad00
Author: Noel Grandin 
AuthorDate: Sun Oct 10 20:23:48 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Oct 11 10:39:38 2021 +0200

loplugin:moveparam in unotools

Change-Id: Idd014c93e2e85d2ffc7a2535a9c65cffc8a9d403
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123348
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/unotools/securityoptions.hxx 
b/include/unotools/securityoptions.hxx
index 93363c48210f..332ba457fc4d 100644
--- a/include/unotools/securityoptions.hxx
+++ b/include/unotools/securityoptions.hxx
@@ -90,7 +90,7 @@ namespace SvtSecurityOptions
 
*//*-*/
 
 UNOTOOLS_DLLPUBLIC std::vector< OUString >  GetSecureURLs();
-UNOTOOLS_DLLPUBLIC void SetSecureURLs( const std::vector< OUString >& 
seqURLList );
+UNOTOOLS_DLLPUBLIC void SetSecureURLs( std::vector< OUString >&& 
seqURLList );
 
 
/*-
 @short  interface methods to get and set value of config key 
"org.openoffice.Office.Common/Security/Scripting/StarOfficeBasic"
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index c37e01281977..feeb621b1596 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -640,7 +640,7 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& 
rSet )
 if ( SfxItemState::SET == rSet.GetItemState(SID_SECURE_URL, true, ))
 {
 DBG_ASSERT(dynamic_cast< const SfxStringListItem *>( pItem ) !=  
nullptr, "StringListItem expected");
-SvtSecurityOptions::SetSecureURLs( static_cast(pItem)->GetList() );
+SvtSecurityOptions::SetSecureURLs( std::vector(static_cast(pItem)->GetList()) );
 }
 
 // Store changed data
diff --git a/unotools/source/config/securityoptions.cxx 
b/unotools/source/config/securityoptions.cxx
index cd41f92a0eac..e3cab9d1a557 100644
--- a/unotools/source/config/securityoptions.cxx
+++ b/unotools/source/config/securityoptions.cxx
@@ -104,12 +104,12 @@ std::vector< OUString > GetSecureURLs()
 return aRet;
 }
 
-void SetSecureURLs( const std::vector< OUString >& urlList )
+void SetSecureURLs( std::vector< OUString >&& urlList )
 {
 //DBG_ASSERT(!officecfg::SecureURL::isReadOnly(), 
"SvtSecurityOptions_Impl::SetSecureURLs()\nYou tried to write on a readonly 
value!\n");
 //if (officecfg::SecureURL::isReadOnly())
 //return;
-std::vector< OUString > lURLs( urlList );
+std::vector< OUString > lURLs( std::move(urlList) );
 SvtPathOptions aOpt;
 std::transform(lURLs.begin(), lURLs.end(), lURLs.begin(),
 [](const OUString& rUrl) -> OUString { return aOpt.UseVariable( 
rUrl ); });
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx 
b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 625bbbd0d4be..189c220eebd9 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -788,7 +788,7 @@ void 
DocumentDigitalSignatures::addLocationToTrustedSources( const OUString& Loc
 std::vector< OUString > aSecURLs = SvtSecurityOptions::GetSecureURLs();
 aSecURLs.push_back(Location);
 
-SvtSecurityOptions::SetSecureURLs( aSecURLs );
+SvtSecurityOptions::SetSecureURLs( std::move(aSecURLs) );
 }
 
 sal_Bool DocumentDigitalSignatures::signDocumentWithCertificate(
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx 
b/xmlsecurity/source/dialogs/macrosecurity.cxx
index dbfa41e96d58..d4a7e9f7c23f 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -430,7 +430,7 @@ void MacroSecurityTrustedSourcesTP::ClosePage()
 aSecureURLs.push_back(aURL);
 }
 
-SvtSecurityOptions::SetSecureURLs( aSecureURLs );
+SvtSecurityOptions::SetSecureURLs( std::move(aSecureURLs) );
 }
 // Trusted Path could not be removed (#i33584#)
 // don't forget to remove the old saved SecureURLs


[Libreoffice-commits] core.git: include/unotools sfx2/source unotools/source

2021-07-27 Thread Noel Grandin (via logerrit)
 include/unotools/itemholderbase.hxx|5 
 include/unotools/viewoptions.hxx   |   56 -
 sfx2/source/appl/app.cxx   |6 
 unotools/source/config/itemholder1.cxx |   16 
 unotools/source/config/viewoptions.cxx |  929 ++---
 5 files changed, 182 insertions(+), 830 deletions(-)

New commits:
commit 48383d59f49d00dc27797d58472c90382c2244f7
Author: Noel Grandin 
AuthorDate: Mon Jul 26 16:01:25 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 27 14:32:52 2021 +0200

simplify SvtViewOptions

Change-Id: Ib1f42d7322d105337554848bc40726be00533843
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119548
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/unotools/itemholderbase.hxx 
b/include/unotools/itemholderbase.hxx
index b7a8a7bbc825..0815a4c20c32 100644
--- a/include/unotools/itemholderbase.hxx
+++ b/include/unotools/itemholderbase.hxx
@@ -53,11 +53,6 @@ enum class EItem
 SysLocaleOptions  ,   // 2
 
 UserOptions   ,   // 2
-
-ViewOptionsDialog ,
-ViewOptionsTabDialog  ,
-ViewOptionsTabPage,
-ViewOptionsWindow
 };
 
 struct TItemInfo
diff --git a/include/unotools/viewoptions.hxx b/include/unotools/viewoptions.hxx
index c4e6a38e5e79..46f3ea326860 100644
--- a/include/unotools/viewoptions.hxx
+++ b/include/unotools/viewoptions.hxx
@@ -26,9 +26,7 @@
 #include 
 
 namespace com::sun::star::beans { struct NamedValue; }
-namespace osl { class Mutex; }
-
-class SvtViewOptionsBase_Impl;
+namespace com::sun::star::container { class XNameAccess; }
 
 
/*-
 @descr  Use these enum values to specify right list in 
configuration in which your view data are saved.
@@ -94,7 +92,7 @@ enum class EViewType
 @devstatus  ready to use
 
*//*-*/
 
-class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtViewOptions final : public 
utl::detail::Options
+class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtViewOptions final
 {
 
 //  public methods
@@ -118,15 +116,6 @@ class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtViewOptions 
final : public utl::deta
 
  SvtViewOptions(   EViewTypeeType ,
  const OUString& sViewName );
-virtual ~SvtViewOptions() override;
-
-
/*-
-@short  support preload of these config item
-@descr  Sometimes we need preloading of these configuration 
data without real using of it.
-
*//*-*/
-
-static void AcquireOptions();
-static void ReleaseOptions();
 
 //  interface
 
@@ -174,7 +163,7 @@ class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtViewOptions 
final : public utl::deta
 
*//*-*/
 
 OString GetPageID() const;
-void  SetPageID(const OString& rID);
+void  SetPageID(std::string_view rID);
 
 
/*-
 @short  use it to set/get the visual state of a window
@@ -214,46 +203,21 @@ class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtViewOptions 
final : public utl::deta
 void  SetUserItem( const OUString&sName  ,
const css::uno::Any& aValue );
 
-//  private methods
-
 private:
+enum State { STATE_NONE, STATE_FALSE, STATE_TRUE };
 
-
/*-
-@short  return a reference to a static mutex
-@descr  These class is threadsafe.
-We create a static mutex only for one time and use it 
to protect our refcount and container
-member!
-@return A reference to a static mutex member.
-
*//*-*/
-
-UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
-
-//  private member
-
-private:
+css::uno::Reference< css::uno::XInterface > impl_getSetNode( const 
OUString& sNode   ,
+   
bool bCreateIfMissing) const;
+State GetVisible() const;
 
 /// specify which list of views in configuration is used! This can't 
be a static value!!!
 /// ... because we 

[Libreoffice-commits] core.git: include/unotools sfx2/source unotools/source

2021-07-24 Thread Noel Grandin (via logerrit)
 include/unotools/saveopt.hxx   |4 ---
 sfx2/source/appl/appcfg.cxx|9 --
 unotools/source/config/saveopt.cxx |   48 ++---
 3 files changed, 9 insertions(+), 52 deletions(-)

New commits:
commit d904a21d5516ce2786f634d0bcc555c4b345e95d
Author: Noel Grandin 
AuthorDate: Fri Jul 23 19:32:25 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 24 22:09:52 2021 +0200

use officecfg to retrieve AutoSavePrompt

Change-Id: I918e31064064664df7364d7c3093d3cefdb4067a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119458
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index b268d8397d59..d50b8115885c 100644
--- a/include/unotools/saveopt.hxx
+++ b/include/unotools/saveopt.hxx
@@ -35,7 +35,6 @@ public:
 UseUserData,
 Backup,
 AutoSave,
-AutoSavePrompt,
 WarnAlienFormat,
 LoadDocPrinter,
 OdfDefaultVersion,
@@ -97,9 +96,6 @@ public:
 voidSetAutoSave( bool b );
 boolIsAutoSave() const;
 
-voidSetAutoSavePrompt( bool b );
-boolIsAutoSavePrompt() const;
-
 voidSetUserAutoSave( bool b );
 boolIsUserAutoSave() const;
 
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 00742402585c..fc4280e8df4b 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -168,8 +168,9 @@ void SfxApplication::GetOptions( SfxItemSet& rSet )
 case SID_ATTR_AUTOSAVEPROMPT :
 {
 bRet = true;
-if 
(!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::AutoSavePrompt))
-if (!rSet.Put( SfxBoolItem( rPool.GetWhich( 
SID_ATTR_AUTOSAVEPROMPT ), aSaveOptions.IsAutoSavePrompt(
+if 
(!officecfg::Office::Common::Save::Document::AutoSavePrompt::isReadOnly())
+if (!rSet.Put( SfxBoolItem( rPool.GetWhich( 
SID_ATTR_AUTOSAVEPROMPT ),
+
officecfg::Office::Common::Save::Document::AutoSavePrompt::get(
 bRet = false;
 }
 break;
@@ -461,7 +462,9 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& 
rSet )
 if ( SfxItemState::SET == 
rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOSAVEPROMPT), true, ))
 {
 DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) !=  nullptr, 
"BoolItem expected");
-aSaveOptions.SetAutoSavePrompt(static_cast(pItem)->GetValue());
+officecfg::Office::Common::Save::Document::AutoSavePrompt::set(
+static_cast(pItem)->GetValue(),
+batch);
 }
 
 // AutoSave-Time
diff --git a/unotools/source/config/saveopt.cxx 
b/unotools/source/config/saveopt.cxx
index 1d3f7253952a..5bb82488695a 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -62,7 +62,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
 boolbUseUserData,
 bBackup,
 bAutoSave,
-bAutoSavePrompt,
 bUserAutoSave,
 bWarnAlienFormat,
 bLoadDocPrinter;
@@ -73,7 +72,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
 bROUseUserData,
 bROBackup,
 bROAutoSave,
-bROAutoSavePrompt,
 bROUserAutoSave,
 bROWarnAlienFormat,
 bROLoadDocPrinter,
@@ -90,7 +88,6 @@ public:
 boolIsUseUserData() const   { return 
bUseUserData; }
 boolIsBackup() const{ return 
bBackup; }
 boolIsAutoSave() const  { return 
bAutoSave; }
-boolIsAutoSavePrompt() const{ return 
bAutoSavePrompt; }
 boolIsUserAutoSave() const  { return 
bUserAutoSave; }
 boolIsWarnAlienFormat() const   { return 
bWarnAlienFormat; }
 boolIsLoadDocPrinter() const{ return 
bLoadDocPrinter; }
@@ -102,7 +99,6 @@ public:
 voidSetUseUserData( bool b );
 voidSetBackup( bool b );
 voidSetAutoSave( bool b );
-voidSetAutoSavePrompt( bool b );
 voidSetUserAutoSave( bool b );
 

[Libreoffice-commits] core.git: include/unotools sfx2/source unotools/source

2021-07-24 Thread Noel Grandin (via logerrit)
 include/unotools/saveopt.hxx   |4 ---
 sfx2/source/appl/appcfg.cxx|9 +--
 unotools/source/config/saveopt.cxx |   44 -
 3 files changed, 7 insertions(+), 50 deletions(-)

New commits:
commit 8690061b7d2d7c50ba96b40af4c4549fd9378b80
Author: Noel Grandin 
AuthorDate: Fri Jul 23 16:06:24 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 24 19:32:09 2021 +0200

use officecfg to retrieve SaveWorkingSet

Change-Id: I9f4e4c2caffa828670ddedb1c6fc324e28162b9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119456
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index 1420269f2fbf..4a7c21cac08a 100644
--- a/include/unotools/saveopt.hxx
+++ b/include/unotools/saveopt.hxx
@@ -37,7 +37,6 @@ public:
 AutoSave,
 AutoSavePrompt,
 DocInfSave,
-SaveWorkingSet,
 WarnAlienFormat,
 LoadDocPrinter,
 OdfDefaultVersion,
@@ -108,9 +107,6 @@ public:
 voidSetDocInfoSave(bool b);
 boolIsDocInfoSave() const;
 
-voidSetSaveWorkingSet( bool b );
-boolIsSaveWorkingSet() const;
-
 voidSetLoadUserSettings(bool b);
 boolIsLoadUserSettings() const;
 
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index ae9b8c7a86fc..68faf7d0e75f 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -200,8 +200,9 @@ void SfxApplication::GetOptions( SfxItemSet& rSet )
 case SID_ATTR_WORKINGSET :
 {
 bRet = true;
-if 
(!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::SaveWorkingSet))
-if (!rSet.Put( SfxBoolItem( rPool.GetWhich( 
SID_ATTR_WORKINGSET ), aSaveOptions.IsSaveWorkingSet(
+if 
(!officecfg::Office::Common::Save::WorkingSet::isReadOnly())
+if (!rSet.Put( SfxBoolItem( rPool.GetWhich( 
SID_ATTR_WORKINGSET ),
+
officecfg::Office::Common::Save::WorkingSet::get(
 bRet = false;
 }
 break;
@@ -487,7 +488,9 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& 
rSet )
 if ( SfxItemState::SET == 
rSet.GetItemState(rPool.GetWhich(SID_ATTR_WORKINGSET), true, ))
 {
 DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) !=  nullptr, 
"BoolItem expected");
-aSaveOptions.SetSaveWorkingSet(static_cast(pItem)->GetValue());
+officecfg::Office::Common::Save::WorkingSet::set(
+static_cast(pItem)->GetValue(),
+batch);
 }
 
 // Save window settings
diff --git a/unotools/source/config/saveopt.cxx 
b/unotools/source/config/saveopt.cxx
index 5fac07ddc4e1..55979f50e982 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -65,7 +65,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
 bAutoSavePrompt,
 bUserAutoSave,
 bDocInfSave,
-bSaveWorkingSet,
 bWarnAlienFormat,
 bLoadDocPrinter;
 
@@ -78,7 +77,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
 bROAutoSavePrompt,
 bROUserAutoSave,
 bRODocInfSave,
-bROSaveWorkingSet,
 bROWarnAlienFormat,
 bROLoadDocPrinter,
 bROODFDefaultVersion;
@@ -97,7 +95,6 @@ public:
 boolIsAutoSavePrompt() const{ return 
bAutoSavePrompt; }
 boolIsUserAutoSave() const  { return 
bUserAutoSave; }
 boolIsDocInfoSave() const   { return 
bDocInfSave; }
-boolIsSaveWorkingSet() const{ return 
bSaveWorkingSet; }
 boolIsWarnAlienFormat() const   { return 
bWarnAlienFormat; }
 boolIsLoadDocPrinter() const{ return 
bLoadDocPrinter; }
 
@@ -111,7 +108,6 @@ public:
 voidSetAutoSavePrompt( bool b );
 voidSetUserAutoSave( bool b );
 voidSetDocInfoSave( bool b );
-voidSetSaveWorkingSet( bool b );
 voidSetWarnAlienFormat( bool _bDoPP );
 voidSetLoadDocPrinter( bool bNew );
 void

[Libreoffice-commits] core.git: include/unotools sfx2/source unotools/source

2021-07-23 Thread Noel Grandin (via logerrit)
 include/unotools/saveopt.hxx   |4 --
 sfx2/source/appl/appcfg.cxx|6 +--
 unotools/source/config/saveopt.cxx |   56 -
 3 files changed, 10 insertions(+), 56 deletions(-)

New commits:
commit 04389e2e5563ae5d771a78e439dfe7ccdcd8b904
Author: Noel Grandin 
AuthorDate: Fri Jul 23 13:59:23 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 23 22:19:09 2021 +0200

use officecfg to retrieve SaveDocView

Change-Id: I1a758137000359d2448f8c5877d7b2e75f3869b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119416
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/unotools/saveopt.hxx b/include/unotools/saveopt.hxx
index 0e16b683e914..e8b6aed4e448 100644
--- a/include/unotools/saveopt.hxx
+++ b/include/unotools/saveopt.hxx
@@ -38,7 +38,6 @@ public:
 AutoSavePrompt,
 DocInfSave,
 SaveWorkingSet,
-SaveDocView,
 SaveRelInet,
 SaveRelFsys,
 DoPrettyPrinting,
@@ -115,9 +114,6 @@ public:
 voidSetSaveWorkingSet( bool b );
 boolIsSaveWorkingSet() const;
 
-voidSetSaveDocView( bool b );
-boolIsSaveDocView() const;
-
 voidSetSaveRelINet( bool b );
 boolIsSaveRelINet() const;
 
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 2aa0a8e22047..01820c08adb7 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -207,8 +207,8 @@ void SfxApplication::GetOptions( SfxItemSet& rSet )
 case SID_ATTR_SAVEDOCVIEW :
 {
 bRet = true;
-if 
(!aSaveOptions.IsReadOnly(SvtSaveOptions::EOption::SaveDocView))
-if (!rSet.Put( SfxBoolItem( rPool.GetWhich( 
SID_ATTR_SAVEDOCVIEW ), aSaveOptions.IsSaveDocView(
+if 
(!officecfg::Office::Common::Save::Document::ViewInfo::isReadOnly())
+if (!rSet.Put( SfxBoolItem( rPool.GetWhich( 
SID_ATTR_SAVEDOCVIEW ), 
officecfg::Office::Common::Save::Document::ViewInfo::get(
 bRet = false;
 }
 break;
@@ -489,7 +489,7 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& 
rSet )
 if ( SfxItemState::SET == 
rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCVIEW), true, ))
 {
 DBG_ASSERT(dynamic_cast< const SfxBoolItem *>( pItem ) !=  nullptr, 
"BoolItem expected");
-aSaveOptions.SetSaveDocView(static_cast(pItem)->GetValue());
+
officecfg::Office::Common::Save::Document::ViewInfo::set(static_cast(pItem)->GetValue(), batch);
 }
 
 // Metric
diff --git a/unotools/source/config/saveopt.cxx 
b/unotools/source/config/saveopt.cxx
index 58040c2eafae..76c7e34f3673 100644
--- a/unotools/source/config/saveopt.cxx
+++ b/unotools/source/config/saveopt.cxx
@@ -66,7 +66,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
 bUserAutoSave,
 bDocInfSave,
 bSaveWorkingSet,
-bSaveDocView,
 bSaveRelINet,
 bSaveRelFSys,
 bDoPrettyPrinting,
@@ -83,7 +82,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem
 bROUserAutoSave,
 bRODocInfSave,
 bROSaveWorkingSet,
-bROSaveDocView,
 bROSaveRelINet,
 bROSaveRelFSys,
 bROWarnAlienFormat,
@@ -106,7 +104,6 @@ public:
 boolIsUserAutoSave() const  { return 
bUserAutoSave; }
 boolIsDocInfoSave() const   { return 
bDocInfSave; }
 boolIsSaveWorkingSet() const{ return 
bSaveWorkingSet; }
-boolIsSaveDocView() const   { return 
bSaveDocView; }
 boolIsSaveRelINet() const   { return 
bSaveRelINet; }
 boolIsSaveRelFSys() const   { return 
bSaveRelFSys; }
 boolIsPrettyPrintingEnabled( ) const{ return 
bDoPrettyPrinting; }
@@ -124,7 +121,6 @@ public:
 voidSetUserAutoSave( bool b );
 voidSetDocInfoSave( bool b );
 voidSetSaveWorkingSet( bool b );
-voidSetSaveDocView( bool b );
 voidSetSaveRelINet( bool b );
 voidSetSaveRelFSys( bool b );
 void   

[Libreoffice-commits] core.git: include/unotools sfx2/source unotools/source

2018-11-13 Thread Libreoffice Gerrit user
 include/unotools/datetime.hxx |1 
 sfx2/source/dialog/dinfdlg.cxx|   42 +++---
 unotools/source/misc/datetime.cxx |9 
 3 files changed, 14 insertions(+), 38 deletions(-)

New commits:
commit bad2196674764d67f19b276c1f6327dc3394e01a
Author: Samuel Mehrbrodt 
AuthorDate: Mon Nov 12 08:21:20 2018 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Tue Nov 13 12:06:30 2018 +0100

Use shared methods instead of duplicated code

Change-Id: I42836dcd1ef3f95d90e6e8897efff9cab7cc23fd
Reviewed-on: https://gerrit.libreoffice.org/63276
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/include/unotools/datetime.hxx b/include/unotools/datetime.hxx
index bd630e2ffca2..2f55faedbc2a 100644
--- a/include/unotools/datetime.hxx
+++ b/include/unotools/datetime.hxx
@@ -38,6 +38,7 @@ namespace utl
 UNOTOOLS_DLLPUBLIC const LocaleDataWrapper& GetLocaleData();
 UNOTOOLS_DLLPUBLIC DateTime GetDateTime(const css::util::DateTime& _rDT);
 UNOTOOLS_DLLPUBLIC OUString GetDateTimeString(const css::util::DateTime& 
_rDT);
+UNOTOOLS_DLLPUBLIC OUString GetDateTimeString(sal_Int32 _nDate, sal_Int32 
_nTime);
 UNOTOOLS_DLLPUBLIC OUString GetDateString(const css::util::DateTime& _rDT);
 
 UNOTOOLS_DLLPUBLIC void typeConvert(const Date& _rDate, css::util::Date& 
_rOut);
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 9f11b03295bd..9199e25ba2e5 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -24,9 +24,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -703,42 +705,6 @@ void SfxDocumentDescPage::Reset(const SfxItemSet *rSet)
 }
 }
 
-namespace
-{
-OUString GetDateTimeString( sal_Int32 _nDate, sal_Int32 _nTime )
-{
-const LocaleDataWrapper& rWrapper( 
Application::GetSettings().GetLocaleDataWrapper() );
-
-Date aDate( _nDate );
-tools::Time aTime( _nTime * tools::Time::nanoPerCenti );
-OUString aStr = rWrapper.getDate( aDate )
-  + ", "
-  + rWrapper.getTime( aTime );
-return aStr;
-}
-
-// copy from xmlsecurity/source/dialog/resourcemanager.cxx
-OUString GetContentPart( const OUString& _rRawString, const OUString& 
_rPartId )
-{
-OUString s;
-
-sal_Int32  nContStart = _rRawString.indexOf( _rPartId );
-if ( nContStart != -1 )
-{
-nContStart = nContStart + _rPartId.getLength();
-++nContStart; // now its start of content, directly after Id
-
-sal_Int32  nContEnd = _rRawString.indexOf( ',', nContStart );
-if (nContEnd != -1)
-s = _rRawString.copy( nContStart, nContEnd - nContStart );
-else
-s = _rRawString.copy(nContStart);
-}
-
-return s;
-}
-}
-
 SfxDocumentPage::SfxDocumentPage(vcl::Window* pParent, const SfxItemSet& 
rItemSet)
 : SfxTabPage(pParent, "DocumentInfoPage", "sfx/ui/documentinfopage.ui", 
)
 , bEnableUseUserData( false )
@@ -888,9 +854,9 @@ void SfxDocumentPage::ImplUpdateSignatures()
 else if ( aInfos.getLength() == 1 )
 {
 const security::DocumentSignatureInformation& rInfo = aInfos[ 
0 ];
-s = GetDateTimeString( rInfo.SignatureDate, 
rInfo.SignatureTime );
+s = utl::GetDateTimeString( rInfo.SignatureDate, 
rInfo.SignatureTime );
 s += ", ";
-s += GetContentPart( rInfo.Signer->getSubjectName(), "CN" );
+s += 
comphelper::xmlsec::GetContentPart(rInfo.Signer->getSubjectName());
 }
 m_pSignedValFt->SetText( s );
 }
diff --git a/unotools/source/misc/datetime.cxx 
b/unotools/source/misc/datetime.cxx
index 979db79e13cd..3c2da9f6586e 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -212,6 +212,15 @@ OUString GetDateTimeString(const css::util::DateTime& _rDT)
 return rLoDa.getDate(aDT) + " " + rLoDa.getTime(aDT);
 }
 
+OUString GetDateTimeString(sal_Int32 _nDate, sal_Int32 _nTime)
+{
+const LocaleDataWrapper& rLoDa = GetLocaleData();
+
+Date aDate(_nDate);
+tools::Time aTime(_nTime * tools::Time::nanoPerCenti);
+return rLoDa.getDate(aDate) + ", " + rLoDa.getTime(aTime);
+}
+
 OUString GetDateString(const css::util::DateTime& _rDT)
 {
 return GetLocaleData().getDate(GetDateTime(_rDT));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/unotools sfx2/source unotools/source

2016-10-17 Thread Giuseppe Castagno
 include/unotools/ucbhelper.hxx  |   30 ++
 sfx2/source/doc/docfile.cxx |7 +--
 unotools/source/ucbhelper/ucbhelper.cxx |   18 ++
 3 files changed, 53 insertions(+), 2 deletions(-)

New commits:
commit 26c99e42db233e375a007c49e1e903359caa1ce3
Author: Giuseppe Castagno 
Date:   Sat Oct 15 16:21:42 2016 +0200

tdf#103274: Add helper for a default XCommandEnvironment reference.

This helper should be used where the empty XCommandEnvironment
e.g. something like:

css::uno::Reference< css::ucb::XCommandEnvironment >()

is currently used.

See comment in the committed code (include/unotools/ucbhelper.hxx)
for details.

A case use is presented in this commit, please see:
sfx2/source/doc/docfile.cxx for details.

Change-Id: Ieb97c0ed61f31ef8df532c8be0e7ff1035327915
Reviewed-on: https://gerrit.libreoffice.org/29927
Tested-by: Jenkins 
Reviewed-by: Giuseppe Castagno 

diff --git a/include/unotools/ucbhelper.hxx b/include/unotools/ucbhelper.hxx
index 1777a40..653d828 100644
--- a/include/unotools/ucbhelper.hxx
+++ b/include/unotools/ucbhelper.hxx
@@ -80,6 +80,36 @@ UNOTOOLS_DLLPUBLIC bool IsSubPath(
 UNOTOOLS_DLLPUBLIC bool EqualURLs(
 OUString const & url1, OUString const & url2);
 
+/**
+* Returns a default XCommandEnvironment to be used
+* when creating a ucbhelper::Content.
+*
+* Due to the way the WebDAV UCP provider works, an interaction handler
+* is always needed:
+* 1) to activate the credential dialog or to provide the cached credentials
+* whenever the server requests them;
+*
+* 2) in case of ssl connection (https) to activate the dialog to show the
+* certificate if said certificate looks wrong or dubious.
+*
+* This helper provides the XCommandEnvironment with an interaction
+* handler that intercepts:
+* 1) css::ucb::AuthenticationRequest()
+* 2) css::ucb::CertificateValidationRequest()
+* 3) css::ucb::InteractiveIOException()
+* 4) css::ucb::UnsupportedDataSinkException()
+*
+* Exception 1) and 2) will be passed to the UI handler, e.g. shown to
+* the user for interaction.
+*
+* Exception 3) and 4) will be have a default 'Abort' result.
+* See comphelper::StillReadWriteInteraction for details.
+* comphelper::StillReadWriteInteraction was introduced in
+* commit bbe51f039dffca2506ea542feb78571b6358b981.
+*/
+UNOTOOLS_DLLPUBLIC
+css::uno::Reference< css::ucb::XCommandEnvironment > 
getDefaultCommandEnvironment();
+
 } }
 
 #endif
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 2179f82..e41f716 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -394,8 +394,11 @@ util::DateTime SfxMedium::GetInitFileDate( bool 
bIgnoreOldValue )
 {
 try
 {
-uno::Reference< css::ucb::XCommandEnvironment > xDummyEnv;
-::ucbhelper::Content aContent( GetURLObject().GetMainURL( 
INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() 
);
+// add a default css::ucb::XCommandEnvironment
+// in order to have the WebDAV UCP provider manage http/https 
authentication correctly
+::ucbhelper::Content aContent( GetURLObject().GetMainURL( 
INetURLObject::NO_DECODE ),
+   
utl::UCBContentHelper::getDefaultCommandEnvironment(),
+   
comphelper::getProcessComponentContext() );
 
 aContent.getPropertyValue("DateModified") >>= pImpl->m_aDateTime;
 pImpl->m_bGotDateTime = true;
diff --git a/unotools/source/ucbhelper/ucbhelper.cxx 
b/unotools/source/ucbhelper/ucbhelper.cxx
index acbc63f..aa751b6 100644
--- a/unotools/source/ucbhelper/ucbhelper.cxx
+++ b/unotools/source/ucbhelper/ucbhelper.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -46,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -120,6 +122,22 @@ DateTime convert(css::util::DateTime const & dt) {
 
 }
 
+css::uno::Reference< css::ucb::XCommandEnvironment > 
utl::UCBContentHelper::getDefaultCommandEnvironment()
+{
+css::uno::Reference< css::task::XInteractionHandler > xIH(
+css::task::InteractionHandler::createWithParent(
+comphelper::getProcessComponentContext(), nullptr ) );
+
+css::uno::Reference< css::ucb::XProgressHandler > xProgress;
+ucbhelper::CommandEnvironment* pCommandEnv =
+new ::ucbhelper::CommandEnvironment(
+new comphelper::SimpleFileAccessInteraction( xIH ), xProgress );
+
+css::uno::Reference < css::ucb::XCommandEnvironment > xEnv(
+static_cast< css::ucb::XCommandEnvironment* >(pCommandEnv), 
css::uno::UNO_QUERY );
+return xEnv;
+}
+
 bool utl::UCBContentHelper::IsDocument(OUString const & url) {
 try {