[Libreoffice-commits] core.git: comphelper/source dbaccess/source filter/Library_t602filter.mk filter/source framework/inc framework/source include/comphelper include/xmloff lotuswordpro/source packag

2023-01-15 Thread Mike Kaganski (via logerrit)
 comphelper/source/xml/attributelist.cxx |   82 -
 comphelper/source/xml/ofopxmlhelper.cxx |   14 
 dbaccess/source/core/recovery/storagexmlstream.cxx  |8 
 dbaccess/source/filter/xml/xmlAutoStyle.cxx |2 
 dbaccess/source/filter/xml/xmlAutoStyle.hxx |2 
 dbaccess/source/filter/xml/xmlExport.cxx|   10 
 dbaccess/source/filter/xml/xmlExport.hxx|4 
 filter/Library_t602filter.mk|1 
 filter/source/t602/t602filter.cxx   |2 
 filter/source/t602/t602filter.hxx   |4 
 filter/source/xsltdialog/typedetectionexport.cxx|   29 -
 framework/inc/acceleratorconst.h|2 
 framework/inc/xml/imagesdocumenthandler.hxx |1 
 framework/inc/xml/menudocumenthandler.hxx   |1 
 framework/inc/xml/statusbardocumenthandler.hxx  |1 
 framework/inc/xml/toolboxconfigurationdefines.hxx   |2 
 framework/inc/xml/toolboxdocumenthandler.hxx|1 
 framework/source/fwe/xml/menudocumenthandler.cxx|   11 
 framework/source/fwe/xml/saxnamespacefilter.cxx |2 
 framework/source/fwe/xml/statusbardocumenthandler.cxx   |   17 -
 framework/source/fwe/xml/toolboxdocumenthandler.cxx |9 
 framework/source/xml/acceleratorconfigurationwriter.cxx |   16 -
 framework/source/xml/imagesdocumenthandler.cxx  |6 
 include/comphelper/attributelist.hxx|   35 +-
 include/xmloff/attrlist.hxx |   74 
 include/xmloff/shapeexport.hxx  |8 
 include/xmloff/xmlaustp.hxx |4 
 include/xmloff/xmlexp.hxx   |6 
 include/xmloff/xmlexppr.hxx |8 
 lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx|4 
 lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx|   12 
 package/source/manifest/ManifestDefines.hxx |1 
 package/source/manifest/ManifestExport.cxx  |   34 --
 reportdesign/inc/pch/precompiled_rptxml.hxx |1 
 reportdesign/source/filter/xml/xmlAutoStyle.cxx |2 
 reportdesign/source/filter/xml/xmlAutoStyle.hxx |2 
 reportdesign/source/filter/xml/xmlExport.cxx|4 
 reportdesign/source/filter/xml/xmlExport.hxx|2 
 reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx |   16 -
 reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx |4 
 sax/source/expatwrap/sax_expat.cxx  |3 
 sax/source/fastparser/legacyfastparser.cxx  |6 
 sc/source/filter/xml/xmlexprt.cxx   |6 
 sc/source/filter/xml/xmlstyle.cxx   |8 
 sc/source/filter/xml/xmlstyle.hxx   |8 
 sfx2/source/doc/doctemplateslocal.cxx   |6 
 starmath/source/mathml/mathmlexport.cxx |3 
 sw/source/filter/xml/xmlexpit.cxx   |7 
 sw/source/filter/xml/xmlexpit.hxx   |8 
 sw/source/filter/xml/xmlfmte.cxx|5 
 sw/source/filter/xml/xmliteme.cxx   |8 
 ucb/source/ucp/webdav-curl/CurlSession.cxx  |   10 
 unoxml/source/dom/element.cxx   |5 
 writerperfect/source/common/DocumentHandler.cxx |5 
 writerperfect/source/writer/EPUBPackage.cxx |4 
 xmloff/Library_xo.mk|1 
 xmloff/inc/SchXMLAutoStylePoolP.hxx |2 
 xmloff/inc/XMLChartPropertySetMapper.hxx|2 
 xmloff/inc/pch/precompiled_xo.hxx   |1 
 xmloff/inc/pch/precompiled_xof.hxx  |1 
 xmloff/source/chart/PropertyMaps.cxx|4 
 xmloff/source/chart/SchXMLAutoStylePoolP.cxx|2 
 xmloff/source/core/XMLEmbeddedObjectImportContext.cxx   |1 
 xmloff/source/core/attrlist.cxx |  187 
 xmloff/source/core/xmlexp.cxx   |7 
 xmloff/source/core/xmlimp.cxx   |2 
 xmloff/source/draw/sdpropls.cxx |2 
 xmloff/source/draw/sdpropls.hxx |2 
 xmloff/source/draw/shapeexport.cxx  |8 
 xmloff/source/draw/shapeimport.cxx  |1 
 xmloff/source/draw/ximpshap.cxx |1 
 xmloff/source/forms/controlpropertymap.cxx  |2 
 

[Libreoffice-commits] core.git: comphelper/source dbaccess/source editeng/source include/comphelper linguistic/source sc/source sfx2/source starmath/source sw/source vcl/source

2022-04-30 Thread Noel Grandin (via logerrit)
 comphelper/source/misc/string.cxx  |   86 ++---
 dbaccess/source/core/misc/dsntypes.cxx |7 -
 dbaccess/source/ui/app/AppDetailPageHelper.cxx |2 
 dbaccess/source/ui/querydesign/QueryDesignView.cxx |2 
 editeng/source/outliner/outliner.cxx   |5 -
 include/comphelper/string.hxx  |   24 -
 linguistic/source/dicimp.cxx   |4 
 sc/source/core/data/dputil.cxx |2 
 sc/source/filter/html/htmlpars.cxx |2 
 sfx2/source/dialog/dinfdlg.cxx |4 
 starmath/source/cursor.cxx |2 
 starmath/source/dialog.cxx |2 
 sw/source/core/doc/docfld.cxx  |2 
 sw/source/core/inc/docfld.hxx  |2 
 sw/source/filter/html/swhtml.cxx   |2 
 vcl/source/treelist/imap2.cxx  |4 
 16 files changed, 116 insertions(+), 36 deletions(-)

New commits:
commit fbff7af0a1a31e82c3a3eb6dac77d5a48ef3371d
Author: Noel Grandin 
AuthorDate: Fri Apr 29 20:52:46 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Apr 30 21:21:34 2022 +0200

split comphelper::string::strip functions into String and view version

which is more obvious, from the perspective of the caller, and lets us
avoid creating a new String if nothing needs to be stripped

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

diff --git a/comphelper/source/misc/string.cxx 
b/comphelper/source/misc/string.cxx
index acdb6c88adcb..a11a305c5daf 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -61,16 +61,43 @@ namespace
 
 return rIn.substr(i);
 }
+template  T tmpl_stripStartString(const T ,
+const C cRemove)
+{
+if (rIn.isEmpty())
+return rIn;
+
+sal_Int32 i = 0;
+
+while (i < rIn.getLength())
+{
+if (rIn[i] != cRemove)
+break;
+++i;
+}
+
+return rIn.copy(i);
+}
 }
 
-OString stripStart(std::string_view rIn, char c)
+OString stripStart(const OString& rIn, char c)
 {
-return OString(tmpl_stripStart(rIn, c));
+return tmpl_stripStartString(rIn, c);
 }
 
-OUString stripStart(std::u16string_view rIn, sal_Unicode c)
+std::string_view stripStart(std::string_view rIn, char c)
 {
-return OUString(tmpl_stripStart(rIn, c));
+return tmpl_stripStart(rIn, c);
+}
+
+OUString stripStart(const OUString& rIn, sal_Unicode c)
+{
+return tmpl_stripStartString(rIn, c);
+}
+
+std::u16string_view stripStart(std::u16string_view rIn, sal_Unicode c)
+{
+return tmpl_stripStart(rIn, c);
 }
 
 namespace
@@ -92,25 +119,64 @@ namespace
 
 return rIn.substr(0, i);
 }
+template  T tmpl_stripEndString(const T ,
+const C cRemove)
+{
+if (rIn.isEmpty())
+return rIn;
+
+sal_Int32 i = rIn.getLength();
+
+while (i > 0)
+{
+if (rIn[i-1] != cRemove)
+break;
+--i;
+}
+
+return rIn.copy(0, i);
+}
+}
+
+OString stripEnd(const OString& rIn, char c)
+{
+return tmpl_stripEndString(rIn, c);
 }
 
-OString stripEnd(std::string_view rIn, char c)
+std::string_view stripEnd(std::string_view rIn, char c)
 {
-return OString(tmpl_stripEnd(rIn, c));
+return tmpl_stripEnd(rIn, c);
 }
 
-OUString stripEnd(std::u16string_view rIn, sal_Unicode c)
+OUString stripEnd(const OUString& rIn, sal_Unicode c)
 {
-return OUString(tmpl_stripEnd(rIn, c));
+return tmpl_stripEndString(rIn, c);
 }
 
-OString strip(std::string_view rIn, char c)
+std::u16string_view stripEnd(std::u16string_view rIn, sal_Unicode c)
+{
+return tmpl_stripEnd(rIn, c);
+}
+
+OString strip(const OString& rIn, char c)
+{
+auto x = tmpl_stripStartString(rIn, c);
+return stripEnd(x, c);
+}
+
+std::string_view strip(std::string_view rIn, char c)
 {
 auto x = tmpl_stripStart(rIn, c);
 return stripEnd(x, c);
 }
 
