[Libreoffice-commits] core.git: comphelper/source include/comphelper sc/source vcl/unx

2023-05-05 Thread Noel Grandin (via logerrit)
 comphelper/source/misc/accessiblecomponenthelper.cxx |3 -
 comphelper/source/misc/accessibleeventnotifier.cxx   |   17 ++-
 include/comphelper/accessiblecomponenthelper.hxx |3 -
 sc/source/ui/Accessibility/AccessibleDocument.cxx|2 
 vcl/unx/gtk3/a11y/atklistener.cxx|   42 +--
 5 files changed, 51 insertions(+), 16 deletions(-)

New commits:
commit 2361718a34ee4ef47901846cb35eea4552bca46b
Author: Noel Grandin 
AuthorDate: Fri May 5 12:11:34 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri May 5 14:39:58 2023 +0200

tdf#155149 Crash when exiting cell edit mode

regression from
commit 2dc240a82646fc23c673a6fd5a29ade934dd5b67
Author: Noel Grandin 
Date:   Tue May 2 14:47:43 2023 +0200
improve AccessibleEventNotifier::addEvent
and
commit 3b7db802731826b6cc3b55100470b0c61c1f2dfa
Author: Noel Grandin 
Date:   Thu May 4 10:06:14 2023 +0200
tdf#105404 [API CHANGE] add index to accessiblity change event

(*) Send better index hints
(*) Error check the index hints better
(*) Convert asserts to warnings and fall back to old code when
index hint is wrong.

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

diff --git a/comphelper/source/misc/accessiblecomponenthelper.cxx 
b/comphelper/source/misc/accessiblecomponenthelper.cxx
index 816b3b69ee0c..07d05d31a31d 100644
--- a/comphelper/source/misc/accessiblecomponenthelper.cxx
+++ b/comphelper/source/misc/accessiblecomponenthelper.cxx
@@ -113,7 +113,7 @@ namespace comphelper
 
 
 void OCommonAccessibleComponent::NotifyAccessibleEvent( const sal_Int16 
_nEventId,
-const Any& _rOldValue, const Any& _rNewValue )
+const Any& _rOldValue, const Any& _rNewValue, sal_Int32 nIndexHint )
 {
 if ( !m_nClientId )
 // if we don't have a client id for the notifier, then we don't 
have listeners, then
@@ -126,6 +126,7 @@ namespace comphelper
 aEvent.EventId = _nEventId;
 aEvent.OldValue = _rOldValue;
 aEvent.NewValue = _rNewValue;
+aEvent.IndexHint = nIndexHint;
 
 // let the notifier handle this event
 AccessibleEventNotifier::addEvent( m_nClientId, aEvent );
diff --git a/comphelper/source/misc/accessibleeventnotifier.cxx 
b/comphelper/source/misc/accessibleeventnotifier.cxx
index d146d11812ba..37c9edda2625 100644
--- a/comphelper/source/misc/accessibleeventnotifier.cxx
+++ b/comphelper/source/misc/accessibleeventnotifier.cxx
@@ -246,8 +246,21 @@ void AccessibleEventNotifier::addEvent( const TClientId 
_nClient, const Accessib
 return;
 
 // since we're synchronous, again, we want to notify immediately
-aClientPos->second.notifyEach(aGuard, 
::notifyEvent, _rEvent);
-
+OInterfaceIteratorHelper4 aIt(aGuard, aClientPos->second);
+// no need to hold lock here, and we don't want to hold lock while calling 
listeners
+aGuard.unlock();
+while (aIt.hasMoreElements())
+{
+try
+{
+aIt.next()->notifyEvent(_rEvent);
+}
+catch (Exception&)
+{
+// no assertion, because a broken access remote bridge or 
something like this
+// can cause this exception
+}
+}
 }
 
 } // namespace comphelper
diff --git a/include/comphelper/accessiblecomponenthelper.hxx 
b/include/comphelper/accessiblecomponenthelper.hxx
index 2a840ea9e36e..328d61316b15 100644
--- a/include/comphelper/accessiblecomponenthelper.hxx
+++ b/include/comphelper/accessiblecomponenthelper.hxx
@@ -128,7 +128,8 @@ namespace comphelper
 void NotifyAccessibleEvent(
 const sal_Int16 _nEventId,
 const css::uno::Any& _rOldValue,
-const css::uno::Any& _rNewValue
+const css::uno::Any& _rNewValue,
+sal_Int32 nIndexHint = -1
 );
 
 // life time control
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 6d5dacede496..870851691a43 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -2136,6 +2136,7 @@ void ScAccessibleDocument::AddChild(const 
uno::Reference& xAcc, boo
 aEvent.Source = uno::Reference(this);
 aEvent.EventId = AccessibleEventId::CHILD;
 aEvent.NewValue <<= mxTempAcc;
+aEvent.IndexHint = getAccessibleChildCount() - 1;
 CommitChange( aEvent );
 }
 }
