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

2023-11-09 Thread Michael Stahl (via logerrit)
 scripting/source/pyprov/mailmerge.py |   56 ---
 1 file changed, 39 insertions(+), 17 deletions(-)

New commits:
commit 8e46dd9599bc84f60abf2d2d5625fa15076dfc80
Author: Michael Stahl 
AuthorDate: Tue Nov 7 15:40:55 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Nov 9 16:55:18 2023 +0100

scripting: PyMailServiceProvider: implement AllowInsecureProtocols

The "ehlo" calls look redundant, smtplib will do these implicitly if
required (checked in Python 3.5.9); it will also check that the STARTTLS
is successful which very old versions of Python didn't do.

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

diff --git a/scripting/source/pyprov/mailmerge.py 
b/scripting/source/pyprov/mailmerge.py
index 40be53b9366a..3c781c52f2cb 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -55,6 +55,34 @@ g_ImplementationHelper = unohelper.ImplementationHelper()
 g_providerImplName = "org.openoffice.pyuno.MailServiceProvider"
 g_messageImplName = "org.openoffice.pyuno.MailMessage"
 
+def prepareTLSContext(xComponent, xContext, isTLSRequested):
+   xConfigProvider = 
xContext.ServiceManager.createInstance("com.sun.star.configuration.ConfigurationProvider")
+   prop = uno.createUnoStruct('com.sun.star.beans.PropertyValue')
+   prop.Name = "nodepath"
+   prop.Value = "/org.openoffice.Office.Security/Net"
+   xSettings = 
xConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",
+   (prop,))
+   isAllowedInsecure = xSettings.getByName("AllowInsecureProtocols")
+   tlscontext = None
+   if isTLSRequested:
+   if dbg:
+   print("SSL config: " + 
str(ssl.get_default_verify_paths()), file=sys.stderr)
+   tlscontext = ssl.create_default_context()
+   # SSLv2/v3 is already disabled by default.
+   # This check does not work, because OpenSSL 3 defines 
SSL_OP_NO_SSLv2
+   # as 0, so even though _ssl__SSLContext_impl() tries to set it,
+   # getting the value from SSL_CTX_get_options() doesn't lead to 
setting
+   # the python-level flag.
+   #assert (tlscontext.options & ssl.Options.OP_NO_SSLv2) != 0
+   assert (tlscontext.options & ssl.Options.OP_NO_SSLv3) != 0
+   if not(isAllowedInsecure):
+   if not(isTLSRequested):
+   if dbg:
+   print("mailmerge.py: insecure connection not 
allowed by configuration", file=sys.stderr)
+   raise IllegalArgumentException("insecure connection not 
allowed by configuration", xComponent, 1)
+   tlscontext.options |= ssl.Options.OP_NO_TLSv1 | 
ssl.Options.OP_NO_TLSv1_1
+   return tlscontext
+
 class PyMailSMTPService(unohelper.Base, XSmtpService):
def __init__( self, ctx ):
self.ctx = ctx
@@ -95,25 +123,21 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
tout = _GLOBAL_DEFAULT_TIMEOUT
if dbg:
print("Timeout: " + str(tout), file=sys.stderr)
+   connectiontype = 
xConnectionContext.getValueByName("ConnectionType")
+   if dbg:
+   print("ConnectionType: " + connectiontype, 
file=sys.stderr)
+   tlscontext = prepareTLSContext(self, self.ctx, 
connectiontype.upper() == 'SSL' or port == 465)
if port == 465:
-   if dbg:
-   print("SSL config: " + 
str(ssl.get_default_verify_paths()), file=sys.stderr)
-   self.server = smtplib.SMTP_SSL(server, port, 
timeout=tout, context=ssl.create_default_context())
+   self.server = smtplib.SMTP_SSL(server, port, 
timeout=tout, context=tlscontext)
else:
self.server = smtplib.SMTP(server, port,timeout=tout)
 
if dbg:
self.server.set_debuglevel(1)
 
-   connectiontype = 
xConnectionContext.getValueByName("ConnectionType")
-   if dbg:
-   print("ConnectionType: " + connectiontype, 
file=sys.stderr)
if connectiontype.upper() == 'SSL' and port != 465:
-   if dbg:
-   print("SSL config: " + 
str(ssl.get_default_verify_paths()), file=sys.stderr)
-   self.server.ehlo()
-   
self.server.starttls(context=ssl.create_default_context())
-   self.server.ehlo()
+   # STRIPTLS: smtplib raises an exception if result is 
not 220
+   self.server.starttls(context=tlscontext)
 
user = 

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

2023-10-20 Thread Stephan Bergmann (via logerrit)
 scripting/source/basprov/basmethnode.cxx   |2 +-
 scripting/source/basprov/basscript.cxx |2 +-
 scripting/source/dlgprov/dlgprov.cxx   |2 +-
 scripting/source/provider/URIHelper.cxx|8 
 scripting/source/stringresource/stringresource.cxx |2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 7c59c59a0b6abee5d2c147139a79051a190939aa
Author: Stephan Bergmann 
AuthorDate: Thu Oct 19 10:30:26 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 20 18:42:47 2023 +0200

Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: scripting

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

diff --git a/scripting/source/basprov/basmethnode.cxx 
b/scripting/source/basprov/basmethnode.cxx
index 168d297e48de..f26e4c9a931b 100644
--- a/scripting/source/basprov/basmethnode.cxx
+++ b/scripting/source/basprov/basmethnode.cxx
@@ -45,7 +45,7 @@ using namespace ::sf_misc;
 #define BASPROV_PROPERTY_ID_EDITABLE2
 
 constexpr OUStringLiteral BASPROV_PROPERTY_URI = u"URI";
-constexpr OUStringLiteral BASPROV_PROPERTY_EDITABLE = u"Editable";
+constexpr OUString BASPROV_PROPERTY_EDITABLE = u"Editable"_ustr;
 
 #define BASPROV_DEFAULT_ATTRIBS()   PropertyAttribute::BOUND | 
PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY
 
diff --git a/scripting/source/basprov/basscript.cxx 
b/scripting/source/basprov/basscript.cxx
index f3ab8d2dd224..de50f62e11de 100644
--- a/scripting/source/basprov/basscript.cxx
+++ b/scripting/source/basprov/basscript.cxx
@@ -45,7 +45,7 @@ namespace basprov
 {
 
 #define BASSCRIPT_PROPERTY_ID_CALLER 1
-constexpr OUStringLiteral BASSCRIPT_PROPERTY_CALLER = u"Caller";
+constexpr OUString BASSCRIPT_PROPERTY_CALLER = u"Caller"_ustr;
 
 #define BASSCRIPT_DEFAULT_ATTRIBS()   PropertyAttribute::BOUND | 
PropertyAttribute::TRANSIENT
 
diff --git a/scripting/source/dlgprov/dlgprov.cxx 
b/scripting/source/dlgprov/dlgprov.cxx
index 18815f499e72..32e85900d440 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -554,7 +554,7 @@ namespace dlgprov
 // XDialogProvider
 
 
-constexpr OUStringLiteral aDecorationPropName = u"Decoration";
+constexpr OUString aDecorationPropName = u"Decoration"_ustr;
 
 Reference < XControl > DialogProviderImpl::createDialogImpl(
 const OUString& URL, const Reference< XInterface >& xHandler,
diff --git a/scripting/source/provider/URIHelper.cxx 
b/scripting/source/provider/URIHelper.cxx
index 5333bee34da4..4b122da8b1d7 100644
--- a/scripting/source/provider/URIHelper.cxx
+++ b/scripting/source/provider/URIHelper.cxx
@@ -34,14 +34,14 @@ namespace ucb = ::com::sun::star::ucb;
 namespace lang = ::com::sun::star::lang;
 namespace uri = ::com::sun::star::uri;
 
-constexpr OUStringLiteral SHARE = u"share";
+constexpr OUString SHARE = u"share"_ustr;
 
 constexpr OUStringLiteral SHARE_UNO_PACKAGES_URI =
 u"vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE";
 
-constexpr OUStringLiteral USER = u"user";
-constexpr OUStringLiteral USER_URI =
-u"vnd.sun.star.expand:${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" 
SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
+constexpr OUString USER = u"user"_ustr;
+constexpr OUString USER_URI =
+u"vnd.sun.star.expand:${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" 
SAL_CONFIGFILE( "bootstrap") "::UserInstallation}"_ustr;
 
 
 
diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 64988a5aafaf..096692602407 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -665,7 +665,7 @@ Sequence< OUString > 
StringResourcePersistenceImpl::getSupportedServiceNames(  )
 // XInitialization base functionality for derived classes
 
 
-constexpr OUStringLiteral aNameBaseDefaultStr = u"strings";
+constexpr OUString aNameBaseDefaultStr = u"strings"_ustr;
 
 void StringResourcePersistenceImpl::implInitializeCommonParameters
 ( std::unique_lock& rGuard, const Sequence< Any >& aArguments )


[Libreoffice-commits] core.git: scripting/source sw/source toolkit/source

2023-09-02 Thread Noel Grandin (via logerrit)
 scripting/source/vbaevents/eventhelper.cxx  |5 +++--
 sw/source/uibase/uno/unotxdoc.cxx   |2 +-
 toolkit/source/controls/grid/defaultgridcolumnmodel.cxx |5 +++--
 toolkit/source/controls/grid/gridcontrol.cxx|5 +++--
 4 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 3c7a35dd28fbc337a23473873b3dd47392b883ae
Author: Noel Grandin 
AuthorDate: Sat Sep 2 20:32:17 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 2 22:49:12 2023 +0200

no need to use UNO_QUERY_THROW here

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

diff --git a/scripting/source/vbaevents/eventhelper.cxx 
b/scripting/source/vbaevents/eventhelper.cxx
index 420161a22ee1..9f4bdc1f72fe 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -355,8 +355,9 @@ ScriptEventHelper::~ScriptEventHelper()
 {
 try
 {
-uno::Reference< lang::XComponent > xComp( m_xControl, 
uno::UNO_QUERY_THROW );
-xComp->dispose();
+uno::Reference< lang::XComponent > xComp( m_xControl, 
uno::UNO_QUERY );
+if (xComp)
+xComp->dispose();
 }
 // destructor can't throw
 catch( uno::Exception& )
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 397bf0cdb205..0bdfdd41f42e 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1471,7 +1471,7 @@ voidSwXTextDocument::InitNewDoc()
 {
 // #i91798#, #i91895#
 // dispose XDrawPage here. We are the owner and know that it is no 
longer in a valid condition.
-
Reference(static_cast(m_xDrawPage.get()), 
UNO_QUERY_THROW)->dispose();
+m_xDrawPage->dispose();
 m_xDrawPage->InvalidateSwDoc();
 m_xDrawPage.clear();
 }
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx 
b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
index f498001d1173..5e1a085ba06f 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -285,8 +285,9 @@ private:
 {
 try
 {
-const Reference< XComponent > xColComp( rEvent.Element, 
UNO_QUERY_THROW );
-xColComp->dispose();
+const Reference< XComponent > xColComp( rEvent.Element, 
UNO_QUERY );
+if (xColComp)
+xColComp->dispose();
 }
 catch( const Exception& )
 {
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx 
b/toolkit/source/controls/grid/gridcontrol.cxx
index 0fb9e9695958..c60051e5612b 100644
--- a/toolkit/source/controls/grid/gridcontrol.cxx
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -169,8 +169,9 @@ namespace
 {
 try
 {
-const Reference< XComponent > xComponent( i_component, 
UNO_QUERY_THROW );
-xComponent->dispose();
+const Reference< XComponent > xComponent( i_component, UNO_QUERY );
+if (xComponent)
+xComponent->dispose();
 }
 catch( const Exception& )
 {


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

2023-07-30 Thread Thorsten Behrens (via logerrit)
 scripting/source/pyprov/mailmerge.py |8 
 1 file changed, 8 insertions(+)

New commits:
commit d7b8dc9f3f866d65c2e1ae3727b3738ae954e325
Author: Thorsten Behrens 
AuthorDate: Sat Jul 29 05:17:10 2023 +0200
Commit: Thorsten Behrens 
CommitDate: Sun Jul 30 21:59:19 2023 +0200

Log SSL default verification path for mailmerge debug

related: follow python recommendation and pass SSL contexts

Change-Id: I992535a7fbe0bd21ff1de8241715babc0cb5cdc3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155050
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/scripting/source/pyprov/mailmerge.py 
b/scripting/source/pyprov/mailmerge.py
index 6bd80430d147..40be53b9366a 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -96,6 +96,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
if dbg:
print("Timeout: " + str(tout), file=sys.stderr)
if port == 465:
+   if dbg:
+   print("SSL config: " + 
str(ssl.get_default_verify_paths()), file=sys.stderr)
self.server = smtplib.SMTP_SSL(server, port, 
timeout=tout, context=ssl.create_default_context())
else:
self.server = smtplib.SMTP(server, port,timeout=tout)
@@ -107,6 +109,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
if dbg:
print("ConnectionType: " + connectiontype, 
file=sys.stderr)
if connectiontype.upper() == 'SSL' and port != 465:
+   if dbg:
+   print("SSL config: " + 
str(ssl.get_default_verify_paths()), file=sys.stderr)
self.server.ehlo()

self.server.starttls(context=ssl.create_default_context())
self.server.ehlo()
@@ -299,6 +303,8 @@ class PyMailIMAPService(unohelper.Base, XMailService):
print(connectiontype, file=sys.stderr)
print("BEFORE", file=sys.stderr)
if connectiontype.upper() == 'SSL':
+   if dbg:
+   print("SSL config: " + 
str(ssl.get_default_verify_paths()), file=sys.stderr)
self.server = imaplib.IMAP4_SSL(server, port, 
ssl_context=ssl.create_default_context())
else:
self.server = imaplib.IMAP4(server, port)
@@ -368,6 +374,8 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
print(connectiontype, file=sys.stderr)
print("BEFORE", file=sys.stderr)
if connectiontype.upper() == 'SSL':
+   if dbg:
+   print("SSL config: " + 
str(ssl.get_default_verify_paths()), file=sys.stderr)
self.server = poplib.POP3_SSL(server, port, 
context=ssl.create_default_context())
else:
tout = xConnectionContext.getValueByName("Timeout")


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

2023-07-28 Thread Caolán McNamara (via logerrit)
 scripting/source/pyprov/mailmerge.py |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit e3d28846c2343072750197fcdeaf44a945ddcb61
Author: Caolán McNamara 
AuthorDate: Fri Jul 28 12:13:41 2023 +0100
Commit: Thorsten Behrens 
CommitDate: Sat Jul 29 02:30:34 2023 +0200

follow python recommendation and pass SSL contexts

i.e. https://docs.python.org/3/library/ssl.html#security-considerations

Change-Id: I67a0f9e1c25abc6644412b014f30933a7e681da2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155016
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/scripting/source/pyprov/mailmerge.py 
b/scripting/source/pyprov/mailmerge.py
index 0ef37b477c81..6bd80430d147 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -47,7 +47,7 @@ from email.utils import formatdate
 from email.utils import parseaddr
 from socket import _GLOBAL_DEFAULT_TIMEOUT
 
-import sys, smtplib, imaplib, poplib
+import sys, ssl, smtplib, imaplib, poplib
 dbg = False
 
 # pythonloader looks for a static g_ImplementationHelper variable
@@ -96,7 +96,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
if dbg:
print("Timeout: " + str(tout), file=sys.stderr)
if port == 465:
-   self.server = smtplib.SMTP_SSL(server, 
port,timeout=tout)
+   self.server = smtplib.SMTP_SSL(server, port, 
timeout=tout, context=ssl.create_default_context())
else:
self.server = smtplib.SMTP(server, port,timeout=tout)
 
@@ -108,7 +108,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
print("ConnectionType: " + connectiontype, 
file=sys.stderr)
if connectiontype.upper() == 'SSL' and port != 465:
self.server.ehlo()
-   self.server.starttls()
+   
self.server.starttls(context=ssl.create_default_context())
self.server.ehlo()
 
user = xAuthenticator.getUserName()
@@ -299,7 +299,7 @@ class PyMailIMAPService(unohelper.Base, XMailService):
print(connectiontype, file=sys.stderr)
print("BEFORE", file=sys.stderr)
if connectiontype.upper() == 'SSL':
-   self.server = imaplib.IMAP4_SSL(server, port)
+   self.server = imaplib.IMAP4_SSL(server, port, 
ssl_context=ssl.create_default_context())
else:
self.server = imaplib.IMAP4(server, port)
print("AFTER", file=sys.stderr)
@@ -368,7 +368,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
print(connectiontype, file=sys.stderr)
print("BEFORE", file=sys.stderr)
if connectiontype.upper() == 'SSL':
-   self.server = poplib.POP3_SSL(server, port)
+   self.server = poplib.POP3_SSL(server, port, 
context=ssl.create_default_context())
else:
tout = xConnectionContext.getValueByName("Timeout")
if dbg:


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

2023-02-12 Thread Mike Kaganski (via logerrit)
 scripting/source/pyprov/pythonscript.py |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 12896c9ed652a239cb1fd05bbd9a32f040e3381f
Author: Mike Kaganski 
AuthorDate: Sun Feb 12 23:13:20 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Feb 12 23:55:08 2023 +

tdf#153571: properly unquote (URL-decode) vnd.sun.star.expand payload

Similar to what is done in bootstrap_expandUri, expandUnoRcUrl,
UrlReference::expand, JavaLoader.expand_url, and is documented
in XVndSunStarExpandUrl interface.

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

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 4955c8c54888..00d96d9b0d3f 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -26,6 +26,7 @@ import time
 import ast
 import platform
 from com.sun.star.uri.RelativeUriExcessParentSegments import RETAIN
+from urllib.parse import unquote
 
 class LogLevel:
 NONE = 0   # production level
@@ -854,7 +855,7 @@ def getPackageName2PathMap( sfa, storageType ):
 paths = getPathsFromPackage( j, sfa )
 if len( paths ) > 0:
 # map package name to url, we need this later
-log.isErrorLevel() and log.error( "adding Package " + 
transientPathElement + " " + str( paths ) )
+log.debug( "adding Package " + transientPathElement + " " + str( 
paths ) )
 ret[ lastElement( j ) ] = Package( paths, transientPathElement )
 return ret
 
@@ -941,7 +942,7 @@ def expandUri(  uri ):
 if uri.startswith( "vnd.sun.star.expand:" ):
 uri = uri.replace( "vnd.sun.star.expand:", "",1)
 uri = uno.getComponentContext().getByName(
-"/singletons/com.sun.star.util.theMacroExpander" 
).expandMacros( uri )
+"/singletons/com.sun.star.util.theMacroExpander" 
).expandMacros( unquote(uri) )
 if uri.startswith( "file:" ):
 uri = uno.absolutize("",uri)   # necessary to get rid of .. in uri
 return uri


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

2022-05-03 Thread Stephan Bergmann (via logerrit)
 scripting/source/basprov/basscript.cxx  |2 +-
 scripting/source/dlgprov/dlgprov.cxx|4 ++--
 scripting/source/provider/ActiveMSPList.cxx |2 +-
 scripting/source/provider/ActiveMSPList.hxx |2 +-
 scripting/source/provider/BrowseNodeFactoryImpl.cxx |6 +++---
 scripting/source/provider/MasterScriptProvider.cxx  |2 +-
 scripting/source/stringresource/stringresource.cxx  |4 ++--
 scripting/source/vbaevents/eventhelper.cxx  |4 ++--
 8 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 5fc8f8620d0367813d20b9a90ece47f0674996b3
Author: Stephan Bergmann 
AuthorDate: Tue May 3 23:23:59 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 4 06:55:38 2022 +0200

Just use Any ctor instead of makeAny in scripting

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

diff --git a/scripting/source/basprov/basscript.cxx 
b/scripting/source/basprov/basscript.cxx
index 9054ee4bfc27..d64fa5af4357 100644
--- a/scripting/source/basprov/basscript.cxx
+++ b/scripting/source/basprov/basscript.cxx
@@ -242,7 +242,7 @@ constexpr OUStringLiteral BASSCRIPT_PROPERTY_CALLER = 
u"Caller";
 // if it's a document-based script, temporarily reset 
ThisComponent to the script invocation context
 Any aOldThisComponent;
 if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
-aOldThisComponent = 
m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( 
m_xDocumentScriptContext ) );
+aOldThisComponent = 
m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", Any( 
m_xDocumentScriptContext ) );
 
 if ( m_caller.hasElements() && m_caller[ 0 ].hasValue()  )
 {
diff --git a/scripting/source/dlgprov/dlgprov.cxx 
b/scripting/source/dlgprov/dlgprov.cxx
index ade1b6424d91..a40c4f6fb2d2 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -603,8 +603,8 @@ namespace dlgprov
 aDecorationAny >>= bDecoration;
 if( !bDecoration )
 {
-xDlgModPropSet->setPropertyValue( 
aDecorationPropName, makeAny( true ) );
-xDlgModPropSet->setPropertyValue( "Title", 
makeAny( OUString() ) );
+xDlgModPropSet->setPropertyValue( 
aDecorationPropName, Any( true ) );
+xDlgModPropSet->setPropertyValue( "Title", Any( 
OUString() ) );
 }
 }
 catch( UnknownPropertyException& )
diff --git a/scripting/source/provider/ActiveMSPList.cxx 
b/scripting/source/provider/ActiveMSPList.cxx
index 85ff36fb1b86..c073c73b730c 100644
--- a/scripting/source/provider/ActiveMSPList.cxx
+++ b/scripting/source/provider/ActiveMSPList.cxx
@@ -142,7 +142,7 @@ Reference< provider::XScriptProvider >
 if ( pos == m_mScriptComponents.end() )
 {
 // TODO
-msp = createNewMSP( uno::makeAny( xContext ) );
+msp = createNewMSP( uno::Any( xContext ) );
 addActiveMSP( xNormalized, msp );
 }
 else
diff --git a/scripting/source/provider/ActiveMSPList.hxx 
b/scripting/source/provider/ActiveMSPList.hxx
index 3685e666cdef..fb52629c1dd2 100644
--- a/scripting/source/provider/ActiveMSPList.hxx
+++ b/scripting/source/provider/ActiveMSPList.hxx
@@ -75,7 +75,7 @@ private:
 css::uno::Reference< css::script::provider::XScriptProvider >
 createNewMSP( const OUString& context )
 {
-return createNewMSP( css::uno::makeAny( context ) );
+return createNewMSP( css::uno::Any( context ) );
 }
 
 friend class NonDocMSPCreator;
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx 
b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 23eb2f203630..9d070ab00514 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -266,8 +266,8 @@ std::vector< Reference< browse::XBrowseNode > > 
getAllBrowseNodes( const Referen
 {
 xFac = provider::theMasterScriptProviderFactory::get( xCtx );
 
-locnBNs[ mspIndex++ ].set( xFac->createScriptProvider( makeAny( 
OUString("user") ) ), UNO_QUERY_THROW );
-locnBNs[ mspIndex++ ].set( xFac->createScriptProvider( makeAny( 
OUString("share") ) ), UNO_QUERY_THROW );
+locnBNs[ mspIndex++ ].set( xFac->createScriptProvider( Any( 
OUString("user") ) ), UNO_QUERY_THROW );
+locnBNs[ mspIndex++ ].set( xFac->createScriptProvider( Any( 
OUString("share") ) ), UNO_QUERY_THROW );
 }
 // TODO proper exception handling, should throw
 catch( const Exception& )
@@ -295,7 +295,7 @@ std::vector< Reference< browse::XBrowseNode > > 
getAllBrowseNodes( const 

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

2022-03-20 Thread Mike Kaganski (via logerrit)
 scripting/source/pyprov/mailmerge.py |  147 ---
 1 file changed, 68 insertions(+), 79 deletions(-)

New commits:
commit cd973e75fa55e3b2703757b1901e9ce644881be9
Author: Mike Kaganski 
AuthorDate: Sun Mar 20 17:05:46 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sun Mar 20 16:37:30 2022 +0100

Remove special-casing Windows stderr handling

Since commit 506173a7f42f34821238a63f3f8c7362c9fae9d9
  Date   Mon Nov 19 13:07:20 2018 +0300
tdf#112536 related: make soffice.bin a proper console application on Win

and commit ab0942240507e9be81dbe43e8d69b7f9273b124f
  Date   Wed Jan 22 22:13:25 2020 +0300
Make unopkg.com proper launcher for unopkg.bin on Windows

there *is* stderr on Windows, so we can revert commits
a34c9a8065c90250f7389cdea660a49e84289098
  Date   Tue Aug 02 09:52:37 2011 +0100
can't use set_debuglevel under windows

and a1775d69e8cccb827331c1984313d2d26ddadadb
  Date   Tue Aug 02 09:57:59 2011 +0100
make logging less painful under windows

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

diff --git a/scripting/source/pyprov/mailmerge.py 
b/scripting/source/pyprov/mailmerge.py
index 69b3b3ae4c97..0ef37b477c81 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -55,13 +55,6 @@ g_ImplementationHelper = unohelper.ImplementationHelper()
 g_providerImplName = "org.openoffice.pyuno.MailServiceProvider"
 g_messageImplName = "org.openoffice.pyuno.MailMessage"
 
-#no stderr under windows, output to pymailmerge.log
-#with no buffering
-if dbg and os.name == 'nt':
-   dbgout = open('pymailmerge.log', 'w', 0)
-else:
-   dbgout = sys.stderr
-
 class PyMailSMTPService(unohelper.Base, XSmtpService):
def __init__( self, ctx ):
self.ctx = ctx
@@ -71,52 +64,48 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
self.connectioncontext = None
self.notify = EventObject(self)
if dbg:
-   print("PyMailSMTPService init", file=dbgout)
-   print("python version is: " + sys.version, file=dbgout)
+   print("PyMailSMTPService init", file=sys.stderr)
+   print("python version is: " + sys.version, 
file=sys.stderr)
def addConnectionListener(self, xListener):
if dbg:
-   print("PyMailSMTPService addConnectionListener", 
file=dbgout)
+   print("PyMailSMTPService addConnectionListener", 
file=sys.stderr)
self.listeners.append(xListener)
def removeConnectionListener(self, xListener):
if dbg:
-   print("PyMailSMTPService removeConnectionListener", 
file=dbgout)
+   print("PyMailSMTPService removeConnectionListener", 
file=sys.stderr)
self.listeners.remove(xListener)
def getSupportedConnectionTypes(self):
if dbg:
-   print("PyMailSMTPService getSupportedConnectionTypes", 
file=dbgout)
+   print("PyMailSMTPService getSupportedConnectionTypes", 
file=sys.stderr)
return self.supportedtypes
def connect(self, xConnectionContext, xAuthenticator):
self.connectioncontext = xConnectionContext
if dbg:
-   print("PyMailSMTPService connect", file=dbgout)
+   print("PyMailSMTPService connect", file=sys.stderr)
server = xConnectionContext.getValueByName("ServerName").strip()
if dbg:
-   print("ServerName: " + server, file=dbgout)
+   print("ServerName: " + server, file=sys.stderr)
port = int(xConnectionContext.getValueByName("Port"))
if dbg:
-   print("Port: " + str(port), file=dbgout)
+   print("Port: " + str(port), file=sys.stderr)
tout = xConnectionContext.getValueByName("Timeout")
if dbg:
-   print(isinstance(tout,int), file=dbgout)
+   print(isinstance(tout,int), file=sys.stderr)
if not isinstance(tout,int):
tout = _GLOBAL_DEFAULT_TIMEOUT
if dbg:
-   print("Timeout: " + str(tout), file=dbgout)
+   print("Timeout: " + str(tout), file=sys.stderr)
if port == 465:
self.server = smtplib.SMTP_SSL(server, 
port,timeout=tout)
else:
self.server = smtplib.SMTP(server, port,timeout=tout)
 
-   #stderr not available for us under windows, but
-   #set_debuglevel outputs 

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

2022-01-04 Thread Noel Grandin (via logerrit)
 scripting/source/stringresource/stringresource.cxx |   82 -
 scripting/source/stringresource/stringresource.hxx |   16 +---
 2 files changed, 39 insertions(+), 59 deletions(-)

New commits:
commit 5de44f16b68977058386a60ca468de3efa780a25
Author: Noel Grandin 
AuthorDate: Mon Dec 20 19:10:49 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Jan 4 10:44:03 2022 +0100

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

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

diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index c7b40bb09e46..3b3c356fa784 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -50,18 +50,6 @@ using namespace ::com::sun::star::container;
 namespace stringresource
 {
 
-
-// mutex
-
-
-::osl::Mutex& getMutex()
-{
-static ::osl::Mutex s_aMutex;
-
-return s_aMutex;
-}
-
-
 // StringResourceImpl
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
@@ -77,7 +65,6 @@ StringResourceImpl::StringResourceImpl( const Reference< 
XComponentContext >& rx
 , m_pCurrentLocaleItem( nullptr )
 , m_pDefaultLocaleItem( nullptr )
 , m_bDefaultModified( false )
-, m_aListenerContainer( getMutex() )
 , m_bModified( false )
 , m_bReadOnly( false )
 , m_nNextUniqueNumericId( UNIQUE_NUMBER_NEEDS_INITIALISATION )
@@ -115,6 +102,7 @@ void StringResourceImpl::addModifyListener( const 
Reference< XModifyListener >&
 if( !aListener.is() )
 throw RuntimeException();
 
+std::unique_lock aGuard( m_aMutex );
 m_aListenerContainer.addInterface( aListener );
 }
 
@@ -123,6 +111,7 @@ void StringResourceImpl::removeModifyListener( const 
Reference< XModifyListener
 if( !aListener.is() )
 throw RuntimeException();
 
+std::unique_lock aGuard( m_aMutex );
 m_aListenerContainer.removeInterface( aListener );
 }
 
@@ -152,13 +141,13 @@ OUString StringResourceImpl::implResolveString
 
 OUString StringResourceImpl::resolveString( const OUString& ResourceID )
 {
-::osl::MutexGuard aGuard( getMutex() );
+std::unique_lock aGuard( m_aMutex );
 return implResolveString( ResourceID, m_pCurrentLocaleItem );
 }
 
 OUString StringResourceImpl::resolveStringForLocale( const OUString& 
ResourceID, const Locale& locale )
 {
-::osl::MutexGuard aGuard( getMutex() );
+std::unique_lock aGuard( m_aMutex );
 LocaleItem* pLocaleItem = getItemForLocale( locale, false );
 return implResolveString( ResourceID, pLocaleItem );
 }
@@ -177,14 +166,14 @@ bool StringResourceImpl::implHasEntryForId( const 
OUString& ResourceID, LocaleIt
 
 sal_Bool StringResourceImpl::hasEntryForId( const OUString& ResourceID )
 {
-::osl::MutexGuard aGuard( getMutex() );
+std::unique_lock aGuard( m_aMutex );
 return implHasEntryForId( ResourceID, m_pCurrentLocaleItem );
 }
 
 sal_Bool StringResourceImpl::hasEntryForIdAndLocale( const OUString& 
ResourceID,
 const Locale& locale )
 {
-::osl::MutexGuard aGuard( getMutex() );
+std::unique_lock aGuard( m_aMutex );
 LocaleItem* pLocaleItem = getItemForLocale( locale, false );
 return implHasEntryForId( ResourceID, pLocaleItem );
 }
@@ -213,20 +202,20 @@ Sequence< OUString > 
StringResourceImpl::implGetResourceIDs( LocaleItem* pLocale
 Sequence< OUString > StringResourceImpl::getResourceIDsForLocale
 ( const Locale& locale )
 {
-::osl::MutexGuard aGuard( getMutex() );
+std::unique_lock aGuard( m_aMutex );
 LocaleItem* pLocaleItem = getItemForLocale( locale, false );
 return implGetResourceIDs( pLocaleItem );
 }
 
 Sequence< OUString > StringResourceImpl::getResourceIDs(  )
 {
-::osl::MutexGuard aGuard( getMutex() );
+std::unique_lock aGuard( m_aMutex );
 return implGetResourceIDs( m_pCurrentLocaleItem );
 }
 
 Locale StringResourceImpl::getCurrentLocale()
 {
-::osl::MutexGuard aGuard( getMutex() );
+std::unique_lock aGuard( m_aMutex );
 
 Locale aRetLocale;
 if( m_pCurrentLocaleItem != nullptr )
@@ -236,7 +225,7 @@ Locale StringResourceImpl::getCurrentLocale()
 
 Locale StringResourceImpl::getDefaultLocale(  )
 {
-::osl::MutexGuard aGuard( getMutex() );
+std::unique_lock aGuard( m_aMutex );
 
 Locale aRetLocale;
 if( m_pDefaultLocaleItem != nullptr )
@@ -246,7 +235,7 @@ Locale StringResourceImpl::getDefaultLocale(  )
 
 Sequence< Locale > StringResourceImpl::getLocales(  )
 {
-::osl::MutexGuard aGuard( getMutex() );
+std::unique_lock aGuard( m_aMutex );
 
 sal_Int32 nSize = m_aLocaleItemVector.size();
 Sequence< Locale > aLocalSeq( nSize );
@@ -280,8 +269,6 @@ sal_Bool StringResourceImpl::isReadOnly()
 void StringResourceImpl::implSetCurrentLocale( const Locale& locale,
 bool FindClosestMatch, bool bUseDefaultIfNoMatch )

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

2021-12-18 Thread Noel Grandin (via logerrit)
 scripting/source/basprov/basmethnode.hxx |3 ++-
 scripting/source/basprov/basscript.hxx   |3 ++-
 scripting/source/inc/bcholder.hxx|   12 
 3 files changed, 4 insertions(+), 14 deletions(-)

New commits:
commit 1d83453ce33de1ab72f0a635f73d13c440a46c81
Author: Noel Grandin 
AuthorDate: Sat Dec 18 09:41:52 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Dec 18 19:50:07 2021 +0100

use more cppu::BaseMutex

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

diff --git a/scripting/source/basprov/basmethnode.hxx 
b/scripting/source/basprov/basmethnode.hxx
index 53f9a8fbc357..d1eddada026b 100644
--- a/scripting/source/basprov/basmethnode.hxx
+++ b/scripting/source/basprov/basmethnode.hxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 
@@ -44,7 +45,7 @@ namespace basprov
 css::script::XInvocation > BasicMethodNodeImpl_BASE;
 
 class BasicMethodNodeImpl : public BasicMethodNodeImpl_BASE,
-public ::scripting_helper::OMutexHolder,
+public cppu::BaseMutex,
 public 
::scripting_helper::OBroadcastHelperHolder,
 public ::comphelper::OPropertyContainer,
 public 
::comphelper::OPropertyArrayUsageHelper< BasicMethodNodeImpl >
diff --git a/scripting/source/basprov/basscript.hxx 
b/scripting/source/basprov/basscript.hxx
index f92691affe75..d0f9e6e7af85 100644
--- a/scripting/source/basprov/basscript.hxx
+++ b/scripting/source/basprov/basscript.hxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -42,7 +43,7 @@ namespace basprov
 
 
 class BasicScriptImpl : public BasicScriptImpl_BASE, public SfxListener,
-public ::scripting_helper::OMutexHolder,
+public cppu::BaseMutex,
 public 
::scripting_helper::OBroadcastHelperHolder,
 public ::comphelper::OPropertyContainer,
 public 
::comphelper::OPropertyArrayUsageHelper< BasicScriptImpl >
diff --git a/scripting/source/inc/bcholder.hxx 
b/scripting/source/inc/bcholder.hxx
index d9c994013bcb..9f8add31bb3e 100644
--- a/scripting/source/inc/bcholder.hxx
+++ b/scripting/source/inc/bcholder.hxx
@@ -26,18 +26,6 @@
 namespace scripting_helper
 {
 
-
-
-
-class OMutexHolder
-{
-protected:
-::osl::Mutex m_aMutex;
-};
-
-
-
-
 class OBroadcastHelperHolder
 {
 ::cppu::OBroadcastHelperm_aBHelper;


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

2021-11-28 Thread Noel Grandin (via logerrit)
 scripting/source/stringresource/stringresource.cxx |   12 
 scripting/source/stringresource/stringresource.hxx |4 ++--
 2 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 9622b62f1bc181f3841f0e730fb212bfd40758b8
Author: Noel Grandin 
AuthorDate: Sun Nov 28 09:58:31 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Nov 28 17:21:22 2021 +0100

use more OInterfaceContainerHelper2 in scripting

and remove unnecessary guards, OInterfaceContainerHelper3 will
already take the mutex

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

diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 74d491704fcd..c7b40bb09e46 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -115,8 +115,7 @@ void StringResourceImpl::addModifyListener( const 
Reference< XModifyListener >&
 if( !aListener.is() )
 throw RuntimeException();
 
-::osl::MutexGuard aGuard( getMutex() );
-m_aListenerContainer.addInterface( Reference( aListener, 
UNO_QUERY ) );
+m_aListenerContainer.addInterface( aListener );
 }
 
 void StringResourceImpl::removeModifyListener( const Reference< 
XModifyListener >& aListener )
@@ -124,8 +123,7 @@ void StringResourceImpl::removeModifyListener( const 
Reference< XModifyListener
 if( !aListener.is() )
 throw RuntimeException();
 
-::osl::MutexGuard aGuard( getMutex() );
-m_aListenerContainer.removeInterface( Reference( aListener, 
UNO_QUERY ) );
+m_aListenerContainer.removeInterface( aListener );
 }
 
 
@@ -615,14 +613,12 @@ void StringResourceImpl::implNotifyListeners()
 EventObject aEvent;
 aEvent.Source = static_cast< XInterface* >( 
static_cast(this) );
 
-::comphelper::OInterfaceIteratorHelper2 it( m_aListenerContainer );
+::comphelper::OInterfaceIteratorHelper3 it( m_aListenerContainer );
 while( it.hasMoreElements() )
 {
-Reference< XInterface > xIface = it.next();
-Reference< XModifyListener > xListener( xIface, UNO_QUERY );
 try
 {
-xListener->modified( aEvent );
+it.next()->modified( aEvent );
 }
 catch(RuntimeException&)
 {
diff --git a/scripting/source/stringresource/stringresource.hxx 
b/scripting/source/stringresource/stringresource.hxx
index 2cb2e0aa1424..b2ca571844d3 100644
--- a/scripting/source/stringresource/stringresource.hxx
+++ b/scripting/source/stringresource/stringresource.hxx
@@ -28,7 +28,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -94,7 +94,7 @@ protected:
 LocaleItem*   
m_pDefaultLocaleItem;
 bool  
m_bDefaultModified;
 
-::comphelper::OInterfaceContainerHelper2
m_aListenerContainer;
+::comphelper::OInterfaceContainerHelper3 
m_aListenerContainer;
 
 std::vector< std::unique_ptr >
m_aLocaleItemVector;
 std::vector< std::unique_ptr >
m_aDeletedLocaleItemVector;


[Libreoffice-commits] core.git: scripting/source ucb/source

2021-11-07 Thread Julien Nabet (via logerrit)
 scripting/source/provider/BrowseNodeFactoryImpl.cxx |2 +-
 ucb/source/ucp/tdoc/tdoc_stgelems.hxx   |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit f23a4e6d46cb7802d248984bc82ae6247cffd855
Author: Julien Nabet 
AuthorDate: Sun Nov 7 11:38:19 2021 +0100
Commit: Julien Nabet 
CommitDate: Sun Nov 7 12:57:59 2021 +0100

Typo: implemnented->implemented

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

diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx 
b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 15055eb8514c..360ae8ee97d2 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -458,7 +458,7 @@ public:
 }
 }
 
-// XTypeProvider (implemnented by base, but needs to be overridden for
+// XTypeProvider (implemented by base, but needs to be overridden for
 //delegating to aggregate)
 virtual Sequence< Type > SAL_CALL getTypes() override
 {
diff --git a/ucb/source/ucp/tdoc/tdoc_stgelems.hxx 
b/ucb/source/ucp/tdoc/tdoc_stgelems.hxx
index f6e8f609e025..3927f2819063 100644
--- a/ucb/source/ucp/tdoc/tdoc_stgelems.hxx
+++ b/ucb/source/ucp/tdoc/tdoc_stgelems.hxx
@@ -198,7 +198,7 @@ public:
 virtual css::uno::Any SAL_CALL
 queryInterface( const css::uno::Type& aType ) override;
 
-// XTypeProvider (implemnented by base, but needs to be overridden for
+// XTypeProvider (implemented by base, but needs to be overridden for
 //delegating to aggregate)
 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
 getTypes() override;
@@ -257,7 +257,7 @@ public:
 virtual css::uno::Any SAL_CALL
 queryInterface( const css::uno::Type& aType ) override;
 
-// XTypeProvider (implemnented by base, but needs to be overridden for
+// XTypeProvider (implemented by base, but needs to be overridden for
 //delegating to aggregate)
 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
 getTypes() override;


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

2021-10-30 Thread Mike Kaganski (via logerrit)
 scripting/source/basprov/basmethnode.cxx|   20 ++
 scripting/source/dlgprov/dlgevtatt.cxx  |2 -
 scripting/source/dlgprov/dlgprov.cxx|   16 +--
 scripting/source/protocolhandler/scripthandler.cxx  |6 ++--
 scripting/source/provider/ActiveMSPList.cxx |7 ++---
 scripting/source/provider/BrowseNodeFactoryImpl.cxx |   12 +---
 scripting/source/provider/MasterScriptProvider.cxx  |   12 +---
 scripting/source/provider/ProviderCache.cxx |5 ++-
 scripting/source/vbaevents/eventhelper.cxx  |   28 +---
 9 files changed, 49 insertions(+), 59 deletions(-)

New commits:
commit 22ba855d1a2317361c6ad8b631ae1bd707887435
Author: Mike Kaganski 
AuthorDate: Fri Oct 29 10:00:35 2021 +0300
Commit: Mike Kaganski 
CommitDate: Sat Oct 30 22:04:01 2021 +0200

Prepare for removal of non-const operator[] from Sequence in scripting

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

diff --git a/scripting/source/basprov/basmethnode.cxx 
b/scripting/source/basprov/basmethnode.cxx
index 688b4ef2140f..fca2cafe8d72 100644
--- a/scripting/source/basprov/basmethnode.cxx
+++ b/scripting/source/basprov/basmethnode.cxx
@@ -23,6 +23,8 @@
 #include 
 #include 
 #include 
+
+#include 
 #include 
 #include 
 #include 
@@ -237,17 +239,13 @@ namespace basprov
 {
 Reference< frame::XDispatchHelper > xHelper( 
frame::DispatchHelper::create( m_xContext ) );
 
-Sequence < PropertyValue > aArgs(7);
-aArgs[0].Name = "Document";
-aArgs[0].Value <<= sDocURL;
-aArgs[1].Name = "LibName";
-aArgs[1].Value <<= sLibName;
-aArgs[2].Name = "Name";
-aArgs[2].Value <<= sModName;
-aArgs[3].Name = "Type";
-aArgs[3].Value <<= OUString("Module");
-aArgs[4].Name = "Line";
-aArgs[4].Value <<= static_cast< sal_uInt32 >( nLine1 );
+Sequence < PropertyValue > aArgs{
+comphelper::makePropertyValue("Document", sDocURL),
+comphelper::makePropertyValue("LibName", sLibName),
+comphelper::makePropertyValue("Name", sModName),
+comphelper::makePropertyValue("Type", OUString("Module")),
+comphelper::makePropertyValue("Line", static_cast< 
sal_uInt32 >( nLine1 ))
+};
 xHelper->executeDispatch( xProv, ".uno:BasicIDEAppear", 
OUString(), 0, aArgs );
 }
 }
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx 
b/scripting/source/dlgprov/dlgevtatt.cxx
index 43b5851c225a..704518e07aef 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -113,7 +113,7 @@ namespace dlgprov
 Sequence< Any > args(1);
 if ( xSMgr.is() )
 {
-args[0] <<= xModel;
+args.getArray()[0] <<= xModel;
 mxListener.set( xSMgr->createInstanceWithArgumentsAndContext( 
"ooo.vba.EventListener", args, m_xContext ), UNO_QUERY );
 }
 if ( !rxControl.is() )
diff --git a/scripting/source/dlgprov/dlgprov.cxx 
b/scripting/source/dlgprov/dlgprov.cxx
index d52660904471..5a4e5c7eb124 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -71,15 +71,15 @@ namespace dlgprov
 OUString aDlgLocation = aInetObj.GetMainURL( 
INetURLObject::DecodeMechanism::NONE );
 css::lang::Locale aLocale = 
Application::GetSettings().GetUILanguageTag().getLocale();
 
-Sequence aArgs( 6 );
-aArgs[0] <<= aDlgLocation;
-aArgs[1] <<= true; // bReadOnly
-aArgs[2] <<= aLocale;
-aArgs[3] <<= aDlgName;
-aArgs[4] <<= OUString();
-
 Reference< task::XInteractionHandler > xDummyHandler;
-aArgs[5] <<= xDummyHandler;
+
+Sequence aArgs{ Any(aDlgLocation),
+ Any(true), // bReadOnly
+ Any(aLocale),
+ Any(aDlgName),
+ Any(OUString()),
+ Any(xDummyHandler) };
+
 Reference< XMultiComponentFactory > xSMgr_( 
i_xContext->getServiceManager(), UNO_SET_THROW );
 // TODO: Ctor
 Reference< resource::XStringResourceManager > xStringResourceManager( 
xSMgr_->createInstanceWithContext
diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index db9d746c81be..0ef2fdad21db 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -176,8 +176,8 @@ void SAL_CALL 
ScriptProtocolHandler::dispatchWithNotification(
 

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

2021-08-01 Thread Noel Grandin (via logerrit)
 scripting/source/provider/ProviderCache.cxx |6 +++---
 scripting/source/provider/ProviderCache.hxx |4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 933cf264b29307ce5cdf489ff89f5da889f5d298
Author: Noel Grandin 
AuthorDate: Sun Aug 1 12:58:19 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 21:01:23 2021 +0200

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

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

diff --git a/scripting/source/provider/ProviderCache.cxx 
b/scripting/source/provider/ProviderCache.cxx
index 4291d811c7a8..765de8c155d0 100644
--- a/scripting/source/provider/ProviderCache.cxx
+++ b/scripting/source/provider/ProviderCache.cxx
@@ -62,7 +62,7 @@ ProviderCache::~ProviderCache()
 Reference< provider::XScriptProvider >
 ProviderCache::getProvider( const OUString& providerName )
 {
-::osl::Guard< osl::Mutex > aGuard( m_mutex );
+std::lock_guard aGuard( m_mutex );
 Reference< provider::XScriptProvider > provider;
 ProviderDetails_hash::iterator h_it = m_hProviderDetailsCache.find( 
providerName );
 if ( h_it != m_hProviderDetailsCache.end() )
@@ -86,7 +86,7 @@ ProviderCache::getAllProviders()
 // need to create providers that haven't been created already
 // so check what providers exist and what ones don't
 
-::osl::Guard< osl::Mutex > aGuard( m_mutex );
+std::lock_guard aGuard( m_mutex );
 Sequence < Reference< provider::XScriptProvider > > providers (  
m_hProviderDetailsCache.size() );
 // should assert if size !>  0
 if (  !m_hProviderDetailsCache.empty() )
@@ -132,7 +132,7 @@ ProviderCache::populateCache()
 {
 // wrong name in services.rdb
 OUString serviceName;
-::osl::Guard< osl::Mutex > aGuard( m_mutex );
+std::lock_guard aGuard( m_mutex );
 try
 {
 Reference< container::XContentEnumerationAccess > xEnumAccess( m_xMgr, 
UNO_QUERY_THROW );
diff --git a/scripting/source/provider/ProviderCache.hxx 
b/scripting/source/provider/ProviderCache.hxx
index 5e00217875a2..6b5059370c05 100644
--- a/scripting/source/provider/ProviderCache.hxx
+++ b/scripting/source/provider/ProviderCache.hxx
@@ -19,13 +19,13 @@
 
 #pragma once
 
-#include 
 #include 
 #include 
 #include 
 
 #include 
 
+#include 
 #include 
 
 namespace func_provider
@@ -68,7 +68,7 @@ private:
 bool isInDenyList( const OUString& serviceName );
 css::uno::Sequence< OUString >  m_sDenyList;
 ProviderDetails_hash  m_hProviderDetailsCache;
-osl::Mutex m_mutex;
+std::mutex m_mutex;
 css::uno::Sequence< css::uno::Any >  m_Sctx;
 css::uno::Reference< css::uno::XComponentContext > m_xContext;
 css::uno::Reference< css::lang::XMultiComponentFactory > m_xMgr;


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

2021-08-01 Thread Noel Grandin (via logerrit)
 scripting/source/provider/MasterScriptProvider.cxx |2 +-
 scripting/source/provider/MasterScriptProvider.hxx |3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 86d66c60043f97fcdeb7cabd40fe86c03216655a
Author: Noel Grandin 
AuthorDate: Sun Aug 1 12:56:22 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 21:01:03 2021 +0200

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

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

diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index 041f77a65c40..e8719c8cb4aa 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -335,7 +335,7 @@ MasterScriptProvider::providerCache()
 {
 if ( !m_pPCache )
 {
-::osl::MutexGuard aGuard( m_mutex );
+std::lock_guard aGuard( m_mutex );
 if ( !m_pPCache )
 {
 Sequence denylist { 
"com.sun.star.script.provider.ScriptProviderForBasic" };
diff --git a/scripting/source/provider/MasterScriptProvider.hxx 
b/scripting/source/provider/MasterScriptProvider.hxx
index 2328746f950a..0e6c40f5f0a6 100644
--- a/scripting/source/provider/MasterScriptProvider.hxx
+++ b/scripting/source/provider/MasterScriptProvider.hxx
@@ -35,6 +35,7 @@
 
 #include "ProviderCache.hxx"
 #include 
+#include 
 
 namespace func_provider
 {
@@ -121,7 +122,7 @@ private:
 bool m_bIsPkgMSP;
 css::uno::Reference< css::script::provider::XScriptProvider > m_xMSPPkg;
 std::unique_ptr m_pPCache;
-osl::Mutex m_mutex;
+std::mutex m_mutex;
 OUString m_sCtxString;
 };
 


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

2021-02-06 Thread ViKrAm-Baisclear (via logerrit)
 scripting/source/stringresource/stringresource.hxx |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit ab559cf3423f29f00697afb9cea4636e9f9069f6
Author: ViKrAm-Baisclear 
AuthorDate: Fri Jan 15 14:03:08 2021 +0530
Commit: Ilmari Lauhakangas 
CommitDate: Sat Feb 6 15:38:35 2021 +0100

tdf#124176 Used pragma once instead of include guards

Change-Id: I235462f3ce81816f3ce36c7423dd3e50fc03778a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109320
Tested-by: Jenkins
Reviewed-by: Ilmari Lauhakangas 

diff --git a/scripting/source/stringresource/stringresource.hxx 
b/scripting/source/stringresource/stringresource.hxx
index 81c558fd7b99..6a2a583c3b3e 100644
--- a/scripting/source/stringresource/stringresource.hxx
+++ b/scripting/source/stringresource/stringresource.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SCRIPTING_SOURCE_STRINGRESOURCE_STRINGRESOURCE_HXX
-#define INCLUDED_SCRIPTING_SOURCE_STRINGRESOURCE_STRINGRESOURCE_HXX
+#pragma once
 
 #include 
 #include 
@@ -491,7 +490,4 @@ public:
 
 }   // namespace stringtable
 
-
-#endif // INCLUDED_SCRIPTING_SOURCE_STRINGRESOURCE_STRINGRESOURCE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-10-14 Thread Julien Nabet (via logerrit)
 scripting/source/vbaevents/eventhelper.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit f76f15f02a30d20be1c4816d72f7ad7fb4fa20d3
Author: Julien Nabet 
AuthorDate: Sun Oct 11 12:25:30 2020 +0200
Commit: Julien Nabet 
CommitDate: Wed Oct 14 22:14:59 2020 +0200

Replace list by vector in scripting/eventhelpher

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

diff --git a/scripting/source/vbaevents/eventhelper.cxx 
b/scripting/source/vbaevents/eventhelper.cxx
index 5fdbe8c078cf..31e7a1bf80d2 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -67,7 +67,7 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -172,7 +172,7 @@ struct TranslateInfo
 
 typedef std::unordered_map<
 OUString,
-std::list< TranslateInfo > > EventInfoHash;
+std::vector< TranslateInfo > > EventInfoHash;
 
 namespace {
 
@@ -273,14 +273,14 @@ static EventInfoHash& getEventTransInfo()
 while (i < nCount)
 {
 sEventInfo = pTransProp->sEventInfo;
-std::list< TranslateInfo > infoList;
+std::vector< TranslateInfo > infoList;
 do
 {
 infoList.push_back( pTransProp->aTransInfo );
 pTransProp++;
 i++;
 }while(i < nCount && sEventInfo == pTransProp->sEventInfo);
-tmp[sEventInfo] = infoList;
+tmp[sEventInfo] = std::move(infoList);
 }
 return tmp;
 }();
@@ -382,7 +382,7 @@ ScriptEventHelper::~ScriptEventHelper()
 Sequence< OUString >
 ScriptEventHelper::getEventListeners() const
 {
-std::list< OUString > eventMethods;
+std::vector< OUString > eventMethods;
 
 Reference< beans::XIntrospection > xIntrospection = 
beans::theIntrospection::get( m_xCtx );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-15 Thread Noel Grandin (via logerrit)
 scripting/source/basprov/basprov.component |5 +-
 scripting/source/basprov/basprov.cxx   |   64 -
 2 files changed, 13 insertions(+), 56 deletions(-)

New commits:
commit e78b16632f5a3ad974574dd0354df3cef1f5c844
Author: Noel Grandin 
AuthorDate: Tue Jul 14 12:48:58 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 15 10:10:54 2020 +0200

scripting/basprov: create instances with uno constructors

See tdf#74608 for motivation.

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

diff --git a/scripting/source/basprov/basprov.component 
b/scripting/source/basprov/basprov.component
index 8a660e38b2a8..d0d6bf974925 100644
--- a/scripting/source/basprov/basprov.component
+++ b/scripting/source/basprov/basprov.component
@@ -18,8 +18,9 @@
  -->
 
 http://openoffice.org/2010/uno-components;>
-  
+xmlns="http://openoffice.org/2010/uno-components;>
+  
 
 
 
diff --git a/scripting/source/basprov/basprov.cxx 
b/scripting/source/basprov/basprov.cxx
index bd1832ba98ba..e1492af59995 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -60,28 +60,6 @@ using namespace ::sf_misc;
 namespace basprov
 {
 
-
-// component operations
-
-
-static OUString getImplementationName_BasicProviderImpl()
-{
-return "com.sun.star.comp.scripting.ScriptProviderForBasic";
-}
-
-
-static Sequence< OUString > getSupportedServiceNames_BasicProviderImpl()
-{
-static Sequence< OUString > s_Names{
-"com.sun.star.script.provider.ScriptProviderForBasic",
-"com.sun.star.script.provider.LanguageScriptProvider",
-"com.sun.star.script.provider.ScriptProvider",
-"com.sun.star.script.browse.BrowseNode"};
-
-return s_Names;
-}
-
-
 // BasicProviderImpl
 
 
@@ -170,7 +148,7 @@ namespace basprov
 // XServiceInfo
 OUString BasicProviderImpl::getImplementationName(  )
 {
-return getImplementationName_BasicProviderImpl();
+return "com.sun.star.comp.scripting.ScriptProviderForBasic";
 }
 
 sal_Bool BasicProviderImpl::supportsService( const OUString& rServiceName )
@@ -180,7 +158,11 @@ namespace basprov
 
 Sequence< OUString > BasicProviderImpl::getSupportedServiceNames(  )
 {
-return getSupportedServiceNames_BasicProviderImpl();
+return {
+"com.sun.star.script.provider.ScriptProviderForBasic",
+"com.sun.star.script.provider.LanguageScriptProvider",
+"com.sun.star.script.provider.ScriptProvider",
+"com.sun.star.script.browse.BrowseNode"};
 }
 
 
@@ -484,40 +466,14 @@ namespace basprov
 
 // component operations
 
-
-static Reference< XInterface > create_BasicProviderImpl(
-Reference< XComponentContext > const & xContext )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+scripting_BasicProviderImpl_get_implementation(
+css::uno::XComponentContext* context, 
css::uno::Sequence const&)
 {
-return static_cast< lang::XTypeProvider * >( new BasicProviderImpl( 
xContext ) );
+return cppu::acquire(new BasicProviderImpl(context));
 }
 
 
-struct ::cppu::ImplementationEntry const s_component_entries [] =
-{
-{
-create_BasicProviderImpl, getImplementationName_BasicProviderImpl,
-getSupportedServiceNames_BasicProviderImpl, 
::cppu::createSingleComponentFactory,
-nullptr, 0
-},
-{ nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-};
-
-
 }   // namespace basprov
 
-
-// component exports
-
-
-extern "C"
-{
-SAL_DLLPUBLIC_EXPORT void * basprov_component_getFactory(
-const char * pImplName, void * pServiceManager,
-void * pRegistryKey )
-{
-return ::cppu::component_getFactoryHelper(
-pImplName, pServiceManager, pRegistryKey, 
::basprov::s_component_entries );
-}
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-15 Thread Noel Grandin (via logerrit)
 scripting/source/protocolhandler/protocolhandler.component |5 
 scripting/source/protocolhandler/scripthandler.cxx |   73 -
 scripting/source/protocolhandler/scripthandler.hxx |   12 --
 3 files changed, 8 insertions(+), 82 deletions(-)

New commits:
commit b2835b2a65918c8ea73fde4ba6befa1fabbe6033
Author: Noel Grandin 
AuthorDate: Tue Jul 14 12:35:28 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 15 10:08:08 2020 +0200

scripting/protocolhandler: create instances with uno constructors

See tdf#74608 for motivation.

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

diff --git a/scripting/source/protocolhandler/protocolhandler.component 
b/scripting/source/protocolhandler/protocolhandler.component
index d569cfe9911a..959c332c0e86 100644
--- a/scripting/source/protocolhandler/protocolhandler.component
+++ b/scripting/source/protocolhandler/protocolhandler.component
@@ -18,8 +18,9 @@
  -->
 
 http://openoffice.org/2010/uno-components;>
-  
+xmlns="http://openoffice.org/2010/uno-components;>
+  
 
   
 
diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index a759ef63070c..78d754300cfa 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -413,7 +413,7 @@ ScriptProtocolHandler::~ScriptProtocolHandler()
 /* XServiceInfo */
 OUString SAL_CALL ScriptProtocolHandler::getImplementationName( )
 {
-return impl_getStaticImplementationName();
+return "com.sun.star.comp.ScriptProtocolHandler";
 }
 
 /* XServiceInfo */
@@ -424,81 +424,18 @@ sal_Bool SAL_CALL 
ScriptProtocolHandler::supportsService(const OUString& sServic
 
 /* XServiceInfo */
 Sequence< OUString > SAL_CALL ScriptProtocolHandler::getSupportedServiceNames()
-{
-return impl_getStaticSupportedServiceNames();
-}
-
-/* Helper for XServiceInfo */
-Sequence< OUString > 
ScriptProtocolHandler::impl_getStaticSupportedServiceNames()
 {
 return {"com.sun.star.frame.ProtocolHandler"};
 }
 
-/* Helper for XServiceInfo */
-OUString ScriptProtocolHandler::impl_getStaticImplementationName()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+scripting_ScriptProtocolHandler_get_implementation(
+css::uno::XComponentContext* context, css::uno::Sequence 
const&)
 {
-return "com.sun.star.comp.ScriptProtocolHandler";
-}
-
-/* Helper for registry */
-Reference< XInterface > SAL_CALL ScriptProtocolHandler::impl_createInstance(
-const Reference< css::lang::XMultiServiceFactory >& xServiceManager )
-{
-return Reference< XInterface > ( *new ScriptProtocolHandler( 
comphelper::getComponentContext(xServiceManager) ) );
-}
-
-/* Factory for registration */
-Reference< XSingleServiceFactory > ScriptProtocolHandler::impl_createFactory(
-const Reference< XMultiServiceFactory >& xServiceManager )
-{
-Reference< XSingleServiceFactory > xReturn (
-cppu::createSingleFactory( xServiceManager,
-ScriptProtocolHandler::impl_getStaticImplementationName(),
-ScriptProtocolHandler::impl_createInstance,
-ScriptProtocolHandler::impl_getStaticSupportedServiceNames() )
-);
-return xReturn;
+return cppu::acquire(new ScriptProtocolHandler(context));
 }
 
 } // namespace scripting_protocolhandler
 
-extern "C"
-{
-SAL_DLLPUBLIC_EXPORT void* protocolhandler_component_getFactory( const 
char * pImplementationName ,
- void * pServiceManager ,
- void * )
-{
-// Set default return value for this operation - if it failed.
-void * pReturn = nullptr ;
-
-if (
-( pImplementationName != nullptr ) &&
-( pServiceManager != nullptr )
-)
-{
-// Define variables which are used in following macros.
-css::uno::Reference< css::lang::XSingleServiceFactory > xFactory;
-css::uno::Reference< css::lang::XMultiServiceFactory > 
xServiceManager(
-static_cast< css::lang::XMultiServiceFactory* >( 
pServiceManager ) ) ;
-
-if ( 
::scripting_protocolhandler::ScriptProtocolHandler::impl_getStaticImplementationName().equalsAscii(
-pImplementationName ) )
-{
-xFactory = 
::scripting_protocolhandler::ScriptProtocolHandler::impl_createFactory( 
xServiceManager );
-}
-
-// Factory is valid - service was found.
-if ( xFactory.is() )
-{
-xFactory->acquire();
-pReturn = xFactory.get();
-}
-}
-
-// Return with result of this operation.
-return pReturn ;
-}
-} // extern "C"
-
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git 

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

2020-07-15 Thread Noel Grandin (via logerrit)
 scripting/source/stringresource/stringresource.component |   11 -
 scripting/source/stringresource/stringresource.cxx   |  112 ++-
 2 files changed, 25 insertions(+), 98 deletions(-)

New commits:
commit fd5531534dc1e2f90d33f1d0cf9c0fe2cb9fd6f5
Author: Noel Grandin 
AuthorDate: Tue Jul 14 12:13:10 2020 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 15 09:47:26 2020 +0200

scripting/stringresource: create instances with uno constructors

See tdf#74608 for motivation.

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

diff --git a/scripting/source/stringresource/stringresource.component 
b/scripting/source/stringresource/stringresource.component
index e39e0f908882..a2b2a24f33b5 100644
--- a/scripting/source/stringresource/stringresource.component
+++ b/scripting/source/stringresource/stringresource.component
@@ -18,14 +18,17 @@
  -->
 
 http://openoffice.org/2010/uno-components;>
-  
+xmlns="http://openoffice.org/2010/uno-components;>
+  
 
   
-  
+  
 
   
-  
+  
 
   
 
diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index dc8b38466416..217536d66c55 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -65,23 +65,11 @@ namespace stringresource
 
 // StringResourceImpl
 
-
-// component operations
-static Sequence< OUString > getSupportedServiceNames_StringResourceImpl()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+scripting_StringResourcePersistenceImpl_implementation(
+css::uno::XComponentContext* context, css::uno::Sequence 
const&)
 {
-Sequence< OUString > names { "com.sun.star.resource.StringResource" };
-return names;
-}
-
-static OUString getImplementationName_StringResourceImpl()
-{
-return "com.sun.star.comp.scripting.StringResource";
-}
-
-static Reference< XInterface > create_StringResourceImpl(
-Reference< XComponentContext > const & xContext )
-{
-return static_cast< ::cppu::OWeakObject * >( new 
StringResourcePersistenceImpl( xContext ) );
+return cppu::acquire(new StringResourcePersistenceImpl(context));
 }
 
 
@@ -107,7 +95,7 @@ StringResourceImpl::~StringResourceImpl()
 
 OUString StringResourceImpl::getImplementationName(  )
 {
-return getImplementationName_StringResourceImpl();
+return "com.sun.star.comp.scripting.StringResource";
 }
 
 sal_Bool StringResourceImpl::supportsService( const OUString& rServiceName )
@@ -117,7 +105,7 @@ sal_Bool StringResourceImpl::supportsService( const 
OUString& rServiceName )
 
 Sequence< OUString > StringResourceImpl::getSupportedServiceNames(  )
 {
-return getSupportedServiceNames_StringResourceImpl();
+return { "com.sun.star.resource.StringResource" };
 }
 
 
@@ -2047,23 +2035,11 @@ bool 
StringResourcePersistenceImpl::implWritePropertiesFile( LocaleItem const *
 
 // StringResourceWithStorageImpl
 
-
-// component operations
-static Sequence< OUString > 
getSupportedServiceNames_StringResourceWithStorageImpl()
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+scripting_StringResourceWithStorageImpl_get_implementation(
+css::uno::XComponentContext* context, css::uno::Sequence 
const&)
 {
-Sequence< OUString > names { 
"com.sun.star.resource.StringResourceWithStorage" };
-return names;
-}
-
-static OUString getImplementationName_StringResourceWithStorageImpl()
-{
-return "com.sun.star.comp.scripting.StringResourceWithStorage";
-}
-
-static Reference< XInterface > create_StringResourceWithStorageImpl(
-Reference< XComponentContext > const & xContext )
-{
-return static_cast< ::cppu::OWeakObject * >( new 
StringResourceWithStorageImpl( xContext ) );
+return cppu::acquire(new StringResourceWithStorageImpl(context));
 }
 
 
@@ -2084,7 +2060,7 @@ 
StringResourceWithStorageImpl::~StringResourceWithStorageImpl()
 
 OUString StringResourceWithStorageImpl::getImplementationName(  )
 {
-return getImplementationName_StringResourceWithStorageImpl();
+return "com.sun.star.comp.scripting.StringResourceWithStorage";
 }
 
 sal_Bool StringResourceWithStorageImpl::supportsService( const OUString& 
rServiceName )
@@ -2094,7 +2070,7 @@ sal_Bool StringResourceWithStorageImpl::supportsService( 
const OUString& rServic
 
 Sequence< OUString > StringResourceWithStorageImpl::getSupportedServiceNames(  
)
 {
-return getSupportedServiceNames_StringResourceWithStorageImpl();
+return { "com.sun.star.resource.StringResourceWithStorage" };
 }
 
 
@@ -2333,23 +2309,13 @@ bool StringResourceWithStorageImpl::implLoadLocale( 
LocaleItem* pLocaleItem )
 // StringResourceWithLocationImpl
 
 
-// component operations
-static Sequence< OUString > 
getSupportedServiceNames_StringResourceWithLocationImpl()
-{
-Sequence< OUString > names { 

[Libreoffice-commits] core.git: scripting/source scripting/util

2020-07-14 Thread Noel Grandin (via logerrit)
 scripting/source/provider/BrowseNodeFactoryImpl.cxx   |   38 +
 scripting/source/provider/MasterScriptProvider.cxx|   97 --
 scripting/source/provider/MasterScriptProvider.hxx|   11 -
 scripting/source/provider/MasterScriptProviderFactory.cxx |   28 +---
 scripting/source/provider/URIHelper.cxx   |9 +
 scripting/util/scriptframe.component  |   18 +-
 6 files changed, 42 insertions(+), 159 deletions(-)

New commits:
commit 8e6c5635bed20790dcf10da99766c92d4589845e
Author: Noel Grandin 
AuthorDate: Tue Jul 14 12:04:51 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 14 20:25:34 2020 +0200

scripting/provider: create instances with uno constructors

See tdf#74608 for motivation.

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

diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx 
b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 20574bf70c6f..26fc13331ec5 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -612,46 +612,19 @@ BrowseNodeFactoryImpl::getOrganizerHierarchy() const
 return xRet;
 }
 
-// Helper methods
-
-
-// Namespace global methods for setting up BrowseNodeFactory service
-
-
-Sequence< OUString >
-bnf_getSupportedServiceNames( )
-{
-return { "com.sun.star.script.browse.BrowseNodeFactory" };
-}
-
-OUString
-bnf_getImplementationName( )
-{
-return
-"com.sun.star.script.browse.BrowseNodeFactory";
-}
-
-Reference< XInterface >
-bnf_create( Reference< XComponentContext > const & xComponentContext )
-{
-return static_cast< ::cppu::OWeakObject * >(
-new BrowseNodeFactoryImpl( xComponentContext ) );
-}
-
-
 // Implementation of XServiceInfo
 
 
 OUString SAL_CALL
 BrowseNodeFactoryImpl::getImplementationName()
 {
-return bnf_getImplementationName();
+return "com.sun.star.script.browse.BrowseNodeFactory";
 }
 
 Sequence< OUString > SAL_CALL
 BrowseNodeFactoryImpl::getSupportedServiceNames()
 {
-return bnf_getSupportedServiceNames();
+return { "com.sun.star.script.browse.BrowseNodeFactory" };
 }
 
 sal_Bool BrowseNodeFactoryImpl::supportsService(OUString const & serviceName )
@@ -659,6 +632,13 @@ sal_Bool BrowseNodeFactoryImpl::supportsService(OUString 
const & serviceName )
 return cppu::supportsService(this, serviceName);
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+scripting_BrowseNodeFactoryImpl_get_implementation(
+css::uno::XComponentContext* context, css::uno::Sequence 
const&)
+{
+return cppu::acquire(new BrowseNodeFactoryImpl(context));
+}
+
 } // namespace browsenodefactory
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index 703e01c86299..007df949e93b 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -665,101 +665,14 @@ Sequence< OUString > SAL_CALL 
MasterScriptProvider::getSupportedServiceNames( )
 "com.sun.star.script.provider.ScriptProvider" };
 }
 
-} // namespace func_provider
-
-
-namespace scripting_runtimemgr
-{
-
-static Reference< XInterface > sp_create(
-const Reference< XComponentContext > & xCompC )
-{
-return static_cast(new 
::func_provider::MasterScriptProvider( xCompC ));
-}
-
-
-static Sequence< OUString > sp_getSupportedServiceNames( )
-{
-return { "com.sun.star.script.provider.MasterScriptProvider",
- "com.sun.star.script.browse.BrowseNode",
- "com.sun.star.script.provider.ScriptProvider" };
-}
-
-
-static OUString sp_getImplementationName( )
-{
-return "com.sun.star.script.provider.MasterScriptProvider";
-}
-
-// * registration or ScriptingFrameworkURIHelper
-static Reference< XInterface > urihelper_create(
-const Reference< XComponentContext > & xCompC )
-{
-return static_cast(
-new ::func_provider::ScriptingFrameworkURIHelper( xCompC ));
-}
-
-static Sequence< OUString > urihelper_getSupportedServiceNames( )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+scripting_MasterScriptProvider_get_implementation(
+css::uno::XComponentContext* context, css::uno::Sequence 
const&)
 {
-return { "com.sun.star.script.provider.ScriptURIHelper" };
+return cppu::acquire(new MasterScriptProvider(context));
 }
 
-static OUString urihelper_getImplementationName( )
-{
-return "com.sun.star.script.provider.ScriptURIHelper";
-}
-
-const struct cppu::ImplementationEntry s_entries [] =
-{
-{
-sp_create, sp_getImplementationName,
-sp_getSupportedServiceNames, cppu::createSingleComponentFactory,
-nullptr, 0
-},
-{
-urihelper_create,
-

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

2020-07-14 Thread Noel Grandin (via logerrit)
 scripting/source/dlgprov/DialogModelProvider.cxx |   11 ++-
 scripting/source/dlgprov/dlgprov.component   |8 +-
 scripting/source/dlgprov/dlgprov.cxx |   74 ++-
 scripting/source/dlgprov/dlgprov.hxx |   10 ---
 4 files changed, 22 insertions(+), 81 deletions(-)

New commits:
commit b4f1f2dc427cad5829911de01e00a4c7d4e7dd50
Author: Noel Grandin 
AuthorDate: Tue Jul 14 12:45:52 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 14 20:25:08 2020 +0200

scripting/dlgprov: create instances with uno constructors

See tdf#74608 for motivation.

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

diff --git a/scripting/source/dlgprov/DialogModelProvider.cxx 
b/scripting/source/dlgprov/DialogModelProvider.cxx
index 5f9e4e15a032..e49ed058d475 100644
--- a/scripting/source/dlgprov/DialogModelProvider.cxx
+++ b/scripting/source/dlgprov/DialogModelProvider.cxx
@@ -141,7 +141,7 @@ void SAL_CALL 
DialogModelProvider::removeVetoableChangeListener( const OUString&
 // com.sun.star.uno.XServiceInfo:
 OUString SAL_CALL DialogModelProvider::getImplementationName()
 {
-return comp_DialogModelProvider::_getImplementationName();
+return "com.sun.star.comp.scripting.DialogModelProvider";
 }
 
 sal_Bool SAL_CALL DialogModelProvider::supportsService(OUString const & 
serviceName)
@@ -151,9 +151,16 @@ sal_Bool SAL_CALL 
DialogModelProvider::supportsService(OUString const & serviceN
 
 css::uno::Sequence< OUString > SAL_CALL 
DialogModelProvider::getSupportedServiceNames()
 {
-return comp_DialogModelProvider::_getSupportedServiceNames();
+return { "com.sun.star.awt.UnoControlDialogModelProvider" };
 }
 
 } // closing anonymous implementation namespace
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+scripting_DialogModelProvider_get_implementation(
+css::uno::XComponentContext* context, css::uno::Sequence 
const&)
+{
+return cppu::acquire(new dlgprov::DialogModelProvider(context));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/dlgprov/dlgprov.component 
b/scripting/source/dlgprov/dlgprov.component
index f93b25dc6585..35203afb831c 100644
--- a/scripting/source/dlgprov/dlgprov.component
+++ b/scripting/source/dlgprov/dlgprov.component
@@ -18,13 +18,15 @@
  -->
 
 http://openoffice.org/2010/uno-components;>
-  
+xmlns="http://openoffice.org/2010/uno-components;>
+  
 
 
 
   
-  
+  
 
   
 
diff --git a/scripting/source/dlgprov/dlgprov.cxx 
b/scripting/source/dlgprov/dlgprov.cxx
index 2117982e7c39..22a2839b4042 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -62,27 +62,6 @@ using namespace beans;
 using namespace document;
 using namespace ::sf_misc;
 
-// component helper namespace
-namespace comp_DialogModelProvider
-{
-
-OUString _getImplementationName()
-{
-return "com.sun.star.comp.scripting.DialogModelProvider";
-}
-
-uno::Sequence< OUString > _getSupportedServiceNames()
-{
-uno::Sequence< OUString > s { 
"com.sun.star.awt.UnoControlDialogModelProvider" };
-return s;
-}
-
-static uno::Reference< uno::XInterface > _create(const uno::Reference< 
uno::XComponentContext > & context)
-{
-return static_cast< ::cppu::OWeakObject * >(new 
dlgprov::DialogModelProvider(context));
-}
-} // closing component helper namespace
-
 namespace dlgprov
 {
 
@@ -154,23 +133,6 @@ namespace dlgprov
 return xDialogModel;
 }
 
-// component operations
-
-
-static OUString getImplementationName_DialogProviderImpl()
-{
-return "com.sun.star.comp.scripting.DialogProvider";
-}
-
-
-static Sequence< OUString > getSupportedServiceNames_DialogProviderImpl()
-{
-return { "com.sun.star.awt.DialogProvider",
- "com.sun.star.awt.DialogProvider2",
- "com.sun.star.awt.ContainerWindowProvider" };
-}
-
-
 // mutex
 
 
@@ -538,7 +500,7 @@ namespace dlgprov
 
 OUString DialogProviderImpl::getImplementationName(  )
 {
-return getImplementationName_DialogProviderImpl();
+return "com.sun.star.comp.scripting.DialogProvider";
 }
 
 sal_Bool DialogProviderImpl::supportsService( const OUString& rServiceName 
)
@@ -548,7 +510,9 @@ namespace dlgprov
 
 Sequence< OUString > DialogProviderImpl::getSupportedServiceNames(  )
 {
-return getSupportedServiceNames_DialogProviderImpl();
+return { "com.sun.star.awt.DialogProvider",
+ "com.sun.star.awt.DialogProvider2",
+ "com.sun.star.awt.ContainerWindowProvider" };
 }
 
 
@@ -728,36 +692,14 @@ namespace dlgprov
 // component operations
 
 
-static Reference< XInterface > create_DialogProviderImpl(
-Reference< XComponentContext > const & 

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

2020-07-01 Thread Stephan Bergmann (via logerrit)
 scripting/source/basprov/basprov.cxx   |2 +-
 scripting/source/dlgprov/dlgprov.cxx   |4 ++--
 scripting/source/provider/MasterScriptProvider.cxx |2 +-
 scripting/source/provider/URIHelper.cxx|8 
 scripting/source/stringresource/stringresource.cxx |4 ++--
 scripting/source/vbaevents/eventhelper.cxx |4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 9c6100c26a295bba568f89b2eb0ade104ddb2069
Author: Stephan Bergmann 
AuthorDate: Wed Jul 1 21:24:52 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Jul 1 23:43:58 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: scripting

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

diff --git a/scripting/source/basprov/basprov.cxx 
b/scripting/source/basprov/basprov.cxx
index 6c7ede60649f..bd1832ba98ba 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -492,7 +492,7 @@ namespace basprov
 }
 
 
-static struct ::cppu::ImplementationEntry const s_component_entries [] =
+struct ::cppu::ImplementationEntry const s_component_entries [] =
 {
 {
 create_BasicProviderImpl, getImplementationName_BasicProviderImpl,
diff --git a/scripting/source/dlgprov/dlgprov.cxx 
b/scripting/source/dlgprov/dlgprov.cxx
index 2f120497cf28..2117982e7c39 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -593,7 +593,7 @@ namespace dlgprov
 // XDialogProvider
 
 
-static const char aDecorationPropName[] = "Decoration";
+const char aDecorationPropName[] = "Decoration";
 
 Reference < XControl > DialogProviderImpl::createDialogImpl(
 const OUString& URL, const Reference< XInterface >& xHandler,
@@ -735,7 +735,7 @@ namespace dlgprov
 }
 
 
-static struct ::cppu::ImplementationEntry const s_component_entries [] =
+struct ::cppu::ImplementationEntry const s_component_entries [] =
 {
 {create_DialogProviderImpl, 
getImplementationName_DialogProviderImpl,getSupportedServiceNames_DialogProviderImpl,
 ::cppu::createSingleComponentFactory,nullptr, 0},
 { 
_DialogModelProvider::_create,_DialogModelProvider::_getImplementationName,_DialogModelProvider::_getSupportedServiceNames,&::cppu::createSingleComponentFactory,
 nullptr, 0 },
diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index 0ed11a20348f..0f4429d2dd79 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -709,7 +709,7 @@ static OUString urihelper_getImplementationName( )
 return "com.sun.star.script.provider.ScriptURIHelper";
 }
 
-static const struct cppu::ImplementationEntry s_entries [] =
+const struct cppu::ImplementationEntry s_entries [] =
 {
 {
 sp_create, sp_getImplementationName,
diff --git a/scripting/source/provider/URIHelper.cxx 
b/scripting/source/provider/URIHelper.cxx
index 1497df6b92a8..f9c07a741b64 100644
--- a/scripting/source/provider/URIHelper.cxx
+++ b/scripting/source/provider/URIHelper.cxx
@@ -35,13 +35,13 @@ namespace ucb = ::com::sun::star::ucb;
 namespace lang = ::com::sun::star::lang;
 namespace uri = ::com::sun::star::uri;
 
-static const char SHARE[] = "share";
+const char SHARE[] = "share";
 
-static const char SHARE_UNO_PACKAGES_URI[] =
+const char SHARE_UNO_PACKAGES_URI[] =
 "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE";
 
-static const char USER[] = "user";
-static const char USER_URI[] =
+const char USER[] = "user";
+const char USER_URI[] =
 "vnd.sun.star.expand:${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" 
SAL_CONFIGFILE( "bootstrap") "::UserInstallation}";
 
 
diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 4d4bcb1c045e..dc8b38466416 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -697,7 +697,7 @@ Sequence< OUString > 
StringResourcePersistenceImpl::getSupportedServiceNames(  )
 // XInitialization base functionality for derived classes
 
 
-static const char aNameBaseDefaultStr[] = "strings";
+const char aNameBaseDefaultStr[] = "strings";
 
 void StringResourcePersistenceImpl::implInitializeCommonParameters
 ( const Sequence< Any >& aArguments )
@@ -2656,7 +2656,7 @@ const Reference< ucb::XSimpleFileAccess3 > & 
StringResourceWithLocationImpl::get
 // component export operations
 
 
-static const struct ::cppu::ImplementationEntry s_component_entries [] =
+const struct ::cppu::ImplementationEntry s_component_entries [] =
 {
 {
 create_StringResourceImpl, getImplementationName_StringResourceImpl,
diff --git 

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

2020-06-05 Thread Stephan Bergmann (via logerrit)
 scripting/source/basprov/basprov.cxx   |3 +--
 scripting/source/inc/util/MiscUtils.hxx|3 +--
 scripting/source/protocolhandler/scripthandler.cxx |3 +--
 scripting/source/provider/MasterScriptProvider.cxx |3 +--
 scripting/source/provider/ProviderCache.cxx|4 +---
 5 files changed, 5 insertions(+), 11 deletions(-)

New commits:
commit 9e07acf3a9b0c9f82734c7bb23e82f7684522f13
Author: Stephan Bergmann 
AuthorDate: Thu Jun 4 21:23:21 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 5 08:53:18 2020 +0200

Upcoming loplugin:elidestringvar: scripting

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

diff --git a/scripting/source/basprov/basprov.cxx 
b/scripting/source/basprov/basprov.cxx
index ad990dbd4863..0d247130ff9f 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -232,8 +232,7 @@ namespace basprov
 );
 }
 
-OUString sDoc = "vnd.sun.star.tdoc";
-if ( m_sScriptingContext.startsWith( sDoc  ) )
+if ( m_sScriptingContext.startsWith( "vnd.sun.star.tdoc"  ) )
 {
 xModel = MiscUtils::tDocUrlToModel(  m_sScriptingContext );
 // TODO: use ScriptingContantsPool for SCRIPTING_DOC_REF
diff --git a/scripting/source/inc/util/MiscUtils.hxx 
b/scripting/source/inc/util/MiscUtils.hxx
index f40a51499834..e7b5bd920a58 100644
--- a/scripting/source/inc/util/MiscUtils.hxx
+++ b/scripting/source/inc/util/MiscUtils.hxx
@@ -108,8 +108,7 @@ static css::uno::Reference< css::frame::XModel > 
tDocUrlToModel( const OUString&
 try
 {
 ::ucbhelper::Content root( url, nullptr, 
comphelper::getProcessComponentContext() );
-OUString propName =  "DocumentModel";
-result = getUCBProperty( root, propName );
+result = getUCBProperty( root, "DocumentModel" );
 }
 catch ( css::ucb::ContentCreationException& )
 {
diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index ea29661a489a..74aecbeb1e5c 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -80,8 +80,7 @@ void SAL_CALL ScriptProtocolHandler::initialize(
 // but usually it's a "real" frame)
 if ( aArguments.hasElements() && !( aArguments[ 0 ] >>= m_xFrame ) )
 {
-OUString temp = "ScriptProtocolHandler::initialize: could not extract 
reference to the frame";
-throw RuntimeException( temp );
+throw RuntimeException( "ScriptProtocolHandler::initialize: could not 
extract reference to the frame" );
 }
 
 ENSURE_OR_THROW( m_xContext.is(), "ScriptProtocolHandler::initialize: No 
Service Manager available" );
diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index 2a12c21fb604..d6e64eb92da8 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -345,8 +345,7 @@ MasterScriptProvider::providerCache()
 ::osl::MutexGuard aGuard( m_mutex );
 if ( !m_pPCache )
 {
-OUString serviceName1 = 
"com.sun.star.script.provider.ScriptProviderForBasic";
-Sequence blacklist { serviceName1 };
+Sequence blacklist { 
"com.sun.star.script.provider.ScriptProviderForBasic" };
 
 if ( !m_bIsPkgMSP )
 {
diff --git a/scripting/source/provider/ProviderCache.cxx 
b/scripting/source/provider/ProviderCache.cxx
index e97be35acb6f..4bcbd67f9260 100644
--- a/scripting/source/provider/ProviderCache.cxx
+++ b/scripting/source/provider/ProviderCache.cxx
@@ -136,10 +136,8 @@ ProviderCache::populateCache()
 ::osl::Guard< osl::Mutex > aGuard( m_mutex );
 try
 {
-OUString const languageProviderName( 
"com.sun.star.script.provider.LanguageScriptProvider"  );
-
 Reference< container::XContentEnumerationAccess > xEnumAccess( m_xMgr, 
UNO_QUERY_THROW );
-Reference< container::XEnumeration > xEnum = 
xEnumAccess->createContentEnumeration ( languageProviderName );
+Reference< container::XEnumeration > xEnum = 
xEnumAccess->createContentEnumeration ( 
"com.sun.star.script.provider.LanguageScriptProvider" );
 
 while ( xEnum->hasMoreElements() )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-04-06 Thread Michael Stahl (via logerrit)
 scripting/source/pyprov/mailmerge.py |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

New commits:
commit eba46261c435b2ae898dd50de664a7f88006fa67
Author: Michael Stahl 
AuthorDate: Sat Apr 4 19:05:00 2020 +0200
Commit: Michael Stahl 
CommitDate: Mon Apr 6 11:02:41 2020 +0200

scripting: mailmerge.py: remove Python 3.0/3.1 support

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

diff --git a/scripting/source/pyprov/mailmerge.py 
b/scripting/source/pyprov/mailmerge.py
index fadceb1e1e56..e41f44d965bd 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -199,14 +199,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
#it's a bytesequence, get raw 
bytes
textbody = textbody.value
if sys.version_info >= (3,0):
-   if sys.version_info <= (3,1):
-   
#http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
-   #see 
http://bugs.python.org/16564, etc. basically it now *seems* to be all ok
-   #in python 3.3.2 
onwards, but a little busted in 3.3.0
-
-   textbody = 
textbody.decode('iso8859-1')
-   else:
-   textbody = 
textbody.decode('utf-8')
+   textbody = 
textbody.decode('utf-8')
c = Charset('utf-8')
c.body_encoding = QP
textmsg.set_payload(textbody, c)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-04-02 Thread Noel Grandin (via logerrit)
 scripting/source/dlgprov/DialogModelProvider.cxx|   46 ++---
 scripting/source/dlgprov/dlgevtatt.cxx  |  168 +-
 scripting/source/dlgprov/dlgprov.cxx|   50 ++---
 scripting/source/protocolhandler/scripthandler.cxx  |   50 ++---
 scripting/source/provider/ActiveMSPList.cxx |   28 +--
 scripting/source/provider/BrowseNodeFactoryImpl.cxx |   24 +-
 scripting/source/stringresource/stringresource.cxx  |  184 ++--
 scripting/source/vbaevents/eventhelper.cxx  |  130 +++---
 8 files changed, 340 insertions(+), 340 deletions(-)

New commits:
commit d9946e6d0ba81071f3e50622e5cae9e2ffc9bfb0
Author: Noel Grandin 
AuthorDate: Thu Apr 2 10:45:58 2020 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 2 20:05:25 2020 +0200

loplugin:flatten in scripting

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

diff --git a/scripting/source/dlgprov/DialogModelProvider.cxx 
b/scripting/source/dlgprov/DialogModelProvider.cxx
index bd9525a5bc5b..5f9e4e15a032 100644
--- a/scripting/source/dlgprov/DialogModelProvider.cxx
+++ b/scripting/source/dlgprov/DialogModelProvider.cxx
@@ -42,33 +42,33 @@ DialogModelProvider::DialogModelProvider(Reference< 
XComponentContext > const &
 // lang::XInitialization:
 void SAL_CALL DialogModelProvider::initialize(const css::uno::Sequence< 
uno::Any > & aArguments)
 {
-if ( aArguments.getLength() == 1 )
-{
-OUString sURL;
-if ( !( aArguments[ 0 ] >>= sURL ))
-throw css::lang::IllegalArgumentException();
- // Try any other URL with SimpleFileAccess
-Reference< ucb::XSimpleFileAccess3 > xSFI = 
ucb::SimpleFileAccess::create(m_xContext);
+if ( aArguments.getLength() != 1 )
+return;
+
+OUString sURL;
+if ( !( aArguments[ 0 ] >>= sURL ))
+throw css::lang::IllegalArgumentException();
+ // Try any other URL with SimpleFileAccess
+Reference< ucb::XSimpleFileAccess3 > xSFI = 
ucb::SimpleFileAccess::create(m_xContext);
 
-try
+try
+{
+Reference< io::XInputStream > xInput = xSFI->openFileRead( sURL );
+Reference< resource::XStringResourceManager > xStringResourceManager;
+if ( xInput.is() )
 {
-Reference< io::XInputStream > xInput = xSFI->openFileRead( sURL );
-Reference< resource::XStringResourceManager > 
xStringResourceManager;
-if ( xInput.is() )
-{
-xStringResourceManager = 
dlgprov::lcl_getStringResourceManager(m_xContext,sURL);
-Any aDialogSourceURLAny;
-aDialogSourceURLAny <<= sURL;
-
-Reference< frame::XModel > xModel;
-m_xDialogModel.set( dlgprov::lcl_createDialogModel( 
m_xContext, xInput , xModel, xStringResourceManager, aDialogSourceURLAny  ), 
UNO_SET_THROW);
-m_xDialogModelProp.set(m_xDialogModel, UNO_QUERY_THROW);
-}
+xStringResourceManager = 
dlgprov::lcl_getStringResourceManager(m_xContext,sURL);
+Any aDialogSourceURLAny;
+aDialogSourceURLAny <<= sURL;
+
+Reference< frame::XModel > xModel;
+m_xDialogModel.set( dlgprov::lcl_createDialogModel( m_xContext, 
xInput , xModel, xStringResourceManager, aDialogSourceURLAny  ), UNO_SET_THROW);
+m_xDialogModelProp.set(m_xDialogModel, UNO_QUERY_THROW);
 }
-catch( Exception& )
-{}
-//m_sURL = sURL;
 }
+catch( Exception& )
+{}
+//m_sURL = sURL;
 }
 
 // container::XElementAccess:
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx 
b/scripting/source/dlgprov/dlgevtatt.cxx
index 1269395b01f5..b1a3fceee7ec 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -118,37 +118,37 @@ namespace dlgprov
 args[0] <<= xModel;
 mxListener.set( xSMgr->createInstanceWithArgumentsAndContext( 
"ooo.vba.EventListener", args, m_xContext ), UNO_QUERY );
 }
-if ( rxControl.is() )
+if ( !rxControl.is() )
+return;
+
+try
 {
-try
-{
-Reference< XPropertySet > xProps( rxControl->getModel(), 
UNO_QUERY_THROW );
-xProps->getPropertyValue("Name") >>= msDialogCodeName;
-xProps.set( mxListener, UNO_QUERY_THROW );
-xProps->setPropertyValue("Model", args[ 0 ] );
-}
-catch( const Exception& )
-{
-DBG_UNHANDLED_EXCEPTION("scripting");
-}
+Reference< XPropertySet > xProps( rxControl->getModel(), 
UNO_QUERY_THROW );
+xProps->getPropertyValue("Name") >>= msDialogCodeName;
+xProps.set( mxListener, UNO_QUERY_THROW );
+xProps->setPropertyValue("Model", 

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

2020-01-07 Thread Andrea Gelmini (via logerrit)
 scripting/source/provider/MasterScriptProvider.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4d2a95f6d296c871533db536a43492534a4e2f8c
Author: Andrea Gelmini 
AuthorDate: Mon Jan 6 19:58:37 2020 +0100
Commit: Julien Nabet 
CommitDate: Tue Jan 7 11:53:39 2020 +0100

Fix typo

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

diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index 75cf2ff33fbd..eb5d8a6b07c8 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -288,7 +288,7 @@ MasterScriptProvider::getScript( const OUString& scriptURI )
 // MSP then delete to the language provider controlled by this MSP
 // ** Special case is BASIC, all calls to getScript will be handled
 // by the language script provider in the current location context
-// even if its different
+// even if it's different
 if  (   (   location == "document"
 &&  m_xModel.is()
 )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-12-20 Thread Kemal Ayhan (via logerrit)
 scripting/source/dlgprov/DialogModelProvider.hxx |5 +
 scripting/source/dlgprov/dlgevtatt.hxx   |6 +-
 scripting/source/dlgprov/dlgprov.hxx |6 +-
 3 files changed, 3 insertions(+), 14 deletions(-)

New commits:
commit 0cc5185147402f6c5a4ff8e1256aa8348a04f75e
Author: Kemal Ayhan 
AuthorDate: Thu Dec 19 01:48:45 2019 +0300
Commit: Muhammet Kara 
CommitDate: Fri Dec 20 20:56:37 2019 +0100

tdf#124176: Use pragma once instead of include guards

Change-Id: I4a045b450a5779bdd357a05a0efd4da7d521682d
Reviewed-on: https://gerrit.libreoffice.org/85448
Tested-by: Jenkins
Reviewed-by: Muhammet Kara 

diff --git a/scripting/source/dlgprov/DialogModelProvider.hxx 
b/scripting/source/dlgprov/DialogModelProvider.hxx
index 7f938bc90ad1..d9a41ef64e86 100644
--- a/scripting/source/dlgprov/DialogModelProvider.hxx
+++ b/scripting/source/dlgprov/DialogModelProvider.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SCRIPTING_SOURCE_DLGPROV_DIALOGMODELPROVIDER_HXX
-#define INCLUDED_SCRIPTING_SOURCE_DLGPROV_DIALOGMODELPROVIDER_HXX
+#pragma once
 
 #include 
 #include 
@@ -85,6 +84,4 @@ private:
 };
 } // closing anonymous implementation namespace
 
-#endif // INCLUDED_SCRIPTING_SOURCE_DLGPROV_DIALOGMODELPROVIDER_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/dlgprov/dlgevtatt.hxx 
b/scripting/source/dlgprov/dlgevtatt.hxx
index 73a60706556d..2adcd03baa7a 100644
--- a/scripting/source/dlgprov/dlgevtatt.hxx
+++ b/scripting/source/dlgprov/dlgevtatt.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SCRIPTING_SOURCE_DLGPROV_DLGEVTATT_HXX
-#define INCLUDED_SCRIPTING_SOURCE_DLGPROV_DLGEVTATT_HXX
+#pragma once
 
 #include 
 #include 
@@ -128,7 +127,4 @@ namespace dlgprov
 
 }   // namespace dlgprov
 
-
-#endif // SCRIPTING_DLGEVT_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/dlgprov/dlgprov.hxx 
b/scripting/source/dlgprov/dlgprov.hxx
index df3d37a7118c..fb5957619e08 100644
--- a/scripting/source/dlgprov/dlgprov.hxx
+++ b/scripting/source/dlgprov/dlgprov.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SCRIPTING_SOURCE_DLGPROV_DLGPROV_HXX
-#define INCLUDED_SCRIPTING_SOURCE_DLGPROV_DLGPROV_HXX
+#pragma once
 
 #include 
 #include 
@@ -156,7 +155,4 @@ css::uno::Sequence< OUString > _getSupportedServiceNames();
 
 } // namespace comp_DialogModelProvider
 
-
-#endif // INCLUDED_SCRIPTING_SOURCE_DLGPROV_DLGPROV_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-11-24 Thread Julien Nabet (via logerrit)
 sc/source/core/data/stlpool.cxx |3 +--
 sc/source/core/tool/detfunc.cxx |4 ++--
 sc/source/filter/oox/worksheethelper.cxx|2 +-
 sc/source/filter/xml/xmlcoli.cxx|2 +-
 sc/source/filter/xml/xmldrani.cxx   |2 +-
 sc/source/filter/xml/xmlfilti.cxx   |2 +-
 scripting/source/provider/BrowseNodeFactoryImpl.cxx |5 ++---
 sd/qa/unit/uimpress.cxx |2 +-
 sd/source/filter/eppt/grouptable.hxx|   10 +-
 sd/source/filter/eppt/pptx-text.cxx |8 
 sd/source/filter/eppt/text.hxx  |6 +++---
 sd/source/filter/html/htmlex.cxx|   18 --
 sd/source/filter/ppt/propread.cxx   |3 +--
 13 files changed, 31 insertions(+), 36 deletions(-)

New commits:
commit 9d63592d530e9ad5ab2d6aee0aba5bc0c117aae3
Author: Julien Nabet 
AuthorDate: Sun Nov 24 21:43:25 2019 +0100
Commit: Julien Nabet 
CommitDate: Sun Nov 24 22:52:21 2019 +0100

cppcheck: performing init in init list (sc/scripting/sd)

Change-Id: I8bd4c1b7b551a96ecd5a2b50fbfdf225567175f6
Reviewed-on: https://gerrit.libreoffice.org/83621
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 2a701c1b26e8..897dc19891d5 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -380,9 +380,8 @@ namespace {
 struct CaseInsensitiveNamePredicate : svl::StyleSheetPredicate
 {
 CaseInsensitiveNamePredicate(const OUString& rName, SfxStyleFamily eFam)
-: mFamily(eFam)
+: mUppercaseName(ScGlobal::pCharClass->uppercase(rName)), mFamily(eFam)
 {
-mUppercaseName = ScGlobal::pCharClass->uppercase(rName);
 }
 
 bool
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index b253e6c4..91693af8ff40 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -147,9 +147,9 @@ ScDetectiveData::ScDetectiveData( SdrModel* pModel ) :
 aArrowSet( pModel->GetItemPool(), svl::Items{} 
),
 aToTabSet( pModel->GetItemPool(), svl::Items{} 
),
 aFromTabSet( pModel->GetItemPool(), svl::Items{} ),
-aCircleSet( pModel->GetItemPool(), svl::Items{} )
+aCircleSet( pModel->GetItemPool(), svl::Items{} ),
+nMaxLevel(0)
 {
-nMaxLevel = 0;
 
 aBoxSet.Put( XLineColorItem( EMPTY_OUSTRING, 
ScDetectiveFunc::GetArrowColor() ) );
 aBoxSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
diff --git a/sc/source/filter/oox/worksheethelper.cxx 
b/sc/source/filter/oox/worksheethelper.cxx
index a567435fcc28..3fb3693b7e6a 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -407,9 +407,9 @@ WorksheetGlobals::WorksheetGlobals( const WorkbookHelper& 
rHelper, const ISegmen
 mxProgressBar( rxProgressBar ),
 mbFastRowProgress( false ),
 meSheetType( eSheetType ),
+mxSheet(getSheetFromDoc( nSheet )),
 mbHasDefWidth( false )
 {
-mxSheet = getSheetFromDoc( nSheet );
 if( !mxSheet.is() )
 maUsedArea.aStart.SetTab( -1 );
 
diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx
index 1d4d0966d707..40f8b4f74d56 100644
--- a/sc/source/filter/xml/xmlcoli.cxx
+++ b/sc/source/filter/xml/xmlcoli.cxx
@@ -40,9 +40,9 @@ using namespace xmloff::token;
 ScXMLTableColContext::ScXMLTableColContext( ScXMLImport& rImport,
   const 
rtl::Reference& rAttrList ) :
 ScXMLImportContext( rImport ),
+nColCount(1),
 sVisibility(GetXMLToken(XML_VISIBLE))
 {
-nColCount = 1;
 if ( rAttrList.is() )
 {
 for (auto  : *rAttrList)
diff --git a/sc/source/filter/xml/xmldrani.cxx 
b/sc/source/filter/xml/xmldrani.cxx
index 5a6e362677d8..5ca1a1c01b08 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -87,6 +87,7 @@ ScXMLDatabaseRangeContext::ScXMLDatabaseRangeContext( 
ScXMLImport& rImport,
 mpQueryParam(new ScQueryParam),
 sDatabaseRangeName(STR_DB_LOCAL_NONAME),
 aSortSequence(),
+nSourceType(sheet::DataImportMode_NONE),
 nRefresh(0),
 nSubTotalsUserListIndex(0),
 mbValidRange(true),
@@ -109,7 +110,6 @@ ScXMLDatabaseRangeContext::ScXMLDatabaseRangeContext( 
ScXMLImport& rImport,
 bByRow(false),
 meRangeType(ScDBCollection::GlobalNamed)
 {
-nSourceType = sheet::DataImportMode_NONE;
 if( rAttrList.is() )
 {
 for( auto  : *rAttrList )
diff --git a/sc/source/filter/xml/xmlfilti.cxx 
b/sc/source/filter/xml/xmlfilti.cxx
index 47fea817123c..50cfb09bfb8e 100644
--- a/sc/source/filter/xml/xmlfilti.cxx
+++ b/sc/source/filter/xml/xmlfilti.cxx
@@ -290,10 +290,10 @@ ScXMLConditionContext::ScXMLConditionContext(
 ScXMLImportContext( rImport ),
 mrQueryParam(rParam),
 

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

2019-11-05 Thread Samuel Mehrbrodt (via logerrit)
 scripting/source/protocolhandler/scripthandler.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit f5d01aef7697478fe315098ed4855cfcdfc0379f
Author: Samuel Mehrbrodt 
AuthorDate: Tue Nov 5 16:43:50 2019 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Wed Nov 6 08:11:52 2019 +0100

Check if scripting disabled for each dispatch call

Not only when initializing.
This way, changing the property during runtime has an effect.

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

diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index ed960848d072..c167fb3c42d8 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -71,7 +71,7 @@ namespace scripting_protocolhandler
 void SAL_CALL ScriptProtocolHandler::initialize(
 const css::uno::Sequence < css::uno::Any >& aArguments )
 {
-if ( m_bInitialised || 
officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get() )
+if ( m_bInitialised )
 {
 return ;
 }
@@ -123,6 +123,9 @@ void SAL_CALL 
ScriptProtocolHandler::dispatchWithNotification(
 const URL& aURL, const Sequence < PropertyValue >& lArgs,
 const Reference< XDispatchResultListener >& xListener )
 {
+if 
(officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get())
+return;
+
 bool bSuccess = false;
 Any invokeResult;
 bool bCaughtException = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-19 Thread Stephan Bergmann (via logerrit)
 scripting/source/pyprov/pythonscript.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c79efeb66f7951305d0334bc288aee1c571a8728
Author: Stephan Bergmann 
AuthorDate: Mon Aug 19 11:27:15 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Aug 19 12:47:59 2019 +0200

Improve check for absolute URI

Change-Id: I4dee44832107f72f8f3fb68554428dc1e646c346
Reviewed-on: https://gerrit.libreoffice.org/77706
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index bd2aa3e1670e..82973266a2b0 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -238,7 +238,7 @@ class MyUriHelper:
 log.debug( message )
 raise RuntimeException( message, self.ctx )
 
-if xFileUri.isAbsolute():
+if not xFileUri.hasRelativePath():
 message = "pythonscript: an absolute uri is invalid '" + 
sFileUri+ "'"
 log.debug( message )
 raise RuntimeException( message, self.ctx )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-16 Thread Caolán McNamara (via logerrit)
 scripting/source/pyprov/pythonscript.py |   13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 9a97a26511584f41c3753fa9536e1c4a8dce637a
Author: Caolán McNamara 
AuthorDate: Fri Aug 16 10:38:18 2019 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 16 13:05:52 2019 +0200

member 'Context' of struct type 'uno.Exception' not given a value

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

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 67251e6ada61..bd2aa3e1670e 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -176,6 +176,7 @@ def toIniName( str ):
 class MyUriHelper:
 
 def __init__( self, ctx, location ):
+self.ctx = ctx
 self.s_UriMap = \
 { "share" : 
"vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/Scripts/python" , \
   "share:uno_packages" : 
"vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE/uno_packages", \
@@ -203,7 +204,7 @@ class MyUriHelper:
 if not storageURI.startswith( self.m_baseUri ):
 message = "pythonscript: storage uri '" + storageURI + "' not in 
base uri '" + self.m_baseUri + "'"
 log.debug( message )
-raise RuntimeException( message )
+raise RuntimeException( message, self.ctx )
 
 ret = "vnd.sun.star.script:" + \
   storageURI[len(self.m_baseUri)+1:].replace("/","|") + \
@@ -235,12 +236,12 @@ class MyUriHelper:
 if not xFileUri:
 message = "pythonscript: invalid relative uri '" + sFileUri+ 
"'"
 log.debug( message )
-raise RuntimeException( message )
+raise RuntimeException( message, self.ctx )
 
 if xFileUri.isAbsolute():
 message = "pythonscript: an absolute uri is invalid '" + 
sFileUri+ "'"
 log.debug( message )
-raise RuntimeException( message )
+raise RuntimeException( message, self.ctx )
 
 # absolute path to the .py file
 xAbsScriptUri = self.m_uriRefFac.makeAbsolute(xBaseUri, xFileUri, 
True, RETAIN)
@@ -250,7 +251,7 @@ class MyUriHelper:
 if not sAbsScriptUri.startswith(sBaseUri):
 message = "pythonscript: storage uri '" + sAbsScriptUri + "' 
not in base uri '" + self.m_baseUri + "'"
 log.debug( message )
-raise RuntimeException( message )
+raise RuntimeException( message, self.ctx )
 
 ret = sAbsScriptUri
 if funcNameStart != -1:
@@ -259,10 +260,10 @@ class MyUriHelper:
 return ret
 except UnoException as e:
 log.error( "error during converting scriptURI="+scriptURI + ": " + 
e.Message)
-raise RuntimeException( "pythonscript:scriptURI2StorageUri: " + 
e.Message, None )
+raise RuntimeException( "pythonscript:scriptURI2StorageUri: " + 
e.Message, self.ctx )
 except Exception as e:
 log.error( "error during converting scriptURI="+scriptURI + ": " + 
str(e))
-raise RuntimeException( "pythonscript:scriptURI2StorageUri: " + 
str(e), None )
+raise RuntimeException( "pythonscript:scriptURI2StorageUri: " + 
str(e), self.ctx )
 
 
 class ModuleEntry:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-16 Thread Caolán McNamara (via logerrit)
 scripting/source/pyprov/pythonscript.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 700c8ec9782c3d81fef0e42146af6b69ecd84e2a
Author: Caolán McNamara 
AuthorDate: Fri Aug 16 10:32:33 2019 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 16 13:04:52 2019 +0200

AttributeError on getMessage

Change-Id: If0bd315fe605b850ec397eb2267b08ad8039355c
Reviewed-on: https://gerrit.libreoffice.org/77565
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index d8924f8dba8c..67251e6ada61 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -259,7 +259,7 @@ class MyUriHelper:
 return ret
 except UnoException as e:
 log.error( "error during converting scriptURI="+scriptURI + ": " + 
e.Message)
-raise RuntimeException( "pythonscript:scriptURI2StorageUri: " 
+e.getMessage(), None )
+raise RuntimeException( "pythonscript:scriptURI2StorageUri: " + 
e.Message, None )
 except Exception as e:
 log.error( "error during converting scriptURI="+scriptURI + ": " + 
str(e))
 raise RuntimeException( "pythonscript:scriptURI2StorageUri: " + 
str(e), None )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-16 Thread Caolán McNamara (via logerrit)
 scripting/source/pyprov/pythonscript.py |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 3c076e54f736980e208f5c27ecf179aa90aea103
Author: Caolán McNamara 
AuthorDate: Fri Aug 16 10:18:34 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Aug 16 12:20:03 2019 +0200

an absolute uri is invalid input

Change-Id: I392be4282be8ed67e3451b28d2c9f22acd4c87fc
Reviewed-on: https://gerrit.libreoffice.org/77564
Reviewed-by: Stephan Bergmann 
Tested-by: Stephan Bergmann 

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 0f74852523b3..d8924f8dba8c 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -237,6 +237,11 @@ class MyUriHelper:
 log.debug( message )
 raise RuntimeException( message )
 
+if xFileUri.isAbsolute():
+message = "pythonscript: an absolute uri is invalid '" + 
sFileUri+ "'"
+log.debug( message )
+raise RuntimeException( message )
+
 # absolute path to the .py file
 xAbsScriptUri = self.m_uriRefFac.makeAbsolute(xBaseUri, xFileUri, 
True, RETAIN)
 sAbsScriptUri = xAbsScriptUri.getUriReference()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-14 Thread Caolán McNamara (via logerrit)
 scripting/source/protocolhandler/scripthandler.cxx |   56 -
 sfx2/source/notify/eventsupplier.cxx   |   39 +-
 2 files changed, 68 insertions(+), 27 deletions(-)

New commits:
commit a1140054b4031fe64e073bb4a5c443018c8532c2
Author: Caolán McNamara 
AuthorDate: Wed Aug 14 15:24:05 2019 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 14 17:52:29 2019 +0200

revert part of 'warn on load when a document binds an event to a macro'

i.e.
commit b3edf85e0fe6ca03dc26e1bf531be82193bc9627
Author: Caolán McNamara 
Date:   Wed Aug 7 17:37:11 2019 +0100

because then extensions that add a entry to menus results in menu
entries that cannot run in the start center where there is no document.

If allowed when there is no document, it would still result in the
odd behaviour that such menu entries would not work in a document which
contained macros or macro-calls if permission was denied to run them

Add a similar check instead to SfxEvents_Impl::Execute

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

diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index 965827bbde6e..1fbf0c8bbc46 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -122,7 +122,6 @@ void SAL_CALL 
ScriptProtocolHandler::dispatchWithNotification(
 const URL& aURL, const Sequence < PropertyValue >& lArgs,
 const Reference< XDispatchResultListener >& xListener )
 {
-
 bool bSuccess = false;
 Any invokeResult;
 bool bCaughtException = false;
@@ -132,32 +131,42 @@ void SAL_CALL 
ScriptProtocolHandler::dispatchWithNotification(
 {
 try
 {
-// obtain the component for our security check
-Reference< XEmbeddedScripts > xDocumentScripts;
-if ( getScriptInvocation() )
-xDocumentScripts.set( 
m_xScriptInvocation->getScriptContainer(), UNO_SET_THROW );
-
-OSL_ENSURE( xDocumentScripts.is(), 
"ScriptProtocolHandler::dispatchWithNotification: can't do the security check!" 
);
-if ( !xDocumentScripts.is() || 
!xDocumentScripts->getAllowMacroExecution() )
+css::uno::Reference urifac(
+css::uri::UriReferenceFactory::create(m_xContext));
+css::uno::Reference uri(
+urifac->parse(aURL.Complete), css::uno::UNO_QUERY_THROW);
+auto const loc = uri->getParameter("location");
+bool bIsDocumentScript = loc == "document";
+
+if ( bIsDocumentScript )
 {
-if ( xListener.is() )
+// obtain the component for our security check
+Reference< XEmbeddedScripts > xDocumentScripts;
+if ( getScriptInvocation() )
+xDocumentScripts.set( 
m_xScriptInvocation->getScriptContainer(), UNO_SET_THROW );
+
+OSL_ENSURE( xDocumentScripts.is(), 
"ScriptProtocolHandler::dispatchWithNotification: can't do the security check!" 
);
+if ( !xDocumentScripts.is() || 
!xDocumentScripts->getAllowMacroExecution() )
 {
-css::frame::DispatchResultEvent aEvent(
-static_cast< ::cppu::OWeakObject* >( this ),
-css::frame::DispatchResultState::FAILURE,
-invokeResult );
-try
-{
-xListener->dispatchFinished( aEvent ) ;
-}
-catch(const RuntimeException &)
+if ( xListener.is() )
 {
-TOOLS_WARN_EXCEPTION("scripting",
-"ScriptProtocolHandler::dispatchWithNotification: 
caught RuntimeException"
-"while dispatchFinished with failure of the 
execution");
+css::frame::DispatchResultEvent aEvent(
+static_cast< ::cppu::OWeakObject* >( this ),
+css::frame::DispatchResultState::FAILURE,
+invokeResult );
+try
+{
+xListener->dispatchFinished( aEvent ) ;
+}
+catch(const RuntimeException &)
+{
+TOOLS_WARN_EXCEPTION("scripting",
+
"ScriptProtocolHandler::dispatchWithNotification: caught RuntimeException"
+"while dispatchFinished with failure of the 
execution");
+}
 }
+   

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

2019-08-13 Thread Caolán McNamara (via logerrit)
 scripting/source/pyprov/pythonscript.py |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 87959e5deea6d33cd35dbb3b8423056f9566710e
Author: Caolán McNamara 
AuthorDate: Mon Aug 12 20:32:54 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Aug 13 10:10:56 2019 +0200

construct final url from parsed output

Change-Id: Ifd733625a439685ad307603eb2b00bf463eb9ca9
Reviewed-on: https://gerrit.libreoffice.org/77373
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 64e1337d642e..0f74852523b3 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -224,7 +224,13 @@ class MyUriHelper:
 sStorageUri = sStorageUri.replace( "|", "/" )
 
 # path to the .py file, relative to the base
-sFileUri = sStorageUri[0:sStorageUri.find("$")]
+funcNameStart = sStorageUri.find("$")
+if funcNameStart != -1:
+sFileUri = sStorageUri[0:funcNameStart]
+sFuncName = sStorageUri[funcNameStart+1:]
+else:
+sFileUri = sStorageUri
+
 xFileUri = self.m_uriRefFac.parse(sFileUri)
 if not xFileUri:
 message = "pythonscript: invalid relative uri '" + sFileUri+ 
"'"
@@ -241,7 +247,9 @@ class MyUriHelper:
 log.debug( message )
 raise RuntimeException( message )
 
-ret = sBaseUri + sStorageUri
+ret = sAbsScriptUri
+if funcNameStart != -1:
+ret = ret + "$" + sFuncName
 log.debug( "converting scriptURI="+scriptURI + " to storageURI=" + 
ret )
 return ret
 except UnoException as e:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-06 Thread Stephan Bergmann (via logerrit)
 scripting/source/protocolhandler/scripthandler.cxx |9 +++--
 sfx2/source/doc/objmisc.cxx|   21 -
 2 files changed, 19 insertions(+), 11 deletions(-)

New commits:
commit a9cde2557242a0c343d99533f3ee032599c66f42
Author: Stephan Bergmann 
AuthorDate: Tue Aug 6 13:29:22 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Aug 6 14:21:14 2019 +0200

Properly obtain location

Change-Id: I9fb0d883a3623394343cd54ef61e5610544198c8
Reviewed-on: https://gerrit.libreoffice.org/77019
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index 47216464cdb0..db3808799111 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -49,6 +49,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -131,8 +132,12 @@ void SAL_CALL 
ScriptProtocolHandler::dispatchWithNotification(
 {
 try
 {
-bool bIsDocumentScript = ( aURL.Complete.indexOf( "document" ) 
!=-1 );
-// TODO: isn't this somewhat strange? This should be a test 
for a location=document parameter, shouldn't it?
+css::uno::Reference urifac(
+css::uri::UriReferenceFactory::create(m_xContext));
+css::uno::Reference uri(
+urifac->parse(aURL.Complete), css::uno::UNO_QUERY_THROW);
+auto const loc = uri->getParameter("location");
+bool bIsDocumentScript = loc == "document";
 
 if ( bIsDocumentScript )
 {
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 4a1fb448b7b1..2280960e66ea 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1383,19 +1383,22 @@ ErrCode SfxObjectShell::CallXScript( const Reference< 
XInterface >& _rxScriptCon
 SAL_INFO("sfx", "in CallXScript" );
 ErrCode nErr = ERRCODE_NONE;
 
-bool bIsDocumentScript = ( _rScriptURL.indexOf( "location=document" ) >= 0 
);
-// TODO: we should parse the URL, and check whether there is a 
parameter with this name.
-// Otherwise, we might find too much.
-if ( bIsDocumentScript && !lcl_isScriptAccessAllowed_nothrow( 
_rxScriptContext ) )
-return ERRCODE_IO_ACCESSDENIED;
-
-if ( UnTrustedScript(_rScriptURL) )
-return ERRCODE_IO_ACCESSDENIED;
-
 bool bCaughtException = false;
 Any aException;
 try
 {
+css::uno::Reference urifac(
+
css::uri::UriReferenceFactory::create(comphelper::getProcessComponentContext()));
+css::uno::Reference uri(
+urifac->parse(_rScriptURL), css::uno::UNO_QUERY_THROW);
+auto const loc = uri->getParameter("location");
+bool bIsDocumentScript = loc == "document";
+if ( bIsDocumentScript && !lcl_isScriptAccessAllowed_nothrow( 
_rxScriptContext ) )
+return ERRCODE_IO_ACCESSDENIED;
+
+if ( UnTrustedScript(_rScriptURL) )
+return ERRCODE_IO_ACCESSDENIED;
+
 // obtain/create a script provider
 Reference< provider::XScriptProvider > xScriptProvider;
 Reference< provider::XScriptProviderSupplier > xSPS( _rxScriptContext, 
UNO_QUERY );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-08-06 Thread Stephan Bergmann (via logerrit)
 scripting/source/pyprov/pythonscript.py |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit c30da2b46b5f791281005b63e61f205d20fece13
Author: Stephan Bergmann 
AuthorDate: Sat Aug 3 16:37:48 2019 +0100
Commit: Caolán McNamara 
CommitDate: Tue Aug 6 12:25:00 2019 +0200

keep name percent-encoded

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

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index f1b2bfc75ee3..64e1337d642e 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -219,7 +219,9 @@ class MyUriHelper:
 
 # path to the .py file + "$functionname, arguments, etc
 xStorageUri = self.m_uriRefFac.parse(scriptURI)
-sStorageUri = xStorageUri.getName().replace( "|", "/" );
+# getName will apply url-decoding to the name, so encode back
+sStorageUri = xStorageUri.getName().replace("%", "%25")
+sStorageUri = sStorageUri.replace( "|", "/" )
 
 # path to the .py file, relative to the base
 sFileUri = sStorageUri[0:sStorageUri.find("$")]
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: scripting/source sdext/source sd/qa sd/source

2019-04-19 Thread Noel Grandin (via logerrit)
 scripting/source/provider/URIHelper.cxx|3 +--
 sd/qa/unit/export-tests-ooxml1.cxx |   12 
 sd/source/core/drawdoc2.cxx|3 +--
 sd/source/core/sdpage.cxx  |4 +---
 sd/source/filter/eppt/pptx-epptbase.cxx|3 +--
 sd/source/ui/accessibility/AccessiblePageShape.cxx |9 +++--
 sd/source/ui/dlg/filedlg.cxx   |3 +--
 sd/source/ui/func/fuconrec.cxx |3 +--
 sd/source/ui/func/unoaprms.cxx |4 +---
 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx |3 +--
 sd/source/ui/tools/IconCache.cxx   |3 +--
 sd/source/ui/tools/SdGlobalResourceContainer.cxx   |6 ++
 sd/source/ui/unoidl/SdUnoDrawView.cxx  |4 +---
 sd/source/ui/unoidl/UnoDocumentSettings.cxx|3 +--
 sd/source/ui/view/Outliner.cxx |4 +---
 sd/source/ui/view/drviews2.cxx |3 +--
 sd/source/ui/view/sdview.cxx   |3 +--
 sd/source/ui/view/sdview3.cxx  |3 +--
 sd/source/ui/view/sdwindow.cxx |3 +--
 sdext/source/pdfimport/filterdet.cxx   |   11 +++
 sdext/source/pdfimport/test/pdfunzip.cxx   |3 +--
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |6 ++
 sdext/source/pdfimport/tree/writertreevisiting.cxx |6 ++
 sdext/source/pdfimport/wrapper/wrapper.cxx |3 +--
 sdext/source/presenter/PresenterSlideSorter.cxx|6 ++
 25 files changed, 36 insertions(+), 78 deletions(-)

New commits:
commit 8b663bc830605a0065184b299bea9cd3682d7935
Author: Noel Grandin 
AuthorDate: Sat Apr 13 21:25:10 2019 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 19 13:19:45 2019 +0200

loplugin:sequentialassign in sd

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

diff --git a/scripting/source/provider/URIHelper.cxx 
b/scripting/source/provider/URIHelper.cxx
index fb74cba6ab6b..2a09e8dbe5ae 100644
--- a/scripting/source/provider/URIHelper.cxx
+++ b/scripting/source/provider/URIHelper.cxx
@@ -184,8 +184,7 @@ ScriptingFrameworkURIHelper::getLanguagePart(const 
OUString& rStorageURI)
 OUString
 ScriptingFrameworkURIHelper::getLanguagePath(const OUString& rLanguagePart)
 {
-OUString result;
-result = rLanguagePart.replace('|', '/');
+OUString result = rLanguagePart.replace('|', '/');
 return result;
 }
 
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index bf1c6b422354..e7080ae0a6e8 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -752,32 +752,28 @@ void SdOOXMLExportTest1::testTableCellBorder()
 uno::Reference< beans::XPropertySet > xCellPropSet (xCell, 
uno::UNO_QUERY_THROW);
 
 xCellPropSet->getPropertyValue("LeftBorder") >>= aBorderLine;
-sal_Int32 nLeftBorder = aBorderLine.LineWidth ;
 // While importing the table cell border line width, it converts EMU->Hmm then 
divided result by 2.
 // To get original value of LineWidth need to multiple by 2.
-nLeftBorder = nLeftBorder * 2 ;
+sal_Int32 nLeftBorder = aBorderLine.LineWidth * 2;
 nLeftBorder = oox::drawingml::convertHmmToEmu( nLeftBorder );
 CPPUNIT_ASSERT(nLeftBorder);
 CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine.Color);
 
 xCellPropSet->getPropertyValue("RightBorder") >>= aBorderLine;
-sal_Int32 nRightBorder = aBorderLine.LineWidth ;
-nRightBorder = nRightBorder * 2 ;
+sal_Int32 nRightBorder = aBorderLine.LineWidth * 2;
 nRightBorder = oox::drawingml::convertHmmToEmu( nRightBorder );
 CPPUNIT_ASSERT(nRightBorder);
 CPPUNIT_ASSERT_EQUAL(util::Color(16777215), aBorderLine.Color);
 
 xCellPropSet->getPropertyValue("TopBorder") >>= aBorderLine;
-sal_Int32 nTopBorder = aBorderLine.LineWidth ;
-nTopBorder = nTopBorder * 2 ;
+sal_Int32 nTopBorder = aBorderLine.LineWidth * 2;
 nTopBorder = oox::drawingml::convertHmmToEmu( nTopBorder );
 CPPUNIT_ASSERT(nTopBorder);
 CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine.Color);
 
 
 xCellPropSet->getPropertyValue("BottomBorder") >>= aBorderLine;
-sal_Int32 nBottomBorder = aBorderLine.LineWidth ;
-nBottomBorder = nBottomBorder * 2 ;
+sal_Int32 nBottomBorder = aBorderLine.LineWidth * 2;
 nBottomBorder = oox::drawingml::convertHmmToEmu( nBottomBorder );
 CPPUNIT_ASSERT(nBottomBorder);
 CPPUNIT_ASSERT_EQUAL(util::Color(45296), aBorderLine.Color);
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index bf3ecb518aff..7c73d7dc66ca 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ 

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

2018-12-20 Thread Libreoffice Gerrit user
 scripting/source/provider/MasterScriptProvider.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 09f80aded680fca07e6676f769b80491da12f0bb
Author: Mike Kaganski 
AuthorDate: Thu Dec 20 07:55:20 2018 +0100
Commit: Mike Kaganski 
CommitDate: Thu Dec 20 09:12:36 2018 +0100

Restore original behavior of MasterScriptProvider::hasByName

Commit f3ce30ec75a4d7116b9cd4d7b21d9aaa0e237eeb changed this to return
after first non-throwing XNameContainer::hasByName, regardless if it
returned true or false.

This changes it back, to iterate over all the providers again.

Change-Id: I74fa4d4aa8760cad509442226601ab4842312b80
Reviewed-on: https://gerrit.libreoffice.org/65471
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index 6854d6283dc0..4a66a15093da 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -466,7 +466,8 @@ template  bool 
FindProviderAndApply(ProviderCache& rCache, Proc p
 try
 {
 bResult = p(xCont);
-break;
+if (bResult)
+break;
 }
 catch (Exception& e)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-12-19 Thread Libreoffice Gerrit user
 scripting/source/stringresource/stringresource.cxx |   44 +
 scripting/source/stringresource/stringresource.hxx |2 
 2 files changed, 20 insertions(+), 26 deletions(-)

New commits:
commit f12b6893cfee3df23756f752adad299f1368f04b
Author: Noel Grandin 
AuthorDate: Wed Dec 19 10:52:51 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Dec 19 12:34:05 2018 +0100

use unique_ptr in StringResourceImpl

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

diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index bb700290ff25..bf4260646caa 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -38,6 +38,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -337,8 +338,8 @@ void StringResourceImpl::setDefaultLocale( const Locale& 
locale )
 {
 if( m_pDefaultLocaleItem )
 {
-LocaleItem* pChangedDefaultLocaleItem = new LocaleItem( 
m_pDefaultLocaleItem->m_locale );
-m_aChangedDefaultLocaleVector.push_back( pChangedDefaultLocaleItem 
);
+m_aChangedDefaultLocaleVector.push_back(
+o3tl::make_unique( m_pDefaultLocaleItem->m_locale 
) );
 }
 
 m_pDefaultLocaleItem = pLocaleItem;
@@ -523,8 +524,8 @@ void StringResourceImpl::removeLocale( const Locale& locale 
)
 m_nNextUniqueNumericId = 0;
 if( m_pDefaultLocaleItem )
 {
-LocaleItem* pChangedDefaultLocaleItem = new 
LocaleItem( m_pDefaultLocaleItem->m_locale );
-m_aChangedDefaultLocaleVector.push_back( 
pChangedDefaultLocaleItem );
+m_aChangedDefaultLocaleVector.push_back(
+o3tl::make_unique( 
m_pDefaultLocaleItem->m_locale ) );
 }
 m_pCurrentLocaleItem = nullptr;
 m_pDefaultLocaleItem = nullptr;
@@ -937,20 +938,17 @@ void StringResourcePersistenceImpl::implStoreAtStorage
 {
 for( auto& pLocaleItem : m_aChangedDefaultLocaleVector )
 {
-if( pLocaleItem != nullptr )
-{
-OUString aStreamName = implGetFileNameForLocaleItem( 
pLocaleItem, m_aNameBase );
-aStreamName += ".default";
-
-try
-{
-Storage->removeElement( aStreamName );
-}
-catch( Exception& )
-{}
+OUString aStreamName = implGetFileNameForLocaleItem( 
pLocaleItem.get(), m_aNameBase );
+aStreamName += ".default";
 
-delete pLocaleItem;
+try
+{
+Storage->removeElement( aStreamName );
 }
+catch( Exception& )
+{}
+
+pLocaleItem.reset();
 }
 m_aChangedDefaultLocaleVector.clear();
 }
@@ -1019,15 +1017,11 @@ void 
StringResourcePersistenceImpl::implKillChangedDefaultFiles
 // Delete files for changed defaults
 for( auto& pLocaleItem : m_aChangedDefaultLocaleVector )
 {
-if( pLocaleItem != nullptr )
-{
-OUString aCompleteFileName =
-implGetPathForLocaleItem( pLocaleItem, aNameBase, Location, 
true );
-if( xFileAccess->exists( aCompleteFileName ) )
-xFileAccess->kill( aCompleteFileName );
-
-delete pLocaleItem;
-}
+OUString aCompleteFileName =
+implGetPathForLocaleItem( pLocaleItem.get(), aNameBase, Location, 
true );
+if( xFileAccess->exists( aCompleteFileName ) )
+xFileAccess->kill( aCompleteFileName );
+pLocaleItem.reset();
 }
 m_aChangedDefaultLocaleVector.clear();
 }
diff --git a/scripting/source/stringresource/stringresource.hxx 
b/scripting/source/stringresource/stringresource.hxx
index e99088b001cf..13ad55a327ec 100644
--- a/scripting/source/stringresource/stringresource.hxx
+++ b/scripting/source/stringresource/stringresource.hxx
@@ -82,7 +82,7 @@ struct LocaleItem
 {}
 };
 
-typedef std::vector< LocaleItem* > LocaleItemVector;
+typedef std::vector< std::unique_ptr > LocaleItemVector;
 
 typedef ::cppu::WeakImplHelper<
 css::lang::XServiceInfo,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: scripting/source sd/source sfx2/source stoc/source svl/source svtools/source

2018-11-22 Thread Libreoffice Gerrit user
 scripting/source/vbaevents/eventhelper.cxx|   11 +-
 sd/source/core/stlsheet.cxx   |4 
 sd/source/ui/framework/factories/BasicViewFactory.cxx |   11 +-
 sd/source/ui/unoidl/facreg.cxx|   20 ++--
 sfx2/source/appl/sfxhelp.cxx  |   48 ---
 sfx2/source/view/classificationhelper.cxx |   11 +-
 sfx2/source/view/sfxbasecontroller.cxx|   74 +++---
 stoc/source/javaloader/javaloader.cxx |   12 --
 svl/source/misc/inettype.cxx  |   18 ++--
 svtools/source/config/apearcfg.cxx|   15 ---
 svtools/source/config/htmlcfg.cxx |   13 ---
 11 files changed, 88 insertions(+), 149 deletions(-)

New commits:
commit 06ad764cfb36ece7f054ecb786cc0395346a6a68
Author: Noel Grandin 
AuthorDate: Thu Nov 22 08:56:15 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Nov 22 12:46:56 2018 +0100

improve function-local statics in scripting..svtools

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

diff --git a/scripting/source/vbaevents/eventhelper.cxx 
b/scripting/source/vbaevents/eventhelper.cxx
index 86d941df9e74..408539cb7038 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -256,10 +256,9 @@ static TranslatePropMap aTranslatePropMap_Impl[] =
 
 static EventInfoHash& getEventTransInfo()
 {
-static bool initialised = false;
-static EventInfoHash eventTransInfo;
-if ( !initialised )
+static EventInfoHash eventTransInfo = [&]()
 {
+EventInfoHash tmp;
 OUString sEventInfo;
 TranslatePropMap* pTransProp = aTranslatePropMap_Impl;
 int nCount = SAL_N_ELEMENTS(aTranslatePropMap_Impl);
@@ -275,10 +274,10 @@ static EventInfoHash& getEventTransInfo()
 pTransProp++;
 i++;
 }while(i < nCount && sEventInfo == pTransProp->sEventInfo);
-eventTransInfo[sEventInfo] = infoList;
+tmp[sEventInfo] = infoList;
 }
-initialised = true;
-}
+return tmp;
+}();
 return eventTransInfo;
 }
 
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 24f365b30936..3df37e99da6e 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -958,9 +958,7 @@ void SAL_CALL SdStyleSheet::setParentStyle( const OUString& 
rParentName  )
 Reference< XPropertySetInfo > SdStyleSheet::getPropertySetInfo()
 {
 throwIfDisposed();
-static Reference< XPropertySetInfo > xInfo;
-if( !xInfo.is() )
-xInfo = GetStylePropertySet().getPropertySetInfo();
+static Reference< XPropertySetInfo > xInfo = 
GetStylePropertySet().getPropertySetInfo();
 return xInfo;
 }
 
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx 
b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 864f305e6009..d76eccbde220 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -439,17 +439,18 @@ bool BasicViewFactory::IsCacheable (const 
std::shared_ptr& rpDes
 Reference xResource (rpDescriptor->mxView, 
UNO_QUERY);
 if (xResource.is())
 {
-static ::std::vector > s_aCacheableResources;
-if (s_aCacheableResources.empty() )
+static ::std::vector > s_aCacheableResources = 
[&]()
 {
+::std::vector > tmp;
 std::shared_ptr pHelper 
(FrameworkHelper::Instance(*mpBase));
 
 // The slide sorter and the task panel are cacheable and 
relocatable.
-s_aCacheableResources.push_back(FrameworkHelper::CreateResourceId(
+tmp.push_back(FrameworkHelper::CreateResourceId(
 FrameworkHelper::msSlideSorterURL, 
FrameworkHelper::msLeftDrawPaneURL));
-s_aCacheableResources.push_back(FrameworkHelper::CreateResourceId(
+tmp.push_back(FrameworkHelper::CreateResourceId(
 FrameworkHelper::msSlideSorterURL, 
FrameworkHelper::msLeftImpressPaneURL));
-}
+return tmp;
+}();
 
 ::std::vector >::const_iterator iId;
 for (iId=s_aCacheableResources.begin(); 
iId!=s_aCacheableResources.end(); ++iId)
diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx
index 7b69d936ea9e..d4dc0533bfcf 100644
--- a/sd/source/ui/unoidl/facreg.cxx
+++ b/sd/source/ui/unoidl/facreg.cxx
@@ -44,16 +44,14 @@ enum FactoryId
 typedef std::unordered_map FactoryMap;
 
 namespace {
-static std::shared_ptr spFactoryMap;
-std::shared_ptr const & GetFactoryMap()
+FactoryMap const & GetFactoryMap()
 {
-if (spFactoryMap == nullptr)
+static FactoryMap aFactoryMap
 {
-spFactoryMap.reset(new FactoryMap);
-

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

2018-11-12 Thread Libreoffice Gerrit user
 scripting/source/basprov/basprov.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit c846e85f03b635c88e043166a352a42eeae39304
Author: Jan-Marek Glogowski 
AuthorDate: Mon Nov 12 13:02:13 2018 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Mon Nov 12 15:37:26 2018 +0100

Guard listener cleanup of BasicProviderImpl

Otherwise JunitTest_sfx2_complex dbgutil asserts especially on
Windows with:

ucrtbased!get_wide_winmain_command_line+0x296
ucrtbased!get_wide_winmain_command_line+0xe4
ucrtbased!wassert+0x1a
vcllo!ImplDbgTestSolarMutex+0x43
tllo!DbgTestSolarMutex+0x11d
svllo!SfxBroadcaster::RemoveListener+0x2e
svllo!SfxListener::~SfxListener+0x8f
basprovlo!basprov::BasicProviderImpl::~BasicProviderImpl+0x8f
...

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

diff --git a/scripting/source/basprov/basprov.cxx 
b/scripting/source/basprov/basprov.cxx
index 6c856d5a5a24..1055b57bd7d0 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -101,6 +101,8 @@ namespace basprov
 
 BasicProviderImpl::~BasicProviderImpl()
 {
+SolarMutexGuard aGuard;
+EndListeningAll();
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: scripting/source sc/source sfx2/source sw/source ucb/source

2018-10-28 Thread Libreoffice Gerrit user
 sc/source/core/data/global.cxx |   15 -
 sc/source/ui/app/inputhdl.cxx  |  200 ++---
 scripting/source/provider/MasterScriptProvider.cxx |   22 --
 sfx2/source/doc/objstor.cxx|   14 -
 sw/source/uibase/utlui/glbltree.cxx|3 
 ucb/source/ucp/ftp/ftpcontent.cxx  |   18 -
 6 files changed, 112 insertions(+), 160 deletions(-)

New commits:
commit 36880d76299e913761f03bbde1b6ca6bea393b5a
Author: Mike Kaganski 
AuthorDate: Sun Oct 28 03:09:02 2018 +0300
Commit: Mike Kaganski 
CommitDate: Sun Oct 28 08:23:32 2018 +0100

tdf#120703 PVS: V547 Expression is always true/false

Change-Id: I1e5098e11f1e5e2f7c5518ea05c57512f58b585b
Reviewed-on: https://gerrit.libreoffice.org/62464
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 1bb038b4d437..441c95ef8412 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -523,18 +523,13 @@ void ScGlobal::InitTextHeight(const SfxItemPool* pPool)
 return;
 }
 
-const ScPatternAttr* pPattern = >GetDefaultItem(ATTR_PATTERN);
-if (!pPattern)
-{
-OSL_FAIL("ScGlobal::InitTextHeight: No default pattern");
-return;
-}
+const ScPatternAttr& rPattern = pPool->GetDefaultItem(ATTR_PATTERN);
 
 OutputDevice* pDefaultDev = Application::GetDefaultDevice();
 ScopedVclPtrInstance< VirtualDevice > pVirtWindow( *pDefaultDev );
 pVirtWindow->SetMapMode(MapMode(MapUnit::MapPixel));
 vcl::Font aDefFont;
-pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // Font color 
doesn't matter here
+rPattern.GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // Font color 
doesn't matter here
 pVirtWindow->SetFont(aDefFont);
 sal_uInt16 nTest = static_cast(
 pVirtWindow->PixelToLogic(Size(0, pVirtWindow->GetTextHeight()), 
MapMode(MapUnit::MapTwip)).Height());
@@ -542,10 +537,10 @@ void ScGlobal::InitTextHeight(const SfxItemPool* pPool)
 if (nTest > nDefFontHeight)
 nDefFontHeight = nTest;
 
-const SvxMarginItem* pMargin = >GetItem(ATTR_MARGIN);
+const SvxMarginItem& rMargin = rPattern.GetItem(ATTR_MARGIN);
 
-nTest = static_cast(
-nDefFontHeight + pMargin->GetTopMargin() + pMargin->GetBottomMargin() 
- STD_ROWHEIGHT_DIFF);
+nTest = static_cast(nDefFontHeight + rMargin.GetTopMargin()
++ rMargin.GetBottomMargin() - 
STD_ROWHEIGHT_DIFF);
 
 if (nTest > nStdRowHeight)
 nStdRowHeight = nTest;
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 4706b8f21e22..36af4bd5979c 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3633,131 +3633,127 @@ void ScInputHandler::NotifyChange( const 
ScInputHdlState* pState,
 {
 ScModule* pScMod = SC_MOD();
 
-if ( pState )
+// Also take foreign reference input into account here (e.g. 
FunctionsAutoPilot),
+// FormEditData, if we're switching from Help to Calc:
+if ( !bFormulaMode && !pScMod->IsFormulaMode() && 
!pScMod->GetFormEditData() )
 {
+bool bIgnore = false;
+if ( bModified )
+{
+if (pState->GetPos() != aCursorPos)
+{
+if (!bProtected)
+EnterHandler();
+}
+else
+bIgnore = true;
+}
 
-// Also take foreign reference input into account here (e.g. 
FunctionsAutoPilot),
-// FormEditData, if we're switching from Help to Calc:
-if ( !bFormulaMode && !pScMod->IsFormulaMode() && 
!pScMod->GetFormEditData() )
+if ( !bIgnore )
 {
-bool bIgnore = false;
-if ( bModified )
+const ScAddress&rSPos   = pState->GetStartPos();
+const ScAddress&rEPos   = pState->GetEndPos();
+const EditTextObject*   pData   = pState->GetEditData();
+OUString aString = pState->GetString();
+bool bTxtMod = false;
+ScDocShell* pDocSh = 
pActiveViewSh->GetViewData().GetDocShell();
+ScDocument& rDoc = pDocSh->GetDocument();
+
+aCursorPos  = pState->GetPos();
+
+if ( pData )
+bTxtMod = true;
+else if ( bHadObject )
+bTxtMod = true;
+else if ( bTextValid )
+bTxtMod = ( aString != aCurrentText );
+else
+bTxtMod = ( aString != GetEditText(mpEditEngine.get()) );
+
+if ( bTxtMod || bForce )
 {
-if (pState->GetPos() != aCursorPos)
+if (pData)
 {
-  

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

2018-10-19 Thread Libreoffice Gerrit user
 scripting/source/pyprov/pythonscript.py |   30 --
 1 file changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 87d36feab5ce4b45798b0b80abe566fc7960d194
Author: Caolán McNamara 
AuthorDate: Thu Oct 18 20:39:23 2018 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 19 16:29:43 2018 +0200

keep pyuno script processing below base uri

Change-Id: Icc13fb7193fb1e7c50e0df286161a10b4ed636c7
Reviewed-on: https://gerrit.libreoffice.org/61957
Reviewed-by: Stephan Bergmann 
Tested-by: Jenkins

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 722dc24b9b07..f1b2bfc75ee3 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -25,6 +25,7 @@ import imp
 import time
 import ast
 import platform
+from com.sun.star.uri.RelativeUriExcessParentSegments import RETAIN
 
 try:
 unicode
@@ -212,8 +213,33 @@ class MyUriHelper:
 
 def scriptURI2StorageUri( self, scriptURI ):
 try:
-myUri = self.m_uriRefFac.parse(scriptURI)
-ret = self.m_baseUri + "/" + myUri.getName().replace( "|", "/" )
+# base path to the python script location
+sBaseUri = self.m_baseUri + "/"
+xBaseUri = self.m_uriRefFac.parse(sBaseUri)
+
+# path to the .py file + "$functionname, arguments, etc
+xStorageUri = self.m_uriRefFac.parse(scriptURI)
+sStorageUri = xStorageUri.getName().replace( "|", "/" );
+
+# path to the .py file, relative to the base
+sFileUri = sStorageUri[0:sStorageUri.find("$")]
+xFileUri = self.m_uriRefFac.parse(sFileUri)
+if not xFileUri:
+message = "pythonscript: invalid relative uri '" + sFileUri+ 
"'"
+log.debug( message )
+raise RuntimeException( message )
+
+# absolute path to the .py file
+xAbsScriptUri = self.m_uriRefFac.makeAbsolute(xBaseUri, xFileUri, 
True, RETAIN)
+sAbsScriptUri = xAbsScriptUri.getUriReference()
+
+# ensure py file is under the base path
+if not sAbsScriptUri.startswith(sBaseUri):
+message = "pythonscript: storage uri '" + sAbsScriptUri + "' 
not in base uri '" + self.m_baseUri + "'"
+log.debug( message )
+raise RuntimeException( message )
+
+ret = sBaseUri + sStorageUri
 log.debug( "converting scriptURI="+scriptURI + " to storageURI=" + 
ret )
 return ret
 except UnoException as e:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-09 Thread Libreoffice Gerrit user
 scripting/source/basprov/baslibnode.hxx|8 
 scripting/source/basprov/basmethnode.hxx   |4 ++--
 scripting/source/basprov/basmodnode.hxx|4 ++--
 scripting/source/basprov/basscript.hxx |2 +-
 scripting/source/dlgprov/dlgevtatt.cxx |4 ++--
 scripting/source/dlgprov/dlgevtatt.hxx |4 ++--
 scripting/source/provider/ProviderCache.hxx|2 +-
 scripting/source/stringresource/stringresource.cxx |2 +-
 scripting/source/vbaevents/eventhelper.cxx |8 
 9 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit 383a4f883d4a2932167695c761611b998f773f0e
Author: Noel Grandin 
AuthorDate: Mon Oct 8 16:14:22 2018 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 9 11:28:02 2018 +0200

loplugin:constfields in scripting

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

diff --git a/scripting/source/basprov/baslibnode.hxx 
b/scripting/source/basprov/baslibnode.hxx
index c23dcaa8a475..fc9e9e2efeaf 100644
--- a/scripting/source/basprov/baslibnode.hxx
+++ b/scripting/source/basprov/baslibnode.hxx
@@ -44,12 +44,12 @@ namespace basprov
 {
 private:
 css::uno::Reference< css::uno::XComponentContext >m_xContext;
-OUString  
m_sScriptingContext;
-BasicManager* m_pBasicManager;
+OUString const
m_sScriptingContext;
+BasicManager* const   m_pBasicManager;
 css::uno::Reference< css::script::XLibraryContainer > m_xLibContainer;
 css::uno::Reference< css::container::XNameContainer > m_xLibrary;
-OUString  m_sLibName;
-bool  m_bIsAppScript;
+OUString constm_sLibName;
+bool constm_bIsAppScript;
 
 public:
 BasicLibraryNodeImpl( const css::uno::Reference< 
css::uno::XComponentContext >& rxContext,
diff --git a/scripting/source/basprov/basmethnode.hxx 
b/scripting/source/basprov/basmethnode.hxx
index a66a0fb007c2..9949620e2ca8 100644
--- a/scripting/source/basprov/basmethnode.hxx
+++ b/scripting/source/basprov/basmethnode.hxx
@@ -53,9 +53,9 @@ namespace basprov
 {
 private:
 css::uno::Reference< css::uno::XComponentContext >m_xContext;
-OUString m_sScriptingContext;
+OUString const m_sScriptingContext;
 SbMethod* m_pMethod;
-bool m_bIsAppScript;
+bool const m_bIsAppScript;
 
 // properties
 OUString m_sURI;
diff --git a/scripting/source/basprov/basmodnode.hxx 
b/scripting/source/basprov/basmodnode.hxx
index e317df2272f1..569d218fab5e 100644
--- a/scripting/source/basprov/basmodnode.hxx
+++ b/scripting/source/basprov/basmodnode.hxx
@@ -43,9 +43,9 @@ namespace basprov
 {
 private:
 css::uno::Reference< css::uno::XComponentContext >m_xContext;
-OUString m_sScriptingContext;
+OUString const m_sScriptingContext;
 SbModule* m_pModule;
-bool m_bIsAppScript;
+bool const m_bIsAppScript;
 
 public:
 BasicModuleNodeImpl( const css::uno::Reference< 
css::uno::XComponentContext >& rxContext,
diff --git a/scripting/source/basprov/basscript.hxx 
b/scripting/source/basprov/basscript.hxx
index 29244c4e9316..62a2d61e66da 100644
--- a/scripting/source/basprov/basscript.hxx
+++ b/scripting/source/basprov/basscript.hxx
@@ -51,7 +51,7 @@ namespace basprov
 {
 private:
 SbMethodRef m_xMethod;
-OUStringm_funcName;
+OUString const  m_funcName;
 BasicManager*   m_documentBasicManager;
 css::uno::Reference< css::document::XScriptInvocationContext >
 m_xDocumentScriptContext;
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx 
b/scripting/source/dlgprov/dlgevtatt.cxx
index 4bb940f82167..cd174d88ec3c 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -81,7 +81,7 @@ namespace dlgprov
 Reference< awt::XControl > m_xControl;
 Reference< XInterface > m_xHandler;
 Reference< beans::XIntrospectionAccess > m_xIntrospectionAccess;
-bool m_bDialogProviderMode;
+bool const m_bDialogProviderMode;
 
 virtual void firing_impl( const script::ScriptEvent& aScriptEvent, 
uno::Any* pRet ) override;
 
@@ -99,7 +99,7 @@ namespace dlgprov
 {
 protected:
 OUString msDialogCodeName;
-OUString msDialogLibName;
+OUString const msDialogLibName;
 Reference<  script::XScriptListener > mxListener;
 virtual void 

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

2018-10-08 Thread Libreoffice Gerrit user
 scripting/source/basprov/basprov.cxx   |   22 ++---
 scripting/source/dlgprov/dlgprov.cxx   |   14 ++---
 scripting/source/stringresource/stringresource.cxx |   14 ++---
 sfx2/source/doc/objxtor.cxx|   14 +
 4 files changed, 15 insertions(+), 49 deletions(-)

New commits:
commit 9ed8a1bfffd608b31badeae5341ebf0b48501419
Author: Jochen Nitschke 
AuthorDate: Mon Oct 8 16:32:04 2018 +0200
Commit: Noel Grandin 
CommitDate: Mon Oct 8 19:51:24 2018 +0200

replace double-checked locking patterns with thread safe ...

local statics.

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

diff --git a/scripting/source/basprov/basprov.cxx 
b/scripting/source/basprov/basprov.cxx
index 6180fa333627..ce71c003d75d 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -76,21 +76,13 @@ namespace basprov
 
 static Sequence< OUString > getSupportedServiceNames_BasicProviderImpl()
 {
-static Sequence< OUString >* pNames = nullptr;
-if ( !pNames )
-{
-::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-if ( !pNames )
-{
-static Sequence< OUString > aNames(4);
-aNames.getArray()[0] = 
"com.sun.star.script.provider.ScriptProviderForBasic";
-aNames.getArray()[1] = 
"com.sun.star.script.provider.LanguageScriptProvider";
-aNames.getArray()[2] = 
"com.sun.star.script.provider.ScriptProvider";
-aNames.getArray()[3] = "com.sun.star.script.browse.BrowseNode";
-pNames = 
-}
-}
-return *pNames;
+static Sequence< OUString > s_Names{
+"com.sun.star.script.provider.ScriptProviderForBasic",
+"com.sun.star.script.provider.LanguageScriptProvider",
+"com.sun.star.script.provider.ScriptProvider",
+"com.sun.star.script.browse.BrowseNode"};
+
+return s_Names;
 }
 
 
diff --git a/scripting/source/dlgprov/dlgprov.cxx 
b/scripting/source/dlgprov/dlgprov.cxx
index 90a28cca56fd..4f979ee54308 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -177,17 +177,9 @@ namespace dlgprov
 
 ::osl::Mutex& getMutex()
 {
-static ::osl::Mutex* s_pMutex = nullptr;
-if ( !s_pMutex )
-{
-::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-if ( !s_pMutex )
-{
-static ::osl::Mutex s_aMutex;
-s_pMutex = _aMutex;
-}
-}
-return *s_pMutex;
+static ::osl::Mutex s_aMutex;
+
+return s_aMutex;
 }
 
 
diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index a17977536056..9e29229e13e0 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -62,17 +62,9 @@ namespace stringresource
 
 ::osl::Mutex& getMutex()
 {
-static ::osl::Mutex* s_pMutex = nullptr;
-if ( !s_pMutex )
-{
-::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-if ( !s_pMutex )
-{
-static ::osl::Mutex s_aMutex;
-s_pMutex = _aMutex;
-}
-}
-return *s_pMutex;
+static ::osl::Mutex s_aMutex;
+
+return s_aMutex;
 }
 
 
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 8eef03e8d5cc..a03e3b7ddd95 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -838,19 +838,9 @@ SfxObjectShell* SfxObjectShell::GetObjectShell()
 
 uno::Sequence< OUString > SfxObjectShell::GetEventNames()
 {
-static uno::Sequence< OUString >* pEventNameContainer = nullptr;
+static uno::Sequence< OUString > 
s_EventNameContainer(rtl::Reference(new 
GlobalEventConfig)->getElementNames());
 
-if ( !pEventNameContainer )
-{
-SolarMutexGuard aGuard;
-if ( !pEventNameContainer )
-{
-static uno::Sequence< OUString > aEventNameContainer = 
rtl::Reference(new GlobalEventConfig)->getElementNames();
-pEventNameContainer = 
-}
-}
-
-return *pEventNameContainer;
+return s_EventNameContainer;
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-06 Thread Libreoffice Gerrit user
 scripting/source/provider/ProviderCache.cxx |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 4435135e68f7d1024875defc3df18de183607048
Author: Mike Kaganski 
AuthorDate: Sat Oct 6 12:27:44 2018 +0200
Commit: Mike Kaganski 
CommitDate: Sat Oct 6 13:54:29 2018 +0200

Use range-based loop

Change-Id: I5c1233f53ca5c9f4322ecf7a832880399d6fec5e
Reviewed-on: https://gerrit.libreoffice.org/61463
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/scripting/source/provider/ProviderCache.cxx 
b/scripting/source/provider/ProviderCache.cxx
index 4e3b0230efa9..eeaac5fd44eb 100644
--- a/scripting/source/provider/ProviderCache.cxx
+++ b/scripting/source/provider/ProviderCache.cxx
@@ -88,16 +88,13 @@ ProviderCache::getAllProviders()
 
 ::osl::Guard< osl::Mutex > aGuard( m_mutex );
 Sequence < Reference< provider::XScriptProvider > > providers (  
m_hProviderDetailsCache.size() );
-ProviderDetails_hash::iterator h_itEnd =  m_hProviderDetailsCache.end();
-ProviderDetails_hash::iterator h_it = m_hProviderDetailsCache.begin();
 // should assert if size !>  0
 if (  !m_hProviderDetailsCache.empty() )
 {
 sal_Int32 providerIndex = 0;
-sal_Int32 index = 0;
-for ( index = 0; h_it !=  h_itEnd; ++h_it, index++ )
+for (auto& rDetail : m_hProviderDetailsCache)
 {
-Reference< provider::XScriptProvider > xScriptProvider  = 
h_it->second.provider;
+Reference xScriptProvider = 
rDetail.second.provider;
 if ( xScriptProvider.is() )
 {
 providers[ providerIndex++ ] = xScriptProvider;
@@ -107,7 +104,7 @@ ProviderCache::getAllProviders()
 // create provider
 try
 {
-xScriptProvider  = createProvider( h_it->second );
+xScriptProvider = createProvider(rDetail.second);
 providers[ providerIndex++ ] = xScriptProvider;
 }
 catch ( const Exception& )
@@ -117,7 +114,7 @@ ProviderCache::getAllProviders()
 }
 }
 
-if ( providerIndex < index )
+if (providerIndex < providers.getLength())
 {
 providers.realloc( providerIndex );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-09 Thread Libreoffice Gerrit user
 scripting/source/stringresource/stringresource.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit f2ea65c92330ef0e36725a351f7b39027023f4bf
Author: Noel Grandin 
AuthorDate: Thu Sep 6 11:26:00 2018 +0200
Commit: Noel Grandin 
CommitDate: Sun Sep 9 13:34:59 2018 +0200

loplugin:useuniqueptr in StringResourcePersistenceImpl

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

diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 3317fa330fd1..94c7d0ba85f7 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -1241,7 +1241,7 @@ Sequence< sal_Int8 > 
StringResourcePersistenceImpl::exportBinary(  )
 BinaryOutput aOut( m_xContext );
 
 sal_Int32 nLocaleCount = m_aLocaleItemVector.size();
-Sequence< sal_Int8 >* pLocaleDataSeq = new Sequence< sal_Int8 >[ 
nLocaleCount ];
+std::vector> aLocaleDataSeq(nLocaleCount);
 
 sal_Int32 iLocale = 0;
 sal_Int32 iDefault = 0;
@@ -1255,7 +1255,7 @@ Sequence< sal_Int8 > 
StringResourcePersistenceImpl::exportBinary(  )
 BinaryOutput aLocaleOut( m_xContext );
 implWriteLocaleBinary( pLocaleItem.get(), aLocaleOut );
 
-pLocaleDataSeq[iLocale] = aLocaleOut.closeAndGetData();
+aLocaleDataSeq[iLocale] = aLocaleOut.closeAndGetData();
 }
 ++iLocale;
 }
@@ -1273,7 +1273,7 @@ Sequence< sal_Int8 > 
StringResourcePersistenceImpl::exportBinary(  )
 {
 aOut.writeInt32( nDataPos );
 
-Sequence< sal_Int8 >& rSeq = pLocaleDataSeq[iLocale];
+Sequence< sal_Int8 >& rSeq = aLocaleDataSeq[iLocale];
 sal_Int32 nSeqLen = rSeq.getLength();
 nDataPos += nSeqLen;
 }
@@ -1286,13 +1286,11 @@ Sequence< sal_Int8 > 
StringResourcePersistenceImpl::exportBinary(  )
 {
 for( iLocale = 0; iLocale < nLocaleCount; iLocale++ )
 {
-Sequence< sal_Int8 >& rSeq = pLocaleDataSeq[iLocale];
+Sequence< sal_Int8 >& rSeq = aLocaleDataSeq[iLocale];
 xOutputStream->writeBytes( rSeq );
 }
 }
 
-delete[] pLocaleDataSeq;
-
 Sequence< sal_Int8 > aRetSeq = aOut.closeAndGetData();
 return aRetSeq;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-22 Thread Libreoffice Gerrit user
 scripting/source/stringresource/stringresource.cxx |   58 +
 scripting/source/stringresource/stringresource.hxx |4 -
 2 files changed, 28 insertions(+), 34 deletions(-)

New commits:
commit 7867e1f1cdd726cb98a236245e3d08557cc3a313
Author: Noel Grandin 
AuthorDate: Wed Aug 22 09:45:29 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 22 13:25:44 2018 +0200

loplugin:useuniqueptr in StringResourceImpl

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

diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 8fdfdec22526..3317fa330fd1 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -112,11 +112,6 @@ StringResourceImpl::StringResourceImpl( const Reference< 
XComponentContext >& rx
 
 StringResourceImpl::~StringResourceImpl()
 {
-for( auto& pLocaleItem : m_aLocaleItemVector )
-delete pLocaleItem;
-
-for( auto& pLocaleItem : m_aDeletedLocaleItemVector )
-delete pLocaleItem;
 }
 
 
@@ -445,7 +440,7 @@ void StringResourceImpl::newLocale( const Locale& locale )
 //}
 
 LocaleItem* pLocaleItem = new LocaleItem( locale );
-m_aLocaleItemVector.push_back( pLocaleItem );
+m_aLocaleItemVector.emplace_back( pLocaleItem );
 pLocaleItem->m_bModified = true;
 
 // Copy strings from default locale
@@ -506,9 +501,9 @@ void StringResourceImpl::removeLocale( const Locale& locale 
)
 LocaleItem* pFallbackItem = nullptr;
 for( auto& pLocaleItem : m_aLocaleItemVector )
 {
-if( pLocaleItem != pRemoveItem )
+if( pLocaleItem.get() != pRemoveItem )
 {
-pFallbackItem = pLocaleItem;
+pFallbackItem = pLocaleItem.get();
 break;
 }
 }
@@ -524,11 +519,10 @@ void StringResourceImpl::removeLocale( const Locale& 
locale )
 }
 for( auto it = m_aLocaleItemVector.begin(); it != 
m_aLocaleItemVector.end(); ++it )
 {
-LocaleItem* pLocaleItem = *it;
-if( pLocaleItem == pRemoveItem )
+if( it->get() == pRemoveItem )
 {
 // Remember locale item to delete file while storing
-m_aDeletedLocaleItemVector.push_back( pLocaleItem );
+m_aDeletedLocaleItemVector.push_back( std::move(*it) );
 
 // Last locale?
 if( nLocaleCount == 1 )
@@ -607,7 +601,7 @@ LocaleItem* StringResourceImpl::getItemForLocale
 cmp_locale.Country  == locale.Country &&
 cmp_locale.Variant  == locale.Variant )
 {
-pRetItem = pLocaleItem;
+pRetItem = pLocaleItem.get();
 break;
 }
 }
@@ -635,7 +629,7 @@ LocaleItem* 
StringResourceImpl::getClosestMatchItemForLocale( const Locale& loca
 }
 ::std::vector< Locale >::const_iterator iFound( 
LanguageTag::getMatchingFallback( aLocales, locale));
 if (iFound != aLocales.end())
-pRetItem = *(m_aLocaleItemVector.begin() + (iFound - 
aLocales.begin()));
+pRetItem = (m_aLocaleItemVector.begin() + (iFound - 
aLocales.begin()))->get();
 
 return pRetItem;
 }
@@ -894,9 +888,9 @@ void StringResourcePersistenceImpl::implStoreAtStorage
 {
 for( auto& pLocaleItem : m_aDeletedLocaleItemVector )
 {
-if( pLocaleItem != nullptr )
+if( pLocaleItem )
 {
-OUString aStreamName = implGetFileNameForLocaleItem( 
pLocaleItem, m_aNameBase );
+OUString aStreamName = implGetFileNameForLocaleItem( 
pLocaleItem.get(), m_aNameBase );
 aStreamName += ".properties";
 
 try
@@ -906,7 +900,7 @@ void StringResourcePersistenceImpl::implStoreAtStorage
 catch( Exception& )
 {}
 
-delete pLocaleItem;
+pLocaleItem.reset();
 }
 }
 m_aDeletedLocaleItemVector.clear();
@@ -915,9 +909,9 @@ void StringResourcePersistenceImpl::implStoreAtStorage
 for( auto& pLocaleItem : m_aLocaleItemVector )
 {
 if( pLocaleItem != nullptr && (bStoreAll || pLocaleItem->m_bModified) 
&&
-loadLocale( pLocaleItem ) )
+loadLocale( pLocaleItem.get() ) )
 {
-OUString aStreamName = implGetFileNameForLocaleItem( pLocaleItem, 
aNameBase );
+OUString aStreamName = implGetFileNameForLocaleItem( 
pLocaleItem.get(), aNameBase );
 aStreamName += ".properties";
 
 Reference< io::XStream > xElementStream =
@@ -937,7 +931,7 @@ void 

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

2018-07-30 Thread Libreoffice Gerrit user
 scripting/source/basprov/basprov.cxx   
 |1 +
 scripting/source/protocolhandler/scripthandler.cxx 
 |1 +
 scripting/source/provider/BrowseNodeFactoryImpl.cxx
 |1 +
 scripting/source/provider/MasterScriptProvider.cxx 
 |1 +
 scripting/source/provider/ProviderCache.cxx
 |1 +
 scripting/source/vbaevents/eventhelper.cxx 
 |1 +
 sd/source/core/CustomAnimationCloner.cxx   
 |1 +
 sd/source/core/CustomAnimationEffect.cxx   
 |1 +
 sd/source/core/CustomAnimationPreset.cxx   
 |1 +
 sd/source/core/PageListWatcher.cxx 
 |1 +
 sd/source/core/TransitionPreset.cxx
 |1 +
 sd/source/core/drawdoc2.cxx
 |1 +
 sd/source/core/sdpage.cxx  
 |1 +
 sd/source/core/stlsheet.cxx
 |1 +
 sd/source/filter/eppt/pptx-epptbase.cxx
 |1 +
 sd/source/filter/eppt/pptx-epptooxml.cxx   
 |1 +
 sd/source/filter/html/htmlex.cxx   
 |1 +
 sd/source/filter/ppt/ppt97animations.cxx   
 |1 +
 sd/source/filter/ppt/pptin.cxx 
 |1 +
 sd/source/filter/ppt/propread.cxx  
 |1 +
 sd/source/filter/xml/sdxmlwrp.cxx  
 |1 +
 sd/source/helper/simplereferencecomponent.cxx  
 |1 +
 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx  
 |1 +
 sd/source/ui/accessibility/AccessibleOutlineView.cxx   
 |1 +
 sd/source/ui/accessibility/AccessiblePageShape.cxx 
 |1 +
 sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx 
 |1 +
 sd/source/ui/accessibility/AccessibleSlideSorterView.cxx   
 |1 +
 sd/source/ui/animations/SlideTransitionPane.cxx
 |1 +
 sd/source/ui/dlg/PhotoAlbumDialog.cxx  
 |1 +
 sd/source/ui/dlg/prltempl.cxx  
 |1 +
 sd/source/ui/dlg/sdtreelb.cxx  
 |1 +
 sd/source/ui/docshell/docshel4.cxx 
 |1 +
 sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx   
 |1 +
 sd/source/ui/framework/configuration/Configuration.cxx 
 |1 +
 sd/source/ui/framework/configuration/ConfigurationClassifier.cxx   
 |1 +
 sd/source/ui/framework/configuration/ConfigurationController.cxx   
 |1 +
 
sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx 
|1 +
 sd/source/ui/framework/configuration/ConfigurationUpdater.cxx  
 |1 +
 sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
 |1 +
 sd/source/ui/framework/factories/ChildWindowPane.cxx   
 |1 +
 sd/source/ui/framework/factories/ViewShellWrapper.cxx  
 |1 +
 sd/source/ui/framework/module/ModuleController.cxx 
 |1 +
 sd/source/ui/func/fuexpand.cxx 
 |1 +
 sd/source/ui/remotecontrol/BufferedStreamSocket.cxx
 |1 +
 sd/source/ui/remotecontrol/Communicator.cxx
 |1 +
 sd/source/ui/remotecontrol/DiscoveryService.cxx
 |1 +
 sd/source/ui/remotecontrol/ImagePreparer.cxx   
 |1 +
 sd/source/ui/remotecontrol/Listener.cxx
 |1 +
 sd/source/ui/remotecontrol/Receiver.cxx
 |1 +
 sd/source/ui/remotecontrol/Transmitter.cxx 
 |1 +
 sd/source/ui/sidebar/DocumentHelper.cxx
 |1 +
 sd/source/ui/sidebar/LayoutMenu.cxx
 |1 +
 sd/source/ui/sidebar/MasterPageContainerProviders.cxx  
 |1 +
 sd/source/ui/sidebar/MasterPageDescriptor.cxx  
 |1 +
 sd/source/ui/slideshow/showwin.cxx 
 | 

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

2018-04-27 Thread Laurent Godard
 scripting/source/pyprov/pythonscript.py |   24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

New commits:
commit 3d97c9d292d80cb82391bdb416a9c6217a8e16e4
Author: Laurent Godard 
Date:   Wed Apr 25 15:49:21 2018 +0200

tdf#117202 more pythonic and allow spaces as argument

space argument must be encapsulated in double-quotes
that will be stripped

Change-Id: I0387cc7f3fcb4cc48c5a94afcd481306bb4644e2
Reviewed-on: https://gerrit.libreoffice.org/53453
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 5844ebe8912c..b1ef0aa7e324 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -869,10 +869,8 @@ class PythonScript( unohelper.Base, XScript ):
 def __init__( self, func, mod, args ):
 self.func = func
 self.mod = mod
-if (args != '' and args is not None):
-self.args = tuple([x.strip() for x in args.split(",")])
-else:
-self.args = None
+self.args = args
+
 def invoke(self, args, out, outindex ):
 log.debug( "PythonScript.invoke " + str( args ) )
 try:
@@ -986,19 +984,23 @@ class PythonScriptProvider( unohelper.Base, XBrowseNode, 
XScriptProvider, XNameC
 def getType( self ):
 return self.dirBrowseNode.getType()
 
-# retrieve function args in parenthesis
+# retreive function args in parenthesis
 def getFunctionArguments(self, func_signature):
-nOpenParenthesis = func_signature.find( "(")
+nOpenParenthesis = func_signature.find( "(" )
 if -1 == nOpenParenthesis:
 function_name = func_signature
-arguments = ''
+arguments = None
 else:
 function_name = func_signature[0:nOpenParenthesis]
-leading = func_signature[nOpenParenthesis+1:len(func_signature)]
-nCloseParenthesis = leading.find( ")")
+arg_part = func_signature[nOpenParenthesis+1:len(func_signature)]
+nCloseParenthesis = arg_part.find( ")" )
 if -1 == nCloseParenthesis:
 raise IllegalArgumentException( "PythonLoader: mismatch 
parenthesis " + func_signature, self, 0 )
-arguments = leading[0:nCloseParenthesis]
+arguments = arg_part[0:nCloseParenthesis].strip()
+if arguments == "":
+arguments = None
+else:
+arguments = tuple([x.strip().strip('"') for x in 
arguments.split(",")])
 return function_name, arguments
 
 def getScript( self, scriptUri ):
@@ -1011,7 +1013,7 @@ class PythonScriptProvider( unohelper.Base, XBrowseNode, 
XScriptProvider, XNameC
 fileUri = storageUri[0:storageUri.find( "$" )]
 funcName = storageUri[storageUri.find( "$" )+1:len(storageUri)]
 
-# retrieve arguments in parenthesis
+# retreive arguments in parenthesis
 funcName, funcArgs = self.getFunctionArguments(funcName)
 log.debug( " getScript : parsed funcname " + str(funcName) )
 log.debug( " getScript : func args " + str(funcArgs) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-24 Thread Laurent Godard
 scripting/source/pyprov/pythonscript.py |   34 
 1 file changed, 30 insertions(+), 4 deletions(-)

New commits:
commit aa45e2745f14c5626fe163939dc7d101efe9d1cd
Author: Laurent Godard 
Date:   Tue Apr 24 16:05:18 2018 +0200

tdf#117202 - parse function name to get arguments

they are then aggregated to the other and passed to the function

Change-Id: I158a747de9c22d50716fc066074a593b4928d6bf
Reviewed-on: https://gerrit.libreoffice.org/53424
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index ef131b3c1dab..5844ebe8912c 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -743,7 +743,7 @@ class DummyProgressHandler( unohelper.Base, 
XProgressHandler ):
 
 def push( self,status ):
 log.debug( "pythonscript: DummyProgressHandler.push " + str( status ) )
-def update( self,status ): 
+def update( self,status ):
 log.debug( "pythonscript: DummyProgressHandler.update " + str( status 
) )
 def pop( self, event ):
 log.debug( "pythonscript: DummyProgressHandler.push " + str( event ) )
@@ -866,12 +866,18 @@ class PackageBrowseNode( unohelper.Base, XBrowseNode ):
 
 
 class PythonScript( unohelper.Base, XScript ):
-def __init__( self, func, mod ):
+def __init__( self, func, mod, args ):
 self.func = func
 self.mod = mod
+if (args != '' and args is not None):
+self.args = tuple([x.strip() for x in args.split(",")])
+else:
+self.args = None
 def invoke(self, args, out, outindex ):
 log.debug( "PythonScript.invoke " + str( args ) )
 try:
+if (self.args):
+args += self.args
 ret = self.func( *args )
 except UnoException as e:
 # UNO Exception continue to fly ...
@@ -883,7 +889,7 @@ class PythonScript( unohelper.Base, XScript ):
 # some people may beat me up for modifying the exception text,
 # but otherwise office just shows
 # the type name and message text with no more information,
-# this is really bad for most users. 
+# this is really bad for most users.
 e.Message = e.Message + " (" + complete + ")"
 raise
 except Exception as e:
@@ -980,6 +986,21 @@ class PythonScriptProvider( unohelper.Base, XBrowseNode, 
XScriptProvider, XNameC
 def getType( self ):
 return self.dirBrowseNode.getType()
 
+# retrieve function args in parenthesis
+def getFunctionArguments(self, func_signature):
+nOpenParenthesis = func_signature.find( "(")
+if -1 == nOpenParenthesis:
+function_name = func_signature
+arguments = ''
+else:
+function_name = func_signature[0:nOpenParenthesis]
+leading = func_signature[nOpenParenthesis+1:len(func_signature)]
+nCloseParenthesis = leading.find( ")")
+if -1 == nCloseParenthesis:
+raise IllegalArgumentException( "PythonLoader: mismatch 
parenthesis " + func_signature, self, 0 )
+arguments = leading[0:nCloseParenthesis]
+return function_name, arguments
+
 def getScript( self, scriptUri ):
 try:
 log.debug( "getScript " + scriptUri + " invoked")
@@ -990,13 +1011,18 @@ class PythonScriptProvider( unohelper.Base, XBrowseNode, 
XScriptProvider, XNameC
 fileUri = storageUri[0:storageUri.find( "$" )]
 funcName = storageUri[storageUri.find( "$" )+1:len(storageUri)]
 
+# retrieve arguments in parenthesis
+funcName, funcArgs = self.getFunctionArguments(funcName)
+log.debug( " getScript : parsed funcname " + str(funcName) )
+log.debug( " getScript : func args " + str(funcArgs) )
+
 mod = self.provCtx.getModuleByUrl( fileUri )
 log.debug( " got mod " + str(mod) )
 
 func = mod.__dict__[ funcName ]
 
 log.debug( "got func " + str( func ) )
-return PythonScript( func, mod )
+return PythonScript( func, mod, funcArgs )
 except:
 text = lastException2String()
 log.error( text )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-28 Thread Tor Lillqvist
 scripting/source/pyprov/pythonscript.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8329f4541e27402d19729ae1588af8bfe61f7b49
Author: Tor Lillqvist 
Date:   Fri Jan 12 15:50:05 2018 +0200

Fix class name in debug message

Change-Id: I171e74a34273ddf969e49260fec487dd8cf2fb12
Reviewed-on: https://gerrit.libreoffice.org/51981
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index e97784ce7025..ef131b3c1dab 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -859,7 +859,7 @@ class PackageBrowseNode( unohelper.Base, XBrowseNode ):
 return CONTAINER
 
 def getScript( self, uri ):
-log.debug( "DirBrowseNode getScript " + uri + " invoked" )
+log.debug( "PackageBrowseNode getScript " + uri + " invoked" )
 raise IllegalArgumentException( "PackageBrowseNode couldn't 
instantiate script " + uri , self , 0 )
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-27 Thread Tor Lillqvist
 scripting/source/protocolhandler/scripthandler.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 2147cbf6204ebca8fb5a306ad5d81215b1175ac2
Author: Tor Lillqvist 
Date:   Fri Jan 12 14:16:51 2018 +0200

Filter out "SynchronMode" too

Change-Id: I2c5111ee34929b9740796f5e1f08b3a8a58218e4
Reviewed-on: https://gerrit.libreoffice.org/51964
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index b132c43684c2..d238bdbd300d 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -186,10 +186,12 @@ void SAL_CALL 
ScriptProtocolHandler::dispatchWithNotification(
int argCount = 0;
for ( int index = 0; index < lArgs.getLength(); index++ )
{
-   // Sometimes we get a propertyval with name = "Referer"
-   // this is not an argument to be passed to script, so
-   // ignore.
-   if ( lArgs[ index ].Name != "Referer" ||
+   // Sometimes we get a propertyval with name = "Referer" or 
"SynchronMode". These
+   // are not actual arguments to be passed to script, but 
flags describing the
+   // call, so ignore. Who thought that passing such 
"meta-arguments" mixed in with
+   // real arguments was a good idea?
+   if ( (lArgs[ index ].Name != "Referer" &&
+ lArgs[ index ].Name != "SynchronMode") ||
 lArgs[ index ].Name.isEmpty() ) //TODO:???
{
inArgs.realloc( ++argCount );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-27 Thread Tor Lillqvist
 scripting/source/pyprov/pythonscript.py |5 -
 1 file changed, 5 deletions(-)

New commits:
commit e25b905106598578449d5b2864654d0f58c3147f
Author: Tor Lillqvist 
Date:   Fri Jan 12 15:27:01 2018 +0200

Bin some dead code

We defined the same function member in the class PythonScriptProvider
twice. The first one was some accidental leftover surely.

Change-Id: I10eebab7084af790a9263176f01f7817fa5124ff
Reviewed-on: https://gerrit.libreoffice.org/51965
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 4803d0bebc23..e97784ce7025 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -980,11 +980,6 @@ class PythonScriptProvider( unohelper.Base, XBrowseNode, 
XScriptProvider, XNameC
 def getType( self ):
 return self.dirBrowseNode.getType()
 
-def getScript( self, uri ):
-log.debug( "DirBrowseNode getScript " + uri + " invoked" )
-
-raise IllegalArgumentException( "DirBrowseNode couldn't instantiate 
script " + uri , self , 0 )
-
 def getScript( self, scriptUri ):
 try:
 log.debug( "getScript " + scriptUri + " invoked")
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-27 Thread Tor Lillqvist
 scripting/source/protocolhandler/scripthandler.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7e16966d517f1c25e673ddbb88e72cf418f5aeaa
Author: Tor Lillqvist 
Date:   Fri Jan 12 13:34:26 2018 +0200

Add a separator between two words in an exception message

Change-Id: I5c2e01249058e03edfcf036036f9595b87f0a070
Reviewed-on: https://gerrit.libreoffice.org/51963
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index b4313df5b8fb..b132c43684c2 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -240,7 +240,7 @@ void SAL_CALL 
ScriptProtocolHandler::dispatchWithNotification(
 
 OUString reason = "ScriptProtocolHandler::dispatch: caught ";
 
-invokeResult <<= reason.concat( aException.getValueTypeName() 
).concat( e.Message );
+invokeResult <<= reason.concat( aException.getValueTypeName() 
).concat( ": " ).concat( e.Message );
 
 bCaughtException = true;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-01-29 Thread Justin Luth
 scripting/source/pyprov/mailmerge.py |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 036b51dbc49b533d1db773d8627d56ab86bca487
Author: Justin Luth 
Date:   Thu Jan 18 12:30:58 2018 +0300

tdf#63388: use SMTP_SSL for port 465

Thanks to Jurassic Pork and prrychr (tdf#99363) for the 2016 patch.
I used smtp.gmail.com as my testing server.

Port 587 is the "official" port to use for encrypted email.
I confirmed that 587 CANNOT use SMTP_SSL [SSL: UNKNOWN_PROTOCOL],
so I limited SMTP_SSL use to common TLS port 465 only.

Port 465 was temporarily recommended, but OFFICIALLY has long
since been abandoned. However, LOTS of documentation and ISPs still
recommend it as the port to use. I confirmed that 465 DOES NOT
support STARTTLS, so it is specifically excluded.

So, technically the button should say use STARTTLS instead of SSL,
but only for SMTP. IMAP/POP do use SSL, so terminology gets
rather confusing. This patch forces SSL without STARTTLS for port 465
regardless of the "use SSL" setting due to all the confusion.

Currently we don't support ANY SSL/TLS connections. With this patch
we now at least support the extremely common use case of port 465.

Change-Id: I210cc307491157c1121cfffd70cbb94347ee2856
Reviewed-on: https://gerrit.libreoffice.org/48210
Tested-by: Jenkins 
Reviewed-by: Justin Luth 

diff --git a/scripting/source/pyprov/mailmerge.py 
b/scripting/source/pyprov/mailmerge.py
index ca18c7b17227..079744007816 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -104,7 +104,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
tout = _GLOBAL_DEFAULT_TIMEOUT
if dbg:
print("Timeout: " + str(tout), file=dbgout)
-   self.server = smtplib.SMTP(server, port,timeout=tout)
+   if port == 465:
+   self.server = smtplib.SMTP_SSL(server, 
port,timeout=tout)
+   else:
+   self.server = smtplib.SMTP(server, port,timeout=tout)
 
#stderr not available for us under windows, but
#set_debuglevel outputs there, and so throw
@@ -116,7 +119,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
connectiontype = 
xConnectionContext.getValueByName("ConnectionType")
if dbg:
print("ConnectionType: " + connectiontype, file=dbgout)
-   if connectiontype.upper() == 'SSL':
+   if connectiontype.upper() == 'SSL' and port != 465:
self.server.ehlo()
self.server.starttls()
self.server.ehlo()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-30 Thread Xisco Fauli
 scripting/source/pyprov/mailmerge.py |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 55ad93f29b1be106a7b475f92202ece3589584d8
Author: Xisco Fauli 
Date:   Mon Oct 30 11:13:06 2017 +0100

mailmerge.py: Use strip in server name

Using spaces in the dialog might lead to  incorrect server name
Change-Id: I29a1ffa867d2e415338accf98bb45c7d65b14fa2
Reviewed-on: https://gerrit.libreoffice.org/44052
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/scripting/source/pyprov/mailmerge.py 
b/scripting/source/pyprov/mailmerge.py
index 235472b2a85d..6034a74f1b03 100644
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -91,7 +91,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
self.connectioncontext = xConnectionContext
if dbg:
print("PyMailSMTPService connect", file=dbgout)
-   server = xConnectionContext.getValueByName("ServerName")
+   server = xConnectionContext.getValueByName("ServerName").strip()
if dbg:
print("ServerName: " + server, file=dbgout)
port = int(xConnectionContext.getValueByName("Port"))
@@ -405,7 +405,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
print("Timeout: " + str(tout), file=dbgout)
self.server = poplib.POP3(server, port, timeout=tout)
print("AFTER", file=dbgout)
-   
+
user = xAuthenticator.getUserName()
password = xAuthenticator.getPassword()
if sys.version < '3': # fdo#59249 i#105669 Python 2 needs 
"ascii"
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-12 Thread Werner Tietz
 scripting/source/pyprov/pythonscript.py |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 7ef47336411389ac492729bef52fe62aebe90f5a
Author: Werner Tietz 
Date:   Tue Apr 11 01:51:11 2017 +0200

tdf#92007 python scripts with tuple-assignments fails on access from GUI

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

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 406693266f45..4803d0bebc23 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -405,7 +405,12 @@ class ProviderContext:
 allFuncs.append(node.name)
 elif isinstance(node, ast.Assign):
 for target in node.targets:
-if target.id == "g_exportedScripts":
+try:
+identifier = target.id
+except AttributeError:
+identifier = ""
+pass
+if identifier == "g_exportedScripts":
 for value in node.value.elts:
 g_exportedScripts.append(value.id)
 return g_exportedScripts
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-27 Thread Stephan Bergmann
 scripting/source/provider/ScriptImpl.cxx |   99 -
 scripting/source/provider/ScriptImpl.hxx |  103 ---
 2 files changed, 202 deletions(-)

New commits:
commit 12ffd3ecdd8c138a478d1665d01969639b3914f6
Author: Stephan Bergmann 
Date:   Fri Jan 27 12:03:48 2017 +0100

Remove dead code

...dead ever since its introduction in 
d86602573305ac7c8583794a37c4bd0572b41577
"#i17307#: XFunction->XScript etc"

Change-Id: I664ff15ec2e9fda000bae7740ced427a646ddc92

diff --git a/scripting/source/provider/ScriptImpl.cxx 
b/scripting/source/provider/ScriptImpl.cxx
deleted file mode 100644
index b3cb96f..000
--- a/scripting/source/provider/ScriptImpl.cxx
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- 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 file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include "ScriptImpl.hxx"
-#include "sal/log.hxx"
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::script::framework;
-
-namespace func_provider
-{
-
-
-ScriptImpl::ScriptImpl(
-const Reference< beans::XPropertySet > & scriptingContext,
-const Reference< runtime::XScriptInvocation > & runtimeMgr,
-const OUString& scriptURI )
-throw ( RuntimeException ) :
-m_XScriptingContext( scriptingContext, UNO_SET_THROW ),
-m_RunTimeManager( runtimeMgr, UNO_SET_THROW ),
-m_ScriptURI( scriptURI )
-{
-SAL_INFO("scripting.provider", "" );
-}
-
-
-ScriptImpl::~ScriptImpl()
-{
-SAL_INFO("scripting.provider", "" );
-}
-
-
-Any SAL_CALL
-ScriptImpl::invoke( const Sequence< Any >& aParams,
-  Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& 
aOutParam )
-throw ( lang::IllegalArgumentException, script::CannotConvertException,
-reflection::InvocationTargetException, RuntimeException )
-{
-SAL_INFO("scripting.provider", "" );
-Any result;
-Any anyScriptingContext;
-
-anyScriptingContext <<= m_XScriptingContext;
-try
-{
-result = m_RunTimeManager->invoke( m_ScriptURI, anyScriptingContext, 
aParams,
-   aOutParamIndex, aOutParam );
-}
-catch ( const lang::IllegalArgumentException & iae )
-{
-OUString temp = "ScriptImpl::invoke IllegalArgumentException : ";
-throw lang::IllegalArgumentException( temp.concat( iae.Message ),
-  Reference< XInterface > (),
-  iae.ArgumentPosition );
-}
-catch ( const script::CannotConvertException & cce )
-{
-OUString temp = "ScriptImpl::invoke CannotConvertException : ";
-throw script::CannotConvertException( temp.concat( cce.Message ),
-  Reference< XInterface > (),
-  cce.DestinationTypeClass,
-  cce.Reason,
-  cce.ArgumentIndex );
-}
-catch ( const reflection::InvocationTargetException & ite )
-{
-OUString temp = "ScriptImpl::invoke InvocationTargetException : ";
-throw reflection::InvocationTargetException( temp.concat( ite.Message 
),
-Reference< XInterface > (),
-ite.TargetException );
-}
-catch ( const RuntimeException & re )
-{
-OUString temp = "ScriptImpl::invoke RuntimeException : ";
-throw RuntimeException( temp.concat( re.Message ) );
-}
-return result;
-}
-} // namespace func_provider
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/provider/ScriptImpl.hxx 
b/scripting/source/provider/ScriptImpl.hxx
deleted file mode 100644
index 773ee22..000
--- a/scripting/source/provider/ScriptImpl.hxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- 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 

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

2016-12-12 Thread Noel Grandin
 sc/source/core/data/document.cxx|8 +++---
 sc/source/core/tool/interpr1.cxx|2 -
 sc/source/core/tool/scmatrix.cxx|2 -
 sc/source/core/tool/token.cxx   |2 -
 sc/source/filter/excel/read.cxx |8 --
 sc/source/filter/excel/xeescher.cxx |2 -
 sc/source/filter/excel/xiescher.cxx |   20 ++-
 sc/source/filter/excel/xipivot.cxx  |2 -
 sc/source/filter/excel/xistream.cxx |2 -
 sc/source/filter/excel/xlpivot.cxx  |2 -
 sc/source/filter/excel/xlstyle.cxx  |4 +--
 sc/source/filter/excel/xltoolbar.cxx|3 --
 sc/source/filter/excel/xltools.cxx  |4 +--
 sc/source/filter/xcl97/xcl97esc.cxx |4 +--
 sc/source/ui/docshell/macromgr.cxx  |1 
 sc/source/ui/drawfunc/fusel.cxx |1 
 sc/source/ui/unoobj/docuno.cxx  |4 +--
 sc/source/ui/unoobj/servuno.cxx |4 ---
 sc/source/ui/unoobj/tokenuno.cxx|2 -
 sc/source/ui/vba/vbaapplication.cxx |3 --
 sc/source/ui/vba/vbachartobjects.cxx|2 -
 sc/source/ui/vba/vbaeventshelper.cxx|2 -
 sc/source/ui/vba/vbaglobals.cxx |   19 ++
 sc/source/ui/vba/vbahelper.cxx  |6 ++--
 sc/source/ui/vba/vbaoleobject.cxx   |2 -
 sc/source/ui/vba/vbarange.cxx   |6 
 sc/source/ui/vba/vbaworkbooks.cxx   |1 
 sc/source/ui/vba/vbaworksheet.cxx   |7 +
 sc/source/ui/vba/vbawsfunction.cxx  |1 
 scripting/source/basprov/basprov.cxx|4 ---
 scripting/source/protocolhandler/scripthandler.cxx  |   15 ---
 scripting/source/provider/BrowseNodeFactoryImpl.cxx |3 --
 scripting/source/provider/MasterScriptProvider.cxx  |7 +
 scripting/source/provider/ProviderCache.cxx |2 -
 scripting/source/provider/URIHelper.cxx |6 ++--
 scripting/source/vbaevents/eventhelper.cxx  |   26 ++--
 36 files changed, 60 insertions(+), 129 deletions(-)

New commits:
commit 81f2a9f46451492d4d879573bc9ac7f2e44abedb
Author: Noel Grandin 
Date:   Mon Dec 12 13:33:14 2016 +0200

OSL_TRACE->SAL in sc..scripting

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

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 429eff0..da23524 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -238,7 +238,7 @@ bool ScDocument::SetCodeName( SCTAB nTab, const OUString& 
rName )
 return true;
 }
 }
-OSL_TRACE( " can't set code name %s", OUStringToOString( rName, 
RTL_TEXTENCODING_UTF8 ).getStr() );
+SAL_WARN("sc",  "can't set code name " << rName );
 return false;
 }
 
@@ -2147,7 +2147,7 @@ void ScDocument::CopyToClip(const ScClipParam& rClipParam,
 
 if (!pClipDoc)
 {
-OSL_TRACE("CopyToClip: no ClipDoc");
+SAL_WARN("sc", "CopyToClip: no ClipDoc");
 pClipDoc = ScModule::GetClipDoc();
 }
 
@@ -2247,7 +2247,7 @@ void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
 {
 if (!pClipDoc)
 {
-OSL_TRACE("CopyTabToClip: no ClipDoc");
+SAL_WARN("sc", "CopyTabToClip: no ClipDoc");
 pClipDoc = ScModule::GetClipDoc();
 }
 
@@ -2355,7 +2355,7 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, 
InsertDeleteFlags nFlags
 }
 else
 {
-OSL_TRACE("TransposeClip: Too big");
+SAL_WARN("sc", "TransposeClip: Too big");
 }
 
 // This happens only when inserting...
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index eec366d..7fe7b81 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1030,7 +1030,7 @@ sc::RangeMatrix ScInterpreter::CompareMat( ScQueryOp eOp, 
sc::CompareOptions* pO
 aRes.mpMat->CompareNotEqual();
 break;
 default:
-OSL_TRACE( "ScInterpreter::QueryMat: unhandled comparison 
operator: %d", (int)eOp);
+SAL_WARN("sc",  "ScInterpreter::QueryMat: unhandled comparison 
operator: " << (int)eOp);
 aRes.mpMat.reset();
 return aRes;
 }
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 273a5fb..8ed28f4 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx

[Libreoffice-commits] core.git: scripting/source sd/source sfx2/source stoc/source svl/source svtools/source

2016-08-25 Thread Gökhan Gurbetoğlu
 scripting/source/dlgprov/dlgprov.cxx  |6 +
 sd/source/filter/eppt/pptexanimations.cxx |   28 +++
 sfx2/source/dialog/templdlg.cxx   |4 +--
 stoc/source/javavm/javavm.cxx |   36 +++---
 svl/source/config/itemholder2.cxx |8 +++---
 svtools/source/config/colorcfg.cxx|   11 -
 svtools/source/config/extcolorcfg.cxx |   29 ++--
 svtools/source/config/itemholder2.cxx |8 +++---
 8 files changed, 58 insertions(+), 72 deletions(-)

New commits:
commit b7bf1ba2136b3d1e031673e7b541c6181e95ff61
Author: Gökhan Gurbetoğlu 
Date:   Wed Aug 24 17:41:12 2016 +0300

tdf#100726 - Improve readability of OUString concatanations

Improved readability of OUString concatanations. Also removed unused
OUStrings "sColor" and "sEntry" from the code.

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

diff --git a/scripting/source/dlgprov/dlgprov.cxx 
b/scripting/source/dlgprov/dlgprov.cxx
index 30d8b23..4adfd13 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -280,10 +280,8 @@ static const char aResourceResolverPropName[] = 
"ResourceResolver";
 uriRef.set( xFac->parse( aURL ), UNO_QUERY );
 if ( !uriRef.is() )
 {
-OUString errorMsg("DialogProviderImpl::getDialogModel: failed 
to parse URI: ");
-errorMsg += aURL;
-throw IllegalArgumentException( errorMsg,
-Reference< XInterface >(), 1 );
+OUString errorMsg = "DialogProviderImpl::getDialogModel: 
failed to parse URI: " + aURL;
+throw IllegalArgumentException( errorMsg, Reference< 
XInterface >(), 1 );
 }
 Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY );
 if( !sxUri.is() )
diff --git a/sd/source/filter/eppt/pptexanimations.cxx 
b/sd/source/filter/eppt/pptexanimations.cxx
index 4a839c2..adf8661 100644
--- a/sd/source/filter/eppt/pptexanimations.cxx
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -1429,23 +1429,23 @@ Any AnimationExporter::convertAnimateValue( const Any& 
rSourceValue, const OUStr
 OUString aP( "," );
 if ( rSourceValue >>= aHSL )
 {
-aDest += "hsl(";
-aDest += OUString::number( (sal_Int32)( aHSL[ 0 ] / ( 360.0 / 255 
) ) );
-aDest += aP;
-aDest += OUString::number( (sal_Int32)( aHSL[ 1 ] * 255.0 ) );
-aDest += aP;
-aDest += OUString::number( (sal_Int32)( aHSL[ 2 ] * 255.0 ) );
-aDest += ")";
+aDest += "hsl("
+  +  OUString::number( (sal_Int32)( aHSL[ 0 ] / ( 360.0 / 255 
) ) )
+  +  aP
+  +  OUString::number( (sal_Int32)( aHSL[ 1 ] * 255.0 ) )
+  +  aP
+  +  OUString::number( (sal_Int32)( aHSL[ 2 ] * 255.0 ) )
+  +  ")";
 }
 else if ( rSourceValue >>= nColor )
 {
-aDest += "rgb(";
-aDest += OUString::number( ( (sal_Int8)nColor ) );
-aDest += aP;
-aDest += OUString::number( ( (sal_Int8)( nColor >> 8 ) ) );
-aDest += aP;
-aDest += OUString::number( ( (sal_Int8)( nColor >> 16 ) ) );
-aDest += ")";
+aDest += "rgb("
+  +  OUString::number( ( (sal_Int8)nColor ) )
+  +  aP
+  +  OUString::number( ( (sal_Int8)( nColor >> 8 ) ) )
+  +  aP
+  +  OUString::number( ( (sal_Int8)( nColor >> 16 ) ) )
+  +  ")";
 }
 }
 else if ( rAttributeName == "FillStyle" )
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 4096986..8e0d421 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1912,8 +1912,8 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl()
 SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : 
aFmtLb->FirstSelected();
 const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl();
 
-OUString aMsg = SfxResId(STR_DELETE_STYLE_USED).toString();
-aMsg += SfxResId(STR_DELETE_STYLE).toString();
+OUString aMsg = SfxResId(STR_DELETE_STYLE_USED).toString()
+  + SfxResId(STR_DELETE_STYLE).toString();
 
 while (pEntry)
 {
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index e37023b..dcba929 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -286,14 +286,12 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm,
 // read ftp proxy 

[Libreoffice-commits] core.git: scripting/source testtools/source

2016-08-09 Thread Caolán McNamara
 scripting/source/pyprov/pythonscript.py   |5 ++---
 testtools/source/bridgetest/pyuno/core.py |8 
 2 files changed, 6 insertions(+), 7 deletions(-)

New commits:
commit adb9cbff1f6c380bfae85e7dd96ff6cff22ffbe9
Author: Caolán McNamara 
Date:   Tue Aug 9 15:32:05 2016 +0100

python macros aren't listed under scripting organize

since...

commit deb989dd6d1f86e74864131be50ed92d8d43768c
Author: Kenneth Koski 
Date:   Mon Feb 29 22:22:10 2016 -0600

blew away the uno.ByteSequence(str) path

Change-Id: I8b73883c4f246ebafd2f810ca61b19da40f833e2

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index a2fc4f0..e4d6a2e 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -153,7 +153,7 @@ g_implName = 
"org.libreoffice.pyuno.LanguageScriptProviderFor"+LANGUAGENAME
 BLOCK_SIZE = 65536
 def readTextFromStream( inputStream ):
 # read the file
-code = uno.ByteSequence( "" )
+code = uno.ByteSequence( b"" )
 while True:
 read,out = inputStream.readBytes( None , BLOCK_SIZE )
 code = code + out
@@ -549,9 +549,8 @@ class ScriptBrowseNode( unohelper.Base, XBrowseNode , 
XPropertySet, XInvocation,
 
 elif event.ActionCommand == "Save":
 toWrite = uno.ByteSequence(
-str(
 self.editor.getControl("EditorTextField").getText().encode(
-sys.getdefaultencoding())) )
+sys.getdefaultencoding()) )
 copyUrl = self.uri + ".orig"
 self.provCtx.sfa.move( self.uri, copyUrl )
 out = self.provCtx.sfa.openFileWrite( self.uri )
diff --git a/testtools/source/bridgetest/pyuno/core.py 
b/testtools/source/bridgetest/pyuno/core.py
index b45e10f..c56e9f1 100644
--- a/testtools/source/bridgetest/pyuno/core.py
+++ b/testtools/source/bridgetest/pyuno/core.py
@@ -336,10 +336,10 @@ class TestCase( unittest.TestCase):
   self.failUnlessRaises( (RuntimeException), uno.getConstantByName, 
"com.sun.star.uno.XInterface" )
 
   def testByteSequence( self ):
-  s = uno.ByteSequence( "ab" )
-  self.failUnless( s == uno.ByteSequence( "ab" ) )
-  self.failUnless( uno.ByteSequence( "abc" ) == s + uno.ByteSequence( 
"c" ) )
-  self.failUnless( uno.ByteSequence( "abc" ) == s + "c" )
+  s = uno.ByteSequence( b"ab" )
+  self.failUnless( s == uno.ByteSequence( b"ab" ) )
+  self.failUnless( uno.ByteSequence( b"abc" ) == s + uno.ByteSequence( 
b"c" ) )
+  self.failUnless( uno.ByteSequence( b"abc" ) == s + "c" )
   self.failUnless( s + "c"  == "abc" )
   self.failUnless( s == uno.ByteSequence( s ) )
   self.failUnless( s[0] == 'a' )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-08-01 Thread Noel Grandin
 scripting/source/vbaevents/eventhelper.cxx |   51 ++---
 1 file changed, 4 insertions(+), 47 deletions(-)

New commits:
commit 192365319df0982a73d105af0cc1000a95cb3e42
Author: Noel Grandin 
Date:   Mon Aug 1 09:59:30 2016 +0200

remove dead ASYNC code

introduced in
   commit 0b21b8b146fc4b982c7c9bbb866b9ff18a29332a
   Author: Noel Power 
   Date:   Wed Oct 6 10:16:27 2010 +0100
   initial commit for vba blob

and never activated or touched since then

Change-Id: I34f9a5f702dd8f2254aa1efb94de61569220b90c

diff --git a/scripting/source/vbaevents/eventhelper.cxx 
b/scripting/source/vbaevents/eventhelper.cxx
index 675f85b..0a35f1c 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -76,15 +76,6 @@
 #include 
 #include 
 
-#define ASYNC 0
-
-// primitive support for asynchronous handling of
-// events from controls ( all event will be processed asynchronously
-// in the application thread )
-#if ASYNC
-#include 
-#endif
-
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::script;
 using namespace ::com::sun::star::uno;
@@ -188,9 +179,10 @@ struct TranslateInfo
 };
 
 
-typedef std::unordered_map< OUString,
-std::list< TranslateInfo >,
-OUStringHash > EventInfoHash;
+typedef std::unordered_map<
+OUString,
+std::list< TranslateInfo >,
+OUStringHash > EventInfoHash;
 
 
 struct TranslatePropMap
@@ -551,7 +543,6 @@ class EventListener : public EventListener_BASE
 ,public ::comphelper::OMutexAndBroadcastHelper
 ,public ::comphelper::OPropertyContainer
 ,public ::comphelper::OPropertyArrayUsageHelper< EventListener >
-
 {
 
 public:
@@ -628,9 +619,6 @@ protected:
 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(  ) const override;
 
 private:
-#if ASYNC
-DECL_LINK( OnAsyncScriptEvent, ScriptEvent* );
-#endif
 void setShellFromModel();
 void firing_Impl( const  ScriptEvent& evt, Any *pSyncRet=nullptr ) throw( 
RuntimeException, std::exception );
 
@@ -684,40 +672,9 @@ EventListener::disposing(const lang::EventObject&)  throw( 
RuntimeException, std
 void SAL_CALL
 EventListener::firing(const ScriptEvent& evt) throw(RuntimeException, 
std::exception)
 {
-#if ASYNC
-// needs some logic to check if the event handler is oneway or not
-// if not oneway then firing_Impl otherwise... as below
-acquire();
-Application::PostUserEvent( LINK( this, EventListener, OnAsyncScriptEvent 
),
-new ScriptEvent( evt ) );
-#else
 firing_Impl( evt );
-#endif
 }
 
-#if ASYNC
-IMPL_LINK( EventListener, OnAsyncScriptEvent, ScriptEvent*, _pEvent )
-{
-if ( !_pEvent )
-return 1L;
-
-{
-// #FIXME if we enable ASYNC we probably need something like
-// below
-//::osl::ClearableMutexGuard aGuard( m_aMutex );
-
-//if ( !impl_isDisposed_nothrow() )
-//  impl_doFireScriptEvent_nothrow( aGuard, *_pEvent, NULL );
-firing_Impl( *_pEvent, NULL );
-}
-
-delete _pEvent;
-// we acquired ourself immediately before posting the event
-release();
-return 0L;
- }
-#endif
-
 Any SAL_CALL
 EventListener::approveFiring(const ScriptEvent& evt) 
throw(reflection::InvocationTargetException, RuntimeException, std::exception)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: scripting/source shell/source slideshow/source sot/source starmath/source stoc/source svl/source svtools/source

2016-05-11 Thread Noel Grandin
 scripting/source/provider/BrowseNodeFactoryImpl.cxx  |   12 +--
 shell/source/unix/sysshell/recently_used_file_handler.cxx|6 -
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |4 -
 slideshow/source/engine/animationnodes/basecontainernode.cxx |4 -
 sot/source/base/filelist.cxx |4 -
 sot/source/sdstor/stgelem.cxx|   16 
++---
 sot/source/sdstor/ucbstorage.cxx |   19 
++---
 starmath/source/ElementsDockingWindow.cxx|   23 
+++
 starmath/source/cfgitem.cxx  |   12 +--
 starmath/source/dialog.cxx   |8 +-
 starmath/source/document.cxx |3 
 starmath/source/ooxmlexport.cxx  |4 -
 starmath/source/rtfexport.cxx|4 -
 starmath/source/symbol.cxx   |6 -
 starmath/source/unomodel.cxx |3 
 starmath/source/utility.cxx  |   10 +--
 stoc/source/security/access_controller.cxx   |9 --
 svl/source/items/aeitem.cxx  |4 -
 svl/source/items/itempool.cxx|3 
 svl/source/items/poolcach.cxx|9 +-
 svl/source/items/poolio.cxx  |6 -
 svl/source/misc/sharecontrolfile.cxx |   32 
+-
 svl/source/numbers/zforlist.cxx  |   12 +--
 svl/source/numbers/zformat.cxx   |   14 
++--
 svtools/source/brwbox/brwbox1.cxx|4 -
 svtools/source/brwbox/brwbox2.cxx|   12 +--
 svtools/source/brwbox/datwin.cxx |   14 
++--
 svtools/source/contnr/fileview.cxx   |4 -
 svtools/source/contnr/foldertree.cxx |8 +-
 svtools/source/contnr/imivctl1.cxx   |3 
 svtools/source/contnr/treelist.cxx   |4 -
 svtools/source/contnr/treelistbox.cxx|4 -
 svtools/source/control/autocmpledit.cxx  |6 -
 svtools/source/control/ctrlbox.cxx   |   15 
+---
 svtools/source/control/headbar.cxx   |   11 +--
 svtools/source/control/ruler.cxx |   12 +--
 svtools/source/control/tabbar.cxx|   27 
+++-
 svtools/source/control/valueset.cxx  |3 
 svtools/source/dialogs/insdlg.cxx|   12 +--
 svtools/source/graphic/grfmgr2.cxx   |4 -
 svtools/source/hatchwindow/ipwin.cxx |8 +-
 svtools/source/misc/imap.cxx |   10 +--
 svtools/source/misc/transfer.cxx |4 -
 svtools/source/uno/framestatuslistener.cxx   |3 
 svtools/source/uno/statusbarcontroller.cxx   |3 
 svtools/source/uno/toolboxcontroller.cxx |3 
 46 files changed, 186 insertions(+), 215 deletions(-)

New commits:
commit 265068d65b39688b8a4756dfbcd46453dd1f9b70
Author: Noel Grandin 
Date:   Tue May 10 14:39:07 2016 +0200

clang-tidy modernize-loop-convert in scripting to svtools

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

diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx 
b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index cc63505..863860e 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -91,12 +91,12 @@ public:
 
 sal_Int32 numChildren = 0;
 
-for ( size_t i = 0; i < m_Nodes.size(); i++ )
+for (Reference & xNode : m_Nodes)
 {
 Sequence< Reference < browse::XBrowseNode > > children;
 try
 {
-children = m_Nodes[ i ]->getChildNodes();
+children = xNode->getChildNodes();
 seqs.push_back( children );
 numChildren += children.getLength();
 }
@@ -128,11 +128,11 @@ public:
 {
 if ( 

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

2016-04-24 Thread Arnaud Versini
 scripting/source/basprov/basprov.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 6bcb322264d5ad82071123de16669f47f6454b61
Author: Arnaud Versini 
Date:   Sun Apr 24 21:38:21 2016 +0200

Don't use SolarMutexGuard for returning a constant

Change-Id: Ia6e31d7fe9d90f8094e2043de29a896c9e840c53
Reviewed-on: https://gerrit.libreoffice.org/24347
Reviewed-by: Markus Mohrhard 
Tested-by: Markus Mohrhard 

diff --git a/scripting/source/basprov/basprov.cxx 
b/scripting/source/basprov/basprov.cxx
index 20f6a99..6e3fd49 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -486,8 +486,6 @@ namespace basprov
 
 sal_Int16 BasicProviderImpl::getType(  ) throw (RuntimeException, 
std::exception)
 {
-SolarMutexGuard aGuard;
-
 return browse::BrowseNodeTypes::CONTAINER;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-02 Thread Stephan Bergmann
 scripting/source/provider/ScriptImpl.cxx |7 ---
 1 file changed, 7 deletions(-)

New commits:
commit 6ccf68622e51c1b727dd042c1c1a71b5d1fd6a12
Author: Stephan Bergmann 
Date:   Mon Nov 2 23:30:58 2015 +0100

No need for this debug code

Change-Id: I05a6d15a0c54ca5457d662c2467cb15c14991a0a

diff --git a/scripting/source/provider/ScriptImpl.cxx 
b/scripting/source/provider/ScriptImpl.cxx
index 0741590..5fa3d5e 100644
--- a/scripting/source/provider/ScriptImpl.cxx
+++ b/scripting/source/provider/ScriptImpl.cxx
@@ -92,13 +92,6 @@ throw ( lang::IllegalArgumentException, 
script::CannotConvertException,
 OUString temp = "ScriptImpl::invoke RuntimeException : ";
 throw RuntimeException( temp.concat( re.Message ) );
 }
-#ifdef _DEBUG
-catch ( ... )
-{
-throw RuntimeException(
-"ScriptImpl::invoke Unknown Exception caught - RuntimeException 
rethrown" );
-}
-#endif
 return result;
 }
 } // namespace func_provider
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-09-30 Thread Andrea Gelmini
 scripting/source/pyprov/pythonscript.py |  143 
 1 file changed, 72 insertions(+), 71 deletions(-)

New commits:
commit 0e5318aa75b615b35a3d07172bdeb26eb5acfdd9
Author: Andrea Gelmini 
Date:   Tue Sep 22 11:35:52 2015 +0200

Script: better way to detect Windows

Change-Id: I0e99443f3715cde4414d14b2fa507ecab0995c6d
Reviewed-on: https://gerrit.libreoffice.org/18937
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 03f0cde..c62c228 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -23,6 +23,7 @@ import os
 import imp
 import time
 import ast
+import platform
 
 try:
 unicode
@@ -82,18 +83,18 @@ def getLogTarget():
 except:
 print("Exception during creation of pythonscript logfile: "+ 
lastException2String() + "\n, delagating log to stdout\n")
 return ret
-  
+
 class Logger(LogLevel):
 def __init__(self , target ):
 self.target = target
 
 def isDebugLevel( self ):
 return self.use >= self.DEBUG
-
+
 def debug( self, msg ):
 if self.isDebugLevel():
 self.log( self.DEBUG, msg )
-
+
 def isErrorLevel( self ):
 return self.use >= self.ERROR
 
@@ -159,12 +160,12 @@ def readTextFromStream( inputStream ):
 if read < BLOCK_SIZE:
break
 return code.value
-
+
 def toIniName( str ):
-# TODO: what is the official way to get to know whether i am on the 
windows platform ?
-if( hasattr(sys , "dllhandle") ):
+if platform.system() == "Windows":
 return str + ".ini"
-return str + "rc"
+else:
+return str + "rc"
 
 
 """ definition: storageURI is the system dependent, absolute file url, where 
the script is stored on disk
@@ -177,7 +178,7 @@ class MyUriHelper:
 { "share" : 
"vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/Scripts/python" , \
   "share:uno_packages" : 
"vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE/uno_packages", \
   "user" : "vnd.sun.star.expand:${$BRAND_INI_DIR/" + toIniName( 
"bootstrap") + "::UserInstallation}/user/Scripts/python" , \
-  "user:uno_packages" : 
"vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/uno_packages" } 
+  "user:uno_packages" : 
"vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/uno_packages" }
 self.m_uriRefFac = 
ctx.ServiceManager.createInstanceWithContext("com.sun.star.uri.UriReferenceFactory",ctx)
 if location.startswith( "vnd.sun.star.tdoc" ):
 self.m_baseUri = location + "/Scripts/python"
@@ -186,10 +187,10 @@ class MyUriHelper:
 self.m_baseUri = expandUri( self.s_UriMap[location] )
 self.m_scriptUriLocation = location
 log.debug( "initialized urihelper with baseUri="+self.m_baseUri + 
",m_scriptUriLocation="+self.m_scriptUriLocation )
-
+
 def getRootStorageURI( self ):
 return self.m_baseUri
-
+
 def getStorageURI( self, scriptURI ):
 return self.scriptURI2StorageUri(scriptURI)
 
@@ -207,7 +208,7 @@ class MyUriHelper:
   "?language=" + LANGUAGENAME + "=" + 
self.m_scriptUriLocation
 log.debug( "converting storageURI="+storageURI + " to scriptURI=" + 
ret )
 return ret
-
+
 def scriptURI2StorageUri( self, scriptURI ):
 try:
 myUri = self.m_uriRefFac.parse(scriptURI)
@@ -220,7 +221,7 @@ class MyUriHelper:
 except Exception as e:
 log.error( "error during converting scriptURI="+scriptURI + ": " + 
str(e))
 raise RuntimeException( "pythonscript:scriptURI2StorageUri: " + 
str(e), None )
-
+
 
 class ModuleEntry:
 def __init__( self, lastRead, module ):
@@ -256,14 +257,14 @@ def checkForPythonPathBesideScript( url ):
 if 1 == os.access( encfile(path), os.F_OK) and not path in sys.path:
 log.log( LogLevel.DEBUG, "adding " + path + " to sys.path" )
 sys.path.append( path )
-
-
+
+
 class ScriptContext(unohelper.Base):
 def __init__( self, ctx, doc, inv ):
 self.ctx = ctx
 self.doc = doc
 self.inv = inv
-   
+
# XScriptContext
 def getDocument(self):
 if self.doc:
@@ -296,12 +297,12 @@ class ScriptContext(unohelper.Base):
 #log.debug("file " + url + " has changed, reloading")
 #else:
 #load = False
-#
+#
 #if load:
 #log.debug( "opening >" + url + "<" )
 #
 #code = readTextFromStream( sfa.openFileRead( url ) )
-
+
 # execute the module
 #entry = ModuleEntry( lastRead, imp.new_module("ooo_script_framework") 
)
 #entry.module.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = g_scriptContext
@@ -324,13 +325,13 @@ class ProviderContext:
 

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

2015-09-03 Thread Takeshi Abe
 scripting/source/basprov/baslibnode.hxx   |4 ++--
 scripting/source/basprov/basmethnode.hxx  |4 ++--
 scripting/source/basprov/basmodnode.hxx   |4 ++--
 scripting/source/basprov/basprov.hxx  |4 ++--
 scripting/source/basprov/basscript.hxx|4 ++--
 scripting/source/dlgprov/DialogModelProvider.hxx  |4 ++--
 scripting/source/dlgprov/dlgevtatt.hxx|8 
 scripting/source/dlgprov/dlgprov.hxx  |4 ++--
 scripting/source/protocolhandler/scripthandler.hxx|4 ++--
 scripting/source/provider/ActiveMSPList.cxx   |1 -
 scripting/source/provider/ActiveMSPList.hxx   |4 ++--
 scripting/source/provider/BrowseNodeFactoryImpl.cxx   |   12 ++--
 scripting/source/provider/BrowseNodeFactoryImpl.hxx   |4 ++--
 scripting/source/provider/MasterScriptProvider.hxx|4 ++--
 scripting/source/provider/MasterScriptProviderFactory.cxx |1 -
 scripting/source/provider/MasterScriptProviderFactory.hxx |4 ++--
 scripting/source/provider/ProviderCache.hxx   |1 -
 scripting/source/provider/ScriptImpl.hxx  |4 ++--
 scripting/source/provider/URIHelper.hxx   |4 ++--
 scripting/source/stringresource/stringresource.hxx|   11 +--
 20 files changed, 43 insertions(+), 47 deletions(-)

New commits:
commit f3c7e6953675f4ed85a5212a6af3ee189400f34e
Author: Takeshi Abe 
Date:   Sat Aug 29 07:48:41 2015 +0900

scripting: tdf#88206 replace cppu::WeakImplHelper* etc.

with the variadic variants.

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

diff --git a/scripting/source/basprov/baslibnode.hxx 
b/scripting/source/basprov/baslibnode.hxx
index 5b13c27..43fa4ca 100644
--- a/scripting/source/basprov/baslibnode.hxx
+++ b/scripting/source/basprov/baslibnode.hxx
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 class BasicManager;
 
@@ -38,7 +38,7 @@ namespace basprov
 //  class BasicLibraryNodeImpl
 
 
-typedef ::cppu::WeakImplHelper1<
+typedef ::cppu::WeakImplHelper<
 ::com::sun::star::script::browse::XBrowseNode > 
BasicLibraryNodeImpl_BASE;
 
 
diff --git a/scripting/source/basprov/basmethnode.hxx 
b/scripting/source/basprov/basmethnode.hxx
index ae45a30..24631eb 100644
--- a/scripting/source/basprov/basmethnode.hxx
+++ b/scripting/source/basprov/basmethnode.hxx
@@ -28,7 +28,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 
 class SbMethod;
@@ -43,7 +43,7 @@ namespace basprov
 //  class BasicMethodNodeImpl
 
 
-typedef ::cppu::WeakImplHelper2<
+typedef ::cppu::WeakImplHelper<
 ::com::sun::star::script::browse::XBrowseNode,
 ::com::sun::star::script::XInvocation > BasicMethodNodeImpl_BASE;
 
diff --git a/scripting/source/basprov/basmodnode.hxx 
b/scripting/source/basprov/basmodnode.hxx
index 6cc8bd5..7efbb69 100644
--- a/scripting/source/basprov/basmodnode.hxx
+++ b/scripting/source/basprov/basmodnode.hxx
@@ -23,7 +23,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 class SbModule;
 
@@ -37,7 +37,7 @@ namespace basprov
 //  class BasicModuleNodeImpl
 
 
-typedef ::cppu::WeakImplHelper1<
+typedef ::cppu::WeakImplHelper<
 ::com::sun::star::script::browse::XBrowseNode > 
BasicModuleNodeImpl_BASE;
 
 
diff --git a/scripting/source/basprov/basprov.hxx 
b/scripting/source/basprov/basprov.hxx
index b798d55..b552d4e 100644
--- a/scripting/source/basprov/basprov.hxx
+++ b/scripting/source/basprov/basprov.hxx
@@ -28,7 +28,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 class BasicManager;
 
@@ -42,7 +42,7 @@ namespace basprov
 //  class BasicProviderImpl
 
 
-typedef ::cppu::WeakImplHelper4<
+typedef ::cppu::WeakImplHelper<
 ::com::sun::star::lang::XServiceInfo,
 ::com::sun::star::lang::XInitialization,
 ::com::sun::star::script::provider::XScriptProvider,
diff --git a/scripting/source/basprov/basscript.hxx 
b/scripting/source/basprov/basscript.hxx
index 203a3f6..0cf87fb 100644
--- a/scripting/source/basprov/basscript.hxx
+++ b/scripting/source/basprov/basscript.hxx
@@ -23,7 +23,7 @@
 #include "bcholder.hxx"
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -40,7 +40,7 @@ namespace basprov
 //  class BasicScriptImpl
 
 
-typedef ::cppu::WeakImplHelper1<
+typedef ::cppu::WeakImplHelper<
 ::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
 
 
diff --git a/scripting/source/dlgprov/DialogModelProvider.hxx 
b/scripting/source/dlgprov/DialogModelProvider.hxx
index ef1f468..c225cd8 100644
--- 

[Libreoffice-commits] core.git: scripting/source sc/source sw/source

2014-08-26 Thread Takeshi Abe
 sc/source/ui/miscdlgs/optsolver.cxx|5 ++---
 scripting/source/protocolhandler/scripthandler.cxx |9 +++--
 sw/source/uibase/shells/textidx.cxx|3 +--
 3 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit 4d32244437475688ca951ce30f8d6fcc59fc1caa
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Tue Aug 26 17:50:33 2014 +0900

Avoid possible memory leaks in case of exceptions

Change-Id: Ib4a87cab2729e18b2c830cbd7e7a34d62b5f0f45

diff --git a/sc/source/ui/miscdlgs/optsolver.cxx 
b/sc/source/ui/miscdlgs/optsolver.cxx
index e42917a..3605065 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -543,14 +543,13 @@ IMPL_LINK( ScOptSolverDlg, BtnHdl, PushButton*, pBtn )
 else if ( pBtn == m_pBtnOpt )
 {
 //! move options dialog to UI lib?
-ScSolverOptionsDialog* pOptDlg =
-new ScSolverOptionsDialog( this, maImplNames, maDescriptions, 
maEngine, maProperties );
+boost::scoped_ptrScSolverOptionsDialog pOptDlg(
+new ScSolverOptionsDialog( this, maImplNames, maDescriptions, 
maEngine, maProperties ));
 if ( pOptDlg-Execute() == RET_OK )
 {
 maEngine = pOptDlg-GetEngine();
 maProperties = pOptDlg-GetProperties();
 }
-delete pOptDlg;
 }
 
 return 0;
diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index b5760b6..e959d3f 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -273,14 +273,11 @@ void SAL_CALL 
ScriptProtocolHandler::dispatchWithNotification(
 
 if ( pFact != NULL )
 {
-VclAbstractDialog* pDlg =
-pFact-CreateScriptErrorDialog( NULL, aException );
+boost::scoped_ptrVclAbstractDialog pDlg(
+pFact-CreateScriptErrorDialog( NULL, aException ));
 
-if ( pDlg != NULL )
-{
+if ( pDlg )
 pDlg-Execute();
-delete pDlg;
-}
 }
}
 
diff --git a/sw/source/uibase/shells/textidx.cxx 
b/sw/source/uibase/shells/textidx.cxx
index 4cbdb61..49c806a 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -84,10 +84,9 @@ void SwTextShell::ExecIdx(SfxRequest rReq)
 {   // Several marks, which should it be?
 SwAbstractDialogFactory* pFact = 
SwAbstractDialogFactory::Create();
 OSL_ENSURE(pFact, Dialog creation failed!);
-VclAbstractDialog* pMultDlg = 
pFact-CreateMultiTOXMarkDlg(pMDI, aMgr);
+boost::scoped_ptrVclAbstractDialog 
pMultDlg(pFact-CreateMultiTOXMarkDlg(pMDI, aMgr));
 OSL_ENSURE(pMultDlg, Dialog creation failed!);
 nRet = pMultDlg-Execute();
-delete pMultDlg;
 }
 if( nRet == RET_OK)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-08-21 Thread Stephan Bergmann
 scripting/source/provider/MasterScriptProvider.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit bf640ba048704220292411e4f2bcc0d3c62caa32
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Aug 21 17:44:40 2014 +0200

Fix *_component_getFactory function type

Change-Id: Id16c653554f5573dc862e0798747b7337ff74d44

diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index 8d0385c..8f59d97 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -900,8 +900,8 @@ extern C
  */
 SAL_DLLPUBLIC_EXPORT void * SAL_CALL scriptframe_component_getFactory(
 const sal_Char * pImplName,
-lang::XMultiServiceFactory * pServiceManager,
-registry::XRegistryKey * pRegistryKey )
+void * pServiceManager,
+void * pRegistryKey )
 {
 return ::cppu::component_getFactoryHelper( pImplName, pServiceManager,
 pRegistryKey, ::scripting_runtimemgr::s_entries );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-08-21 Thread Stephan Bergmann
 scripting/source/basprov/basprov.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c7d7582452e8a6ebbe337d8083e8f660f63d6a96
Author: Stephan Bergmann sberg...@redhat.com
Date:   Thu Aug 21 17:49:13 2014 +0200

Fix *_component_getFactory function type

Change-Id: I966824af73effed95d975c09cb8a7f9ae022843f

diff --git a/scripting/source/basprov/basprov.cxx 
b/scripting/source/basprov/basprov.cxx
index 0f27e92..843beef 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -535,8 +535,8 @@ namespace basprov
 extern C
 {
 SAL_DLLPUBLIC_EXPORT void * SAL_CALL basprov_component_getFactory(
-const sal_Char * pImplName, lang::XMultiServiceFactory * 
pServiceManager,
-registry::XRegistryKey * pRegistryKey )
+const sal_Char * pImplName, void * pServiceManager,
+void * pRegistryKey )
 {
 return ::cppu::component_getFactoryHelper(
 pImplName, pServiceManager, pRegistryKey, 
::basprov::s_component_entries );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-06-21 Thread Julien Nabet
 scripting/source/stringresource/stringresource.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d59da701c67074a44abcfebcb7506792d12127ae
Author: Julien Nabet serval2...@yahoo.fr
Date:   Sat Jun 21 22:33:17 2014 +0200

Related fdo#58774 Alternative dialog Find  Replace for Writer

After having installed the extension from 
http://extensions.libreoffice.org/extension-center/alternative-dialog-find-replace-for-writer/releases/1.4
I had a crash, extract of bt:
5  0x2aaad3ee13df in rtl::OUString::copy (this=0x7fff2510, 
beginIndex=147, count=-15) at 
/home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx:1481
6  0x2aaad3edc10e in 
stringresource::StringResourcePersistenceImpl::implScanLocaleNames 
(this=0x8e2bba0, aContentSeq=uno::Sequence of length 24 = {...})
at 
/home/julien/compile-libreoffice/libreoffice/scripting/source/stringresource/stringresource.cxx:1728

So add a quick check to be sure iDot  iSlash

Change-Id: I944a852d6cc9a35c451985ac96032f0d848136e8

diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 1533531..c0b2e71 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -1722,7 +1722,7 @@ void StringResourcePersistenceImpl::implScanLocaleNames( 
const Sequence OUStrin
 OUString aExtension;
 sal_Int32 iDot = aCompleteName.lastIndexOf( '.' );
 sal_Int32 iSlash = aCompleteName.lastIndexOf( '/' );
-if( iDot != -1 )
+if( iDot != -1  iDot  iSlash)
 {
 sal_Int32 iCopyFrom = (iSlash != -1) ? iSlash + 1 : 0;
 aPureName = aCompleteName.copy( iCopyFrom, iDot-iCopyFrom );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-05-18 Thread Tsutomu Uchino
 scripting/source/protocolhandler/scripthandler.cxx |   40 +
 1 file changed, 40 insertions(+)

New commits:
commit a00c4c5e2fb9461fef1fbce4d51c8cdf36141b9f
Author: Tsutomu Uchino ha...@apache.org
Date:   Sat May 17 10:16:40 2014 +

Resolves: #i113481# query script invocation from the current frame...

when the controller is not yet attached

(cherry picked from commit 03a410876fbdb5f9e1a7216d9d622557275d4896)

Change-Id: I1da3b3da258445d5187dcc75c4d151d08f9017dc

diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index 50fa627..d2c6f75 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -158,7 +158,28 @@ void SAL_CALL 
ScriptProtocolHandler::dispatchWithNotification(
 
 OSL_ENSURE( xDocumentScripts.is(), 
ScriptProtocolHandler::dispatchWithNotification: can't do the security check! 
);
 if ( !xDocumentScripts.is() || 
!xDocumentScripts-getAllowMacroExecution() )
+{
+if ( xListener.is() )
+{
+::com::sun::star::frame::DispatchResultEvent aEvent(
+static_cast ::cppu::OWeakObject* ( this ),
+
::com::sun::star::frame::DispatchResultState::FAILURE,
+invokeResult );
+try
+{
+xListener-dispatchFinished( aEvent ) ;
+}
+catch(RuntimeException  e)
+{
+OSL_TRACE(
+
ScriptProtocolHandler::dispatchWithNotification: caught RuntimeException
+while dispatchFinished with failture of the 
execution %s,
+::rtl::OUStringToOString( e.Message,
+RTL_TEXTENCODING_ASCII_US ).pData-buffer );
+}
+}
 return;
+}
 }
 
 // Creates a ScriptProvider ( if one is not created already )
@@ -333,6 +354,25 @@ ScriptProtocolHandler::getScriptInvocation()
 if ( !m_xScriptInvocation.set( xController-getModel(), UNO_QUERY 
) )
 m_xScriptInvocation.set( xController, UNO_QUERY );
 }
+else
+{
+Reference XFrame  xFrame( m_xFrame.get(), UNO_QUERY );
+if ( xFrame.is() )
+{
+SfxFrame* pFrame = NULL;
+for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = 
SfxFrame::GetNext( *pFrame ) )
+{
+if ( pFrame-GetFrameInterface() == xFrame )
+break;
+}
+SfxObjectShell* pDocShell = pFrame ? 
pFrame-GetCurrentDocument() : SfxObjectShell::Current();
+if ( pDocShell )
+{
+Reference XModel  xModel( pDocShell-GetModel() );
+m_xScriptInvocation.set( xModel, UNO_QUERY );
+}
+}
+}
 }
 return m_xScriptInvocation.is();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-05-11 Thread Julien Nabet
 scripting/source/provider/URIHelper.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e3d01ad33689168d46969fd5d8fb432e03a0b41b
Author: Julien Nabet serval2...@yahoo.fr
Date:   Sun May 11 10:37:30 2014 +0200

Fix previous commit (scripting part)

Change-Id: Ib451642924909c11db4252e81d0c6db690c0e838

diff --git a/scripting/source/provider/URIHelper.cxx 
b/scripting/source/provider/URIHelper.cxx
index b0a5204..a8498b3 100644
--- a/scripting/source/provider/URIHelper.cxx
+++ b/scripting/source/provider/URIHelper.cxx
@@ -86,8 +86,8 @@ ScriptingFrameworkURIHelper::initialize(
 throw ( uno::Exception, uno::RuntimeException, std::exception )
 {
 if ( args.getLength() != 2 ||
- args[0].getValueType() != ::cppu::UnoTypeOUString::get()NULL) ||
- args[1].getValueType() != ::cppu::UnoTypeOUString::get()NULL) )
+ args[0].getValueType() != ::cppu::UnoTypeOUString::get() ||
+ args[1].getValueType() != ::cppu::UnoTypeOUString::get() )
 {
 throw uno::RuntimeException( OUString(
 ScriptingFrameworkURIHelper got invalid argument list ),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-04-14 Thread Stephan Bergmann
 scripting/source/dlgprov/DialogModelProvider.cxx  |1 
 scripting/source/provider/BrowseNodeFactoryImpl.cxx   |3 
 scripting/source/provider/MasterScriptProvider.cxx|   15 ---
 scripting/source/provider/MasterScriptProvider.hxx|   15 +++
 scripting/source/provider/MasterScriptProviderFactory.cxx |1 
 scripting/source/vbaevents/eventhelper.cxx|3 
 scripting/source/vbaevents/service.cxx|   45 --
 scripting/source/vbaevents/service.hxx|   63 ++
 8 files changed, 83 insertions(+), 63 deletions(-)

New commits:
commit 5e3c99315592191c1cb2bf787ac78889846fc453
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Apr 14 15:51:37 2014 +0200

Clean up function declarations

Change-Id: Ie204bb9dc1fb4ded416087f5a3d962924b3dec82

diff --git a/scripting/source/dlgprov/DialogModelProvider.cxx 
b/scripting/source/dlgprov/DialogModelProvider.cxx
index 6e61692..3e7d889 100644
--- a/scripting/source/dlgprov/DialogModelProvider.cxx
+++ b/scripting/source/dlgprov/DialogModelProvider.cxx
@@ -38,7 +38,6 @@ using namespace beans;
 // component and service helper functions:
 OUString SAL_CALL _getImplementationName();
 css::uno::Sequence OUString  SAL_CALL _getSupportedServiceNames();
-css::uno::Reference css::uno::XInterface  SAL_CALL _create( 
css::uno::Reference css::uno::XComponentContext  const  context );
 
 } // closing component helper namespace
 
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx 
b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 8c938e4..156b387 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -37,6 +37,7 @@
 #include tools/diagnose_ex.h
 
 #include BrowseNodeFactoryImpl.hxx
+#include MasterScriptProvider.hxx
 #include ActiveMSPList.hxx
 #include util/MiscUtils.hxx
 
@@ -382,7 +383,6 @@ private:
 Reference XAggregation m_xAggProxy;
 Reference XComponentContextm_xCtx;
 
-DefaultBrowseNode();
 public:
 DefaultBrowseNode( const Reference XComponentContext  xCtx, const 
Reference browse::XBrowseNode xNode ) : m_xWrappedBrowseNode( xNode ), 
m_xWrappedTypeProv( xNode, UNO_QUERY ), m_xCtx( xCtx )
 {
@@ -538,7 +538,6 @@ private:
 vXBrowseNodes m_vNodes;
 OUString m_Name;
 
-DefaultRootBrowseNode();
 public:
 DefaultRootBrowseNode( const Reference XComponentContext  xCtx )
 {
diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index 4b66cf8..850d45b 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -56,14 +56,6 @@ using namespace ::sf_misc;
 namespace func_provider
 {
 
-//  Definitions for MasterScriptProviderFactory global methods.
-
-
-OUString SAL_CALL mspf_getImplementationName() ;
-Reference XInterface  SAL_CALL mspf_create( Reference XComponentContext  
const  xComponentContext );
-Sequence OUString  SAL_CALL mspf_getSupportedServiceNames();
-
-
 bool endsWith( const OUString target,
 const OUString item )
 {
@@ -830,13 +822,6 @@ throw( RuntimeException, std::exception )
 } // namespace func_provider
 
 
-namespace browsenodefactory
-{
-OUString SAL_CALL bnf_getImplementationName() ;
-Reference XInterface  SAL_CALL bnf_create( Reference XComponentContext  
const  xComponentContext );
-Sequence OUString  SAL_CALL bnf_getSupportedServiceNames();
-}
-
 namespace scripting_runtimemgr
 {
 
diff --git a/scripting/source/provider/MasterScriptProvider.hxx 
b/scripting/source/provider/MasterScriptProvider.hxx
index 2953463..e424c93 100644
--- a/scripting/source/provider/MasterScriptProvider.hxx
+++ b/scripting/source/provider/MasterScriptProvider.hxx
@@ -143,7 +143,20 @@ private:
 osl::Mutex m_mutex;
 OUString m_sCtxString;
 };
-} // namespace func_provider
+
+OUString SAL_CALL mspf_getImplementationName() ;
+css::uno::Reference css::uno::XInterface  SAL_CALL mspf_create( 
css::uno::Reference css::uno::XComponentContext  const  xComponentContext );
+css::uno::Sequence OUString  SAL_CALL mspf_getSupportedServiceNames();
+
+}
+
+namespace browsenodefactory
+{
+OUString SAL_CALL bnf_getImplementationName() ;
+css::uno::Reference css::uno::XInterface  SAL_CALL bnf_create( 
css::uno::Reference css::uno::XComponentContext  const  xComponentContext );
+css::uno::Sequence OUString  SAL_CALL bnf_getSupportedServiceNames();
+}
+
 #endif //_FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/provider/MasterScriptProviderFactory.cxx 
b/scripting/source/provider/MasterScriptProviderFactory.cxx
index 3051bc8..547244a 100644
--- a/scripting/source/provider/MasterScriptProviderFactory.cxx
+++ b/scripting/source/provider/MasterScriptProviderFactory.cxx
@@ -24,6 +24,7 @@
 #include cppuhelper/supportsservice.hxx
 

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

2014-03-03 Thread Donizete Waterkemper
 scripting/source/stringresource/stringresource.cxx |2 +-
 sd/source/ui/unoidl/unopage.cxx|4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit c4cff5a6452c05c797742327f57bb682fa5379ce
Author: Donizete Waterkemper dwat...@gmail.com
Date:   Mon Mar 3 17:22:15 2014 -0300

fdo#54938: Convert some places to use cppu::supportsService

Change-Id: Ib941c6ec82d81b1da815561eee87ee91dc8de200
Reviewed-on: https://gerrit.libreoffice.org/8443
Tested-by: LibreOffice gerrit bot ger...@libreoffice.org
Reviewed-by: Marcos Paulo de Souza marcos.souza@gmail.com

diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index dc114f2..39a42a7 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -788,7 +788,7 @@ OUString 
StringResourcePersistenceImpl::getImplementationName(  )
 sal_Bool StringResourcePersistenceImpl::supportsService( const OUString 
rServiceName )
 throw (RuntimeException, std::exception)
 {
-return StringResourceImpl::supportsService( rServiceName );
+return cppu::supportsService( this, rServiceName );
 }
 
 
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 2953e27..09cdc3f 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -2243,7 +2243,7 @@ Sequence OUString  SAL_CALL 
SdDrawPage::getSupportedServiceNames() throw(uno::
 sal_Bool SAL_CALL SdDrawPage::supportsService( const OUString ServiceName )
 throw(uno::RuntimeException, std::exception)
 {
-return SdGenericDrawPage::supportsService( ServiceName );
+return cppu::supportsService( this, ServiceName );
 }
 
 // XNamed
@@ -2799,7 +2799,7 @@ Sequence OUString  SAL_CALL 
SdMasterPage::getSupportedServiceNames() throw(uno
 sal_Bool SAL_CALL SdMasterPage::supportsService( const OUString ServiceName )
 throw(uno::RuntimeException, std::exception)
 {
-return SdGenericDrawPage::supportsService( ServiceName );
+return cppu::supportsService( this, ServiceName );
 }
 
 // XElementAccess
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: scripting/source sfx2/inc shell/inc

2013-11-06 Thread Takeshi Abe
 scripting/source/vbaevents/eventhelper.cxx |1 -
 sfx2/inc/bluthsndapi.hxx   |1 -
 shell/inc/internal/types.hxx   |1 -
 3 files changed, 3 deletions(-)

New commits:
commit 9c2ab712300c78bdb74ee307fae0a6d118829e5a
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Wed Nov 6 15:15:52 2013 +0900

Drop unnecessary #includes

Change-Id: I9659279233067a8946a9e54be2f22439854a961e

diff --git a/scripting/source/vbaevents/eventhelper.cxx 
b/scripting/source/vbaevents/eventhelper.cxx
index 797d058..990586f 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -76,7 +76,6 @@
 #include cppuhelper/implbase2.hxx
 #include comphelper/evtmethodhelper.hxx
 
-#include set
 #include list
 #include boost/unordered_map.hpp
 #define ASYNC 0
diff --git a/sfx2/inc/bluthsndapi.hxx b/sfx2/inc/bluthsndapi.hxx
index 90dbe8b..d96228a 100644
--- a/sfx2/inc/bluthsndapi.hxx
+++ b/sfx2/inc/bluthsndapi.hxx
@@ -10,7 +10,6 @@
 #ifndef INCLUDED_SFX2_INC_BLUTHSNDAPI_HXX
 #define INCLUDED_SFX2_INC_BLUTHSNDAPI_HXX
 
-#include vector
 #include com/sun/star/frame/XFrame.hpp
 #include com/sun/star/frame/XModel.hpp
 #include rtl/ustring.hxx
diff --git a/shell/inc/internal/types.hxx b/shell/inc/internal/types.hxx
index 6823070..b65fb92 100644
--- a/shell/inc/internal/types.hxx
+++ b/shell/inc/internal/types.hxx
@@ -24,7 +24,6 @@
 #include map
 #include utility
 #include vector
-#include stack
 
 typedef std::vectorstd::wstring StringList_t;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-08-21 Thread Rene Engelhard
 scripting/source/pyprov/pythonscript.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 83f4be4740892e497d30f660abb55e40c628158e
Author: Rene Engelhard r...@debian.org
Date:   Wed Aug 21 10:11:14 2013 +0200

deb#719941: pythonscript.py: use open() instead of file()

Change-Id: Ib9f06b2b5629d149e932fe37312fdf5e8448c39f

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index c9cafc9..6732e25 100755
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -78,7 +78,7 @@ def getLogTarget():
 userInstallation =  pathSubst.getSubstituteVariableValue( user )
 if len( userInstallation )  0:
 systemPath = uno.fileUrlToSystemPath( userInstallation + 
/Scripts/python/log.txt )
-ret = file( systemPath , a )
+ret = open( systemPath , a )
 except:
 print(Exception during creation of pythonscript logfile: + 
lastException2String() + \n, delagating log to stdout\n)
 return ret
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-08-20 Thread Michael Stahl
 scripting/source/pyprov/pythonscript.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5be1f5234b46a89a7660a9cfe3deaa00e2aa124b
Author: Michael Stahl mst...@redhat.com
Date:   Tue Aug 20 17:16:16 2013 +0200

deb#719941: unbreak python script provider debug logging on Python 3

Don't mess with encoding in Logger.log, since sys.stdout.write()
accepts str (in python3) and both str/unicode (in python2) anyway.

Change-Id: Ib0339b7fd882a7654cc24c38efdaf67f519663ff

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index a405ca4..c9cafc9 100755
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -109,7 +109,7 @@ class Logger(LogLevel):
  [ +
 logLevel2String( level ) +
 ]  +
-encfile(msg) +
+msg +
 \n )
 self.target.flush()
 except:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-08-18 Thread Takeshi Abe
 scripting/source/provider/MasterScriptProvider.cxx |2 +-
 scripting/source/stringresource/stringresource.cxx |2 +-
 sd/source/filter/eppt/pptx-epptooxml.cxx   |4 ++--
 sd/source/ui/controller/slidelayoutcontroller.cxx  |   12 ++--
 sd/source/ui/dlg/gluectrl.cxx  |2 +-
 sd/source/ui/sidebar/LayoutMenu.cxx|8 
 sd/source/ui/toolpanel/LayoutMenu.cxx  |8 
 sd/source/ui/view/viewoverlaymanager.cxx   |4 ++--
 sdext/source/presenter/PresenterComponent.cxx  |2 +-
 9 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit f4004429d339009bec6babe30becdc9c727940b8
Author: Takeshi Abe t...@fixedpoint.jp
Date:   Mon Aug 19 07:45:55 2013 +0900

Mark as const

Change-Id: Ic81dd60fadecf72f25792903985f2b387df7a7a0

diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index f7dca4d..cb3783f 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -903,7 +903,7 @@ OUString urihelper_getImplementationName( )
 com.sun.star.script.provider.ScriptURIHelper);
 }
 
-static struct cppu::ImplementationEntry s_entries [] =
+static const struct cppu::ImplementationEntry s_entries [] =
 {
 {
 sp_create, sp_getImplementationName,
diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 253d77b..33a2e30 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -2986,7 +2986,7 @@ const Reference ucb::XSimpleFileAccess3  
StringResourceWithLocationImpl::getFi
 // component export operations
 // 
=
 
-static struct ::cppu::ImplementationEntry s_component_entries [] =
+static const struct ::cppu::ImplementationEntry s_component_entries [] =
 {
 {
 create_StringResourceImpl, getImplementationName_StringResourceImpl,
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 2535689..ca78715 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -142,7 +142,7 @@ struct PPTXLayoutInfo {
 const char* sType;
 };
 
-static PPTXLayoutInfo aLayoutInfo[LAYOUT_SIZE] = {
+static const PPTXLayoutInfo aLayoutInfo[LAYOUT_SIZE] = {
 { 20, Blank Slide, blank },
 { 0, Title Slide, tx },
 { 1, Title, Content, obj },
@@ -2158,7 +2158,7 @@ OUString PowerPointExport::implGetImplementationName() 
const
 
 // UNO component
 
-static struct cppu::ImplementationEntry g_entries[] =
+static const struct cppu::ImplementationEntry g_entries[] =
 {
 {
 oox::core::PowerPointExport_createInstance,
diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx 
b/sd/source/ui/controller/slidelayoutcontroller.cxx
index 38626bb..8a3fd5e 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.cxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx
@@ -97,13 +97,13 @@ struct snewfoil_value_info
 AutoLayout maAutoLayout;
 };
 
-static snewfoil_value_info notes[] =
+static const snewfoil_value_info notes[] =
 {
 {BMP_FOILN_01, STR_AUTOLAYOUT_NOTES, WritingMode_LR_TB, AUTOLAYOUT_NOTES},
 {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
 };
 
-static snewfoil_value_info handout[] =
+static const snewfoil_value_info handout[] =
 {
 {BMP_FOILH_01, STR_AUTOLAYOUT_HANDOUT1, WritingMode_LR_TB, 
AUTOLAYOUT_HANDOUT1},
 {BMP_FOILH_02, STR_AUTOLAYOUT_HANDOUT2, WritingMode_LR_TB, 
AUTOLAYOUT_HANDOUT2},
@@ -114,7 +114,7 @@ static snewfoil_value_info handout[] =
 {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE},
 };
 
-static snewfoil_value_info standard[] =
+static const snewfoil_value_info standard[] =
 {
 {BMP_LAYOUT_EMPTY,STR_AUTOLAYOUT_NONE, 
WritingMode_LR_TB, AUTOLAYOUT_NONE },
 {BMP_LAYOUT_HEAD03,   STR_AUTOLAYOUT_TITLE,
WritingMode_LR_TB, AUTOLAYOUT_TITLE},
@@ -131,7 +131,7 @@ static snewfoil_value_info standard[] =
 {0, 0, WritingMode_LR_TB, AUTOLAYOUT_NONE}
 };
 
-static snewfoil_value_info v_standard[] =
+static const snewfoil_value_info v_standard[] =
 {
 // vertical
 {BMP_LAYOUT_VERTICAL02, STR_AL_VERT_TITLE_TEXT_CHART,  
WritingMode_TB_RL, AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART   },
@@ -143,7 +143,7 @@ static snewfoil_value_info v_standard[] =
 
 // ---
 
-static void fillLayoutValueSet( ValueSet* pValue, snewfoil_value_info* pInfo )
+static void fillLayoutValueSet( ValueSet* pValue, const snewfoil_value_info* 
pInfo )
 {
 Size aLayoutItemSize;
 for( ; pInfo-mnBmpResId; pInfo++ )
@@ -198,7 +198,7 @@ LayoutToolbarMenu::LayoutToolbarMenu( 
SlideLayoutController 

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

2013-07-30 Thread Noel Power
 scripting/source/provider/MasterScriptProvider.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 92500896a9d0ba873c06a4a2728eb5a1b9d8f68d
Author: Noel Power noel.po...@suse.com
Date:   Tue Jul 30 17:29:42 2013 +0100

fdo#67547 fix access to methods (getScript) of MasterScriptProvider from VB

access to libreoffice objects ( and methods/properties of those objects )
from VB all goes through the ole automation bridge. There has been a long
standing issue where the bridge falls over trying to access methods of the
scripting framework MasterScriptProvider object.

Change-Id: I3b9391286e1030bef2a12d6e546a5c47a4f68edb

diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index a473394..f7dca4d 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -695,7 +695,9 @@ MasterScriptProvider::hasByName( const OUString aName ) 
throw (RuntimeException
 
 result = xCont-hasByName( aName );
 }
-else
+// If this is a document provider then we shouldn't
+// have a PackageProvider
+else if (!m_xModel.is())
 {
 throw RuntimeException( PackageMasterScriptProvider is 
unitialised,
 Reference XInterface () );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-15 Thread Caolán McNamara
 scripting/source/pyprov/mailmerge.py |   16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 24078e3501042e8693ef1f9d3edebbc47e37ce12
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Jul 15 10:25:31 2013 +0100

Related: fdo#66761 the double-encoding bug appears gone in python 3.3.2

i.e. I see the bug in our built-in python3 3.3.0 but not in my system python
3.3.2 and there's a raft of email related bug fixes in the 3.3.2/3.3.1
python Changelog

Change-Id: I257770cd0ec41fc3b2f2a638009b075b9a2f325f

diff --git a/scripting/source/pyprov/mailmerge.py 
b/scripting/source/pyprov/mailmerge.py
index 6ed046b..201b5c9 100755
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -189,8 +189,14 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
#it's a bytesequence, get raw 
bytes
textbody = textbody.value
if sys.version = '3':
-   
#http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
-   textbody = 
textbody.decode('iso8859-1')
+   if sys.version_info.minor  3 
or (sys.version_info.minor == 3 and sys.version_info.micro = 1):
+   
#http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
+   #see 
http://bugs.python.org/16564, etc. basically it now *seems* to be all ok
+   #in python 3.3.2 
onwards, but a little busted in 3.3.0
+
+   textbody = 
textbody.decode('iso8859-1')
+   else:
+   textbody = 
textbody.decode('utf-8')
c = Charset('utf-8')
c.body_encoding = QP
textmsg.set_payload(textbody, c)
@@ -472,15 +478,15 @@ class PyMailMessage(unohelper.Base, XMailMessage):
self.bccrecipients.append(bccrecipient)
def getRecipients( self ):
if dbg:
-   print(PyMailMessage.getRecipients:  + 
self.recipients, file=dbgout)
+   print(PyMailMessage.getRecipients:  + 
str(self.recipients), file=dbgout)
return tuple(self.recipients)
def getCcRecipients( self ):
if dbg:
-   print(PyMailMessage.getCcRecipients:  + 
self.ccrecipients, file=dbgout)
+   print(PyMailMessage.getCcRecipients:  + 
str(self.ccrecipients), file=dbgout)
return tuple(self.ccrecipients)
def getBccRecipients( self ):
if dbg:
-   print(PyMailMessage.getBccRecipients:  + 
self.bccrecipients, file=dbgout)
+   print(PyMailMessage.getBccRecipients:  + 
str(self.bccrecipients), file=dbgout)
return tuple(self.bccrecipients)
def addAttachment( self, aMailAttachment ):
if dbg:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-13 Thread Caolán McNamara
 scripting/source/pyprov/mailmerge.py |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit c4aa13c931da11164835a7aafbfd7e44bd5714ca
Author: Caolán McNamara caol...@redhat.com
Date:   Sat Jul 13 15:56:41 2013 +0100

Resolves: fdo#66761 Macro controlled Python Mailmerge broken

Change-Id: Id8bbf06a5571534aa5eef8624e89565fe3715938

diff --git a/scripting/source/pyprov/mailmerge.py 
b/scripting/source/pyprov/mailmerge.py
index cbd1428..6fa486d 100755
--- a/scripting/source/pyprov/mailmerge.py
+++ b/scripting/source/pyprov/mailmerge.py
@@ -182,7 +182,10 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
textmsg['Content-Type'] = mimeEncoding
textmsg['MIME-Version'] = '1.0'
 
-   textbody = textbody.encode('utf-8')
+   try:
+   textbody = 
textbody.encode('utf-8')
+   except:
+   textbody = 
str(textbody.value).encode('utf-8')
if sys.version = '3':

#http://stackoverflow.com/questions/9403265/how-do-i-use-python-3-2-email-module-to-send-unicode-messages-encoded-in-utf-8-w
textbody = 
textbody.decode('iso8859-1')
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-07-12 Thread Herbert Dürr
 scripting/source/pyprov/pythonscript.py |   24 
 1 file changed, 16 insertions(+), 8 deletions(-)

New commits:
commit 3c57a9b8a41b0b1244e649f0766f45d54012f395
Author: Herbert Dürr h...@apache.org
Date:   Fri Jul 12 08:56:00 2013 +

Resolves: #i120083# make python loglevel and log output changeable...

through environment vars

Set the log level with the environment variable PYSCRIPT_LOG_LEVEL
DEBUG (for debugging)
ERROR (show errors only)
NONE  (or anything else) (for production) is the default
and the log output type with the enviroment variable PYSCRIPT_LOG_STDOUT
0 (log output to user/Scripts/python/log.txt)
1 (or anything else) (log output to stdout)

Patch by: Tsutomu Uchino hanya.r...@gmail.com
Review by: Herbert Durr h...@apache.org

Note: Commit message edited by ASF infra team to work around a known issue 
with the
ASF svn install (not an issue with svn) and UTF-8 handling. This is a 
temporary
issue that we hope to resolve soon.
(cherry picked from commit 9dc7f72febe9d294304f70cc7b9cdeab1c67dc8b)

Change-Id: I099c8b3f812559c380078f63b692c83fdc811e33

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 789b6a6..d2e90ba 100755
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -31,16 +31,24 @@ except NameError:
 unicode = str
 
 class LogLevel:
-NONE = 0
-ERROR = 1
-DEBUG = 2
+NONE = 0   # production level
+ERROR = 1  # for script developers
+DEBUG = 2  # for script framework developers
+
+PYSCRIPT_LOG_ENV = PYSCRIPT_LOG_LEVEL
+PYSCRIPT_LOG_STDOUT_ENV = PYSCRIPT_LOG_STDOUT
 
 # Configuration 
-LogLevel.use = LogLevel.NONE# production level
-#LogLevel.use = LogLevel.ERROR   # for script developers
-#LogLevel.use = LogLevel.DEBUG   # for script framework developers
-LOG_STDOUT = True   # True, writes to stdout 
(difficult on windows)
-# False, writes to 
user/Scripts/python/log.txt
+LogLevel.use = LogLevel.NONE
+if os.environ.get(PYSCRIPT_LOG_ENV) == ERROR:
+LogLevel.use = LogLevel.ERROR
+elif os.environ.get(PYSCRIPT_LOG_ENV) == DEBUG:
+LogLevel.use = LogLevel.DEBUG
+
+# True, writes to stdout (difficult on windows)
+# False, writes to user/Scripts/python/log.txt
+LOG_STDOUT = os.environ.get(PYSCRIPT_LOG_STDOUT_ENV, 1) != 0
+
 ENABLE_EDIT_DIALOG=False# offers a minimal editor for 
editing.
 #---
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-06-28 Thread Thomas Arnhold
 scripting/source/basprov/basprov.cxx  |1 
 scripting/source/inc/util/MiscUtils.hxx   |2 -
 scripting/source/inc/util/util.hxx|   26 --
 scripting/source/protocolhandler/scripthandler.cxx|1 
 scripting/source/provider/ActiveMSPList.cxx   |1 
 scripting/source/provider/BrowseNodeFactoryImpl.cxx   |1 
 scripting/source/provider/MasterScriptProvider.cxx|1 
 scripting/source/provider/MasterScriptProviderFactory.cxx |2 -
 scripting/source/provider/ProviderCache.cxx   |1 
 scripting/source/provider/ScriptImpl.cxx  |1 
 scripting/source/provider/ScriptingContext.cxx|1 
 11 files changed, 38 deletions(-)

New commits:
commit 349d3b2bb5b771b9e6d42693c64ba7fa29379322
Author: Thomas Arnhold tho...@arnhold.org
Date:   Thu Jun 27 13:21:47 2013 +0200

remove an unused header

Change-Id: I2821879670e23e7b1ce9749acab1970098a0a38d
Reviewed-on: https://gerrit.libreoffice.org/4597
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/scripting/source/basprov/basprov.cxx 
b/scripting/source/basprov/basprov.cxx
index ed0c1f9..04e279f 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -47,7 +47,6 @@
 #include com/sun/star/uri/XUriReferenceFactory.hpp
 #include com/sun/star/uri/XVndSunStarScriptUrl.hpp
 
-#include util/util.hxx
 #include util/MiscUtils.hxx
 
 
diff --git a/scripting/source/inc/util/MiscUtils.hxx 
b/scripting/source/inc/util/MiscUtils.hxx
index ccb44f8..5780964 100644
--- a/scripting/source/inc/util/MiscUtils.hxx
+++ b/scripting/source/inc/util/MiscUtils.hxx
@@ -37,8 +37,6 @@
 #include com/sun/star/lang/XMultiComponentFactory.hpp
 #include comphelper/processfactory.hxx
 
-#include util.hxx
-
 namespace sf_misc
 {
 
diff --git a/scripting/source/inc/util/util.hxx 
b/scripting/source/inc/util/util.hxx
deleted file mode 100644
index 5dd38b8..000
--- a/scripting/source/inc/util/util.hxx
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- 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 file to you under the Apache
- *   License, Version 2.0 (the License); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#ifndef _COM_SUN_STAR_SCRIPTING_UTIL_UTIL_HXX_
-#define _COM_SUN_STAR_SCRIPTING_UTIL_UTIL_HXX_
-
-#endif //_COM_SUN_STAR_SCRIPTING_UTIL_UTIL_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/protocolhandler/scripthandler.cxx 
b/scripting/source/protocolhandler/scripthandler.cxx
index 43128f2..5d70b30 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -44,7 +44,6 @@
 #include comphelper/processfactory.hxx
 #include cppuhelper/factory.hxx
 #include cppuhelper/exc_hlp.hxx
-#include util/util.hxx
 #include framework/documentundoguard.hxx
 
 #include com/sun/star/uno/XComponentContext.hpp
diff --git a/scripting/source/provider/ActiveMSPList.cxx 
b/scripting/source/provider/ActiveMSPList.cxx
index 448294c..5b3b71e 100644
--- a/scripting/source/provider/ActiveMSPList.cxx
+++ b/scripting/source/provider/ActiveMSPList.cxx
@@ -22,7 +22,6 @@
 #include cppuhelper/implbase1.hxx
 #include cppuhelper/exc_hlp.hxx
 #include util/scriptingconstants.hxx
-#include util/util.hxx
 #include util/MiscUtils.hxx
 
 #include com/sun/star/beans/XPropertySet.hpp
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx 
b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index cfb53af..a57c9f7 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -38,7 +38,6 @@
 #include BrowseNodeFactoryImpl.hxx
 #include ActiveMSPList.hxx
 #include util/MiscUtils.hxx
-#include util/util.hxx
 
 #include vector
 #include algorithm
diff --git a/scripting/source/provider/MasterScriptProvider.cxx 
b/scripting/source/provider/MasterScriptProvider.cxx
index 32c89b4..a473394 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -40,7 +40,6 @@
 #include 

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

2013-05-24 Thread Miklos Vajna
 scripting/source/dlgprov/dlgprov.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 2e2a4827ce6708f0e8677dba9cc92e1479a44086
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri May 24 12:52:25 2013 +0200

scripting: get CreateUnoDialog() work again

Trivial reproducer:

Dim Dlg As Object
DialogLibraries.LoadLibrary(Standard)
Dlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
Dlg.Execute()
Dlg.dispose()

Regression from 6c61b20a8d4a6dcac28801cde82a211fb7e30654.

Change-Id: Ia62778c6d94f54e6097a307701e5c81be847665d
Reviewed-on: https://gerrit.libreoffice.org/4023
Reviewed-by: Miklos Vajna vmik...@suse.cz
Tested-by: Miklos Vajna vmik...@suse.cz

diff --git a/scripting/source/dlgprov/dlgprov.cxx 
b/scripting/source/dlgprov/dlgprov.cxx
index 8c645a3..2d96b9d 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -149,9 +149,10 @@ static OUString 
aResourceResolverPropName(ResourceResolver);
 // Set resource property
 if( xStringResourceManager.is() )
 {
+Reference beans::XPropertySet  xDlgPSet( xDialogModel, UNO_QUERY 
);
 Any aStringResourceManagerAny;
 aStringResourceManagerAny = xStringResourceManager;
-xDialogModel-setPropertyValue( aResourceResolverPropName, 
aStringResourceManagerAny );
+xDlgPSet-setPropertyValue( aResourceResolverPropName, 
aStringResourceManagerAny );
 }
 
 return xDialogModel;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-05-24 Thread Pedro Giffuni
 scripting/source/pyprov/pythonscript.py |   82 
 1 file changed, 41 insertions(+), 41 deletions(-)

New commits:
commit 7a6cc8bb59bf1cae6adabdf76e0bebd3f04f5e39
Author: Pedro Giffuni p...@apache.org
Date:   Sun Jul 29 19:53:48 2012 +

Resolves: #i55055# Simplify pythonscript.py code

author: hanya
(cherry picked from commit e945b49105bab50700274f797e41d1446a70641d)

Conflicts:
scripting/source/pyprov/pythonscript.py

Change-Id: Ia019a737c5f80d3af9fc50aefcda6f5b00987513

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index c92d212..789b6a6 100755
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -177,7 +177,7 @@ class MyUriHelper:
 else:
 self.m_baseUri = expandUri( self.s_UriMap[location] )
 self.m_scriptUriLocation = location
-log.isDebugLevel() and log.debug( initialized urihelper with 
baseUri=+self.m_baseUri + ,m_scriptUriLocation=+self.m_scriptUriLocation )
+log.debug( initialized urihelper with baseUri=+self.m_baseUri + 
,m_scriptUriLocation=+self.m_scriptUriLocation )
 
 def getRootStorageURI( self ):
 return self.m_baseUri
@@ -191,20 +191,20 @@ class MyUriHelper:
 def storageURI2ScriptUri( self, storageURI ):
 if not storageURI.startswith( self.m_baseUri ):
 message = pythonscript: storage uri ' + storageURI + ' not in 
base uri ' + self.m_baseUri + '
-log.isDebugLevel() and log.debug( message )
+log.debug( message )
 raise RuntimeException( message )
 
 ret = vnd.sun.star.script: + \
   storageURI[len(self.m_baseUri)+1:].replace(/,|) + \
   ?language= + LANGUAGENAME + location= + 
self.m_scriptUriLocation
-log.isDebugLevel() and log.debug( converting storageURI=+storageURI 
+  to scriptURI= + ret )
+log.debug( converting storageURI=+storageURI +  to scriptURI= + 
ret )
 return ret
 
 def scriptURI2StorageUri( self, scriptURI ):
 try:
 myUri = self.m_uriRefFac.parse(scriptURI)
 ret = self.m_baseUri + / + myUri.getName().replace( |, / )
-log.isDebugLevel() and log.debug( converting 
scriptURI=+scriptURI +  to storageURI= + ret )
+log.debug( converting scriptURI=+scriptURI +  to storageURI= + 
ret )
 return ret
 except UnoException as e:
 log.error( error during converting scriptURI=+scriptURI + :  + 
e.Message)
@@ -285,12 +285,12 @@ class ScriptContext(unohelper.Base):
 #lastRead = sfa.getDateTimeModified( url )
 #if entry:
 #if hasChanged( entry.lastRead, lastRead ):
-#log.isDebugLevel() and log.debug(file  + url +  has changed, 
reloading)
+#log.debug(file  + url +  has changed, reloading)
 #else:
 #load = False
 #
 #if load:
-#log.isDebugLevel() and log.debug( opening  + url +  )
+#log.debug( opening  + url +  )
 #
 #code = readTextFromStream( sfa.openFileRead( url ) )
 
@@ -300,7 +300,7 @@ class ScriptContext(unohelper.Base):
 #entry.module.__file__ = url
 #exec code in entry.module.__dict__
 #g_modules[ url ] = entry
-#log.isDebugLevel() and log.debug( mapped  + url +  to  + str( 
entry.module ) )
+#log.debug( mapped  + url +  to  + str( entry.module ) )
 #return entry.module
 
 class ProviderContext:
@@ -333,7 +333,7 @@ class ProviderContext:
 def addPackageByUrl( self, url ):
 packageName = self.getPackageNameFromUrl( url )
 transientPart = self.getTransientPartFromUrl( url )
-log.isDebugLevel() and log.debug( addPackageByUrl :  + packageName + 
,  + transientPart + (+url+) + , rootUrl=+self.rootUrl )
+log.debug( addPackageByUrl :  + packageName + ,  + transientPart + 
(+url+) + , rootUrl=+self.rootUrl )
 if packageName in self.mapPackageName2Path:
 package = self.mapPackageName2Path[ packageName ]
 package.paths = package.paths + (url, )
@@ -360,7 +360,7 @@ class ProviderContext:
 if self.rootUrl:
 pos = len( self.rootUrl) +1
 ret = url[0:pos]+url[url.find(/,pos)+1:len(url)]
-log.isDebugLevel() and log.debug( getPersistentUrlFromStorageUrl  + 
url +   - + ret)
+log.debug( getPersistentUrlFromStorageUrl  + url +   - + ret)
 return ret
 
 def getStorageUrlFromPersistentUrl( self, url):
@@ -370,7 +370,7 @@ class ProviderContext:
 packageName = url[pos:url.find(/,pos+1)]
 package = self.mapPackageName2Path[ packageName ]
 ret = url[0:pos]+ package.transientPathElement + / + 
url[pos:len(url)]
-log.isDebugLevel() and log.debug( getStorageUrlFromPersistentUrl  + 
url +  - + ret)
+log.debug( getStorageUrlFromPersistentUrl 

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

2013-05-11 Thread Ariel Constenla-Haile
 scripting/source/pyprov/pythonscript.py |   56 +---
 1 file changed, 51 insertions(+), 5 deletions(-)

New commits:
commit b0c59c314610ee5c6a361b0d3629d5a676305c58
Author: Ariel Constenla-Haile arie...@apache.org
Date:   Wed May 30 03:08:28 2012 +

Resolves: #ii118478# Implement getInvocationContext in PyUNO ScriptContext

Original author: Tsutomu Uchino hanya.runo at gmail.com

(cherry picked from commit 5de5fd495d7cdad852d1631941ae03ec213f93b7)

Change-Id: Iaa0aa8b1dd6a326cd738f2e296a1b5ecdc379c65

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index 52ae89b..c92d212 100755
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -117,9 +117,9 @@ from com.sun.star.lang import IllegalArgumentException
 from com.sun.star.container import NoSuchElementException
 from com.sun.star.lang import XServiceInfo
 from com.sun.star.io import IOException
-from com.sun.star.ucb import CommandAbortedException, XCommandEnvironment, 
XProgressHandler
+from com.sun.star.ucb import CommandAbortedException, XCommandEnvironment, 
XProgressHandler, Command
 from com.sun.star.task import XInteractionHandler
-from com.sun.star.beans import XPropertySet
+from com.sun.star.beans import XPropertySet, Property
 from com.sun.star.container import XNameContainer
 from com.sun.star.xml.sax import XDocumentHandler, InputSource
 from com.sun.star.uno import Exception as UnoException
@@ -251,12 +251,15 @@ def checkForPythonPathBesideScript( url ):
 
 
 class ScriptContext(unohelper.Base):
-def __init__( self, ctx, doc ):
+def __init__( self, ctx, doc, inv ):
 self.ctx = ctx
 self.doc = doc
+self.inv = inv

# XScriptContext
 def getDocument(self):
+if self.doc:
+return self.doc
 return self.getDesktop().getCurrentComponent()
 
 def getDesktop(self):
@@ -266,6 +269,9 @@ class ScriptContext(unohelper.Base):
 def getComponentContext(self):
 return self.ctx
 
+def getInvocationContext(self):
+return self.inv
+
 #--
 # Global Module Administration
 # does not fit together with script
@@ -745,7 +751,32 @@ class CommandEnvironment(unohelper.Base, 
XCommandEnvironment):
 #log.isDebugLevel() and log.debug( pythonscript: 
ModifyListener.modified  + str( event ) )
 #def disposing( self, event ):
 #log.isDebugLevel() and log.debug( pythonscript: 
ModifyListener.disposing  + str( event ) )
+
+def getModelFromDocUrl(ctx, url):
+Get document model from document url.
+doc = None
+args = (Local, Office)
+ucb = ctx.getServiceManager().createInstanceWithArgumentsAndContext(
+com.sun.star.ucb.UniversalContentBroker, args, ctx)
+identifier = ucb.createContentIdentifier(url)
+content = ucb.queryContent(identifier)
+p = Property()
+p.Name = DocumentModel
+p.Handle = -1
 
+c = Command()
+c.Handle = -1
+c.Name = getPropertyValues
+c.Argument = uno.Any([]com.sun.star.beans.Property, (p,))
+
+env = CommandEnvironment()
+try:
+ret = content.execute(c, 0, env)
+doc = ret.getObject(1, None)
+except Exception as e:
+log.isErrorLevel() and log.error(getModelFromDocUrl: %s % url)
+return doc
+
 def mapStorageType2PackageContext( storageType ):
 ret = storageType
 if( storageType == share:uno_packages ):
@@ -872,11 +903,26 @@ class PythonScriptProvider( unohelper.Base, XBrowseNode, 
XScriptProvider, XNameC
 mystr = mystr + str(i)
 log.debug( Entering PythonScriptProvider.ctor + mystr )
 
+doc = None
+inv = None
 storageType = 
+
 if isinstance(args[0],unicode ):
 storageType = args[0]
+if storageType.startswith( vnd.sun.star.tdoc ):
+doc = getModelFromDocUrl(ctx, storageType)
 else:
-storageType = args[0].SCRIPTING_DOC_URI
+inv = args[0]
+try:
+doc = inv.ScriptContainer
+content = ctx.getServiceManager().createInstanceWithContext(
+
com.sun.star.frame.TransientDocumentsDocumentContentFactory,
+ctx).createDocumentContent(doc)
+storageType = content.getIdentifier().getContentIdentifier()
+except Exception as e:
+text = lastException2String()
+log.error( text )
+
 isPackage = storageType.endswith( :uno_packages )
 
 try:
@@ -895,7 +941,7 @@ class PythonScriptProvider( unohelper.Base, XBrowseNode, 
XScriptProvider, XNameC
 raise RuntimeException(
 PythonScriptProvider couldn't instantiate  +ucbService, 
self)
 self.provCtx = ProviderContext(
-storageType, sfa, urlHelper, ScriptContext( 

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

2013-04-16 Thread Stephan Bergmann
 scripting/source/stringresource/stringresource.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 617e7c623167308e6fb8501822158fe1af72ba47
Author: Stephan Bergmann sberg...@redhat.com
Date:   Tue Apr 16 19:07:36 2013 +0200

Missing include

Change-Id: I1be082b7db5592ad5090cf3ffaafe708bb1d9be4

diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 5bc2842..689f6f7 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -32,7 +32,7 @@
 #include com/sun/star/container/XNameAccess.hpp
 #include com/sun/star/ucb/SimpleFileAccess.hpp
 
-
+#include rtl/tencinfo.h
 #include rtl/ustrbuf.hxx
 #include rtl/strbuf.hxx
 #include tools/urlobj.hxx
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-02-24 Thread Julien Nabet
 scripting/source/stringresource/stringresource.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3901964b6d1fb2117cb983a7eedf80da93ba5530
Author: Julien Nabet serval2...@yahoo.fr
Date:   Sun Feb 24 14:09:54 2013 +0100

coverity#704434 Non-array delete for scalars

Change-Id: Ie92de56ead7988d951fe44cf63b4e72214b1e22f
Reviewed-on: https://gerrit.libreoffice.org/2358
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index e88ff5a..4be1a77 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -2265,7 +2265,7 @@ bool 
StringResourcePersistenceImpl::implWritePropertiesFile( LocaleItem* pLocale
 }
 }
 
-delete pIdPtrs;
+delete[] pIdPtrs;
 }
 
 bSuccess = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-02-24 Thread Caolán McNamara
 scripting/source/stringresource/stringresource.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit df37f7d8e82d8d0854076c3c9be64ee3a155f7bf
Author: Caolán McNamara caol...@redhat.com
Date:   Sun Feb 24 23:24:12 2013 +

move loop variables into least scope pos

Change-Id: I8e69e92bbfee2bf20918d041ecc6b7a3f7729fbd

diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 4be1a77..6c8bb64 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -2238,8 +2238,7 @@ bool 
StringResourcePersistenceImpl::implWritePropertiesFile( LocaleItem* pLocale
 
 // Create sorted array of pointers to the id strings
 const ::rtl::OUString** pIdPtrs = new const ::rtl::OUString*[nTabSize];
-sal_Int32 i;
-for( i = 0 ; i  nTabSize ; i++ )
+for(sal_Int32 i = 0 ; i  nTabSize ; i++ )
 pIdPtrs[i] = NULL;
 for( it_index = rIndexMap.begin(); it_index != rIndexMap.end(); 
++it_index )
 {
@@ -2248,7 +2247,7 @@ bool 
StringResourcePersistenceImpl::implWritePropertiesFile( LocaleItem* pLocale
 }
 
 // Write lines in correct order
-for( i = 0 ; i  nTabSize ; i++ )
+for(sal_Int32 i = 0 ; i  nTabSize ; i++ )
 {
 const ::rtl::OUString* pStr = pIdPtrs[i];
 if( pStr != NULL )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2013-02-21 Thread Miklos Vajna
 scripting/source/pyprov/pythonscript.py |   30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

New commits:
commit d1dc850cbb6072d26a26aa8d183002a50c548cfc
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Feb 22 08:47:14 2013 +0100

scripting: s/pathes/paths and s/Pathes/Paths

Change-Id: I58d8e8dc9c6a6864206d923165d075114368c866

diff --git a/scripting/source/pyprov/pythonscript.py 
b/scripting/source/pyprov/pythonscript.py
index dbc5725..cab9851 100755
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -320,7 +320,7 @@ class ProviderContext:
 def removePackageByUrl( self, url ):
 items = self.mapPackageName2Path.items()
 for i in items:
-if url in i[1].pathes:
+if url in i[1].paths:
 self.mapPackageName2Path.pop(i[0])
 break
 
@@ -330,7 +330,7 @@ class ProviderContext:
 log.isDebugLevel() and log.debug( addPackageByUrl :  + packageName + 
,  + transientPart + (+url+) + , rootUrl=+self.rootUrl )
 if packageName in self.mapPackageName2Path:
 package = self.mapPackageName2Path[ packageName ]
-package.pathes = package.pathes + (url, )
+package.paths = package.paths + (url, )
 else:
 package = Package( (url,), transientPart)
 self.mapPackageName2Path[ packageName ] = package
@@ -338,8 +338,8 @@ class ProviderContext:
 def isUrlInPackage( self, url ):
 values = self.mapPackageName2Path.values()
 for i in values:
-#  print (checking  + url +  in  + str(i.pathes))
-if url in i.pathes:
+#  print (checking  + url +  in  + str(i.paths))
+if url in i.paths:
return True
 #print (false)
 return False
@@ -686,7 +686,7 @@ def isPyFileInPath( sfa, path ):
 return ret
 
 # extracts META-INF directory from 
-def getPathesFromPackage( rootUrl, sfa ):
+def getPathsFromPackage( rootUrl, sfa ):
 ret = ()
 try:
 fileUrl = rootUrl + /META-INF/manifest.xml 
@@ -701,14 +701,14 @@ def getPathesFromPackage( rootUrl, sfa ):
 ret = tuple( handler.urlList )
 except UnoException:
 text = lastException2String()
-log.debug( getPathesFromPackage  + fileUrl +  Exception:  +text )
+log.debug( getPathsFromPackage  + fileUrl +  Exception:  +text )
 pass
 return ret
 
 
 class Package:
-def __init__( self, pathes, transientPathElement ):
-self.pathes = pathes
+def __init__( self, paths, transientPathElement ):
+self.paths = paths
 self.transientPathElement = transientPathElement
 
 class DummyInteractionHandler( unohelper.Base, XInteractionHandler ):
@@ -770,11 +770,11 @@ def getPackageName2PathMap( sfa, storageType ):
 log.isDebugLevel() and log.debug( inspecting package  + i.Name + 
(+i.Identifier.Value+) )
 transientPathElement = penultimateElement( i.URL )
 j = expandUri( i.URL )
-pathes = getPathesFromPackage( j, sfa )
-if len( pathes )  0:
+paths = getPathsFromPackage( j, sfa )
+if len( paths )  0:
 # map package name to url, we need this later
-log.isErrorLevel() and log.error( adding Package  + 
transientPathElement +   + str( pathes ) )
-ret[ lastElement( j ) ] = Package( pathes, transientPathElement )
+log.isErrorLevel() and log.error( adding Package  + 
transientPathElement +   + str( paths ) )
+ret[ lastElement( j ) ] = Package( paths, transientPathElement )
 return ret
 
 def penultimateElement( aStr ):
@@ -798,11 +798,11 @@ class PackageBrowseNode( unohelper.Base, XBrowseNode ):
 items = self.provCtx.mapPackageName2Path.items()
 browseNodeList = []
 for i in items:
-if len( i[1].pathes ) == 1:
+if len( i[1].paths ) == 1:
 browseNodeList.append(
-DirBrowseNode( self.provCtx, i[0], i[1].pathes[0] ))
+DirBrowseNode( self.provCtx, i[0], i[1].paths[0] ))
 else:
-for j in i[1].pathes:
+for j in i[1].paths:
 browseNodeList.append(
 DirBrowseNode( self.provCtx, i[0]+.+lastElement(j), 
j ) )
 return tuple( browseNodeList )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits