core.git: framework/source

2024-08-06 Thread Michael Meeks (via logerrit)
 framework/source/helper/wakeupthread.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit b954a2409bdae5b22e35c150ca035a3b3d43538f
Author: Michael Meeks 
AuthorDate: Mon Aug 5 17:55:12 2024 +0100
Commit: Noel Grandin 
CommitDate: Tue Aug 6 21:48:54 2024 +0200

Avoid excessive progress updates unconditionally.

This may make short lived progress bars somewhat more 'blocky' and less
smooth - but inevitably make loading faster, particularly for loaded
machines with ultra-beautiful, slow to render themed progress-bars.

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

diff --git a/framework/source/helper/wakeupthread.cxx 
b/framework/source/helper/wakeupthread.cxx
index d30742758a89..b1a9b81cb12d 100644
--- a/framework/source/helper/wakeupthread.cxx
+++ b/framework/source/helper/wakeupthread.cxx
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -63,11 +62,10 @@ public:
 
 void execute() override
 {
-bool bLOK = comphelper::LibreOfficeKit::isActive();
 while (true)
 {
 std::unique_lock g(getMutex());
-condition.wait_for(g, bLOK ? 200ms : 25ms, [this] { return 
terminate; });
+condition.wait_for(g, 200ms, [this] { return terminate; });
 if (terminate || updatables.empty())
 break;
 


core.git: framework/source

2024-08-05 Thread Michael Meeks (via logerrit)
 framework/source/helper/wakeupthread.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit c41401adeb97de52df75ce55e17efc6d2d8c77d1
Author: Michael Meeks 
AuthorDate: Fri Aug 2 15:30:13 2024 +0100
Commit: Michael Meeks 
CommitDate: Mon Aug 5 18:52:32 2024 +0200

lok: avoid excessive progress updates.

Perhaps for desktop 40 updates per second can provide a nice smooth
status experience for a full screen-width progress bar in some cases;
but it seems likely that five per second over a remote protocol
might be better.

Change-Id: Ic77b3b76d680771cb766984bdbcd9c8af4af303d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171407
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/framework/source/helper/wakeupthread.cxx 
b/framework/source/helper/wakeupthread.cxx
index 63d52a82da76..d30742758a89 100644
--- a/framework/source/helper/wakeupthread.cxx
+++ b/framework/source/helper/wakeupthread.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -62,10 +63,11 @@ public:
 
 void execute() override
 {
+bool bLOK = comphelper::LibreOfficeKit::isActive();
 while (true)
 {
 std::unique_lock g(getMutex());
-condition.wait_for(g, 25ms, [this] { return terminate; });
+condition.wait_for(g, bLOK ? 200ms : 25ms, [this] { return 
terminate; });
 if (terminate || updatables.empty())
 break;
 


core.git: framework/source

2024-07-25 Thread Mike Kaganski (via logerrit)
 framework/source/fwe/helper/titlehelper.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 9b911aaa3d2c7258fd41a896b7d57ca8c2a476fb
Author: Mike Kaganski 
AuthorDate: Thu Jul 25 21:11:04 2024 +0200
Commit: Mike Kaganski 
CommitDate: Thu Jul 25 23:09:11 2024 +0200

tdf#124213: handle private URLs as non-remote

Since commit 26c106a5aeca3e50d1e3c3d37e622b2743a23bca "append '(Remote)'
in the titlebar when remote file is opened", 2015-08-14, the titlebar
shows "(remote)" for documents with non-empty URLs that are not file
scheme.

When recovering a non-existing document, the URL is a factory one like
"private:factory/swriter"; and INetURLObject::GetProtocol() call returns
PrivSoffice.

Indeed, recovery of a non-existing document doesn't make sense itself,
and is fixed by Justin elsewhere; but let's fix the general logic here.

Change-Id: Ibaf095981c37a2fd64f745ad0966465d98a4ed4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171027
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins

diff --git a/framework/source/fwe/helper/titlehelper.cxx 
b/framework/source/fwe/helper/titlehelper.cxx
index c318ec817b45..5fc85505edad 100644
--- a/framework/source/fwe/helper/titlehelper.cxx
+++ b/framework/source/fwe/helper/titlehelper.cxx
@@ -438,6 +438,7 @@ void TitleHelper::impl_updateTitleForController (const 
css::uno::Reference< css:
 {
 INetURLObject aURL (xModel->getURL ());
 if (aURL.GetProtocol () != INetProtocol::File
+&& aURL.GetProtocol() != INetProtocol::PrivSoffice
 && aURL.GetProtocol () != INetProtocol::NotValid)
 {
 OUString sRemoteText (FwkResId (STR_REMOTE_TITLE));


core.git: framework/source

2024-06-11 Thread Andrea Gelmini (via logerrit)
 framework/source/services/autorecovery.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8fadd44f5947e1022d3431e3ac781b0924c7652e
Author: Andrea Gelmini 
AuthorDate: Tue Jun 11 15:27:45 2024 +0200
Commit: Julien Nabet 
CommitDate: Tue Jun 11 23:04:53 2024 +0200

Fix typo

Change-Id: I8dee411e1f3b4f182791e45b286f24d20f4c98da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168680
Reviewed-by: Julien Nabet 
Tested-by: Jenkins

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 14e09e7085de..c4fb2fcf3ed1 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2452,7 +2452,7 @@ void AutoRecovery::implts_registerDocument(const 
css::uno::Reference< css::frame
 if (pIt != m_lDocCache.end())
 {
 // Normally nothing must be done for this "late" notification.
-// But may be the modified state was changed inbetween.
+// But may be the modified state was changed in between.
 // Check it...
 implts_updateModifiedState(xDocument);
 return;


core.git: framework/source

2024-06-11 Thread Andrea Gelmini (via logerrit)
 framework/source/services/autorecovery.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 02b858e78667de122331a056af29d362d1cef56e
Author: Andrea Gelmini 
AuthorDate: Tue Jun 11 15:27:29 2024 +0200
Commit: Julien Nabet 
CommitDate: Tue Jun 11 23:03:06 2024 +0200

Fix typo

Change-Id: Ib50cf36b56ff0a77870948e7ce73eb5da84a6f55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168679
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 3e3d92ba6a63..14e09e7085de 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2553,7 +2553,7 @@ void AutoRecovery::implts_registerDocument(const 
css::uno::Reference< css::frame
 
 } /* SAFE */
 
-// Don't register new documents here. (They are registered elsewhere when 
saved or modifed...)
+// Don't register new documents here. (They are registered elsewhere when 
saved or modified...)
 implts_flushConfigItem(aInfo, /*bRemoveIt=*/false, 
/*bAllowAdd=*/!aNew.OrgURL.isEmpty());
 implts_startModifyListeningOnDoc(aInfo);
 


core.git: framework/source

2024-06-10 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |   40 +
 1 file changed, 24 insertions(+), 16 deletions(-)

New commits:
commit 852cd511258e97a0df3b6fbe9fc0ae670c3fc843
Author: Justin Luth 
AuthorDate: Mon Jun 10 15:50:29 2024 -0400
Commit: Justin Luth 
CommitDate: Tue Jun 11 02:17:28 2024 +0200

tdf#57414 tdf#160769 autorecovery: keep open docs in RecoveryList

This reverts parts of the LO 24.2 patches commited for bug 57414.

There were lots more vocal people than I expected
that want the crash-recovery to restore their session state.

Since there is no working alternative to trigger a session save,
just revert the bits that made the RecoveryList clean
(as I and other users had requested)
and revert back to the original, historic behaviour.

This means that now the following files will again be recovered:
- saved documents (opened from file URL)
- read-only documents (opened from file URL)
- files that were opened, but never modified (opened from file URL)
- files from now-potentially-unavailable disks/servers/temp-dirs
   - recovery will attempt to access those file URLs

At least one benefit remains:
- new, unmodified documents will not be in the RecoveryList

Maybe I'll look into a session save option for 25.2.

Change-Id: I2477f194bf94f14620d284728027846ec5b6119e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168650
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 246d8438bbae..3e3d92ba6a63 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -110,24 +110,32 @@ using namespace css::lang;
 using namespace framework;
 
 /** After the fact documentation - hopefully it is correct.
+ *
+ * NOTE TO DEVELOPERS: instsetoo_native/ooenv sets the environment variable 
OOO_DISABLE_RECOVERY
+ * which means that your non-gdb execution of the compiled code will not 
display the recovery dialog
+ * and if officecfg::Office::Recovery::RecoveryList has some autosave files to 
recover,
+ * then autorecovery itself will not be started, and none of the code in this 
file will be executed.
+ * THEREFORE you probably want to COMMENT OUT that environment variable when 
working in this file.
  *
  * AutoRecovery handles 3 types of recovery, as well as periodic document 
saving
- *   1) timed, ODF, temporary, recovery files created in the backup folder
- *  -can instead be used to actually save the documents periodically if 
settings request that.
+ *   1a) timed, automatic saving of the documents (aka UserAutoSave)
+ *   or more commonly:
+ *   1b) timed, ODF, temporary recovery files created in the backup folder 
(default setting)
  *  -temporary: deleted when the document itself is saved
  *  -handles the situation where LO immediately exits (power outage, 
program crash, pkill -9 soffice)
- *  -not restored immediately
+ *  -not restored immediately (user needs to restart LibreOffice)
  *  -no guarantee of availability of recovery file (since deleted on 
document save)
- *   or original document (perhaps /tmp, removeable, disconnected 
server).
- *  -therefore does not include unmodified files in RecoveryList 
(@since LO 24.2).
- *-TODO: perhaps can be enhanced for users who always want 
sessions restored?
+ *   or original document (perhaps /tmp, removeable disk, disconnected 
server).
+ *  -TODO tdf#57414: if SessionSave not desired, don't recover 
unmodified files.
  *   2) emergency save-and-restart immediately triggers creation of temporary, 
ODF, recovery files
  *  -handles the situation where LO is partially functioning (pkill -6 
soffice)
  *  -restore attempted immediately, so try to restore entire session - 
all open files
  *  -always create recovery file for every open document in emergency 
situation
  *  -works without requiring AutoRecovery to be enabled
- *   3) session save on exit desired by OS or user creates recovery files for 
every open document
- *  -triggered by some OS's shutdown/logout (no known way for user to 
initiate within LO)
+ *   3) session save on exit requested by OS or user
+ *  -triggered by OS's shutdown/logout
+ *  -appears to be purely theoretical: no known working OS at the 
moment.
+ *  -also no known way for user to initiate within LO (tdf#146769)
  *  -same as emergency save, except maybe more time critical - OS kill 
timeout
  *  -not restored until much later - the user has stopped doing 
computer work
  *  -always create recovery file for every open document: needed for 
/tmp, disconnected docs
@@ -617,8 +625,9 @@ private:
  *EmergencySave and SessionSave are interested in all open 
documents (which may not

core.git: framework/source include/vcl vcl/inc vcl/source

2024-05-16 Thread Vasily Melenchuk (via logerrit)
 framework/source/loadenv/loadenv.cxx |8 +---
 include/vcl/ctrl.hxx |2 ++
 include/vcl/window.hxx   |4 ++--
 vcl/inc/brdwin.hxx   |2 --
 vcl/source/window/brdwin.cxx |   12 
 vcl/source/window/stacking.cxx   |4 ++--
 vcl/source/window/window.cxx |   18 --
 vcl/source/window/window3.cxx|9 -
 8 files changed, 31 insertions(+), 28 deletions(-)

New commits:
commit e0b930e1ddf008d202c3620fdc6652483f914835
Author: Vasily Melenchuk 
AuthorDate: Sat Apr 27 14:14:04 2024 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu May 16 12:50:31 2024 +0200

VCL: Windows: more usecases for FlashWindow() API to inform on changes

FlashWindow() can be used to bring user attention to application
in background. Right now in LO it has implementation only for
Windows. Here some new cases were added when flashing is used:
 * dialog window did open
 * document loaded
 * LO started

Some redesign of previous solution is also performed: no manual
search for top window, let's reuse existing code.

Changed behavior for bringing LO window to foreground: it is made always 
and not depending on current value of NewDocumentHandling:ForceFocusAndToFront. 
It has no sense to tweak this behavior: if user clicks on document in file 
explorer, LO should came to foreground, no exceptions.

Change-Id: I22b5b4e2b170cd25632083a55b3e9f0358bcae03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166615
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/framework/source/loadenv/loadenv.cxx 
b/framework/source/loadenv/loadenv.cxx
index 40b9917064ee..299b0fcd5ba4 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -1596,11 +1596,11 @@ void LoadEnv::impl_reactForLoadingState()
 css::uno::Reference< css::awt::XWindow > xWindow  = 
m_xTargetFrame->getContainerWindow();
 bool bHidden  = 
m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN, 
false);
 bool bMinimized = 
m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MINIMIZED,
 false);
+VclPtr pWindow = VCLUnoHelper::GetWindow(xWindow);
 
 if (bMinimized)
 {
 SolarMutexGuard aSolarGuard;
-VclPtr pWindow = VCLUnoHelper::GetWindow(xWindow);
 // check for system window is necessary to guarantee correct 
pointer cast!
 if (pWindow && pWindow->IsSystemWindow())
 static_cast(pWindow.get())->Minimize();
@@ -1612,6 +1612,9 @@ void LoadEnv::impl_reactForLoadingState()
 impl_makeFrameWindowVisible(xWindow, !m_bFocusedAndToFront && 
shouldFocusAndToFront());
 }
 
+if (pWindow)
+pWindow->FlashWindow();
+
 // Note: Only if an existing property "FrameName" is given by this 
media descriptor,
 // it should be used. Otherwise we should do nothing. May be the 
outside code has already
 // set a frame name on the target!
@@ -1700,8 +1703,7 @@ bool LoadEnv::shouldFocusAndToFront() const
 {
 bool const preview(
 
m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW,
 false));
-return !preview
-   && 
officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get();
+return !preview;
 }
 
 // static
diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
index 3f838aba1a70..4e61822abf7a 100644
--- a/include/vcl/ctrl.hxx
+++ b/include/vcl/ctrl.hxx
@@ -230,6 +230,8 @@ public:
 
 /// Notify the LOK client about an invalidated area.
 virtual void LogicInvalidate( const tools::Rectangle* pRectangle ) 
override;
+
+virtual void FlashWindow() const override {};
 };
 
 #endif // INCLUDED_VCL_CTRL_HXX
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index c71c0891c572..c78c214a5b60 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -694,7 +694,7 @@ private:
 // retrieves the list of owner draw decorated windows for this window 
hierarchy
 SAL_DLLPRIVATE ::std::vector >& ImplGetOwnerDrawList();
 
-SAL_DLLPRIVATE vcl::Window* ImplGetTopmostFrameWindow();
+SAL_DLLPRIVATE vcl::Window* ImplGetTopmostFrameWindow() const;
 
 SAL_DLLPRIVATE bool ImplStopDnd();
 SAL_DLLPRIVATE void ImplStartDnd();
@@ -1119,7 +1119,7 @@ public:
 /// Dumps itself and potentially its children to a property tree, to be 
written easily to JSON.
 virtual void DumpAsPropertyTree(tools::JsonWriter&);
 
-
+/// Use OS specific way to bring user attention to current window
 virtual void FlashWindow() const;
 
 /** @name Accessibility
diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx
index 

core.git: framework/source

2024-05-11 Thread Noel Grandin (via logerrit)
 framework/source/uiconfiguration/CommandImageResolver.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 89d35be82851d820f36e31ac1866b1d58be0aa07
Author: Noel Grandin 
AuthorDate: Wed May 8 10:01:08 2024 +0200
Commit: Noel Grandin 
CommitDate: Sat May 11 15:04:15 2024 +0200

replace createFromAscii with OUString literals in CommandImageResolver

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

diff --git a/framework/source/uiconfiguration/CommandImageResolver.cxx 
b/framework/source/uiconfiguration/CommandImageResolver.cxx
index a431ae320b35..e6c0c8ba850d 100644
--- a/framework/source/uiconfiguration/CommandImageResolver.cxx
+++ b/framework/source/uiconfiguration/CommandImageResolver.cxx
@@ -21,11 +21,11 @@ namespace vcl
 namespace
 {
 
-const o3tl::enumarray ImageType_Prefixes =
+constexpr o3tl::enumarray ImageType_Prefixes
 {
-"cmd/sc_",
-"cmd/lc_",
-"cmd/32/"
+u"cmd/sc_"_ustr,
+u"cmd/lc_"_ustr,
+u"cmd/32/"_ustr
 };
 
 OUString lclConvertToCanonicalName(const OUString& rFileName)
@@ -129,7 +129,7 @@ ImageList* CommandImageResolver::getImageList(ImageType 
nImageType)
 
 if (!m_pImageList[nImageType])
 {
-OUString sIconPath = 
OUString::createFromAscii(ImageType_Prefixes[nImageType]);
+OUString sIconPath = ImageType_Prefixes[nImageType];
 m_pImageList[nImageType].reset( new ImageList(m_aImageNameVector, 
sIconPath) );
 }
 


core.git: framework/source

2024-05-06 Thread Tibor Nagy (via logerrit)
 framework/source/services/desktop.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 64a50c65ee15c03f58ccf25308a70dfd24e791fe
Author: Tibor Nagy 
AuthorDate: Mon May 6 10:43:34 2024 +0200
Commit: Nagy Tibor 
CommitDate: Mon May 6 14:38:06 2024 +0200

The previous behavior of using the TerminationVetoException has changed

"Since LibreOffice 5.3: Throwing this exception will only prevent 
termination. Exiting LibreOffice will close all the windows but the process 
will keep running."

Currently, the behavior is different, because not only is LibreOffice
prevented from terminating, but the last document cannot be closed either. 
The expected behavior is all windows should be closed, but the
process should be kept running when using a TerminationVetoException.

Change-Id: I8764aefccc4c9feec3ee0e45a54bf0aebcf16c5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167194
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Jenkins

diff --git a/framework/source/services/desktop.cxx 
b/framework/source/services/desktop.cxx
index 6560af7f1eb3..2f9ccbd04bf2 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -201,6 +201,8 @@ sal_Bool SAL_CALL Desktop::terminate()
 aGuard.clear();
 
 // Allow using of any UI ... because Desktop.terminate() was designed as 
UI functionality in the past.
+// try to close all open frames
+bool bFramesClosed = impl_closeFrames(!bRestartableMainLoop);
 
 // Ask normal terminate listener. They could veto terminating the process.
 Desktop::TTerminateListenerList lCalledTerminationListener;
@@ -210,8 +212,7 @@ sal_Bool SAL_CALL Desktop::terminate()
 return false;
 }
 
-// try to close all open frames
-if (!impl_closeFrames(!bRestartableMainLoop))
+if (!bFramesClosed)
 {
 impl_sendCancelTerminationEvent(lCalledTerminationListener);
 return false;


core.git: framework/source

2024-05-03 Thread Noel Grandin (via logerrit)
 framework/source/uielement/controlmenucontroller.cxx |   50 +--
 1 file changed, 25 insertions(+), 25 deletions(-)

New commits:
commit 23d5c8ed000adc4d66f24ddd67b73a8e5c8a0511
Author: Noel Grandin 
AuthorDate: Thu May 2 13:10:00 2024 +0200
Commit: Noel Grandin 
CommitDate: Fri May 3 14:03:57 2024 +0200

replace createFromAscii with OUString literals in framework

Change-Id: I925d79877d477e6273e0ca8d8de7af391d72bb78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167038
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/framework/source/uielement/controlmenucontroller.cxx 
b/framework/source/uielement/controlmenucontroller.cxx
index abb4a5762eb5..a4d69afee1fb 100644
--- a/framework/source/uielement/controlmenucontroller.cxx
+++ b/framework/source/uielement/controlmenucontroller.cxx
@@ -39,28 +39,28 @@
 #include 
 #include 
 
-static const char* aCommands[] =
+constexpr OUString aCommands[]
 {
-".uno:ConvertToEdit",
-".uno:ConvertToButton",
-".uno:ConvertToFixed",
-".uno:ConvertToList",
-".uno:ConvertToCheckBox",
-".uno:ConvertToRadio",
-".uno:ConvertToGroup",
-".uno:ConvertToCombo",
-".uno:ConvertToImageBtn",
-".uno:ConvertToFileControl",
-".uno:ConvertToDate",
-".uno:ConvertToTime",
-".uno:ConvertToNumeric",
-".uno:ConvertToCurrency",
-".uno:ConvertToPattern",
-".uno:ConvertToImageControl",
-".uno:ConvertToFormatted",
-".uno:ConvertToScrollBar",
-".uno:ConvertToSpinButton",
-".uno:ConvertToNavigationBar"
+u".uno:ConvertToEdit"_ustr,
+u".uno:ConvertToButton"_ustr,
+u".uno:ConvertToFixed"_ustr,
+u".uno:ConvertToList"_ustr,
+u".uno:ConvertToCheckBox"_ustr,
+u".uno:ConvertToRadio"_ustr,
+u".uno:ConvertToGroup"_ustr,
+u".uno:ConvertToCombo"_ustr,
+u".uno:ConvertToImageBtn"_ustr,
+u".uno:ConvertToFileControl"_ustr,
+u".uno:ConvertToDate"_ustr,
+u".uno:ConvertToTime"_ustr,
+u".uno:ConvertToNumeric"_ustr,
+u".uno:ConvertToCurrency"_ustr,
+u".uno:ConvertToPattern"_ustr,
+u".uno:ConvertToImageControl"_ustr,
+u".uno:ConvertToFormatted"_ustr,
+u".uno:ConvertToScrollBar"_ustr,
+u".uno:ConvertToSpinButton"_ustr,
+u".uno:ConvertToNavigationBar"_ustr
 };
 
 static TranslateId aLabels[] =
@@ -209,7 +209,7 @@ void ControlMenuController::fillPopupMenu( Reference< 
css::awt::XPopupMenu > con
 for (size_t i=0; i < SAL_N_ELEMENTS(aCommands); ++i)
 {
 sal_Int16 nItemId = i + 1;
-OUString sCommand(OUString::createFromAscii(aCommands[i]));
+OUString sCommand(aCommands[i]);
 rPopupMenu->insertItem(nItemId, FwkResId(aLabels[i]), 0, i);
 rPopupMenu->setCommand(nItemId, sCommand);
 rPopupMenu->enableItem(nItemId, false);
@@ -247,7 +247,7 @@ void SAL_CALL ControlMenuController::statusChanged( const 
FeatureStateEvent& Eve
 sal_Int16 nItemId = 0;
 for (size_t i=0; i < SAL_N_ELEMENTS(aCommands); ++i)
 {
-if ( Event.FeatureURL.Complete.equalsAscii( aCommands[i] ))
+if ( Event.FeatureURL.Complete == aCommands[i] )
 {
 nItemId = i + 1;
 break;
@@ -293,9 +293,9 @@ void SAL_CALL ControlMenuController::updatePopupMenu()
 fillPopupMenu( m_xPopupMenu );
 m_aURLToDispatchMap.free();
 
-for (const char* aCommand : aCommands)
+for (const OUString& aCommand : aCommands)
 {
-aTargetURL.Complete = OUString::createFromAscii( aCommand );
+aTargetURL.Complete = aCommand;
 m_xURLTransformer->parseStrict( aTargetURL );
 
 Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( 
aTargetURL, OUString(), 0 );


core.git: framework/source

2024-05-03 Thread Noel Grandin (via logerrit)
 framework/source/layoutmanager/helpers.cxx  |4 ++--
 framework/source/layoutmanager/helpers.hxx  |2 +-
 framework/source/layoutmanager/toolbarlayoutmanager.cxx |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 0c98269868a63b308d238d14e0c324a5e5d26dde
Author: Noel Grandin 
AuthorDate: Thu May 2 13:05:46 2024 +0200
Commit: Noel Grandin 
CommitDate: Fri May 3 08:00:49 2024 +0200

replace createFromAscii with OUString literals in framework

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

diff --git a/framework/source/layoutmanager/helpers.cxx 
b/framework/source/layoutmanager/helpers.cxx
index ccce1b3e8673..22965a3e6a5d 100644
--- a/framework/source/layoutmanager/helpers.cxx
+++ b/framework/source/layoutmanager/helpers.cxx
@@ -154,14 +154,14 @@ bool lcl_checkUIElement(const uno::Reference< 
ui::XUIElement >& xUIElement, awt:
 return bRet;
 }
 
-uno::Reference< awt::XVclWindowPeer > createToolkitWindow( const 
uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< 
awt::XVclWindowPeer >& rParent, const char* pService )
+uno::Reference< awt::XVclWindowPeer > createToolkitWindow( const 
uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< 
awt::XVclWindowPeer >& rParent, const OUString& pService )
 {
 uno::Reference< awt::XToolkit2 > xToolkit = awt::Toolkit::create( 
rxContext );
 
 // describe window properties.
 css::awt::WindowDescriptor aDescriptor;
 aDescriptor.Type=   awt::WindowClass_SIMPLE;
-aDescriptor.WindowServiceName   =   OUString::createFromAscii( pService );
+aDescriptor.WindowServiceName   =   pService;
 aDescriptor.ParentIndex =   -1;
 aDescriptor.Parent = rParent;
 aDescriptor.Bounds  =   awt::Rectangle(0,0,0,0);
diff --git a/framework/source/layoutmanager/helpers.hxx 
b/framework/source/layoutmanager/helpers.hxx
index c58fa6665bad..b15ba4446ced 100644
--- a/framework/source/layoutmanager/helpers.hxx
+++ b/framework/source/layoutmanager/helpers.hxx
@@ -50,7 +50,7 @@ vcl::Window* getWindowFromXUIElement( const 
css::uno::Reference< css::ui::XUIEle
 SystemWindow* getTopSystemWindow( const css::uno::Reference< css::awt::XWindow 
>& xWindow );
 bool equalRectangles( const css::awt::Rectangle& rRect1, const 
css::awt::Rectangle& rRect2 );
 bool lcl_checkUIElement(const css::uno::Reference< css::ui::XUIElement >& 
xUIElement,css::awt::Rectangle& _rPosSize, css::uno::Reference< 
css::awt::XWindow >& _xWindow);
-css::uno::Reference< css::awt::XVclWindowPeer > createToolkitWindow( const 
css::uno::Reference< css::uno::XComponentContext >& rxContext, const 
css::uno::Reference< css::awt::XVclWindowPeer >& rParent, const char* pService 
);
+css::uno::Reference< css::awt::XVclWindowPeer > createToolkitWindow( const 
css::uno::Reference< css::uno::XComponentContext >& rxContext, const 
css::uno::Reference< css::awt::XVclWindowPeer >& rParent, const OUString& 
pService );
 WindowAlign ImplConvertAlignment( css::ui::DockingArea aAlignment );
 std::u16string_view getElementTypeFromResourceURL( std::u16string_view 
aResourceURL );
 void parseResourceURL( std::u16string_view aResourceURL, OUString& 
aElementType, OUString& aElementName );
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx 
b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 46bbe90fc17d..39f228ca1133 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -1004,7 +1004,7 @@ void ToolbarLayoutManager::resetDockingArea()
 void ToolbarLayoutManager::setParentWindow(
 const uno::Reference< awt::XVclWindowPeer >& xParentWindow )
 {
-static const char DOCKINGAREASTRING[] = "dockingarea";
+static constexpr OUString DOCKINGAREASTRING = u"dockingarea"_ustr;
 
 uno::Reference< awt::XWindow > xTopDockWindow( createToolkitWindow( 
m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
 uno::Reference< awt::XWindow > xLeftDockWindow( createToolkitWindow( 
m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );


core.git: framework/source

2024-04-01 Thread Gabor Kelemen (via logerrit)
 framework/source/fwe/xml/menuconfiguration.cxx  |1 -
 framework/source/fwe/xml/statusbarconfiguration.cxx |1 -
 framework/source/fwe/xml/toolboxconfiguration.cxx   |1 -
 framework/source/fwi/helper/mischelper.cxx  |2 --
 framework/source/helper/dockingareadefaultacceptor.cxx  |2 --
 framework/source/helper/ocomponentaccess.cxx|1 -
 framework/source/helper/ocomponentenumeration.cxx   |1 -
 framework/source/helper/oframes.cxx |2 --
 framework/source/uiconfiguration/imagemanager.cxx   |2 --
 framework/source/uiconfiguration/moduleuicfgsupplier.cxx|3 ---
 framework/source/uiconfiguration/uicategorydescription.cxx  |1 -
 framework/source/uielement/FixedImageToolbarController.cxx  |4 
 framework/source/uielement/FixedTextToolbarController.cxx   |3 ---
 framework/source/uielement/comboboxtoolbarcontroller.cxx|2 --
 framework/source/uielement/complextoolbarcontroller.cxx |1 -
 framework/source/uielement/controlmenucontroller.cxx|1 -
 framework/source/uielement/dropdownboxtoolbarcontroller.cxx |3 ---
 framework/source/uielement/edittoolbarcontroller.cxx|2 --
 framework/source/uielement/fontmenucontroller.cxx   |1 -
 framework/source/uielement/footermenucontroller.cxx |5 -
 framework/source/uielement/genericstatusbarcontroller.cxx   |2 --
 framework/source/uielement/headermenucontroller.cxx |1 -
 framework/source/uielement/imagebuttontoolbarcontroller.cxx |3 ---
 framework/source/uielement/langselectionmenucontroller.cxx  |1 -
 framework/source/uielement/langselectionstatusbarcontroller.cxx |2 --
 framework/source/uielement/macrosmenucontroller.cxx |3 ---
 framework/source/uielement/newmenucontroller.cxx|1 -
 framework/source/uielement/objectmenucontroller.cxx |3 ---
 framework/source/uielement/spinfieldtoolbarcontroller.cxx   |2 --
 framework/source/uielement/statusbarwrapper.cxx |1 -
 framework/source/uielement/statusindicatorinterfacewrapper.cxx  |1 -
 framework/source/uielement/togglebuttontoolbarcontroller.cxx|2 --
 framework/source/uielement/toolbarmodemenucontroller.cxx|3 ---
 framework/source/uifactory/addonstoolbarfactory.cxx |1 -
 framework/source/uifactory/menubarfactory.cxx   |1 -
 framework/source/uifactory/statusbarfactory.cxx |2 --
 framework/source/uifactory/toolbarfactory.cxx   |1 -
 framework/source/uifactory/uicontrollerfactory.cxx  |1 -
 38 files changed, 70 deletions(-)

New commits:
commit 7c18a0bb37fc2cd50bd3fa4386b02d88fbedb773
Author: Gabor Kelemen 
AuthorDate: Fri Mar 29 14:04:32 2024 +0100
Commit: Gabor Kelemen 
CommitDate: Mon Apr 1 11:46:16 2024 +0200

tdf#146619 Drop unused 'using namespace' in: framework/

Change-Id: I03d2d3d07d0d71800df624510b5e20bd5e0588e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165531
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen 

diff --git a/framework/source/fwe/xml/menuconfiguration.cxx 
b/framework/source/fwe/xml/menuconfiguration.cxx
index d2131c8a8deb..1047422ed775 100644
--- a/framework/source/fwe/xml/menuconfiguration.cxx
+++ b/framework/source/fwe/xml/menuconfiguration.cxx
@@ -34,7 +34,6 @@
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::xml::sax;
 using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::io;
diff --git a/framework/source/fwe/xml/statusbarconfiguration.cxx 
b/framework/source/fwe/xml/statusbarconfiguration.cxx
index ce974237b286..98130700ef26 100644
--- a/framework/source/fwe/xml/statusbarconfiguration.cxx
+++ b/framework/source/fwe/xml/statusbarconfiguration.cxx
@@ -29,7 +29,6 @@
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::xml::sax;
-using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::container;
 
diff --git a/framework/source/fwe/xml/toolboxconfiguration.cxx 
b/framework/source/fwe/xml/toolboxconfiguration.cxx
index d9e34baabc98..c88b3c01da2d 100644
--- a/framework/source/fwe/xml/toolboxconfiguration.cxx
+++ b/framework/source/fwe/xml/toolboxconfiguration.cxx
@@ -29,7 +29,6 @@
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::xml::sax;
-using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::container;
 
diff --git a/framework/source/fwi/helper/mischelper.cxx 
b/framework/source/fwi/helper/mischelper.cxx
index e9c664d474df..af83c5867356 

core.git: framework/source

2024-03-21 Thread Michael Stahl (via logerrit)
 framework/source/uielement/menubarmanager.cxx |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 447a15f4772bcbc9366cfa43b92c55ae644e9b03
Author: Michael Stahl 
AuthorDate: Wed Mar 20 21:42:50 2024 +0100
Commit: Michael Stahl 
CommitDate: Thu Mar 21 10:49:06 2024 +0100

framework: MenuBarManager: fix WNT crash if queryDispatch() throws

a Java extension throws RuntimeException from queryDispatch(), which is
translated to a C++ exception and thrown by the mscx_uno bridge, and this
is apparently not handled anywhere (Visual Studio says "Unhandled
Exception"), and what happens then apparently is the exception goes poof
and vanishes, and normal return from the mscx_uno bridge code happens,
but the out parameter used for the return value is never initialised, and
then the uno::Reference move assignment operator crashes.

Change-Id: I21535fcf0ab4ec30a712d01b5039b7e2fb7b09d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165081
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/framework/source/uielement/menubarmanager.cxx 
b/framework/source/uielement/menubarmanager.cxx
index 770e6b166a1c..0eb7705e66fd 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -660,7 +660,16 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
 if ( aTargetURL.Complete.startsWith( ".uno:StyleApply?" ) )
 xMenuItemDispatch = new StyleDispatcher( m_xFrame, 
m_xURLTransformer, aTargetURL );
 else
-xMenuItemDispatch = xDispatchProvider->queryDispatch( 
aTargetURL, menuItemHandler->aTargetFrame, 0 );
+{
+try
+{
+xMenuItemDispatch = xDispatchProvider->queryDispatch( 
aTargetURL, menuItemHandler->aTargetFrame, 0 );
+}
+catch (uno::Exception const&)
+{
+TOOLS_WARN_EXCEPTION("fwk.uielement", 
"MenuBarManager::Activate(): exception from queryDispatch()");
+}
+}
 
 bool bPopupMenu( false );
 if ( !menuItemHandler->xPopupMenuController.is() &&


core.git: framework/source sw/source writerfilter/source xmlhelp/source

2024-02-14 Thread varshneydevansh (via logerrit)
 framework/source/services/autorecovery.cxx  |   52 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   12 ++---
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx |   16 +++
 xmlhelp/source/cxxhelp/provider/databases.cxx   |   14 +++---
 xmlhelp/source/treeview/tvread.cxx  |   10 ++--
 5 files changed, 52 insertions(+), 52 deletions(-)

New commits:
commit 0859e497be07acceb0a950183d5997374783266f
Author: varshneydevansh 
AuthorDate: Fri Feb 2 00:12:33 2024 +0530
Commit: Hossein 
CommitDate: Wed Feb 14 09:58:21 2024 +0100

tdf#145539 convert const char[] in files to constexpr OUStringLiteral

OStringLiteral represent read-only memory for string literal while
OUString is a dynamic string class with reference counting
hence use OUString when you need reference counting, string
manipulation along with _ustr suffix.

Change-Id: Ib566df156d81c7527f5650bcc6bd5db6509128cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162911
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 22bdb916a642..6852be6dc954 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -1066,35 +1066,35 @@ constexpr OUStringLiteral TYPE_PROP_EXTENSIONS = 
u"Extensions";
 constexpr OUStringLiteral CFG_ENTRY_PROP_EMPTYDOCUMENTURL = 
u"ooSetupFactoryEmptyDocumentURL";
 constexpr OUStringLiteral CFG_ENTRY_PROP_FACTORYSERVICE = 
u"ooSetupFactoryDocumentService";
 
-const char EVENT_ON_NEW[] = "OnNew";
-const char EVENT_ON_LOAD[] = "OnLoad";
-const char EVENT_ON_UNLOAD[] = "OnUnload";
-const char EVENT_ON_MODIFYCHANGED[] = "OnModifyChanged";
-const char EVENT_ON_SAVE[] = "OnSave";
-const char EVENT_ON_SAVEAS[] = "OnSaveAs";
-const char EVENT_ON_SAVETO[] = "OnCopyTo";
-const char EVENT_ON_SAVEDONE[] = "OnSaveDone";
-const char EVENT_ON_SAVEASDONE[] = "OnSaveAsDone";
-const char EVENT_ON_SAVETODONE[] = "OnCopyToDone";
-const char EVENT_ON_SAVEFAILED[] = "OnSaveFailed";
-const char EVENT_ON_SAVEASFAILED[] = "OnSaveAsFailed";
-const char EVENT_ON_SAVETOFAILED[] = "OnCopyToFailed";
+constexpr OUStringLiteral EVENT_ON_NEW = u"OnNew";
+constexpr OUStringLiteral EVENT_ON_LOAD = u"OnLoad";
+constexpr OUStringLiteral EVENT_ON_UNLOAD = u"OnUnload";
+constexpr OUStringLiteral EVENT_ON_MODIFYCHANGED = u"OnModifyChanged";
+constexpr OUStringLiteral EVENT_ON_SAVE = u"OnSave";
+constexpr OUStringLiteral EVENT_ON_SAVEAS = u"OnSaveAs";
+constexpr OUStringLiteral EVENT_ON_SAVETO = u"OnCopyTo";
+constexpr OUStringLiteral EVENT_ON_SAVEDONE = u"OnSaveDone";
+constexpr OUStringLiteral EVENT_ON_SAVEASDONE = u"OnSaveAsDone";
+constexpr OUStringLiteral EVENT_ON_SAVETODONE = u"OnCopyToDone";
+constexpr OUStringLiteral EVENT_ON_SAVEFAILED = u"OnSaveFailed";
+constexpr OUStringLiteral EVENT_ON_SAVEASFAILED = u"OnSaveAsFailed";
+constexpr OUStringLiteral EVENT_ON_SAVETOFAILED = u"OnCopyToFailed";
 
 constexpr OUString RECOVERY_ITEM_BASE_IDENTIFIER = u"recovery_item_"_ustr;
 
-const char CMD_PROTOCOL[] = "vnd.sun.star.autorecovery:";
-
-const char CMD_DO_AUTO_SAVE[] = "/doAutoSave";// force AutoSave ignoring 
the AutoSave timer
-const char CMD_DO_PREPARE_EMERGENCY_SAVE[] = "/doPrepareEmergencySave";// 
prepare the office for the following EmergencySave step (hide windows etcpp.)
-const char CMD_DO_EMERGENCY_SAVE[] = "/doEmergencySave";// do 
EmergencySave on crash
-const char CMD_DO_RECOVERY[] = "/doAutoRecovery";// recover all crashed 
documents
-const char CMD_DO_ENTRY_BACKUP[] = "/doEntryBackup";// try to store a temp 
or original file to a user defined location
-const char CMD_DO_ENTRY_CLEANUP[] = "/doEntryCleanUp";// remove the 
specified entry from the recovery cache
-const char CMD_DO_SESSION_SAVE[] = "/doSessionSave";// save all open 
documents if e.g. a window manager closes an user session
-const char CMD_DO_SESSION_QUIET_QUIT[] = "/doSessionQuietQuit";// let the 
current session be quietly closed ( the saving should be done using 
doSessionSave previously ) if e.g. a window manager closes an user session
-const char CMD_DO_SESSION_RESTORE[] = "/doSessionRestore";// restore a 
saved user session from disc
-const char CMD_DO_DISABLE_RECOVERY[] = "/disableRecovery";// disable 
recovery and auto save (!) temp. for this office session
-const char CMD_DO_SET_AUTOSAVE_STATE[] = "/setAutoSaveState";// 
disable/enable auto save (not crash save) for this office session
+constexpr OUString CMD_PROTOCOL = u"vnd.sun.star.autorecovery:"_ustr;
+
+constexpr OUString CMD_DO_AUTO_SAVE = u"/doAutoSave"_ustr;// force 
AutoSave ignoring the AutoSave timer
+constexpr OUString CMD_DO_PREPARE_EMERGENCY_SAVE = 
u"/doPrepareEmergencySave"_ustr;// prepare the office for the following 
EmergencySave step (hide windows etcpp.)
+constexpr OUString CMD_DO_EMERGENCY_SAVE = u"/doEmergencySave"_ustr;  

core.git: framework/source sc/source

2024-01-26 Thread Henry Castro (via logerrit)
 framework/source/uielement/langselectionstatusbarcontroller.cxx |5 -
 sc/source/ui/docshell/docsh4.cxx|   45 
++
 2 files changed, 33 insertions(+), 17 deletions(-)

New commits:
commit 64e1a5916367644ad3883a24ab1630d1340603b3
Author: Henry Castro 
AuthorDate: Wed Jan 17 16:25:41 2024 -0400
Commit: Henry Castro 
CommitDate: Fri Jan 26 19:41:14 2024 +0100

tdf#127856: fix setting "None" in cell format language

Change-Id: I94dc0b1e7f0a52e8fb6da1f9b80456cec696a727
Signed-off-by: Henry Castro 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162244
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx 
b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index 2d56c4186883..f5730ae7ee54 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -190,7 +190,10 @@ void LangSelectionStatusbarController::LangMenu(
 }
 else
 {
-xPopupMenu->insertItem( MID_LANG_DEF_NONE,  
FwkResId(STR_LANGSTATUS_NONE), 0, MID_LANG_DEF_NONE );
+if (bCalc)
+xPopupMenu->insertItem( MID_LANG_SEL_NONE,  
FwkResId(STR_LANGSTATUS_NONE), 0, MID_LANG_SEL_NONE );
+else
+xPopupMenu->insertItem( MID_LANG_DEF_NONE,  
FwkResId(STR_LANGSTATUS_NONE), 0, MID_LANG_DEF_NONE );
 if ( sNone == m_aCurLang )
 xPopupMenu->checkItem( MID_LANG_DEF_NONE, true );
 xPopupMenu->insertItem( MID_LANG_DEF_RESET, 
FwkResId(STR_RESET_TO_DEFAULT_LANGUAGE), 0, MID_LANG_DEF_RESET );
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 82b874391f38..34e69724742c 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1301,28 +1301,41 @@ void ScDocShell::Execute( SfxRequest& rReq )
 if (bSelection)
 {
 ScTabViewShell* pViewShell = GetBestViewShell();
-const LanguageType nLangType = 
SvtLanguageTable::GetLanguageType(aLangText);
-const SvtScriptType nScriptType = 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType);
-
 if (pViewShell)
 {
 const ScPatternAttr* pSelAttrs = 
pViewShell->GetSelectionPattern();
 if (pSelAttrs)
 {
 const SfxItemSet& rOldSet = 
pSelAttrs->GetItemSet();
+SfxItemPool* pItemPool = rOldSet.GetPool();
 auto pNewSet = 
std::make_shared(rOldSet);
 
-if (nScriptType == SvtScriptType::LATIN)
-pNewSet->Put(SvxLanguageItem(nLangType,
- 
rOldSet.GetPool()->GetWhich(SID_ATTR_CHAR_LANGUAGE)));
-if (nScriptType == SvtScriptType::COMPLEX)
-pNewSet->Put(SvxLanguageItem(nLangType,
- 
rOldSet.GetPool()->GetWhich(SID_ATTR_CHAR_CTL_LANGUAGE)));
-if (nScriptType == SvtScriptType::ASIAN)
-pNewSet->Put(SvxLanguageItem(nLangType,
- 
rOldSet.GetPool()->GetWhich(SID_ATTR_CHAR_CJK_LANGUAGE)));
-
+if (aLangText == "LANGUAGE_NONE")
+{
+pNewSet->Put(SvxLanguageItem(LANGUAGE_NONE,
+ 
pItemPool->GetWhich(SID_ATTR_CHAR_LANGUAGE)));
+pNewSet->Put(SvxLanguageItem(LANGUAGE_NONE,
+ 
pItemPool->GetWhich(SID_ATTR_CHAR_CJK_LANGUAGE)));
+pNewSet->Put(SvxLanguageItem(LANGUAGE_NONE,
+ 
pItemPool->GetWhich(SID_ATTR_CHAR_CTL_LANGUAGE)));
+}
+else
+{
+const LanguageType nLangType = 
SvtLanguageTable::GetLanguageType(aLangText);
+const SvtScriptType nScriptType =
+
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType);
+if (nScriptType == SvtScriptType::LATIN)
+pNewSet->Put(SvxLanguageItem(nLangType,
+ 
pItemPool->GetWhich(SID_ATTR_CHAR_LANGUAGE)));
+if (nScriptType == SvtScriptType::COMPLEX)
+pNewSet->Put(SvxLanguageItem(nLangType,
+   

core.git: framework/source sc/source

2024-01-26 Thread Henry Castro (via logerrit)
 framework/source/uielement/langselectionstatusbarcontroller.cxx |5 
 sc/source/ui/docshell/docsh4.cxx|   11 
--
 2 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 966f075a332b38a2689dad317d5d3c3fa61a1efb
Author: Henry Castro 
AuthorDate: Wed Jan 24 09:51:17 2024 -0400
Commit: Henry Castro 
CommitDate: Fri Jan 26 19:40:54 2024 +0100

tdf#34142: update status language after the cell format language change

Change-Id: Ieb97515cee469a54c5b28ac4477c9d0d78e2974c
Signed-off-by: Henry Castro 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162243
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx 
b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index 169583a76fcd..2d56c4186883 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -244,10 +244,7 @@ void LangSelectionStatusbarController::LangMenu(
 }
 else if (nId == MID_LANG_DEF_MORE)
 {
-if (bCalc)
-aBuff.append( ".uno:FormatCellDialog" );
-else
-aBuff.append( ".uno:LanguageStatus?Language:string=*" );
+aBuff.append( ".uno:LanguageStatus?Language:string=*" );
 }
 else if (MID_LANG_PARA_1 <= nId && nId <= MID_LANG_PARA_9)
 {
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 813d86785a7a..82b874391f38 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1252,12 +1252,11 @@ void ScDocShell::Execute( SfxRequest& rReq )
 sal_Int32 nPos = 0;
 if ( aLangText == "*" )
 {
-SfxAbstractDialogFactory* pFact = 
SfxAbstractDialogFactory::Create();
-ScTabViewShell* pSh = GetBestViewShell();
-ScopedVclPtr 
pDlg(pFact->CreateVclDialog(pSh ? pSh->GetDialogParent() : nullptr, 
SID_LANGUAGE_OPTIONS));
-pDlg->Execute();
-
-rDoc.GetLanguage( eLang, eCjk, eCtl );
+if (ScTabViewShell* pSh = GetBestViewShell())
+{
+pSh->ExecuteCellFormatDlg(rReq, "font");
+pBindings->Invalidate(SID_LANGUAGE_STATUS);
+}
 }
 else if ( (nPos = aLangText.indexOf(aDocLangPrefix)) != -1 )
 {


core.git: framework/source sc/source

2024-01-05 Thread Henry Castro (via logerrit)
 framework/source/uielement/langselectionstatusbarcontroller.cxx |2 
 sc/source/ui/docshell/docsh4.cxx|   30 
+-
 2 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit fbbad70b9437aa2e96f004c530f2d552715cf810
Author: Henry Castro 
AuthorDate: Wed Dec 27 11:12:16 2023 -0400
Commit: Caolán McNamara 
CommitDate: Fri Jan 5 18:14:26 2024 +0100

tdf#127856: fix cell selection language

Clicking the language in the popup Calc's status bar,
it will change the cell range selection language property.

Signed-off-by: Henry Castro 
Change-Id: I1cc218da44eff0a4d3acee7b089e54aaad474379
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161371
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx 
b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index f913688526db..169583a76fcd 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -212,7 +212,7 @@ void LangSelectionStatusbarController::LangMenu(
 
 if (MID_LANG_SEL_1 <= nId && nId <= MID_LANG_SEL_9)
 {
-if (bWriter)
+if (bWriter || bCalc)
 aBuff.append( ".uno:LanguageStatus?Language:string=Current_" );
 else
 aBuff.append( ".uno:LanguageStatus?Language:string=Default_" );
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 08a37c9e1b62..3e316ce9420f 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1290,7 +1290,35 @@ void ScDocShell::Execute( SfxRequest& rReq )
 aLangText = aLangText.replaceAt( nPos, 
aParagraphLangPrefix.getLength(), u"" );
 }
 
-if (bSelection || bParagraph)
+if (bSelection)
+{
+ScTabViewShell* pViewShell = GetBestViewShell();
+const LanguageType nLangType = 
SvtLanguageTable::GetLanguageType(aLangText);
+const SvtScriptType nScriptType = 
SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType);
+
+if (pViewShell)
+{
+const ScPatternAttr* pSelAttrs = 
pViewShell->GetSelectionPattern();
+if (pSelAttrs)
+{
+const SfxItemSet& rOldSet = 
pSelAttrs->GetItemSet();
+auto pNewSet = 
std::make_shared(rOldSet);
+
+if (nScriptType == SvtScriptType::LATIN)
+pNewSet->Put(SvxLanguageItem(nLangType,
+ 
rOldSet.GetPool()->GetWhich(SID_ATTR_CHAR_LANGUAGE)));
+if (nScriptType == SvtScriptType::COMPLEX)
+pNewSet->Put(SvxLanguageItem(nLangType,
+ 
rOldSet.GetPool()->GetWhich(SID_ATTR_CHAR_CJK_LANGUAGE)));
+if (nScriptType == SvtScriptType::ASIAN)
+pNewSet->Put(SvxLanguageItem(nLangType,
+ 
rOldSet.GetPool()->GetWhich(SID_ATTR_CHAR_CTL_LANGUAGE)));
+
+pViewShell->ApplyAttributes(*pNewSet, rOldSet);
+}
+}
+}
+else if (bParagraph)
 {
 ScViewData* pViewData = GetViewData();
 if (!pViewData)


core.git: framework/source

2023-12-26 Thread Julien Nabet (via logerrit)
 framework/source/uielement/statusbarmanager.cxx |   42 ++--
 1 file changed, 12 insertions(+), 30 deletions(-)

New commits:
commit 0b194702002af52d1e0034d41e497052675eb84a
Author: Julien Nabet 
AuthorDate: Tue Dec 26 17:53:48 2023 +0100
Commit: Julien Nabet 
CommitDate: Tue Dec 26 19:56:36 2023 +0100

Simplify aPropVector construction in framework/statusbarmanager

Change-Id: I14dfe9f156109c9c098e27fcf88ca9a273e7722c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161308
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/framework/source/uielement/statusbarmanager.cxx 
b/framework/source/uielement/statusbarmanager.cxx
index dbc305c696fa..3efb64c44bfd 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -299,38 +300,19 @@ void StatusBarManager::CreateControllers()
 AddonStatusbarItemData *pItemData = static_cast< 
AddonStatusbarItemData *>( m_pStatusBar->GetItemData( nId ) );
 uno::Reference< ui::XStatusbarItem > xStatusbarItem = new 
StatusbarItem( m_pStatusBar, nId, aCommandURL );
 
-beans::PropertyValue aPropValue;
-std::vector< uno::Any > aPropVector;
-
-aPropValue.Name = "CommandURL";
-aPropValue.Value<<= aCommandURL;
-aPropVector.push_back( uno::Any( aPropValue ) );
-
-aPropValue.Name = "ModuleIdentifier";
-aPropValue.Value<<= OUString();
-aPropVector.push_back( uno::Any( aPropValue ) );
-
-aPropValue.Name = "Frame";
-aPropValue.Value<<= m_xFrame;
-aPropVector.push_back( uno::Any( aPropValue ) );
-
-// TODO remove this
-aPropValue.Name = "ServiceManager";
-aPropValue.Value<<= 
uno::Reference(m_xContext->getServiceManager(), 
uno::UNO_QUERY_THROW);
-aPropVector.push_back( uno::Any( aPropValue ) );
-
-aPropValue.Name = "ParentWindow";
-aPropValue.Value<<= xStatusbarWindow;
-aPropVector.push_back( uno::Any( aPropValue ) );
+std::vector< uno::Any > aPropVector
+{
+uno::Any(comphelper::makePropertyValue("CommandURL", aCommandURL)),
+uno::Any(comphelper::makePropertyValue("ModuleIdentifier", 
u""_ustr)),
+uno::Any(comphelper::makePropertyValue("Frame", m_xFrame)),
 
-// TODO still needing with the css::ui::XStatusbarItem?
-aPropValue.Name = "Identifier";
-aPropValue.Value<<= nId;
-aPropVector.push_back( uno::Any( aPropValue ) );
+// TODO remove this
+uno::Any(comphelper::makePropertyValue("ServiceManager", 
uno::Reference(m_xContext->getServiceManager(), 
uno::UNO_QUERY_THROW))),
 
-aPropValue.Name = "StatusbarItem";
-aPropValue.Value<<= xStatusbarItem;
-aPropVector.push_back( uno::Any( aPropValue ) );
+uno::Any(comphelper::makePropertyValue("ParentWindow", 
xStatusbarWindow)),
+uno::Any(comphelper::makePropertyValue("Identifier", nId)),
+uno::Any(comphelper::makePropertyValue("StatusbarItem", 
xStatusbarItem))
+};
 
 uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( 
aPropVector ) );
 


core.git: framework/source

2023-12-21 Thread t-aswath (via logerrit)
 framework/source/uielement/addonstoolbarwrapper.cxx |3 ++-
 framework/source/uielement/statusbarwrapper.cxx |3 ++-
 framework/source/uielement/toolbarwrapper.cxx   |3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit a2cd681369061574974517b1aabf78613f5601b7
Author: t-aswath 
AuthorDate: Fri Dec 8 09:46:29 2023 +0530
Commit: Hossein 
CommitDate: Thu Dec 21 23:38:15 2023 +0100

tdf#114441 - Convert use of sal_uLong to better integer types

Change-Id: Ia226ea485700a6864c9d5ca154267c5080555a82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160450
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx 
b/framework/source/uielement/addonstoolbarwrapper.cxx
index f0bb99549fcf..740a120d63e7 100644
--- a/framework/source/uielement/addonstoolbarwrapper.cxx
+++ b/framework/source/uielement/addonstoolbarwrapper.cxx
@@ -27,6 +27,7 @@
 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star::uno;
 using namespace com::sun::star::beans;
@@ -102,7 +103,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const 
Sequence< Any >& aArgument
 VclPtr pWindow = VCLUnoHelper::GetWindow( 
xFrame->getContainerWindow() );
 if ( pWindow )
 {
-sal_uLong nStyles = WB_BORDER | WB_SCROLL | WB_MOVEABLE | 
WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
+WinBits nStyles = WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK 
| WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
 
 pToolBar = VclPtr::Create( pWindow, nStyles );
 pToolBar->SetLineSpacing(true);
diff --git a/framework/source/uielement/statusbarwrapper.cxx 
b/framework/source/uielement/statusbarwrapper.cxx
index 845a0b9269cf..58203d9f4db3 100644
--- a/framework/source/uielement/statusbarwrapper.cxx
+++ b/framework/source/uielement/statusbarwrapper.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star::uno;
 using namespace com::sun::star::beans;
@@ -99,7 +100,7 @@ void SAL_CALL StatusBarWrapper::initialize( const Sequence< 
Any >& aArguments )
 VclPtr pWindow = VCLUnoHelper::GetWindow( 
xFrame->getContainerWindow() );
 if ( pWindow )
 {
-sal_uLong nStyles = WinBits( WB_LEFT | WB_3DLOOK );
+WinBits nStyles = WinBits( WB_LEFT | WB_3DLOOK );
 
 pStatusBar = VclPtr::Create( pWindow, nStyles 
);
 pStatusBarManager = new StatusBarManager( m_xContext, xFrame, 
pStatusBar );
diff --git a/framework/source/uielement/toolbarwrapper.cxx 
b/framework/source/uielement/toolbarwrapper.cxx
index ae988744c142..30d0e84e2b1a 100644
--- a/framework/source/uielement/toolbarwrapper.cxx
+++ b/framework/source/uielement/toolbarwrapper.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
@@ -145,7 +146,7 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< 
Any >& aArguments )
 VclPtr pWindow = VCLUnoHelper::GetWindow( xParentWindow );
 if ( pWindow )
 {
-sal_uLong nStyles = WB_BORDER | WB_SCROLL | WB_MOVEABLE | 
WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
+WinBits nStyles = WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK 
| WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
 
 pToolBar = VclPtr::Create( pWindow, nStyles );
 pToolBar->SetLineSpacing(true);


core.git: framework/source sfx2/source sw/source

2023-12-20 Thread Caolán McNamara (via logerrit)
 framework/source/uielement/menubarmanager.cxx |3 +--
 sfx2/source/doc/docfile.cxx   |3 +--
 sw/source/filter/ww8/docxattributeoutput.cxx  |5 ++---
 sw/source/filter/xml/xmlexpit.hxx |   11 ---
 sw/source/filter/xml/xmlimpit.cxx |4 ++--
 sw/source/filter/xml/xmlimpit.hxx |2 +-
 sw/source/filter/xml/xmlitemi.cxx |4 ++--
 sw/source/ui/vba/vbabookmarks.cxx |3 +--
 sw/source/uibase/docvw/edtwin.cxx |3 +--
 9 files changed, 15 insertions(+), 23 deletions(-)

New commits:
commit fdb37b71b563c3ffa90b5b0c4643fdad62b9c67c
Author: Caolán McNamara 
AuthorDate: Tue Dec 19 19:33:44 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Dec 20 09:30:56 2023 +0100

cid#1545835 COPY_INSTEAD_OF_MOVE

and

cid#1545830 COPY_INSTEAD_OF_MOVE
cid#1545798 COPY_INSTEAD_OF_MOVE
cid#1545784 COPY_INSTEAD_OF_MOVE
cid#1545753 COPY_INSTEAD_OF_MOVE
cid#1545752 COPY_INSTEAD_OF_MOVE
cid#1545672 COPY_INSTEAD_OF_MOVE

Change-Id: Iaf2f77cb27ae0ea1585416a0c500f7c50d04e3fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161007
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/framework/source/uielement/menubarmanager.cxx 
b/framework/source/uielement/menubarmanager.cxx
index 2abd58434827..1f2c25ba085a 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1527,11 +1527,10 @@ void MenuBarManager::AddMenu(MenuBarManager* 
pSubMenuManager,const OUString& _sI
 Reference< XStatusListener > xSubMenuManager( pSubMenuManager );
 m_xFrame->addFrameActionListener( Reference< XFrameActionListener >( 
xSubMenuManager, UNO_QUERY ));
 
-Reference< XDispatch > xDispatch;
 std::unique_ptr pMenuItemHandler(new MenuItemHandler(
 _nItemId,
 pSubMenuManager,
-xDispatch ));
+Reference() ));
 pMenuItemHandler->aMenuItemURL = _sItemCommand;
 m_aMenuItemHandlerVector.push_back( std::move(pMenuItemHandler) );
 }
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 0cdbd884663b..282354795520 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -3871,9 +3871,8 @@ void SfxMedium::AddVersion_Impl( util::RevisionTag& 
rRevision )
 if ( aLongs[nKey] > nKey+1 )
 break;
 
-OUString aRevName = "Version" + OUString::number( nKey + 1 );
+rRevision.Identifier = "Version" + OUString::number( nKey + 1 );
 pImpl->aVersions.realloc( nLength+1 );
-rRevision.Identifier = aRevName;
 pImpl->aVersions.getArray()[nLength] = rRevision;
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 10db254a711f..20738c09967e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7429,11 +7429,10 @@ void DocxAttributeOutput::EmbedFontStyle( 
std::u16string_view name, int tag, Fon
 xOutStream->writeBytes( uno::Sequence< sal_Int8 >( 
reinterpret_cast< const sal_Int8* >( buffer ), readSize ));
 }
 xOutStream->closeOutput();
-OString relId = OUStringToOString( 
GetExport().GetFilter().addRelation( m_pSerializer->getOutputStream(),
+EmbeddedFontRef ref;
+ref.relId = OUStringToOString( GetExport().GetFilter().addRelation( 
m_pSerializer->getOutputStream(),
 oox::getRelationship(Relationship::FONT),
 Concat2View("fonts/font" + OUString::number( m_nextFontId ) + 
".odttf") ), RTL_TEXTENCODING_UTF8 );
-EmbeddedFontRef ref;
-ref.relId = relId;
 ref.fontKey = fontKeyStr;
 m_FontFilesMap[ fontUrl ] = ref;
 ++m_nextFontId;
diff --git a/sw/source/filter/xml/xmlexpit.hxx 
b/sw/source/filter/xml/xmlexpit.hxx
index b0e10fb0ab86..f4ad52ce8a38 100644
--- a/sw/source/filter/xml/xmlexpit.hxx
+++ b/sw/source/filter/xml/xmlexpit.hxx
@@ -82,19 +82,16 @@ public:
 virtual void handleElementItem( const SvXMLItemMapEntry& rEntry,
 const SfxPoolItem& rItem ) const;
 
-inline void setMapEntries( SvXMLItemMapEntriesRef rMapEntries );
+void setMapEntries(const SvXMLItemMapEntriesRef& rMapEntries)
+{
+mrMapEntries = rMapEntries;
+}
 
 static bool QueryXMLValue( const SfxPoolItem& rItem,
  OUString& rValue, sal_uInt16 nMemberId,
  const SvXMLUnitConverter& rUnitConverter );
 };
 
-inline void
-SvXMLExportItemMapper::setMapEntries( SvXMLItemMapEntriesRef rMapEntries )
-{
-mrMapEntries = rMapEntries;
-}
-
 #endif // INCLUDED_SW_SOURCE_FILTER_XML_XMLEXPIT_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 

core.git: framework/source

2023-12-19 Thread Michael Weghorn (via logerrit)
 framework/source/uielement/toolbarmanager.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit b7ba91311abaf1af4d97822e5c8eccc53b1e11fa
Author: Michael Weghorn 
AuthorDate: Mon Dec 18 09:30:02 2023 +0100
Commit: Michael Weghorn 
CommitDate: Tue Dec 19 09:30:31 2023 +0100

tdf#123864 a11y: Evaluate checkable/toggle flag for more toolbar items

commit 4342408a8359e590f57b016baaf7d8dcfdebdbd4
Author: Carsten Driesner 
Date:   Thu May 6 18:15:21 2010 +0200

fwk142: #i104293 Use Commands.xcu files to mark commands which 
support a toggle state

introduced a `UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON` state
to mark commands that can be toggled, see `framework/inc/properties.h`.

Despite that one being set for the `.uno:Underline` command in
`officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu`,
the underline button in Writer's formatting toolbar would not expose
the CHECKABLE a11y state even after

commit 78241a40628e5721aa50cb0fa13a6343f766
Author: Michael Weghorn 
Date:   Mon Dec 18 08:48:12 2023 +0100

tdf#123864 a11y: Handle new CHECKABLE state in misc places

because the state set in the .xcu file was only applied
in `ToolBarManager::CreateControllers` in the code path where
no controller is set.

There seems to be no particular reason for that, so move this
out of that block so this gets run for other items, too.

With this in place, the underline button in Writer's formatting
toolbar now has the checkable AT-SPI state when using the gtk3
VCL plugin.

(Orca still doesn't announce the button as checked when it is,
despite the checked state also being set then, but that's another
aspect that will be addressed in a separate commit.)

Change-Id: Ib9200077a95feea3ce7c0380b9b8f31c96632223
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160903
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/framework/source/uielement/toolbarmanager.cxx 
b/framework/source/uielement/toolbarmanager.cxx
index bdc4627c2c8d..0ef5ea3c723e 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -1120,15 +1120,15 @@ void ToolBarManager::CreateControllers()
 xController.set( new GenericToolbarController( 
m_xContext, m_xFrame, m_pToolBar, nId, aCommandURL ));
 else
 xController.set( new GenericToolbarController( 
m_xContext, m_xFrame, *m_pWeldedToolBar, aCommandURL ));
-
-// Accessibility support: Set toggle button role for 
specific commands
-sal_Int32 nProps = 
vcl::CommandInfoProvider::GetPropertiesForCommand(aCommandURL, 
m_aModuleIdentifier);
-if ( nProps & UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 
)
-m_pImpl->SetItemCheckable( nId );
 }
 }
 }
 
+// Accessibility support: Set toggle button role for specific commands
+const sal_Int32 nProps = 
vcl::CommandInfoProvider::GetPropertiesForCommand(aCommandURL, 
m_aModuleIdentifier);
+if (nProps & UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON)
+m_pImpl->SetItemCheckable(nId);
+
 // Associate ID and controller to be able to retrieve
 // the controller from the ID later.
 m_aControllerMap[ nId ] = xController;


core.git: framework/source

2023-12-13 Thread Stephan Bergmann (via logerrit)
 framework/source/services/desktop.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 13b7905ba142d78b6061c52a8cc191125b0d7d5f
Author: Stephan Bergmann 
AuthorDate: Wed Dec 13 10:18:00 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Dec 13 20:48:27 2023 +0100

Remove misleading comment

...that had been added with 33fa50e1191c75fd2fcbf6f852ec1d76af58a577 "Drop 
some
pointless assertions" back in 2011, but is no longer meaningful now that 
this is
a proper assert since 6e35794cad555485955c3b43593497dcdbf29840 "terminate
XDesktop properly in unit tests"

Change-Id: Id8592df03f2a4c070af3cc691a0aa65ba8c2c061
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160675
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/framework/source/services/desktop.cxx 
b/framework/source/services/desktop.cxx
index 237d35afc6a5..12a45fa93117 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -1038,8 +1038,6 @@ void SAL_CALL Desktop::disposing()
 // Safe impossible cases
 // It's a programming error if dispose is called before terminate!
 
-// But if you just ignore the assertion (which happens in unit
-// tests for instance in sc/qa/unit) nothing bad happens.
 assert(m_bIsShutdown && "Desktop disposed before terminating it");
 
 {


[Libreoffice-commits] core.git: framework/source

2023-11-27 Thread Mike Kaganski (via logerrit)
 framework/source/fwe/helper/titlehelper.cxx |   30 ++--
 1 file changed, 20 insertions(+), 10 deletions(-)

New commits:
commit 6ea42a11669e2b3d3a10dd5eb199f45d6050c86b
Author: Mike Kaganski 
AuthorDate: Mon Nov 27 10:16:40 2023 +0100
Commit: Mike Kaganski 
CommitDate: Mon Nov 27 12:54:34 2023 +0100

tdf#158396: show DocumentTitle when set in MediaDescriptor

Change-Id: Ic89de9e7d83c7c96eb1b2cc51798d354b38f86d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159904
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/framework/source/fwe/helper/titlehelper.cxx 
b/framework/source/fwe/helper/titlehelper.cxx
index 48583681b9a4..5ab03ab10e8f 100644
--- a/framework/source/fwe/helper/titlehelper.cxx
+++ b/framework/source/fwe/helper/titlehelper.cxx
@@ -298,6 +298,13 @@ void TitleHelper::impl_updateTitle (bool init)
 }
 }
 
+static OUString getURLFromModel(const css::uno::Reference< css::frame::XModel3 
>& xModel)
+{
+if (css::uno::Reference xURLProvider{ xModel, 
css::uno::UNO_QUERY })
+return xURLProvider->getLocation();
+return {};
+}
+
 void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< 
css::frame::XModel3 >& xModel, bool init)
 {
 css::uno::Reference< css::uno::XInterface > xOwner;
@@ -326,24 +333,27 @@ void TitleHelper::impl_updateTitleForModel (const 
css::uno::Reference< css::fram
 return;
 
 OUString sTitle;
-OUString sURL;
 
-css::uno::Reference< css::frame::XStorable > xURLProvider(xModel , 
css::uno::UNO_QUERY);
-if (xURLProvider.is())
-sURL = xURLProvider->getLocation ();
+utl::MediaDescriptor aDescriptor(
+xModel->getArgs2({ utl::MediaDescriptor::PROP_DOCUMENTTITLE,
+   utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME }));
 
-utl::MediaDescriptor aDescriptor(xModel->getArgs2( { 
utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME } ));
-const OUString sSuggestedSaveAsName = 
aDescriptor.getUnpackedValueOrDefault(
-utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME, OUString());
-
-if (!sURL.isEmpty())
+if (const OUString sMediaTitle = aDescriptor.getUnpackedValueOrDefault(
+utl::MediaDescriptor::PROP_DOCUMENTTITLE, OUString());
+!sMediaTitle.isEmpty())
+{
+sTitle = sMediaTitle;
+}
+else if (const OUString sURL = getURLFromModel(xModel); !sURL.isEmpty())
 {
 sTitle = impl_convertURL2Title(sURL);
 if (nLeasedNumber != css::frame::UntitledNumbersConst::INVALID_NUMBER)
 xNumbers->releaseNumber (nLeasedNumber);
 nLeasedNumber = css::frame::UntitledNumbersConst::INVALID_NUMBER;
 }
-else if (!sSuggestedSaveAsName.isEmpty())
+else if (const OUString sSuggestedSaveAsName = 
aDescriptor.getUnpackedValueOrDefault(
+ utl::MediaDescriptor::PROP_SUGGESTEDSAVEASNAME, OUString());
+ !sSuggestedSaveAsName.isEmpty())
 {
 // tdf#121537 Use suggested save as name for title if file has not yet 
been saved
 sTitle = sSuggestedSaveAsName;


[Libreoffice-commits] core.git: framework/source

2023-11-27 Thread Mike Kaganski (via logerrit)
 framework/source/fwe/helper/titlehelper.cxx |   60 ++--
 1 file changed, 22 insertions(+), 38 deletions(-)

New commits:
commit 9ada569e6e9f892924e285b04f569d37a97d8014
Author: Mike Kaganski 
AuthorDate: Mon Nov 27 08:42:15 2023 +0100
Commit: Mike Kaganski 
CommitDate: Mon Nov 27 11:36:17 2023 +0100

Simplify a bit

Change-Id: I1609b9dfc047ad55bbaeee369b643d654903866e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159903
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/framework/source/fwe/helper/titlehelper.cxx 
b/framework/source/fwe/helper/titlehelper.cxx
index be779736e0f7..48583681b9a4 100644
--- a/framework/source/fwe/helper/titlehelper.cxx
+++ b/framework/source/fwe/helper/titlehelper.cxx
@@ -51,38 +51,24 @@ TitleHelper::TitleHelper(css::uno::Reference< 
css::uno::XComponentContext > xCon
 const css::uno::Reference< 
css::frame::XUntitledNumbers >& xNumbers)
 : ::cppu::BaseMutex ()
 , m_xContext(std::move(xContext))
+, m_xOwner  (xOwner)
+, m_xUntitledNumbers(xNumbers)
 , m_bExternalTitle  (false)
 , m_nLeasedNumber   (css::frame::UntitledNumbersConst::INVALID_NUMBER)
 , m_aListener   (m_aMutex)
 {
-// SYNCHRONIZED ->
-{
-osl::MutexGuard aLock(m_aMutex);
-
-m_xOwner = xOwner;
-m_xUntitledNumbers = xNumbers;
-}
-// <- SYNCHRONIZED
-
-css::uno::Reference< css::frame::XModel > xModel(xOwner, 
css::uno::UNO_QUERY);
-if (xModel.is ())
+if (css::uno::Reference xModel{ xOwner, 
css::uno::UNO_QUERY })
 {
 impl_startListeningForModel (xModel);
-return;
 }
-
-css::uno::Reference< css::frame::XController > xController(xOwner, 
css::uno::UNO_QUERY);
-if (xController.is ())
+else if (css::uno::Reference xController{ xOwner,
+   
css::uno::UNO_QUERY })
 {
 impl_startListeningForController (xController);
-return;
 }
-
-css::uno::Reference< css::frame::XFrame > xFrame(xOwner, 
css::uno::UNO_QUERY);
-if (xFrame.is ())
+else if (css::uno::Reference xFrame{ xOwner, 
css::uno::UNO_QUERY })
 {
 impl_startListeningForFrame (xFrame);
-return;
 }
 }
 
@@ -145,7 +131,7 @@ void SAL_CALL TitleHelper::titleChanged(const 
css::frame::TitleChangedEvent& aEv
 {
 osl::MutexGuard aLock(m_aMutex);
 
-xSubTitle.set(m_xSubTitle.get (), css::uno::UNO_QUERY);
+xSubTitle = m_xSubTitle;
 }
 // <- SYNCHRONIZED
 
@@ -167,7 +153,7 @@ void SAL_CALL TitleHelper::documentEventOccured(const 
css::document::DocumentEve
 {
 osl::MutexGuard aLock(m_aMutex);
 
-xOwner.set(m_xOwner.get (), css::uno::UNO_QUERY);
+xOwner.set(m_xOwner, css::uno::UNO_QUERY);
 }
 // <- SYNCHRONIZED
 
@@ -189,7 +175,7 @@ void SAL_CALL TitleHelper::frameAction(const 
css::frame::FrameActionEvent& aEven
 {
 osl::MutexGuard aLock(m_aMutex);
 
-xOwner.set(m_xOwner.get (), css::uno::UNO_QUERY);
+xOwner.set(m_xOwner, css::uno::UNO_QUERY);
 }
 // <- SYNCHRONIZED
 
@@ -219,7 +205,7 @@ void SAL_CALL TitleHelper::disposing(const 
css::lang::EventObject& aEvent)
 osl::MutexGuard aLock(m_aMutex);
 
 xOwner = m_xOwner;
-xNumbers.set(m_xUntitledNumbers.get(), css::uno::UNO_QUERY);
+xNumbers = m_xUntitledNumbers;
 nLeasedNumber = m_nLeasedNumber;
 }
 // <- SYNCHRONIZED
@@ -245,7 +231,7 @@ void SAL_CALL TitleHelper::disposing(const 
css::lang::EventObject& aEvent)
 osl::MutexGuard aLock(m_aMutex);
 
 m_xOwner.clear();
-m_sTitle= OUString ();
+m_sTitle.clear();
 m_nLeasedNumber = css::frame::UntitledNumbersConst::INVALID_NUMBER;
 }
 // <- SYNCHRONIZED
@@ -287,28 +273,26 @@ void TitleHelper::impl_sendTitleChangedEvent ()
 
 void TitleHelper::impl_updateTitle (bool init)
 {
-css::uno::Reference< css::frame::XModel3 > xModel;
-css::uno::Reference< css::frame::XController > xController;
-css::uno::Reference< css::frame::XFrame >  xFrame;
+css::uno::Reference xOwner;
+
 // SYNCHRONIZED ->
 {
 osl::MutexGuard aLock(m_aMutex);
 
-xModel.set (m_xOwner.get(), css::uno::UNO_QUERY);
-xController.set(m_xOwner.get(), css::uno::UNO_QUERY);
-xFrame.set (m_xOwner.get(), css::uno::UNO_QUERY);
+xOwner = m_xOwner;
 }
 // <- SYNCHRONIZED
 
-if (xModel.is ())
+if (css::uno::Reference xModel{ xOwner, 
css::uno::UNO_QUERY })
 {
 impl_updateTitleForModel (xModel, init);
 }
-else if (xController.is ())
+else if (css::uno::Reference xController{ xOwner,
+   
css::uno::UNO_QUERY })
 {
 impl_updateTitleForController (xController, init);
 }
-else if 

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

2023-09-25 Thread Andreas Heinisch (via logerrit)
 framework/source/uielement/recentfilesmenucontroller.cxx |2 
 include/unotools/historyoptions.hxx  |5 
 sfx2/source/control/recentdocsview.cxx   |2 
 sfx2/source/dialog/backingwindow.cxx |2 
 unotools/source/config/historyoptions.cxx|   88 ++-
 5 files changed, 65 insertions(+), 34 deletions(-)

New commits:
commit 71cae3a219ff1629368b8f324d0de89afc9445e9
Author: Andreas Heinisch 
AuthorDate: Fri Sep 22 12:06:50 2023 +0200
Commit: Andreas Heinisch 
CommitDate: Mon Sep 25 14:15:37 2023 +0200

tdf#155698 - Start Center: Retain pinned items when clearing the list

Change-Id: Ife54845e020977cdb80a7fcc1fa6afc17b32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157169
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx 
b/framework/source/uielement/recentfilesmenucontroller.cxx
index 75d13407ad93..9c8eea5ef694 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -383,7 +383,7 @@ void SAL_CALL RecentFilesMenuController::itemSelected( 
const css::awt::MenuEvent
 
 if ( aCommand == CMD_CLEAR_LIST )
 {
-SvtHistoryOptions::Clear( EHistoryType::PickList );
+SvtHistoryOptions::Clear( EHistoryType::PickList, false );
 dispatchCommand(
 "vnd.org.libreoffice.recentdocs:ClearRecentFileList",
 css::uno::Sequence< css::beans::PropertyValue >() );
diff --git a/include/unotools/historyoptions.hxx 
b/include/unotools/historyoptions.hxx
index b2388de2ad4b..3eb8162ee0b5 100644
--- a/include/unotools/historyoptions.hxx
+++ b/include/unotools/historyoptions.hxx
@@ -44,7 +44,7 @@ namespace SvtHistoryOptions
 
 @param  eHistory select right history.
 */
-UNOTOOLS_DLLPUBLIC void Clear(EHistoryType eHistory);
+UNOTOOLS_DLLPUBLIC void Clear(EHistoryType eHistory, const bool 
bClearPinnedItems = true);
 
 /** Return the complete specified history list.
 
@@ -81,7 +81,8 @@ namespace SvtHistoryOptions
 
 /** Delete item from the specified list.
 */
-UNOTOOLS_DLLPUBLIC void DeleteItem(EHistoryType eHistory, const OUString& 
sURL);
+UNOTOOLS_DLLPUBLIC void DeleteItem(EHistoryType eHistory, const OUString& 
sURL,
+   const bool bClearPinned = true);
 
 // tdf#38742 - toggle pinned state of an item
 UNOTOOLS_DLLPUBLIC void TogglePinItem(EHistoryType eHistory, const 
OUString& sURL);
diff --git a/sfx2/source/control/recentdocsview.cxx 
b/sfx2/source/control/recentdocsview.cxx
index f2c58cf6e12e..cc2e80de17e9 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -191,7 +191,7 @@ void RecentDocsView::clearUnavailableFiles(){
 {
 const SvtHistoryOptions::HistoryItem& rPickListEntry = aHistoryList[i];
 if ( !comphelper::DirectoryHelper::fileExists(rPickListEntry.sURL) ){
-
SvtHistoryOptions::DeleteItem(EHistoryType::PickList,rPickListEntry.sURL);
+
SvtHistoryOptions::DeleteItem(EHistoryType::PickList,rPickListEntry.sURL, 
false);
 }
 }
 Reload();
diff --git a/sfx2/source/dialog/backingwindow.cxx 
b/sfx2/source/dialog/backingwindow.cxx
index fbae5e1af221..553577a846df 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -647,7 +647,7 @@ IMPL_LINK (BackingWindow, MenuSelectHdl, const OUString&, 
rId, void)
 {
 if (rId == "clear_all")
 {
-SvtHistoryOptions::Clear(EHistoryType::PickList);
+SvtHistoryOptions::Clear(EHistoryType::PickList, false);
 mxAllRecentThumbnails->Reload();
 return;
 }
diff --git a/unotools/source/config/historyoptions.cxx 
b/unotools/source/config/historyoptions.cxx
index 2cda950858d2..8361aa6bc358 100644
--- a/unotools/source/config/historyoptions.cxx
+++ b/unotools/source/config/historyoptions.cxx
@@ -68,27 +68,49 @@ static sal_uInt32 GetCapacity(const 
uno::Reference& xCom
 namespace SvtHistoryOptions
 {
 
-void Clear( EHistoryType eHistory )
+void Clear(EHistoryType eHistory, const bool bClearPinnedItems)
 {
 try
 {
 uno::Reference xCfg = GetConfig();
 uno::Reference xListAccess(GetListAccess(xCfg, 
eHistory));
 
-// clear ItemList
-uno::Reference xNode;
-xListAccess->getByName(s_sItemList) >>= xNode;
-Sequence aStrings(xNode->getElementNames());
+// Retrieve order and item lists using name access to check properties 
of individual items
+uno::Reference xItemList;
+uno::Reference xOrderList;
+xListAccess->getByName(s_sItemList)  >>= xItemList;
+xListAccess->getByName(s_sOrderList) >>= xOrderList;
 
-for (const auto& rString : std::as_const(aStrings))
-xNode->removeByName(rString);
+

[Libreoffice-commits] core.git: framework/source vcl/source

2023-08-15 Thread Justin Luth (via logerrit)
 framework/source/services/sessionlistener.cxx |3 ++-
 vcl/source/app/session.cxx|4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 918cd8cbf383e0099d80db2e12a1071a0bc4f200
Author: Justin Luth 
AuthorDate: Tue Aug 15 08:55:09 2023 -0400
Commit: Justin Luth 
CommitDate: Tue Aug 15 19:04:45 2023 +0200

VCLSession: avoid null dereferences

Found while I was (mis)using
XSessionManagerListener2 in
https://gerrit.libreoffice.org/c/core/+/155460

But I think these are valid anyway.
Certainly one is when it is checked in the try clause
but not in the catch clause.

Change-Id: Ia3f7211e4a4c86dd503ffe1b04e5b5c13227218e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155719
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/framework/source/services/sessionlistener.cxx 
b/framework/source/services/sessionlistener.cxx
index 188b082fe94c..a77e7f961ebb 100644
--- a/framework/source/services/sessionlistener.cxx
+++ b/framework/source/services/sessionlistener.cxx
@@ -366,7 +366,8 @@ void SAL_CALL SessionListener::approveInteraction( sal_Bool 
bInteractionGranted
 catch( const css::uno::Exception& )
 {
 StoreSession( true );
-m_rSessionManager->interactionDone( this );
+if (m_rSessionManager.is())
+m_rSessionManager->interactionDone(this);
 }
 
 if ( m_rSessionManager.is() && m_bTerminated )
diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx
index c0dfe71d7bc3..3b1bf3565bb2 100644
--- a/vcl/source/app/session.cxx
+++ b/vcl/source/app/session.cxx
@@ -309,7 +309,9 @@ void SAL_CALL VCLSession::queryInteraction( const 
css::uno::ReferencequeryInteraction();
+if (m_xSession)
+m_xSession->queryInteraction();
+
 m_bInteractionRequested = true;
 }
 for (auto & listener: m_aListeners)


[Libreoffice-commits] core.git: framework/source

2023-08-12 Thread Andrea Gelmini (via logerrit)
 framework/source/services/autorecovery.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e6007b3be10a47b5a5382cfffa21b4106633f4b7
Author: Andrea Gelmini 
AuthorDate: Fri Aug 11 15:40:09 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Aug 12 10:55:07 2023 +0200

Fix typo

Change-Id: Id2c317c44e6bc4e2c9d0d0e7fd830b6b414e8c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155624
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index dfed8cfc6993..03a7d3b40748 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -617,7 +617,7 @@ private:
  *EmergencySave and SessionSave are interested in all open 
documents (which may not
  *even be available at next start - i.e. /tmp files might be lost 
after a reboot,
  *or removable media / server access might not be connected).
- *On the other hand, timer-based autorecovery should not be 
interested in recoverying
+ *On the other hand, timer-based autorecovery should not be 
interested in recovering
  *the session, but only modified documents that are recoverable
  *(TODO: unless the user always wants to recover a session).
  */


[Libreoffice-commits] core.git: framework/source

2023-08-11 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit f1c3526dee49927f7efb79bef285e3688264ec3f
Author: Justin Luth 
AuthorDate: Thu Aug 10 15:42:58 2023 -0400
Commit: Justin Luth 
CommitDate: Sat Aug 12 01:36:13 2023 +0200

tdf#137878 autorecovery: reduce "file not found" pop-ups

For a DOCX file, there were four of them during a recovery
if the file was on a USB or renamed or whatever.

Now there aren't any.

Change-Id: I5cbad6e4ed1a1bc1d3b8e805a6b493f4ee61ec68
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155567
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 2b62186b08fe..dfed8cfc6993 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -88,6 +88,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -3459,6 +3460,8 @@ void AutoRecovery::implts_openOneDoc(const OUString&  
 sURL   ,
 // TODO: remove load-process specific arguments from the 
descriptor, e.g. the status indicator
 xModel->attachResource( sURL, 
lDescriptor.getAsConstPropertyValueList() );
 }
+else if (!utl::UCBContentHelper::Exists(sURL))
+throw css::uno::Exception();
 else
 {
 OUString sFilterName;


[Libreoffice-commits] core.git: framework/source

2023-08-10 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |   53 ++---
 1 file changed, 49 insertions(+), 4 deletions(-)

New commits:
commit 3b81780ae907046b667282b051281888ef00d210
Author: Justin Luth 
AuthorDate: Sat Aug 5 16:41:45 2023 -0400
Commit: Justin Luth 
CommitDate: Fri Aug 11 00:11:06 2023 +0200

autorecovery: add some documentation

Change-Id: I9a037e263ecdc374df9450ee9a066468dc6ab5e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155426
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 213ba729be97..2b62186b08fe 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -108,6 +108,41 @@ using namespace css::frame;
 using namespace css::lang;
 using namespace framework;
 
+/** After the fact documentation - hopefully it is correct.
+ *
+ * AutoRecovery handles 3 types of recovery, as well as periodic document 
saving
+ *   1) timed, ODF, temporary, recovery files created in the backup folder
+ *  -can instead be used to actually save the documents periodically if 
settings request that.
+ *  -temporary: deleted when the document itself is saved
+ *  -handles the situation where LO immediately exits (power outage, 
program crash, pkill -9 soffice)
+ *  -not restored immediately
+ *  -no guarantee of availability of recovery file (since deleted on 
document save)
+ *   or original document (perhaps /tmp, removeable, disconnected 
server).
+ *  -therefore does not include unmodified files in RecoveryList 
(@since LO 24.2).
+ *-TODO: perhaps can be enhanced for users who always want 
sessions restored?
+ *   2) emergency save-and-restart immediately triggers creation of temporary, 
ODF, recovery files
+ *  -handles the situation where LO is partially functioning (pkill -6 
soffice)
+ *  -restore attempted immediately, so try to restore entire session - 
all open files
+ *  -always create recovery file for every open document in emergency 
situation
+ *  -works without requiring AutoRecovery to be enabled
+ *   3) session save on exit desired by OS or user creates recovery files for 
every open document
+ *  -triggered by some OS's shutdown/logout (no known way for user to 
initiate within LO)
+ *  -same as emergency save, except maybe more time critical - OS kill 
timeout
+ *  -not restored until much later - the user has stopped doing 
computer work
+ *  -always create recovery file for every open document: needed for 
/tmp, disconnected docs
+ *
+ * All of these use the same recovery dialog - re-opening all the files listed 
in the RecoveryList
+ * of the user's officecfg settings.
+ *
+ * Since these 3 have very different expectations, and yet share the same 
code, keep all of them
+ * in mind when making code changes.
+ *
+ * Note: often, entries in m_lDocCache are copied. So realize that changes to 
aInfo/rInfo might not
+ * apply to async events like mark-document-as-saved-and-delete-TMP-URLs or 
set-modified-status,
+ * or ignoreClosing, or ListenForModify. For example, DocState::Modified 
should be considered only
+ * a good hint, and not as definitively accurate.
+ */
+
 namespace {
 
 /** @short  hold all needed information for an asynchronous dispatch alive.
@@ -326,8 +361,8 @@ public:
 OUString FactoryURL;
 OUString TemplateURL;
 
-OUString OldTempURL;
-OUString NewTempURL;
+OUString OldTempURL; // previous recovery file (filename_0.odf) 
which will be removed
+OUString NewTempURL; // new recovery file (filename_1.odf) that is 
being created
 
 OUString AppModule;  // e.g. com.sun.star.text.TextDocument - 
used to identify app module
 OUString FactoryService; // the service to create a document of 
the module
@@ -574,7 +609,17 @@ private:
   */
 void implts_readAutoSaveConfig();
 
-// TODO document me
+/** After the fact documentation
+ * @short adds/updates/removes entries in the RecoveryList - files to be 
recovered at startup
+ *
+ * @descr Deciding whether to add or remove an entry is very dependent on 
the context!
+ *EmergencySave and SessionSave are interested in all open 
documents (which may not
+ *even be available at next start - i.e. /tmp files might be lost 
after a reboot,
+ *or removable media / server access might not be connected).
+ *On the other hand, timer-based autorecovery should not be 
interested in recoverying
+ *the session, but only modified documents that are recoverable
+ *(TODO: unless the user always wants to recover a session).
+ */
 void implts_flushConfigItem(AutoRecovery::TDocumentInfo& rInfo, bool 
bRemoveIt = false,

[Libreoffice-commits] core.git: framework/source

2023-08-10 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit c3cb2f956d760ba6ddd9a882e952b2bd7c1af145
Author: Justin Luth 
AuthorDate: Wed Aug 9 07:07:28 2023 -0400
Commit: Justin Luth 
CommitDate: Thu Aug 10 22:23:03 2023 +0200

partial Revert "tdf#144512 autorecovery: always wait for user idle...

... with timed save" in order to restore useful comments

This reverts 24.2 commit 75d7464e7eb94df1ad9904ad750b27d99d91abc5,
where the ResettableMutexGuard's safety is cancelled by a g.clear()
  // } /* SAFE */
and re-instated with a g.reset()
  // /* SAFE */ {

Thanks Mike for explaining the obvious to me.

Change-Id: I98016a50221b734a38d14bce0a958c6af9e57944
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155514
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 48c8978c9ab1..213ba729be97 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2974,11 +2974,13 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( 
  boolbAllow
 continue;
 }
 
+// } /* SAFE */
 g.clear();
 // changing of aInfo and flushing it is done inside implts_saveOneDoc!
 implts_saveOneDoc(sBackupPath, aInfo, xExternalProgress);
 implts_informListener(eJob, 
AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_UPDATE, ));
 g.reset();
+// /* SAFE */ {
 
 *pIt = aInfo;
 }
@@ -2990,11 +2992,13 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( 
  boolbAllow
 pIt = dangerousDoc;
 AutoRecovery::TDocumentInfo aInfo = *pIt;
 
+// } /* SAFE */
 g.clear();
 // changing of aInfo and flushing it is done inside implts_saveOneDoc!
 implts_saveOneDoc(sBackupPath, aInfo, xExternalProgress);
 implts_informListener(eJob, 
AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_UPDATE, ));
 g.reset();
+// /* SAFE */ {
 
 *pIt = aInfo;
 }


[Libreoffice-commits] core.git: framework/source

2023-08-09 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |   31 -
 1 file changed, 5 insertions(+), 26 deletions(-)

New commits:
commit 90b23d0b4528a12ababa3c2897ab3f1a3719b2f1
Author: Justin Luth 
AuthorDate: Tue Aug 8 09:41:48 2023 -0400
Commit: Mike Kaganski 
CommitDate: Wed Aug 9 12:13:44 2023 +0200

tdf#144512 autorecovery: always wait for user idle with timed save

Only the "active" document was waiting for a user idle.
But that doesn't make sense because the background apps
still lock the foreground app during file save.

So all timed backups should wait for a user idle period
before starting their recovery / autosave.

Once an idle loop is triggered, no autosave will ever run again
until an idle timeout occurs! So a busy user who switches from
one doc to another without ever pausing still wouldn't ever
get a backup - even from the background docs!

Without this patch, only the first modified documents
(if backgrounded within 10 minutes) would ever
get a recovery save. So in pretty much every case
this patch makes sense AFAICS.

Change-Id: I6e9e04aa2e50895e53826b427cb52c129da43701
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155459
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index b4e898952aad..48c8978c9ab1 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2840,17 +2840,8 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs(  
 boolbAllow
 if (pParams)
 xExternalProgress = pParams->m_xProgress;
 
-css::uno::Reference< css::frame::XDesktop2 > xDesktop = 
css::frame::Desktop::create(m_xContext);
 OUString  
sBackupPath(SvtPathOptions().GetBackupPath());
 
-css::uno::Reference< css::frame::XController > xActiveController;
-css::uno::Reference< css::frame::XModel >  xActiveModel;
-css::uno::Reference< css::frame::XFrame >  xActiveFrame = 
xDesktop->getActiveFrame();
-if (xActiveFrame.is())
-xActiveController = xActiveFrame->getController();
-if (xActiveController.is())
-xActiveModel = xActiveController->getModel();
-
 // Set the default timer action for our call.
 // Default = NORMAL_AUTOSAVE
 // We return a suggestion for an active timer only.
@@ -2967,37 +2958,27 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( 
  boolbAllow
 }
 }
 
-// a) Document was not postponed - and is active now. => postpone 
it (restart timer, restart loop)
-// b) Document was not postponed - and is not active now. => save it
-// c) Document was postponed - and is not active now. => save it
-// d) Document was postponed - and is active now. => save it 
(because user idle was checked already)
-bool bActive   = (xActiveModel == aInfo.Document);
-bool bWasPostponed = ((aInfo.DocumentState & DocState::Postponed) == 
DocState::Postponed);
-
-if (
-! bWasPostponed &&
-  bActive
-   )
+// a) Document was not postponed => wait for user idle if not urgent
+// b) Document was postponed => save it (because user idle/call_back 
was checked already)
+if (!(aInfo.DocumentState & DocState::Postponed))
 {
 aInfo.DocumentState |= DocState::Postponed;
 *pIt = aInfo;
 // postponed documents will be saved if this method is called 
again!
 // That can be done by an outside started timer   => 
E_POLL_FOR_USER_IDLE (if normal AutoSave is active)
 // or it must be done directly without starting any timer => 
E_CALL_ME_BACK   (if Emergency- or SessionSave is active and must be 
finished ASAP!)
-eTimer = AutoRecovery::E_POLL_FOR_USER_IDLE;
 if (!bAllowUserIdleLoop)
 eTimer = AutoRecovery::E_CALL_ME_BACK;
+else
+eTimer = AutoRecovery::E_POLL_FOR_USER_IDLE;
 continue;
 }
 
-// b, c, d)
-// } /* SAFE */
 g.clear();
 // changing of aInfo and flushing it is done inside implts_saveOneDoc!
 implts_saveOneDoc(sBackupPath, aInfo, xExternalProgress);
 implts_informListener(eJob, 
AutoRecovery::implst_createFeatureStateEvent(eJob, OPERATION_UPDATE, ));
 g.reset();
-// /* SAFE */ {
 
 *pIt = aInfo;
 }
@@ -3009,13 +2990,11 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( 
  boolbAllow
 pIt = dangerousDoc;
 AutoRecovery::TDocumentInfo aInfo = *pIt;
 
-// } /* SAFE */
 g.clear();
 // changing of aInfo and flushing it is done inside implts_saveOneDoc!
 implts_saveOneDoc(sBackupPath, 

[Libreoffice-commits] core.git: framework/source

2023-08-08 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit c3cf88f73e29a79f890782b31d1ecc6ed1c376ea
Author: Justin Luth 
AuthorDate: Tue Aug 8 11:44:48 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Aug 9 04:10:48 2023 +0200

tdf#144512 autorecovery: only wait once for user idle

If we currently are in a user idle state, then don't delay
any recovery / autosave's until a future idle timeout.

Change-Id: Ie3953bb7456370d046b76a4cad816498dbfc85e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155462
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index dbf0c803aab6..b4e898952aad 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2327,7 +2327,9 @@ IMPL_LINK_NOARG(AutoRecovery, implts_timerExpired, Timer 
*, void)
 // force save of all currently open documents
 // The called method returns an info, if and how this
 // timer must be restarted.
-AutoRecovery::ETimerType eSuggestedTimer = 
implts_saveDocs(true/*bAllowUserIdleLoop*/, false);
+const bool bIsAlreadyIdle(m_eTimerType == 
AutoRecovery::E_POLL_FOR_USER_IDLE);
+AutoRecovery::ETimerType eSuggestedTimer
+= implts_saveDocs(/*AllowUserIdleLoop=*/!bIsAlreadyIdle, 
/*RemoveLockFiles=*/false);
 
 // If timer is not used for "short callbacks" (means polling
 // for special states) ... reset the handle state of all


[Libreoffice-commits] core.git: framework/source

2023-08-07 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit ceeb48b33b374dfcd970d4fdd194ce0301bbb65a
Author: Justin Luth 
AuthorDate: Wed Aug 2 15:28:44 2023 -0400
Commit: Justin Luth 
CommitDate: Mon Aug 7 18:15:47 2023 +0200

tdf#57414 autorecovery: ignoreClosing during Emergency/SessionSave

Unmodified documents were losing the enties from RecoveryList
when implts_deregisterDocument was triggered,
which prevented the Session recovery from being able to reload them.

Change-Id: I991a9821105aca81ec596b28341ef4335b817439
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155380
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 657d8c12106c..dbf0c803aab6 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2896,12 +2896,17 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( 
  boolbAllow
 if ((aInfo.DocumentState & DocState::Handled) == DocState::Handled)
 continue;
 
+// don't allow implts_deregisterDocument to remove from RecoveryList 
during shutdown jobs
+if (m_eJob & (Job::EmergencySave | Job::SessionSave))
+aInfo.IgnoreClosing = true;
+
 // Not modified documents are not saved.
-// We safe an information about the URL only!
+// We save information about the URL only!
 Reference< XDocumentRecovery > xDocRecover( aInfo.Document, 
UNO_QUERY_THROW );
 if ( !xDocRecover->wasModifiedSinceLastSave() )
 {
 aInfo.DocumentState |= DocState::Handled;
+*pIt = aInfo;
 continue;
 }
 


[Libreoffice-commits] core.git: framework/source

2023-08-07 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 63bb760acc8aa50c352f3349e8adf3db381b4911
Author: Justin Luth 
AuthorDate: Tue Aug 1 16:00:33 2023 -0400
Commit: Justin Luth 
CommitDate: Mon Aug 7 17:43:54 2023 +0200

tdf#57414 autorecovery: avoid unnecessary storeToRecoveryFile

With a successful UserAutoBackup, the document is fully saved,
and the recoveryInfo entry is removed.

So just avoid the recovery that would just be deleted anyway.

Change-Id: I3cc9fe2730640df48f450f900f33afc2df7f020a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155273
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 816e4f7253a3..657d8c12106c 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3073,6 +3073,7 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 // Note that we must do it *before* calling storeToRecoveryFile, so in 
case of failure here
 // we won't remain with the modified flag set to true, even though the 
autorecovery save succeeded.
 const bool bEmergencySave(m_eJob & Job::EmergencySave);
+bool bUserAutoSaved = false;
 try
 {
 // We must check here for an empty URL to avoid a "This operation is 
not supported on this operating system."
@@ -3081,6 +3082,7 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 {
 Reference< XStorable > xDocSave(rInfo.Document, 
css::uno::UNO_QUERY_THROW);
 xDocSave->store();
+bUserAutoSaved = true;
 }
 }
 catch(const css::uno::Exception&)
@@ -3098,7 +3100,7 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 
 // If it is no longer modified, it is the same as on disk, and can be 
removed from RecoveryList.
 const bool bRemoveIt
-= xModify.is() && !xModify->isModified() && !bEmergencySave && 
!(m_eJob & Job::SessionSave);
+= xModify.is() && !xModify->isModified() && bUserAutoSaved && !(m_eJob 
& Job::SessionSave);
 
 sal_Int32 nRetry = RETRY_STORE_ON_FULL_DISC_FOREVER;
 bool  bError = false;
@@ -3106,7 +3108,10 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 {
 try
 {
-xDocRecover->storeToRecoveryFile( rInfo.NewTempURL, 
lNewArgs.getAsConstPropertyValueList() );
+// skip recovery if it will be removed anyway.
+if (!bRemoveIt)
+xDocRecover->storeToRecoveryFile(rInfo.NewTempURL,
+ 
lNewArgs.getAsConstPropertyValueList());
 
 #ifdef TRIGGER_FULL_DISC_CHECK
 throw css::uno::Exception("trigger full disk check");


[Libreoffice-commits] core.git: framework/source

2023-08-07 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit f5d6888bd1b945596684cb643118e0e07477d3fa
Author: Justin Luth 
AuthorDate: Mon Jul 31 15:23:11 2023 -0400
Commit: Justin Luth 
CommitDate: Mon Aug 7 17:43:10 2023 +0200

tdf#57414 autorecovery: don't store unmodified docs in RecoveryList

When a document is successfully saved (manually),
it is removed from RecoveryList (implts_markDocumentAsSaved)
and all of the temporary recovery files are removed
from the user's backup folder.

If the document is automatically saved (UserAutoSave)
successfully, it doesn't need to remain in the RecoveryList either.

storeToRecoveryFile can benefit from knowing if it will be removed,
so determine whether to bRemoveIt just prior to that call.

Change-Id: I2cb30b426e600cfe34987a091acaf8826316ede5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155272
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 1071423da954..816e4f7253a3 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3096,6 +3096,10 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 else if (xModify.is())
 rInfo.DocumentState &= ~DocState::Modified;
 
+// If it is no longer modified, it is the same as on disk, and can be 
removed from RecoveryList.
+const bool bRemoveIt
+= xModify.is() && !xModify->isModified() && !bEmergencySave && 
!(m_eJob & Job::SessionSave);
+
 sal_Int32 nRetry = RETRY_STORE_ON_FULL_DISC_FOREVER;
 bool  bError = false;
 do
@@ -3184,7 +3188,8 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 rInfo.OldTempURL = rInfo.NewTempURL;
 rInfo.NewTempURL.clear();
 
-implts_flushConfigItem(rInfo);
+// If it is modified, a recovery file has just been created, so add to 
RecoveryList.
+implts_flushConfigItem(rInfo, bRemoveIt, /*bAllowAdd=*/bModified);
 
 // We must know if the user modifies the document again ...
 implts_startModifyListeningOnDoc(rInfo);


[Libreoffice-commits] core.git: framework/source

2023-08-07 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |   16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 9fffac201136dc4f0a128171c17b0fd38836c043
Author: Justin Luth 
AuthorDate: Mon Jul 31 18:10:29 2023 -0400
Commit: Justin Luth 
CommitDate: Mon Aug 7 17:41:36 2023 +0200

tdf#57414 autorecovery: not in RecoveryList? always delete tmp files

In all but one case, the storeToRecoveryFiles were deleted
when the entry was removed from the RecoveryList
(and likely it should have been removed in that case as well,
 since the program could not open that file anyway).

So, move that function into the flushConfig function
to ensure that recovery files are not orphaned
in the backup folder.

If the URLs are not cleared, and the recovery tries to load
the non-existing file, then LO will assert (or maybe crash).

(For implts_markDocumentAsSaved,
it does the deletefiles/flushCOnfig outside of the SAFE area,
but updates m_lDocCache with *pIt = aInfo inside the SAFE area,
so those deletefiles/clears cannot be cleaned up.)

(implts_cleanUpWorkingEntry and implts_deregisterDocument
both remove the m_lDocCache entry competely, so it was not
necessary to clear the URLs in those two cases.)

Change-Id: I765f3a815f28082495a7f286a8b28b977e0cad75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155118
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index f0affa0cf7f3..1071423da954 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -575,7 +575,7 @@ private:
 void implts_readAutoSaveConfig();
 
 // TODO document me
-void implts_flushConfigItem(const AutoRecovery::TDocumentInfo& rInfo, bool 
bRemoveIt = false,
+void implts_flushConfigItem(AutoRecovery::TDocumentInfo& rInfo, bool 
bRemoveIt = false,
 bool bAllowAdd = true);
 
 // TODO document me
@@ -1981,7 +1981,7 @@ void AutoRecovery::implts_persistAllActiveViewNames()
 }
 }
 
-void AutoRecovery::implts_flushConfigItem(const AutoRecovery::TDocumentInfo& 
rInfo, bool bRemoveIt,
+void AutoRecovery::implts_flushConfigItem(AutoRecovery::TDocumentInfo& rInfo, 
bool bRemoveIt,
   bool bAllowAdd)
 {
 std::shared_ptr batch(
@@ -2007,6 +2007,11 @@ void AutoRecovery::implts_flushConfigItem(const 
AutoRecovery::TDocumentInfo& rIn
 // DO IT!
 try
 {
+osl::File::remove(rInfo.OldTempURL);
+osl::File::remove(rInfo.NewTempURL);
+rInfo.OldTempURL.clear();
+rInfo.NewTempURL.clear();
+
 xModify->removeByName(sID);
 }
 catch(const css::container::NoSuchElementException&)
@@ -2540,8 +2545,6 @@ void AutoRecovery::implts_deregisterDocument(const 
css::uno::Reference< css::fra
 if (bStopListening)
 implts_stopModifyListeningOnDoc(aInfo);
 
-AutoRecovery::st_impl_removeFile(aInfo.OldTempURL);
-AutoRecovery::st_impl_removeFile(aInfo.NewTempURL);
 implts_flushConfigItem(aInfo, true); // sal_True => remove it from config
 }
 
@@ -3323,7 +3326,8 @@ AutoRecovery::ETimerType 
AutoRecovery::implts_openDocs(const DispatchParams& aPa
 info.DocumentState |=  DocState::Damaged;
 }
 
-implts_flushConfigItem(info, true);
+implts_flushConfigItem(info, /*bRemoveIt=*/true);
+
 implts_informListener(eJob,
 AutoRecovery::implst_createFeatureStateEvent(eJob, 
OPERATION_UPDATE, ));
 
@@ -3898,8 +3902,6 @@ void AutoRecovery::implts_cleanUpWorkingEntry(const 
DispatchParams& aParams)
 if (pIt != m_lDocCache.end())
 {
 AutoRecovery::TDocumentInfo& rInfo = *pIt;
-AutoRecovery::st_impl_removeFile(rInfo.OldTempURL);
-AutoRecovery::st_impl_removeFile(rInfo.NewTempURL);
 implts_flushConfigItem(rInfo, true); // sal_True => remove it from xml 
config!
 
 m_lDocCache.erase(pIt);


[Libreoffice-commits] core.git: framework/source

2023-08-07 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |   23 ---
 1 file changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 9e0f13b2c4d31537162434b5b932b265c62349e0
Author: Justin Luth 
AuthorDate: Thu Jul 20 16:29:41 2023 -0400
Commit: Justin Luth 
CommitDate: Mon Aug 7 17:40:06 2023 +0200

tdf#57414 autorecovery: don't always add every file to RecoveryList

There is no need to recover documents that are not modified,
and certainly not if there is no storeToRecoveryFile.
This specifically is nice for read-only files, new files,
or e-mailed files that have just been opened for viewing.

registerDocument: A just opened file has nothing to recover,
so wait until it has storeToRecoveryFile'd.
  - Emergency and Session pre-register all documents
via implts_persistAllActiveViewNames, so no problem here.

resetHandleStates: shouldn't add, just update the existing states

saveOneDoc: shouldn't add before storeToRecoveryFile, only after.

Change-Id: I4a935ee325af6469b25c5bf3d2860c4065d9130d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154490
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 1bef7e6f3980..f0affa0cf7f3 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -575,8 +575,8 @@ private:
 void implts_readAutoSaveConfig();
 
 // TODO document me
-void implts_flushConfigItem(const AutoRecovery::TDocumentInfo& rInfo   
 ,
-  bool bRemoveIt = 
false);
+void implts_flushConfigItem(const AutoRecovery::TDocumentInfo& rInfo, bool 
bRemoveIt = false,
+bool bAllowAdd = true);
 
 // TODO document me
 void implts_startListening();
@@ -1981,7 +1981,8 @@ void AutoRecovery::implts_persistAllActiveViewNames()
 }
 }
 
-void AutoRecovery::implts_flushConfigItem(const AutoRecovery::TDocumentInfo& 
rInfo, bool bRemoveIt)
+void AutoRecovery::implts_flushConfigItem(const AutoRecovery::TDocumentInfo& 
rInfo, bool bRemoveIt,
+  bool bAllowAdd)
 {
 std::shared_ptr batch(
 comphelper::ConfigurationChanges::create());
@@ -2019,7 +2020,12 @@ void AutoRecovery::implts_flushConfigItem(const 
AutoRecovery::TDocumentInfo& rIn
 css::uno::Reference< css::beans::XPropertySet > xSet;
 boolbNew = 
!xCheck->hasByName(sID);
 if (bNew)
+{
+if (!bAllowAdd)
+return; // no change made, just exit
+
 xSet.set(xCreate->createInstance(), css::uno::UNO_QUERY_THROW);
+}
 else
 xCheck->getByName(sID) >>= xSet;
 
@@ -2485,7 +2491,8 @@ void AutoRecovery::implts_registerDocument(const 
css::uno::Reference< css::frame
 
 } /* SAFE */
 
-implts_flushConfigItem(aInfo);
+// Even if the document is modified, we don't know if we have anything to 
recover, so don't add.
+implts_flushConfigItem(aInfo, /*bRemoveIt=*/false, /*bAllowAdd=*/false);
 implts_startModifyListeningOnDoc(aInfo);
 
 aCacheLock.unlock();
@@ -3053,10 +3060,11 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 // Because the last temp file is too old and does not include all changes.
 Reference< XDocumentRecovery > xDocRecover(rInfo.Document, 
css::uno::UNO_QUERY_THROW);
 
-// safe the state about "trying to save"
+// save the state about "trying to save"
 // ... we need it for recovery if e.g. a crash occurs inside next line!
 rInfo.DocumentState |= DocState::TrySave;
-implts_flushConfigItem(rInfo);
+// just update existing info: don't add any recovery record until recovery 
file created.
+implts_flushConfigItem(rInfo, /*bRemoveIt=*/false, /*bAllowAdd=*/false);
 
 // If userautosave is enabled, first try to save the original file.
 // Note that we must do it *before* calling storeToRecoveryFile, so in 
case of failure here
@@ -3667,7 +3675,8 @@ void AutoRecovery::implts_resetHandleStates()
 
 // } /* SAFE */
 g.clear();
-implts_flushConfigItem(info);
+// just update existing records.
+implts_flushConfigItem(info, /*bRemoveIt=*/false, /*bAllowAdd=*/false);
 g.reset();
 // /* SAFE */ {
 }


[Libreoffice-commits] core.git: framework/source

2023-08-07 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit db9fa6da9d57853e0089a063ec372e11ce6046a9
Author: Justin Luth 
AuthorDate: Thu Jul 20 13:25:57 2023 -0400
Commit: Justin Luth 
CommitDate: Mon Aug 7 17:17:47 2023 +0200

related tdf#57414 autosave: try harder to know when !IsModified

The cache that holds document status did:
-saveDocs: for each cached document status:
  -creates a copy of the cached status
  -call saveOneDoc: given the copy
  [-updateModifiedState should get called, updating the cache itself]
  -saveOneDoc: flushConfig writes copy to RecoveryList (as modified)
  -cache is updated with the results from saveOneDoc (*pIt = aInfo)

Now, it is easily possible that saveOneDoc changed the status from
modified, to not modified, wouldn't you think (if UserAutoSave)?
But since the copy was never updated, it reported as modified still!

storeToRecoveryFile can benefit from knowing the real modified status,
so do the update just prior to that call.

Change-Id: Iee1ddd0bf7bee25d5ba3e7abb1ac6713295906af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154683
Reviewed-by: Justin Luth 
Tested-by: Jenkins

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 4eb7000afeac..1bef7e6f3980 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3076,6 +3076,15 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 {
 }
 
+// DocState::Modified status cannot be trusted to be accurate, but at 
least attempt to be so,
+// since this rInfo will eventually get assigned to m_lDocCache as the 
authoritative status.
+const Reference xModify(rInfo.Document, UNO_QUERY);
+const bool bModified = xModify.is() && xModify->isModified();
+if (bModified)
+rInfo.DocumentState |= DocState::Modified;
+else if (xModify.is())
+rInfo.DocumentState &= ~DocState::Modified;
+
 sal_Int32 nRetry = RETRY_STORE_ON_FULL_DISC_FOREVER;
 bool  bError = false;
 do


[Libreoffice-commits] core.git: framework/source

2023-08-02 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit eef0c5d4d45ba35acfb6d8f7551fe565ca4badaa
Author: Justin Luth 
AuthorDate: Tue Aug 1 14:00:35 2023 -0400
Commit: Justin Luth 
CommitDate: Thu Aug 3 03:37:42 2023 +0200

tdf#71550 autorecovery: use osl::File::Remove when isEmptyFileUrl

Mike K suggested I just use the simpler, faster function in this case.

Change-Id: I0f7f6611f12f88cd1daa4104b58eb44365a44ae3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155271
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 902e180320ee..4eb7000afeac 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3127,7 +3127,7 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 {
 // delete the empty file created by implts_generateNewTempURL
 if (tools::isEmptyFileUrl(rInfo.NewTempURL))
-AutoRecovery::st_impl_removeFile(rInfo.NewTempURL);
+osl::File::remove(rInfo.NewTempURL);
 
 throw; // force stacktrace to know if there exist might other 
reasons, why an AutoSave can fail !!!
 }


[Libreoffice-commits] core.git: framework/source

2023-08-02 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |   17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit fe55282c02a3306ac1c7971a5c2c85c52f54d205
Author: Justin Luth 
AuthorDate: Tue Aug 1 10:47:46 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Aug 2 23:32:15 2023 +0200

tdf#144512 autorecovery: don't delay autosave on shutdown

Change-Id: I98ee31369aa46c4e3aeb405ec11a1ef197c31fe0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155165
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index c55e869cedf3..902e180320ee 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2895,15 +2895,18 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( 
  boolbAllow
 continue;
 }
 
-if (auto xDocRecovery2 = xDocRecover.query())
+// If the document became modified not too long ago, don't autosave it 
yet.
+if (bAllowUserIdleLoop)
 {
-const sal_Int64 nDirtyDuration = 
xDocRecovery2->getModifiedStateDuration();
-// If the document became modified not too long ago, don't 
autosave it yet.
-// Round up to second - if this document is almost ready for 
autosave, do it now.
-if (nDirtyDuration + 999 < nConfiguredAutoSaveInterval)
+if (auto xDocRecovery2 = xDocRecover.query())
 {
-aInfo.DocumentState |= DocState::Handled;
-continue;
+const sal_Int64 nDirtyDuration = 
xDocRecovery2->getModifiedStateDuration();
+// Round up to second - if this document is almost ready for 
autosave, do it now.
+if (nDirtyDuration + 999 < nConfiguredAutoSaveInterval)
+{
+aInfo.DocumentState |= DocState::Handled;
+continue;
+}
 }
 }
 


[Libreoffice-commits] core.git: framework/source

2023-08-02 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit f080ef9daf7519cc53f5f341bfa1d60b1ee4b964
Author: Justin Luth 
AuthorDate: Tue Aug 1 11:01:54 2023 -0400
Commit: Justin Luth 
CommitDate: Wed Aug 2 19:15:52 2023 +0200

tdf#65509 autorecovery: don't UserAutoSave during EmergencySave

Saving overtop of the working document during a crash save
does not sound like a safe thing to do.

However, an ODF recovery export is attempted
which will preserve unsaved modifications,
so avoiding this save should not cause data loss.

Change-Id: Ie993042b4c99d5dfb816727d4bfae5bca694d72f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155166
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 7bdf5f094b30..c55e869cedf3 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3058,11 +3058,12 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 // If userautosave is enabled, first try to save the original file.
 // Note that we must do it *before* calling storeToRecoveryFile, so in 
case of failure here
 // we won't remain with the modified flag set to true, even though the 
autorecovery save succeeded.
+const bool bEmergencySave(m_eJob & Job::EmergencySave);
 try
 {
 // We must check here for an empty URL to avoid a "This operation is 
not supported on this operating system."
 // message during autosave.
-if ((m_eJob & Job::UserAutoSave) == Job::UserAutoSave && 
!rInfo.OrgURL.isEmpty())
+if (!bEmergencySave && m_eJob & Job::UserAutoSave && 
!rInfo.OrgURL.isEmpty())
 {
 Reference< XStorable > xDocSave(rInfo.Document, 
css::uno::UNO_QUERY_THROW);
 xDocSave->store();


[Libreoffice-commits] core.git: framework/source

2023-07-31 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d16d86685afdf3d321cc282a39a65f38381b6eaa
Author: Justin Luth 
AuthorDate: Sat Jul 29 22:22:20 2023 -0400
Commit: Mike Kaganski 
CommitDate: Tue Aug 1 03:10:44 2023 +0200

tdf#57414 autorecovery: if no recovery doc, remove from RecoveryList

The document has just been saved
(perhaps manually, perhaps automatically)
and so the recovery ODF files are being removed.

So remove from RecoveryList since there is nothing
recoverable at this point.

Sure the document is open, and perhaps
there is even a modification already,
but if there are no recovery files available,
then why display it to the user?

Change-Id: I309cd7df573c960f75c2240c8b5cf171fc1d95be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155059
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index f325a45788a2..7bdf5f094b30 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2662,7 +2662,8 @@ void AutoRecovery::implts_markDocumentAsSaved(const 
css::uno::Reference< css::fr
 
 } /* SAFE */
 
-implts_flushConfigItem(aInfo);
+// no need to recover a saved document until modified and new recovery 
file is created
+implts_flushConfigItem(aInfo, /*bRemoveIt=*/true);
 
 aCacheLock.unlock();
 


[Libreoffice-commits] core.git: framework/source include/vcl vcl/source

2023-07-28 Thread Balazs Varga (via logerrit)
 framework/source/uielement/menubarmanager.cxx |   31 +++---
 include/vcl/menu.hxx  |1 
 vcl/source/window/menu.cxx|   18 +++
 3 files changed, 47 insertions(+), 3 deletions(-)

New commits:
commit 630303ad8e94bd634b98e691935a1f4c19582a3a
Author: Balazs Varga 
AuthorDate: Wed Jul 26 12:17:19 2023 +0200
Commit: Balazs Varga 
CommitDate: Fri Jul 28 09:22:49 2023 +0200

tdf#104382 - Menus should be disabled when they have no enabled submenus

Disable menu elements if they only have disabled submenu elemets.
TODO: GTK3

Change-Id: I83cdc58846afd61719ceeba9f993df894ce6fd01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154938
Tested-by: Jenkins
Reviewed-by: Balazs Varga 

diff --git a/framework/source/uielement/menubarmanager.cxx 
b/framework/source/uielement/menubarmanager.cxx
index b445324d70d5..f86ede8eb052 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -515,7 +515,7 @@ void SAL_CALL MenuBarManager::disposing( const EventObject& 
Source )
 static void lcl_CheckForChildren(Menu* pMenu, sal_uInt16 nItemId)
 {
 if (PopupMenu* pThisPopup = pMenu->GetPopupMenu( nItemId ))
-pMenu->EnableItem( nItemId, pThisPopup->GetItemCount() != 0 );
+pMenu->EnableItem( nItemId, pThisPopup->GetItemCount() != 0 && 
pThisPopup->HasValidEntries(true));
 }
 
 // vcl handler
@@ -672,6 +672,15 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
 {
 if( xMenuItemDispatch.is() || 
menuItemHandler->aMenuItemURL != ".uno:RecentFileList" )
 bPopupMenu = 
CreatePopupMenuController(menuItemHandler.get(), m_xDispatchProvider, 
m_aModuleIdentifier);
+
+if (bPopupMenu && 
menuItemHandler->xPopupMenuController.is())
+{
+if (PopupMenu* pThisPopup = 
pMenu->GetPopupMenu(menuItemHandler->nItemId))
+{
+pThisPopup->Activate();
+pThisPopup->Deactivate();
+}
+}
 }
 else if ( menuItemHandler->xPopupMenuController.is() )
 {
@@ -679,7 +688,10 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
 menuItemHandler->xPopupMenuController->updatePopupMenu();
 bPopupMenu = true;
 if (PopupMenu*  pThisPopup = pMenu->GetPopupMenu( 
menuItemHandler->nItemId ))
-pMenu->EnableItem( menuItemHandler->nItemId, 
pThisPopup->GetItemCount() != 0 );
+{
+pThisPopup->Activate();
+pThisPopup->Deactivate();
+}
 }
 lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
 
@@ -703,6 +715,11 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
 {
 // Force update of popup menu
 menuItemHandler->xPopupMenuController->updatePopupMenu();
+if (PopupMenu* pThisPopup = 
pMenu->GetPopupMenu(menuItemHandler->nItemId))
+{
+pThisPopup->Activate();
+pThisPopup->Deactivate();
+}
 lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
 }
 else if ( menuItemHandler->xMenuItemDispatch.is() )
@@ -722,8 +739,16 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
 {
 }
 }
-else if ( menuItemHandler->xSubMenuManager.is() )
+else if (menuItemHandler->xSubMenuManager.is())
+{
+MenuBarManager* pMenuBarManager = 
static_cast(menuItemHandler->xSubMenuManager.get());
+if (pMenuBarManager)
+{
+pMenuBarManager->Activate(pMenuBarManager->GetMenuBar());
+pMenuBarManager->Deactivate(pMenuBarManager->GetMenuBar());
+}
 lcl_CheckForChildren(pMenu, menuItemHandler->nItemId);
+}
 }
 }
 
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index aeedc2cbe218..2442eef9202f 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -252,6 +252,7 @@ public:
 void SetMenuFlags( MenuFlags nFlags ) { nMenuFlags = nFlags; }
 MenuFlags GetMenuFlags() const { return nMenuFlags; }
 
+bool HasValidEntries(bool bCheckPopups) const;
 sal_uInt16 GetItemCount() const;
 sal_uInt16 GetItemId(sal_uInt16 nPos) const;
 sal_uInt16 GetItemId(std::u16string_view rIdent) const;
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 284a54a0a3a7..b33219c82c8d 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -579,6 +579,24 @@ 

[Libreoffice-commits] core.git: framework/source include/vcl vcl/source

2023-07-26 Thread Rafael Lima (via logerrit)
 framework/source/uielement/menubarmanager.cxx |2 ++
 include/vcl/menu.hxx  |6 ++
 vcl/source/window/menuwindow.cxx  |   19 +--
 3 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit 6fa4e5965b2a79ae6735f4191a2261713a42356e
Author: Rafael Lima 
AuthorDate: Mon Jul 24 23:05:50 2023 +0200
Commit: Rafael Lima 
CommitDate: Wed Jul 26 13:25:10 2023 +0200

tdf#149318 Set HID for menus that have sub menus

This patch fixes the following issue when pressing F1 while hovering on a 
menu entry that has submenus:
1) Place the mouse over a menu entry that has submenus (f.i. in Draw go to 
Format - Table)
2) A submenu will appear, however leave the mouse over "Table"
3) Press F1... the help ID used will be "slot:0" because LO is trying to 
find the help ID of the selected entry in the submenu, but since none is 
selected, then the generic "slot:0" value is used.

To fix this problem, this patch assigns a Help ID for the submenu (not for 
its entries) so that when no entry is focused, then the submenu HID is used.

IMPORTANT: note that pressing F1 on menus only work with gen and win. Due 
to bug 156376 pressing F1 on menus does not work with kf5 and gtk3 (yet).

Change-Id: I717e7669faac47a12c929129c0de98dee7f44439
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154862
Tested-by: Jenkins
Tested-by: Heiko Tietze 
Reviewed-by: Heiko Tietze 

diff --git a/framework/source/uielement/menubarmanager.cxx 
b/framework/source/uielement/menubarmanager.cxx
index edbd88d2250c..b445324d70d5 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1342,6 +1342,8 @@ void MenuBarManager::FillMenu(
 {
 VclPtr pNewPopupMenu = 
VclPtr::Create();
 pMenu->SetPopupMenu( nId, pNewPopupMenu );
+// Use the command URL as the Help ID for the sub menu
+pNewPopupMenu->SetHelpId(aCommandURL);
 
 if ( xDispatchProvider.is() )
 {
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index c6bd47efba01..aeedc2cbe218 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -156,6 +156,9 @@ private:
 mutable std::unique_ptr mpLayoutData;
 std::unique_ptr mpSalMenu;
 
+// Stores the help ID of the menu
+OUString m_sMenuHelpId;
+
 protected:
 SAL_DLLPRIVATE Menu* ImplGetStartMenu();
 SAL_DLLPRIVATE Menu* ImplFindSelectMenu();
@@ -314,6 +317,9 @@ public:
 void SetHelpId( sal_uInt16 nItemId, const OUString& rHelpId );
 OUString GetHelpId( sal_uInt16 nItemId ) const;
 
+void SetHelpId( const OUString& rHelpId ) { m_sMenuHelpId = rHelpId; }
+OUString GetHelpId() const { return m_sMenuHelpId; }
+
 void SetActivateHdl( const Link& rLink )
 {
 aActivateHdl = rLink;
diff --git a/vcl/source/window/menuwindow.cxx b/vcl/source/window/menuwindow.cxx
index 36ed07f0730d..802c62e285f8 100644
--- a/vcl/source/window/menuwindow.cxx
+++ b/vcl/source/window/menuwindow.cxx
@@ -91,17 +91,24 @@ bool MenuWindow::ImplHandleHelpEvent(vcl::Window* 
pMenuWindow, Menu const * pMen
 Help* pHelp = Application::GetHelp();
 if ( pHelp )
 {
-// is an id available, then call help with the id, otherwise
-// use help-index
+// Check if there is a Help ID available, or else use
+// the command URL
 OUString aCommand = pMenu->GetItemCommand( nId );
-OUString aHelpId(  pMenu->GetHelpId( nId ) );
+OUString aHelpId;
+
+// If no entry is selected, use the general menu Help ID
+if (nId <= 0)
+aHelpId = pMenu->GetHelpId();
+else
+aHelpId = pMenu->GetHelpId(nId);
+
 if( aHelpId.isEmpty() )
 aHelpId = OOO_HELP_INDEX;
 
-if ( !aCommand.isEmpty() )
-pHelp->Start(aCommand);
-else
+if ( !aHelpId.isEmpty() )
 pHelp->Start(aHelpId);
+else
+pHelp->Start(aCommand);
 }
 bDone = true;
 }


[Libreoffice-commits] core.git: framework/source

2023-07-19 Thread Mike Kaganski (via logerrit)
 framework/source/services/autorecovery.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 514cc22875a90c8faa3d946ad47ebb68bd710ac7
Author: Mike Kaganski 
AuthorDate: Wed Jul 19 15:27:56 2023 +0200
Commit: Mike Kaganski 
CommitDate: Wed Jul 19 20:26:48 2023 +0200

Use correct configuration

I introduced it in commit 79113484cacb630f93f87c483b6c5d97c47b8728
by mistake, when rebased on 3c41b32562d5ccdd306000484c5b16245b2b4a4f.

Change-Id: Ia3ba91cda9e54d9434b6d79bf78afd13f2b20d5e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154619
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index ee58ba9212a2..b1abcf5e9982 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2840,7 +2840,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs(   
boolbAllow
 CacheLockGuard aCacheLock(this, 
cppu::WeakComponentImplHelperBase::rBHelper.rMutex, m_nDocCacheLock, 
LOCK_FOR_CACHE_USE);
 
 const sal_Int64 nConfiguredAutoSaveInterval
-= 
officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::get()
+= officecfg::Office::Recovery::AutoSave::TimeIntervall::get()
   * sal_Int64(6); // min -> ms
 
 /* SAFE */ {


[Libreoffice-commits] core.git: framework/source include/sfx2 offapi/com offapi/UnoApi_offapi.mk sfx2/source

2023-07-18 Thread Mike Kaganski (via logerrit)
 framework/source/services/autorecovery.cxx  |   44 +-
 include/sfx2/sfxbasemodel.hxx   |7 ++
 offapi/UnoApi_offapi.mk |1 
 offapi/com/sun/star/document/XDocumentRecovery2.idl |   47 
 sfx2/source/doc/sfxbasemodel.cxx|   44 ++
 5 files changed, 127 insertions(+), 16 deletions(-)

New commits:
commit 79113484cacb630f93f87c483b6c5d97c47b8728
Author: Mike Kaganski 
AuthorDate: Sun Jul 16 23:17:08 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Jul 18 19:15:33 2023 +0200

[API CHANGE] tdf#144512: keep autosave interval separately for each document

Maybe this would make a better UX, as the request suggests ... or maybe not.

css::document::XDocumentRecovery2 is introduced for this, allowing to query
the document dirty state duration.

Change-Id: I25997788bc5da261f7e4131616ab8d4a245de380
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154505
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index a1a984e7617e..ee58ba9212a2 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -50,7 +50,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -995,7 +995,7 @@ private:
 };
 
 // recovery.xcu
-constexpr OUStringLiteral CFG_PACKAGE_RECOVERY = 
u"org.openoffice.Office.Recovery/";
+constexpr OUStringLiteral CFG_PACKAGE_RECOVERY = 
u"/org.openoffice.Office.Recovery";
 
 const char CFG_ENTRY_AUTOSAVE_ENABLED[] = "AutoSave/Enabled";
 
@@ -2183,7 +2183,7 @@ void AutoRecovery::implts_updateTimer()
 {
 implts_stopTimer();
 
-sal_Int32 nMilliSeconds = 0;
+sal_Int64 nMilliSeconds = 0;
 
 /* SAFE */ {
 osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
@@ -2196,7 +2196,27 @@ void AutoRecovery::implts_updateTimer()
 
 if (m_eTimerType == AutoRecovery::E_NORMAL_AUTOSAVE_INTERVALL)
 {
-nMilliSeconds = 
officecfg::Office::Recovery::AutoSave::TimeIntervall::get() * 6; // [min] 
=> 60.000 ms
+const sal_Int64 nConfiguredAutoSaveInterval
+= officecfg::Office::Recovery::AutoSave::TimeIntervall::get()
+  * sal_Int64(6); // [min] => 60.000 ms
+nMilliSeconds = nConfiguredAutoSaveInterval;
+
+// Calculate how soon the nearest dirty document's autosave time is;
+// store the shortest document autosave timeout as the next timer 
timeout.
+for (const auto& docInfo : m_lDocCache)
+{
+if (auto xDocRecovery2 = 
docInfo.Document.query())
+{
+sal_Int64 nDirtyDuration = 
xDocRecovery2->getModifiedStateDuration();
+if (nDirtyDuration < 0)
+continue;
+if (nDirtyDuration > nConfiguredAutoSaveInterval)
+nDirtyDuration = nConfiguredAutoSaveInterval; // 
nMilliSeconds will be 0
+
+nMilliSeconds
+= std::min(nMilliSeconds, nConfiguredAutoSaveInterval - 
nDirtyDuration);
+}
+}
 }
 else if (m_eTimerType == AutoRecovery::E_POLL_FOR_USER_IDLE)
 {
@@ -2819,6 +2839,10 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs(  
 boolbAllow
 
 CacheLockGuard aCacheLock(this, 
cppu::WeakComponentImplHelperBase::rBHelper.rMutex, m_nDocCacheLock, 
LOCK_FOR_CACHE_USE);
 
+const sal_Int64 nConfiguredAutoSaveInterval
+= 
officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::get()
+  * sal_Int64(6); // min -> ms
+
 /* SAFE */ {
 osl::ResettableMutexGuard 
g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
 
@@ -2858,6 +2882,18 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs(  
 boolbAllow
 continue;
 }
 
+if (auto xDocRecovery2 = xDocRecover.query())
+{
+const sal_Int64 nDirtyDuration = 
xDocRecovery2->getModifiedStateDuration();
+// If the document became modified not too long ago, don't 
autosave it yet.
+// Round up to second - if this document is almost ready for 
autosave, do it now.
+if (nDirtyDuration + 999 < nConfiguredAutoSaveInterval)
+{
+aInfo.DocumentState |= DocState::Handled;
+continue;
+}
+}
+
 // check if this document is still used by a concurrent save operation
 // e.g. if the user tried to save via UI.
 // Handle it in the following way:
diff --git a/include/sfx2/sfxbasemodel.hxx b/include/sfx2/sfxbasemodel.hxx
index 8ccd59292e58..2602387fad59 100644
--- a/include/sfx2/sfxbasemodel.hxx
+++ b/include/sfx2/sfxbasemodel.hxx
@@ -29,7 +29,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 

[Libreoffice-commits] core.git: framework/source

2023-07-17 Thread Mike Kaganski (via logerrit)
 framework/source/services/autorecovery.cxx |   27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

New commits:
commit 8362ec6646df330629b1c6c2e28b634487d55612
Author: Mike Kaganski 
AuthorDate: Sun Jul 16 22:04:37 2023 +0200
Commit: Mike Kaganski 
CommitDate: Mon Jul 17 18:40:16 2023 +0200

Small simplification

Change-Id: I36bbdb48f0fa0d81e7ba294e9ac01b0d187e4800
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154462
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index a0ef83d3a9da..07ea3184476f 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -1801,7 +1801,6 @@ void AutoRecovery::implts_readConfig()
 
 css::uno::Reference xRecoveryList(
 officecfg::Office::Recovery::RecoveryList::get());
-const OUString 
sRECOVERY_ITEM_BASE_IDENTIFIER(RECOVERY_ITEM_BASE_IDENTIFIER);
 const css::uno::Sequence< OUString > lItems = 
xRecoveryList->getElementNames();
 const OUString*  pItems = lItems.getConstArray();
 sal_Int32c  = lItems.getLength();
@@ -1833,9 +1832,9 @@ void AutoRecovery::implts_readConfig()
 implts_specifyAppModuleAndFactory(aInfo);
 implts_specifyDefaultFilterAndExtension(aInfo);
 
-if (pItems[i].startsWith(sRECOVERY_ITEM_BASE_IDENTIFIER))
+if (pItems[i].startsWith(RECOVERY_ITEM_BASE_IDENTIFIER))
 {
-std::u16string_view sID = 
pItems[i].subView(sRECOVERY_ITEM_BASE_IDENTIFIER.getLength());
+std::u16string_view sID = 
pItems[i].subView(RECOVERY_ITEM_BASE_IDENTIFIER.getLength());
 aInfo.ID = o3tl::toInt32(sID);
 /* SAFE */ {
 osl::MutexGuard 
g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
@@ -1935,8 +1934,8 @@ void 
AutoRecovery::implts_specifyAppModuleAndFactory(AutoRecovery::TDocumentInfo
 rInfo.AppModule = xManager->identify(rInfo.Document);
 
 ::comphelper::SequenceAsHashMap 
lModuleDescription(xManager->getByName(rInfo.AppModule));
-lModuleDescription[OUString(CFG_ENTRY_PROP_EMPTYDOCUMENTURL)] >>= 
rInfo.FactoryURL;
-lModuleDescription[OUString(CFG_ENTRY_PROP_FACTORYSERVICE)] >>= 
rInfo.FactoryService;
+lModuleDescription[CFG_ENTRY_PROP_EMPTYDOCUMENTURL] >>= rInfo.FactoryURL;
+lModuleDescription[CFG_ENTRY_PROP_FACTORYSERVICE] >>= rInfo.FactoryService;
 }
 
 void AutoRecovery::implts_collectActiveViewNames( AutoRecovery::TDocumentInfo& 
i_rInfo )
@@ -3590,15 +3589,15 @@ css::frame::FeatureStateEvent 
AutoRecovery::implst_createFeatureStateEvent(
 {
 // pack rInfo for transport via UNO
 ::comphelper::NamedValueCollection aInfo;
-aInfo.put( OUString(CFG_ENTRY_PROP_ID), pInfo->ID );
-aInfo.put( OUString(CFG_ENTRY_PROP_ORIGINALURL), pInfo->OrgURL );
-aInfo.put( OUString(CFG_ENTRY_PROP_FACTORYURL), pInfo->FactoryURL );
-aInfo.put( OUString(CFG_ENTRY_PROP_TEMPLATEURL), pInfo->TemplateURL );
-aInfo.put( OUString(CFG_ENTRY_PROP_TEMPURL), 
pInfo->OldTempURL.isEmpty() ? pInfo->NewTempURL : pInfo->OldTempURL );
-aInfo.put( OUString(CFG_ENTRY_PROP_MODULE), pInfo->AppModule);
-aInfo.put( OUString(CFG_ENTRY_PROP_TITLE), pInfo->Title);
-aInfo.put( OUString(CFG_ENTRY_PROP_VIEWNAMES), pInfo->ViewNames);
-aInfo.put( OUString(CFG_ENTRY_PROP_DOCUMENTSTATE), 
sal_Int32(pInfo->DocumentState));
+aInfo.put( CFG_ENTRY_PROP_ID, pInfo->ID );
+aInfo.put( CFG_ENTRY_PROP_ORIGINALURL, pInfo->OrgURL );
+aInfo.put( CFG_ENTRY_PROP_FACTORYURL, pInfo->FactoryURL );
+aInfo.put( CFG_ENTRY_PROP_TEMPLATEURL, pInfo->TemplateURL );
+aInfo.put( CFG_ENTRY_PROP_TEMPURL, pInfo->OldTempURL.isEmpty() ? 
pInfo->NewTempURL : pInfo->OldTempURL );
+aInfo.put( CFG_ENTRY_PROP_MODULE, pInfo->AppModule);
+aInfo.put( CFG_ENTRY_PROP_TITLE, pInfo->Title);
+aInfo.put( CFG_ENTRY_PROP_VIEWNAMES, pInfo->ViewNames);
+aInfo.put( CFG_ENTRY_PROP_DOCUMENTSTATE, 
sal_Int32(pInfo->DocumentState));
 
 aEvent.State <<= aInfo.getPropertyValues();
 }


[Libreoffice-commits] core.git: framework/source

2023-07-14 Thread Justin Luth (via logerrit)
 framework/source/services/autorecovery.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 65db5b6a34c4cb781e7a9ab813801a0e0d114da5
Author: Justin Luth 
AuthorDate: Fri Jul 14 14:37:43 2023 -0400
Commit: Justin Luth 
CommitDate: Fri Jul 14 22:21:02 2023 +0200

tdf#71550 autosave: remove empty, new file on failed autosave

before throwing and losing any control.

Change-Id: I2340c6f08bae116f3c1a390bccca2075c047a737
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154446
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index ddeeab2c23c5..a0ef83d3a9da 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3086,7 +3086,13 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 else if (nRetry > RETRY_STORE_ON_MIGHT_FULL_DISC_USEFULL)
 nRetry = RETRY_STORE_ON_MIGHT_FULL_DISC_USEFULL;
 else if (nRetry <= GIVE_UP_RETRY)
+{
+// delete the empty file created by implts_generateNewTempURL
+if (tools::isEmptyFileUrl(rInfo.NewTempURL))
+AutoRecovery::st_impl_removeFile(rInfo.NewTempURL);
+
 throw; // force stacktrace to know if there exist might other 
reasons, why an AutoSave can fail !!!
+}
 
 --nRetry;
 }


[Libreoffice-commits] core.git: framework/source

2023-06-15 Thread Andreas Heinisch (via logerrit)
 framework/source/uielement/recentfilesmenucontroller.cxx |   47 ++-
 1 file changed, 34 insertions(+), 13 deletions(-)

New commits:
commit 651d60f79c28c9a8e456817990c21a404c69d700
Author: Andreas Heinisch 
AuthorDate: Tue Jun 6 23:33:12 2023 +0200
Commit: Andreas Heinisch 
CommitDate: Thu Jun 15 09:54:55 2023 +0200

tdf#155699 - MRU: show pinned documents at the beginning of the list

Change-Id: Id08678708ee74a4a278baa1e67930044f25e5d5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152690
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx 
b/framework/source/uielement/recentfilesmenucontroller.cxx
index 194f66d1476f..e630dda1cba3 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -165,35 +165,50 @@ void RecentFilesMenuController::fillPopupMenu( Reference< 
css::awt::XPopupMenu >
 = officecfg::Office::Common::History::ShowCurrentModuleOnly::get();
 
 size_t nItemPosModule = 0;
+size_t nItemPosPinned = 0;
 if (( nPickListMenuItems > 0 ) && !m_bDisabled )
 {
 size_t nItemPos = 0;
+
+// tdf#155699 - create a lambda to insert a recent document item at a 
specified position
+auto insertHistoryItemAtPos =
+[&](const SvtHistoryOptions::HistoryItem& rPickListEntry, const 
size_t aInsertPosition)
+{
+m_aRecentFilesItems.insert(m_aRecentFilesItems.begin() + 
aInsertPosition,
+   { rPickListEntry.sURL, 
rPickListEntry.isReadOnly });
+nItemPos++;
+};
+
 if (m_aModuleName != "com.sun.star.frame.StartModule")
 {
 ::comphelper::MimeConfigurationHelper aConfigHelper(
 comphelper::getProcessComponentContext());
+
 // Show the first MAX_MENU_ITEMS_PER_MODULE items of the current 
module
 // on top of the recent document list.
 for (int i = 0; i < nPickListMenuItems; i++)
 {
 const SvtHistoryOptions::HistoryItem& rPickListEntry = 
aHistoryList[i];
-const std::pair 
aPickListEntry(rPickListEntry.sURL,
-   
rPickListEntry.isReadOnly);
-if ((nItemPosModule < MAX_MENU_ITEMS_PER_MODULE || 
bShowCurrentModuleOnly)
-&& 
aConfigHelper.GetDocServiceNameFromFilter(rPickListEntry.sFilter)
-   == m_aModuleName)
+
+// tdf#155699 - insert pinned document at the beginning of the 
list
+if (rPickListEntry.isPinned)
 {
-m_aRecentFilesItems.insert(m_aRecentFilesItems.begin() + 
nItemPosModule,
-   aPickListEntry);
-nItemPos++;
+insertHistoryItemAtPos(rPickListEntry, nItemPosPinned);
+nItemPosPinned++;
 nItemPosModule++;
 }
-else if (!bShowCurrentModuleOnly)
+// tdf#56696 - insert documents of the current module
+else if ((bShowCurrentModuleOnly
+  || (nItemPosModule - nItemPosPinned) < 
MAX_MENU_ITEMS_PER_MODULE)
+ && 
aConfigHelper.GetDocServiceNameFromFilter(rPickListEntry.sFilter)
+== m_aModuleName)
 {
-m_aRecentFilesItems.insert(m_aRecentFilesItems.begin() + 
nItemPos,
-   aPickListEntry);
-nItemPos++;
+insertHistoryItemAtPos(rPickListEntry, nItemPosModule);
+nItemPosModule++;
 }
+// Insert all other documents at the end of the list if the 
expert option is not set
+else if (!bShowCurrentModuleOnly)
+insertHistoryItemAtPos(rPickListEntry, nItemPos);
 }
 }
 else
@@ -201,7 +216,9 @@ void RecentFilesMenuController::fillPopupMenu( Reference< 
css::awt::XPopupMenu >
 for (int i = 0; i < nPickListMenuItems; i++)
 {
 const SvtHistoryOptions::HistoryItem& rPickListEntry = 
aHistoryList[i];
-m_aRecentFilesItems.emplace_back(rPickListEntry.sURL, 
rPickListEntry.isReadOnly);
+// tdf#155699 - insert pinned document at the beginning of the 
list
+insertHistoryItemAtPos(rPickListEntry,
+   rPickListEntry.isPinned ? 
nItemPosModule++ : nItemPos);
 }
 }
 }
@@ -263,6 +280,10 @@ void RecentFilesMenuController::fillPopupMenu( Reference< 
css::awt::XPopupMenu >
 rPopupMenu->setTipHelpText(sal_uInt16(i + 1), aTipHelpText);
 

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

2023-06-06 Thread Noel Grandin (via logerrit)
 framework/source/layoutmanager/toolbarlayoutmanager.cxx |2 
 framework/source/services/desktop.cxx   |2 
 framework/source/services/frame.cxx |2 
 framework/source/uielement/menubarmanager.cxx   |8 +--
 framework/source/uielement/toolbarmanager.cxx   |6 +-
 framework/source/uielement/toolbarsmenucontroller.cxx   |8 ---
 include/unotools/cmdoptions.hxx |   10 
 sfx2/source/dialog/dinfdlg.cxx  |2 
 sw/source/ui/envelp/labprt.cxx  |2 
 unotools/source/config/cmdoptions.cxx   |   33 
 10 files changed, 26 insertions(+), 49 deletions(-)

New commits:
commit 41c248e066f454355dcceaa233ccf90f2adaee52
Author: Noel Grandin 
AuthorDate: Tue Jun 6 11:49:27 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jun 6 17:35:26 2023 +0200

SvtCommandOptions only supports CMDOPTION_DISABLED

CMDOPTION_NONE is just ignored, so remove this parameter

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

diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx 
b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index b7b1d248564d..846b111d5825 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -543,7 +543,7 @@ bool ToolbarLayoutManager::createToolbar( const OUString& 
rResourceURL )
 {
 ToolBox* pToolbar = static_cast(pWindow.get());
 ToolBoxMenuType nMenuType = pToolbar->GetMenuType();
-if ( aCmdOptions.Lookup( 
SvtCommandOptions::CMDOPTION_DISABLED, "ConfigureDialog" ))
+if ( aCmdOptions.LookupDisabled( "ConfigureDialog" ))
 pToolbar->SetMenuType( nMenuType & 
~ToolBoxMenuType::Customize );
 else
 pToolbar->SetMenuType( nMenuType | 
ToolBoxMenuType::Customize );
diff --git a/framework/source/services/desktop.cxx 
b/framework/source/services/desktop.cxx
index ea0df283b8a6..35dfcd2e21eb 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -679,7 +679,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL 
Desktop::queryDispatch( co
 m_xCommandOptions.reset(new SvtCommandOptions);
 
 // Make std::unordered_map lookup if the current URL is in the disabled 
list
-if (m_xCommandOptions && 
m_xCommandOptions->Lookup(SvtCommandOptions::CMDOPTION_DISABLED, aCommand))
+if (m_xCommandOptions && m_xCommandOptions->LookupDisabled(aCommand))
 return css::uno::Reference< css::frame::XDispatch >();
 else
 {
diff --git a/framework/source/services/frame.cxx 
b/framework/source/services/frame.cxx
index 54df1a7eeac2..659578975a5e 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -2313,7 +2313,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL 
XFrameImpl::queryDispatch(
 aCommand = aURL.Path;
 
 // Make std::unordered_map lookup if the current URL is in the disabled 
list
-if ( m_aCommandOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, 
aCommand ) )
+if ( m_aCommandOptions.LookupDisabled( aCommand ) )
 return css::uno::Reference< css::frame::XDispatch >();
 else
 {
diff --git a/framework/source/uielement/menubarmanager.cxx 
b/framework/source/uielement/menubarmanager.cxx
index c7efdb92053d..b5608310188c 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -563,7 +563,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
 const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
 bool bShowMenuImages = rSettings.GetUseImagesInMenus();
 bool bShowShortcuts  = m_bHasMenuBar || 
rSettings.GetContextMenuShortcuts();
-bool bHasDisabledEntries = SvtCommandOptions().HasEntries( 
SvtCommandOptions::CMDOPTION_DISABLED );
+bool bHasDisabledEntries = SvtCommandOptions().HasEntriesDisabled();
 
 SolarMutexGuard g;
 
@@ -657,7 +657,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu, bool )
 
 if ( bHasDisabledEntries )
 {
-if ( aCmdOptions.Lookup( 
SvtCommandOptions::CMDOPTION_DISABLED, aTargetURL.Path ))
+if ( aCmdOptions.LookupDisabled( aTargetURL.Path ))
 pMenu->HideItem( menuItemHandler->nItemId );
 }
 
@@ -840,7 +840,7 @@ bool MenuBarManager::MustBeHidden( PopupMenu* pPopupMenu, 
const Reference< XURLT
 aTargetURL.Complete = pPopupMenu->GetItemCommand( nId );
 rTransformer->parseStrict( aTargetURL );
 
-if ( aCmdOptions.Lookup( 

[Libreoffice-commits] core.git: framework/source offapi/com offapi/UnoApi_offapi.mk svtools/source

2023-05-25 Thread Miklos Vajna (via logerrit)
 framework/source/uiconfiguration/moduleuicfgsupplier.cxx  |6 -
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |4 
 framework/source/uiconfiguration/uiconfigurationmanager.cxx   |4 
 offapi/UnoApi_offapi.mk   |2 
 offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl   |2 
 offapi/com/sun/star/ui/UIConfigurationManager.idl |2 
 offapi/com/sun/star/ui/XModuleUIConfigurationManager2.idl |8 +
 offapi/com/sun/star/ui/XModuleUIConfigurationManager3.idl |   41 
--
 offapi/com/sun/star/ui/XUIConfigurationManager2.idl   |8 +
 offapi/com/sun/star/ui/XUIConfigurationManager3.idl   |   39 
-
 svtools/source/misc/acceleratorexecute.cxx|6 -
 11 files changed, 28 insertions(+), 94 deletions(-)

New commits:
commit 98a87f015800cd2e81e43732d7effe723b61e02a
Author: Miklos Vajna 
AuthorDate: Thu May 25 08:15:10 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 25 10:35:41 2023 +0200

[API CHANGE] remove XModuleUIConfigurationManager3 and 
XUIConfigurationManager3

The motivation was to not modify XModuleUIConfigurationManager /
XUIConfigurationManager, but as pointed out at

,
it may be fine to modify XModuleUIConfigurationManager2 and
XUIConfigurationManager2 instead of adding
XModuleUIConfigurationManager3 and XUIConfigurationManager3.

Indeed, searching for usage in ,
only the published interfaces are used, so let's fold
XModuleUIConfigurationManager3 into XModuleUIConfigurationManager2 and
XUIConfigurationManager3 into XUIConfigurationManager2.

This is a reasonable middle ground between 0 API change and breaking
known users of the public API.

Change-Id: I2dedee7e255f9dda9c9057961e6c829f83b2b709
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152254
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx 
b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
index f127c81d7fb9..cdbd647c3108 100644
--- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
+++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx
@@ -28,7 +28,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -80,7 +80,7 @@ public:
 private:
 virtual void disposing(std::unique_lock&) final override;
 
-typedef std::unordered_map< OUString, css::uno::Reference< 
css::ui::XModuleUIConfigurationManager3 > > ModuleToModuleCfgMgr;
+typedef std::unordered_map< OUString, css::uno::Reference< 
css::ui::XModuleUIConfigurationManager2 > > ModuleToModuleCfgMgr;
 
 //TODO_ASvoid impl_initStorages();
 
@@ -99,7 +99,7 @@ 
ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier( cons
 Reference< XNameAccess > xNameAccess( m_xModuleMgr, UNO_QUERY_THROW );
 const Sequence< OUString > aNameSeq   = 
xNameAccess->getElementNames();
 for ( const OUString& rName : aNameSeq )
-m_aModuleToModuleUICfgMgrMap.emplace( rName, Reference< 
XModuleUIConfigurationManager3 >() );
+m_aModuleToModuleUICfgMgrMap.emplace( rName, Reference< 
XModuleUIConfigurationManager2 >() );
 }
 catch(...)
 {
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx 
b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index dfa73e9bd39a..7427cd925956 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -30,7 +30,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -83,7 +83,7 @@ namespace {
 class ModuleUIConfigurationManager : public cppu::WeakImplHelper<
css::lang::XServiceInfo,
css::lang::XComponent,
-   css::ui::XModuleUIConfigurationManager3 
>
+   css::ui::XModuleUIConfigurationManager2 
>
 {
 public:
 ModuleUIConfigurationManager(
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx 
b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index c3e2bc7ca9e1..0140d17866d1 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -40,7 +40,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -73,7 +73,7 @@ namespace {
 
 class UIConfigurationManager :   public ::cppu::WeakImplHelper<
 css::lang::XServiceInfo  ,
-

[Libreoffice-commits] core.git: framework/source

2023-05-13 Thread Noel Grandin (via logerrit)
 framework/source/uiconfiguration/imagemanagerimpl.cxx |   11 ++-
 framework/source/uiconfiguration/imagemanagerimpl.hxx |5 -
 2 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 07af6b1c386b90e50c1aae0f7dd67af3173ffadb
Author: Noel Grandin 
AuthorDate: Fri May 12 22:17:27 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat May 13 14:56:16 2023 +0200

simplify

no need to use a map here, a set will do

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

diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx 
b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 0152387cc0b4..8bc322ff6667 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using ::com::sun::star::uno::Sequence;
 using ::com::sun::star::uno::XInterface;
@@ -627,7 +628,7 @@ Sequence< OUString > ImageManagerImpl::getAllImageNames( 
::sal_Int16 nImageType
 if ( m_bDisposed )
 throw DisposedException();
 
-ImageNameMap aImageCmdNameMap;
+std::unordered_set< OUString > aImageCmdNames;
 
 vcl::ImageType nIndex = implts_convertImageTypeToIndex( nImageType );
 
@@ -639,12 +640,12 @@ Sequence< OUString > ImageManagerImpl::getAllImageNames( 
::sal_Int16 nImageType
 const std::vector< OUString >& rGlobalImageNameVector = 
rGlobalImageList->getImageCommandNames();
 const sal_uInt32 nGlobalCount = rGlobalImageNameVector.size();
 for ( i = 0; i < nGlobalCount; i++ )
-aImageCmdNameMap.emplace( rGlobalImageNameVector[i], true );
+aImageCmdNames.insert( rGlobalImageNameVector[i] );
 
 const std::vector< OUString >& rModuleImageNameVector = 
implts_getDefaultImageList()->getImageCommandNames();
 const sal_uInt32 nModuleCount = rModuleImageNameVector.size();
 for ( i = 0; i < nModuleCount; i++ )
-aImageCmdNameMap.emplace( rModuleImageNameVector[i], true );
+aImageCmdNames.insert( rModuleImageNameVector[i] );
 }
 
 ImageList* pImageList = implts_getUserImageList(nIndex);
@@ -652,9 +653,9 @@ Sequence< OUString > ImageManagerImpl::getAllImageNames( 
::sal_Int16 nImageType
 pImageList->GetImageNames( rUserImageNames );
 const sal_uInt32 nUserCount = rUserImageNames.size();
 for ( i = 0; i < nUserCount; i++ )
-aImageCmdNameMap.emplace( rUserImageNames[i], true );
+aImageCmdNames.insert( rUserImageNames[i] );
 
-return comphelper::mapKeysToSequence( aImageCmdNameMap );
+return comphelper::containerToSequence( aImageCmdNames );
 }
 
 bool ImageManagerImpl::hasImage( ::sal_Int16 nImageType, const OUString& 
aCommandURL )
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.hxx 
b/framework/source/uiconfiguration/imagemanagerimpl.hxx
index f36c9fff74c7..4d48da1c2312 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.hxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.hxx
@@ -137,9 +137,6 @@ namespace framework
 
 void clear();
 
-typedef std::unordered_map< OUString,
-sal_Bool > ImageNameMap;
-
 enum NotifyOp
 {
 NotifyOp_Remove,
@@ -147,8 +144,6 @@ namespace framework
 NotifyOp_Replace
 };
 
-typedef ::std::vector< css::ui::ConfigurationEvent > 
ConfigEventNotifyContainer;
-
 void  implts_initialize();
 void  
implts_notifyContainerListener( const css::ui::ConfigurationEvent& aEvent, 
NotifyOp eOp );
 ImageList*implts_getUserImageList( 
vcl::ImageType nImageType );


[Libreoffice-commits] core.git: framework/source

2023-05-07 Thread Julien Nabet (via logerrit)
 framework/source/classes/taskcreator.cxx |   39 +++
 1 file changed, 9 insertions(+), 30 deletions(-)

New commits:
commit 4327ee4563d6458a578ebc8685ac7735f361168c
Author: Julien Nabet 
AuthorDate: Sun May 7 18:09:19 2023 +0200
Commit: Julien Nabet 
CommitDate: Sun May 7 19:22:00 2023 +0200

Simplify some initializations in framework/source/classes/taskcreator.cxx

Change-Id: I56480780903a39534c3bab8e79e3864fcba10470
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151473
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/framework/source/classes/taskcreator.cxx 
b/framework/source/classes/taskcreator.cxx
index 151322e1e601..1372dfeb7c1b 100644
--- a/framework/source/classes/taskcreator.cxx
+++ b/framework/source/classes/taskcreator.cxx
@@ -71,36 +71,15 @@ css::uno::Reference< css::frame::XFrame > 
TaskCreator::createTask( const OUStrin
 if ( ! xCreator.is())
 xCreator = css::frame::TaskCreator::create(m_xContext);
 
-css::uno::Sequence< css::uno::Any > lArgs(6);
-auto plArgs = lArgs.getArray();
-css::beans::NamedValue  aArg;
-
-aArg.Name= ARGUMENT_PARENTFRAME;
-aArg.Value <<= css::uno::Reference< css::frame::XFrame >( 
css::frame::Desktop::create( m_xContext ), css::uno::UNO_QUERY_THROW);
-plArgs[0]   <<= aArg;
-
-aArg.Name= ARGUMENT_CREATETOPWINDOW;
-aArg.Value <<= true;
-plArgs[1]   <<= aArg;
-
-aArg.Name= ARGUMENT_MAKEVISIBLE;
-aArg.Value <<= false;
-plArgs[2]   <<= aArg;
-
-aArg.Name= ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE;
-aArg.Value <<= true;
-plArgs[3]   <<= aArg;
-
-aArg.Name= ARGUMENT_FRAMENAME;
-aArg.Value <<= sName;
-plArgs[4]   <<= aArg;
-
-bool bHidden
-= rDescriptor.getUnpackedValueOrDefault("HiddenForConversion", false);
-aArg.Name = "HiddenForConversion";
-aArg.Value <<= bHidden;
-plArgs[5] <<= aArg;
-
+css::uno::Sequence< css::uno::Any > lArgs
+{
+css::uno::Any(css::beans::NamedValue(ARGUMENT_PARENTFRAME, 
css::uno::Any(css::uno::Reference< css::frame::XFrame >( 
css::frame::Desktop::create( m_xContext ), css::uno::UNO_QUERY_THROW ,
+css::uno::Any(css::beans::NamedValue(ARGUMENT_CREATETOPWINDOW, 
css::uno::Any(true))),
+css::uno::Any(css::beans::NamedValue(ARGUMENT_MAKEVISIBLE, 
css::uno::Any(false))),
+
css::uno::Any(css::beans::NamedValue(ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE, 
css::uno::Any(true))),
+css::uno::Any(css::beans::NamedValue(ARGUMENT_FRAMENAME, 
css::uno::Any(sName))),
+css::uno::Any(css::beans::NamedValue("HiddenForConversion", 
css::uno::Any(rDescriptor.getUnpackedValueOrDefault("HiddenForConversion", 
false
+};
 css::uno::Reference< css::frame::XFrame > 
xTask(xCreator->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW);
 return xTask;
 }


[Libreoffice-commits] core.git: framework/source

2023-05-07 Thread Julien Nabet (via logerrit)
 framework/source/services/taskcreatorsrv.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 12e0178d4a450386eac6864cb98bf006cef93b85
Author: Julien Nabet 
AuthorDate: Sun May 7 18:14:51 2023 +0200
Commit: Julien Nabet 
CommitDate: Sun May 7 18:15:29 2023 +0200

Typo: freature->feature

Change-Id: Ia30740ce0422b2fe5a85e288f18de68a1dca9b33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151474
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/framework/source/services/taskcreatorsrv.cxx 
b/framework/source/services/taskcreatorsrv.cxx
index 12e7c2c34846..0d09e30cf572 100644
--- a/framework/source/services/taskcreatorsrv.cxx
+++ b/framework/source/services/taskcreatorsrv.cxx
@@ -176,7 +176,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL 
TaskCreatorService::createI
 }
 css::uno::Reference< css::frame::XFrame2 > xFrame = 
implts_createFrame(xParentFrame, xContainerWindow, sRightName);
 
-// special freature:
+// special feature:
 // A special listener will restore pos/size states in case
 // a component was loaded into the frame first time.
 if (bSupportPersistentWindowState)
@@ -189,7 +189,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL 
TaskCreatorService::createI
 if (bTopLevelDocumentWindow)
 implts_establishDocModifyListener (xFrame);
 
-// special freature:
+// special feature:
 // A special listener will update title bar (text and icon)
 // if component of frame will be changed.
 if (bEnableTitleBarUpdate)


[Libreoffice-commits] core.git: framework/source svtools/source

2023-04-14 Thread Mike Kaganski (via logerrit)
 framework/source/uielement/buttontoolbarcontroller.cxx |   15 ---
 svtools/source/uno/statusbarcontroller.cxx |   15 ---
 svtools/source/uno/toolboxcontroller.cxx   |   15 ---
 3 files changed, 12 insertions(+), 33 deletions(-)

New commits:
commit 4578ded393f8e97ae781f63c9a1cf57669409635
Author: Mike Kaganski 
AuthorDate: Sat Apr 15 01:13:22 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Apr 15 03:05:26 2023 +0200

Simplify initialized check

The previous complexity did nothing useful; it allowed to have a single
unguarded boolean value check, for the cost of releasing and acquiring
the mutex again.

Change-Id: I426304e9ef6f27ca371544951bf3cc029887019e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150437
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/framework/source/uielement/buttontoolbarcontroller.cxx 
b/framework/source/uielement/buttontoolbarcontroller.cxx
index 4972b6da7667..d94e5b0ff25f 100644
--- a/framework/source/uielement/buttontoolbarcontroller.cxx
+++ b/framework/source/uielement/buttontoolbarcontroller.cxx
@@ -90,21 +90,14 @@ void SAL_CALL ButtonToolbarController::release() noexcept
 void SAL_CALL ButtonToolbarController::initialize(
 const css::uno::Sequence< css::uno::Any >& aArguments )
 {
-bool bInitialized( true );
-
-{
-SolarMutexGuard aSolarMutexGuard;
-
-if ( m_bDisposed )
-throw DisposedException();
+SolarMutexGuard aSolarMutexGuard;
 
-bInitialized = m_bInitialized;
-}
+if ( m_bDisposed )
+throw DisposedException();
 
-if ( bInitialized )
+if ( m_bInitialized )
 return;
 
-SolarMutexGuard aSolarMutexGuard;
 m_bInitialized = true;
 
 PropertyValue aPropValue;
diff --git a/svtools/source/uno/statusbarcontroller.cxx 
b/svtools/source/uno/statusbarcontroller.cxx
index 76387cbad0fd..6a8499a353c7 100644
--- a/svtools/source/uno/statusbarcontroller.cxx
+++ b/svtools/source/uno/statusbarcontroller.cxx
@@ -120,21 +120,14 @@ void SAL_CALL StatusbarController::release() noexcept
 
 void SAL_CALL StatusbarController::initialize( const Sequence< Any >& 
aArguments )
 {
-bool bInitialized( true );
-
-{
-SolarMutexGuard aSolarMutexGuard;
-
-if ( m_bDisposed )
-throw DisposedException();
+SolarMutexGuard aSolarMutexGuard;
 
-bInitialized = m_bInitialized;
-}
+if ( m_bDisposed )
+throw DisposedException();
 
-if ( bInitialized )
+if ( m_bInitialized )
 return;
 
-SolarMutexGuard aSolarMutexGuard;
 m_bInitialized = true;
 
 PropertyValue aPropValue;
diff --git a/svtools/source/uno/toolboxcontroller.cxx 
b/svtools/source/uno/toolboxcontroller.cxx
index 8fe4eb37c621..b592bb25b859 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -163,21 +163,14 @@ css::uno::Sequence 
ToolboxController::getTypes()
 
 void SAL_CALL ToolboxController::initialize( const Sequence< Any >& aArguments 
)
 {
-bool bInitialized( true );
-
-{
-SolarMutexGuard aSolarMutexGuard;
-
-if ( m_bDisposed )
-throw DisposedException();
+SolarMutexGuard aSolarMutexGuard;
 
-bInitialized = m_bInitialized;
-}
+if ( m_bDisposed )
+throw DisposedException();
 
-if ( bInitialized )
+if ( m_bInitialized )
 return;
 
-SolarMutexGuard aSolarMutexGuard;
 m_bInitialized = true;
 m_bSupportVisible = false;
 PropertyValue aPropValue;


[Libreoffice-commits] core.git: framework/source

2023-04-05 Thread Caolán McNamara (via logerrit)
 framework/source/loadenv/loadenv.cxx |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 7f9b3a0214e0c5d69e2becf2084fbf6e3defa090
Author: Caolán McNamara 
AuthorDate: Wed Apr 5 16:07:07 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed Apr 5 22:24:12 2023 +0200

Resolves: tdf#154308 if start center frame exists, use it as dialog parent

At least for the case the document is launched from the StartCenter, put
that StartCenter as the parent for any dialogs that may appear during
typedetection, this avoids such dialogs not getting associated with
the start center and going behind the dialog if the start center is
clicked while the dialog was appearing.

The start center is always recycled to become the next document if
it exists, so its window is the window the final document would
appear in if successful.

Change-Id: I75a92ff424aa0b9d5d6b808e2f7f1766a80fa50c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150058
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/framework/source/loadenv/loadenv.cxx 
b/framework/source/loadenv/loadenv.cxx
index 0d56944a3b17..0684c7b5fa69 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -322,7 +322,16 @@ void LoadEnv::initializeUIDefaults( const 
css::uno::Reference< css::uno::XCompon
 nUpdateMode = css::document::UpdateDocMode::ACCORDING_TO_CONFIG;
 try
 {
-xInteractionHandler.set( 
css::task::InteractionHandler::createWithParent( i_rxContext, nullptr ), 
css::uno::UNO_QUERY_THROW );
+// tdf#154308 At least for the case the document is launched from 
the StartCenter, put that StartCenter as the
+// parent for any dialogs that may appear during typedetection 
(once load starts a permanent frame will be set
+// anyway and used as dialog parent, which will be this one if the 
startcenter was running)
+css::uno::Reference xSupplier = 
css::frame::Desktop::create(i_rxContext);
+FrameListAnalyzer aTasksAnalyzer(xSupplier, 
css::uno::Reference(), 
FrameAnalyzerFlags::BackingComponent);
+css::uno::Reference 
xDialogParent(aTasksAnalyzer.m_xBackingComponent ?
+ 
aTasksAnalyzer.m_xBackingComponent->getContainerWindow() :
+ nullptr);
+
+xInteractionHandler.set( 
css::task::InteractionHandler::createWithParent(i_rxContext, xDialogParent), 
css::uno::UNO_QUERY_THROW );
 }
 catch(const css::uno::RuntimeException&) {throw;}
 catch(const css::uno::Exception&   ) {  }


[Libreoffice-commits] core.git: framework/source

2023-03-22 Thread Caolán McNamara (via logerrit)
 framework/source/accelerators/acceleratorconfiguration.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 936f2e6924e405433770b98f32a615508fd0670d
Author: Caolán McNamara 
AuthorDate: Wed Mar 22 16:59:23 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 22 19:36:13 2023 +

fix crash seen when experimenting with tdf#129547

Change-Id: I0b26a7f683f91d3307856f86c5a437fde1155451
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149331
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx 
b/framework/source/accelerators/acceleratorconfiguration.cxx
index 48e0d362026e..e07c826109a7 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -64,7 +64,10 @@ namespace framework
 static OUString lcl_getKeyString(const css::awt::KeyEvent& aKeyEvent)
 {
 const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of an 
identifier...
-OUStringBuffer 
sKeyBuffer((KeyMapping::get().mapCodeToIdentifier(aKeyEvent.KeyCode)).subView(nBeginIndex));
+OUString 
sKey(KeyMapping::get().mapCodeToIdentifier(aKeyEvent.KeyCode));
+if (sKey.getLength() < nBeginIndex) // dead key
+return OUString();
+OUStringBuffer sKeyBuffer(sKey.subView(nBeginIndex));
 
 if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == 
css::awt::KeyModifier::SHIFT )
 sKeyBuffer.append("_SHIFT");


[Libreoffice-commits] core.git: framework/source sc/inc sc/sdi sc/source

2023-03-21 Thread Maxim Monastirsky (via logerrit)
 framework/source/uielement/styletoolbarcontroller.cxx |3 
 sc/inc/globstr.hrc|1 
 sc/sdi/drawsh.sdi |   12 -
 sc/sdi/drtxtob.sdi|   12 -
 sc/sdi/tabvwsh.sdi|1 
 sc/source/ui/drawfunc/drawsh2.cxx |2 
 sc/source/ui/drawfunc/fusel.cxx   |8 +
 sc/source/ui/undo/undostyl.cxx|   16 +-
 sc/source/ui/view/tabview3.cxx|2 
 sc/source/ui/view/tabvwsha.cxx|  143 +-
 10 files changed, 164 insertions(+), 36 deletions(-)

New commits:
commit 1cfeb4bd8ce7f7727a81136bd3e2d6ebea976895
Author: Maxim Monastirsky 
AuthorDate: Fri Mar 17 14:28:36 2023 +0200
Commit: Maxim Monastirsky 
CommitDate: Tue Mar 21 23:10:39 2023 +

sc drawstyles: Handle style commands and undo

Change-Id: Ibd81f7aba9ef2efca89556c31cd9b09867419d0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149203
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/framework/source/uielement/styletoolbarcontroller.cxx 
b/framework/source/uielement/styletoolbarcontroller.cxx
index 31aed5336f10..3ff1e777eb6d 100644
--- a/framework/source/uielement/styletoolbarcontroller.cxx
+++ b/framework/source/uielement/styletoolbarcontroller.cxx
@@ -34,7 +34,8 @@ OUString MapFamilyToCommand( std::u16string_view rFamily )
 return ".uno:CharStyle";
 else if ( rFamily == u"PageStyles" )
 return ".uno:PageStyle";
-else if ( rFamily == u"FrameStyles" )
+else if ( rFamily == u"FrameStyles" ||
+  rFamily == u"GraphicStyles" )  // In sc
 return ".uno:FrameStyle";
 else if ( rFamily == u"NumberingStyles" )
 return ".uno:ListStyle";
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 88eca11e5a89..16fce3f32974 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -84,6 +84,7 @@
 #define STR_UNDO_EDITCELLSTYLE  NC_("STR_UNDO_EDITCELLSTYLE", 
"Edit Cell Style")
 #define STR_UNDO_APPLYPAGESTYLE NC_("STR_UNDO_APPLYPAGESTYLE", 
"Apply Page Style")
 #define STR_UNDO_EDITPAGESTYLE  NC_("STR_UNDO_EDITPAGESTYLE", 
"Edit Page Style")
+#define STR_UNDO_EDITGRAPHICSTYLE   
NC_("STR_UNDO_EDITGRAPHICSTYLE", "Edit Drawing Style")
 #define STR_UNDO_DETADDPRED NC_("STR_UNDO_DETADDPRED", 
"Trace Precedents")
 #define STR_UNDO_DETDELPRED NC_("STR_UNDO_DETDELPRED", 
"Remove Precedent")
 #define STR_UNDO_DETADDSUCC NC_("STR_UNDO_DETADDSUCC", 
"Trace Dependents")
diff --git a/sc/sdi/drawsh.sdi b/sc/sdi/drawsh.sdi
index ccd5d69605d4..13f1d6b150df 100644
--- a/sc/sdi/drawsh.sdi
+++ b/sc/sdi/drawsh.sdi
@@ -35,18 +35,6 @@ interface TableDraw
 SID_OPENDLG_EDIT_PRINTAREA  [ StateMethod = StateDisableItems; ]
 // others:
 SID_DRAW_CHART  [ StateMethod = StateDisableItems; ]
-SID_STYLE_FAMILY2   [ StateMethod = StateDisableItems; ]
-SID_STYLE_FAMILY4   [ StateMethod = StateDisableItems; ]
-SID_STYLE_APPLY [ StateMethod = StateDisableItems; ]
-SID_STYLE_WATERCAN  [ StateMethod = StateDisableItems; ]
-SID_STYLE_NEW_BY_EXAMPLE[ StateMethod = StateDisableItems; ]
-SID_STYLE_UPDATE_BY_EXAMPLE [ StateMethod = StateDisableItems; ]
-SID_STYLE_NEW   [ StateMethod = StateDisableItems; ]
-SID_STYLE_EDIT  [ StateMethod = StateDisableItems; ]
-SID_STYLE_DELETE[ StateMethod = StateDisableItems; ]
-SID_STYLE_HIDE  [ StateMethod = StateDisableItems; ]
-SID_STYLE_SHOW  [ StateMethod = StateDisableItems; ]
-
 
 SID_TEXT_STANDARD   [ ExecMethod = ExecDrawAttr; StateMethod = 
NoState; ]
 SID_DRAWTEXT_ATTR_DLG   [ ExecMethod = ExecDrawAttr; StateMethod = 
NoState; ]
diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi
index 5280430413bc..4670d216fba2 100644
--- a/sc/sdi/drtxtob.sdi
+++ b/sc/sdi/drtxtob.sdi
@@ -33,18 +33,6 @@ interface TableDrawText
 // others:
 SID_DRAW_CHART  [ StateMethod = StateDisableItems; ]
 SID_OPENDLG_FUNCTION[ StateMethod = StateDisableItems; ]
-SID_STYLE_FAMILY2   [ StateMethod = StateDisableItems; ]
-SID_STYLE_FAMILY4   [ StateMethod = StateDisableItems; ]
-SID_STYLE_APPLY [ StateMethod = StateDisableItems; ]
-SID_STYLE_WATERCAN  [ StateMethod = StateDisableItems; ]
-SID_STYLE_NEW_BY_EXAMPLE[ StateMethod = StateDisableItems; ]
-SID_STYLE_UPDATE_BY_EXAMPLE [ StateMethod = StateDisableItems; ]
-SID_STYLE_NEW   [ StateMethod = StateDisableItems; ]
-SID_STYLE_EDIT  [ StateMethod = StateDisableItems; ]
-SID_STYLE_DELETE[ StateMethod = StateDisableItems; ]
-

[Libreoffice-commits] core.git: framework/source

2023-03-20 Thread Juergen Funk (via logerrit)
 framework/source/accelerators/acceleratorcache.cxx |1 -
 framework/source/accelerators/acceleratorconfiguration.cxx |5 ++---
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 038f0b06a2d7d90e7ea19f2233f2892d9c78a08c
Author: Juergen Funk 
AuthorDate: Wed Feb 15 12:25:10 2023 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Mon Mar 20 11:37:40 2023 +

little optimization in accelerators

remove double calls

Change-Id: I4242067bdc0fdcc5184d555bb293f17d66965fb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147094
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/framework/source/accelerators/acceleratorcache.cxx 
b/framework/source/accelerators/acceleratorcache.cxx
index 0163654d4bf7..c0b819a2a9e8 100644
--- a/framework/source/accelerators/acceleratorcache.cxx
+++ b/framework/source/accelerators/acceleratorcache.cxx
@@ -116,7 +116,6 @@ void AcceleratorCache::removeCommand(const OUString& 
sCommand)
 {
 removeKey(lKey);
 }
-m_lCommand2Keys.erase(sCommand);
 }
 
 } // namespace framework
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx 
b/framework/source/accelerators/acceleratorconfiguration.cxx
index 3507314a9a6e..48e0d362026e 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -614,10 +614,9 @@ void SAL_CALL 
XCUBasedAcceleratorConfiguration::removeKeyEvent(const css::awt::K
 
 if (rPrimaryCache.hasKey(aKeyEvent))
 {
-OUString sDelCommand = rPrimaryCache.getCommandByKey(aKeyEvent);
-if (!sDelCommand.isEmpty())
+OUString sOriginalCommand = rPrimaryCache.getCommandByKey(aKeyEvent);
+if (!sOriginalCommand.isEmpty())
 {
-OUString sOriginalCommand = 
rPrimaryCache.getCommandByKey(aKeyEvent);
 if (rSecondaryCache.hasCommand(sOriginalCommand))
 {
 AcceleratorCache::TKeyList lSecondaryKeys = 
rSecondaryCache.getKeysByCommand(sOriginalCommand);


[Libreoffice-commits] core.git: framework/source

2023-02-27 Thread Noel Grandin (via logerrit)
 framework/source/uielement/controlmenucontroller.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 394dcb830c9d7bfe3a454589847be0fd5024dc86
Author: Noel Grandin 
AuthorDate: Mon Feb 27 16:42:41 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Feb 28 06:27:57 2023 +

tdf#153857 Writer hangs right-clicking on form field

regression from
commit 5032262fccd0ef7f274323ae481b3230ffd42d3a
Author: Noel Grandin 
Date:   Tue Feb 21 15:05:37 2023 +0200
BaseMutex->std::mutex in PopupMenuControllerBase

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

diff --git a/framework/source/uielement/controlmenucontroller.cxx 
b/framework/source/uielement/controlmenucontroller.cxx
index b990e725d507..afbf3ec9258d 100644
--- a/framework/source/uielement/controlmenucontroller.cxx
+++ b/framework/source/uielement/controlmenucontroller.cxx
@@ -302,8 +302,10 @@ void SAL_CALL ControlMenuController::updatePopupMenu()
 Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( 
aTargetURL, OUString(), 0 );
 if ( xDispatch.is() )
 {
+aLock.unlock(); // the addStatusListener will call back into 
::statusChanged
 xDispatch->addStatusListener( static_cast< XStatusListener* 
>(this), aTargetURL );
 xDispatch->removeStatusListener( static_cast< XStatusListener* 
>(this), aTargetURL );
+aLock.lock();
 m_aURLToDispatchMap.emplace( aTargetURL.Complete, xDispatch );
 }
 }


[Libreoffice-commits] core.git: framework/source

2023-02-21 Thread Noel Grandin (via logerrit)
 framework/source/jobs/jobexecutor.cxx |   94 --
 1 file changed, 46 insertions(+), 48 deletions(-)

New commits:
commit d56b6e0904c276e9a9ea63eb226e6324422c21c8
Author: Noel Grandin 
AuthorDate: Mon Feb 20 19:59:53 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Feb 21 09:46:26 2023 +

BaseMutex->std::mutex in JobExecutor

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

diff --git a/framework/source/jobs/jobexecutor.cxx 
b/framework/source/jobs/jobexecutor.cxx
index f5776fdf283d..158351f19c4e 100644
--- a/framework/source/jobs/jobexecutor.cxx
+++ b/framework/source/jobs/jobexecutor.cxx
@@ -31,8 +31,7 @@
 #include 
 #include 
 
-#include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -44,7 +43,7 @@ using namespace framework;
 
 namespace {
 
-typedef cppu::WeakComponentImplHelper<
+typedef comphelper::WeakComponentImplHelper<
   css::lang::XServiceInfo
 , css::task::XJobExecutor
 , css::container::XContainerListener // => lang.XEventListener
@@ -57,7 +56,7 @@ typedef cppu::WeakComponentImplHelper<
 inside the configuration and execute it. Of course it controls the
 lifetime of such jobs too.
  */
-class JobExecutor : private cppu::BaseMutex, public Base
+class JobExecutor : public Base
 {
 private:
 
@@ -73,7 +72,7 @@ private:
 /** helper to allow us listen to the configuration without a cyclic 
dependency */
 css::uno::Reference m_xConfigListener;
 
-virtual void SAL_CALL disposing() final override;
+virtual void disposing(std::unique_lock& rGuard) final 
override;
 
 public:
 
@@ -121,8 +120,7 @@ public:
 reference to the uno service manager
  */
 JobExecutor::JobExecutor( /*IN*/ const css::uno::Reference< 
css::uno::XComponentContext >& xContext )
-: Base(m_aMutex)
-, m_xContext  (xContext
)
+: m_xContext  (xContext
)
 , m_aConfig   (xContext, "/org.openoffice.Office.Jobs/Events")
 {
 }
@@ -162,21 +160,19 @@ void JobExecutor::initListeners()
 
 JobExecutor::~JobExecutor()
 {
-disposing();
+std::unique_lock g(m_aMutex);
+disposing(g);
 }
 
-void JobExecutor::disposing() {
+void JobExecutor::disposing(std::unique_lock& /*rGuard*/) {
 css::uno::Reference notifier;
 css::uno::Reference listener;
-{
-osl::MutexGuard g(rBHelper.rMutex);
-if (m_aConfig.getMode() != ConfigAccess::E_CLOSED) {
-notifier.set(m_aConfig.cfg(), css::uno::UNO_QUERY);
-listener = m_xConfigListener;
-m_aConfig.close();
-}
-m_xConfigListener.clear();
+if (m_aConfig.getMode() != ConfigAccess::E_CLOSED) {
+notifier.set(m_aConfig.cfg(), css::uno::UNO_QUERY);
+listener = m_xConfigListener;
+m_aConfig.close();
 }
+m_xConfigListener.clear();
 if (notifier.is()) {
 notifier->removeContainerListener(listener);
 }
@@ -195,14 +191,15 @@ void SAL_CALL JobExecutor::trigger( const OUString& 
sEvent )
 {
 SAL_INFO( "fwk", "JobExecutor::trigger()");
 
-/* SAFE */ {
-osl::MutexGuard g(rBHelper.rMutex);
+/* SAFE */
+{
+std::unique_lock g(m_aMutex);
 
-// Optimization!
-// Check if the given event name exist inside configuration and reject 
wrong requests.
-// This optimization suppress using of the cfg api for getting event and 
job descriptions ...
-if (std::find(m_lEvents.begin(), m_lEvents.end(), sEvent) == 
m_lEvents.end())
-return;
+// Optimization!
+// Check if the given event name exist inside configuration and reject 
wrong requests.
+// This optimization suppress using of the cfg api for getting event 
and job descriptions ...
+if (std::find(m_lEvents.begin(), m_lEvents.end(), sEvent) == 
m_lEvents.end())
+return;
 
 } /* SAFE */
 
@@ -252,32 +249,33 @@ void SAL_CALL JobExecutor::notifyEvent( const 
css::document::EventObject& aEvent
 catch( const css::uno::Exception& )
 {}
 
-/* SAFE */ {
-osl::MutexGuard g(rBHelper.rMutex);
-
-// Special feature: If the events "OnNew" or "OnLoad" occurs - we generate 
our own event "onDocumentOpened".
-if (
-(aEvent.EventName == "OnNew") ||
-(aEvent.EventName == "OnLoad")
-   )
+/* SAFE */
 {
-if (std::find(m_lEvents.begin(), m_lEvents.end(), 
EVENT_ON_DOCUMENT_OPENED) != m_lEvents.end())
-JobData::appendEnabledJobsForEvent(m_xContext, 
EVENT_ON_DOCUMENT_OPENED, lJobs);
-}
+std::unique_lock g(m_aMutex);
 
-// Special feature: If the events "OnCreate" or "OnLoadFinished" occurs - 
we generate our own event "onDocumentAdded".
-if (
-

[Libreoffice-commits] core.git: framework/source

2023-02-16 Thread Noel Grandin (via logerrit)
 framework/source/fwe/helper/undomanagerhelper.cxx |   92 +++---
 1 file changed, 63 insertions(+), 29 deletions(-)

New commits:
commit 130602ad8cdb45235dd99c60876fc8a091b9bc89
Author: Noel Grandin 
AuthorDate: Thu Feb 16 18:55:25 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Feb 17 07:58:15 2023 +

osl::Mutex->std::mutex in UndoManagerHelper_Impl

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

diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx 
b/framework/source/fwe/helper/undomanagerhelper.cxx
index eef1f9f452b4..3a2fdd6c066b 100644
--- a/framework/source/fwe/helper/undomanagerhelper.cxx
+++ b/framework/source/fwe/helper/undomanagerhelper.cxx
@@ -29,7 +29,7 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -202,13 +202,13 @@ namespace framework
 private:
 ::osl::Mutexm_aMutex;
 /// Use different mutex for listeners to prevent ABBA deadlocks
-::osl::Mutexm_aListenerMutex;
+std::mutex  m_aListenerMutex;
 std::mutex  m_aQueueMutex;
 boolm_bAPIActionRunning;
 boolm_bProcessingEvents;
 sal_Int32   m_nLockCount;
-::comphelper::OInterfaceContainerHelper3   
m_aUndoListeners;
-::comphelper::OInterfaceContainerHelper3   
m_aModifyListeners;
+::comphelper::OInterfaceContainerHelper4   
m_aUndoListeners;
+::comphelper::OInterfaceContainerHelper4   
m_aModifyListeners;
 IUndoManagerImplementation& m_rUndoManagerImplementation;
 ::std::stack< bool >m_aContextVisibilities;
 #if OSL_DEBUG_LEVEL > 0
@@ -226,8 +226,6 @@ namespace framework
 :m_bAPIActionRunning( false )
 ,m_bProcessingEvents( false )
 ,m_nLockCount( 0 )
-,m_aUndoListeners( m_aListenerMutex )
-,m_aModifyListeners( m_aListenerMutex )
 ,m_rUndoManagerImplementation( i_undoManagerImpl )
 {
 getUndoManager().AddUndoListener( *this );
@@ -275,22 +273,26 @@ namespace framework
 
 void addUndoManagerListener( const Reference< XUndoManagerListener >& 
i_listener )
 {
-m_aUndoListeners.addInterface( i_listener );
+std::unique_lock g(m_aListenerMutex);
+m_aUndoListeners.addInterface( g, i_listener );
 }
 
 void removeUndoManagerListener( const Reference< XUndoManagerListener 
>& i_listener )
 {
-m_aUndoListeners.removeInterface( i_listener );
+std::unique_lock g(m_aListenerMutex);
+m_aUndoListeners.removeInterface( g, i_listener );
 }
 
 void addModifyListener( const Reference< XModifyListener >& i_listener 
)
 {
-m_aModifyListeners.addInterface( i_listener );
+std::unique_lock g(m_aListenerMutex);
+m_aModifyListeners.addInterface( g, i_listener );
 }
 
 void removeModifyListener( const Reference< XModifyListener >& 
i_listener )
 {
-m_aModifyListeners.removeInterface( i_listener );
+std::unique_lock g(m_aListenerMutex);
+m_aModifyListeners.removeInterface( g, i_listener );
 }
 
 UndoManagerEvent
@@ -320,9 +322,11 @@ namespace framework
 {
 EventObject aEvent;
 aEvent.Source = getXUndoManager();
-m_aUndoListeners.disposeAndClear( aEvent );
-m_aModifyListeners.disposeAndClear( aEvent );
-
+{
+std::unique_lock g(m_aListenerMutex);
+m_aUndoListeners.disposeAndClear( g, aEvent );
+m_aModifyListeners.disposeAndClear( g, aEvent );
+}
 ::osl::MutexGuard aGuard( m_aMutex );
 
 getUndoManager().RemoveUndoListener( *this );
@@ -340,7 +344,8 @@ namespace framework
 void UndoManagerHelper_Impl::impl_notifyModified()
 {
 const EventObject aEvent( getXUndoManager() );
-m_aModifyListeners.notifyEach( ::modified, aEvent );
+std::unique_lock g(m_aListenerMutex);
+m_aModifyListeners.notifyEach( g, ::modified, aEvent );
 }
 
 void UndoManagerHelper_Impl::notify( OUString const& i_title,
@@ -354,7 +359,10 @@ namespace framework
 // Fixing this properly would require outsourcing all the 
notifications into an own thread - which might lead
 // to problems of its own, since clients might expect synchronous 
notifications.
 
-m_aUndoListeners.notifyEach( i_notificationMethod, aEvent );
+{
+std::unique_lock g(m_aListenerMutex);
+m_aUndoListeners.notifyEach( g, i_notificationMethod, aEvent );
+}
 

[Libreoffice-commits] core.git: framework/source

2023-02-15 Thread Caolán McNamara (via logerrit)
 framework/source/dispatch/closedispatcher.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 23c77c80d80b46911344f2dd440f98848a1bec50
Author: Caolán McNamara 
AuthorDate: Wed Feb 15 11:21:26 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Feb 15 15:27:50 2023 +

Resolves: tdf#30920 don't terminate app on closing license frame

when there is a backing window (start center) also open

Change-Id: I64051467ac90ee321b7fc54cb96775c5a1e8d3a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147078
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/framework/source/dispatch/closedispatcher.cxx 
b/framework/source/dispatch/closedispatcher.cxx
index a6ff39d459c3..a30aab0c447f 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -331,8 +331,11 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, 
LinkParamNone*, void)
 
 // c1) there is as minimum 1 frame open, which is visible and 
contains a document
 // different from our one. And it's not the help!
+// (tdf#30920 consider that closing a frame which is not the 
backing window (start center) while there is
+//  another frame that is the backing window open only closes 
the frame, and not terminate the app, so
+//  closing the license frame doesn't terminate the app if 
launched from the start center)
 // => close our frame only - nothing else.
-if (!aCheck2.m_lOtherVisibleFrames.empty())
+if (!aCheck2.m_lOtherVisibleFrames.empty() || 
(!aCheck2.m_bReferenceIsBacking && aCheck2.m_xBackingComponent.is()))
 bCloseFrame = true;
 else
 


[Libreoffice-commits] core.git: framework/source

2023-02-05 Thread Greg Kelesidis (via logerrit)
 framework/source/uiconfiguration/ImageList.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 1e2f6e7b27fafd6c579dfb09ccd2012151b4ab7e
Author: Greg Kelesidis 
AuthorDate: Sat Feb 4 19:27:25 2023 +0200
Commit: Ilmari Lauhakangas 
CommitDate: Sun Feb 5 09:26:21 2023 +

tdf#143148 Use pragma once instead of include guards

Change-Id: Iaeabe4e21ffe407684a57e1988a836e7cf85b2a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146560
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/framework/source/uiconfiguration/ImageList.hxx 
b/framework/source/uiconfiguration/ImageList.hxx
index 0951b8369d2a..edd0789ed146 100644
--- a/framework/source/uiconfiguration/ImageList.hxx
+++ b/framework/source/uiconfiguration/ImageList.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef FRAMEWORK_SOURCE_UICONFIGURATION_IMAGELIST_HXX
-#define FRAMEWORK_SOURCE_UICONFIGURATION_IMAGELIST_HXX
+#pragma once
 
 #include 
 
@@ -73,6 +72,4 @@ private:
 void ImplRemoveImage( sal_uInt16 nPos );
 };
 
-#endif // INCLUDED_VCL_IMAGE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: framework/source officecfg/registry

2023-02-03 Thread Andreas Heinisch (via logerrit)
 framework/source/uielement/recentfilesmenucontroller.cxx   |   53 -
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |7 +
 2 files changed, 57 insertions(+), 3 deletions(-)

New commits:
commit 6836776fa295293c114c267bca38d18603993a54
Author: Andreas Heinisch 
AuthorDate: Wed Feb 1 15:09:28 2023 +0100
Commit: Andreas Heinisch 
CommitDate: Fri Feb 3 09:46:01 2023 +

tdf#56696 - Sort recent document list according to current LibO module

Change-Id: I246dc9538e011b8981bea04963995559d2b43cc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146456
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx 
b/framework/source/uielement/recentfilesmenucontroller.cxx
index fe7de1c3d907..ef95d300058b 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -20,6 +20,8 @@
 #include 
 #include 
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +36,8 @@
 #include 
 #include 
 
+#include 
+
 using namespace css;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
@@ -42,6 +46,7 @@ using namespace com::sun::star::beans;
 using namespace com::sun::star::util;
 
 #define MAX_MENU_ITEMS  99
+#define MAX_MENU_ITEMS_PER_MODULE  5
 
 namespace {
 
@@ -154,12 +159,50 @@ void RecentFilesMenuController::fillPopupMenu( Reference< 
css::awt::XPopupMenu >
 int nPickListMenuItems = std::min( aHistoryList.size(), 
MAX_MENU_ITEMS );
 m_aRecentFilesItems.clear();
 
+// tdf#56696 - retrieve expert configuration option if the recent document
+// list should show only files that can be handled by the current module
+const bool bShowCurrentModuleOnly
+= officecfg::Office::Common::History::ShowCurrentModuleOnly::get();
+
+size_t nItemPosModule = 0;
 if (( nPickListMenuItems > 0 ) && !m_bDisabled )
 {
-for ( int i = 0; i < nPickListMenuItems; i++ )
+size_t nItemPos = 0;
+if (m_aModuleName != "com.sun.star.frame.StartModule")
+{
+::comphelper::MimeConfigurationHelper aConfigHelper(
+comphelper::getProcessComponentContext());
+// Show the first MAX_MENU_ITEMS_PER_MODULE items of the current 
module
+// on top of the recent document list.
+for (int i = 0; i < nPickListMenuItems; i++)
+{
+const SvtHistoryOptions::HistoryItem& rPickListEntry = 
aHistoryList[i];
+const std::pair 
aPickListEntry(rPickListEntry.sURL,
+   
rPickListEntry.isReadOnly);
+if ((nItemPosModule < MAX_MENU_ITEMS_PER_MODULE || 
bShowCurrentModuleOnly)
+&& 
aConfigHelper.GetDocServiceNameFromFilter(rPickListEntry.sFilter)
+   == m_aModuleName)
+{
+m_aRecentFilesItems.insert(m_aRecentFilesItems.begin() + 
nItemPosModule,
+   aPickListEntry);
+nItemPos++;
+nItemPosModule++;
+}
+else if (!bShowCurrentModuleOnly)
+{
+m_aRecentFilesItems.insert(m_aRecentFilesItems.begin() + 
nItemPos,
+   aPickListEntry);
+nItemPos++;
+}
+}
+}
+else
 {
-const SvtHistoryOptions::HistoryItem& rPickListEntry = 
aHistoryList[i];
-m_aRecentFilesItems.emplace_back(rPickListEntry.sURL, 
rPickListEntry.isReadOnly);
+for (int i = 0; i < nPickListMenuItems; i++)
+{
+const SvtHistoryOptions::HistoryItem& rPickListEntry = 
aHistoryList[i];
+m_aRecentFilesItems.emplace_back(rPickListEntry.sURL, 
rPickListEntry.isReadOnly);
+}
 }
 }
 
@@ -220,6 +263,10 @@ void RecentFilesMenuController::fillPopupMenu( Reference< 
css::awt::XPopupMenu >
 
 rPopupMenu->setTipHelpText(sal_uInt16(i + 1), aTipHelpText);
 rPopupMenu->setCommand(sal_uInt16(i + 1), aURLString);
+
+// Show a separator after the MAX_MENU_ITEMS_PER_MODULE recent 
document items
+if (nItemPosModule > 0 && i == nItemPosModule - 1)
+rPopupMenu->insertSeparator(-1);
 }
 
 rPopupMenu->insertSeparator(-1);
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index f333657151f5..ced635fa4200 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2233,6 +2233,13 @@
 
 true
   
+  
+
+  The entry specifies if the recent document list should 

[Libreoffice-commits] core.git: framework/source

2023-02-01 Thread Noel Grandin (via logerrit)
 framework/source/uiconfiguration/windowstateconfiguration.cxx |   27 +-
 1 file changed, 14 insertions(+), 13 deletions(-)

New commits:
commit e8d2a9ffc0d96418dbec94cdbba14aac1c09adf5
Author: Noel Grandin 
AuthorDate: Wed Feb 1 19:18:45 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Feb 2 06:59:13 2023 +

osl::Mutex->std::mutex in ConfigurationAccess_WindowState

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

diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx 
b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index eb7e72affabe..97a1402c9f2e 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -45,6 +45,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -203,7 +204,7 @@ class ConfigurationAccess_WindowState : public  
::cppu::WeakImplHelper< XNameCon
 typedef std::unordered_map< OUString,
 WindowStateInfo > ResourceURLToInfoCache;
 
-osl::Mutexm_aMutex;
+std::mutexm_aMutex;
 OUString  m_aConfigWindowAccess;
 Reference< XMultiServiceFactory > m_xConfigProvider;
 Reference< XNameAccess >  m_xConfigAccess;
@@ -230,7 +231,7 @@ 
ConfigurationAccess_WindowState::ConfigurationAccess_WindowState( std::u16string
 ConfigurationAccess_WindowState::~ConfigurationAccess_WindowState()
 {
 // SAFE
-osl::MutexGuard g(m_aMutex);
+std::unique_lock g(m_aMutex);
 Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
 if ( xContainer.is() )
 xContainer->removeContainerListener(m_xConfigListener);
@@ -240,7 +241,7 @@ 
ConfigurationAccess_WindowState::~ConfigurationAccess_WindowState()
 Any SAL_CALL ConfigurationAccess_WindowState::getByName( const OUString& 
rResourceURL )
 {
 // SAFE
-osl::MutexGuard g(m_aMutex);
+std::unique_lock g(m_aMutex);
 
 ResourceURLToInfoCache::const_iterator pIter = 
m_aResourceURLToInfoCache.find( rResourceURL );
 if ( pIter != m_aResourceURLToInfoCache.end() )
@@ -257,7 +258,7 @@ Any SAL_CALL ConfigurationAccess_WindowState::getByName( 
const OUString& rResour
 Sequence< OUString > SAL_CALL 
ConfigurationAccess_WindowState::getElementNames()
 {
 // SAFE
-osl::MutexGuard g(m_aMutex);
+std::unique_lock g(m_aMutex);
 
 if ( !m_bConfigAccessInitialized )
 {
@@ -274,7 +275,7 @@ Sequence< OUString > SAL_CALL 
ConfigurationAccess_WindowState::getElementNames()
 sal_Bool SAL_CALL ConfigurationAccess_WindowState::hasByName( const OUString& 
rResourceURL )
 {
 // SAFE
-osl::MutexGuard g(m_aMutex);
+std::unique_lock g(m_aMutex);
 
 ResourceURLToInfoCache::const_iterator pIter = 
m_aResourceURLToInfoCache.find( rResourceURL );
 if ( pIter != m_aResourceURLToInfoCache.end() )
@@ -298,7 +299,7 @@ Type SAL_CALL 
ConfigurationAccess_WindowState::getElementType()
 sal_Bool SAL_CALL ConfigurationAccess_WindowState::hasElements()
 {
 // SAFE
-osl::MutexGuard g(m_aMutex);
+std::unique_lock g(m_aMutex);
 
 if ( !m_bConfigAccessInitialized )
 {
@@ -316,7 +317,7 @@ sal_Bool SAL_CALL 
ConfigurationAccess_WindowState::hasElements()
 void SAL_CALL ConfigurationAccess_WindowState::removeByName( const OUString& 
rResourceURL )
 {
 // SAFE
-osl::ClearableMutexGuard g(m_aMutex);
+std::unique_lock g(m_aMutex);
 
 ResourceURLToInfoCache::iterator pIter = m_aResourceURLToInfoCache.find( 
rResourceURL );
 if ( pIter != m_aResourceURLToInfoCache.end() )
@@ -334,7 +335,7 @@ void SAL_CALL 
ConfigurationAccess_WindowState::removeByName( const OUString& rRe
 Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY 
);
 if ( xNameContainer.is() )
 {
-g.clear();
+g.unlock();
 
 xNameContainer->removeByName( rResourceURL );
 Reference< XChangesBatch > xFlush( m_xConfigAccess, UNO_QUERY );
@@ -350,7 +351,7 @@ void SAL_CALL 
ConfigurationAccess_WindowState::removeByName( const OUString& rRe
 void SAL_CALL ConfigurationAccess_WindowState::insertByName( const OUString& 
rResourceURL, const css::uno::Any& aPropertySet )
 {
 // SAFE
-osl::ClearableMutexGuard g(m_aMutex);
+std::unique_lock g(m_aMutex);
 
 Sequence< PropertyValue > aPropSet;
 if ( !(aPropertySet >>= aPropSet) )
@@ -383,7 +384,7 @@ void SAL_CALL 
ConfigurationAccess_WindowState::insertByName( const OUString& rRe
 return;
 
 Reference< XSingleServiceFactory > xFactory( m_xConfigAccess, UNO_QUERY );
-g.clear();
+g.unlock();
 
 try
 {
@@ -408,7 +409,7 @@ void SAL_CALL 
ConfigurationAccess_WindowState::insertByName( const OUString& rRe
 void 

[Libreoffice-commits] core.git: framework/source

2023-01-30 Thread Stephan Bergmann (via logerrit)
 framework/source/fwe/helper/undomanagerhelper.cxx |   26 +++---
 1 file changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 061d3bc359b6b94a874c10e96ad9cc8189494e21
Author: Stephan Bergmann 
AuthorDate: Mon Jan 30 21:45:46 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Jan 31 07:54:47 2023 +

Fix locking order

JunitTest_sfx2_complex occasionally deadlocked when the main thread at

> framework::UndoManagerHelper::isUndoPossible
> chart::UndoCommandDispatch::fireStatusEvent
> chart::CommandDispatch::addStatusListener
> svt::ToolboxController::bindListener
> framework::ToolBarManager::UpdateControllers
> framework::ToolBarManager::AsyncUpdateControllersHdl
> Scheduler::CallbackTaskScheduling
> SalTimer::CallCallback
> SvpSalInstance::CheckTimeout
> SvpSalInstance::ImplYield
> SvpSalInstance::DoYield
> ImplYield
> Application::Execute
> desktop::Desktop::Main

has acquired the SolarMutex in
framework::ToolBarManager::AsyncUpdateControllersHdl and is now trying to
acquire framework::UndoManagerHelper_Impl::m_aMutex, while a 
cppu_threadpool at

> framework::UndoManagerHelper_Impl::impl_clear
> std::function::operator()
> framework::(anonymous namespace)::UndoManagerRequest::execute
> framework::UndoManagerHelper_Impl::impl_processRequest
> framework::UndoManagerHelper_Impl::clear
> framework::UndoManagerHelper::clear
> gcc3::callVirtualMethod

first acquired framework::UndoManagerHelper_Impl::m_aMutex and then tries to
acquire the SolarMutex.  That additional acquiring of the SolarMutex had 
been
added to framework::UndoManagerHelper_Impl::impl_clear in
8611f6e259b807b4f19c8dc0eab86ca648891ce3 "ref-count SdrObject".

Change-Id: Ifcb8765b29b65f773be6bbe54092346c5ae3a33b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146371
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx 
b/framework/source/fwe/helper/undomanagerhelper.cxx
index 27780dc2719e..eef1f9f452b4 100644
--- a/framework/source/fwe/helper/undomanagerhelper.cxx
+++ b/framework/source/fwe/helper/undomanagerhelper.cxx
@@ -681,22 +681,22 @@ namespace framework
 
 void UndoManagerHelper_Impl::impl_clear()
 {
-// SYNCHRONIZED --->
-::osl::ClearableMutexGuard aGuard( m_aMutex );
+EventObject aEvent;
+{
+SolarMutexGuard aGuard;
+::osl::MutexGuard aGuard2( m_aMutex );
 
-SfxUndoManager& rUndoManager = getUndoManager();
-if ( rUndoManager.IsInListAction() )
-throw UndoContextNotClosedException( OUString(), getXUndoManager() 
);
+SfxUndoManager& rUndoManager = getUndoManager();
+if ( rUndoManager.IsInListAction() )
+throw UndoContextNotClosedException( OUString(), 
getXUndoManager() );
 
-{
-::comphelper::FlagGuard aNotificationGuard( m_bAPIActionRunning );
-SolarMutexGuard aGuard2;
-rUndoManager.Clear();
-}
+{
+::comphelper::FlagGuard aNotificationGuard( 
m_bAPIActionRunning );
+rUndoManager.Clear();
+}
 
-const EventObject aEvent( getXUndoManager() );
-aGuard.clear();
-// <--- SYNCHRONIZED
+aEvent = EventObject( getXUndoManager() );
+}
 
 m_aUndoListeners.notifyEach( ::allActionsCleared, 
aEvent );
 impl_notifyModified();


[Libreoffice-commits] core.git: framework/source

2023-01-27 Thread Stephan Bergmann (via logerrit)
 framework/source/jobs/jobexecutor.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5d4adec9e0c3edca15867aac19ff6d2c0983959f
Author: Stephan Bergmann 
AuthorDate: Fri Jan 27 08:40:02 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Jan 27 12:51:32 2023 +

Move a UNO service creation outside a guarded area

When trying to address a deadlock issue involving 
NotifySingleListenerIgnoreRE
(sfx2/source/doc/sfxbasemodel.cxx), I ran into another deadlock between a
cppu_threadpool thread at

> comphelper::SolarMutex::acquire
> osl::ClearableGuard::ClearableGuard
> SolarMutexClearableGuard::SolarMutexClearableGuard
> SfxModelGuard::SfxModelGuard
> SfxBaseModel::getIdentifier
> (anonymous namespace)::ModuleManager::implts_identify
> (anonymous namespace)::ModuleManager::identify
> (anonymous namespace)::JobExecutor::notifyEvent
> (anonymous namespace)::SfxGlobalEvents_Impl::implts_notifyJobExecution
> (anonymous namespace)::SfxGlobalEvents_Impl::documentEventOccured
> (anonymous 
namespace)::NotifySingleListenerIgnoreRE::operator()
> 
comphelper::OInterfaceContainerHelper2::forEach >
> SfxBaseModel::postEvent_Impl
> SfxBaseModel::Notify
> ScModelObj::Notify
> SfxBroadcaster::Broadcast
> SfxApplication::NotifyEvent
> SfxObjectShell::SetInitialized_Impl
> SfxObjectShell::FinishedLoading
> ScDocShell::Load
> SfxObjectShell::LoadOwnFormat
> SfxObjectShell::DoLoad
> SfxBaseModel::load
> (anonymous namespace)::SfxFrameLoader_Impl::load
> framework::LoadEnv::impl_loadContent
> framework::LoadEnv::start
> framework::LoadEnv::startLoading
> framework::LoadEnv::loadComponentFromURL
> framework::Desktop::loadComponentFromURL
> gcc3::callVirtualMethod

and the main thread at

> osl::Mutex::acquire
> osl::Guard
> (anonymous namespace)::JobExecutor::trigger
> desktop::Desktop::AsyncInitFirstRun
> desktop::Desktop::LinkStubAsyncInitFirstRun
> Link::Call
> Timer::Invoke
> Scheduler::CallbackTaskScheduling
> SalTimer::CallCallback
> SvpSalInstance::CheckTimeout
> SvpSalInstance::ImplYield
> SvpSalInstance::DoYield
> ImplYield
> Application::Yield
> Application::Execute
> desktop::Desktop::Main

which this commit fixes.  (I commit this independently of any commit 
addressing
that other deadlock, as that involves some SolarMutexReleaser hackery and 
might
eventually get reverted, while this change here looks correct and worthwhile
even on its own.)

Change-Id: I2530569c6661e440126db04fa19a655d52e20094
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146242
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/framework/source/jobs/jobexecutor.cxx 
b/framework/source/jobs/jobexecutor.cxx
index 5578b877b028..65c7dc25ded4 100644
--- a/framework/source/jobs/jobexecutor.cxx
+++ b/framework/source/jobs/jobexecutor.cxx
@@ -247,9 +247,6 @@ void SAL_CALL JobExecutor::notifyEvent( const 
css::document::EventObject& aEvent
 OUString aModuleIdentifier;
 ::std::vector< JobData::TJob2DocEventBinding > lJobs;
 
-/* SAFE */ {
-osl::MutexGuard g(rBHelper.rMutex);
-
 // Optimization!
 // Check if the given event name exist inside configuration and reject 
wrong requests.
 // This optimization suppress using of the cfg api for getting event and 
job descriptions.
@@ -263,6 +260,9 @@ void SAL_CALL JobExecutor::notifyEvent( const 
css::document::EventObject& aEvent
 catch( const css::uno::Exception& )
 {}
 
+/* SAFE */ {
+osl::MutexGuard g(rBHelper.rMutex);
+
 // Special feature: If the events "OnNew" or "OnLoad" occurs - we generate 
our own event "onDocumentOpened".
 if (
 (aEvent.EventName == "OnNew") ||


[Libreoffice-commits] core.git: framework/source

2023-01-17 Thread Andrea Gelmini (via logerrit)
 framework/source/fwe/helper/titlehelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c4341c95a2be2e0210d5f8f15d4dd80d9077c4af
Author: Andrea Gelmini 
AuthorDate: Tue Jan 17 14:37:36 2023 +0100
Commit: Julien Nabet 
CommitDate: Tue Jan 17 18:59:38 2023 +

Fix typo

Change-Id: I4f2cf13ce7b9dd7cd4d579bee1ad411459687c57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145668
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/framework/source/fwe/helper/titlehelper.cxx 
b/framework/source/fwe/helper/titlehelper.cxx
index 51025f71e4a5..31981d403b4f 100644
--- a/framework/source/fwe/helper/titlehelper.cxx
+++ b/framework/source/fwe/helper/titlehelper.cxx
@@ -105,7 +105,7 @@ OUString SAL_CALL TitleHelper::getTitle()
 if (!m_sTitle.isEmpty())
 return m_sTitle;
 
-// Title seems to be unused till now ... do bootstraping
+// Title seems to be unused till now ... do bootstrapping
 impl_updateTitle (true);
 
 return m_sTitle;


[Libreoffice-commits] core.git: framework/source include/toolkit toolkit/source

2023-01-14 Thread Noel Grandin (via logerrit)
 framework/source/layoutmanager/layoutmanager.cxx |4 ++--
 framework/source/uielement/newmenucontroller.cxx |4 ++--
 include/toolkit/awt/vclxmenu.hxx |5 -
 toolkit/source/awt/vclxmenu.cxx  |   10 +++---
 toolkit/source/awt/vclxtopwindow.cxx |2 +-
 5 files changed, 8 insertions(+), 17 deletions(-)

New commits:
commit 8d97a90564abba49dcc072d33ddd12c93f4992fe
Author: Noel Grandin 
AuthorDate: Fri Jan 13 15:09:47 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 14 10:51:22 2023 +

XUnoTunnel->dynamic_cast in VCLXMenu

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

diff --git a/framework/source/layoutmanager/layoutmanager.cxx 
b/framework/source/layoutmanager/layoutmanager.cxx
index 9220b805c83a..ec6ed5572d94 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -181,7 +181,7 @@ void LayoutManager::implts_createMenuBar(const OUString& 
rMenuBarName)
 if ( !xMenuBar.is() )
 return;
 
-VCLXMenu* pAwtMenuBar = comphelper::getFromUnoTunnel( xMenuBar );
+VCLXMenu* pAwtMenuBar = dynamic_cast( xMenuBar.get() );
 if ( pAwtMenuBar )
 {
 MenuBar* pMenuBar = static_cast(pAwtMenuBar->GetMenu());
@@ -229,7 +229,7 @@ void LayoutManager::impl_clearUpMenuBar()
 }
 }
 
-VCLXMenu* pAwtMenuBar = 
comphelper::getFromUnoTunnel( xMenuBar );
+VCLXMenu* pAwtMenuBar = dynamic_cast( 
xMenuBar.get() );
 if ( pAwtMenuBar )
 pSetMenuBar = 
static_cast(pAwtMenuBar->GetMenu());
 }
diff --git a/framework/source/uielement/newmenucontroller.cxx 
b/framework/source/uielement/newmenucontroller.cxx
index c36818341ad0..3e2260e3fae8 100644
--- a/framework/source/uielement/newmenucontroller.cxx
+++ b/framework/source/uielement/newmenucontroller.cxx
@@ -283,7 +283,7 @@ NewMenuController::~NewMenuController()
 // private function
 void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const 
& rPopupMenu )
 {
-VCLXPopupMenu* pPopupMenu= static_cast(comphelper::getFromUnoTunnel( rPopupMenu ));
+VCLXPopupMenu* pPopupMenu= static_cast(dynamic_cast( rPopupMenu.get() ));
 PopupMenu* pVCLPopupMenu = nullptr;
 
 SolarMutexGuard aSolarMutexGuard;
@@ -367,7 +367,7 @@ void SAL_CALL NewMenuController::itemSelected( const 
css::awt::MenuEvent& rEvent
 if ( !xPopupMenu.is() )
 return;
 
-VCLXPopupMenu* pPopupMenu = static_cast(comphelper::getFromUnoTunnel( xPopupMenu ));
+VCLXPopupMenu* pPopupMenu = static_cast(dynamic_cast( xPopupMenu.get() ));
 if ( !pPopupMenu )
 return;
 
diff --git a/include/toolkit/awt/vclxmenu.hxx b/include/toolkit/awt/vclxmenu.hxx
index 096c370bce82..bc971a2088ec 100644
--- a/include/toolkit/awt/vclxmenu.hxx
+++ b/include/toolkit/awt/vclxmenu.hxx
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -54,7 +53,6 @@ class TOOLKIT_DLLPUBLIC VCLXMenu :  public css::awt::XMenuBar,
 public css::awt::XPopupMenu,
 public css::lang::XServiceInfo,
 public css::lang::XTypeProvider,
-public css::lang::XUnoTunnel,
 public ::cppu::OWeakObject
 {
 private:
@@ -87,9 +85,6 @@ public:
 void SAL_CALL acquire() noexcept override  { OWeakObject::acquire(); }
 void SAL_CALL release() noexcept override  { OWeakObject::release(); }
 
-// css::lang::XUnoTunnel
-UNO3_GETIMPLEMENTATION_DECL(VCLXMenu)
-
 // css::lang::XTypeProvider
 css::uno::Sequence< css::uno::Type >  SAL_CALL getTypes() override;
 css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index b17f32c2aebc..52edfb5caa49 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -214,22 +214,18 @@ css::uno::Any VCLXMenu::queryInterface(
 static_cast< css::awt::XMenu* 
>(static_cast(this)),
 static_cast< css::awt::XPopupMenu* 
>(this),
 static_cast< css::lang::XTypeProvider* 
>(this),
-static_cast< css::lang::XServiceInfo* 
>(this),
-static_cast< css::lang::XUnoTunnel* 
>(this) );
+static_cast< css::lang::XServiceInfo* 
>(this) );
 else
 aRet = ::cppu::queryInterface(  rType,
 static_cast< css::awt::XMenu* 
>(static_cast(this)),
 

[Libreoffice-commits] core.git: framework/source include/sfx2 include/svtools reportdesign/source sfx2/source svtools/source sw/source

2023-01-13 Thread Noel Grandin (via logerrit)
 framework/source/uielement/controlmenucontroller.cxx   |1 
 framework/source/uielement/fontmenucontroller.cxx  |1 
 framework/source/uielement/fontsizemenucontroller.cxx  |1 
 framework/source/uielement/headermenucontroller.cxx|1 
 framework/source/uielement/langselectionmenucontroller.cxx |1 
 framework/source/uielement/macrosmenucontroller.cxx|1 
 framework/source/uielement/newmenucontroller.cxx   |6 -
 framework/source/uielement/objectmenucontroller.cxx|1 
 framework/source/uielement/popuptoolbarcontroller.cxx  |   15 -
 framework/source/uielement/recentfilesmenucontroller.cxx   |1 
 framework/source/uielement/resourcemenucontroller.cxx  |   11 +++--
 framework/source/uielement/thesaurusmenucontroller.cxx |1 
 framework/source/uielement/toolbarmodemenucontroller.cxx   |4 ++-
 framework/source/uielement/toolbarsmenucontroller.cxx  |4 ++-
 include/sfx2/dispatch.hxx  |4 ++-
 include/sfx2/viewsh.hxx|7 +++---
 include/svtools/popupmenucontrollerbase.hxx|4 ++-
 reportdesign/source/ui/report/ReportSection.cxx|5 +---
 sfx2/source/control/dispatch.cxx   |8 ++
 sfx2/source/notebookbar/NotebookbarTabControl.cxx  |4 +--
 sfx2/source/view/viewsh.cxx|   10 
 svtools/source/uno/popupmenucontrollerbase.cxx |4 ++-
 sw/source/uibase/docvw/edtwin.cxx  |4 +--
 sw/source/uibase/docvw/romenu.hxx  |3 +-
 sw/source/uibase/inc/olmenu.hxx|3 +-
 sw/source/uibase/uiview/viewling.cxx   |4 +--
 26 files changed, 58 insertions(+), 51 deletions(-)

New commits:
commit 793904ff3a7d8cceafab3d83a562261c4c17fd14
Author: Noel Grandin 
AuthorDate: Fri Jan 13 14:50:36 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 14 06:36:24 2023 +

use more VCLXPopupMenu instead of XPopupMenu

which avoids a bunch of casting and makes the dependency explicit
instead of implicit

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

diff --git a/framework/source/uielement/controlmenucontroller.cxx 
b/framework/source/uielement/controlmenucontroller.cxx
index 2c31081bbe6b..dec13831646f 100644
--- a/framework/source/uielement/controlmenucontroller.cxx
+++ b/framework/source/uielement/controlmenucontroller.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/framework/source/uielement/fontmenucontroller.cxx 
b/framework/source/uielement/fontmenucontroller.cxx
index c0dd19e2e71a..e25b5b210b83 100644
--- a/framework/source/uielement/fontmenucontroller.cxx
+++ b/framework/source/uielement/fontmenucontroller.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 //  Defines
 
diff --git a/framework/source/uielement/fontsizemenucontroller.cxx 
b/framework/source/uielement/fontsizemenucontroller.cxx
index 4c5c686888a9..e050c1659eb6 100644
--- a/framework/source/uielement/fontsizemenucontroller.cxx
+++ b/framework/source/uielement/fontsizemenucontroller.cxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/framework/source/uielement/headermenucontroller.cxx 
b/framework/source/uielement/headermenucontroller.cxx
index cbcdc33bc5fa..842e74559fac 100644
--- a/framework/source/uielement/headermenucontroller.cxx
+++ b/framework/source/uielement/headermenucontroller.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 //  Defines
 
diff --git a/framework/source/uielement/langselectionmenucontroller.cxx 
b/framework/source/uielement/langselectionmenucontroller.cxx
index 94918c02179a..51994c1021a0 100644
--- a/framework/source/uielement/langselectionmenucontroller.cxx
+++ b/framework/source/uielement/langselectionmenucontroller.cxx
@@ -29,6 +29,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/framework/source/uielement/macrosmenucontroller.cxx 
b/framework/source/uielement/macrosmenucontroller.cxx
index a0745b1e4f6f..b15b3191efe7 100644
--- a/framework/source/uielement/macrosmenucontroller.cxx
+++ b/framework/source/uielement/macrosmenucontroller.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace com::sun::star::uno;
diff --git a/framework/source/uielement/newmenucontroller.cxx 
b/framework/source/uielement/newmenucontroller.cxx
index 14b59c263b85..c36818341ad0 100644
--- a/framework/source/uielement/newmenucontroller.cxx
+++ b/framework/source/uielement/newmenucontroller.cxx
@@ -395,15 +395,11 @@ void SAL_CALL NewMenuController::itemActivated( const 

[Libreoffice-commits] core.git: framework/source

2023-01-11 Thread Noel Grandin (via logerrit)
 framework/source/fwe/helper/undomanagerhelper.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 92d9888e79b768996db5526eb3965259b38ced76
Author: Noel Grandin 
AuthorDate: Wed Jan 11 09:29:00 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Jan 11 12:25:23 2023 +

fix deadlock observed on jenkins

where we are locking SolarMutex and UndoManagerHelper_Impl::m_aMutex in
different orders in different code-paths, which is deadly when we call
into the same class recursively.

Thread 2 (Thread 0x7f5cf303b700 (LWP 22637)):
(this=0x7f5cf3037cd8) at include/vcl/svapp.hxx:1373
framework::UndoManagerHelper_Impl::impl_clear() (this=0x5f90d50) at
framework/source/fwe/helper/undomanagerhelper.cxx:691
  holds UndoManagerHelper_Impl::m_aMutex
  tries to acquire SolarMutex

framework::UndoManagerHelper_Impl::clear(framework::IMutexGuard&)::$_3::operator()()
const (this=0x5519040) at
framework/source/fwe/helper/undomanagerhelper.cxx:403

framework::UndoManagerHelper_Impl::clear(framework::IMutexGuard&)::$_3>::_M_invoke(std::_Any_data
const&) (__functor=...) at

/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/std_function.h:316
(this=0x5519040) at

/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/std_function.h:706
namespace)::UndoManagerRequest::execute() (this=0x5519030) at
framework/source/fwe/helper/undomanagerhelper.cxx:160
framework::UndoManagerHelper_Impl::impl_processRequest(std::function const&, framework::IMutexGuard&) (this=0x5f90d50, i_request=...,
i_instanceLock=...) at
framework/source/fwe/helper/undomanagerhelper.cxx:490
framework::UndoManagerHelper_Impl::clear(framework::IMutexGuard&)
(this=0x5f90d50, i_instanceLock=...) at
framework/source/fwe/helper/undomanagerhelper.cxx:402
framework::UndoManagerHelper::clear(framework::IMutexGuard&)
(this=0x5f90c38, i_instanceLock=...) at
framework/source/fwe/helper/undomanagerhelper.cxx:999
at chart2/source/model/main/UndoManager.cxx:278
void*, _typelib_TypeDescriptionReference*, bool, unsigned long*,
unsigned int, unsigned long*, double*) (pThis=0x5f90bc8,
nVtableIndex=18, pRegisterReturn=0x0, pReturnTypeRef=0xa2dac0,
bSimpleReturn=true, pStack=0x7f5cf30380e0, nStack=0,
pGPR=0x7f5cf30383e0, pFPR=0x7f5cf30383a0) at
bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77
cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*,
bridges::cpp_uno::shared::VtableSlot,
_typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*,
void*, void**, _uno_Any**) (pThis=0x5e40ac0, aVtableSlot=...,
pReturnTypeRef=0xa2dac0, nParams=0, pParams=0x0, pUnoReturn=0x0,
pUnoArgs=0x0, ppUnoExc=0x7f5cf30388e0) at
bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233
pMemberDescr=0x551dd30, pReturn=0x0, pArgs=0x0,
ppException=0x7f5cf30388e0) at
bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413
binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*,
std::__debug::vector >*) const (this=0x28a3cc0,
returnValue=0x7f5cf3039040, outArguments=0x7f5cf3039008) at
binaryurp/source/incomingrequest.cxx:236
(this=0x28a3cc0) at binaryurp/source/incomingrequest.cxx:79

Thread 1 (Thread 0x7f5cfd03eec0 (LWP 22302)):
(this=0x7ffcdf1b1720, t=...) at include/osl/mutex.hxx:144

comphelper::OInterfaceContainerHelper3::addInterface(com::sun::star::uno::Reference
const&) (this=0x5f90da0, rListener=...) at
include/comphelper/interfacecontainer3.hxx:313
trying to acquire UndoManagerHelper_Impl::m_aMutex

framework::UndoManagerHelper_Impl::addModifyListener(com::sun::star::uno::Reference
const&) (this=0x5f90d50, i_listener=...) at
framework/source/fwe/helper/undomanagerhelper.cxx:286

framework::UndoManagerHelper::addModifyListener(com::sun::star::uno::Reference
const&) (this=0x5f90c38, i_listener=...) at
framework/source/fwe/helper/undomanagerhelper.cxx:1047

chart::UndoManager::addModifyListener(com::sun::star::uno::Reference
const&) (this=0x5f90bc0, i_listener=...) at
chart2/source/model/main/UndoManager.cxx:338
(this=0x1d470d0) at
chart2/source/controller/main/UndoCommandDispatch.cxx:57
chart::CommandDispatchContainer::getDispatchForURL(com::sun::star::util::URL
const&) (this=0x5f66e58, rURL=...) at
chart2/source/controller/main/CommandDispatchContainer.cxx:93
chart::ChartController::queryDispatch(com::sun::star::util::URL const&,
rtl::OUString const&, int) (this=0x5f66c50, rURL=...,
rTargetFrameName=...) at
chart2/source/controller/main/ChartController.cxx:1055
locks SolarMutex
chart::ChartController::queryDispatch(com::sun::star::util::URL const&,
rtl::OUString const&, int) () at


[Libreoffice-commits] core.git: framework/source

2022-12-16 Thread Stephan Bergmann (via logerrit)
 framework/source/services/frame.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 557615d97473dd4faea0914a8064d8525963fe5c
Author: Stephan Bergmann 
AuthorDate: Wed Dec 14 20:04:11 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Dec 16 15:40:24 2022 +

Use rtl::Reference to avoid a dynamic_cast

Change-Id: I3b9781cf00df7b740c8b29c6834e54035b255269
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144327
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/framework/source/services/frame.cxx 
b/framework/source/services/frame.cxx
index 3721f8e40462..54df1a7eeac2 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -71,6 +71,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -374,7 +375,7 @@ private:
 /// points to an external set progress, which should be used instead of 
the internal one.
 css::uno::WeakReference< css::task::XStatusIndicator >  
m_xIndicatorInterception;
 /// helper for XDispatch/Provider and interception interfaces
-css::uno::Reference< css::frame::XDispatchProvider >
m_xDispatchHelper;
+rtl::Reference< InterceptionHelper >m_xDispatchHelper;
 /// helper for XFrames, XIndexAccess and XElementAccess interfaces
 css::uno::Reference< css::frame::XFrames >  
m_xFramesHelper;
 /// container for ALL Listener
@@ -1474,10 +1475,9 @@ sal_Bool SAL_CALL XFrameImpl::setComponent(const 
css::uno::Reference< css::awt::
 SolarMutexGuard aWriteLock;
 m_xController = nullptr;
 
-auto pInterceptionHelper = 
dynamic_cast(m_xDispatchHelper.get());
-if (pInterceptionHelper)
+if (m_xDispatchHelper)
 {
-rtl::Reference pDispatchProvider = 
pInterceptionHelper->GetSlave();
+rtl::Reference pDispatchProvider = 
m_xDispatchHelper->GetSlave();
 if (pDispatchProvider)
 {
 pDispatchProvider->ClearProtocolHandlers();
@@ -2117,7 +2117,7 @@ void SAL_CALL XFrameImpl::disposing()
 css::uno::Reference< css::lang::XEventListener > xDispatchHelper;
 {
 SolarMutexGuard g;
-xDispatchHelper.set(m_xDispatchHelper, css::uno::UNO_QUERY_THROW);
+xDispatchHelper = m_xDispatchHelper;
 }
 xDispatchHelper->disposing(aEvent);
 xDispatchHelper.clear();
@@ -2383,7 +2383,7 @@ void SAL_CALL 
XFrameImpl::registerDispatchProviderInterceptor(
 css::uno::Reference< css::frame::XDispatchProviderInterception > 
xInterceptionHelper;
 {
 SolarMutexGuard g;
-xInterceptionHelper.set( m_xDispatchHelper, css::uno::UNO_QUERY );
+xInterceptionHelper = m_xDispatchHelper;
 }
 if (xInterceptionHelper.is()) {
 xInterceptionHelper->registerDispatchProviderInterceptor( xInterceptor 
);
@@ -2402,7 +2402,7 @@ void SAL_CALL 
XFrameImpl::releaseDispatchProviderInterceptor(
 css::uno::Reference< css::frame::XDispatchProviderInterception > 
xInterceptionHelper;
 {
 SolarMutexGuard g;
-xInterceptionHelper.set( m_xDispatchHelper, css::uno::UNO_QUERY );
+xInterceptionHelper = m_xDispatchHelper;
 }
 if (xInterceptionHelper.is()) {
 xInterceptionHelper->releaseDispatchProviderInterceptor( xInterceptor 
);


[Libreoffice-commits] core.git: framework/source

2022-12-05 Thread Noel Grandin (via logerrit)
 framework/source/uiconfiguration/uiconfigurationmanager.cxx |   33 
 1 file changed, 12 insertions(+), 21 deletions(-)

New commits:
commit 80ef2a46f4ac2ac6f3b14561a195262156fe4b85
Author: Noel Grandin 
AuthorDate: Mon Dec 5 14:43:30 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue Dec 6 07:28:44 2022 +

tdf#152134 Customize: assign user macro to menu hangs

regression from
commit d4257daba1155ebccbfebea99bad0e4152ca9b08
Author: Noel Grandin 
Date:   Fri Dec 24 20:58:28 2021 +0200
use comphelper::WeakComponentImplHelper in MenuBarManager

We should not hold the mutex while firing events, since the mutex is now
non-recursive.

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

diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx 
b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index eeb1418da1c3..4950cbfc4cf3 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -1347,29 +1347,20 @@ sal_Bool SAL_CALL UIConfigurationManager::isReadOnly()
 void UIConfigurationManager::implts_notifyContainerListener( const 
ConfigurationEvent& aEvent, NotifyOp eOp )
 {
 std::unique_lock aGuard(m_mutex);
-comphelper::OInterfaceIteratorHelper4 pIterator( aGuard, 
m_aConfigListeners );
-while ( pIterator.hasMoreElements() )
-{
-try
-{
-switch ( eOp )
-{
-case NotifyOp_Replace:
-pIterator.next()->elementReplaced( aEvent );
-break;
-case NotifyOp_Insert:
-pIterator.next()->elementInserted( aEvent );
-break;
-case NotifyOp_Remove:
-pIterator.next()->elementRemoved( aEvent );
-break;
-}
-}
-catch( const css::uno::RuntimeException& )
+m_aConfigListeners.forEach(aGuard, [, ](const 
css::uno::Reference& l) {
+switch ( eOp )
 {
-pIterator.remove(aGuard);
+case NotifyOp_Replace:
+l->elementReplaced( aEvent );
+break;
+case NotifyOp_Insert:
+l->elementInserted( aEvent );
+break;
+case NotifyOp_Remove:
+l->elementRemoved( aEvent );
+break;
 }
-}
+});
 }
 
 }


[Libreoffice-commits] core.git: framework/source

2022-10-03 Thread Henry Castro (via logerrit)
 framework/source/uielement/langselectionstatusbarcontroller.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 161e8c63a5175a634b3ddaea4314e335b290a298
Author: Henry Castro 
AuthorDate: Thu Aug 18 11:02:29 2022 -0400
Commit: Henry Castro 
CommitDate: Mon Oct 3 15:43:09 2022 +0200

tdf#127856: sc: Status bar "languages" when you click...

the popup "More.." button it will show the format cells dialog.

Signed-off-by: Henry Castro 
Change-Id: Idb60decf1c582c906d24d10fc248cfd20f8f4cbf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138499
Tested-by: Jenkins

diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx 
b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index 807806364f34..b0f71f3e3f33 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -120,6 +120,7 @@ void LangSelectionStatusbarController::LangMenu(
 return;
 
 const Reference 
xService(m_xFrame->getController()->getModel(), UNO_QUERY);
+bool bCalc   = xService.is() && 
xService->supportsService("com.sun.star.sheet.SpreadsheetDocument");
 bool bWriter = xService.is() && 
xService->supportsService("com.sun.star.text.GenericTextDocument");
 //add context menu
 Reference< awt::XPopupMenu > xPopupMenu( awt::PopupMenu::create( 
m_xContext ) );
@@ -243,7 +244,10 @@ void LangSelectionStatusbarController::LangMenu(
 }
 else if (nId == MID_LANG_DEF_MORE)
 {
-aBuff.append( ".uno:LanguageStatus?Language:string=*" );
+if (bCalc)
+aBuff.append( ".uno:FormatCellDialog" );
+else
+aBuff.append( ".uno:LanguageStatus?Language:string=*" );
 }
 else if (MID_LANG_PARA_1 <= nId && nId <= MID_LANG_PARA_9)
 {


[Libreoffice-commits] core.git: framework/source

2022-09-30 Thread Maxim Monastirsky (via logerrit)
 framework/source/uielement/generictoolbarcontroller.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 79e450749d58e21cad747592f49e505830184d74
Author: Maxim Monastirsky 
AuthorDate: Tue Sep 27 23:42:26 2022 +0300
Commit: Maxim Monastirsky 
CommitDate: Fri Sep 30 13:01:32 2022 +0200

tdf#151172 crash in notebookbar with extension enabled

Change-Id: I60d777b27ffee095807490f4b181b1b08ed88462
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140683
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/framework/source/uielement/generictoolbarcontroller.cxx 
b/framework/source/uielement/generictoolbarcontroller.cxx
index f61a0d0150b9..1fd8998f0460 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -356,8 +356,9 @@ 
ImageOrientationController::ImageOrientationController(const ReferenceRemoveEventListener(LINK(this, 
ImageOrientationController, WindowEventListener));
+VclPtr pWindow = VCLUnoHelper::GetWindow(getParent());
+if (pWindow)
+pWindow->RemoveEventListener(LINK(this, ImageOrientationController, 
WindowEventListener));
 }
 
 IMPL_LINK(ImageOrientationController, WindowEventListener, VclWindowEvent&, 
rWindowEvent, void)


[Libreoffice-commits] core.git: framework/source sd/source

2022-09-04 Thread Mike Kaganski (via logerrit)
 framework/source/inc/loadenv/loadenv.hxx |   11 ++
 framework/source/loadenv/loadenv.cxx |   32 ---
 sd/source/ui/inc/DrawViewShell.hxx   |5 
 sd/source/ui/view/drviews1.cxx   |   19 --
 4 files changed, 42 insertions(+), 25 deletions(-)

New commits:
commit 42d197ef301db68e56f7e45b6e36ace5fae04b4d
Author: Mike Kaganski 
AuthorDate: Sun Sep 4 13:39:27 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sun Sep 4 19:44:49 2022 +0200

tdf#150773: Avoid bringing loading files to front several times

The change attempts to establish this logic:
1. Honor the ForceFocusAndToFront setting uniformly: previously, it
   was ignored when reusing existing windows (opening in Start Center,
   in place of an empty document, or trying to open an already opened
   document);
2. When ForceFocusAndToFront is set, try to activate the window as
   early as possible (before loading begind), as a feedback to user,
   and also to avoid situations when activation would be impossible
   later (e.g., there is a timespan on Windows, during which entitled
   applications can bring themselves to foreground; a lengthy loading
   process can exceed that time);
3. If activated once, do not activate second time after loading ends,
   to avoid nagging users who deliberately switched to other tasks.

Explicit calls to impl_makeFrameWindowVisible were removed from
impl_searchAlreadyLoaded and impl_isFrameAlreadyUsedForLoading,
because those functions are called from impl_loadContent, which makes
sure that they are followed by a call to impl_makeFrameWindowVisible
(either in impl_setResult -> impl_reactForLoadingState, or directly).

A fix to tdf#83773 was adjusted; I checked that the bug doesn't
reappear after that.

Change-Id: I4bdcf978d43016d1e8979adf2fdf108a37f6ba2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139362
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/framework/source/inc/loadenv/loadenv.hxx 
b/framework/source/inc/loadenv/loadenv.hxx
index 351d39b94b4e..baad8fac9b7f 100644
--- a/framework/source/inc/loadenv/loadenv.hxx
+++ b/framework/source/inc/loadenv/loadenv.hxx
@@ -179,6 +179,12 @@ private:
  */
 bool m_bLoaded;
 
+/** @short  If we already brought it to front; do not do that again
+(the user could switch elsewhere after the first activation,
+and we shouldn't nag them again).
+ */
+bool m_bFocusedAndToFront = false;
+
 /** @short  holds an XActionLock on the internal used task member.
 
 @seealsom_xTargetFrame
@@ -533,6 +539,11 @@ private:
 loading the document.
  */
 bool impl_filterHasInteractiveDialog() const;
+
+/** @short  checks if this should bring to front and get focus on load,
+according to user settings and to the load flags.
+ */
+bool shouldFocusAndToFront() const;
 };
 
 } // namespace framework
diff --git a/framework/source/loadenv/loadenv.cxx 
b/framework/source/loadenv/loadenv.cxx
index f8d0176b6276..0cd8b0b38330 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -1119,7 +1119,10 @@ bool LoadEnv::impl_loadContent()
 xHandler->initialize(aArguments);
 //show the frame as early as possible to make it the parent of any 
message dialogs
 if (!impl_filterHasInteractiveDialog())
-impl_makeFrameWindowVisible(xWindow, false);
+{
+impl_makeFrameWindowVisible(xWindow, shouldFocusAndToFront());
+m_bFocusedAndToFront = true; // no need to ask 
shouldFocusAndToFront second time
+}
 }
 }
 
@@ -1408,9 +1411,6 @@ css::uno::Reference< css::frame::XFrame > 
LoadEnv::impl_searchAlreadyLoaded()
 // if an optional jumpmark is given too.
 if (!m_aURL.Mark.isEmpty())
 impl_jumpToMark(xResult, m_aURL);
-
-// bring it to front and make sure it's visible...
-impl_makeFrameWindowVisible(xResult->getContainerWindow(), true);
 }
 
 return xResult;
@@ -1448,8 +1448,6 @@ css::uno::Reference< css::frame::XFrame > 
LoadEnv::impl_searchRecycleTarget()
 {
 if 
(!impl_isFrameAlreadyUsedForLoading(aTasksAnalyzer.m_xBackingComponent))
 {
-// bring it to front...
-
impl_makeFrameWindowVisible(aTasksAnalyzer.m_xBackingComponent->getContainerWindow(),
 true);
 m_bReactivateControllerOnError = true;
 return aTasksAnalyzer.m_xBackingComponent;
 }
@@ -1562,9 +1560,6 @@ css::uno::Reference< css::frame::XFrame > 
LoadEnv::impl_searchRecycleTarget()
 }
 // <- SAFE ..
 
-// bring it to front ...
-impl_makeFrameWindowVisible(xTask->getContainerWindow(), true);
-
 return xTask;
 

[Libreoffice-commits] core.git: framework/source

2022-09-04 Thread Mike Kaganski (via logerrit)
 framework/source/loadenv/loadenv.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit f0fbf30a9c9dab41fce10f3ad4bfc83434122c70
Author: Mike Kaganski 
AuthorDate: Sun Sep 4 08:50:45 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sun Sep 4 10:41:33 2022 +0200

Some refactor

Change-Id: I5b87f9298bfeec70848654eacf5086803c19080a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139354
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/framework/source/loadenv/loadenv.cxx 
b/framework/source/loadenv/loadenv.cxx
index 76116ad98ed7..f8d0176b6276 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -1691,19 +1691,19 @@ void LoadEnv::impl_makeFrameWindowVisible(const 
css::uno::Reference< css::awt::X
 if ( !pWindow )
 return;
 
-bool const preview( m_lMediaDescriptor.getUnpackedValueOrDefault(
-utl::MediaDescriptor::PROP_PREVIEW, false) );
-
-bool bForceFrontAndFocus(false);
-if ( !preview )
+if (!bForceToFront)
 {
-bForceFrontAndFocus = 
officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get();
+bool const preview(m_lMediaDescriptor.getUnpackedValueOrDefault(
+utl::MediaDescriptor::PROP_PREVIEW, false));
+bForceToFront
+= !preview
+  && 
officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get();
 }
 
-if( pWindow->IsVisible() && (bForceFrontAndFocus || bForceToFront) )
+if (pWindow->IsVisible() && bForceToFront)
 pWindow->ToTop( ToTopFlags::RestoreWhenMin | 
ToTopFlags::ForegroundTask );
 else
-pWindow->Show(true, (bForceFrontAndFocus || bForceToFront) ? 
ShowFlags::ForegroundTask : ShowFlags::NONE );
+pWindow->Show(true, bForceToFront ? ShowFlags::ForegroundTask : 
ShowFlags::NONE);
 }
 
 void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< 
css::awt::XWindow >& xWindow)


[Libreoffice-commits] core.git: framework/source include/framework include/vcl sfx2/source vcl/inc vcl/source vcl/unx

2022-08-30 Thread Maxim Monastirsky (via logerrit)
 framework/source/uielement/generictoolbarcontroller.cxx |   14 ++
 include/framework/generictoolbarcontroller.hxx  |1 
 include/vcl/weld.hxx|1 
 sfx2/source/toolbox/weldutils.cxx   |7 +--
 vcl/inc/salvtables.hxx  |2 
 vcl/source/app/salvtables.cxx   |6 ++
 vcl/source/window/toolbox2.cxx  |   13 --
 vcl/unx/gtk3/gtkinst.cxx|   33 
 8 files changed, 53 insertions(+), 24 deletions(-)

New commits:
commit 4fb8c0d14cb2468f7336438004f699b9eb7e7e4a
Author: Maxim Monastirsky 
AuthorDate: Fri Jul 29 00:36:18 2022 +0300
Commit: Maxim Monastirsky 
CommitDate: Tue Aug 30 13:08:03 2022 +0200

tdf#149741 tdf#149956 Make flipping work also in the sidebar

- Reset the icon each time, as there seems to be no easy
way to retrieve the existing icon from a gtk widget in
order to mirror it, like we used to do for vcl. Similar
approach is currently taken in
ToolboxButtonColorUpdaterBase::Update.

- Store the flipping state also in GtkInstanceToolbar,
similar to vcl's ToolBox. This seems to be the easiest
way to make flipping not break on icon theme change,
covering all 4 cases (ToolBarManager, SidebarToolBox,
ToolbarUnoDispatcher, GenericToolbarController), w/o
too involved changes in each. This might benefit from
some refactoring later on, but should be good enough
for now.

- One unsolved problem is the appearance of flipped
icons with svg themes, as the regular variant is handed
to gtk directly, whereas the flipped one is loaded by us,
resulting with a different (blurry) look.

Change-Id: I48c16827b46fb75fd798a041851af6e2648ae8fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139021
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/framework/source/uielement/generictoolbarcontroller.cxx 
b/framework/source/uielement/generictoolbarcontroller.cxx
index e8e49cb30933..312b5ed9e77f 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -91,6 +91,7 @@ GenericToolbarController::GenericToolbarController( const 
Reference< XComponentC
 ,   m_xToolbar( pToolbar )
 ,   m_nID( nID )
 ,   m_bEnumCommand( isEnumCommand( aCommand ))
+,   m_bMirrored( false )
 ,   m_bMadeInvisible( false )
 ,   m_aEnumCommand( getEnumCommand( aCommand ))
 {
@@ -189,6 +190,7 @@ void GenericToolbarController::statusChanged( const 
FeatureStateEvent& Event )
 
 boolbValue;
 OUStringaStrValue;
+SfxImageItem aImageItem;
 
 if ( Event.State >>= bValue )
 {
@@ -199,6 +201,13 @@ void GenericToolbarController::statusChanged( const 
FeatureStateEvent& Event )
 {
 m_pToolbar->set_item_label(sId, aStrValue);
 }
+else if ( aImageItem.PutValue( Event.State, 0 ) && 
aImageItem.IsMirrored() != m_bMirrored )
+{
+m_pToolbar->set_item_image_mirrored(sId, aImageItem.IsMirrored());
+auto 
xGraphic(vcl::CommandInfoProvider::GetXGraphicForCommand(m_aCommandURL, 
m_xFrame, m_pToolbar->get_icon_size()));
+m_pToolbar->set_item_image(sId, xGraphic);
+m_bMirrored = !m_bMirrored;
+}
 else
 m_pToolbar->set_item_active(sId, false);
 
@@ -295,9 +304,12 @@ void GenericToolbarController::statusChanged( const 
FeatureStateEvent& Event )
 if ( m_bMadeInvisible )
 m_xToolbar->ShowItem( m_nID );
 }
-else if ( aImageItem.PutValue( Event.State, 0 ) )
+else if ( aImageItem.PutValue( Event.State, 0 ) && aImageItem.IsMirrored() 
!= m_bMirrored )
 {
 m_xToolbar->SetItemImageMirrorMode( m_nID, aImageItem.IsMirrored() );
+Image aImage( vcl::CommandInfoProvider::GetImageForCommand( 
m_aCommandURL, m_xFrame, m_xToolbar->GetImageSize() ));
+m_xToolbar->SetItemImage( m_nID, aImage );
+m_bMirrored = !m_bMirrored;
 if ( m_bMadeInvisible )
 m_xToolbar->ShowItem( m_nID );
 }
diff --git a/include/framework/generictoolbarcontroller.hxx 
b/include/framework/generictoolbarcontroller.hxx
index e177ea5f00a9..473941a7682a 100644
--- a/include/framework/generictoolbarcontroller.hxx
+++ b/include/framework/generictoolbarcontroller.hxx
@@ -64,6 +64,7 @@ class FWK_DLLPUBLIC GenericToolbarController final : public 
svt::ToolboxControll
 VclPtr m_xToolbar;
 ToolBoxItemId   m_nID;
 boolm_bEnumCommand : 1,
+m_bMirrored : 1,
 m_bMadeInvisible : 1;
 OUStringm_aEnumCommand;
 };
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index b3bbe60a7390..adbd35d85df6 100644
--- 

[Libreoffice-commits] core.git: framework/source

2022-08-10 Thread Maxim Monastirsky (via logerrit)
 framework/source/uielement/toolbarmanager.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f4c922f91e717728376dca943008a6dd56387c71
Author: Maxim Monastirsky 
AuthorDate: Tue Aug 9 21:26:55 2022 +0300
Commit: Maxim Monastirsky 
CommitDate: Wed Aug 10 08:29:33 2022 +0200

Missing colon in toolbar help ids

Regression of 5200a73627d13e2997f81b53f61e143e77e328ee
("use more string_view in various").

Change-Id: I402eb6c03dcfa661c79c5469cfca3c86ac528f60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138066
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/framework/source/uielement/toolbarmanager.cxx 
b/framework/source/uielement/toolbarmanager.cxx
index ef3470a28fb3..86a6c161900d 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -614,7 +614,7 @@ void ToolBarManager::Init()
 sal_Int32 idx = m_aResourceName.lastIndexOf('/');
 idx++; // will become 0 if '/' not found: use full string
 std::u16string_view aToolbarName = m_aResourceName.subView( idx );
-OString aHelpIdAsString = ".HelpId" + OUStringToOString( aToolbarName, 
RTL_TEXTENCODING_UTF8 );
+OString aHelpIdAsString = ".HelpId:" + OUStringToOString( aToolbarName, 
RTL_TEXTENCODING_UTF8 );
 m_pImpl->SetHelpId( aHelpIdAsString );
 
 m_aAsyncUpdateControllersTimer.SetTimeout( 50 );


[Libreoffice-commits] core.git: framework/source

2022-08-04 Thread Caolán McNamara (via logerrit)
 framework/source/uielement/subtoolbarcontroller.cxx |   28 +++-
 1 file changed, 16 insertions(+), 12 deletions(-)

New commits:
commit d84f7217b25bd3766497b17a8e057e3cbf4c8db8
Author: Caolán McNamara 
AuthorDate: Thu Aug 4 11:45:47 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Aug 4 16:28:40 2022 +0200

tdf#150249 close of popover not detected

the popover listened to here isn't the one that ends up getting actually
used, its contents are transferred to another one, so the
OnPopoverClosed wasn't called, its sufficient to just use the
SubToolbarControl dtor to detect what is wanted here

Change-Id: I3f4a038acfc183b863457919bf89d600517ddc01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137792
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/framework/source/uielement/subtoolbarcontroller.cxx 
b/framework/source/uielement/subtoolbarcontroller.cxx
index c5aed8f7bf59..de345f545497 100644
--- a/framework/source/uielement/subtoolbarcontroller.cxx
+++ b/framework/source/uielement/subtoolbarcontroller.cxx
@@ -46,7 +46,6 @@ namespace {
 
 class SubToolBarController : public ToolBarBase
 {
-DECL_LINK(OnPopoverClose, weld::Popover&, void);
 OUString m_aSubTbName;
 OUString m_aLastCommand;
 css::uno::Reference< css::ui::XUIElement > m_xUIElement;
@@ -56,6 +55,8 @@ public:
const css::uno::Sequence< css::uno::Any >& 
rxArgs );
 virtual ~SubToolBarController() override;
 
+void PopoverDestroyed();
+
 // XInitialization
 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any 
>& rxArgs ) override;
 
@@ -209,22 +210,24 @@ namespace {
 class SubToolbarControl final : public WeldToolbarPopup
 {
 public:
-explicit SubToolbarControl(css::uno::Reference< css::frame::XFrame > 
xFrame,
-   weld::Widget* pParent);
+explicit SubToolbarControl(SubToolBarController& rController, 
weld::Widget* pParent);
+virtual ~SubToolbarControl() override;
 
 virtual void GrabFocus() override;
 
 weld::Container* GetContainer() { return m_xTargetContainer.get(); }
 
 private:
+SubToolBarController& m_rController;
 std::unique_ptr m_xTargetContainer;
 };
 }
 
-SubToolbarControl::SubToolbarControl(css::uno::Reference< css::frame::XFrame > 
xFrame,
+SubToolbarControl::SubToolbarControl(SubToolBarController& rController,
  weld::Widget* pParent)
-: WeldToolbarPopup(xFrame, pParent, "svt/ui/subtoolbar.ui", "subtoolbar")
-, m_xTargetContainer(m_xBuilder->weld_container("container"))
+: WeldToolbarPopup(rController.getFrameInterface(), pParent, 
"svt/ui/subtoolbar.ui", "subtoolbar")
+, m_rController(rController)
+, m_xTargetContainer(m_xBuilder->weld_container("container"))
 {
 }
 
@@ -233,11 +236,16 @@ void SubToolbarControl::GrabFocus()
 // TODO
 }
 
+SubToolbarControl::~SubToolbarControl()
+{
+m_rController.PopoverDestroyed();
+}
+
 std::unique_ptr SubToolBarController::weldPopupWindow()
 {
 SolarMutexGuard aGuard;
 
-auto pPopup = std::make_unique(getFrameInterface(), 
m_pToolbar);
+auto pPopup = std::make_unique(*this, m_pToolbar);
 
 css::uno::Reference< css::frame::XFrame > xFrame ( getFrameInterface() );
 
@@ -268,10 +276,6 @@ std::unique_ptr 
SubToolBarController::weldPopupWindow()
 catch ( css::lang::IllegalArgumentException& )
 {}
 
-weld::Popover* pPopover = 
dynamic_cast(pPopup->getTopLevel());
-if (pPopover)
-pPopover->connect_closed(LINK(this, SubToolBarController, 
OnPopoverClose));
-
 return pPopup;
 }
 
@@ -501,7 +505,7 @@ void SubToolBarController::initialize( const 
css::uno::Sequence< css::uno::Any >
 updateImage();
 }
 
-IMPL_LINK_NOARG(SubToolBarController, OnPopoverClose, weld::Popover&, void)
+void SubToolBarController::PopoverDestroyed()
 {
 disposeUIElement();
 m_xUIElement = nullptr;


[Libreoffice-commits] core.git: framework/source

2022-08-03 Thread Noel Grandin (via logerrit)
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |   34 
+++---
 1 file changed, 13 insertions(+), 21 deletions(-)

New commits:
commit 84c4ccfec1cbbd573609623a026a8cd2ad20400f
Author: Noel Grandin 
AuthorDate: Tue Aug 2 20:15:07 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 3 09:12:16 2022 +0200

tdf#149966 Crash on Windows and freeze on Linux when customizing Menu

use the notifyEach helper, which unlocks the mutex while we are
calling listeners, which means we can tolerate a re-entrant call to
removeConfigurationListener.

regression from
commit dab35c152af3345786b8335e83cd067b67d08b81
Author: Noel Grandin 
Date:   Sat Dec 18 20:24:15 2021 +0200
osl::Mutex->std::mutex in ModuleUIConfigurationManager

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

diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx 
b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 93058358d04a..ded9d777080c 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -1625,29 +1625,21 @@ sal_Bool SAL_CALL 
ModuleUIConfigurationManager::isReadOnly()
 void ModuleUIConfigurationManager::implts_notifyContainerListener( const 
ui::ConfigurationEvent& aEvent, NotifyOp eOp )
 {
 std::unique_lock aGuard(m_mutex);
-comphelper::OInterfaceIteratorHelper4 pIterator( aGuard, 
m_aConfigListeners );
-while ( pIterator.hasMoreElements() )
+using ListenerMethodType = void (SAL_CALL 
css::ui::XUIConfigurationListener::*)(const ui::ConfigurationEvent&);
+ListenerMethodType aListenerMethod {};
+switch ( eOp )
 {
-try
-{
-switch ( eOp )
-{
-case NotifyOp_Replace:
-pIterator.next()->elementReplaced( aEvent );
-break;
-case NotifyOp_Insert:
-pIterator.next()->elementInserted( aEvent );
-break;
-case NotifyOp_Remove:
-pIterator.next()->elementRemoved( aEvent );
-break;
-}
-}
-catch( const css::uno::RuntimeException& )
-{
-pIterator.remove(aGuard);
-}
+case NotifyOp_Replace:
+aListenerMethod = 
::ui::XUIConfigurationListener::elementReplaced;
+break;
+case NotifyOp_Insert:
+aListenerMethod = 
::ui::XUIConfigurationListener::elementInserted;
+break;
+case NotifyOp_Remove:
+aListenerMethod = 
::ui::XUIConfigurationListener::elementRemoved;
+break;
 }
+m_aConfigListeners.notifyEach(aGuard, aListenerMethod, aEvent);
 }
 
 }


[Libreoffice-commits] core.git: framework/source

2022-07-19 Thread offtkp (via logerrit)
 framework/source/uiconfiguration/imagemanagerimpl.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 21ad38b61618c7bc4daea4e0e7989d8b21bd1150
Author: offtkp 
AuthorDate: Sat Jul 9 20:48:32 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 13:08:02 2022 +0200

Replace old png writer in imagemanagerimpl.cxx

Change-Id: I8bc30a218b67d165d1a8ae3d663e5482a8113aa8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137118
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx 
b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 5211e79b96dc..26aa0f33400c 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -43,7 +43,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 using ::com::sun::star::uno::Sequence;
@@ -395,8 +395,9 @@ bool ImageManagerImpl::implts_storeUserImages(
 {
 {
 std::unique_ptr 
pSvStream(utl::UcbStreamHelper::CreateStream( xBitmapStream ));
-vcl::PNGWriter aPngWriter( 
pImageList->GetAsHorizontalStrip() );
-aPngWriter.Write( *pSvStream );
+vcl::PngImageWriter aPngWriter( *pSvStream );
+auto rBitmap = pImageList->GetAsHorizontalStrip();
+aPngWriter.write( rBitmap );
 }
 
 // Commit user bitmaps storage


[Libreoffice-commits] core.git: framework/source

2022-07-17 Thread Maxim Monastirsky (via logerrit)
 framework/source/uielement/toolbarmanager.cxx |   45 +-
 1 file changed, 16 insertions(+), 29 deletions(-)

New commits:
commit d69340d4d1e7f96f0633bebd5abcf20114fbef0f
Author: Maxim Monastirsky 
AuthorDate: Sun Jul 17 17:08:29 2022 +0300
Commit: Maxim Monastirsky 
CommitDate: Mon Jul 18 00:44:40 2022 +0200

Simplify by using InitAnyPropertySequence

Change-Id: I145ce892e101ba4e8906cbdb0d32a52a4c655d43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137151
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/framework/source/uielement/toolbarmanager.cxx 
b/framework/source/uielement/toolbarmanager.cxx
index 34a63156bc2a..b2efe27c2f0a 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -59,7 +59,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -1076,27 +1076,14 @@ void ToolBarManager::CreateControllers()
 if ( m_xToolbarControllerFactory.is() &&
  m_xToolbarControllerFactory->hasController( aCommandURL, 
m_aModuleIdentifier ))
 {
-PropertyValue aPropValue;
-std::vector< Any > aPropertyVector;
-
-aPropValue.Name = "ModuleIdentifier";
-aPropValue.Value<<= m_aModuleIdentifier;
-aPropertyVector.push_back( Any( aPropValue ));
-aPropValue.Name = "Frame";
-aPropValue.Value<<= m_xFrame;
-aPropertyVector.push_back( Any( aPropValue ));
-aPropValue.Name = "ServiceManager";
 Reference 
xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW);
-aPropValue.Value<<= xMSF;
-aPropertyVector.push_back( Any( aPropValue ));
-aPropValue.Name = "ParentWindow";
-aPropValue.Value<<= xToolbarWindow;
-aPropertyVector.push_back( Any( aPropValue ));
-aPropValue.Name = "Identifier";
-aPropValue.Value<<= sal_uInt16(nId);
-aPropertyVector.push_back( uno::Any( aPropValue ) );
-
-Sequence< Any > aArgs( comphelper::containerToSequence( 
aPropertyVector ));
+Sequence< Any > aArgs( comphelper::InitAnyPropertySequence( {
+{ "ModuleIdentifier", Any(m_aModuleIdentifier) },
+{ "Frame", Any(m_xFrame) },
+{ "ServiceManager", Any(xMSF) },
+{ "ParentWindow", Any(xToolbarWindow) },
+{ "Identifier", Any(sal_uInt16(nId)) },
+} ));
 xController.set( 
m_xToolbarControllerFactory->createInstanceWithArgumentsAndContext( 
aCommandURL, aArgs, m_xContext ),
  UNO_QUERY );
 bInit = false; // Initialization is done through the factory 
service
@@ -1184,14 +1171,14 @@ void ToolBarManager::CreateControllers()
 if ( bInit )
 {
 Reference 
xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW);
-Sequence< Any > aArgs {
-Any( comphelper::makePropertyValue("Frame", m_xFrame) ),
-Any( comphelper::makePropertyValue("CommandURL", 
aCommandURL) ),
-Any( comphelper::makePropertyValue("ServiceManager", xMSF) 
),
-Any( comphelper::makePropertyValue("ParentWindow", 
xToolbarWindow) ),
-Any( comphelper::makePropertyValue("ModuleIdentifier", 
m_aModuleIdentifier) ),
-Any( comphelper::makePropertyValue("Identifier", 
sal_uInt16(nId)) ),
-};
+Sequence< Any > aArgs( comphelper::InitAnyPropertySequence( {
+{ "Frame", Any(m_xFrame) },
+{ "CommandURL", Any(aCommandURL) },
+{ "ServiceManager", Any(xMSF) },
+{ "ParentWindow", Any(xToolbarWindow) },
+{ "ModuleIdentifier", Any(m_aModuleIdentifier) },
+{ "Identifier", Any(sal_uInt16(nId)) },
+} ));
 
 xInit->initialize( aArgs );
 }


[Libreoffice-commits] core.git: framework/source

2022-07-17 Thread Maxim Monastirsky (via logerrit)
 framework/source/uielement/toolbarmanager.cxx |8 
 1 file changed, 8 deletions(-)

New commits:
commit f1f52b6e5086124c75b57f6f6ff1f1f0353e40af
Author: Maxim Monastirsky 
AuthorDate: Sun Jul 17 17:07:29 2022 +0300
Commit: Maxim Monastirsky 
CommitDate: Mon Jul 18 00:39:51 2022 +0200

Remove the broken SupportsVisible hack

pController is always empty since commit
ac1aefd5174258d9bcb41465ce566ed1a0819f3d
("Extend ToolBarManager to build weld::Toolbar").
But even before that it did nothing, as it was set
only for controllers created by the sfx2 legacy
factory, but neither .uno:SwitchXFormsDesignMode nor
.uno:ViewDataSourceBrowser had such controllers (It
did however work in the past for some other commands
before commit fb60217569b0fb5bc949c58b054da71992fe2582
("tdf#83320 Hide vertical text commands early"). Also,
searching the codebase for SfxVisibilityItem reveals
more commands that set visibility, and I'm not sure
if hardcoding all of them here is a good approach in
general.

Change-Id: Id8c22e729d2402837de0598fa8ca4d41160804c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137150
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/framework/source/uielement/toolbarmanager.cxx 
b/framework/source/uielement/toolbarmanager.cxx
index 587cd8b61ad8..34a63156bc2a 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -1054,8 +1054,6 @@ void ToolBarManager::CreateControllers()
 bool bCreate( true );
 Reference< XStatusListener > xController;
 
-rtl::Reference pController;
-
 OUString aCommandURL( m_pImpl->GetItemCommand( nId ) );
 // Command can be just an alias to another command.
 auto aProperties = 
vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, 
m_aModuleIdentifier);
@@ -1196,12 +1194,6 @@ void ToolBarManager::CreateControllers()
 };
 
 xInit->initialize( aArgs );
-
-if (pController)
-{
-if (aCommandURL == ".uno:SwitchXFormsDesignMode" || 
aCommandURL == ".uno:ViewDataSourceBrowser")
-pController->setFastPropertyValue_NoBroadcast(1, 
Any(true));
-}
 }
 
 // Request an item window from the toolbar controller and set it 
at the VCL toolbar


[Libreoffice-commits] core.git: framework/source include/svx svx/source

2022-07-15 Thread Andrea Gelmini (via logerrit)
 framework/source/dispatch/interceptionhelper.cxx |2 +-
 include/svx/sdr/animation/animationstate.hxx |2 +-
 include/svx/xdash.hxx|2 +-
 svx/source/xoutdev/xattr.cxx |2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 75b410f1292fc9f794984583f734260e8a0378c6
Author: Andrea Gelmini 
AuthorDate: Thu Jul 14 13:46:04 2022 +0200
Commit: Julien Nabet 
CommitDate: Fri Jul 15 09:44:58 2022 +0200

Fix typo "vetor"->"vector"

Change-Id: Ie706797e1bda4d1cd279fa68e93fb15beabb6a2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137077
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/framework/source/dispatch/interceptionhelper.cxx 
b/framework/source/dispatch/interceptionhelper.cxx
index 57ab28ee4fa1..2fe3933bf7dd 100644
--- a/framework/source/dispatch/interceptionhelper.cxx
+++ b/framework/source/dispatch/interceptionhelper.cxx
@@ -235,7 +235,7 @@ void SAL_CALL InterceptionHelper::disposing(const 
css::lang::EventObject& aEvent
 
 // We need a full copy of all currently registered interceptor objects.
 // Otherwise we can't iterate over this vector without the risk, that our 
iterator will be invalid.
-// Because this vetor will be influenced by every deregistered interceptor.
+// Because this vector will be influenced by every deregistered 
interceptor.
 InterceptionHelper::InterceptorList aCopy = m_lInterceptionRegs;
 
 aReadLock.clear();
diff --git a/include/svx/sdr/animation/animationstate.hxx 
b/include/svx/sdr/animation/animationstate.hxx
index 92878897e072..a2e079725df3 100644
--- a/include/svx/sdr/animation/animationstate.hxx
+++ b/include/svx/sdr/animation/animationstate.hxx
@@ -33,7 +33,7 @@ namespace sdr::animation
 // the animated VOC
 sdr::contact::ViewObjectContact&mrVOContact;
 
-// the vetor of animated primitives
+// the vector of animated primitives
 drawinglayer::primitive2d::Primitive2DContainer  
maAnimatedPrimitives;
 
 // local helpers
diff --git a/include/svx/xdash.hxx b/include/svx/xdash.hxx
index e789830e2736..eef7d2f7fb2d 100644
--- a/include/svx/xdash.hxx
+++ b/include/svx/xdash.hxx
@@ -60,7 +60,7 @@ public:
 
 // XDash is translated into an array of doubles which describe the lengths 
of the
 // dashes, dots and empty passages. It returns the complete length of the 
full DashDot
-// sequence and fills the given vetor of doubles accordingly (also 
resizing, so deleting it).
+// sequence and fills the given vector of doubles accordingly (also 
resizing, so deleting it).
 double CreateDotDashArray(::std::vector< double >& rDotDashArray, double 
fLineWidth) const;
 };
 
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index aceba42bbb61..7d8c1395e584 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -434,7 +434,7 @@ bool XDash::operator==(const XDash& rDash) const
 
 // XDash is translated into an array of doubles which describe the lengths of 
the
 // dashes, dots and empty passages. It returns the complete length of the full 
DashDot
-// sequence and fills the given vetor of doubles accordingly (also resizing, 
so deleting it).
+// sequence and fills the given vector of doubles accordingly (also resizing, 
so deleting it).
 const double SMALLEST_DASH_WIDTH(26.95);
 
 double XDash::CreateDotDashArray(::std::vector< double >& rDotDashArray, 
double fLineWidth) const


[Libreoffice-commits] core.git: framework/source sw/sdi sw/source

2022-07-05 Thread Maxim Monastirsky (via logerrit)
 framework/source/uielement/generictoolbarcontroller.cxx |8 
 sw/sdi/_tabsh.sdi   |4 ++--
 sw/sdi/swriter.sdi  |4 ++--
 sw/source/uibase/shells/tabsh.cxx   |   10 ++
 4 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit b0a3245c63a2f77ce761ebd11820b341969a48b4
Author: Maxim Monastirsky 
AuthorDate: Tue Jul 5 01:03:07 2022 +0300
Commit: Maxim Monastirsky 
CommitDate: Tue Jul 5 13:40:53 2022 +0200

tdf#149741 Mirror insert column icons for RTL tables

The usual approach of setting the respective property
in *Commands.xcu won't work here, as that works with
the paragraph direction, which doesn't have to be the
same as the table direction.

Change-Id: I9c4d49a5c553a8a74e7760d257167a0be42c89c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136818
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/framework/source/uielement/generictoolbarcontroller.cxx 
b/framework/source/uielement/generictoolbarcontroller.cxx
index 25f2e0157e9e..e8e49cb30933 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -27,6 +27,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -218,6 +219,7 @@ void GenericToolbarController::statusChanged( const 
FeatureStateEvent& Event )
 ItemStatus  aItemState;
 Visibility  aItemVisibility;
 ControlCommand  aControlCommand;
+SfxImageItemaImageItem;
 
 if (( Event.State >>= bValue ) && !m_bEnumCommand )
 {
@@ -293,6 +295,12 @@ void GenericToolbarController::statusChanged( const 
FeatureStateEvent& Event )
 if ( m_bMadeInvisible )
 m_xToolbar->ShowItem( m_nID );
 }
+else if ( aImageItem.PutValue( Event.State, 0 ) )
+{
+m_xToolbar->SetItemImageMirrorMode( m_nID, aImageItem.IsMirrored() );
+if ( m_bMadeInvisible )
+m_xToolbar->ShowItem( m_nID );
+}
 else if ( m_bMadeInvisible )
 m_xToolbar->ShowItem( m_nID );
 
diff --git a/sw/sdi/_tabsh.sdi b/sw/sdi/_tabsh.sdi
index 5d4017b4790d..e4b6b9a2dd6c 100644
--- a/sw/sdi/_tabsh.sdi
+++ b/sw/sdi/_tabsh.sdi
@@ -141,7 +141,7 @@ interface BaseTextTable
 FN_TABLE_INSERT_COL_BEFORE // status(final|play)
 [
 ExecMethod = Execute ;
-StateMethod = NoState ;
+StateMethod = GetState ;
 DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
 ]
 
@@ -156,7 +156,7 @@ interface BaseTextTable
 FN_TABLE_INSERT_COL_AFTER // status(final|play)
 [
 ExecMethod = Execute ;
-StateMethod = NoState ;
+StateMethod = GetState ;
 DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
 ]
 
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index bf4ed3ec8b25..49fa8f2bb4e6 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -2643,7 +2643,7 @@ SfxVoidItem InsertColumnDialog FN_TABLE_INSERT_COL_DLG
 GroupId = SfxGroupId::Table;
 ]
 
-SfxVoidItem InsertColumnsBefore FN_TABLE_INSERT_COL_BEFORE
+SfxImageItem InsertColumnsBefore FN_TABLE_INSERT_COL_BEFORE
 ()
 [
 AutoUpdate = FALSE,
@@ -2680,7 +2680,7 @@ SfxVoidItem InsertColumns FN_TABLE_INSERT_COL
 GroupId = SfxGroupId::Table;
 ]
 
-SfxVoidItem InsertColumnsAfter FN_TABLE_INSERT_COL_AFTER
+SfxImageItem InsertColumnsAfter FN_TABLE_INSERT_COL_AFTER
 ()
 [
 AutoUpdate = FALSE,
diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index 3cbea6b77389..88a4c3e10c15 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1358,6 +1359,15 @@ void SwTableShell::GetState(SfxItemSet )
 }
 break;
 }
+case FN_TABLE_INSERT_COL_BEFORE:
+case FN_TABLE_INSERT_COL_AFTER:
+{
+SfxImageItem aImageItem(nSlot);
+if (pFormat->GetFrameDir().GetValue() == 
SvxFrameDirection::Horizontal_RL_TB)
+aImageItem.SetMirrored(true);
+rSet.Put(aImageItem);
+break;
+}
 case FN_TABLE_INSERT_ROW:
 case FN_TABLE_INSERT_ROW_AFTER:
 case FN_TABLE_INSERT_ROW_DLG:


[Libreoffice-commits] core.git: framework/source

2022-06-28 Thread Maxim Monastirsky (via logerrit)
 framework/source/uielement/newmenucontroller.cxx |   45 +--
 1 file changed, 2 insertions(+), 43 deletions(-)

New commits:
commit bdd217c1f23e0fb5f84542f1fb41036c3de538df
Author: Maxim Monastirsky 
AuthorDate: Mon Jun 27 12:27:35 2022 +0300
Commit: Maxim Monastirsky 
CommitDate: Tue Jun 28 13:55:56 2022 +0200

NewMenuController: Use status update to determine the default factory

This is a follow-up to 2446fdba3ec4a81d6e3b619a1d9e91b3c6dcbd54
("tdf#134887 Rework last item handling in NewToolbarController").
We should better get the information on what is going to be
executed from the entity that will actually execute it, instead
of guessing on our own. This makes a difference for at least
XML Form Document, where CTRL+N used to be shown next to the
"XML Form Document" entry, although pressing that shortcut
will open a regular writer doc.

Change-Id: Ib9b58ea2fb83a6cfe9a603af6be97fb36a25ddc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136554
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/framework/source/uielement/newmenucontroller.cxx 
b/framework/source/uielement/newmenucontroller.cxx
index d282509d93f5..14b59c263b85 100644
--- a/framework/source/uielement/newmenucontroller.cxx
+++ b/framework/source/uielement/newmenucontroller.cxx
@@ -40,7 +40,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -111,7 +110,6 @@ void NewMenuController::determineAndSetNewDocAccel(const 
css::awt::KeyEvent& rKe
 {
 sal_uInt16 nCount(m_xPopupMenu->getItemCount());
 sal_uInt16 nId( 0 );
-bool  bFound( false );
 OUString aCommand;
 
 if ( !m_aEmptyDocURL.isEmpty() )
@@ -127,34 +125,11 @@ void NewMenuController::determineAndSetNewDocAccel(const 
css::awt::KeyEvent& rKe
 if ( aCommand.startsWith( m_aEmptyDocURL ) )
 {
 m_xPopupMenu->setAcceleratorKeyEvent(nId, rKeyCode);
-bFound = true;
 break;
 }
 }
 }
 }
-
-if ( bFound )
-return;
-
-// Search for the default module name
-OUString aDefaultModuleName( SvtModuleOptions().GetDefaultModuleName() );
-if ( aDefaultModuleName.isEmpty() )
-return;
-
-for ( sal_uInt16 i = 0; i < nCount; i++ )
-{
-if (m_xPopupMenu->getItemType(i) != css::awt::MenuItemType_SEPARATOR)
-{
-nId = m_xPopupMenu->getItemId(i);
-aCommand = m_xPopupMenu->getCommand(nId);
-if ( aCommand.indexOf( aDefaultModuleName ) >= 0 )
-{
-m_xPopupMenu->setAcceleratorKeyEvent(nId, rKeyCode);
-break;
-}
-}
-}
 }
 
 void NewMenuController::setAccelerators()
@@ -372,8 +347,9 @@ void SAL_CALL NewMenuController::disposing( const 
EventObject& )
 }
 
 // XStatusListener
-void SAL_CALL NewMenuController::statusChanged( const FeatureStateEvent& )
+void SAL_CALL NewMenuController::statusChanged( const FeatureStateEvent& Event 
)
 {
+Event.State >>= m_aEmptyDocURL;
 }
 
 // XMenuListener
@@ -452,23 +428,6 @@ void NewMenuController::impl_setPopupMenu()
 {
 m_aModuleIdentifier = xModuleManager->identify( m_xFrame );
 m_bModuleIdentified = true;
-
-if ( !m_aModuleIdentifier.isEmpty() )
-{
-Sequence< PropertyValue > aSeq;
-
-if ( xModuleManager->getByName( m_aModuleIdentifier ) >>= aSeq )
-{
-for ( PropertyValue const & prop : std::as_const(aSeq) )
-{
-if ( prop.Name == "ooSetupFactoryEmptyDocumentURL" )
-{
-prop.Value >>= m_aEmptyDocURL;
-break;
-}
-}
-}
-}
 }
 catch ( const RuntimeException& )
 {


[Libreoffice-commits] core.git: framework/source

2022-06-17 Thread Maxim Monastirsky (via logerrit)
 framework/source/uielement/toolbarwrapper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 230a988c9011ffc365070acf9ecd750825b0b1ec
Author: Maxim Monastirsky 
AuthorDate: Thu Jun 16 13:24:24 2022 +0300
Commit: Maxim Monastirsky 
CommitDate: Fri Jun 17 14:00:14 2022 +0200

tdf#125040 Ignore the default context

This isn't a meaningful context, but a way to represent
a lack of context. Typically it's a temporary state,
followed by a proper context being set. The problem
becomes apparent when a context deactivation is caused
by switching to another document window, as the further
activation will happen only when the former window is
focused again. This makes the contextual controls
disappear in the meantime.

Change-Id: I96c8356acb2434c579dc74407043b55eb5374a0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136010
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/framework/source/uielement/toolbarwrapper.cxx 
b/framework/source/uielement/toolbarwrapper.cxx
index 9acbe7ca7b55..8f3937ef094f 100644
--- a/framework/source/uielement/toolbarwrapper.cxx
+++ b/framework/source/uielement/toolbarwrapper.cxx
@@ -269,7 +269,7 @@ void SAL_CALL ToolBarWrapper::notifyContextChangeEvent( 
const ContextChangeEvent
 if ( m_bDisposed )
 throw DisposedException();
 
-if ( aEvent.ContextName.isEmpty() )
+if ( aEvent.ContextName.isEmpty() || aEvent.ContextName == "default" )
 return;
 
 const OUString aContextToolbar( m_aResourceURL + "-" + 
aEvent.ContextName.toAsciiLowerCase() );


[Libreoffice-commits] core.git: framework/source

2022-06-16 Thread Maxim Monastirsky (via logerrit)
 framework/source/uielement/toolbarwrapper.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 48ca2336251d62ac2e90300cd9945fb84b1cddd8
Author: Maxim Monastirsky 
AuthorDate: Thu Jun 16 01:07:31 2022 +0300
Commit: Maxim Monastirsky 
CommitDate: Thu Jun 16 14:00:12 2022 +0200

tdf#125040 Avoid flickering on context change

Change-Id: I442fada34e10fe13e68987abba34969a8ab50bc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135958
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/framework/source/uielement/toolbarwrapper.cxx 
b/framework/source/uielement/toolbarwrapper.cxx
index 146cddf2867d..9acbe7ca7b55 100644
--- a/framework/source/uielement/toolbarwrapper.cxx
+++ b/framework/source/uielement/toolbarwrapper.cxx
@@ -130,6 +130,8 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< 
Any >& aArguments )
 catch( const Exception& )
 {
 }
+// Avoid flickering on context change
+bPopupMode = true;
 }
 
 // Create VCL based toolbar which will be filled with settings data


[Libreoffice-commits] core.git: framework/source

2022-06-15 Thread Samuel Mehrbrodt (via logerrit)
 framework/source/dispatch/closedispatcher.cxx |   13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 539374caa5deac788f394a54a75b6e167ab04864
Author: Samuel Mehrbrodt 
AuthorDate: Wed Jun 15 14:25:36 2022 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Wed Jun 15 20:53:45 2022 +0200

Show start center when closing last document

also when there are active UNO connections.

(Behavior was different when there were active UNO connections)

Change-Id: Ief37b0f362b7e2a47eccbec985ee3017c475046c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135905
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/framework/source/dispatch/closedispatcher.cxx 
b/framework/source/dispatch/closedispatcher.cxx
index 19fe9ffaa69d..a6ff39d459c3 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -353,12 +353,17 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, 
LinkParamNone*, void)
 // application or establish the backing mode now.
 // And that depends from the dispatched URL ...
 {
-if (bHasActiveConnections)
-bCloseFrame = true;
-else if (eOperation == E_CLOSE_FRAME)
-bTerminateApp = true;
+if (eOperation == E_CLOSE_FRAME)
+{
+if (bHasActiveConnections)
+bCloseFrame = true;
+else
+bTerminateApp = true;
+}
 else if( 
SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::STARTMODULE) )
 bEstablishBackingMode = true;
+else if (bHasActiveConnections)
+bCloseFrame = true;
 else
 bTerminateApp = true;
 }


[Libreoffice-commits] core.git: framework/source

2022-05-31 Thread Stephan Bergmann (via logerrit)
 framework/source/xml/imagesdocumenthandler.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 52da30cd18990c47b5cea0e789f3d1f76c2a9e1b
Author: Stephan Bergmann 
AuthorDate: Tue May 31 15:51:09 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Tue May 31 19:07:51 2022 +0200

Drop unnecessary cast to int

...when iterating over the enumerators of enum Image_XML_Entry

Change-Id: Ic59da7543a41f8b498d6f89e48faafcdf40c6873
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135194
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/framework/source/xml/imagesdocumenthandler.cxx 
b/framework/source/xml/imagesdocumenthandler.cxx
index 30f178416cae..ebdd5366f240 100644
--- a/framework/source/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
@@ -98,7 +98,7 @@ OReadImagesDocumentHandler::OReadImagesDocumentHandler( 
ImageItemDescriptorList&
 m_rImageList( rItems )
 {
 // create hash map to speed up lookup
-for ( int i = 0; i < int(IMG_XML_ENTRY_COUNT); i++ )
+for ( int i = 0; i < IMG_XML_ENTRY_COUNT; i++ )
 {
 OUStringBuffer temp( 20 );
 


[Libreoffice-commits] core.git: framework/source include/framework offapi/com offapi/UnoApi_offapi.mk sdext/source

2022-05-30 Thread Miklos Vajna (via logerrit)
 framework/source/dispatch/dispatchprovider.cxx  |5 +-
 include/framework/dispatchhelper.hxx|   10 -
 offapi/UnoApi_offapi.mk |1 
 offapi/com/sun/star/util/XCacheInfo.idl |   40 
 sdext/source/presenter/PresenterProtocolHandler.hxx |8 ++--
 5 files changed, 48 insertions(+), 16 deletions(-)

New commits:
commit b3f2ae52e381f7d5fa466dc9df7d04d3d13ca4b9
Author: Miklos Vajna 
AuthorDate: Mon May 30 11:08:12 2022 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 30 12:08:03 2022 +0200

framework: fix crash on Writer startup when using 
--enable-ext-wiki-publisher

As reported by Julien, once the mediawiki extension is installed, the
xHandler in framework::DispatchProvider::implts_searchProtocolHandler()
points to an UNO component implemented in Java, and we crash in
dynamic_cast<>(), at least on Linux with gcc 7.5 and libstdc++.

This dynamic_cast<>() call was added in commit
c0fa456436947a5c167c652d19a884064b43c03d (tdf#149261 sdext: fix crash on
starting the presenter console for the 2nd time, 2022-05-26), to allow
the presenter console to opt out from protocol handler caching. It was
expected that the proxy object created for a Java UNO component would
simply return nullptr when we try to dynamic_cast<>() it down to a C++
interface.

Fix the problem by moving the interface to an UNO one: this side-steps
the dynamic_cast<>() crash at the price of introducing an UNO interface,
which is not meant to be part of the public UNO API (but at least it's
not published).

It may still make sense to improve the bridges/ code at some stage to
not crash in dynamic_cast<>() on generated Java proxy objects.

Change-Id: Iaac44515339e0dc15dddc3be45ef7dee7331e47a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135114
Reviewed-by: Miklos Vajna 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/framework/source/dispatch/dispatchprovider.cxx 
b/framework/source/dispatch/dispatchprovider.cxx
index c16a0085a0a5..1c214ddaa48f 100644
--- a/framework/source/dispatch/dispatchprovider.cxx
+++ b/framework/source/dispatch/dispatchprovider.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -454,8 +455,8 @@ css::uno::Reference< css::frame::XDispatch > 
DispatchProvider::implts_searchProt
 css::uno::UNO_QUERY);
 
 // Check if the handler explicitly requested to avoid 
caching.
-auto pCacheInfo = 
dynamic_cast(xHandler.get());
-if (!pCacheInfo || pCacheInfo->IsCachingAllowed())
+css::uno::Reference 
xCacheInfo(xHandler, css::uno::UNO_QUERY);
+if (!xCacheInfo.is() || xCacheInfo->isCachingAllowed())
 {
 m_aProtocolHandlers.emplace(aHandler.m_sUNOName, 
xHandler);
 }
diff --git a/include/framework/dispatchhelper.hxx 
b/include/framework/dispatchhelper.hxx
index 1595e2a3cea2..7c89a2d79aac 100644
--- a/include/framework/dispatchhelper.hxx
+++ b/include/framework/dispatchhelper.hxx
@@ -104,16 +104,6 @@ public:
 // XEventListener
 virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) 
override;
 };
-
-/// Interface that allows a protocol handler implementation to opt out from 
framework caching.
-class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI CacheInfo
-{
-public:
-virtual bool IsCachingAllowed() const = 0;
-
-protected:
-~CacheInfo() noexcept = default;
-};
 }
 
 #endif
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index a9b92639a667..5f0ae2e84d56 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -4157,6 +4157,7 @@ $(eval $(call 
gb_UnoApi_add_idlfiles,offapi,com/sun/star/util,\
XAtomServer \
XBinaryDataContainer \
XBroadcaster \
+   XCacheInfo \
XCancellable \
XChainable \
XChangesBatch \
diff --git a/offapi/com/sun/star/util/XCacheInfo.idl 
b/offapi/com/sun/star/util/XCacheInfo.idl
new file mode 100644
index ..299d49690246
--- /dev/null
+++ b/offapi/com/sun/star/util/XCacheInfo.idl
@@ -0,0 +1,40 @@
+/* -*- 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 

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

2022-05-27 Thread Michael Stahl (via logerrit)
 framework/source/uielement/recentfilesmenucontroller.cxx |7 +--
 sfx2/source/control/recentdocsviewitem.cxx   |6 +-
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 34eea317c5929d640aa43477c737d26d6b700bdb
Author: Michael Stahl 
AuthorDate: Fri May 27 19:31:01 2022 +0200
Commit: Michael Stahl 
CommitDate: Fri May 27 20:26:52 2022 +0200

tdf#149170 framework,sfx2: don't add ReadOnly=false

There is a non-obvious difference in error handling when opening the
file read/write for type-detection fails in
utl::MediaDescriptor::impl_openStreamWithURL() - if ReadOnly=false is
given, it will abort the file loading, whereas without any ReadOnly it
will fall-back to a read-only opening of the file for type detection.

At this point a StillReadWriteInteraction is used, so the user is never
notified of the failure.

(regression from commit 404c51f3664ffd4f7e2c1c8bb8a12ac70954fec2)

Change-Id: I8c06fe23cc0bc0767df83f680a1a59e3700b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135045
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx 
b/framework/source/uielement/recentfilesmenucontroller.cxx
index 2fbad67becd9..dc4001a1f645 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -264,14 +264,17 @@ void RecentFilesMenuController::executeEntry( sal_Int32 
nIndex )
 Sequence< PropertyValue > aArgsList{
 comphelper::makePropertyValue("Referer", OUString( "private:user" )),
 
-comphelper::makePropertyValue("ReadOnly", 
m_aRecentFilesItems[nIndex].second),
-
 // documents in the picklist will never be opened as templates
 comphelper::makePropertyValue("AsTemplate", false),
 
 // Type detection needs to know which app we are opening it from.
 comphelper::makePropertyValue("DocumentService", m_aModuleName)
 };
+if (m_aRecentFilesItems[nIndex].second) // tdf#149170 only add if true
+{
+aArgsList.realloc(aArgsList.size()+1);
+aArgsList.getArray()[aArgsList.size()-1] = 
comphelper::makePropertyValue("ReadOnly", true);
+}
 dispatchCommand(m_aRecentFilesItems[nIndex].first, aArgsList, "_default");
 }
 
diff --git a/sfx2/source/control/recentdocsviewitem.cxx 
b/sfx2/source/control/recentdocsviewitem.cxx
index 0cdf74418d05..44f103dfbfa4 100644
--- a/sfx2/source/control/recentdocsviewitem.cxx
+++ b/sfx2/source/control/recentdocsviewitem.cxx
@@ -320,9 +320,13 @@ void RecentDocsViewItem::OpenDocument()
 xTrans->parseStrict(aTargetURL);
 
 aArgsList = { comphelper::makePropertyValue("Referer", 
OUString("private:user")),
-  comphelper::makePropertyValue("ReadOnly", m_isReadOnly),
   // documents will never be opened as templates
   comphelper::makePropertyValue("AsTemplate", false) };
+if (m_isReadOnly) // tdf#149170 only add if true
+{
+aArgsList.realloc(aArgsList.size()+1);
+aArgsList.getArray()[aArgsList.size()-1] = 
comphelper::makePropertyValue("ReadOnly", true);
+}
 
 xDispatch = xDesktop->queryDispatch(aTargetURL, "_default", 0);
 


[Libreoffice-commits] core.git: framework/source include/framework sdext/source

2022-05-26 Thread Miklos Vajna (via logerrit)
 framework/source/dispatch/dispatchprovider.cxx  |9 -
 include/framework/dispatchhelper.hxx|   10 ++
 sdext/source/presenter/PresenterProtocolHandler.hxx |5 +
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit c0fa456436947a5c167c652d19a884064b43c03d
Author: Miklos Vajna 
AuthorDate: Thu May 26 13:57:12 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu May 26 15:09:30 2022 +0200

tdf#149261 sdext: fix crash on starting the presenter console for the 2nd 
time

This started with commit 3f768cddd28a2f04eb1ffa30bed4474deb6fbfc4
(framework: avoid re-creating protocol handler instances all the time,
2022-05-02). In case there are 2 monitors, then one monitor shows the
slideshow, the other shows the presenter console. The presenter
console's protocol handler in
sdext::presenter::PresenterProtocolHandler::Dispatch::Dispatch() has
mpPresenterController->GetWindowManager() as an empty reference on the
2nd time the presentation starts.

The above commit started to cache protocol handler instances at a frame
level for performance reasons, and this is meant to be safe in general,
but the presenter console's window manager is re-created between
slideshow runs, so it depends on framework/ code to re-create the
protocol handler all the time, which is problematic here.

Fix the problem by introducing a framework::CacheInfo interface that
allows protocol handler implementations to signal if they want to avoid
being cached.

This should be good enough for now, but if later it turns out that there
are too many broken protocol handlers out there, then we can consider
flipping the default and only cache handlers which explicitly opt in for
this behavior. This is not done in this commit.

Change-Id: Ic159813b1b339540bc8c4e780c4d6d7d2d4d2445
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135020
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/framework/source/dispatch/dispatchprovider.cxx 
b/framework/source/dispatch/dispatchprovider.cxx
index bcfa07bb333a..c16a0085a0a5 100644
--- a/framework/source/dispatch/dispatchprovider.cxx
+++ b/framework/source/dispatch/dispatchprovider.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace framework{
 
@@ -451,7 +452,13 @@ css::uno::Reference< css::frame::XDispatch > 
DispatchProvider::implts_searchProt
 
css::uno::Reference(m_xContext->getServiceManager(),
 css::uno::UNO_QUERY_THROW)
   ->createInstance(aHandler.m_sUNOName),
 css::uno::UNO_QUERY);
-m_aProtocolHandlers.emplace(aHandler.m_sUNOName, xHandler);
+
+// Check if the handler explicitly requested to avoid 
caching.
+auto pCacheInfo = 
dynamic_cast(xHandler.get());
+if (!pCacheInfo || pCacheInfo->IsCachingAllowed())
+{
+m_aProtocolHandlers.emplace(aHandler.m_sUNOName, 
xHandler);
+}
 }
 else
 {
diff --git a/include/framework/dispatchhelper.hxx 
b/include/framework/dispatchhelper.hxx
index 7c89a2d79aac..1595e2a3cea2 100644
--- a/include/framework/dispatchhelper.hxx
+++ b/include/framework/dispatchhelper.hxx
@@ -104,6 +104,16 @@ public:
 // XEventListener
 virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) 
override;
 };
+
+/// Interface that allows a protocol handler implementation to opt out from 
framework caching.
+class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI CacheInfo
+{
+public:
+virtual bool IsCachingAllowed() const = 0;
+
+protected:
+~CacheInfo() noexcept = default;
+};
 }
 
 #endif
diff --git a/sdext/source/presenter/PresenterProtocolHandler.hxx 
b/sdext/source/presenter/PresenterProtocolHandler.hxx
index 3a5e33f3b8a6..eaced08d9e6a 100644
--- a/sdext/source/presenter/PresenterProtocolHandler.hxx
+++ b/sdext/source/presenter/PresenterProtocolHandler.hxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace sdext::presenter {
 
@@ -40,6 +41,7 @@ class PresenterController;
 
 class PresenterProtocolHandler
 : protected ::cppu::BaseMutex,
+  public framework::CacheInfo,
   public PresenterProtocolHandlerInterfaceBase
 {
 public:
@@ -71,6 +73,9 @@ public:
 queryDispatches(
 const css::uno::Sequence< css::frame::DispatchDescriptor>& 
rDescriptors) override;
 
+/// See framework::CacheInfo::IsCachingAllowed().
+bool IsCachingAllowed() const override { return false; }
+
 private:
 class Dispatch;
 ::rtl::Reference mpPresenterController;


[Libreoffice-commits] core.git: framework/source

2022-05-25 Thread Noel Grandin (via logerrit)
 framework/source/services/pathsettings.cxx |   23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

New commits:
commit 2e2304f00960d8e0e8c3ff76e632ef8f92608084
Author: Noel Grandin 
AuthorDate: Wed May 25 09:25:03 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed May 25 13:01:35 2022 +0200

elide temporary vector in PathSettings::impl_convertPath2OldStyle

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

diff --git a/framework/source/services/pathsettings.cxx 
b/framework/source/services/pathsettings.cxx
index b5c30dc25809..aedaf3a31d67 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -942,30 +942,25 @@ void PathSettings::impl_subst(PathSettings::PathInfo& 
aPath   ,
 
 OUString PathSettings::impl_convertPath2OldStyle(const PathSettings::PathInfo& 
rPath) const
 {
-std::vector lTemp;
-lTemp.reserve(rPath.lInternalPaths.size() + rPath.lUserPaths.size() + 1);
+OUStringBuffer sPathVal(256);
 
 for (auto const& internalPath : rPath.lInternalPaths)
 {
-lTemp.push_back(internalPath);
+if (sPathVal.getLength())
+sPathVal.append(";");
+sPathVal.append(internalPath);
 }
 for (auto const& userPath : rPath.lUserPaths)
 {
-lTemp.push_back(userPath);
+if (sPathVal.getLength())
+sPathVal.append(";");
+sPathVal.append(userPath);
 }
-
 if (!rPath.sWritePath.isEmpty())
-lTemp.push_back(rPath.sWritePath);
-
-OUStringBuffer sPathVal(256);
-for (  auto pIt  = lTemp.begin();
-   pIt != lTemp.end();
-   )
 {
-sPathVal.append(*pIt);
-++pIt;
-if (pIt != lTemp.end())
+if (sPathVal.getLength())
 sPathVal.append(";");
+sPathVal.append(rPath.sWritePath);
 }
 
 return sPathVal.makeStringAndClear();


[Libreoffice-commits] core.git: framework/source

2022-05-23 Thread Tünde Tóth (via logerrit)
 framework/source/services/autorecovery.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit aeb8a0076cd5ec2836b3dfc1adffcced432f995f
Author: Tünde Tóth 
AuthorDate: Thu May 19 15:14:20 2022 +0200
Commit: László Németh 
CommitDate: Mon May 23 08:59:45 2022 +0200

tdf#149176 tdf#149178 fix Save autorecovery information.. option

Autorecovery information was saved in every 10 minutes,
regardless of the "Save Autorecovery information every" setting.

Change-Id: I1a52da2fa5febb53c270a8db7472e9a8c0e4c426
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134642
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index ffc426a21d19..d4b68b11c994 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -96,6 +96,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1751,7 +1752,7 @@ void AutoRecovery::implts_readAutoSaveConfig()
 implts_openConfig();
 
 // AutoSave [bool]
-bool bEnabled(officecfg::Office::Recovery::AutoSave::Enabled::get());
+bool bEnabled(officecfg::Office::Common::Save::Document::AutoSave::get());
 
 /* SAFE */ {
 osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);
@@ -1779,7 +1780,8 @@ void AutoRecovery::implts_readAutoSaveConfig()
 } /* SAFE */
 
 // AutoSaveTimeIntervall [int] in min
-sal_Int32 
nTimeIntervall(officecfg::Office::Recovery::AutoSave::TimeIntervall::get());
+sal_Int32 nTimeIntervall(
+
officecfg::Office::Common::Save::Document::AutoSaveTimeIntervall::get());
 
 /* SAFE */ {
 osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex);


[Libreoffice-commits] core.git: framework/source i18npool/source package/source sfx2/source unotools/source

2022-05-17 Thread Noel Grandin (via logerrit)
 framework/source/uielement/uicommanddescription.cxx |   21 
+++--
 i18npool/source/characterclassification/characterclassificationImpl.cxx |3 
 package/source/xstor/owriteablestream.cxx   |4 
-
 sfx2/source/doc/SfxDocumentMetaData.cxx |   40 
+-
 unotools/source/config/eventcfg.cxx |8 
+-
 5 files changed, 46 insertions(+), 30 deletions(-)

New commits:
commit 429a960e157f3375e795cdec8f265ace1c5bdc9e
Author: Noel Grandin 
AuthorDate: Sun May 15 21:20:30 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue May 17 18:45:56 2022 +0200

elide some OUString allocation

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

diff --git a/framework/source/uielement/uicommanddescription.cxx 
b/framework/source/uielement/uicommanddescription.cxx
index 793bc9db8fe0..8054cf4bff8d 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -266,17 +266,24 @@ Any ConfigurationAccess_UICommand::getSequenceFromCache( 
const OUString& aComman
 if ( !pIter->second.bCommandNameCreated )
 fillInfoFromResult( pIter->second, pIter->second.aLabel );
 
+static constexpr OUStringLiteral sLabel = u"Label";
+static constexpr OUStringLiteral sName = u"Name";
+static constexpr OUStringLiteral sPopup = u"Popup";
+static constexpr OUStringLiteral sPopupLabel = u"PopupLabel";
+static constexpr OUStringLiteral sTooltipLabel = u"TooltipLabel";
+static constexpr OUStringLiteral sTargetURL = u"TargetURL";
+static constexpr OUStringLiteral sIsExperimental = u"IsExperimental";
 Sequence< PropertyValue > aPropSeq{
-comphelper::makePropertyValue("Label", 
!pIter->second.aContextLabel.isEmpty()
+comphelper::makePropertyValue(sLabel, 
!pIter->second.aContextLabel.isEmpty()
? 
Any(pIter->second.aContextLabel)
: 
Any(pIter->second.aLabel)),
-comphelper::makePropertyValue("Name", pIter->second.aCommandName),
-comphelper::makePropertyValue("Popup", pIter->second.bPopup),
+comphelper::makePropertyValue(sName, pIter->second.aCommandName),
+comphelper::makePropertyValue(sPopup, pIter->second.bPopup),
 comphelper::makePropertyValue(m_aPropProperties, 
pIter->second.nProperties),
-comphelper::makePropertyValue("PopupLabel", 
pIter->second.aPopupLabel),
-comphelper::makePropertyValue("TooltipLabel", 
pIter->second.aTooltipLabel),
-comphelper::makePropertyValue("TargetURL", 
pIter->second.aTargetURL),
-comphelper::makePropertyValue("IsExperimental", 
pIter->second.bIsExperimental)
+comphelper::makePropertyValue(sPopupLabel, 
pIter->second.aPopupLabel),
+comphelper::makePropertyValue(sTooltipLabel, 
pIter->second.aTooltipLabel),
+comphelper::makePropertyValue(sTargetURL, 
pIter->second.aTargetURL),
+comphelper::makePropertyValue(sIsExperimental, 
pIter->second.bIsExperimental)
 };
 return Any( aPropSeq );
 }
diff --git 
a/i18npool/source/characterclassification/characterclassificationImpl.cxx 
b/i18npool/source/characterclassification/characterclassificationImpl.cxx
index 8146612a87fc..aff424d8bef7 100644
--- a/i18npool/source/characterclassification/characterclassificationImpl.cxx
+++ b/i18npool/source/characterclassification/characterclassificationImpl.cxx
@@ -32,7 +32,8 @@ namespace i18npool {
 CharacterClassificationImpl::CharacterClassificationImpl(
 const Reference < XComponentContext >& rxContext ) : m_xContext( 
rxContext )
 {
-if (createLocaleSpecificCharacterClassification("Unicode", Locale()))
+static constexpr OUStringLiteral sUnicode = u"Unicode";
+if (createLocaleSpecificCharacterClassification(sUnicode, Locale()))
 xUCI = cachedItem->xCI;
 }
 
diff --git a/package/source/xstor/owriteablestream.cxx 
b/package/source/xstor/owriteablestream.cxx
index 2a4f1de3f9ef..8f9a93a2cc11 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -2771,8 +2771,8 @@ void SAL_CALL OWriteStream::setPropertyValue( const 
OUString& aPropertyName, con
 }
 
 m_pImpl->GetStreamProperties();
-OUString aCompressedString( "Compressed" );
-OUString aMediaTypeString( "MediaType" );
+static constexpr OUStringLiteral aCompressedString( u"Compressed" );
+static constexpr OUStringLiteral aMediaTypeString( u"MediaType" );
 if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && 
aPropertyName == aMediaTypeString )
 {
 // if the 

[Libreoffice-commits] core.git: framework/source sc/qa sc/source

2022-05-17 Thread László Németh (via logerrit)
 framework/source/services/autorecovery.cxx |   17 -
 sc/qa/uitest/calc_tests9/tdf123877.py  |   52 +
 sc/qa/uitest/data/tdf123877.xlsx   |binary
 sc/source/ui/docshell/docsh.cxx|   13 +++
 4 files changed, 81 insertions(+), 1 deletion(-)

New commits:
commit 6af4c1d097dfba897e305a1e57d1e920f36ce264
Author: László Németh 
AuthorDate: Mon May 16 16:05:59 2022 +0200
Commit: László Németh 
CommitDate: Tue May 17 15:36:00 2022 +0200

tdf#123877 sc XLSX: don't freeze during saving recovery

file by asking password re-typing unstoppably. Instead
of this, skip recovery file saving, if the document
contains password hashes which haven't been supported
by the "calc8" filter of the recovery file (which
triggered the "Re-type password" dialog).

Solved problems:

– Asking for passwords during a non-interactive
  background process.

– A single Cancel didn't close the "Re-type password" dialog
  window, only pressing three times at least (according to the
  value of RETRY_STORE_ON_MIGHT_FULL_DISC_USEFULL), but
  waiting for the password for a while could result a
  frozen "Re-type password" dialog, where only retyping or
  removing the password(s) were the escape routes.

– Re-typing the password required the password (but modifying
  the original document doesn't require this).

– Removing the password resulted in loss of the protection
  after saving the original XLSX document.

Add a UI test to keep the "Re-type password" dialog during Save As.

Note: because of the regression reported in tdf#145757, it needs
to wait 10 min for saving the recovery file, yet, despite the
changed time in Tools->Options->Load/Save->General.

Change-Id: Icc6ee4d67048cdf15ab75ef8e2ee8f1709cdd4c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134409
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index e3321773256f..ffc426a21d19 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -55,6 +55,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -86,6 +87,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -3053,10 +3055,23 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
 nRetry = 0;
 #endif // TRIGGER_FULL_DISC_CHECK
 }
-catch(const css::uno::Exception&)
+catch(const css::uno::Exception& rException)
 {
 bError = true;
 
+// skip saving XLSX with protected sheets, if their passwords 
haven't supported yet
+if ( rException.Message.startsWith("SfxBaseModel::impl_store") )
+{
+const css::task::ErrorCodeIOException& pErrorCodeIOException =
+static_cast(rException);
+if ( static_cast(pErrorCodeIOException.ErrCode) == 
ERRCODE_SFX_WRONGPASSWORD )
+{
+// stop and remove the bad temporary file, instead of 
filling the disk with them
+bError = false;
+break;
+}
+}
+
 // a) FULL DISC seems to be the problem behind 
 => show error and retry it forever (e.g. retry=300)
 // b) unknown problem (may be locking problem) 
 => reset RETRY value to more useful value(!) (e.g. retry=3)
 // c) unknown problem (may be locking problem) + 1..2 repeating 
operations  => throw the original exception to force generation of a stacktrace 
!
diff --git a/sc/qa/uitest/calc_tests9/tdf123877.py 
b/sc/qa/uitest/calc_tests9/tdf123877.py
new file mode 100644
index ..5162f88d9b78
--- /dev/null
+++ b/sc/qa/uitest/calc_tests9/tdf123877.py
@@ -0,0 +1,52 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+
+from uitest.framework import UITestCase
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from uitest.uihelper.common import select_by_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from org.libreoffice.unotest import systemPathToFileUrl
+from tempfile import TemporaryDirectory
+import os.path
+
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import 

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

2022-05-17 Thread Noel Grandin (via logerrit)
 framework/source/fwi/threadhelp/transactionmanager.cxx |8 
 include/framework/transactionmanager.hxx   |4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 8a29fb309878ccf4ad880b02d544ddf4e207116c
Author: Noel Grandin 
AuthorDate: Mon May 16 11:11:04 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue May 17 08:09:33 2022 +0200

osl::Mutex->std::mutex in framework::TransactionManager

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

diff --git a/framework/source/fwi/threadhelp/transactionmanager.cxx 
b/framework/source/fwi/threadhelp/transactionmanager.cxx
index 21c8fb69bf13..86d5b354a064 100644
--- a/framework/source/fwi/threadhelp/transactionmanager.cxx
+++ b/framework/source/fwi/threadhelp/transactionmanager.cxx
@@ -71,7 +71,7 @@ void  TransactionManager::setWorkingMode( EWorkingMode eMode )
 // Safe member access.
 bool bWaitFor = false;
 {
-osl::MutexGuard aAccessGuard(m_aAccessLock);
+std::unique_lock aAccessGuard(m_aAccessLock);
 // Change working mode first!
 if (
 (m_eWorkingMode == E_INIT && eMode == E_WORK) ||
@@ -137,7 +137,7 @@ void  TransactionManager::setWorkingMode( EWorkingMode 
eMode )
 EWorkingMode TransactionManager::getWorkingMode() const
 {
 // Synchronize access to internal member!
-::osl::MutexGuard aAccessLock( m_aAccessLock );
+std::unique_lock aAccessLock( m_aAccessLock );
 return m_eWorkingMode;
 }
 
@@ -154,7 +154,7 @@ EWorkingMode TransactionManager::getWorkingMode() const
 
*//*-*/
 void  TransactionManager::registerTransaction( EExceptionMode eMode )
 {
-::osl::MutexGuard aAccessGuard( m_aAccessLock );
+std::unique_lock aAccessGuard( m_aAccessLock );
 switch( m_eWorkingMode )
 {
 case E_INIT:
@@ -201,7 +201,7 @@ void  TransactionManager::unregisterTransaction()
 {
 // This call could not rejected!
 // Safe access to internal member.
-::osl::MutexGuard aAccessGuard( m_aAccessLock );
+std::unique_lock aAccessGuard( m_aAccessLock );
 
 // Deregister this transaction.
 // If it was the last one ... open gate to enable changing of working mode!
diff --git a/include/framework/transactionmanager.hxx 
b/include/framework/transactionmanager.hxx
index d6a07293a976..fe011968cf32 100644
--- a/include/framework/transactionmanager.hxx
+++ b/include/framework/transactionmanager.hxx
@@ -19,7 +19,7 @@
 
 #pragma once
 
-#include 
+#include 
 
 #include "gate.hxx"
 
@@ -111,7 +111,7 @@ class TransactionManager
 
 private:
 
-mutable ::osl::Mutexm_aAccessLock;   /// regulate access on 
internal member of this instance
+mutable std::mutex  m_aAccessLock;   /// regulate access on 
internal member of this instance
 Gatem_aBarrier;   /// used to block transactions 
requests during change or work mode
 EWorkingModem_eWorkingMode;   /// current working mode of 
object which use this manager (used to reject calls at wrong time)
 sal_Int32   m_nTransactionCount;   /// every transaction 
request is registered by this counter


  1   2   3   4   5   6   7   >