@@ -2154,6 +2155,7 @@ void ScAccessibleDocument::RemoveChild(const 
uno::Reference& xAcc,
 aEvent.Source = uno::Reference(this);
 aEvent.EventId = AccessibleEventId::CHILD;
 aEvent.OldValue <<= mxTempAcc;
+aEvent.IndexHint 

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

2020-02-07 Thread Noel Grandin (via logerrit)
 comphelper/source/container/enumhelper.cxx |4 ++--
 include/comphelper/enumhelper.hxx  |2 +-
 sc/source/filter/inc/imp_op.hxx|2 +-
 svx/source/svdraw/svdobj.cxx   |6 ++
 4 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 9a3810ba9b8b52096bee29e83d1eb5ce57512270
Author: Noel Grandin 
AuthorDate: Fri Feb 7 11:35:49 2020 +0200
Commit: Noel Grandin 
CommitDate: Sat Feb 8 08:49:02 2020 +0100

pack some data structures

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

diff --git a/comphelper/source/container/enumhelper.cxx 
b/comphelper/source/container/enumhelper.cxx
index 1267bb1e66d9..6c05c89d3cd7 100644
--- a/comphelper/source/container/enumhelper.cxx
+++ b/comphelper/source/container/enumhelper.cxx
@@ -135,8 +135,8 @@ void OEnumerationByName::impl_stopDisposeListening()
 }
 
 OEnumerationByIndex::OEnumerationByIndex(const css::uno::Reference< 
css::container::XIndexAccess >& _rxAccess)
-:m_nPos(0)
-,m_xAccess(_rxAccess)
+:m_xAccess(_rxAccess)
+,m_nPos(0)
 ,m_bListening(false)
 {
 impl_startDisposeListening();
diff --git a/include/comphelper/enumhelper.hxx 
b/include/comphelper/enumhelper.hxx
index c9816cd3e055..16d95b76e808 100644
--- a/include/comphelper/enumhelper.hxx
+++ b/include/comphelper/enumhelper.hxx
@@ -73,8 +73,8 @@ class COMPHELPER_DLLPUBLIC OEnumerationByIndex final : 
private OEnumerationLock
   , public ::cppu::WeakImplHelper< 
css::container::XEnumeration ,

css::lang::XEventListener>
 {
-sal_Int32 m_nPos;
 css::uno::Reference< css::container::XIndexAccess > m_xAccess;
+sal_Int32 m_nPos;
 bool  m_bListening;
 
 public:
diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx
index 2579446800b7..3edb96dfe75a 100644
--- a/sc/source/filter/inc/imp_op.hxx
+++ b/sc/source/filter/inc/imp_op.hxx
@@ -77,10 +77,10 @@ class ImportExcel : public ImportTyp, protected XclImpRoot
 protected:
 struct LastFormula
 {
+sal_uInt16 mnXF;
 SCCOL mnCol;
 SCROW mnRow;
 double mfValue;
-sal_uInt16 mnXF;
 ScFormulaCell* mpCell;
 };
 typedef std::unordered_map LastFormulaMapType;
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index ded90158472b..def37015ef50 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -206,14 +206,12 @@ SdrObjTransformInfoRec::SdrObjTransformInfoRec() :
 struct SdrObject::Impl
 {
 sdr::ObjectUserVector maObjectUsers;
-
+std::shared_ptr mpDiagramData;
 o3tl::optional mnRelativeWidth;
-sal_Int16   meRelativeWidthRelation;
 o3tl::optional mnRelativeHeight;
+sal_Int16   meRelativeWidthRelation;
 sal_Int16   meRelativeHeightRelation;
 
-std::shared_ptr mpDiagramData;
-
 Impl() :
 meRelativeWidthRelation(text::RelOrientation::PAGE_FRAME),
 meRelativeHeightRelation(text::RelOrientation::PAGE_FRAME) {}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-03-21 Thread Libreoffice Gerrit user
 comphelper/source/misc/threadpool.cxx |   16 ++--
 include/comphelper/threadpool.hxx |9 +++--
 sc/source/core/data/documen2.cxx  |4 
 sc/source/core/data/formulacell.cxx   |6 --
 4 files changed, 25 insertions(+), 10 deletions(-)

New commits:
commit 769832cc1f592b1d0c39cda7795fe4548fc97566
Author: Dennis Francis 
AuthorDate: Wed Mar 20 20:07:58 2019 +0530
Commit: Michael Meeks 
CommitDate: Thu Mar 21 11:24:26 2019 +0100

Increase the life-cycle of threads in thread-pool...

to ScDocument lifetime if possible. This helps to avoid lots
of thread setup-cost while doing recalcs especially if there are
many formula-groups in the document and most of them are fairly
light-weight.

Change-Id: Idd57e1ebd0d4e492f99e31237d4a55ec9c95a121
Reviewed-on: https://gerrit.libreoffice.org/69473
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/comphelper/source/misc/threadpool.cxx 
b/comphelper/source/misc/threadpool.cxx
index d0178e9aa9a7..89d80298432b 100644
--- a/comphelper/source/misc/threadpool.cxx
+++ b/comphelper/source/misc/threadpool.cxx
@@ -213,7 +213,7 @@ std::unique_ptr ThreadPool::popWorkLocked( 
std::unique_lock< std::mu
 return nullptr;
 }
 
-void ThreadPool::waitUntilDone(const std::shared_ptr& rTag)
+void ThreadPool::waitUntilDone(const std::shared_ptr& rTag, 
bool bJoinAll)
 {
 #if defined DBG_UTIL && (defined LINUX || defined _WIN32)
 assert(!gbIsWorkerThread && "cannot wait for tasks from inside a task");
@@ -232,12 +232,16 @@ void ThreadPool::waitUntilDone(const 
std::shared_ptr& rTag)
 
 rTag->waitUntilDone();
 
+if (bJoinAll)
+joinAll();
+}
+
+void ThreadPool::joinAll()
+{
+std::unique_lock< std::mutex > aGuard( maMutex );
+if (maTasks.empty()) // check if there are still tasks from another tag
 {
-std::unique_lock< std::mutex > aGuard( maMutex );
-if (maTasks.empty()) // check if there are still tasks from another tag
-{
-shutdownLocked(aGuard);
-}
+shutdownLocked(aGuard);
 }
 }
 
diff --git a/include/comphelper/threadpool.hxx 
b/include/comphelper/threadpool.hxx
index 092078199981..1cb9441cfdd1 100644
--- a/include/comphelper/threadpool.hxx
+++ b/include/comphelper/threadpool.hxx
@@ -63,8 +63,13 @@ public:
 /// push a new task onto the work queue
 voidpushTask( std::unique_ptr pTask);
 
-/// wait until all queued tasks associated with the tag are completed
-voidwaitUntilDone(const std::shared_ptr&);
+/** Wait until all queued tasks associated with the tag are completed
+@param  bJoinAll - if set it joins all threads at the end if no other 
tasks from other tags.
+*/
+voidwaitUntilDone(const std::shared_ptr&, bool 
bJoinAll = true);
+
+/// join all threads if there are no tasks presently.
+voidjoinAll();
 
 /// return the number of live worker threads
 sal_Int32   getWorkerCount() const { return mnWorkers; }
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 321c4535e10b..0892025b242a 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -307,6 +308,9 @@ ScDocument::~ScDocument()
 {
 OSL_PRECOND( !bInLinkUpdate, "bInLinkUpdate in dtor" );
 
+// Join any pending(recalc) threads in global threadpool
+comphelper::ThreadPool::getSharedOptimalPool().joinAll();
+
 bInDtorClear = true;
 
 // first of all disable all refresh timers by deleting the control
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 17dc29811ae5..9edddf0bfc54 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -4758,8 +4758,10 @@ bool 
ScFormulaCell::InterpretFormulaGroupThreading(sc::FormulaLogger::GroupScope
 nStartOffset, 
nEndOffset));
 }
 
-SAL_INFO("sc.threaded", "Joining threads");
-rThreadPool.waitUntilDone(aTag);
+SAL_INFO("sc.threaded", "Waiting for threads to finish work");
+// Do not join the threads here. They will get joined in 
ScDocument destructor
+// if they don't get joined from elsewhere before (via 
ThreadPool::waitUntilDone).
+rThreadPool.waitUntilDone(aTag, false);
 
 pDocument->SetThreadedGroupCalcInProgress(false);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: comphelper/source include/comphelper sc/source svx/source vcl/source

2016-06-19 Thread Ashod Nakashian
 comphelper/source/misc/lok.cxx |   24 +
 include/comphelper/lok.hxx |   12 ++
 sc/source/ui/view/gridwin4.cxx |1 
 svx/source/sdr/contact/objectcontactofpageview.cxx |9 +--
 vcl/source/outdev/bitmap.cxx   |4 +--
 5 files changed, 45 insertions(+), 5 deletions(-)

New commits:
commit c337011d2052ec3ddb80e61bcc4b0574b4e898ba
Author: Ashod Nakashian 
Date:   Thu Jun 16 07:28:58 2016 -0400

LOK: tile rendering regression fix

Calc fast rendering requires us to offset
the are being rendered and shift all
bitmaps accordingly. This however is
breaking Impress rendering since the
offseting logic is common (in svx and vcl).

This adds new API to enable or disable
this local rendering (as opposed to
rendering a full document as was previously
done.

The new flag is then set by Calc to
enable the offseting logic in isolation
without affecting other applications.

In one case isolation was achieved by
checking the MapModeUnit.

Change-Id: Ia0aadfc3f6df7c1a891b97dc731f5897414c9420
Reviewed-on: https://gerrit.libreoffice.org/26367
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 
(cherry picked from commit 60fdcda65bad242f99895cb453182578250fbdea)
Reviewed-on: https://gerrit.libreoffice.org/26378
Tested-by: Jenkins 

diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index a6abd2a..a321260 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -17,6 +17,8 @@ namespace LibreOfficeKit
 
 static bool g_bActive(false);
 
+static bool g_bViewCallback(true);
+
 void setActive(bool bActive)
 {
 g_bActive = bActive;
@@ -27,6 +29,28 @@ bool isActive()
 return g_bActive;
 }
 
+void setViewCallback(bool bViewCallback)
+{
+g_bViewCallback = bViewCallback;
+}
+
+bool isViewCallback()
+{
+return g_bViewCallback;
+}
+
+static bool g_bLocalRendering(false);
+
+void setLocalRendering(bool bLocalRendering)
+{
+g_bLocalRendering = bLocalRendering;
+}
+
+bool isLocalRendering()
+{
+return g_bLocalRendering;
+}
+
 static void (*pStatusIndicatorCallback)(void *data, 
statusIndicatorCallbackType type, int percent)(nullptr);
 static void *pStatusIndicatorCallbackData(nullptr);
 
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index 79fa115..8afd3d8 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -36,6 +36,18 @@ COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(void 
(*callback)(void *data
 // Check whether the code is running as invoked through LibreOfficeKit.
 COMPHELPER_DLLPUBLIC bool isActive();
 
+/// Shift the coordinates before rendering each bitmap.
+/// Used by Calc to render each tile separately.
+/// This should be unnecessary (and removed) once Calc
+/// moves to using 100MM Unit.
+COMPHELPER_DLLPUBLIC void setLocalRendering(bool bLocalRendering = true);
+COMPHELPER_DLLPUBLIC bool isLocalRendering();
+
+/// Check whether clients register a callback for each view.
+COMPHELPER_DLLPUBLIC bool isViewCallback();
+/// Set whether clients register a callback for each view.
+COMPHELPER_DLLPUBLIC void setViewCallback(bool bViewCallback);
+
 // Status indicator handling. Even if in theory there could be several status 
indicators active at
 // the same time, in practice there is only one at a time, so we don't handle 
any identification of
 // status indicator in this API.
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 3bd..df98ab9 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -826,6 +826,7 @@ void ScGridWindow::DrawContent(OutputDevice , const 
ScTableInfo& rTableI
 aOrigin.getY() - aOrigin.getY() / twipFactor);
 aNew.SetOrigin(aOrigin);
 pContentDev->SetMapMode(aNew);
+comphelper::LibreOfficeKit::setLocalRendering();
 }
 
 DrawRedraw( aOutputData, eMode, SC_LAYER_FRONT );
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx 
b/svx/source/sdr/contact/objectcontactofpageview.cxx
index cead940..589c292 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -232,7 +232,8 @@ namespace sdr
 
 // transform to world coordinates
 
aViewRange.transform(rTargetOutDev.GetInverseViewTransformation());
-if (comphelper::LibreOfficeKit::isActive())
+if (comphelper::LibreOfficeKit::isActive() &&
+comphelper::LibreOfficeKit::isLocalRendering())
 {
 const int TWIPS_PER_PIXEL = 15;
 aViewRange = 
basegfx::B2DRange(aViewRange.getMinimum().getX(),
@@