-OUString strip(std::u16string_view rIn, sal_Unicode c)
+OUString strip(const OUString& rIn, sal_Unicode c)
+{
+auto x = tmpl_stripStartString(rIn, c);
+return stripEnd(x, c);
+}
+
+std::u16string_view strip(std::u16string_view rIn, sal_Unicode c)
 {
 auto x = tmpl_stripStart(rIn, c);
 return stripEnd(x, c);
diff --git a/dbaccess/source/core/misc/dsntypes.cxx 
b/dbaccess/source/core/misc/dsntypes.cxx
index 25513b36c952..06eb5545f354 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -84,7 +85,7 @@ OUString ODsnTypeCollection::cutPrefix(std::u16string_view 
_sURL) const
 OUString sOldPattern;
 
 // 

[Libreoffice-commits] core.git: comphelper/source dbaccess/source forms/source linguistic/source svx/source sw/source ucbhelper/source ucb/source

2021-12-16 Thread Noel Grandin (via logerrit)
 comphelper/source/eventattachermgr/eventattachermgr.cxx |4 -
 dbaccess/source/core/dataaccess/ContentHelper.cxx   |9 --
 dbaccess/source/core/dataaccess/bookmarkcontainer.cxx   |   12 ---
 dbaccess/source/ui/browser/brwctrlr.cxx |8 --
 dbaccess/source/ui/browser/exsrcbrw.cxx |4 -
 dbaccess/source/ui/browser/formadapter.cxx  |   26 ++-
 dbaccess/source/ui/browser/sbagrid.cxx  |4 -
 dbaccess/source/ui/browser/sbamultiplex.cxx |   56 
 forms/source/component/DatabaseForm.cxx |   10 --
 forms/source/component/errorbroadcaster.cxx |7 --
 linguistic/source/lngopt.cxx|8 --
 svx/source/fmcomp/gridcell.cxx  |9 --
 sw/source/core/unocore/unochart.cxx |4 -
 sw/source/uibase/dochdl/swdtflvr.cxx|5 -
 sw/source/uibase/uno/unomailmerge.cxx   |6 -
 ucb/source/cacher/contentresultsetwrapper.cxx   |   24 +-
 ucb/source/core/ucbstore.cxx|   21 --
 ucb/source/sorter/sortresult.cxx|   16 
 ucbhelper/source/provider/contenthelper.cxx |8 --
 19 files changed, 50 insertions(+), 191 deletions(-)

New commits:
commit 7994791e0a3681d46d8b257f09422b04deeae41c
Author: Noel Grandin 
AuthorDate: Thu Dec 16 16:08:48 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Dec 17 07:26:25 2021 +0100

use more OInterfaceContainer3::notifyEach

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

diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx 
b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 35e90a8379b0..4c7be22c2bb1 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -179,9 +179,7 @@ void SAL_CALL AttacherAllListener_Impl::firing(const 
AllEventObject& Event)
 aScriptEvent.ScriptCode = aScriptCode;
 
 // Iterate over all listeners and pass events.
-OInterfaceIteratorHelper3 aIt( mxManager->aScriptListeners );
-while( aIt.hasMoreElements() )
-aIt.next()->firing( aScriptEvent );
+mxManager->aScriptListeners.notifyEach( ::firing, 
aScriptEvent );
 }
 
 
diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx 
b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index beb75c3d40dd..cefc2443d2c2 100644
--- a/dbaccess/source/core/dataaccess/ContentHelper.cxx
+++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx
@@ -505,14 +505,7 @@ void OContentHelper::notifyPropertiesChange( const 
Sequence< PropertyChangeEvent
 // First, notify listeners interested in changes of every property.
 comphelper::OInterfaceContainerHelper3* 
pAllPropsContainer = m_aPropertyChangeListeners.getContainer( OUString() );
 if ( pAllPropsContainer )
-{
-comphelper::OInterfaceIteratorHelper3 aIter( *pAllPropsContainer );
-while ( aIter.hasMoreElements() )
-{
-// Propagate event.
-aIter.next()->propertiesChange( evt );
-}
-}
+pAllPropsContainer->notifyEach( 
::propertiesChange, evt );
 
 typedef std::map< XPropertiesChangeListener*, Sequence< 
PropertyChangeEvent > > PropertiesEventListenerMap;
 PropertiesEventListenerMap aListeners;
diff --git a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx 
b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
index bee7a0cbb7b9..24feb1371ed0 100644
--- a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
@@ -97,9 +97,7 @@ void SAL_CALL OBookmarkContainer::insertByName( const 
OUString& _rName, const An
 if (m_aContainerListeners.getLength())
 {
 ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sNewLink), 
Any());
-OInterfaceIteratorHelper3 aListenerIterator(m_aContainerListeners);
-while (aListenerIterator.hasMoreElements())
-aListenerIterator.next()->elementInserted(aEvent);
+m_aContainerListeners.notifyEach( 
::elementInserted, aEvent );
 }
 }
 
@@ -127,9 +125,7 @@ void SAL_CALL OBookmarkContainer::removeByName( const 
OUString& _rName )
 if (m_aContainerListeners.getLength())
 {
 ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sOldBookmark), 
Any());
-OInterfaceIteratorHelper3 aListenerIterator(m_aContainerListeners);
-while (aListenerIterator.hasMoreElements())
-aListenerIterator.next()->elementRemoved(aEvent);
+m_aContainerListeners.notifyEach( ::elementRemoved, 
aEvent );
 }
 }
 
@@ -162,9 +158,7 @@ void SAL_CALL OBookmarkContainer::replaceByName( const 
OUString& _rName, const A
 if 

[Libreoffice-commits] core.git: comphelper/source dbaccess/source embeddedobj/source embedserv/source framework/inc framework/source include/comphelper include/svx linguistic/source sfx2/inc sfx2/sour

2021-08-08 Thread Noel Grandin (via logerrit)
 comphelper/source/property/genericpropertyset.cxx |6 
 dbaccess/source/core/dataaccess/ContentHelper.cxx |8 
 dbaccess/source/core/inc/ContentHelper.hxx|4 
 dbaccess/source/ui/browser/formadapter.cxx|2 
 dbaccess/source/ui/browser/sbagrid.cxx|8 
 dbaccess/source/ui/inc/sbagrid.hxx|3 
 dbaccess/source/ui/inc/sbamultiplex.hxx   |   18 -
 embeddedobj/source/general/intercept.cxx  |6 
 embedserv/source/embed/intercept.cxx  |   16 -
 framework/inc/stdtypes.h  |4 
 framework/source/services/autorecovery.cxx|4 
 framework/source/services/frame.cxx   |8 
 include/comphelper/multiinterfacecontainer2.hxx   |  245 ++
 include/svx/shapepropertynotifier.hxx |4 
 linguistic/source/lngopt.cxx  |4 
 linguistic/source/lngopt.hxx  |4 
 sfx2/inc/unoctitm.hxx |3 
 sfx2/source/control/unoctitm.cxx  |6 
 svx/source/unodraw/shapepropertynotifier.cxx  |4 
 sw/source/uibase/inc/unomailmerge.hxx |3 
 sw/source/uibase/uno/unomailmerge.cxx |4 
 ucb/source/cacher/contentresultsetwrapper.cxx |   26 +-
 ucb/source/cacher/contentresultsetwrapper.hxx |3 
 ucb/source/core/ucbstore.cxx  |8 
 ucb/source/core/ucbstore.hxx  |3 
 ucb/source/sorter/sortresult.cxx  |9 
 ucb/source/ucp/file/bc.cxx|9 
 ucb/source/ucp/file/filnot.cxx|2 
 ucb/source/ucp/file/filnot.hxx|2 
 29 files changed, 338 insertions(+), 88 deletions(-)

New commits:
commit 9104017e1bf76857d2b9686363013e1e7c49e355
Author: Noel Grandin 
AuthorDate: Sat Aug 7 18:17:03 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 8 17:04:03 2021 +0200

create comphelper:OMultiTypeInterfaceContainerHelperVar2 and use it

based on OInterfaceContainerHelper2 which is considerably
faster than the original OInterfaceContainerHelper

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

diff --git a/comphelper/source/property/genericpropertyset.cxx 
b/comphelper/source/property/genericpropertyset.cxx
index 4bf9d31dc5f0..68ae7a3353b4 100644
--- a/comphelper/source/property/genericpropertyset.cxx
+++ b/comphelper/source/property/genericpropertyset.cxx
@@ -24,8 +24,8 @@
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -57,7 +57,7 @@ namespace comphelper
 {
 private:
 std::map   maAnyMap;
-cppu::OMultiTypeInterfaceContainerHelperVar m_aListener;
+comphelper::OMultiTypeInterfaceContainerHelperVar2 
m_aListener;
 
 protected:
 virtual void _setPropertyValues( const PropertyMapEntry** ppEntries, 
const  Any* pValues ) override;
@@ -148,7 +148,7 @@ void GenericPropertySet::_setPropertyValues( const 
PropertyMapEntry** ppEntries,
 
 while( *ppEntries )
 {
-OInterfaceContainerHelper * pHelper = 
m_aListener.getContainer((*ppEntries)->maName);
+OInterfaceContainerHelper2 * pHelper = 
m_aListener.getContainer((*ppEntries)->maName);
 
 maAnyMap[ (*ppEntries)->maName ] = *pValues;
 
diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx 
b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index 7de159b2d095..e08fc61b65bb 100644
--- a/dbaccess/source/core/dataaccess/ContentHelper.cxx
+++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx
@@ -486,10 +486,10 @@ void OContentHelper::notifyPropertiesChange( const 
Sequence< PropertyChangeEvent
 return;
 
 // First, notify listeners interested in changes of every property.
-OInterfaceContainerHelper* pAllPropsContainer = 
m_aPropertyChangeListeners.getContainer( OUString() );
+comphelper::OInterfaceContainerHelper2* pAllPropsContainer = 
m_aPropertyChangeListeners.getContainer( OUString() );
 if ( pAllPropsContainer )
 {
-OInterfaceIteratorHelper aIter( *pAllPropsContainer );
+comphelper::OInterfaceIteratorHelper2 aIter( *pAllPropsContainer );
 while ( aIter.hasMoreElements() )
 {
 // Propagate event.
@@ -507,10 +507,10 @@ void OContentHelper::notifyPropertiesChange( const 
Sequence< PropertyChangeEvent
 const PropertyChangeEvent& rEvent = *propertyChangeEvent;
 const OUString& rName = rEvent.PropertyName;
 
-OInterfaceContainerHelper* pPropsContainer = 
m_aPropertyChangeListeners.getContainer( rName );
+comphelper::OInterfaceContainerHelper2* pPropsContainer = 
m_aPropertyChangeListeners.getContainer( rName );
 if ( pPropsContainer )
 {
-OInterfaceIteratorHelper aIter( 

[Libreoffice-commits] core.git: comphelper/source dbaccess/source include/comphelper include/oox include/sfx2 include/xmloff oox/source scripting/source sc/source sfx2/source sw/source xmloff/source

2019-08-13 Thread Caolán McNamara (via logerrit)
 comphelper/source/misc/documentinfo.cxx  |   14 
 dbaccess/source/core/dataaccess/ModelImpl.cxx|7 ++
 dbaccess/source/core/dataaccess/databasedocument.cxx |   25 +---
 dbaccess/source/core/inc/ModelImpl.hxx   |2 
 include/comphelper/documentinfo.hxx  |5 +
 include/oox/ole/axcontrol.hxx|2 
 include/sfx2/docmacromode.hxx|7 ++
 include/sfx2/objsh.hxx   |3 +
 include/xmloff/xmlimp.hxx|3 +
 oox/source/ole/vbaproject.cxx|4 +
 sc/source/filter/excel/xiescher.cxx  |   36 ++--
 sc/source/filter/inc/xiescher.hxx|   11 +++
 sc/source/ui/vba/vbasheetobject.cxx  |   13 
 sc/source/ui/vba/vbasheetobject.hxx  |4 +
 scripting/source/protocolhandler/scripthandler.cxx   |   55 +++
 sfx2/source/doc/docmacromode.cxx |2 
 sfx2/source/doc/objmisc.cxx  |   13 ++--
 sfx2/source/doc/objstor.cxx  |   10 +++
 sfx2/source/doc/objxtor.cxx  |1 
 sfx2/source/doc/sfxbasemodel.cxx |7 ++
 sfx2/source/inc/objshimp.hxx |4 +
 sw/source/filter/html/htmlform.cxx   |   16 -
 sw/source/filter/html/htmlgrin.cxx   |   19 ++
 sw/source/filter/html/swhtml.cxx |1 
 sw/source/filter/html/swhtml.hxx |3 +
 sw/source/filter/ww8/ww8par.cxx  |   13 
 sw/source/filter/ww8/ww8par.hxx  |2 
 sw/source/filter/ww8/ww8par5.cxx |2 
 xmloff/source/core/xmlimp.cxx|   14 
 xmloff/source/script/XMLEventImportHelper.cxx|3 -
 30 files changed, 236 insertions(+), 65 deletions(-)

New commits:
commit b3edf85e0fe6ca03dc26e1bf531be82193bc9627
Author: Caolán McNamara 
AuthorDate: Wed Aug 7 17:37:11 2019 +0100
Commit: Caolán McNamara 
CommitDate: Tue Aug 13 13:26:15 2019 +0200

warn on load when a document binds an event to a macro

a) treat shared/Scripts equivalently to document scripts

This doesn't automatically warn/block running those scripts when used in a
freshly loaded document on its own however

because DocumentMacroMode::checkMacrosOnLoading will see at...

if ( m_xData->m_rDocumentAccess.documentStorageHasMacros() || 
hasMacroLibrary() )

that the document contains no macros and flip the allow macros flag to true 
so
that potentially new uses of macros added by the user during the edit are
allowed to run

b) so, add an additional flag to indicate existence of use of macros in a 
document

c) for odf import, set it when a script:event-listener tag is encountered
d) for html import when registerScriptEvents or 
SwFormatINetFormat::SetMacroTable is called
e) for doc import when Read_F_Macro or StoreMacroCmds is called as well for 
good measure
f) for xls import when registerScriptEvent or ScMacroInfo::SetMacro is 
called
g) for oox import when VbaProject::attachMacros is called

Change-Id: Ic1203d8ec7dfc217aa217135033ae9db2888e19b
Reviewed-on: https://gerrit.libreoffice.org/77131
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/comphelper/source/misc/documentinfo.cxx 
b/comphelper/source/misc/documentinfo.cxx
index 6115ad0e2e25..102766778f95 100644
--- a/comphelper/source/misc/documentinfo.cxx
+++ b/comphelper/source/misc/documentinfo.cxx
@@ -158,6 +158,20 @@ namespace comphelper {
 return sTitle;
 }
 
+void DocumentInfo::notifyMacroEventRead(const 
css::uno::Reference& rModel)
+{
+if (!rModel.is())
+return;
+
+// like BreakMacroSignature of XMLScriptContext use 
XModel::attachResource
+// to propagate this notification
+css::uno::Sequence aMedDescr = 
rModel->getArgs();
+sal_Int32 nNewLen = aMedDescr.getLength() + 1;
+aMedDescr.realloc(nNewLen);
+aMedDescr[nNewLen-1].Name = "MacroEventRead";
+aMedDescr[nNewLen-1].Value <<= true;
+rModel->attachResource(rModel->getURL(), aMedDescr);
+}
 
 } // namespace comphelper
 
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx 
b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index e27dc8d4a292..9958b6c0e995 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -370,6 +370,7 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< 
XComponentContext >& _r
 ,m_bSuppressVersionColumns(true)
 ,m_bModified(false)
 ,m_bDocumentReadOnly(false)
+,m_bMacroCallsSeenWhileLoading(false)
 

[Libreoffice-commits] core.git: comphelper/source dbaccess/source include/comphelper include/vcl vcl/android vcl/headless vcl/inc vcl/ios vcl/osx vcl/source vcl/unx vcl/win

2017-09-19 Thread Jan-Marek Glogowski
 comphelper/source/misc/solarmutex.cxx |   66 
 dbaccess/source/core/dataaccess/ModelImpl.cxx |   12 +
 dbaccess/source/core/dataaccess/ModelImpl.hxx |9 -
 include/comphelper/solarmutex.hxx |   72 -
 include/vcl/svapp.hxx |  114 +-
 vcl/android/androidinst.cxx   |4 
 vcl/headless/headlessinst.cxx |4 
 vcl/headless/svpinst.cxx  |2 
 vcl/inc/osx/salinst.h |   30 +--
 vcl/inc/salinst.hxx   |6 
 vcl/inc/unx/geninst.h |   42 -
 vcl/inc/win/saldata.hxx   |4 
 vcl/inc/win/salinst.h |5 
 vcl/inc/win/salprn.h  |3 
 vcl/ios/iosinst.cxx   |4 
 vcl/osx/salframeview.mm   |9 -
 vcl/osx/salinst.cxx   |  106 +
 vcl/source/app/dbggui.cxx |2 
 vcl/source/app/svapp.cxx  |6 
 vcl/unx/generic/app/geninst.cxx   |   81 --
 vcl/unx/generic/app/saldata.cxx   |2 
 vcl/unx/generic/app/saldisp.cxx   |   13 -
 vcl/unx/generic/plugadapt/salplug.cxx |4 
 vcl/unx/gtk/gtkdata.cxx   |8 -
 vcl/unx/gtk/gtkinst.cxx   |4 
 vcl/unx/gtk3/gtk3gtkdata.cxx  |8 -
 vcl/unx/kde4/KDE4FilePicker.cxx   |   40 ++---
 vcl/unx/kde4/KDESalDisplay.cxx|3 
 vcl/unx/kde4/KDEXLib.cxx  |6 
 vcl/win/app/salinst.cxx   |  205 +++---
 vcl/win/gdi/salprn.cxx|   30 ++-
 31 files changed, 335 insertions(+), 569 deletions(-)

New commits:
commit 3840aede596e6fc24f7ed7df9100fb028134aac6
Author: Jan-Marek Glogowski 
Date:   Tue Aug 15 08:05:51 2017 +0200

Unify SolarMutex implementations

All backends implement the SolarMutex in mostly the same way.
So this consolidates this code into a GenericSolarMutex.

We still need the abstract SolarMutex class for the fake AKA
fascade implementation in dbaccess.

The patch also replaces various places of direct mutex usage with
either SolarMutexGuard or SolarMutexReleaser objects.

Change-Id: Ia0146dd6c51a3b9a513cc6af34a66def58aad831
Reviewed-on: https://gerrit.libreoffice.org/42325
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Reviewed-by: Jan-Marek Glogowski 

diff --git a/comphelper/source/misc/solarmutex.cxx 
b/comphelper/source/misc/solarmutex.cxx
index 4b573078dffd..1501228b1bc6 100644
--- a/comphelper/source/misc/solarmutex.cxx
+++ b/comphelper/source/misc/solarmutex.cxx
@@ -18,9 +18,12 @@
  */
 
 #include 
-#include 
+
 #include 
 
+#include 
+#include 
+
 namespace comphelper {
 
 SolarMutex::SolarMutex() {}
@@ -42,6 +45,67 @@ SolarMutex *SolarMutex::get()
 return pSolarMutex;
 }
 
+GenericSolarMutex::GenericSolarMutex()
+: m_nCount( 0 )
+, m_nThreadId( 0 )
+, m_aBeforeReleaseHandler( nullptr )
+{
+setSolarMutex( this );
+}
+
+GenericSolarMutex::~GenericSolarMutex()
+{
+setSolarMutex( nullptr );
+}
+
+void GenericSolarMutex::doAcquire( const sal_uInt32 nLockCount )
+{
+for ( sal_uInt32 n = nLockCount; n ; --n )
+m_aMutex.acquire();
+m_nThreadId = osl::Thread::getCurrentIdentifier();
+m_nCount += nLockCount;
+}
+
+sal_uInt32 GenericSolarMutex::doRelease( bool bUnlockAll )
+{
+if ( m_nCount == 0 )
+std::abort();
+if ( m_nThreadId != osl::Thread::getCurrentIdentifier() )
+std::abort();
+
+const sal_uInt32 nCount = bUnlockAll ? m_nCount : 1;
+m_nCount -= nCount;
+
+if ( 0 == m_nCount )
+{
+if ( m_aBeforeReleaseHandler )
+m_aBeforeReleaseHandler();
+m_nThreadId = 0;
+}
+
+for ( sal_uInt32 n = nCount ; n ; --n )
+m_aMutex.release();
+
+return nCount;
+}
+
+bool GenericSolarMutex::IsCurrentThread() const
+{
+return m_nThreadId == osl::Thread::getCurrentIdentifier();
+}
+
+bool GenericSolarMutex::tryToAcquire()
+{
+if ( m_aMutex.tryToAcquire() )
+{
+m_nThreadId = osl::Thread::getCurrentIdentifier();
+m_nCount++;
+return true;
+}
+else
+return false;
+}
+
 } // namespace comphelper
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx 
b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index bbbe69d5f52f..3ddffa4caa52 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -92,14 +92,17 @@ VosMutexFacade::VosMutexFacade( ::osl::Mutex& _rMutex )
 {
 }
 
-void VosMutexFacade::acquire()
+void VosMutexFacade::doAcquire( 

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

2017-02-19 Thread Jochen Nitschke
 comphelper/source/eventattachermgr/eventattachermgr.cxx |2 --
 dbaccess/source/core/api/OptimisticSet.cxx  |1 -
 2 files changed, 3 deletions(-)

New commits:
commit f5b09b48c239825e1e94cdfbddb6f0d240fc133a
Author: Jochen Nitschke 
Date:   Sun Feb 19 22:32:26 2017 +0100

cppcheck: unreadVariable

Change-Id: I701431f0346727cbb039f18ade55b5a98c97a135
Reviewed-on: https://gerrit.libreoffice.org/34438
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx 
b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 46be145..19328a7 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -397,8 +397,6 @@ void SAL_CALL ImplEventAttacherManager::registerScriptEvent
 // Examine the index and apply the array
 std::deque::iterator aIt = implCheckIndex( nIndex );
 
-std::deque< AttachedObject_Impl > aList = (*aIt).aObjList;
-
 ScriptEventDescriptor aEvt = ScriptEvent;
 sal_Int32 nLastDot = aEvt.ListenerType.lastIndexOf('.');
 if (nLastDot != -1)
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx 
b/dbaccess/source/core/api/OptimisticSet.cxx
index 84c3e6f..e67b6e3 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -551,7 +551,6 @@ void 
OptimisticSet::fillMissingValues(ORowSetValueVector::Vector& io_aRow) const
 {
 TSQLStatements aSql;
 TSQLStatements aKeyConditions;
-std::map< OUString,bool > aResultSetChanged;
 OUString aQuote  = getIdentifierQuoteString();
 // here we build the condition part for the update statement
 SelectColumnsMetaData::const_iterator aColIter = m_pColumnNames->begin();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-07-29 Thread Michael Stahl
 comphelper/source/misc/asyncnotification.cxx  |  128 +-
 dbaccess/source/core/dataaccess/documenteventnotifier.cxx |   24 +-
 include/comphelper/asyncnotification.hxx  |   72 ++-
 vcl/source/app/svmain.cxx |5 
 4 files changed, 202 insertions(+), 27 deletions(-)

New commits:
commit a2095b151409f0fb57aa8feaa4c6282f84040245
Author: Michael Stahl 
Date:   Tue Jul 26 23:42:36 2016 +0200

comphelper,vcl: let DeInitVCL() join some AsyncEventNotifier threads

comphelper::AsyncEventNotifier is an amazing class that dispatches
events in separate threads, no doubt implemented during times of
exuberant optimism about the tractability of shared-state
multi-threading.

Unfortunately the authors forgot to think about how all those awesome
threads will be joined, so if they are somehow blocked, then it may well
happen that the events are dispatched when the main thread is already in
DeInitVCL, and the objects required for the dispatching already smell
somewhat funny.

This happens quite reproducibly when changing dbaccess' ModelMethodGuard
to lock the SolarMutex too, then CppunitTest_dbaccess_RowSetClones
crashes in DeInitVCL() because one AsyncEventNotifier thread was blocked
until then by SolarMutexGuard, and this test never Yields once its
document is loaded.

Try to fix this by joining the "DocumentEventNotifier" threads from
DeInitVCL() itself.

Since there's no rtl::WeakReference to go with rtl::Reference, refactor
the AsyncEventNotifier and create a new AsyncEventNotifierAutoJoin
that has to be used with std::shared_ptr and std::weak_ptr.

Change-Id: I50a0749795acb04b0776e543f7125767b697ea35
Reviewed-on: https://gerrit.libreoffice.org/27581
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/comphelper/source/misc/asyncnotification.cxx 
b/comphelper/source/misc/asyncnotification.cxx
index 85643e2..e13be28 100644
--- a/comphelper/source/misc/asyncnotification.cxx
+++ b/comphelper/source/misc/asyncnotification.cxx
@@ -21,10 +21,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -76,6 +78,9 @@ namespace comphelper
 ::osl::ConditionaPendingActions;
 EventQueue  aEvents;
 boolbTerminate;
+// only used for AsyncEventNotifierAutoJoin
+char const* name;
+std::shared_ptr pKeepThisAlive;
 
 EventNotifierImpl()
 :bTerminate( false )
@@ -83,18 +88,18 @@ namespace comphelper
 }
 };
 
-AsyncEventNotifier::AsyncEventNotifier(char const * name):
-Thread(name), m_xImpl(new EventNotifierImpl)
+AsyncEventNotifierBase::AsyncEventNotifierBase()
+: m_xImpl(new EventNotifierImpl)
 {
 }
 
 
-AsyncEventNotifier::~AsyncEventNotifier()
+AsyncEventNotifierBase::~AsyncEventNotifierBase()
 {
 }
 
 
-void AsyncEventNotifier::removeEventsForProcessor( const ::rtl::Reference< 
IEventProcessor >& _xProcessor )
+void AsyncEventNotifierBase::removeEventsForProcessor( const 
::rtl::Reference< IEventProcessor >& _xProcessor )
 {
 ::osl::MutexGuard aGuard( m_xImpl->aMutex );
 
@@ -103,7 +108,7 @@ namespace comphelper
 }
 
 
-void SAL_CALL AsyncEventNotifier::terminate()
+void SAL_CALL AsyncEventNotifierBase::terminate()
 {
 ::osl::MutexGuard aGuard( m_xImpl->aMutex );
 
@@ -115,7 +120,7 @@ namespace comphelper
 }
 
 
-void AsyncEventNotifier::addEvent( const AnyEventRef& _rEvent, const 
::rtl::Reference< IEventProcessor >& _xProcessor )
+void AsyncEventNotifierBase::addEvent( const AnyEventRef& _rEvent, const 
::rtl::Reference< IEventProcessor >& _xProcessor )
 {
 ::osl::MutexGuard aGuard( m_xImpl->aMutex );
 
@@ -128,7 +133,7 @@ namespace comphelper
 }
 
 
-void AsyncEventNotifier::execute()
+void AsyncEventNotifierBase::execute()
 {
 for (;;)
 {
@@ -160,6 +165,115 @@ namespace comphelper
 }
 }
 
+AsyncEventNotifier::AsyncEventNotifier(char const* name)
+: salhelper::Thread(name)
+{
+}
+
+AsyncEventNotifier::~AsyncEventNotifier()
+{
+}
+
+void AsyncEventNotifier::execute()
+{
+return AsyncEventNotifierBase::execute();
+}
+
+void AsyncEventNotifier::terminate()
+{
+return AsyncEventNotifierBase::terminate();
+}
+
+struct theNotifiersMutex : public rtl::Static {};
+static std::vector g_Notifiers;
+
+void JoinAsyncEventNotifiers()
+{
+std::vector notifiers;
+{
+::osl::MutexGuard g(theNotifiersMutex::get());
+notifiers = g_Notifiers;
+}
+for 

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

2016-06-17 Thread Stephan Bergmann
 comphelper/source/property/propertybag.cxx |4 
 comphelper/source/property/propertycontainerhelper.cxx |   14 -
 dbaccess/source/core/api/RowSetBase.cxx|6 
 framework/source/layoutmanager/layoutmanager.cxx   |3 
 include/comphelper/propertycontainerhelper.hxx |6 
 reportdesign/source/core/api/ReportDefinition.cxx  |  170 +++--
 sc/source/ui/unoobj/celllistsource.cxx |5 
 sc/source/ui/unoobj/cellvaluebinding.cxx   |5 
 sc/source/ui/unoobj/chartuno.cxx   |4 
 9 files changed, 98 insertions(+), 119 deletions(-)

New commits:
commit bb1e59d596ffa29d40b4538e18a08e5e91d469a9
Author: Stephan Bergmann 
Date:   Fri Jun 17 19:40:58 2016 +0200

Simplify OPropertyContainerHelper::registerPropertyNoMember's _pInitialValue

Change-Id: Ibfb27b3eded45e2646dada37ce3663f427985ae9

diff --git a/comphelper/source/property/propertybag.cxx 
b/comphelper/source/property/propertybag.cxx
index 7f32dd9..019c2b9 100644
--- a/comphelper/source/property/propertybag.cxx
+++ b/comphelper/source/property/propertybag.cxx
@@ -120,7 +120,7 @@ namespace comphelper
 
 // register the property
 OSL_ENSURE( _nAttributes & PropertyAttribute::MAYBEVOID, 
"PropertyBag::addVoidProperty: this is for default-void properties only!" );
-registerPropertyNoMember( _rName, _nHandle, _nAttributes | 
PropertyAttribute::MAYBEVOID, _rType, nullptr );
+registerPropertyNoMember( _rName, _nHandle, _nAttributes | 
PropertyAttribute::MAYBEVOID, _rType, css::uno::Any() );
 
 // remember the default
 m_pImpl->aDefaults.insert( MapInt2Any::value_type( _nHandle, Any() ) );
@@ -143,7 +143,7 @@ namespace comphelper
 
 // register the property
 registerPropertyNoMember( _rName, _nHandle, _nAttributes, 
aPropertyType,
-_rInitialValue.hasValue() ? _rInitialValue.getValue() : nullptr );
+_rInitialValue );
 
 // remember the default
 m_pImpl->aDefaults.insert( MapInt2Any::value_type( _nHandle, 
_rInitialValue ) );
diff --git a/comphelper/source/property/propertycontainerhelper.cxx 
b/comphelper/source/property/propertycontainerhelper.cxx
index 9122ba0..5e7fa4f 100644
--- a/comphelper/source/property/propertycontainerhelper.cxx
+++ b/comphelper/source/property/propertycontainerhelper.cxx
@@ -121,21 +121,21 @@ void 
OPropertyContainerHelper::registerMayBeVoidProperty(const OUString& _rName,
 
 
 void OPropertyContainerHelper::registerPropertyNoMember(const OUString& 
_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
-const Type& _rType, const void* _pInitialValue)
+const Type& _rType, css::uno::Any const & _pInitialValue)
 {
 OSL_ENSURE(!_rType.equals(cppu::UnoType::get()),
 "OPropertyContainerHelper::registerPropertyNoMember : don't give my 
the type of an uno::Any ! Really can't handle this !");
-OSL_ENSURE(_pInitialValue || ((_nAttributes & 
PropertyAttribute::MAYBEVOID) != 0),
-"OPropertyContainerHelper::registerPropertyNoMember : you should not 
omit the initial value if the property can't be void! This will definitively 
crash later!");
+OSL_ENSURE(
+(_pInitialValue.isExtractableTo(_rType)
+ || (!_pInitialValue.hasValue()
+ && (_nAttributes & PropertyAttribute::MAYBEVOID) != 0)),
+"bad initial value");
 
 PropertyDescription aNewProp;
 aNewProp.aProperty = Property( _rName, _nHandle, _rType, 
(sal_Int16)_nAttributes );
 aNewProp.eLocated = PropertyDescription::LocationType::HoldMyself;
 aNewProp.aLocation.nOwnClassVectorIndex = m_aHoldProperties.size();
-if (_pInitialValue)
-m_aHoldProperties.push_back(Any(_pInitialValue, _rType));
-else
-m_aHoldProperties.push_back(Any());
+m_aHoldProperties.push_back(_pInitialValue);
 
 implPushBackProperty(aNewProp);
 }
diff --git a/dbaccess/source/core/api/RowSetBase.cxx 
b/dbaccess/source/core/api/RowSetBase.cxx
index a007159..3bfa9b1 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -96,10 +96,8 @@ ORowSetBase::ORowSetBase( const 
Reference& _rContext, ::cppu:
 {
 sal_Int32 nRBT  = PropertyAttribute::READONLY   | PropertyAttribute::BOUND 
 | PropertyAttribute::TRANSIENT;
 
-sal_Int32 nInitialRowCountValue = 0;
-sal_Bool bInitialRowCountFinalValue( false );
-registerPropertyNoMember( PROPERTY_ROWCOUNT,PROPERTY_ID_ROWCOUNT,  
  nRBT, cppu::UnoType::get(), 
 );
-registerPropertyNoMember( PROPERTY_ISROWCOUNTFINAL, 
PROPERTY_ID_ISROWCOUNTFINAL, nRBT, cppu::UnoType::get(),  
 );
+registerPropertyNoMember( PROPERTY_ROWCOUNT,PROPERTY_ID_ROWCOUNT,  
  nRBT, cppu::UnoType::get(), css::uno::makeAny(0) );
+registerPropertyNoMember( PROPERTY_ISROWCOUNTFINAL, 
PROPERTY_ID_ISROWCOUNTFINAL, nRBT,