Re: Bug 83260

2018-01-11 Thread Matthew J. Francis

On 12/01/2018 13:18, Yemelyanenko Fyodor wrote:


Withthese modification LO is stable when autocreecting and Undo/Redo

Patchis here https://gerrit.libreoffice.org/47686


Thanks for persisting to find a good solution for this. It's much 
appreciated


Regards
Matthew Francis

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Bug 83260

2018-01-03 Thread Matthew J. Francis

On 04/01/2018 09:45, Matthew J. Francis wrote:

On 03/01/2018 17:42, Miklos Vajna wrote:


[...]


We raise a similar warning when deleting a header, you can probably
reuse that code here. And sure, clearing the undo stack instead of
crashing sounds like an improvement (especially if we ask the user
before clearing the undo stack).


I use tracked changes on a regular basis, and would much rather this be 
treated as "maybe difficult but important to get right" than "too hard, 
so don't bother"


[...]

P.S. As I do switch frequently between "show" and "don't show" changes, 
being bothered with a dialog warning that my undo history is going to 
die each time actually sounds like the worst possible thing (for the 
workflow)




___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Bug 83260

2018-01-03 Thread Matthew J. Francis

On 03/01/2018 17:42, Miklos Vajna wrote:

Hi,

On Fri, Dec 22, 2017 at 06:56:53AM +, Yemelyanenko Fyodor 
 wrote:

For now I see 2 possible solutions:
1. Rewrite redlining, so Show option will change how doc is viewed, but
not how it is formed (list of nodes)
2. When toggling change tracking or show option ON/OFF - clean
Undo/Redo.

For now, I prefer option 2 :-)

Do we need to warn user, that we going to purge Undo/Redo (say, by
displaying some warning?)
Any additional suggestions will be appreciated.


We raise a similar warning when deleting a header, you can probably
reuse that code here. And sure, clearing the undo stack instead of
crashing sounds like an improvement (especially if we ask the user
before clearing the undo stack).


I use tracked changes on a regular basis, and would much rather this be 
treated as "maybe difficult but important to get right" than "too hard, 
so don't bother"


When editing a document with tracks, I frequently switch between viewing 
changes and not (alternating focus between "what exactly has been 
changed" and "what the final text should look like"). Not also being 
able to undo at arbitrary times, if for instance I decide after 
switching to "reviewing final text" for a section that I would prefer to 
go back and start again another way, would be a major annoyance in the 
process.
I can't say for certain if other people use the feature the same way, 
but I doubt it's that uncommon as a use case.



Perhaps a few well placed unit tests would clarify what the invariants 
are that should hold in this case, but don't? There must be a middle 
ground to be found between "painful major refactoring/rewrite" and "rip 
it out altogether"


Regards
Matthew Francis
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How to run multiple instances of Writer simultaneously?

2017-10-19 Thread Matthew J. Francis

On 20/10/2017 10:04, Jens Tröger wrote:


Also, I have performance concerns for this approach: loading and running 
through just two documents simultaneously seemed to be unproportionally slow!?


As I mentioned before, while a single LO process can serve multiple 
clients simultaneously, and with low latency for starting a request, it 
will likely struggle to fully utilise all the threads of a modern CPU.


I believe you still haven't mentioned what the specific use case you're 
trying to achieve is - what are its requirements for interactiveness 
and/or throughput? (i.e. is it an interactive process that will 
primarily require low latency, a bulk process that requires high overall 
throughput but may not mind if individual requests are delayed for a 
short time, or something that requires both low request latency and high 
throughput?)


If you need both the lowest request latency and the highest throughput 
on a single machine, you may need to try adopting a hybrid model - start 
a pool of independent LO instances of an appropriate size for your 
number of CPU threads, then feed them jobs one at a time each. There is 
definitely no canned answer for this, so you would have to do your own 
benchmarking and tuning to find the optimum pool size for the resources 
of your local machine.


Regards
Matthew Francis
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How to run multiple instances of Writer simultaneously?

2017-10-19 Thread Matthew J. Francis

On 19/10/2017 17:09, Jens Tröger wrote:

Thanks Matthew!

That’s close to what I’m using. However, would you mind sharing your “close 
document” code, as well as shutting down the soffice process?

In that context, it looks like you’re using the soffice process as the server? How 
about projects like listed in this question: 
https://forum.openoffice.org/en/forum/viewtopic.php?f=20=75523  What about 
scalability as per this question: 
https://forum.openoffice.org/en/forum/viewtopic.php?f=6=74002

Thank you,
Jens


Well, in the context of the previously included code, cleanup was a 
matter of:


  os.killpg(os.getpgid(proc.pid), signal.SIGKILL)
  shutil.rmtree (tempDir)

which is I think not what you want - it was purely used to run a test, 
then terminated with prejudice when the result was known.


Something like you mentioned earlier should be sufficient to make the 
instance (one soffice.bin and wrapper script) go away cleanly in the 
normal case:


  document.close(True)
  desktop.terminate()


Whether running a persistent server process instead would suit your 
needs better is something you'll have to test with your actual use case. 
Without knowing exactly what it is you're trying to achieve, I can only 
speculate in general terms:
On the one hand, running everything through a persistent LO instance as 
server will give you reasonably low latency if it's something time 
sensitive, but it may struggle to make use of the ample threads of 
modern processors if there are many parallel requests to service; on the 
other hand, running everything on individual, isolated instances means 
you will incur a relatively high fixed cost for each startup (even with 
cached user profiles, it will still take some time to load a whole new 
LO), but may ultimately scale to use CPU resources better if each 
individual transaction is fairly long running and CPU intensive.


Regards
Matthew Francis
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2015-10-16 Thread Matthew J . Francis
 include/toolkit/helper/vclunohelper.hxx   |4 +
 offapi/UnoApi_offapi.mk   |1 
 offapi/com/sun/star/awt/XToolkitRobot.idl |   40 
 toolkit/source/awt/vclxtoolkit.cxx|   99 ++
 toolkit/source/helper/vclunohelper.cxx|   20 ++
 5 files changed, 164 insertions(+)

New commits:
commit 59c38539bcabf3a5c949745ff8f501ed7c98a528
Author: Matthew J. Francis <mjay.fran...@gmail.com>
Date:   Sat Oct 3 04:31:48 2015 +0800

Allow injection of keyboard and mouse events through UNO

Change-Id: I3d139c6378f5274be1e7bfd88f72d1576c13243d
Reviewed-on: https://gerrit.libreoffice.org/19321
Reviewed-by: Matthew Francis <mjay.fran...@gmail.com>
Tested-by: Matthew Francis <mjay.fran...@gmail.com>

diff --git a/include/toolkit/helper/vclunohelper.hxx 
b/include/toolkit/helper/vclunohelper.hxx
index 0b3e944..a03e896 100644
--- a/include/toolkit/helper/vclunohelper.hxx
+++ b/include/toolkit/helper/vclunohelper.hxx
@@ -145,11 +145,15 @@ public:
 const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XInterface >& _rxContext
 );
 
+static ::MouseEvent createVCLMouseEvent( const 
::com::sun::star::awt::MouseEvent& _rAwtEvent );
+
 static ::com::sun::star::awt::KeyEvent
 createKeyEvent(
 const ::KeyEvent& _rVclEvent,
 const ::com::sun::star::uno::Reference< 
::com::sun::star::uno::XInterface >& _rxContext
 );
+
+static ::KeyEvent createVCLKeyEvent( const 
::com::sun::star::awt::KeyEvent& _rAwtEvent );
 };
 
 
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 0ede4c2..c8880078ed 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -1889,6 +1889,7 @@ $(eval $(call 
gb_UnoApi_add_idlfiles,offapi,com/sun/star/awt,\
XToolkit \
XToolkit2 \
XToolkitExperimental \
+   XToolkitRobot \
XTopWindow \
XTopWindow2 \
XTopWindowListener \
diff --git a/offapi/com/sun/star/awt/XToolkitRobot.idl 
b/offapi/com/sun/star/awt/XToolkitRobot.idl
new file mode 100644
index 000..a7b430d
--- /dev/null
+++ b/offapi/com/sun/star/awt/XToolkitRobot.idl
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __com_sun_star_awt_XToolkitRobot_idl__
+#define __com_sun_star_awt_XToolkitRobot_idl__
+
+#include 
+#include 
+
+module com {  module sun {  module star {  module awt {
+
+/** Allows injection of keyboard and mouse events
+ */
+
+interface XToolkitRobot
+{
+
+void keyPress( [in] com::sun::star::awt::KeyEvent aKeyEvent );
+
+void keyRelease( [in] com::sun::star::awt::KeyEvent aKeyEvent );
+
+void mousePress( [in] com::sun::star::awt::MouseEvent aMouseEvent );
+
+void mouseRelease( [in] com::sun::star::awt::MouseEvent aMouseEvent );
+
+void mouseMove( [in] com::sun::star::awt::MouseEvent aMouseEvent );
+
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/awt/vclxtoolkit.cxx 
b/toolkit/source/awt/vclxtoolkit.cxx
index 31ed8c4..f97be03 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -149,6 +150,7 @@ protected:
 class VCLXToolkit : public VCLXToolkitMutexHelper,
 public cppu::WeakComponentImplHelper<
 css::awt::XToolkitExperimental,
+css::awt::XToolkitRobot,
 css::lang::XServiceInfo >
 {
 css::uno::Reference< css::datatransfer::clipboard::XClipboard > 
mxClipboard;
@@ -277,6 +279,23 @@ public:
 // css::awt::XReschedule:
 virtual void SAL_CALL reschedule()
 throw (css::uno::RuntimeException, std::exception) override;
+
+// css:awt:XToolkitRobot
+virtual void SAL_CALL keyPress( const css::awt::KeyEvent & aKeyEvent )
+throw (css::uno::RuntimeException, std::exception) override;
+
+virtual void SAL_CALL keyRelease( const css::awt::KeyEvent & aKeyEvent )
+throw (css::uno::RuntimeException, std::exception) override;
+
+virtual void SAL_CALL mousePress( const css::awt::MouseEvent & aMouseEvent 
)
+throw (css::uno::RuntimeException, std::exception) override;
+
+virtual void SAL_CALL mouseRelease( const css::awt::MouseEvent & 
aMouseEvent )
+throw (css::uno::RuntimeException, std::exception) override;
+
+virtual void SAL_CALL mouseMove( const css::awt::MouseEvent & aMouseEvent )
+throw (css::uno::RuntimeException, std::exception) override;
+

Re: Enum types in IDL and in code

2015-08-07 Thread Matthew J. Francis

On 07/08/2015 16:00, Miklos Vajna wrote:

Hi,

On Fri, Aug 07, 2015 at 01:07:52PM +0800, Matthew J. Francis 
mjay.fran...@gmail.com wrote:

Mainly the latter confusion. The problem the user I was discussing this
with had was that when trying to develop using such an interface you
have no idea what the value you receive from it is unless you can find
it in the IDL, and when you do so it suggests that it should have been
an actual enum to begin with.


If the IDL documentation and the actual code differs in such enum vs int
types, I think the best would be to adjust the documentation to match
the code, and not the other way around.


How specifically should that be changed, though. In this case, merely
changing the declared type to short would leave it such that its value
is defined by the set of integer values of an enum, which is still
annoying in terms of manipulation using PyUNO and peculiar in terms of
the IDL.

An equivalent constant group could be added, although that would be not
ideal in a different way - the original enum definition couldn't be
removed, as it may still be used for instance by existing Python code
to blindly assign values to the property.

Any advance then on the idea of:
- Making the declared type short
- Adding a constant group for it
- Deprecating the enum

I note that for this particular case, css::report::XReportControlFormat
declares a ParaAdjust attribute which is actually a short - the
documentation would need changing there to reference the new constant
group, but not the definition.

Regards
Matthew Francis

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Enum types in IDL and in code

2015-08-07 Thread Matthew J. Francis

On 07/08/2015 17:32, Miklos Vajna wrote:

Hi,

On Fri, Aug 07, 2015 at 04:52:36PM +0800, Matthew J. Francis 
mjay.fran...@gmail.com wrote:

How specifically should that be changed, though. In this case, merely
changing the declared type to short would leave it such that its value
is defined by the set of integer values of an enum, which is still
annoying in terms of manipulation using PyUNO and peculiar in terms of
the IDL.


If the documentation says that this is a short, exact possible values
are defined here and there, I don't see that worse than the current
situation. :-)


It's not worse, but also not by itself a solution for an important part
of the problem, which is that you currently can't compare a value from
this property with anything in PyUNO - only assign blindly to the
property (unless you go to the trouble of defining your own constants
from reading the IDL)

If there's a constant group, since a recent change you can

  import something.Group

then

  if obj.SomeProperty == Group.VALUE: ...


If there isn't, I'll have to also do something similar to make Enums
aware of their value set (which may be a good idea anyway), and make
them int-comparable as mentioned previously (which is ickier, Python
avoids doing this in its more recently added native Enum class - you
have to explicitly use an IntEnum for that).

[...]


In case all other ParaAdjust implementations (I'm sure at least editeng
has one) also deal with a sal_Int16 in fact, then just changing
'[property] com::sun::star::style::ParagraphAdjust ParaAdjust;' to
'[property] short ParaAdjust;' in the IDL file (and using a comment to
still refer to the enumeration informally) would make sense, I think.
Even if the in-build check complains that this is nominally an
incompatible change.


Unfortunately it looks like this may not be the case.
chart2/source/model/main/Title.cxx / 
offapi/com/sun/star/chart2/Title.idl look suspicious for one. If 
different implementations of the ParagraphProperties service disagree 
about the real type, then I don't see a way to make everything 
consistent compatibly.



Regards
Matthew Francis

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: reminder: please add API CHANGE to commit message if you change the API incompatibly

2015-08-06 Thread Matthew J. Francis

On 30/07/2015 20:04, Michael Stahl wrote:

* Python PyUNO
   pyuno/


I think we discussed this the last time I changed it - the external C++
interface in pyuno/inc/pyuno/pyuno.hxx shouldn't be considered really
public, and its comment explicitly states

This interface is somewhat private and my change in future.

I can mark any future changes to it that way if you'd like, but
anything outside core LibreOffice still shouldn't depend on it for
binary compatibility. Given that it seems to exist solely to allow
PyUNO itself to be compiled as a (bundled) library, it's hard in any
case to imagine how or why anyone would use it for anything else.


Regards
Matthew Francis

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Enum types in IDL and in code

2015-08-06 Thread Matthew J. Francis

On 05/08/2015 21:13, Stephan Bergmann wrote:

Old-style services that only list a bunch of properties, like
css.style.ParagraphProperties, are mainly glorified documentation,
telling a human that a UNO object documented to support that service is
supposed to support an XProperty of the given name and type.

I am not aware that PyUNO nor the underlying UNO reflection/invocation
facility actually make use of this information (but may well be wrong).

So when you say that this is confusing for PyUNO, do you mean it is
causing trouble somewhere in the innards of PyUNO (i.e., PyUNO or the
underlying reflection/invocation is making use of the old-style
properties-only service information after all), or do you mean it is
causing trouble at the level of a Python program written assuming that
reading some ParaAdjust value would provide some Enum value while in
fact it provies an integer value (i.e., it is the author of the Python
program who gets fooled by the inaccurate ParagraphProperties.idl file)?


Mainly the latter confusion. The problem the user I was discussing this
with had was that when trying to develop using such an interface you
have no idea what the value you receive from it is unless you can find
it in the IDL, and when you do so it suggests that it should have been
an actual enum to begin with.

As mentioned, there's currently no property of the Python Enum class or
instance that tells you what its integer value(s) might be. Ideally
these would be pointless to know in this context, though I could add a
way to get them - just not sure how much improvement in usability this
would be.

Alternatively or as well, it might be possible to transform such
almost but not quite enums into proper Enum instances by paying
attention to the interface definition rather than only the yielded
values. As you rightly point out, nothing currently does. However, this
would seem quite inelegant unless there are at least several such cases
- I'd be interested to know if there are any more.
(Making the PyUNO Enum comparable to integers would avoid this being a
change in behaviour to existing code)

Regards
Matthew Francis





___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: pyuno/Library_pyuno.mk pyuno/source

2015-07-29 Thread Matthew J . Francis
 pyuno/Library_pyuno.mk|1 
 pyuno/source/module/pyuno.cxx |  111 +
 pyuno/source/module/pyuno_impl.hxx|9 
 pyuno/source/module/pyuno_module.cxx  |4 
 pyuno/source/module/pyuno_runtime.cxx |   34 +-
 pyuno/source/module/pyuno_struct.cxx  |  393 ++
 6 files changed, 438 insertions(+), 114 deletions(-)

New commits:
commit 2387c2a46e15995686d28dccdfd455012072b4cf
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Wed Jul 29 15:22:54 2015 +0800

Give PyUNO structs/exceptions their own separate type

Change-Id: Ie4c42c623fae1cf39c2e4c643825c9655cd28daa
Reviewed-on: https://gerrit.libreoffice.org/17410
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/pyuno/Library_pyuno.mk b/pyuno/Library_pyuno.mk
index 3bf08cc..49c5b91 100644
--- a/pyuno/Library_pyuno.mk
+++ b/pyuno/Library_pyuno.mk
@@ -38,6 +38,7 @@ $(eval $(call gb_Library_use_externals,pyuno,\
 $(eval $(call gb_Library_add_exception_objects,pyuno,\
 pyuno/source/module/pyuno_runtime \
 pyuno/source/module/pyuno \
+pyuno/source/module/pyuno_struct \
 pyuno/source/module/pyuno_callable \
 pyuno/source/module/pyuno_module \
 pyuno/source/module/pyuno_type \
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index ccab344..9e9274ab 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -376,26 +376,7 @@ bool lcl_hasInterfaceByName( Any const object, OUString 
const  interfaceName )
 
 PyObject *PyUNO_repr( PyObject  * self )
 {
-PyUNO *me = reinterpret_castPyUNO *(self);
-PyObject * ret = 0;
-
-if( me-members-wrappedObject.getValueType().getTypeClass()
-== com::sun::star::uno::TypeClass_EXCEPTION )
-{
-Reference XMaterialHolder  
rHolder(me-members-xInvocation,UNO_QUERY);
-if( rHolder.is() )
-{
-Any a = rHolder-getMaterial();
-Exception e;
-a = e;
-ret = ustring2PyUnicode(e.Message ).getAcquired();
-}
-}
-else
-{
-ret = PyUNO_str( self );
-}
-return ret;
+return PyUNO_str( self );
 }
 
 Py_hash_t PyUNO_hash( PyObject *self )
@@ -405,20 +386,8 @@ Py_hash_t PyUNO_hash( PyObject *self )
 
 // Py_hash_t is not necessarily the same size as a pointer, but this is not
 // important for hashing - it just has to return the same value each time
-if( me-members-wrappedObject.getValueType().getTypeClass()
-== com::sun::star::uno::TypeClass_STRUCT ||
-me-members-wrappedObject.getValueType().getTypeClass()
-== com::sun::star::uno::TypeClass_EXCEPTION )
-{
-Reference XMaterialHolder  xMe( me-members-xInvocation, UNO_QUERY 
);
-return sal::static_int_cast Py_hash_t ( reinterpret_cast sal_IntPtr 
 (
-*static_castvoid * const *(xMe-getMaterial().getValue()) ) );
-}
-else
-{
-return sal::static_int_cast Py_hash_t ( reinterpret_cast sal_IntPtr 
 (
-*static_castvoid * const 
*(me-members-wrappedObject.getValue()) ) );
-}
+return sal::static_int_cast Py_hash_t ( reinterpret_cast sal_IntPtr  (
+*static_castvoid * const *(me-members-wrappedObject.getValue()) ) 
);
 
 }
 
@@ -501,24 +470,7 @@ PyObject *PyUNO_str( PyObject * self )
 
 OStringBuffer buf;
 
-
-if( me-members-wrappedObject.getValueType().getTypeClass()
-== com::sun::star::uno::TypeClass_STRUCT ||
-me-members-wrappedObject.getValueType().getTypeClass()
-== com::sun::star::uno::TypeClass_EXCEPTION)
-{
-Reference XMaterialHolder  
rHolder(me-members-xInvocation,UNO_QUERY);
-if( rHolder.is() )
-{
-PyThreadDetach antiguard;
-Any a = rHolder-getMaterial();
-OUString s = val2str( a.getValue(), 
a.getValueType().getTypeLibType() );
-buf.append( OUStringToOString(s,RTL_TEXTENCODING_ASCII_US) );
-}
-}
-else
 {
-// a common UNO object
 PyThreadDetach antiguard;
 buf.append( pyuno object  );
 
@@ -527,7 +479,7 @@ PyObject *PyUNO_str( PyObject * self )
 buf.append( OUStringToOString(s,RTL_TEXTENCODING_ASCII_US) );
 }
 
-return PyStr_FromString( buf.getStr());
+return PyStr_FromString( buf.getStr() );
 }
 
 PyObject* PyUNO_dir (PyObject* self)
@@ -1447,18 +1399,15 @@ PyObject* PyUNO_getattr (PyObject* self, char* name)
 }
 if (strcmp (name, __class__) == 0)
 {
-if( me-members-wrappedObject.getValueTypeClass() ==
-com::sun::star::uno::TypeClass_STRUCT ||
-me-members-wrappedObject.getValueTypeClass() ==
-com::sun::star::uno::TypeClass_EXCEPTION )
-{
-return getClass(
-me-members-wrappedObject.getValueType().getTypeName(), 
runtime ).getAcquired

[Libreoffice-commits] core.git: pyuno/source stoc/source

2015-07-27 Thread Matthew J . Francis
 pyuno/source/module/pyuno.cxx |   95 +++-
 pyuno/source/module/pyuno_adapter.cxx |   27 
 pyuno/source/module/pyuno_impl.hxx|9 -
 pyuno/source/module/pyuno_module.cxx  |4 
 pyuno/source/module/pyuno_runtime.cxx |   22 +--
 stoc/source/inspect/introspection.cxx |  193 --
 stoc/source/invocation/invocation.cxx |   50 +++-
 7 files changed, 288 insertions(+), 112 deletions(-)

New commits:
commit 9c5a217681935d661aad4d5667a775319382d22a
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Thu Jul 23 11:36:38 2015 +0800

Tweak introspection/invocation to be more useful to PyUNO

- Make introspection/invocation handle XNameReplace and
  XIndexReplace
- Make introspection handle XUnoTunnel
- Adapt PyUNO to take advantage of the additionally handled
  interfaces

Change-Id: Ie848d10fd2c31cad76fcc3a746262a490a2c9ae1
Reviewed-on: https://gerrit.libreoffice.org/17314
Reviewed-by: Matthew Francis mjay.fran...@gmail.com
Tested-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index f068961..ccab344 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -60,6 +60,7 @@ using com::sun::star::uno::XComponentContext;
 using com::sun::star::lang::XSingleServiceFactory;
 using com::sun::star::lang::XServiceInfo;
 using com::sun::star::lang::XTypeProvider;
+using com::sun::star::lang::XUnoTunnel;
 using com::sun::star::script::XTypeConverter;
 using com::sun::star::script::XInvocation2;
 using com::sun::star::beans::XMaterialHolder;
@@ -563,7 +564,7 @@ sal_Int32 lcl_detach_getLength( PyUNO *me )
 // returned by getElementNames(), or the user may be surprised.
 
 // For XIndexContainer
-Reference XIndexAccess  xIndexAccess( me-members-wrappedObject, 
UNO_QUERY );
+Reference XIndexAccess  xIndexAccess( me-members-xInvocation, 
UNO_QUERY );
 if ( xIndexAccess.is() )
 {
 return xIndexAccess-getCount();
@@ -571,7 +572,7 @@ sal_Int32 lcl_detach_getLength( PyUNO *me )
 
 // For XNameContainer
 // Not terribly efficient - get the count of all the names
-Reference XNameAccess  xNameAccess( me-members-wrappedObject, 
UNO_QUERY );
+Reference XNameAccess  xNameAccess( me-members-xInvocation, UNO_QUERY 
);
 if ( xNameAccess.is() )
 {
 return xNameAccess-getElementNames().getLength();
@@ -782,7 +783,7 @@ PyObject* lcl_getitem_index( PyUNO *me, PyObject *pKey, 
Runtime runtime )
 {
 PyThreadDetach antiguard;
 
-Reference XIndexAccess  xIndexAccess( me-members-wrappedObject, 
UNO_QUERY );
+Reference XIndexAccess  xIndexAccess( me-members-xInvocation, 
UNO_QUERY );
 if ( xIndexAccess.is() )
 {
 if (nIndex  0)
@@ -809,7 +810,7 @@ PyObject* lcl_getitem_slice( PyUNO *me, PyObject *pKey )
 {
 PyThreadDetach antiguard;
 
-xIndexAccess.set( me-members-wrappedObject, UNO_QUERY );
+xIndexAccess.set( me-members-xInvocation, UNO_QUERY );
 if ( xIndexAccess.is() )
 nLen = xIndexAccess-getCount();
 }
@@ -850,7 +851,7 @@ PyObject* lcl_getitem_string( PyUNO *me, PyObject *pKey, 
Runtime runtime )
 {
 PyThreadDetach antiguard;
 
-Reference XNameAccess  xNameAccess( me-members-wrappedObject, 
UNO_QUERY );
+Reference XNameAccess  xNameAccess( me-members-xInvocation, 
UNO_QUERY );
 if ( xNameAccess.is() )
 {
 aRet = xNameAccess-getByName( sKey );
@@ -914,8 +915,8 @@ PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
 // If the object is an XIndexAccess and/or XNameAccess, but the
 // key passed wasn't suitable, give a TypeError which specifically
 // describes this
-Reference XIndexAccess  xIndexAccess( me-members-wrappedObject, 
UNO_QUERY );
-Reference XNameAccess  xNameAccess( me-members-wrappedObject, 
UNO_QUERY );
+Reference XIndexAccess  xIndexAccess( me-members-xInvocation, 
UNO_QUERY );
+Reference XNameAccess  xNameAccess( me-members-xInvocation, 
UNO_QUERY );
 if ( xIndexAccess.is() || xNameAccess.is() )
 {
 PyErr_SetString( PyExc_TypeError, subscription with invalid type 
);
@@ -985,11 +986,11 @@ int lcl_setitem_index( PyUNO *me, PyObject *pKey, 
PyObject *pValue )
 {
 PyThreadDetach antiguard;
 
-xIndexContainer.set( me-members-wrappedObject, UNO_QUERY );
+xIndexContainer.set( me-members-xInvocation, UNO_QUERY );
 if ( xIndexContainer.is() )
 xIndexReplace.set( xIndexContainer, UNO_QUERY );
 else
-xIndexReplace.set( me-members-wrappedObject, UNO_QUERY );
+xIndexReplace.set( me-members-xInvocation, UNO_QUERY );
 
 if ( xIndexReplace.is()  nIndex  0 )
 nIndex += xIndexReplace-getCount();
@@ -1032,11 +1033,11 @@ int

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

2015-07-24 Thread Matthew J . Francis
 pyuno/source/module/pyuno.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3458a252022af241f364a9d49c458180442ebd07
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Fri Jul 24 23:50:45 2015 +0800

Fix PyUNO object hash to use the correct pointer

Change-Id: Id93cba88eaf0dca0784051507809bc849d046a03
Reviewed-on: https://gerrit.libreoffice.org/17337
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 20e2f9f..f068961 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -411,12 +411,12 @@ Py_hash_t PyUNO_hash( PyObject *self )
 {
 Reference XMaterialHolder  xMe( me-members-xInvocation, UNO_QUERY 
);
 return sal::static_int_cast Py_hash_t ( reinterpret_cast sal_IntPtr 
 (
-xMe-getMaterial().getValue() ) );
+*static_castvoid * const *(xMe-getMaterial().getValue()) ) );
 }
 else
 {
 return sal::static_int_cast Py_hash_t ( reinterpret_cast sal_IntPtr 
 (
-me-members-wrappedObject.getValue() ) );
+*static_castvoid * const 
*(me-members-wrappedObject.getValue()) ) );
 }
 
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-22 Thread Matthew J . Francis
 stoc/source/inspect/introspection.cxx |  238 ++
 stoc/source/invocation/invocation.cxx |   50 +++
 2 files changed, 128 insertions(+), 160 deletions(-)

New commits:
commit e412e16d56caf426bac04c7e5966e2a9efa7c408
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Mon Jul 13 09:28:52 2015 +0800

Merge ImplIntrospectionAccess and ImplIntrospectionAdapter

This eliminates a lifecycle error which caused an instance
of ImplIntrospectionAdapter to be created on every failing
call to ImplIntrospectionAccess::queryAdapter(), rather than
only once, due to an incorrectly conceived weak reference
relationship between the two.

Change-Id: If0c7c906acadfd7f81a0ce9e7f7a949154494720
Reviewed-on: https://gerrit.libreoffice.org/16972
Reviewed-by: Matthew Francis mjay.fran...@gmail.com
Tested-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/stoc/source/inspect/introspection.cxx 
b/stoc/source/inspect/introspection.cxx
index a74a729..cd621b8 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -35,7 +35,7 @@
 #include cppuhelper/weak.hxx
 #include cppuhelper/component.hxx
 #include cppuhelper/factory.hxx
-#include cppuhelper/implbase3.hxx
+#include cppuhelper/implbase.hxx
 #include cppuhelper/supportsservice.hxx
 #include cppuhelper/typeprovider.hxx
 #include salhelper/simplereferenceobject.hxx
@@ -83,7 +83,10 @@ using namespace osl;
 namespace
 {
 
-typedef WeakImplHelper3 XIntrospectionAccess, XMaterialHolder, XExactName  
IntrospectionAccessHelper;
+typedef WeakImplHelper XIntrospectionAccess, XMaterialHolder, XExactName,
+XPropertySet, XFastPropertySet, XPropertySetInfo,
+XNameContainer, XIndexContainer, XEnumerationAccess,
+XIdlArray  IntrospectionAccessHelper;
 
 
 
@@ -162,7 +165,6 @@ class IntrospectionAccessStatic_Impl: public 
salhelper::SimpleReferenceObject
 {
 friend class Implementation;
 friend class ImplIntrospectionAccess;
-friend class ImplIntrospectionAdapter;
 
 // Holding CoreReflection
 Reference XIdlReflection  mxCoreReflection;
@@ -700,9 +702,6 @@ class ImplIntrospectionAccess : public 
IntrospectionAccessHelper
 // Static introspection data
 rtl::Reference IntrospectionAccessStatic_Impl  mpStaticImpl;
 
-// Adapter-Implementation
-WeakReference XInterface  maAdapter;
-
 // Last Sequence that came with getProperties (optimization)
 SequenceProperty maLastPropertySeq;
 sal_Int32 mnLastPropertyConcept;
@@ -711,6 +710,26 @@ class ImplIntrospectionAccess : public 
IntrospectionAccessHelper
 SequenceReferenceXIdlMethod  maLastMethodSeq;
 sal_Int32 mnLastMethodConcept;
 
+// Guards the caching of queried interfaces
+osl::Mutex m_aMutex;
+
+// Original interfaces of the objects
+ReferenceXElementAccess   mxObjElementAccess;
+ReferenceXNameContainer   mxObjNameContainer;
+ReferenceXNameAccess  mxObjNameAccess;
+ReferenceXIndexAccess mxObjIndexAccess;
+ReferenceXIndexContainer  mxObjIndexContainer;
+ReferenceXEnumerationAccess   mxObjEnumerationAccess;
+ReferenceXIdlArraymxObjIdlArray;
+
+ReferenceXElementAccess   getXElementAccess();
+ReferenceXNameContainer   getXNameContainer();
+ReferenceXNameAccess  getXNameAccess();
+ReferenceXIndexContainer  getXIndexContainer();
+ReferenceXIndexAccess getXIndexAccess();
+ReferenceXEnumerationAccess   getXEnumerationAccess();
+ReferenceXIdlArraygetXIdlArray();
+
 public:
 ImplIntrospectionAccess( const Any obj, rtl::Reference 
IntrospectionAccessStatic_Impl  const  pStaticImpl_ );
 virtual ~ImplIntrospectionAccess();
@@ -743,75 +762,6 @@ public:
 
 // Methods from XExactName
 virtual OUString SAL_CALL getExactName( const OUString rApproximateName ) 
throw( RuntimeException, std::exception ) SAL_OVERRIDE;
-};
-
-ImplIntrospectionAccess::ImplIntrospectionAccess
-( const Any obj, rtl::Reference IntrospectionAccessStatic_Impl  const  
pStaticImpl_ )
-: maInspectedObject( obj ), mpStaticImpl( pStaticImpl_ ), maAdapter()
-{
-// Remember object as interface if possible
-TypeClass eType = maInspectedObject.getValueType().getTypeClass();
-if( eType == TypeClass_INTERFACE )
-mxIface = *static_castReferenceXInterface const 
*(maInspectedObject.getValue());
-
-mnLastPropertyConcept = -1;
-mnLastMethodConcept = -1;
-}
-
-ImplIntrospectionAccess::~ImplIntrospectionAccess()
-{
-}
-
-
-
-//*** ImplIntrospectionAdapter ***
-
-
-// New Impl class as part of the introspection conversion to instance-bound
-// Introspection with property access via XPropertySet. The old class
-// ImplIntrospectionAccess lives on as IntrospectionAccessStatic_Impl
-class ImplIntrospectionAdapter :
-public XPropertySet, public

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

2015-07-22 Thread Matthew J . Francis
 stoc/source/inspect/introspection.cxx |  113 ++
 1 file changed, 22 insertions(+), 91 deletions(-)

New commits:
commit a37df351c447373bb893ba154bd124d33e43c040
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Fri Jul 10 15:29:22 2015 +0800

Fix logic in the fast path of Implementation::inspect()

- Merge TypeCache and ClassCache
- Don't fill SupportedClassSeq before the fast exit for a
  cache hit
- Do query XPropertySet blind in the degenerate interface case

Change-Id: I3fd8ab4a215f4c217e1a687af679aef4a21b68b9
Reviewed-on: https://gerrit.libreoffice.org/16921
Reviewed-by: Matthew Francis mjay.fran...@gmail.com
Tested-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/stoc/source/inspect/introspection.cxx 
b/stoc/source/inspect/introspection.cxx
index 497d9e2..a74a729 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -197,7 +197,6 @@ class IntrospectionAccessStatic_Impl: public 
salhelper::SimpleReferenceObject
 
 // Flags which indicate if various interfaces are present
 bool mbFastPropSet;
-bool mbPropertySet;
 bool mbElementAccess;
 bool mbNameAccess;
 bool mbNameContainer;
@@ -270,7 +269,6 @@ 
IntrospectionAccessStatic_Impl::IntrospectionAccessStatic_Impl( Reference XIdlR
 maPropertyConceptSeq.realloc( ARRAY_SIZE_STEP );
 
 mbFastPropSet = false;
-mbPropertySet = false;
 mbElementAccess = false;
 mbNameAccess = false;
 mbNameContainer = false;
@@ -1499,55 +1497,6 @@ OUString ImplIntrospectionAccess::getExactName( const 
OUString rApproximateName
 return aRetStr;
 }
 
-struct ClassKey {
-ClassKey(
-css::uno::Referencecss::beans::XPropertySetInfo const  
theProperties,
-css::uno::Referencecss::reflection::XIdlClass const 
-theImplementation,
-css::uno::Sequence css::uno::Referencecss::reflection::XIdlClass 
-const  theClasses):
-properties(theProperties), implementation(theImplementation),
-classes(theClasses)
-{}
-
-css::uno::Referencecss::beans::XPropertySetInfo properties;
-css::uno::Referencecss::reflection::XIdlClass implementation;
-css::uno::Sequence css::uno::Referencecss::reflection::XIdlClass 
-classes;
-};
-
-struct ClassKeyLess {
-bool operator ()(ClassKey const  key1, ClassKey const  key2) const {
-if (key1.properties.get()  key2.properties.get()) {
-return true;
-}
-if (key1.properties.get()  key2.properties.get()) {
-return false;
-}
-if (key1.implementation.get()  key2.implementation.get()) {
-return true;
-}
-if (key1.implementation.get()  key2.implementation.get()) {
-return false;
-}
-if (key1.classes.getLength()  key2.classes.getLength()) {
-return true;
-}
-if (key1.classes.getLength()  key2.classes.getLength()) {
-return false;
-}
-for (sal_Int32 i = 0; i != key1.classes.getLength(); ++i) {
-if (key1.classes[i].get()  key2.classes[i].get()) {
-return true;
-}
-if (key1.classes[i].get()  key2.classes[i].get()) {
-return false;
-}
-}
-return false;
-}
-};
-
 struct TypeKey {
 TypeKey(
 css::uno::Referencecss::beans::XPropertySetInfo const  
theProperties,
@@ -1653,7 +1602,6 @@ private:
 virtual void SAL_CALL disposing() SAL_OVERRIDE {
 osl::MutexGuard g(m_aMutex);
 reflection_.clear();
-classCache_.clear();
 typeCache_.clear();
 }
 
@@ -1679,7 +1627,6 @@ private:
 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
 css::uno::Referencecss::reflection::XIdlReflection reflection_;
-CacheClassKey, ClassKeyLess classCache_;
 CacheTypeKey, TypeKeyLess typeCache_;
 };
 
@@ -1731,10 +1678,8 @@ css::uno::Referencecss::beans::XIntrospectionAccess 
Implementation::inspect(
 Sequence ReferenceXIdlClass SupportedClassSeq;
 Sequence Type SupportedTypesSeq;
 ReferenceXTypeProviderxTypeProvider;
-ReferenceXIdlClassxImplClass;
 ReferenceXPropertySetInfoxPropSetInfo;
 ReferenceXPropertySetxPropSet;
-boolbHasPropertySet = false;
 
 // Look for interfaces XTypeProvider and PropertySet
 if( eType == TypeClass_INTERFACE )
@@ -1746,66 +1691,46 @@ css::uno::Referencecss::beans::XIntrospectionAccess 
Implementation::inspect(
 sal_Int32 nTypeCount = SupportedTypesSeq.getLength();
 if( nTypeCount )
 {
-SupportedClassSeq.realloc( nTypeCount );
-ReferenceXIdlClass* pClasses = SupportedClassSeq.getArray();
-
 const Type* pTypes

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

2015-07-21 Thread Matthew J . Francis
 pyuno/source/module/pyuno.cxx |   26 +-
 1 file changed, 25 insertions(+), 1 deletion(-)

New commits:
commit a781abe326b45573eb677030358c362394e2bc09
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Tue Jul 21 09:58:44 2015 +0800

Make PyUNO objects hashable

This allows them to be used as set members and dict keys

Change-Id: I10bd71788be6b508c6f491a27a8841e599e47e3a
Reviewed-on: https://gerrit.libreoffice.org/17248
Reviewed-by: Matthew Francis mjay.fran...@gmail.com
Tested-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 413cc20..20e2f9f 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -397,6 +397,30 @@ PyObject *PyUNO_repr( PyObject  * self )
 return ret;
 }
 
+Py_hash_t PyUNO_hash( PyObject *self )
+{
+
+PyUNO *me = reinterpret_castPyUNO *(self);
+
+// Py_hash_t is not necessarily the same size as a pointer, but this is not
+// important for hashing - it just has to return the same value each time
+if( me-members-wrappedObject.getValueType().getTypeClass()
+== com::sun::star::uno::TypeClass_STRUCT ||
+me-members-wrappedObject.getValueType().getTypeClass()
+== com::sun::star::uno::TypeClass_EXCEPTION )
+{
+Reference XMaterialHolder  xMe( me-members-xInvocation, UNO_QUERY 
);
+return sal::static_int_cast Py_hash_t ( reinterpret_cast sal_IntPtr 
 (
+xMe-getMaterial().getValue() ) );
+}
+else
+{
+return sal::static_int_cast Py_hash_t ( reinterpret_cast sal_IntPtr 
 (
+me-members-wrappedObject.getValue() ) );
+}
+
+}
+
 PyObject *PyUNO_invoke( PyObject *object, const char *name , PyObject *args )
 {
 PyRef ret;
@@ -1690,7 +1714,7 @@ static PyTypeObject PyUNOType =
 PyUNONumberMethods,
 PyUNOSequenceMethods,
 PyUNOMappingMethods,
-nullptr,
+PyUNO_hash,
 nullptr,
 PyUNO_str,
 nullptr,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Enum types in IDL and in code

2015-07-20 Thread Matthew J. Francis

The ParagraphProperties service contains, among other things, the
properties:

com::sun::star::style::ParagraphAdjust  ParaAdjust
com::sun::star::style::GraphicLocation  ParaBackGraphicLocation

where ParagraphAdjust and GraphicLocation are both enum types.

However, while reading ParaBackGraphicLocation actually gives an enum
value, ParaAdjust appears to be implemented and handled as a sal_Int16 
(UNO short). This is confusing for PyUNO and presumably anything else 
which relies on inspecting the type of the property.

(Blindly assigning an enum value to this property results in an integer
with the right value being assigned, but the PyUNO Enum doesn't
currently internally contain or know anything about the integer value,
so for instance there's no way to compare the two for equality in Python
code)

Should we:
a) Incompatibly change the most holy IDL
b) Change all the internal code which reads/writes it as a bare integer,
equally risking incompatibility with some unknown external user who
was relying on it being really an integer
c) Suck our teeth and deal with it as a wart at the PyUNO level (though
are there in fact any / many other instances of this? It would be nasty
to add that affordance if this were the only one)
d) Run away screaming

Or, is there some reason why this situation is considered legitimate?


Regards
Matthew Francis
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2015-07-15 Thread Matthew J . Francis
 stoc/source/inspect/introspection.cxx |  469 --
 stoc/source/invocation/invocation.cxx |   26 -
 2 files changed, 247 insertions(+), 248 deletions(-)

New commits:
commit 80cbfb75026f4673b14237650302c3da1cc5ab13
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Thu Jul 16 13:37:15 2015 +0800

Translate German comments

Change-Id: I1d1c66fb2c62a3c6e0c65c2b89efcd8bfd2b87cd

diff --git a/stoc/source/inspect/introspection.cxx 
b/stoc/source/inspect/introspection.cxx
index 2b5f3d6..497d9e2 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -119,13 +119,13 @@ bool isDerivedFrom( ReferenceXIdlClass xToTestClass, 
ReferenceXIdlClass xDer
 #define MAP_PROPERTY_SET0
 // Properties from Fields
 #define MAP_FIELD1
-// Properties, that get described with get/set-Methods
+// Properties that get described with get/set methods
 #define MAP_GETSET2
-// Properties, with only a set-Method
+// Properties with only a set method
 #define MAP_SETONLY3
 
 
-// Increments, in which the size of Sequences get adjusted
+// Increments by which the size of sequences get adjusted
 #define ARRAY_SIZE_STEP20
 
 
@@ -206,7 +206,7 @@ class IntrospectionAccessStatic_Impl: public 
salhelper::SimpleReferenceObject
 bool mbEnumerationAccess;
 bool mbIdlArray;
 
-// Original-Handles of FastPropertySets
+// Original handles of FastPropertySets
 sal_Int32* mpOrgPropertyHandleArray;
 
 // MethodSequence, that accepts all methods
@@ -448,7 +448,7 @@ void 
IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any obj, sal
 }
 
 // Do we have a FastPropertySet and a valid Handle?
-// CAUTION: At this point we exploit, that the PropertySet
+// CAUTION: At this point we exploit that the PropertySet
 // gets queried at the beginning of the Introspection-Process.
 sal_Int32 nOrgHandle;
 if( mbFastPropSet  ( nOrgHandle = mpOrgPropertyHandleArray[ 
nSequenceIndex ] ) != -1 )
@@ -509,7 +509,7 @@ void 
IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any obj, sal
 case MAP_GETSET:
 case MAP_SETONLY:
 {
-// Retrieve set-Methods
+// Fetch set method
 ReferenceXIdlMethod xMethod = 
static_castXIdlMethod*(aInterfaceSeq2.getConstArray()[ nSequenceIndex 
].get());
 if( xMethod.is() )
 {
@@ -539,7 +539,7 @@ Any 
IntrospectionAccessStatic_Impl::getPropertyValueByIndex(const Any obj, sal_
 {
 Any aRet;
 
-// Handelt es sich bei dem uebergebenen Objekt ueberhaupt um was passendes?
+// Is there anything suitable in the passed object?
 TypeClass eObjType = obj.getValueType().getTypeClass();
 
 ReferenceXInterface xInterface;
@@ -558,16 +558,16 @@ Any 
IntrospectionAccessStatic_Impl::getPropertyValueByIndex(const Any obj, sal_
 {
 case MAP_PROPERTY_SET:
 {
-// Property besorgen
+// Acquire property
 const Property rProp = maAllPropertySeq.getConstArray()[ 
nSequenceIndex ];
 
-// Haben wir ein FastPropertySet und ein gueltiges Handle?
-// ACHTUNG: An dieser Stelle wird ausgenutzt, dass das PropertySet
-// zu Beginn des Introspection-Vorgangs abgefragt wird.
+// Do we have a FastPropertySet and a valid handle?
+// NOTE: At this point is exploited that the PropertySet
+// is queried at the beginning of introspection process.
 sal_Int32 nOrgHandle;
 if( mbFastPropSet  ( nOrgHandle = mpOrgPropertyHandleArray[ 
nSequenceIndex ] ) != -1 )
 {
-// PropertySet-Interface holen
+// Fetch the PropertySet interface
 ReferenceXFastPropertySet xFastPropSet =
 ReferenceXFastPropertySet::query( xInterface );
 if( xFastPropSet.is() )
@@ -580,10 +580,10 @@ Any 
IntrospectionAccessStatic_Impl::getPropertyValueByIndex(const Any obj, sal_
 return aRet;
 }
 }
-// sonst eben das normale nehmen
+// Otherwise use the normal one
 else
 {
-// PropertySet-Interface holen
+// Fetch the PropertySet interface
 ReferenceXPropertySet xPropSet =
 ReferenceXPropertySet::query( xInterface );
 if( xPropSet.is() )
@@ -618,7 +618,7 @@ Any 
IntrospectionAccessStatic_Impl::getPropertyValueByIndex(const Any obj, sal_
 
 case MAP_GETSET:
 {
-// get-Methode holen
+// Fetch get method
 ReferenceXIdlMethod xMethod = 
static_castXIdlMethod*(aInterfaceSeq1.getConstArray()[ nSequenceIndex 
].get());
 if( xMethod.is() )
 {
@@ -634,7 +634,7 @@ Any

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

2015-07-09 Thread Matthew J . Francis
 include/svx/charmap.hxx |1 
 svx/source/accessibility/charmapacc.cxx |   45 ++--
 svx/source/dialog/charmap.cxx   |9 ++
 svx/source/inc/charmapacc.hxx   |   14 +
 4 files changed, 66 insertions(+), 3 deletions(-)

New commits:
commit 83b53164b096b4cba94a2e1ee8b620228bee8a3a
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Sun Jul 5 20:37:40 2015 +0800

Add an a11y action for items in the Special Characters dialog

Change-Id: I53fef3f151f66be775655ceef623a7d564c66f1a
Reviewed-on: https://gerrit.libreoffice.org/16771
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
index e56fe98..6538ffd 100644
--- a/include/svx/charmap.hxx
+++ b/include/svx/charmap.hxx
@@ -65,6 +65,7 @@ public:
 int LastInView() const;
 int PixelToMapIndex( const Point) const;
 voidSelectIndex( int index, bool bFocus = false );
+voidOutputIndex( int index );
 voidDeSelect();
 inline bool IsSelected(sal_uInt16 _nPos) const { return 
_nPos == nSelectedIndex; }
 inline sal_uInt16   GetSelectIndexId() const { return 
sal::static_int_castsal_uInt16(nSelectedIndex); }
diff --git a/svx/source/accessibility/charmapacc.cxx 
b/svx/source/accessibility/charmapacc.cxx
index 69aff5d..a959ce6 100644
--- a/svx/source/accessibility/charmapacc.cxx
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -625,8 +625,8 @@ SvxShowCharSetItemAcc::~SvxShowCharSetItemAcc()
 delete getExternalLock();
 }
 
-IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetItemAcc, 
OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetItemAcc, 
OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
+IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetItemAcc, 
OAccessibleComponentHelper, OAccessibleHelper_Base_3 )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetItemAcc, 
OAccessibleComponentHelper, OAccessibleHelper_Base_3 )
 
 
 void SvxShowCharSetItemAcc::ParentDestroyed()
@@ -762,6 +762,47 @@ uno::Reference css::accessibility::XAccessibleStateSet  
SAL_CALL SvxShowCharSe
 return pStateSet;
 }
 
+
+
+sal_Int32 SvxShowCharSetItemAcc::getAccessibleActionCount() throw 
(RuntimeException, std::exception)
+{
+return 1;
+}
+
+
+
+sal_Bool SvxShowCharSetItemAcc::doAccessibleAction ( sal_Int32 nIndex ) throw 
(IndexOutOfBoundsException, RuntimeException, std::exception)
+{
+OExternalLockGuard aGuard( this );
+
+if( nIndex == 0 )
+{
+mpParent-mrParent.OutputIndex( mpParent-mnId );
+return 1;
+}
+throw IndexOutOfBoundsException();
+}
+
+
+
+OUString SvxShowCharSetItemAcc::getAccessibleActionDescription ( sal_Int32 
nIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
+{
+if( nIndex == 0 )
+return OUString( press );
+throw IndexOutOfBoundsException();
+}
+
+
+
+Reference css::accessibility::XAccessibleKeyBinding  
SvxShowCharSetItemAcc::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw 
(css::lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception)
+{
+if( nIndex == 0 )
+return Reference css::accessibility::XAccessibleKeyBinding ();
+throw IndexOutOfBoundsException();
+}
+
+
+
 void SAL_CALL SvxShowCharSetItemAcc::grabFocus()
 throw (uno::RuntimeException, std::exception)
 {
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index b7923ac..2972dbe 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -662,6 +662,15 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, bool 
bFocus )
 
 
 
+void SvxShowCharSet::OutputIndex( int nNewIndex )
+{
+SelectIndex( nNewIndex, true );
+aSelectHdl.Call( this );
+
+}
+
+
+
 void SvxShowCharSet::SelectCharacter( sal_UCS4 cNew, bool bFocus )
 {
 if (mpFontCharMap == nullptr)
diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx
index 1c09cfc..7616ee8 100644
--- a/svx/source/inc/charmapacc.hxx
+++ b/svx/source/inc/charmapacc.hxx
@@ -23,6 +23,7 @@
 #include osl/mutex.hxx
 #include vcl/image.hxx
 #include comphelper/accessibleselectionhelper.hxx
+#include com/sun/star/accessibility/XAccessibleAction.hpp
 #include com/sun/star/accessibility/XAccessibleTable.hpp
 
 #include vector
@@ -209,10 +210,14 @@ namespace svx
 
 // - SvxShowCharSetItemAcc -
 
+typedef ::cppu::ImplHelper2
::com::sun::star::accessibility::XAccessible,
+
::com::sun::star::accessibility::XAccessibleAction
+   OAccessibleHelper_Base_3;
+
 /** The child implementation of the table.
 */
 class SvxShowCharSetItemAcc : public 
::comphelper::OAccessibleComponentHelper

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

2015-07-08 Thread Matthew J . Francis
 stoc/source/inspect/introspection.cxx |  245 +++---
 1 file changed, 199 insertions(+), 46 deletions(-)

New commits:
commit 61b1697069c50ff72339d4592add42ab72b03243
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Mon Jul 6 08:09:24 2015 +0800

Reduce the amount of up front work in performing introspection

Previously, when using PyUNO over a remote bridge, each remote
call which returned an object could result in 50+ further calls
to query interfaces on the result, regardless of whether and
how the object was then used. The majority of these queries
were made under css.script.Invocation to pre-cache certain
information about the returned object.

By making better use of available information to eliminate
interface queries which are certain to fail, and lazily
acquiring those interfaces which are required, remote scripting
is significantly accelerated. In general, this also gives a
small speedup for local scripting.

Change-Id: I4f36da6b5f09cb0d22f21291f05fbea2ae7ae697
Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/stoc/source/inspect/introspection.cxx 
b/stoc/source/inspect/introspection.cxx
index e6b9110..cfa7085 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -162,6 +162,7 @@ class IntrospectionAccessStatic_Impl: public 
salhelper::SimpleReferenceObject
 {
 friend class Implementation;
 friend class ImplIntrospectionAccess;
+friend class ImplIntrospectionAdapter;
 
 // Holding CoreReflection
 Reference XIdlReflection  mxCoreReflection;
@@ -194,8 +195,16 @@ class IntrospectionAccessStatic_Impl: public 
salhelper::SimpleReferenceObject
 sal_Int32 mnAttributePropCount;
 sal_Int32 mnMethodPropCount;
 
-// Flag, if a FastPropertySet is supported
+// Flags which indicate if various interfaces are present
 bool mbFastPropSet;
+bool mbPropertySet;
+bool mbElementAccess;
+bool mbNameAccess;
+bool mbNameContainer;
+bool mbIndexAccess;
+bool mbIndexContainer;
+bool mbEnumerationAccess;
+bool mbIdlArray;
 
 // Original-Handles of FastPropertySets
 sal_Int32* mpOrgPropertyHandleArray;
@@ -261,6 +270,15 @@ 
IntrospectionAccessStatic_Impl::IntrospectionAccessStatic_Impl( Reference XIdlR
 maPropertyConceptSeq.realloc( ARRAY_SIZE_STEP );
 
 mbFastPropSet = false;
+mbPropertySet = false;
+mbElementAccess = false;
+mbNameAccess = false;
+mbNameContainer = false;
+mbIndexAccess = false;
+mbIndexContainer = false;
+mbEnumerationAccess = false;
+mbIdlArray = false;
+
 mpOrgPropertyHandleArray = NULL;
 
 mnPropCount = 0;
@@ -772,6 +790,9 @@ class ImplIntrospectionAdapter :
 // Objekt als Interface
 ReferenceXInterface mxIface;
 
+// Guards the caching of queried interfaces
+osl::Mutex m_aMutex;
+
 // Original-Interfaces des Objekts
 ReferenceXElementAccessmxObjElementAccess;
 ReferenceXNameContainermxObjNameContainer;
@@ -781,6 +802,14 @@ class ImplIntrospectionAdapter :
 ReferenceXEnumerationAccessmxObjEnumerationAccess;
 ReferenceXIdlArraymxObjIdlArray;
 
+ReferenceXElementAccess getXElementAccess();
+ReferenceXNameContainer getXNameContainer();
+ReferenceXNameAccess getXNameAccess();
+ReferenceXIndexContainer getXIndexContainer();
+ReferenceXIndexAccess getXIndexAccess();
+ReferenceXEnumerationAccess getXEnumerationAccess();
+ReferenceXIdlArray getXIdlArray();
+
 public:
 ImplIntrospectionAdapter( ImplIntrospectionAccess* pAccess_,
 const Any obj,
@@ -861,6 +890,112 @@ public:
 throw( IllegalArgumentException, ArrayIndexOutOfBoundsException, 
RuntimeException, std::exception ) SAL_OVERRIDE;
 };
 
+ReferenceXElementAccess ImplIntrospectionAdapter::getXElementAccess()
+{
+ResettableGuard Mutex  aGuard( m_aMutex );
+
+if( !mxObjElementAccess.is() )
+{
+aGuard.clear();
+ReferenceXElementAccess xElementAccess = 
ReferenceXElementAccess::query( mxIface );
+aGuard.reset();
+if( !mxObjElementAccess.is() )
+mxObjElementAccess = xElementAccess;
+}
+return mxObjElementAccess;
+}
+
+ReferenceXNameContainer ImplIntrospectionAdapter::getXNameContainer()
+{
+ResettableGuard Mutex  aGuard( m_aMutex );
+
+if( !mxObjNameContainer.is() )
+{
+aGuard.clear();
+ReferenceXNameContainer xNameContainer = 
ReferenceXNameContainer::query( mxIface );
+aGuard.reset();
+if( !mxObjNameContainer.is() )
+mxObjNameContainer = xNameContainer;
+}
+return mxObjNameContainer;
+}
+
+ReferenceXNameAccess ImplIntrospectionAdapter::getXNameAccess()
+{
+ResettableGuard Mutex  aGuard( m_aMutex );
+
+if( !mxObjNameAccess.is() )
+{
+aGuard.clear();
+ReferenceXNameAccess xNameAccess

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

2015-07-08 Thread Matthew J . Francis
 stoc/source/inspect/introspection.cxx |   24 +++-
 1 file changed, 7 insertions(+), 17 deletions(-)

New commits:
commit 85ce6a2446deb0f4c01604b6188f969603de9b16
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Thu Jul 9 09:03:46 2015 +0800

Eliminate pointless string copies

Change-Id: I30049795f511704a43ed0eaf8dd0841c7109c334

diff --git a/stoc/source/inspect/introspection.cxx 
b/stoc/source/inspect/introspection.cxx
index cfa7085..c92d636 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -1489,22 +1489,12 @@ Any ImplIntrospectionAccess::getMaterial() 
throw(RuntimeException, std::exceptio
 return maInspectedObject;
 }
 
-// Hilfs-Funktion zur LowerCase-Wandlung eines OUString
-OUString toLower( const OUString aUStr )
-{
-// Tabelle fuer XExactName pflegen
-OUString aOWStr( aUStr.getStr() );
-OUString aOWLowerStr = aOWStr.toAsciiLowerCase();
-OUString aLowerUStr( aOWLowerStr.getStr() );
-return aLowerUStr;
-}
-
 // Methoden von XExactName
 OUString ImplIntrospectionAccess::getExactName( const OUString 
rApproximateName ) throw( RuntimeException, std::exception )
 {
 OUString aRetStr;
 LowerToExactNameMap::iterator aIt =
-mpStaticImpl-maLowerToExactNameMap.find( toLower( rApproximateName ) 
);
+mpStaticImpl-maLowerToExactNameMap.find( 
rApproximateName.toAsciiLowerCase() );
 if( !( aIt == mpStaticImpl-maLowerToExactNameMap.end() ) )
 aRetStr = (*aIt).second;
 return aRetStr;
@@ -1898,7 +1888,7 @@ css::uno::Referencecss::beans::XIntrospectionAccess 
Implementation::inspect(
 rPropNameMap[ aPropName ] = rPropCount;
 
 // Tabelle fuer XExactName pflegen
-rLowerToExactNameMap[ toLower( aPropName ) ] = aPropName;
+rLowerToExactNameMap[ aPropName.toAsciiLowerCase() ] = 
aPropName;
 }
 else
 {
@@ -1989,7 +1979,7 @@ css::uno::Referencecss::beans::XIntrospectionAccess 
Implementation::inspect(
 rPropNameMap[ aPropName ] = rPropCount;
 
 // Tabelle fuer XExactName pflegen
-rLowerToExactNameMap[ toLower( aPropName ) ] = 
aPropName;
+rLowerToExactNameMap[ aPropName.toAsciiLowerCase() ] = 
aPropName;
 
 // Field merken
 
IntrospectionAccessStatic_Impl::checkInterfaceArraySize( 
pAccess-aInterfaceSeq1,
@@ -2169,7 +2159,7 @@ css::uno::Referencecss::beans::XIntrospectionAccess 
Implementation::inspect(
 rPropNameMap[ aPropName ] = rPropCount;
 
 // Tabelle fuer XExactName pflegen
-rLowerToExactNameMap[ toLower( aPropName ) ] = 
aPropName;
+rLowerToExactNameMap[ aPropName.toAsciiLowerCase() 
] = aPropName;
 
 // get-Methode merken
 
IntrospectionAccessStatic_Impl::checkInterfaceArraySize( 
pAccess-aInterfaceSeq1,
@@ -2359,7 +2349,7 @@ css::uno::Referencecss::beans::XIntrospectionAccess 
Implementation::inspect(
 rPropNameMap[ aPropName ] = rPropCount;
 
 // Tabelle fuer XExactName pflegen
-rLowerToExactNameMap[ toLower( aPropName ) ] = 
aPropName;
+rLowerToExactNameMap[ aPropName.toAsciiLowerCase() 
] = aPropName;
 
 // set-Methode merken
 
IntrospectionAccessStatic_Impl::checkInterfaceArraySize( 
pAccess-aInterfaceSeq2,
@@ -2421,7 +2411,7 @@ css::uno::Referencecss::beans::XIntrospectionAccess 
Implementation::inspect(
 rMethodNameMap[ aMethName2 ] = 
iAllExportedMethod;
 
 // Tabelle fuer XExactName pflegen
-rLowerToExactNameMap[ toLower( aMethName2 ) ] 
= aMethName2;
+rLowerToExactNameMap[ 
aMethName2.toAsciiLowerCase() ] = aMethName2;
 }
 else
 {
@@ -2580,7 +2570,7 @@ css::uno::Referencecss::beans::XIntrospectionAccess 
Implementation::inspect(
 rPropNameMap[ aPropName ] = rPropCount;
 
 // Tabelle fuer XExactName pflegen
-rLowerToExactNameMap[ toLower( aPropName ) ] = aPropName;
+rLowerToExactNameMap[ aPropName.toAsciiLowerCase() ] = aPropName;
 
 // Field merken
 IntrospectionAccessStatic_Impl::checkInterfaceArraySize( 
pAccess-aInterfaceSeq1,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Remote call horror show

2015-07-05 Thread Matthew J. Francis

Hi,

While experimenting with the UNO accessibility tree, I found that
walking the tree from (out of process) Python was slower than it had
any right to be. To investigate why that might be, I wrote a simple
benchmark:

# ... setup ...
ac = doc.CurrentController.ComponentWindow.AccessibleContext
for i in range(1000):
ac.getAccessibleChild(0)

and then hit it with callgrind, and later some manual instrumentation.
Logically, you would expect the number of remote calls over the UNO
bridge that result from this would be in the region of 1000, charitably
give or take a factor of two or so.

The actual number was 57,000, which pretty perfectly explains why it
was so slow.

The main reason for this seems to be the silly amount of up-front work
done by com.sun.star.script.Invocation, which ends up performing dozens
of queries for interfaces which will in most cases never be used on each
object returned from a UNO call over the bridge.

By performing these queries when needed:
  https://gerrit.libreoffice.org/#/c/16780/
the number of calls made by the above benchmark falls to a much more
manageable 7000, and the time to run the more realistic test which
originally sparked this search also fell by 3/4.

Could anyone with more UNO knowledge than me comment on whether the
approach of the above patch is reasonable?


Having said all that, the time to run the test in question is still too
high, and the ultimate solution may well be to merge what I'm doing into
unotest and take advantage of the speed gain of running the whole thing
in-process. It complicates matters slightly that LO crashing then wipes
out the Python process as well, but being able to run more tests at
greater speed should make up for this.

Regards
Matthew Francis
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2015-06-30 Thread Matthew J . Francis
 pyuno/source/module/pyuno.cxx  |8 +++-
 pyuno/source/module/pyuno_impl.hxx |7 ---
 2 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 3a6ec53c71312f5ea890689f9c2ee79c2aac
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Tue Jun 30 10:07:23 2015 -0400

Fix compilation with Python 2.7

Change-Id: I0dd118f0215e06fec0cccff9b46d80f13bd802cc
Reviewed-on: https://gerrit.libreoffice.org/16620
Reviewed-by: Matthew Francis mjay.fran...@gmail.com
Tested-by: Matthew Francis mjay.fran...@gmail.com

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 8f7a6a6..413cc20 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -338,7 +338,13 @@ int lcl_PySlice_GetIndicesEx( PyObject *pObject, sal_Int32 
nLen, sal_Int32 *nSta
 {
 Py_ssize_t nStart_ssize, nStop_ssize, nStep_ssize, nSliceLength_ssize;
 
-int nResult = PySlice_GetIndicesEx( 
static_castPySliceObject_t*(pObject), nLen, nStart_ssize, nStop_ssize, 
nStep_ssize, nSliceLength_ssize );
+int nResult = PySlice_GetIndicesEx(
+#if PY_VERSION_HEX = 0x030200f0
+pObject,
+#else
+reinterpret_castPySliceObject*(pObject),
+#endif
+nLen, nStart_ssize, nStop_ssize, nStep_ssize, nSliceLength_ssize );
 if (nResult == -1)
 return -1;
 
diff --git a/pyuno/source/module/pyuno_impl.hxx 
b/pyuno/source/module/pyuno_impl.hxx
index 5f0df95..11fbfa2 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -143,13 +143,6 @@ inline PyObject* PyStrBytes_FromStringAndSize(const char 
*string, Py_ssize_t len
 }
 #endif /* PY_MAJOR_VERSION = 3 */
 
-// Type of argument to PySlice_GetIndicesEx() changed in Python 3.2
-#if PY_VERSION_HEX = 0x030200f0
-typedef PyObject PySliceObject_t;
-#else
-typedef PySliceObject PySliceObject_t;
-#endif
-
 namespace pyuno
 {
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-30 Thread Matthew J . Francis
 pyuno/source/module/uno.py |   31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

New commits:
commit 33776d143fabc1b6e91a6bad54899e9f33ca2320
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Wed Jul 1 13:14:25 2015 +0800

PyUNO: Allow import of constant group by name

Change-Id: I0ea809a888187624261182552cf7fa0a9c96c648

diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index a8873ae..4c78595 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -303,7 +303,11 @@ def _uno_import( name, *optargs, **kwargs ):
try:
   d[x] = getConstantByName( name + . + x )
except RuntimeException:
-  failed = True
+  # check for constant group
+  try:
+  d[x] = _impl_getConstantGroupByName( name, x )
+  except ValueError:
+  failed = True
 
   if failed:
   # We have an import failure, but cannot distinguish between
@@ -336,6 +340,31 @@ def _uno_import( name, *optargs, **kwargs ):
 
 return mod
 
+# private
+class _ConstantGroup(object):
+__slots__ = ['_constants']
+def __init__(self, constants):
+self._constants = constants
+def __dir__(self):
+return self._constants.keys()
+def __getattr__(self,name):
+if name in self._constants:
+return self._constants[name]
+raise AttributeError
+
+# private
+def _impl_getConstantGroupByName( module, group ):
+CONSTANTS = Enum('com.sun.star.uno.TypeClass', 'CONSTANTS')
+ONE = Enum('com.sun.star.reflection.TypeDescriptionSearchDepth', 'ONE')
+tdm = 
_g_ctx.getValueByName('/singletons/com.sun.star.reflection.theTypeDescriptionManager')
+tde = tdm.createTypeDescriptionEnumeration(module,(CONSTANTS,),ONE)
+qualifiedName = module + '.' + group
+for td in tde:
+if td.Name == qualifiedName:
+return _ConstantGroup({c.Name.split('.')[-1]: c.ConstantValue for 
c in td.Constants})
+else:
+raise ValueError
+
 # private function, don't use
 def _impl_extractName(name):
 r = list(range(len(name)-1,0,-1))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: Callback deadlock

2015-06-29 Thread Matthew J. Francis

On 29/06/2015 20:18, Stephan Bergmann wrote:


ah, that's a poorly implemented Implementation::inspect
(stoc/source/inspect/introspection.cxx), which locks some m_aMutex first
thing and for the duration of the whole function call, and both
Pyhton-side threads 1 and 2 are in this function...


When it comes to thousand line functions which feel the need to be 
(heavily) commented in German, I have a very strong urge to 'nicht 
gefingerpoken'.


Unless you feel generous enough to debug further, I'll go with plan B 
and just poll for now rather than risk changing it. While not optimally 
pretty, the objective of the exercise is after all to produce more tests 
and fewer bugs!


(In due course I can commit a test for this bug too)

Regards
Matthew Francis

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Callback deadlock

2015-06-29 Thread Matthew J. Francis

On 29/06/2015 15:08, Miklos Vajna wrote:

Hi,

On Mon, Jun 29, 2015 at 01:58:09PM +0800, Matthew J. Francis 
mjay.fran...@gmail.com wrote:

I'm intermittently experiencing the attached deadlock in some Python code.


You forgot to attach it. :-)


I attached it, but compressed for size - if it didn't arrive, some 
filter must have kindly eaten the attachment while leaving the message


Maybe like this then - http://pastebin.com/52FkaF2w

Regards
Matthew Francis
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Callback deadlock

2015-06-29 Thread Matthew J. Francis

On 29/06/2015 15:47, Piet van Oostrum wrote:

It is not completely clear if you are calling from a remote Python program, or 
from inside LO.
Assuming that it is remote, yes, there are problems with listeners in this 
situation. It can easily deadlock. I have posted a similar situation on this 
list some months ago, where I did a paragraph enumeration in a listener 
callback and it also deadlocked. See 
lists.freedesktop.org/archives/libreoffice/2015-April/067601.html

Basically the conclusion was the LO does too much locking here, but that it 
could not be avoided because of severe problems if it wouldn't lock.


It's remote - a test running as an external process.

The Python side of the deadlock is http://pastebin.com/qPkyVTkk
(this is a different run - the corresponding soffice.bin trace is 
http://pastebin.com/g4F8zcUi )


The two things that seem to be happening are:

In thread 1, the main Python thread has got the Text property for the 
text document being worked on, and PyUNO_new_UNCHECKED() is called to 
make a Python object for the result, which calls 
createInstanceWithArguments()


Meanwhile, in thread 2, the windowActivated() callback bas been 
received, and pyuno::PyUNO_new_UNCHECKED() is called to make a Python 
object for the argument, which calls createInstanceWithArguments()



If this sequence doesn't work, I'm not sure what if anything the Python 
side can do better here.


Regards
Matthew Francis
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Callback deadlock

2015-06-28 Thread Matthew J. Francis

Hi,

I'm intermittently experiencing the attached deadlock in some Python code.

As far as I can tell, the deadlock appears to be between a call to an 
XTopWindowListener in thread 1 (the listener, also in Python code, 
doesn't yet do anything more than print I am here on a callback) and 
the main thread which is attempting to enumerate the paragraphs of a 
text document in thread 2.


Could anyone with more experience in UNO and locking matters help me to 
understand what's going on here? If what I'm trying to do is essentially 
not going to work, there is the alternative of busy-waiting for windows 
to appear, but I'd like to avoid that if possible.



Regards
Matthew Francis
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: pyuno/inc pyuno/Library_pyuno.mk pyuno/Module_pyuno.mk pyuno/PythonTest_pytests.mk pyuno/PythonTest_pyuno_pytests_testcollections.mk pyuno/qa pyuno/source

2015-06-26 Thread Matthew J . Francis
 pyuno/Library_pyuno.mk |1 
 pyuno/Module_pyuno.mk  |1 
 pyuno/PythonTest_pytests.mk|1 
 pyuno/PythonTest_pyuno_pytests_testcollections.mk  |   26 
 pyuno/inc/pyuno/pyuno.hxx  |6 
 pyuno/qa/pytests/testcollections_XCellRange.py |  365 +
 pyuno/qa/pytests/testcollections_XEnumeration.py   |  111 +
 pyuno/qa/pytests/testcollections_XEnumerationAccess.py |  131 ++
 pyuno/qa/pytests/testcollections_XIndexAccess.py   |  299 
 pyuno/qa/pytests/testcollections_XIndexContainer.py|  198 +++
 pyuno/qa/pytests/testcollections_XIndexReplace.py  |  219 +++
 pyuno/qa/pytests/testcollections_XNameAccess.py|  182 ++
 pyuno/qa/pytests/testcollections_XNameContainer.py |  116 +
 pyuno/qa/pytests/testcollections_XNameReplace.py   |   73 +
 pyuno/qa/pytests/testcollections_base.py   |   58 
 pyuno/qa/pytests/testcollections_misc.py   |   75 +
 pyuno/qa/pytests/testcollections_mixednameindex.py |   48 
 pyuno/source/module/pyuno.cxx  | 1039 -
 pyuno/source/module/pyuno_impl.hxx |   49 
 pyuno/source/module/pyuno_iterator.cxx |  312 +
 pyuno/source/module/pyuno_module.cxx   |   24 
 pyuno/source/module/pyuno_runtime.cxx  |   46 
 22 files changed, 3356 insertions(+), 24 deletions(-)

New commits:
commit af8143bc40cf2cfbc12e77c9bb7de01b655f7b30
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Mon Jun 1 18:34:04 2015 +0800

Make PyUNO provide more Pythonic behaviour

- Simplifies working with UNO objects by giving the behaviour of
Python lists, dicts and iterators to objects which implement UNO
container interfaces

- Applies a custom behaviour to allow objects which implement
com::sun::star::table::XCellRange to yield cells and cell ranges by
subscript

- When UNO container objects are addressed in the new style,
eliminates the requirement to manually construct Any objects for
contained elements which are typed sequences

- Allows lists and iterators to be passed wherever a UNO method
accepts a sequence

- Relaxes the requirements for initialising UNO structs to allow
some members to be skipped when all initialisers are passed by name

1. Collection interfaces


Objects which implement core UNO collection interfaces are made to
behave in a way that is more natural for Python code.

com::sun::star::container::XIndexAccess
com::sun::star::container::XIndexReplace
com::sun::star::container::XIndexContainer
- Objects provide Python list access semantics
num = len(obj)  # Number of elements
val = obj[0]# Access by index
val1,val2 = obj[2:4]# Access by slice
val1,val2 = obj[0:3:2]  # Access by extended slice
if val in obj: ...  # Test value presence
for val in obj: ... # Implicit iterator (values)
itr = iter(obj) # Named iterator (values)
obj[0] = val# Replace by index
obj[2:4] = val1,val2# Replace by slice
obj[0:3:2] = val1,val2  # Replace by extended slice
obj[2:3] = val1,val2# Insert/replace by slice
obj[2:2] = (val,)   # Insert by slice
obj[2:4] = (val,)   # Replace/delete by slice
obj[2:3] = ()   # Delete by slice (implicit)
del obj[0]  # Delete by index
del obj[2:4]# Delete by slice

com::sun::star::container::XNameAccess
com::sun::star::container::XNameReplace
com::sun::star::container::XNameContainer
- Objects provide Python dict access semantics
num = len(obj)  # Number of keys
val = obj[key]  # Access by key
if key in obj: ...  # Test key presence
for key in obj: ... # Implicit iterator (keys)
itr = iter(obj) # Named iterator (keys)
obj[key] = val  # Replace by key
obj[key] = val  # Insert by key
del obj[key]# Delete by key

com::sun::star::container::XEnumerationAccess
- Objects provide Python iterable semantics
for val in obj: ... # Implicit iterator
itr = iter(obj) # Named iterator

com::sun::star::container::XEnumeration
- Objects provide Python iterator semantics
for val in itr: ... # Iteration of named iterator
if val in itr: ...  # Test value presence

Objects which implement both XIndex* and XName* are supported, and
respond to both integer and string keys. However, iterating over

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

2015-06-26 Thread Matthew J . Francis
 unotest/source/python/org/libreoffice/unotest.py |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 3b25116986bfe019f0f3ba7146a02e088690ea30
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Fri Jun 26 19:05:21 2015 +0800

Python 2.7 compatibility for unotest.py

Change-Id: Ic7a54b211f6d55ff50cad0fde12058fe33e8892e

diff --git a/unotest/source/python/org/libreoffice/unotest.py 
b/unotest/source/python/org/libreoffice/unotest.py
index ab3cd8a..f0a43b1 100644
--- a/unotest/source/python/org/libreoffice/unotest.py
+++ b/unotest/source/python/org/libreoffice/unotest.py
@@ -7,6 +7,8 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
+from __future__ import print_function
+
 import subprocess
 import time
 import uuid
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: PyUNO usability improvements

2015-06-18 Thread Matthew J. Francis

On 18/06/2015 20:27, Stephan Bergmann wrote:

On 06/18/2015 11:34 AM, Matthew J. Francis wrote:

What about converting this to a feature branch and running with it for
a while, with the aim of landing a properly mature feature for 5.1?


Avoid feature branches at all cost.  If you are reasonably confident
about a change, push it to master.  If it later turns out to be a bad
idea, revert.


OK. That being the case, I will go ahead with what I'm confident of and
keep working on the rest.

Regards
Matthew Francis
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: libreoffice-5-0 failure in [ CUT ] libreofficekit_tiledrendering

2015-06-18 Thread Matthew J. Francis

On 18/06/2015 22:36, Lionel Elie Mamane wrote:


Grrr... git bisect refuses to work in the direction find the commit
that fixed this, it insists to do find the commit that broke
this. So I cannot bisect between (known bad) branch point and (known
good) master.


In this case you have to drive it in what I call Macbeth mode - Fair 
is foul and foul is fair


I.e. reverse the meanings of git bisect good and git bisect bad


Regards
Matthew Francis


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: libreoffice-5-0 failure in [ CUT ] libreofficekit_tiledrendering

2015-06-18 Thread Matthew J. Francis

On 18/06/2015 22:23, Lionel Elie Mamane wrote:

Nope, branch point is not good. Given that a recompile takes hours,
I'm rather unlikely to pursue this in detail. I started a git
bisect, let's see if I have enough patience to get to the end.


Note that if you have an automated reproducer - a failing test which 
gives a nice obvious exit code is perfect - you can drive your bisect 
automatically with git bisect run


It might not make it any faster, but at least you can ignore it and get 
on with something else


(The argument it takes is a script which should exit with code:
  0 == good
  125 == skip (build failure)
  anything else == bad
so in this case it should suffice to first build without tests, exit 125 
on failure, then run the tests and exit with whatever the result of that 
was)




Regards
Matthew Francis

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: PyUNO usability improvements

2015-06-18 Thread Matthew J. Francis

So far I've had some valuable feedback - thanks to those who
contributed.

I also have the nagging feeling that any changes to behaviour will be
with us for a long time, and there are still a few questions in my mind
over the advisability of some of the details. Part of the reason for
this is that while it all seems a good idea in theory, there aren't any
actual demonstration use cases yet apart from the few unit tests.

So, given that:
- To begin with there's no way I'd recommend rushing this in for 5.0,
and nobody but me is clamouring to actually use the changes
- Some time to mature the interface changes seems like a good idea
- I have a significant actual use case (UI testing) separately in
progress that this could be developed alongside

What about converting this to a feature branch and running with it for
a while, with the aim of landing a properly mature feature for 5.1?


Regards
Matthew Francis


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: PyUNO usability improvements

2015-06-16 Thread Matthew J. Francis

On 16/06/2015 21:45, Eike Rathke wrote:


Is there a specific reason for this? Why not keep the order the API
uses? My concern is, that if these get mixed the user will get
confused..


Doing it the other way round would give a different obvious violation
of the principle of least confusion. Taking one of my original examples,

 tbl.Data = ((y for y in range(10*x,10*x + 10)) for x in range(10))

 tbl.Data
((0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0),
 (10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0),
 (20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0),
 (30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0),
 (40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0),
 (50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0),
 (60.0, 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0),
 (70.0, 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0),
 (80.0, 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0),
 (90.0, 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0))

 tbl.Data[9][0]
90.0

 tbl[9,0].Value
90.0


If the XCellRange specialisation used c,r order, the last statement
would give 9, not 90

(The .Data comes from the XChartDataArray interface; there is also e.g.
.DataArray from XCellRangeData)

Regards
Matthew Francis
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: PyUNO usability improvements

2015-06-15 Thread Matthew J. Francis

Hi,

On 15/06/2015 16:33, Riccardo Magliocchetti wrote:

Have you tried this against unoconv?
https://github.com/dagwieers/unoconv


I have now, although you have to do a bit of a funny dance to get it to work 
correctly against a random LO instance.

Specifically, against a current build I had to:
UNO_PATH=$PWD/instdir PYTHONPATH=$PWD/instdir/program unoconv args

It seems to work correctly, and in general I would expect this to be the case. 
You *could* deliberately write code that was forward-incompatible with the new 
syntax options, but you'd have to try something quite silly to do so.


For instance, deliberately relying on the fact that UNO collection objects 
throw exceptions when you try to access them Python style would be incompatible.



Speaking of pythonic api there was this nice talk which i think fits quite well:
https://www.youtube.com/watch?v=wf-BqAjZb8M

TLDR; what about adding a pythonic wrapper on top of the actual API to make it
pythonic?


Thanks for the link, that was an interesting talk - and suggested one more 
feature that could be implemented cheaply, which is to implement a context 
manager for XModel to manage controller locking.


So instead of

doc.lockControllers()
try:
... # operate on the document
finally:
doc.unlockControllers()

You could simply

with doc:
... # operate on the document

(Can anyone suggest any more interfaces which could benefit from this 
treatment?)


As for the other elements suggested in the talk, UNO properties are already 
mapped to Python properties, which is one of the areas where the existing code 
is quite successful in providing a Pythonic interface; and providing proper 
list, iterator and dict accessors is of course the main thrust of the patch.
The UNO API is huge, and whereas trying to implement a perfect Python 
interface for each UNO object and interface individually would be an enormous 
amount of work, doing this kind of global transform on the whole API should be 
highly effective in achieving (very nearly) the same result.


Regards
Matthew Francis



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: PyUNO usability improvements

2015-06-15 Thread Matthew J. Francis

On 15/06/2015 20:53, Noel Grandin wrote:


Try this:
find . -name *.idl | xargs grep 'close()'
find . -name *.idl | xargs grep 'unlock'
should find you a bunch like

com::sun::star::connection::XConnection
com::sun::star::connection::XBroadcaster


So, having searched a bit further along these lines,

com.sun.star.connection.XConnection
- Could technically be done, but I can't see any use of it outside the 
bridge code (where block level context management would be fairly pointless)


com.sun.star.connection.XBroadcaster
- Referenced by svx/source/table/tablemodel.cxx, but I see precisely 
zero mention of it being used in user code. No UNO service or interface 
actually declares its use. Unless anyone can come up with an actual use 
case, I'd skip it.



The more likely candidates seem to be:

com.sun.star.sdbc.XCloseable
- This one is on pretty solid ground and covers all sorts of things like 
database statements and result sets which could usefully be context 
managed at the block level


com.sun.star.frame.XModel
- As previously mentioned, locking/unlocking controllers is a pretty 
common thing to do and would benefit from the sugar. Riccardo 
Magliocchetti separately pointed out on IRC an example where he used a 
wrapper class context manager to control the closing of documents, which 
would correspond instead to a controller on com.sun.star.util.XCloseable 
- which is also implemented by document components. These two behaviours 
wouldn't happily coexist on the same object, and I think in terms of 
macro programming at least, the controller locking is more useful. As 
(com.sun.star.util.)XCloseable.close() also takes an argument, which 
couldn't be supplied using the with obj: ... syntax, I think this use 
case would be better dealt with by a function or class decorator if it's 
generally useful, rather than in the PyUNO core at the interface level.


com.sun.star.frame.XLayoutManager
- Could be used to lock interface updates while changing UI. I see one 
or two examples of user code using this.


com.sun.star.drawing.framework.XConfigurationController
- Possible but unsure how useful. I see one example of a user having 
(unsuccessfully) attempted to use this. It couldn't in any case be 
implemented without a working use case to test.


com.sun.star.registry.XRegistryKey
com.sun.star.registry.XSimpleRegistry
- Could be occasionally useful


Others:

com.sun.star.document.XUndoManager
- Potentially quite useful, but as with com.sun.star.util.XCloseable it 
requires an argument on the setup side, and would be better served by a 
decorator style controller



Regards
Matthew Francis



___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


PyUNO usability improvements

2015-06-14 Thread Matthew J. Francis

Hi,

For the past few weeks I've been working on some upgrades to PyUNO,
which have now reached (what I hope is) a sufficient level of sanity and 
stability. I've pushed the changes to:


  https://gerrit.libreoffice.org/16272

Given that this is a fairly large API change (if for a scripting
language that is not -yet- heavily used by our users), it probably
needs a careful review, but I have a suspicion that probably no one
developer currently has knowledge of all the interlocking requirements
at play here - or PyUNO might look somewhat different to begin with ;)
If anyone feels kind enough to take on the work of reviewing this,
please give me a shout and I'll offer what help I can on understanding
how all the pieces fit together.

* Parts of the test suite depend on
  https://gerrit.libreoffice.org/16073
Without this fix, various of the tests will fail


Regards
Matthew Francis




Make PyUNO provide more Pythonic behaviour

- Simplifies working with UNO objects by giving the behaviour of
Python lists, dicts and iterators to objects which implement UNO
container interfaces

- Applies a custom behaviour to allow objects which implement
com::sun::star::table::XCellRange to yield cells and cell ranges by
subscript

- When UNO container objects are addressed in the new style,
eliminates the requirement to manually construct Any objects for
contained elements which are typed sequences

- Allows lists and iterators to be passed wherever a UNO method
accepts a sequence

- Relaxes the requirements for initialising UNO structs to allow
some members to be skipped when all initialisers are passed by name

1. Collection interfaces


Objects which implement core UNO collection interfaces are made to
behave in a way that is more natural for Python code.

com::sun::star::container::XIndexAccess
com::sun::star::container::XIndexReplace
com::sun::star::container::XIndexContainer
- Objects provide Python list access semantics
num = len(obj)  # Number of elements
val = obj[0]# Access by index
val1,val2 = obj[2:4]# Access by slice
val1,val2 = obj[0:3:2]  # Access by extended slice
if val in obj: ...  # Test value presence
for val in obj: ... # Implicit iterator (values)
itr = iter(obj) # Named iterator (values)
obj[0] = val# Replace by index
obj[2:4] = val1,val2# Replace by slice
obj[0:3:2] = val1,val2  # Replace by extended slice
obj[2:3] = val1,val2# Insert/replace by slice
obj[2:2] = (val,)   # Insert by slice
obj[2:4] = (val,)   # Replace/delete by slice
obj[2:3] = ()   # Delete by slice (implicit)
del obj[0]  # Delete by index
del obj[2:4]# Delete by slice

com::sun::star::container::XNameAccess
com::sun::star::container::XNameReplace
com::sun::star::container::XNameContainer
- Objects provide Python dict access semantics
num = len(obj)  # Number of keys
val = obj[key]  # Access by key
if key in obj: ...  # Test key presence
for key in obj: ... # Implicit iterator (keys)
itr = iter(obj) # Named iterator (keys)
obj[key] = val  # Replace by key
obj[key] = val  # Insert by key
del obj[key]# Delete by key

com::sun::star::container::XEnumerationAccess
- Objects provide Python iterable semantics
for val in obj: ... # Implicit iterator
itr = iter(obj) # Named iterator

com::sun::star::container::XEnumeration
- Objects provide Python iterator semantics
for val in itr: ... # Iteration of named iterator
if val in itr: ...  # Test value presence

Objects which implement both XIndex* and XName* are supported, and
respond to both integer and string keys. However, iterating over
such an object will return the keys (like a Python dict) rather than
the values (like a Python list).

2. Cell ranges
==

A custom behaviour is applied to objects which implement
com::sun::star::table::XCellRange to allow their cells and cell
ranges to be addressed by subscript, in the style of a Python list
or dict (read-only). This is applicable to Calc spreadsheet sheets,
Writer text tables and cell ranges created upon these.
cell = cellrange[0,0]   # Access cell by indices
rng = cellrange[0,1:2]  # Access cell range by index,slice
rng = cellrange[1:2,0]  # Access cell range by slice,index
rng = cellrange[0:1,2:3]# Access cell range 

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

2015-06-14 Thread Matthew J . Francis
 comphelper/source/container/IndexedPropertyValuesContainer.cxx |4 +-
 sw/qa/complex/writer/CheckIndexedPropertyValues.java   |   18 
+-
 2 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 46e12364dcf638e97831dc3d7507bb6b93377757
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Thu Jun 4 15:56:58 2015 +0800

Fix insertion and deletion in IndexedPropertyValuesContainer

The cases for iterating to an element from the end (used for
elements in the second half of the underlying array) had an off by
one error causing the wrong elements to be inserted/removed

Change-Id: Idcbf158cc31afaf02fce3f1975509edf6239d3ae
Reviewed-on: https://gerrit.libreoffice.org/16073
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Norbert Thiebaud nthieb...@gmail.com

diff --git a/comphelper/source/container/IndexedPropertyValuesContainer.cxx 
b/comphelper/source/container/IndexedPropertyValuesContainer.cxx
index cd329af..b8b91f3 100644
--- a/comphelper/source/container/IndexedPropertyValuesContainer.cxx
+++ b/comphelper/source/container/IndexedPropertyValuesContainer.cxx
@@ -116,7 +116,7 @@ void SAL_CALL 
IndexedPropertyValuesContainer::insertByIndex( sal_Int32 nIndex, c
 else
 {
 aItr = maProperties.end();
-sal_Int32 i(nSize - 1);
+sal_Int32 i(nSize);
 while(i  nIndex)
 {
 --i;
@@ -151,7 +151,7 @@ void SAL_CALL 
IndexedPropertyValuesContainer::removeByIndex( sal_Int32 nIndex )
 else
 {
 aItr = maProperties.end();
-sal_Int32 i(nSize - 1);
+sal_Int32 i(nSize);
 while(i  nIndex)
 {
 --i;
diff --git a/sw/qa/complex/writer/CheckIndexedPropertyValues.java 
b/sw/qa/complex/writer/CheckIndexedPropertyValues.java
index c526176..338f706 100644
--- a/sw/qa/complex/writer/CheckIndexedPropertyValues.java
+++ b/sw/qa/complex/writer/CheckIndexedPropertyValues.java
@@ -53,6 +53,11 @@ public class CheckIndexedPropertyValues {
 prop2[0].Name  = Horst;
 prop2[0].Value = BadGuy;
 
+PropertyValue[] prop3 = new PropertyValue[1];
+prop3[0] = new PropertyValue();
+prop3[0].Name  = Peter;
+prop3[0].Value = FamilyGuy;
+
 Type t = xCont.getElementType();
 assertEquals(Initial container is not empty, 0, xCont.getCount());
 xCont.insertByIndex(0, prop1);
@@ -70,6 +75,17 @@ public class CheckIndexedPropertyValues {
 xCont.insertByIndex(1, prop2);
 assertTrue(Did not insert PropertyValue.,
xCont.hasElements()  xCont.getCount()==2);
+try {
+xCont.removeByIndex(1);
+}
+catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+fail(Could not remove last PropertyValue);
+}
+xCont.insertByIndex(1, prop2);
+xCont.insertByIndex(1, prop3);
+ret = (PropertyValue[])xCont.getByIndex(1);
+assertEquals(prop3[0].Name, ret[0].Name);
+assertEquals(prop3[0].Value, ret[0].Value);
 
 try {
 xCont.insertByIndex(25, prop2);
@@ -86,7 +102,7 @@ public class CheckIndexedPropertyValues {
 }
 
 try {
-xCont.insertByIndex(2, Example String);
+xCont.insertByIndex(3, Example String);
 fail(IllegalArgumentException was not thrown.);
 }
 catch(com.sun.star.lang.IllegalArgumentException e) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: test infrastructure ideas appreciated ... - a11y based testing

2015-06-04 Thread Matthew J. Francis

On 05/06/2015 00:39, Michael Meeks wrote:


On Thu, 2015-06-04 at 16:14 +0200, Noel Grandin wrote:

mjayfrancis(IRC) is doing some interesting automated-UI testing work using
the UNO accessibility API - perhaps get him on contract to finish it up and 
make it nice?


Ah - it'd be great to use our UNO API directly, rather than via some
wrapper - then it can be effortlessly cross-platform ... will split your
ideas up - perhaps into threads ?


The framework I've got so far is based on a UNO sandwich - setting up 
a test environment, and the final check of the results of actions are 
done through (Py)UNO, while the manipulation of the UI itself (the 
filling) is done through Dogtail, a Red Hat project which is itself a 
wrapper around the pyatspi accessibility library (and hence currently 
Linux only)


Replacing the filling with more UNO could be done, but it would need 
at least a replacement for the Dogtail convenience layer (which makes a 
lot of the work of finding and interacting with the correct UI elements 
very easy), and possibly some other work on the raw UNO accessibility 
API. Ultimately this is an achievable volume of work, but it will take 
some time to investigate, and I want to get as far as possible through 
some other aspects of making UI testing easier before tackling it - much 
of the rest of the approach/framework will still be applicable.


At present I'm on a side project to improve the usability of PyUNO by 
making UNO collections (the XIndexAccess, XNameAccess, 
XEnumerationAccess family) function as native Python lists, dicts and 
iterators. Hopefully this too should help make it easier to write tests 
for LO. As of today the basic functionality of this all works, and I 
hope to be able to push it for review some time next week.


Regards
Matthew Francis

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Fate of dp_misc::PersistentMap ?

2015-04-02 Thread Matthew J. Francis
Prodding at this briefly with git blame leads to the below commit. 
Perhaps mmeeks can comment :)



commit 042247b3e428cb7352c06a670576819c67378090
Author: Michael Meeks michael.me...@suse.com
Date:   Wed Nov 16 16:59:39 2011 +

Fixup legacy sleepycat db database usage for packages

Previously empty legacy registered_packages.db databases were created
unconditionally, at some efficiency and startup cost, despite these
being deprectated since before version 3.2.
We now handle version mismatches by warning on the console and ignoring
these files.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2015-03-25 Thread Matthew J . Francis
 wizards/source/euro/Common.xba|2 +-
 wizards/source/euro/ConvertRun.xba|2 +-
 wizards/source/euro/Writer.xba|2 +-
 wizards/source/template/Autotext.xba  |2 +-
 wizards/source/tools/Listbox.xba  |4 ++--
 wizards/source/tools/Strings.xba  |   12 ++--
 wizards/source/tools/UCB.xba  |2 +-
 wizards/source/tutorials/TutorialOpen.xba |2 +-
 8 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit ca07d5bef335b220139b858a5b54aa62983a66e1
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Wed Mar 25 13:01:17 2015 +0800

tdf#68547 Turkısh ı ıs specıal

Capital i is Ä°
Small I is ı
Therefore, any BASIC we ship had better be clean of case-insensitive 
function
name comparisons (or at least those involving is), because they will not
work when the system locale is Turkish.

Change-Id: Ibf3a35a55b6b1ba384731dfa92caf24b51245530
Reviewed-on: https://gerrit.libreoffice.org/14995
Reviewed-by: Noel Grandin noelgran...@gmail.com
Tested-by: Noel Grandin noelgran...@gmail.com

diff --git a/wizards/source/euro/Common.xba b/wizards/source/euro/Common.xba
index 94a8b198b..550042e 100644
--- a/wizards/source/euro/Common.xba
+++ b/wizards/source/euro/Common.xba
@@ -159,7 +159,7 @@ Dim oFormatofObject() as Object
CheckFormatType = False
Exit Function
End If
-   If FieldinArray(CurrSymbolList(),2,oFormatofObject.CurrencySymbol) Then
+   If FieldInArray(CurrSymbolList(),2,oFormatofObject.CurrencySymbol) Then
apos; If the Currencysymbol of the object is the one needed, 
then check the Currency extension
sFormatCurrExt = oFormatofObject.CurrencyExtension
 
diff --git a/wizards/source/euro/ConvertRun.xba 
b/wizards/source/euro/ConvertRun.xba
index 61c50fc..caf28ef 100644
--- a/wizards/source/euro/ConvertRun.xba
+++ b/wizards/source/euro/ConvertRun.xba
@@ -286,7 +286,7 @@ End Sub
 
 apos; Checks if a Field (LocField) is already defined in an Array
 apos; Returns apos;Trueapos; or apos;Falseapos;
-Function FieldinList(LocList(), MaxIndex as integer, ByVal LocField ) As 
Boolean
+Function FieldInList(LocList(), MaxIndex as integer, ByVal LocField ) As 
Boolean
 Dim i as integer
LocField = Ucase(LocField)
For i = Lbound(LocList()) to MaxIndex
diff --git a/wizards/source/euro/Writer.xba b/wizards/source/euro/Writer.xba
index fa2b024..d747b46 100644
--- a/wizards/source/euro/Writer.xba
+++ b/wizards/source/euro/Writer.xba
@@ -74,7 +74,7 @@ Dim MaxIndex as Integer
End If
ElseIf 
oTextField.TextFieldMaster.PropertySetInfo.HasPropertyByName(quot;Valuequot;) 
Then
CurInstanceName = 
oTextField.TextFieldMaster.InstanceName
-   If Not FieldinArray(InstanceNames(), 
MaxIndex, CurInstanceName) Then
+   If Not FieldInArray(InstanceNames(), 
MaxIndex, CurInstanceName) Then

oTextField.TextFieldMaster.Content = 
CStr(Round(oTextField.TextFieldMaster.Value/CurrFactor,2))
InstanceNames(MaxIndex) = 
CurInstanceName
MaxIndex = MaxIndex + 1
diff --git a/wizards/source/template/Autotext.xba 
b/wizards/source/template/Autotext.xba
index 5e41dc3..f99a54f 100644
--- a/wizards/source/template/Autotext.xba
+++ b/wizards/source/template/Autotext.xba
@@ -125,7 +125,7 @@ Sub CreateUserDatafield(oCursor, sFoundContent as String)
oUserfield = 
oDocAuto.CreateInstance(quot;com.sun.star.text.TextField.ExtendedUserquot;)
sFoundList() = ArrayoutofString(sFoundContent,quot;:quot;,MaxIndex)
UserInfo = UCase(LTrim(sFoundList(1)))
-   UserIndex = IndexinArray(UserInfo, UserfieldDatatype())
+   UserIndex = IndexInArray(UserInfo, UserfieldDatatype())
If UserIndex lt;gt; -1 Then
oUserField.UserDatatype = UserIndex
oCursor.Text.InsertTextContent(oCursor,oUserField,True)
diff --git a/wizards/source/tools/Listbox.xba b/wizards/source/tools/Listbox.xba
index 2ac741c..2f4e48b 100644
--- a/wizards/source/tools/Listbox.xba
+++ b/wizards/source/tools/Listbox.xba
@@ -172,10 +172,10 @@ Dim iOldSourceSelect as Integer
m = 0
For n = 0 To MaxOriginalIndex
SearchString = OriginalList(n)
-   If IndexinArray(SearchString, SelList()) lt;gt; -1 
Then
+   If IndexInArray(SearchString, SelList()) lt;gt; -1 
Then
NewSourceList(m) =  SearchString
m = m + 1
-   ElseIf IndexinArray(SearchString, SourceList()) 
lt;gt; -1 Then
+   ElseIf IndexInArray

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

2014-11-27 Thread Matthew J . Francis
 sc/source/filter/excel/xetable.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit d83b031346799bff0a3298387f76b16baad2e5cf
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Thu Nov 27 12:08:07 2014 +0800

fdo#86687 Avoid deadlock updating progress bar

Change-Id: I13f93372fedc67bfd25d36a5bee10a004fe9f8f6
Reviewed-on: https://gerrit.libreoffice.org/13147
Reviewed-by: Michael Meeks michael.me...@collabora.com
Tested-by: Michael Meeks michael.me...@collabora.com

diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 01c286d..66df5d6 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2087,9 +2087,12 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData 
rDefRowData, const ScfUInt
 for ( itr = itrBeg; itr != itrEnd; ++itr, ++nIdx )
 pTasks[ nIdx % nThreads ]-push_back( itr-second.get() );
 
-for ( size_t i = 0; i  nThreads; i++ )
+for ( size_t i = 1; i  nThreads; i++ )
 rPool.pushTask( pTasks[ i ] );
 
+// Progress bar updates must be synchronous to avoid deadlock
+pTasks[0]-doWork();
+
 rPool.waitUntilEmpty();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sc/source

2014-11-27 Thread Matthew J . Francis
 sc/source/filter/excel/xetable.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit e678a333c1f4a7a1bf8594d888938e598ed2f6a1
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Thu Nov 27 12:08:07 2014 +0800

fdo#86687 Avoid deadlock updating progress bar

Change-Id: I13f93372fedc67bfd25d36a5bee10a004fe9f8f6
Reviewed-on: https://gerrit.libreoffice.org/13147
Reviewed-by: Michael Meeks michael.me...@collabora.com
Tested-by: Michael Meeks michael.me...@collabora.com

diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 01c286d..66df5d6 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2087,9 +2087,12 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData 
rDefRowData, const ScfUInt
 for ( itr = itrBeg; itr != itrEnd; ++itr, ++nIdx )
 pTasks[ nIdx % nThreads ]-push_back( itr-second.get() );
 
-for ( size_t i = 0; i  nThreads; i++ )
+for ( size_t i = 1; i  nThreads; i++ )
 rPool.pushTask( pTasks[ i ] );
 
+// Progress bar updates must be synchronous to avoid deadlock
+pTasks[0]-doWork();
+
 rPool.waitUntilEmpty();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-11-26 Thread Matthew J . Francis
 sw/source/uibase/uiview/view2.cxx |   22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 9673698f35ad249bc96506965b5e467d1f7ea0e9
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Wed Oct 29 14:39:32 2014 +0800

fdo#83308 Show thousand separators in document word/character counts

Change-Id: I7ef59f3c40c475c25dd6f110f298fcda3f0f1079
Reviewed-on: https://gerrit.libreoffice.org/12130
Reviewed-by: Samuel Mehrbrodt s.mehrbr...@gmail.com
Tested-by: Samuel Mehrbrodt s.mehrbr...@gmail.com

diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index 1cffd55..64ff288 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1364,18 +1364,16 @@ void SwView::StateStatusLine(SfxItemSet rSet)
 {
 SwDocStat selectionStats;
 SwDocStat documentStats;
-{
-rShell.CountWords(selectionStats);
-documentStats = 
rShell.GetDoc()-getIDocumentStatistics().GetUpdatedDocStat( true /* 
complete-async */, false /* don't update fields */ );
-}
-
-OUString wordCount(SW_RES(selectionStats.nWord ?
-  STR_STATUSBAR_WORDCOUNT : 
STR_STATUSBAR_WORDCOUNT_NO_SELECTION));
-wordCount = wordCount.replaceFirst(%1,
-OUString::number(selectionStats.nWord ? 
selectionStats.nWord : documentStats.nWord));
-wordCount = wordCount.replaceFirst(%2,
-OUString::number(selectionStats.nChar ? 
selectionStats.nChar : documentStats.nChar));
-rSet.Put(SfxStringItem(FN_STAT_WORDCOUNT, wordCount));
+rShell.CountWords(selectionStats);
+documentStats = 
rShell.GetDoc()-getIDocumentStatistics().GetUpdatedDocStat( true /* 
complete-async */, false /* don't update fields */ );
+
+sal_uLong nWord = selectionStats.nWord ? selectionStats.nWord 
: documentStats.nWord;
+sal_uLong nChar = selectionStats.nChar ? selectionStats.nChar 
: documentStats.nChar;
+OUString aWordCount( SW_RES( selectionStats.nWord ? 
STR_STATUSBAR_WORDCOUNT : STR_STATUSBAR_WORDCOUNT_NO_SELECTION ) );
+const LocaleDataWrapper rLocaleData = 
Application::GetSettings().GetUILocaleDataWrapper();
+aWordCount = aWordCount.replaceFirst( %1, 
rLocaleData.getNum( nWord, 0 ) );
+aWordCount = aWordCount.replaceFirst( %2, 
rLocaleData.getNum( nChar, 0 ) );
+rSet.Put( SfxStringItem( FN_STAT_WORDCOUNT, aWordCount ) );
 
 SwWordCountWrapper *pWrdCnt = 
(SwWordCountWrapper*)GetViewFrame()-GetChildWindow(SwWordCountWrapper::GetChildWindowId());
 if (pWrdCnt)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/source

2014-11-26 Thread Matthew J . Francis
 sw/source/uibase/uiview/view2.cxx |   22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 68c378187c0eac9049141cd8ac072231f7860313
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Wed Oct 29 14:39:32 2014 +0800

fdo#83308 Show thousand separators in document word/character counts

Change-Id: I7ef59f3c40c475c25dd6f110f298fcda3f0f1079
Reviewed-on: https://gerrit.libreoffice.org/12130
Reviewed-by: Samuel Mehrbrodt s.mehrbr...@gmail.com
Tested-by: Samuel Mehrbrodt s.mehrbr...@gmail.com
(cherry picked from commit 9673698f35ad249bc96506965b5e467d1f7ea0e9)
Reviewed-on: https://gerrit.libreoffice.org/13132
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index 7dcde99..9c98971 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1364,18 +1364,16 @@ void SwView::StateStatusLine(SfxItemSet rSet)
 {
 SwDocStat selectionStats;
 SwDocStat documentStats;
-{
-rShell.CountWords(selectionStats);
-documentStats = 
rShell.GetDoc()-getIDocumentStatistics().GetUpdatedDocStat( true /* 
complete-async */, false /* don't update fields */ );
-}
-
-OUString wordCount(SW_RES(selectionStats.nWord ?
-  STR_STATUSBAR_WORDCOUNT : 
STR_STATUSBAR_WORDCOUNT_NO_SELECTION));
-wordCount = wordCount.replaceFirst(%1,
-OUString::number(selectionStats.nWord ? 
selectionStats.nWord : documentStats.nWord));
-wordCount = wordCount.replaceFirst(%2,
-OUString::number(selectionStats.nChar ? 
selectionStats.nChar : documentStats.nChar));
-rSet.Put(SfxStringItem(FN_STAT_WORDCOUNT, wordCount));
+rShell.CountWords(selectionStats);
+documentStats = 
rShell.GetDoc()-getIDocumentStatistics().GetUpdatedDocStat( true /* 
complete-async */, false /* don't update fields */ );
+
+sal_uLong nWord = selectionStats.nWord ? selectionStats.nWord 
: documentStats.nWord;
+sal_uLong nChar = selectionStats.nChar ? selectionStats.nChar 
: documentStats.nChar;
+OUString aWordCount( SW_RES( selectionStats.nWord ? 
STR_STATUSBAR_WORDCOUNT : STR_STATUSBAR_WORDCOUNT_NO_SELECTION ) );
+const LocaleDataWrapper rLocaleData = 
Application::GetSettings().GetUILocaleDataWrapper();
+aWordCount = aWordCount.replaceFirst( %1, 
rLocaleData.getNum( nWord, 0 ) );
+aWordCount = aWordCount.replaceFirst( %2, 
rLocaleData.getNum( nChar, 0 ) );
+rSet.Put( SfxStringItem( FN_STAT_WORDCOUNT, aWordCount ) );
 
 SwWordCountWrapper *pWrdCnt = 
(SwWordCountWrapper*)GetViewFrame()-GetChildWindow(SwWordCountWrapper::GetChildWindowId());
 if (pWrdCnt)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-11-19 Thread Matthew J . Francis
 vcl/source/gdi/bmpfast.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f857358d83e7c105271eb0e2c43f0b036f14f284
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Wed Nov 19 11:25:28 2014 +0800

fdo#86298 Avoid crash blending upside down Bitmaps of differing size

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

diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx
index 1764dc6..ff51c23 100644
--- a/vcl/source/gdi/bmpfast.cxx
+++ b/vcl/source/gdi/bmpfast.cxx
@@ -566,7 +566,7 @@ bool ImplBlendToBitmap( TrueColorPixelPtrSRCFMT rSrcLine,
 // source and destination don't match: upside down
 if( (rSrcBuffer.mnFormat ^ rDstBuffer.mnFormat)  BMP_FORMAT_TOP_DOWN )
 {
-aDstLine.AddByteOffset( (rSrcBuffer.mnHeight - 1) * nDstLinestep );
+aDstLine.AddByteOffset( (rDstBuffer.mnHeight - 1) * nDstLinestep );
 nDstLinestep = -nDstLinestep;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-11-17 Thread Matthew J . Francis
 include/sfx2/recentdocsviewitem.hxx|4 
 sfx2/source/control/recentdocsviewitem.cxx |   28 +---
 2 files changed, 9 insertions(+), 23 deletions(-)

New commits:
commit e43f692ef908fd2bc180a5e16fb363ec6bb7eb09
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Sun Nov 16 10:26:18 2014 +0800

fdo#85478 Avoid destroying bitmaps after VCL is shut down

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

diff --git a/include/sfx2/recentdocsviewitem.hxx 
b/include/sfx2/recentdocsviewitem.hxx
index b1a51fe..7ee05ee 100644
--- a/include/sfx2/recentdocsviewitem.hxx
+++ b/include/sfx2/recentdocsviewitem.hxx
@@ -49,6 +49,10 @@ private:
 
 /// Is the icon that the user can click to remove the document from the 
recent documents highlighted?
 bool m_bRemoveIconHighlighted;
+
+BitmapEx m_aRemoveRecentBitmap;
+
+BitmapEx m_aRemoveRecentBitmapHighlighted;
 };
 
 #endif // INCLUDED_SFX2_RECENTDOCSVIEWITEM_HXX
diff --git a/sfx2/source/control/recentdocsviewitem.cxx 
b/sfx2/source/control/recentdocsviewitem.cxx
index aa2a7e0..c8f19f4 100644
--- a/sfx2/source/control/recentdocsviewitem.cxx
+++ b/sfx2/source/control/recentdocsviewitem.cxx
@@ -30,31 +30,13 @@ using namespace com::sun::star::uno;
 using namespace drawinglayer::primitive2d;
 using namespace drawinglayer::processor2d;
 
-/// Icon that the user can click to remove the document from the recent 
documents.
-struct theRemoveRecentBitmap : public rtl::StaticWithInitBitmapEx, 
theRemoveRecentBitmap
-{
-BitmapEx operator()()
-{
-return SfxResId(IMG_RECENTDOC_REMOVE);
-}
-
-};
-
-/// Highlighted version of icon that the user can click to remove the document 
from the recent documents.
-struct theRemoveRecentBitmapHighlighted : public rtl::StaticWithInitBitmapEx, 
theRemoveRecentBitmapHighlighted
-{
-BitmapEx operator()()
-{
-return SfxResId(IMG_RECENTDOC_REMOVE_HIGHLIGHTED);
-}
-
-};
-
 RecentDocsViewItem::RecentDocsViewItem(ThumbnailView rView, const OUString 
rURL,
 const OUString rTitle, const BitmapEx rThumbnail, sal_uInt16 nId)
 : ThumbnailViewItem(rView, nId),
   maURL(rURL),
-  m_bRemoveIconHighlighted(false)
+  m_bRemoveIconHighlighted(false),
+  m_aRemoveRecentBitmap(SfxResId(IMG_RECENTDOC_REMOVE)),
+  
m_aRemoveRecentBitmapHighlighted(SfxResId(IMG_RECENTDOC_REMOVE_HIGHLIGHTED))
 {
 OUString aTitle(rTitle);
 INetURLObject aURLObj(rURL);
@@ -151,7 +133,7 @@ Rectangle RecentDocsViewItem::updateHighlight(bool 
bVisible, const Point rPoint
 Rectangle RecentDocsViewItem::getRemoveIconArea() const
 {
 Rectangle aArea(getDrawArea());
-Size aSize(theRemoveRecentBitmap::get().GetSizePixel());
+Size aSize(m_aRemoveRecentBitmap.GetSizePixel());
 
 return Rectangle(
 Point(aArea.Right() - aSize.Width() - THUMBNAILVIEW_ITEM_CORNER, 
aArea.Top() + THUMBNAILVIEW_ITEM_CORNER),
@@ -175,7 +157,7 @@ void 
RecentDocsViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProc
 Point aIconPos(getRemoveIconArea().TopLeft());
 
 aSeq[0] = drawinglayer::primitive2d::Primitive2DReference(new 
DiscreteBitmapPrimitive2D(
-m_bRemoveIconHighlighted? 
theRemoveRecentBitmapHighlighted::get(): theRemoveRecentBitmap::get(),
+m_bRemoveIconHighlighted ? 
m_aRemoveRecentBitmapHighlighted : m_aRemoveRecentBitmap,
 B2DPoint(aIconPos.X(), aIconPos.Y(;
 
 pProcessor-process(aSeq);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 3 commits - configure.ac helpcontent2

2014-10-30 Thread Matthew J . Francis
 configure.ac |3 ++-
 helpcontent2 |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 86255b6fa31fb65e31a8a3f702a58a27e76c36d2
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Tue Oct 28 16:10:44 2014 +0800

Document that gtk3 support is experimental

Change-Id: I87df8cb6a4e4e374c5c9782e695fcdf020d5707f
Reviewed-on: https://gerrit.libreoffice.org/12121
Reviewed-by: Noel Grandin noelgran...@gmail.com
Tested-by: Noel Grandin noelgran...@gmail.com

diff --git a/configure.ac b/configure.ac
index 964fc5b..2796015 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1077,7 +1077,8 @@ AC_ARG_ENABLE(gtk,
 
 AC_ARG_ENABLE(gtk3,
 AS_HELP_STRING([--enable-gtk3],
-[Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 
3.0 is available.]),
+[Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 
3.0 is available.
+ This is experimental and may not work.]),
 ,enable_gtk3=no)
 
 AC_ARG_ENABLE(systray,
commit 0cba83792d6b2d42a73abcf9a43a8608e175fa6b
Author: Stanislav Horacek stanislav.hora...@gmail.com
Date:   Tue Oct 28 17:07:23 2014 +0100

Updated core
Project: help  e5af8139b8a16b80a1b2398ffbeb629600484823

rename Format Paintbrush to Clone Formatting

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

diff --git a/helpcontent2 b/helpcontent2
index 36a1eb4..e5af813 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 36a1eb4dcee3c27e1ed72f2af63c8ea882a38863
+Subproject commit e5af8139b8a16b80a1b2398ffbeb629600484823
commit f2b355ef62c0a06a356a43bb84e584968666c77b
Author: Stanislav Horacek stanislav.hora...@gmail.com
Date:   Tue Oct 28 22:20:14 2014 +0100

Updated core
Project: help  36a1eb4dcee3c27e1ed72f2af63c8ea882a38863

related fdo#70998 rename Picture to Image

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

diff --git a/helpcontent2 b/helpcontent2
index 3019c4e..36a1eb4 16
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 3019c4ebd3984158f2b0b0b7f9f184c48044add8
+Subproject commit 36a1eb4dcee3c27e1ed72f2af63c8ea882a38863
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/CustomTarget_python_shell.mk pyuno/zipcore

2014-10-28 Thread Matthew J . Francis
 pyuno/CustomTarget_python_shell.mk |1 -
 pyuno/zipcore/mac.sh   |9 +++--
 pyuno/zipcore/nonmac.sh|4 
 pyuno/zipcore/python.sh|5 -
 4 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 65809118914e84bf7cb355e2fd3bce75d7271778
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Sun Oct 26 11:34:43 2014 +0800

Fix python wrapper script on OS X

Change-Id: Icfac94022ee026ad8e9d9d5298e5cc7fbd7121be
Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/pyuno/CustomTarget_python_shell.mk 
b/pyuno/CustomTarget_python_shell.mk
index 4cf7f8b..bc6d355 100644
--- a/pyuno/CustomTarget_python_shell.mk
+++ b/pyuno/CustomTarget_python_shell.mk
@@ -30,7 +30,6 @@ $(call gb_CustomTarget_get_workdir,pyuno/python_shell)/os.sh 
: \
$(SRCDIR)/pyuno/zipcore/$(if $(filter 
MACOSX,$(OS)),mac,nonmac).sh
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),SED,1)
sed -e s/%%PYVERSION%%/$(pyuno_PYTHON_SHELL_VERSION)/g \
--e s,%%PYTHON_FRAMEWORK_RELATIVE_PATH%%,$(if $(filter 
MACOSX,$(OS)),../Frameworks/),g \
$  $@
 
 # vim: set noet sw=4 ts=4:
diff --git a/pyuno/zipcore/mac.sh b/pyuno/zipcore/mac.sh
index 9f04b99..830bcda 100644
--- a/pyuno/zipcore/mac.sh
+++ b/pyuno/zipcore/mac.sh
@@ -1,8 +1,13 @@
-PYTHONHOME=$sd_prog/%%PYTHON_FRAMEWORK_RELATIVE_PATH%%LibreOfficePython.framework
+# Set URE_BOOTSTRAP so that uno.getComponentContext() bootstraps a complete
+# OOo UNO environment:
+: ${URE_BOOTSTRAP=vnd.sun.star.pathname:$sd_prog/../Resources/fundamentalrc}
+export URE_BOOTSTRAP
+
+PYTHONHOME=$sd_prog/../Frameworks/LibreOfficePython.framework
 export PYTHONHOME
 
 pybasislibdir=$PYTHONHOME/Versions/%%PYVERSION%%/lib/python%%PYVERSION%%
-PYTHONPATH=$sd_prog:$pybasislibdir:$pybasislibdir/lib-dynload:$pybasislibdir/lib-tk:$pybasislibdir/site-packages${PYTHONPATH+:$PYTHONPATH}
+PYTHONPATH=$sd_prog/../Resources:$sd_prog/../Frameworks:$pybasislibdir:$pybasislibdir/lib-dynload:$pybasislibdir/lib-tk:$pybasislibdir/site-packages${PYTHONPATH+:$PYTHONPATH}
 export PYTHONPATH
 
 # execute binary
diff --git a/pyuno/zipcore/nonmac.sh b/pyuno/zipcore/nonmac.sh
index 791a340..5e7cca1 100644
--- a/pyuno/zipcore/nonmac.sh
+++ b/pyuno/zipcore/nonmac.sh
@@ -1,3 +1,7 @@
+# Set URE_BOOTSTRAP so that uno.getComponentContext() bootstraps a complete
+# OOo UNO environment:
+: ${URE_BOOTSTRAP=vnd.sun.star.pathname:$sd_prog/fundamentalrc}
+export URE_BOOTSTRAP
 
 
PYTHONPATH=$sd_prog:$sd_prog/python-core-%%PYVERSION%%/lib:$sd_prog/python-core-%%PYVERSION%%/lib/lib-dynload:$sd_prog/python-core-%%PYVERSION%%/lib/lib-tk:$sd_prog/python-core-%%PYVERSION%%/lib/site-packages${PYTHONPATH+:$PYTHONPATH}
 export PYTHONPATH
diff --git a/pyuno/zipcore/python.sh b/pyuno/zipcore/python.sh
old mode 100644
new mode 100755
index 89e73b7..bfe6785
--- a/pyuno/zipcore/python.sh
+++ b/pyuno/zipcore/python.sh
@@ -38,8 +38,3 @@ export PATH
 : ${UNO_PATH=$sd_prog}
 export UNO_PATH
 
-# Set URE_BOOTSTRAP so that uno.getComponentContext() bootstraps a complete
-# OOo UNO environment:
-: ${URE_BOOTSTRAP=vnd.sun.star.pathname:$sd_prog/fundamentalrc}
-export URE_BOOTSTRAP
-
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/Executable_vcldemo.mk

2014-10-24 Thread Matthew J . Francis
 vcl/Executable_vcldemo.mk |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 0b7631bccb2a47ab71a0c1edbabe8a5892ff5f9c
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Sun Oct 5 07:36:00 2014 +0800

vcl: Fix vcldemo linkage - was missing tk

Change-Id: I74d395c0fdcbdb5117584af329e6a023414d46af
Reviewed-on: https://gerrit.libreoffice.org/11806
Reviewed-by: Chris Sherlock chris.sherloc...@gmail.com
Tested-by: Chris Sherlock chris.sherloc...@gmail.com

diff --git a/vcl/Executable_vcldemo.mk b/vcl/Executable_vcldemo.mk
index fb29b9a..878ab62 100644
--- a/vcl/Executable_vcldemo.mk
+++ b/vcl/Executable_vcldemo.mk
@@ -25,6 +25,7 @@ $(eval $(call gb_Executable_set_include,vcldemo,\
 
 $(eval $(call gb_Executable_use_libraries,vcldemo,\
 tl \
+tk \
 sal \
 vcl \
 cppu \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/rtl

2014-10-20 Thread Matthew J . Francis
 include/rtl/strbuf.hxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 8091cf383a122f2348d6e25df90fc26579fe6ef7
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Fri Oct 17 20:48:08 2014 +0800

Increase assert coverage of OStringBuffer arguments

Change-Id: Ifd3c9919ef104909efa8964e7a0cb5e723e3331d
Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx
index b8d1d9d..1bfe640 100644
--- a/include/rtl/strbuf.hxx
+++ b/include/rtl/strbuf.hxx
@@ -491,7 +491,7 @@ public:
  */
 OStringBuffer  append( const sal_Char * str, sal_Int32 len)
 {
-// insert behind the last character
+assert( len = 0 );
 rtl_stringbuffer_insert( pData, nCapacity, getLength(), str, len );
 return *this;
 }
@@ -729,7 +729,8 @@ public:
  */
 OStringBuffer  insert( sal_Int32 offset, const sal_Char * str, sal_Int32 
len)
 {
-// insert behind the last character
+assert( offset = 0  offset = pData-length );
+assert( len = 0 );
 rtl_stringbuffer_insert( pData, nCapacity, offset, str, len );
 return *this;
 }
@@ -911,6 +912,8 @@ public:
  */
 OStringBuffer  remove( sal_Int32 start, sal_Int32 len )
 {
+assert( start = 0  start = pData-length );
+assert( len = 0 );
 rtl_stringbuffer_remove( pData, start, len );
 return *this;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-10-20 Thread Matthew J . Francis
 svx/source/tbxctrls/PaletteManager.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 36b25a83fe0b6b0ae0f179bedfc207375633ed19
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Sun Oct 19 16:24:55 2014 +0800

fdo#85185 Copy OUString argument to avoid a use after free

The original OUString is destroyed along with its containing
object part way through the call to PaletteManager::PopupColorPicker(),
so a copy must be taken

Change-Id: I8417ff23a17003e80a4f65e0cf1ad2a8dda5386c
Reviewed-on: https://gerrit.libreoffice.org/12031
Reviewed-by: Noel Grandin noelgran...@gmail.com
Tested-by: Noel Grandin noelgran...@gmail.com

diff --git a/svx/source/tbxctrls/PaletteManager.cxx 
b/svx/source/tbxctrls/PaletteManager.cxx
index ca4c014..c561a5e 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -197,6 +197,8 @@ void 
PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater)
 
 void PaletteManager::PopupColorPicker(const OUString aCommand)
 {
+// The calling object goes away during aColorDlg.Execute(), so we must 
copy this
+OUString aCommandCopy = aCommand;
 SvColorDialog aColorDlg( 0 );
 aColorDlg.SetColor ( mLastColor );
 aColorDlg.SetMode( svtools::ColorPickerMode_MODIFY );
@@ -206,7 +208,7 @@ void PaletteManager::PopupColorPicker(const OUString 
aCommand)
 mpBtnUpdater-Update( aColorDlg.GetColor() );
 mLastColor = aColorDlg.GetColor();
 AddRecentColor( mLastColor );
-DispatchColorCommand(aCommand, mLastColor);
+DispatchColorCommand(aCommandCopy, mLastColor);
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/rtl

2014-10-17 Thread Matthew J . Francis
 include/rtl/ustrbuf.hxx |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit eca78aee9bde79d9f02cda3bfae6c2bc601605b6
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Fri Oct 17 09:30:26 2014 +0800

Increase assert coverage of OUStringBuffer arguments

Only covers arguments that can be validated with a simple
comparison, and does not attempt validation of arguments which
would require calculation of the length of a string inline

Change-Id: I8a29c8743b47efe3dd45897a1f1371191a5ddb62
Signed-off-by: Stephan Bergmann sberg...@redhat.com

diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx
index b3cee75..8ed7381 100644
--- a/include/rtl/ustrbuf.hxx
+++ b/include/rtl/ustrbuf.hxx
@@ -474,7 +474,7 @@ public:
  */
 OUStringBuffer  append( const sal_Unicode * str, sal_Int32 len)
 {
-// insert behind the last character
+assert( len = 0 );
 rtl_uStringbuffer_insert( pData, nCapacity, getLength(), str, len );
 return *this;
 }
@@ -553,6 +553,7 @@ public:
  */
 OUStringBuffer  appendAscii( const sal_Char * str, sal_Int32 len)
 {
+assert( len = 0 );
 rtl_uStringbuffer_insert_ascii( pData, nCapacity, getLength(), str, 
len );
 return *this;
 }
@@ -795,7 +796,8 @@ public:
  */
 OUStringBuffer  insert( sal_Int32 offset, const sal_Unicode * str, 
sal_Int32 len)
 {
-// insert behind the last character
+assert( offset = 0  offset = pData-length );
+assert( len = 0 );
 rtl_uStringbuffer_insert( pData, nCapacity, offset, str, len );
 return *this;
 }
@@ -1039,6 +1041,8 @@ public:
  */
 OUStringBuffer  remove( sal_Int32 start, sal_Int32 len )
 {
+assert( start = 0  start = pData-length );
+assert( len = 0 );
 rtl_uStringbuffer_remove( pData, start, len );
 return *this;
 }
@@ -1055,6 +1059,7 @@ public:
  */
 OUStringBuffer  truncate( sal_Int32 start = 0 )
 {
+assert( start = 0  start = pData-length );
 rtl_uStringbuffer_remove( pData, start, getLength() - start );
 return *this;
 }
@@ -1119,6 +1124,7 @@ public:
 */
 sal_Int32 indexOf( sal_Unicode ch, sal_Int32 fromIndex = 0 ) const
 {
+assert( fromIndex = 0  fromIndex = pData-length );
 sal_Int32 ret = rtl_ustr_indexOfChar_WithLength( 
pData-buffer+fromIndex, pData-length-fromIndex, ch );
 return (ret  0 ? ret : ret+fromIndex);
 }
@@ -1155,6 +1161,7 @@ public:
 */
 sal_Int32 lastIndexOf( sal_Unicode ch, sal_Int32 fromIndex ) const
 {
+assert( fromIndex = 0  fromIndex = pData-length );
 return rtl_ustr_lastIndexOfChar_WithLength( pData-buffer, fromIndex, 
ch );
 }
 
@@ -1177,6 +1184,7 @@ public:
 */
 sal_Int32 indexOf( const OUString  str, sal_Int32 fromIndex = 0 ) const
 {
+assert( fromIndex = 0  fromIndex = pData-length );
 sal_Int32 ret = rtl_ustr_indexOfStr_WithLength( 
pData-buffer+fromIndex, pData-length-fromIndex,
 str.pData-buffer, 
str.pData-length );
 return (ret  0 ? ret : ret+fromIndex);
@@ -1242,6 +1250,7 @@ public:
 */
 sal_Int32 lastIndexOf( const OUString  str, sal_Int32 fromIndex ) const
 {
+assert( fromIndex = 0  fromIndex = pData-length );
 return rtl_ustr_lastIndexOfStr_WithLength( pData-buffer, fromIndex,
str.pData-buffer, 
str.pData-length );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sysui/desktop

2014-10-13 Thread Matthew J . Francis
 sysui/desktop/macosx/Info.plist.in |   92 +
 1 file changed, 92 insertions(+)

New commits:
commit e71b696ef6a50db0cb6a02e261b858e05fdb1a8f
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Mon Oct 13 22:15:09 2014 +0800

Register flat file mime types on OS X

Change-Id: I505703b2f6890586e05e6c2146d9b37774f101d0
Reviewed-on: https://gerrit.libreoffice.org/11957
Reviewed-by: Tor Lillqvist t...@collabora.com
Tested-by: Tor Lillqvist t...@collabora.com

diff --git a/sysui/desktop/macosx/Info.plist.in 
b/sysui/desktop/macosx/Info.plist.in
index 892d0df..b9c78c0 100755
--- a/sysui/desktop/macosx/Info.plist.in
+++ b/sysui/desktop/macosx/Info.plist.in
@@ -71,6 +71,28 @@
/array
/dict
/dict
+   dict
+   keyUTTypeIdentifier/key
+   stringvnd.oasis.opendocument.text-flat-xml/string
+   keyUTTypeDescription/key
+   stringOpenDocument Text (Flat XML)/string
+   keyUTTypeConformsTo/key
+   array
+   stringpublic.data/string
+   stringpublic.content/string
+   /array
+   keyUTTypeTagSpecification/key
+   dict
+   keypublic.filename-extension/key
+   array
+   stringfodt/string
+   /array
+   keypublic.mime-type/key
+   array
+   
stringapplication/vnd.oasis.opendocument.text-flat-xml/string
+   /array
+   /dict
+   /dict
 
!-- Calc documents --
dict
@@ -119,6 +141,28 @@
/array
/dict
/dict
+   dict
+   keyUTTypeIdentifier/key
+   
stringvnd.oasis.opendocument.spreadsheet-flat-xml/string
+   keyUTTypeDescription/key
+   stringOpenDocument Spreadsheet (Flat XML)/string
+   keyUTTypeConformsTo/key
+   array
+   stringpublic.data/string
+   stringpublic.content/string
+   /array
+   keyUTTypeTagSpecification/key
+   dict
+   keypublic.filename-extension/key
+   array
+   stringfods/string
+   /array
+   keypublic.mime-type/key
+   array
+   
stringapplication/vnd.oasis.opendocument.spreadsheet-flat-xml/string
+   /array
+   /dict
+   /dict
 
!-- Impress documents --
dict
@@ -169,6 +213,28 @@
/array
/dict
/dict
+   dict
+   keyUTTypeIdentifier/key
+   
stringvnd.oasis.opendocument.presentation-flat-xml/string
+   keyUTTypeDescription/key
+   stringOpenDocument Presentation/string
+   keyUTTypeConformsTo/key
+   array
+   stringpublic.data/string
+   stringpublic.content/string
+   /array
+   keyUTTypeTagSpecification/key
+   dict
+   keypublic.filename-extension/key
+   array
+   stringfodp/string
+   /array
+   keypublic.mime-type/key
+   array
+   
stringapplication/vnd.oasis.opendocument.presentation-flat-xml/string
+   /array
+   /dict
+   /dict
 
!-- Draw documents --
dict
@@ -217,6 +283,28 @@
/array
/dict
/dict
+   dict
+   keyUTTypeIdentifier/key
+   
stringvnd.oasis.opendocument.graphics-flat-xml/string
+   keyUTTypeDescription/key
+   stringOpenDocument Drawing (Flat XML)/string
+   keyUTTypeConformsTo/key
+   array
+   stringpublic.data/string

[Libreoffice-commits] core.git: Branch 'libreoffice-4-3-3' - sc/source

2014-10-10 Thread Matthew J . Francis
 sc/source/core/data/document10.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit af79db308c86d200d9fb76001167511408c68bce
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Thu Oct 9 13:02:18 2014 +0800

fdo#84810 Avoid calc crash when using Paste Special - Link

Change-Id: I52c072578ccc0b9f75a850613056e74d400eb532
Reviewed-on: https://gerrit.libreoffice.org/11867
Reviewed-by: Kohei Yoshida libreoff...@kohei.us
Tested-by: Kohei Yoshida libreoff...@kohei.us
(cherry picked from commit 2b6619c597a791775e2d41a68f7e85ef75d1aaa2)
Reviewed-on: https://gerrit.libreoffice.org/11875
(cherry picked from commit b2707c0545d7cc762a9ccfbb8a3b3cea495195e2)
Reviewed-on: https://gerrit.libreoffice.org/11879
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index e468dd3..baf7314 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -76,6 +76,8 @@ bool ScDocument::CopyOneCellFromClip(
 return false;
 
 ScCellValue rSrcCell = rCxt.getSingleCell();
+const ScPatternAttr* pAttr = pClipDoc-GetPattern(aSrcPos);
+rCxt.setSingleCellPattern(pAttr);
 if (rCxt.isAsLink())
 {
 ScSingleRefData aRef;
@@ -89,8 +91,6 @@ bool ScDocument::CopyOneCellFromClip(
 else
 {
 rSrcCell.set(pClipDoc-GetRefCellValue(aSrcPos));
-const ScPatternAttr* pAttr = pClipDoc-GetPattern(aSrcPos);
-rCxt.setSingleCellPattern(pAttr);
 
 // Check the paste flag to see whether we want to paste this cell.  If 
the
 // flag says we don't want to paste this cell, we'll return with true.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - sc/source

2014-10-09 Thread Matthew J . Francis
 sc/source/core/data/document10.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b2707c0545d7cc762a9ccfbb8a3b3cea495195e2
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Thu Oct 9 13:02:18 2014 +0800

fdo#84810 Avoid calc crash when using Paste Special - Link

Change-Id: I52c072578ccc0b9f75a850613056e74d400eb532
Reviewed-on: https://gerrit.libreoffice.org/11867
Reviewed-by: Kohei Yoshida libreoff...@kohei.us
Tested-by: Kohei Yoshida libreoff...@kohei.us
(cherry picked from commit 2b6619c597a791775e2d41a68f7e85ef75d1aaa2)
Reviewed-on: https://gerrit.libreoffice.org/11875

diff --git a/sc/source/core/data/document10.cxx 
b/sc/source/core/data/document10.cxx
index e468dd3..baf7314 100644
--- a/sc/source/core/data/document10.cxx
+++ b/sc/source/core/data/document10.cxx
@@ -76,6 +76,8 @@ bool ScDocument::CopyOneCellFromClip(
 return false;
 
 ScCellValue rSrcCell = rCxt.getSingleCell();
+const ScPatternAttr* pAttr = pClipDoc-GetPattern(aSrcPos);
+rCxt.setSingleCellPattern(pAttr);
 if (rCxt.isAsLink())
 {
 ScSingleRefData aRef;
@@ -89,8 +91,6 @@ bool ScDocument::CopyOneCellFromClip(
 else
 {
 rSrcCell.set(pClipDoc-GetRefCellValue(aSrcPos));
-const ScPatternAttr* pAttr = pClipDoc-GetPattern(aSrcPos);
-rCxt.setSingleCellPattern(pAttr);
 
 // Check the paste flag to see whether we want to paste this cell.  If 
the
 // flag says we don't want to paste this cell, we'll return with true.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-10-07 Thread Matthew J . Francis
 i18npool/source/search/textsearch.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 555a7a601b33c18472be7e99b0f9c8acb05a82d7
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Tue Oct 7 01:51:37 2014 +0800

Avoid accessing 1 character after a string

Found while trying to reproduce fdo#83141, but not related to
that - it just happened to trigger the relevant assert on a dbgutil
build.

The change to TextSearch::NSrchFrwrd() fixes the crash triggered
by reproducing the above bug.
The change to TextSearch::NSrchBkwrd() is by analogy but seems an
equally good idea.

Change-Id: I68c2c87b632dd53453f92394519a06f62e41bbad
Reviewed-on: https://gerrit.libreoffice.org/11830
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/i18npool/source/search/textsearch.cxx 
b/i18npool/source/search/textsearch.cxx
index ef8217b..98aa1b6 100644
--- a/i18npool/source/search/textsearch.cxx
+++ b/i18npool/source/search/textsearch.cxx
@@ -614,7 +614,7 @@ SearchResult TextSearch::NSrchFrwrd( const OUString 
searchStr, sal_Int32 startP
 bool bAtStart = !nCmpIdx;
 bool bAtEnd = nFndEnd == endPos;
 bool bDelimBefore = bAtStart || IsDelimiter( aStr, 
nCmpIdx-1 );
-bool bDelimBehind = IsDelimiter(  aStr, nFndEnd );
+bool bDelimBehind = bAtEnd || IsDelimiter(  aStr, nFndEnd 
);
 //  *   1 - only one word in the paragraph
 //  *   2 - at begin of paragraph
 //  *   3 - at end of paragraph
@@ -685,7 +685,7 @@ SearchResult TextSearch::NSrchBkwrd( const OUString 
searchStr, sal_Int32 startP
 sal_Int32 nFndStt = nCmpIdx - sSearchKey.getLength();
 bool bAtStart = !nFndStt;
 bool bAtEnd = nCmpIdx == startPos;
-bool bDelimBehind = IsDelimiter( aStr, nCmpIdx );
+bool bDelimBehind = bAtEnd || IsDelimiter( aStr, nCmpIdx );
 bool bDelimBefore = bAtStart || // begin of paragraph
 IsDelimiter( aStr, nFndStt-1 );
 //  *   1 - only one word in the paragraph
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - i18npool/source

2014-10-07 Thread Matthew J . Francis
 i18npool/source/search/textsearch.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 25e7318a294c5613a9a2361e0e1cebd5c214d336
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Tue Oct 7 01:51:37 2014 +0800

Avoid accessing 1 character after a string

Found while trying to reproduce fdo#83141, but not related to
that - it just happened to trigger the relevant assert on a dbgutil
build.

The change to TextSearch::NSrchFrwrd() fixes the crash triggered
by reproducing the above bug.
The change to TextSearch::NSrchBkwrd() is by analogy but seems an
equally good idea.

Change-Id: I68c2c87b632dd53453f92394519a06f62e41bbad
Reviewed-on: https://gerrit.libreoffice.org/11830
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com
(cherry picked from commit 555a7a601b33c18472be7e99b0f9c8acb05a82d7)
Reviewed-on: https://gerrit.libreoffice.org/11846

diff --git a/i18npool/source/search/textsearch.cxx 
b/i18npool/source/search/textsearch.cxx
index d95600d..e2d424f 100644
--- a/i18npool/source/search/textsearch.cxx
+++ b/i18npool/source/search/textsearch.cxx
@@ -615,7 +615,7 @@ SearchResult TextSearch::NSrchFrwrd( const OUString 
searchStr, sal_Int32 startP
 bool bAtStart = !nCmpIdx;
 bool bAtEnd = nFndEnd == endPos;
 bool bDelimBefore = bAtStart || IsDelimiter( aStr, 
nCmpIdx-1 );
-bool bDelimBehind = IsDelimiter(  aStr, nFndEnd );
+bool bDelimBehind = bAtEnd || IsDelimiter(  aStr, nFndEnd 
);
 //  *   1 - only one word in the paragraph
 //  *   2 - at begin of paragraph
 //  *   3 - at end of paragraph
@@ -686,7 +686,7 @@ SearchResult TextSearch::NSrchBkwrd( const OUString 
searchStr, sal_Int32 startP
 sal_Int32 nFndStt = nCmpIdx - sSearchKey.getLength();
 bool bAtStart = !nFndStt;
 bool bAtEnd = nCmpIdx == startPos;
-bool bDelimBehind = IsDelimiter( aStr, nCmpIdx );
+bool bDelimBehind = bAtEnd || IsDelimiter( aStr, nCmpIdx );
 bool bDelimBefore = bAtStart || // begin of paragraph
 IsDelimiter( aStr, nFndStt-1 );
 //  *   1 - only one word in the paragraph
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa

2014-10-06 Thread Matthew J . Francis
 sw/qa/core/uwriter.cxx |  490 +
 1 file changed, 292 insertions(+), 198 deletions(-)

New commits:
commit 2c6d17b02529f0bc8bfcb1fc16f9e1481ea71829
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Sun Oct 5 13:09:03 2014 +0800

Refactor giant SwDocTest::testModelToViewHelper() into smaller tests

This is to clear the way for following bugfixes which will add to /
amend these tests

Change-Id: Ie97aba72f1a4c7b1be37577b9bcab2b2f0750d17
Reviewed-on: https://gerrit.libreoffice.org/11808
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index a739ca0..a9f4fbd 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -80,6 +80,22 @@ public:
 void testFileNameFields();
 void testDocStat();
 void testModelToViewHelper();
+void testModelToViewHelperPassthrough();
+void testModelToViewHelperExpandFieldsExpandFootnote();
+void testModelToViewHelperExpandFieldsExpandFootnoteReplaceMode();
+void testModelToViewHelperExpandFields();
+void testModelToViewHelperExpandFieldsReplaceMode();
+void testModelToViewHelperExpandFieldsHideInvisible();
+void testModelToViewHelperExpandFieldsHideRedlined();
+void testModelToViewHelperExpandFieldsHideInvisibleExpandFootnote();
+void 
testModelToViewHelperExpandFieldsHideInvisibleExpandFootnoteReplaceMode();
+void testModelToViewHelperExpandFieldsHideHideRedlinedExpandFootnote();
+void 
testModelToViewHelperExpandFieldsHideHideRedlinedExpandFootnoteReplaceMode();
+void testModelToViewHelperHideInvisibleHideRedlined();
+void 
testModelToViewHelperExpandFieldsHideInvisibleHideRedlinedExpandFootnote();
+void 
testModelToViewHelperExpandFieldsHideInvisibleHideRedlinedExpandFootnoteReplaceMode();
+void testModelToViewHelperExpandFieldsExpandFootnote2();
+void testModelToViewHelperExpandFieldsExpandFootnoteReplaceMode2();
 void testSwScanner();
 void testUserPerceivedCharCount();
 void testGraphicAnchorDeletion();
@@ -92,7 +108,21 @@ public:
 CPPUNIT_TEST(testPageDescName);
 CPPUNIT_TEST(testFileNameFields);
 CPPUNIT_TEST(testDocStat);
-CPPUNIT_TEST(testModelToViewHelper);
+CPPUNIT_TEST(testModelToViewHelperExpandFieldsExpandFootnote);
+CPPUNIT_TEST(testModelToViewHelperExpandFieldsExpandFootnoteReplaceMode);
+CPPUNIT_TEST(testModelToViewHelperExpandFields);
+CPPUNIT_TEST(testModelToViewHelperExpandFieldsReplaceMode);
+CPPUNIT_TEST(testModelToViewHelperExpandFieldsHideInvisible);
+CPPUNIT_TEST(testModelToViewHelperExpandFieldsHideRedlined);
+CPPUNIT_TEST(testModelToViewHelperExpandFieldsHideInvisibleExpandFootnote);
+
CPPUNIT_TEST(testModelToViewHelperExpandFieldsHideInvisibleExpandFootnoteReplaceMode);
+
CPPUNIT_TEST(testModelToViewHelperExpandFieldsHideHideRedlinedExpandFootnote);
+
CPPUNIT_TEST(testModelToViewHelperExpandFieldsHideHideRedlinedExpandFootnoteReplaceMode);
+CPPUNIT_TEST(testModelToViewHelperHideInvisibleHideRedlined);
+
CPPUNIT_TEST(testModelToViewHelperExpandFieldsHideInvisibleHideRedlinedExpandFootnote);
+
CPPUNIT_TEST(testModelToViewHelperExpandFieldsHideInvisibleHideRedlinedExpandFootnoteReplaceMode);
+CPPUNIT_TEST(testModelToViewHelperExpandFieldsExpandFootnote2);
+CPPUNIT_TEST(testModelToViewHelperExpandFieldsExpandFootnoteReplaceMode2);
 CPPUNIT_TEST(testSwScanner);
 CPPUNIT_TEST(testUserPerceivedCharCount);
 CPPUNIT_TEST(testGraphicAnchorDeletion);
@@ -226,220 +256,284 @@ void SwDocTest::testUserPerceivedCharCount()
 CPPUNIT_ASSERT_MESSAGE(Surrogate Pair should be counted as single 
character, nCount == 1);
 }
 
-void SwDocTest::testModelToViewHelper()
+SwTxtNode* getModelToViewTestDocument(SwDoc *pDoc)
 {
-SwNodeIndex aIdx(m_pDoc-GetNodes().GetEndOfContent(), -1);
+SwNodeIndex aIdx(pDoc-GetNodes().GetEndOfContent(), -1);
 SwPaM aPaM(aIdx);
 
-{
-SwFmtFtn aFtn;
-aFtn.SetNumStr(OUString(foo));
+SwFmtFtn aFtn;
+aFtn.SetNumStr(OUString(foo));
 
-
m_pDoc-getIDocumentContentOperations().AppendTxtNode(*aPaM.GetPoint());
-m_pDoc-getIDocumentContentOperations().InsertString(aPaM, 
OUString(A B ));
-SwTxtNode* pTxtNode = aPaM.GetNode().GetTxtNode();
-sal_Int32 nPos = aPaM.GetPoint()-nContent.GetIndex();
-pTxtNode-InsertItem(aFtn, nPos, nPos);
-m_pDoc-getIDocumentContentOperations().InsertString(aPaM, OUString( 
C ));
-nPos = aPaM.GetPoint()-nContent.GetIndex();
-pTxtNode-InsertItem(aFtn, nPos, nPos);
-m_pDoc-getIDocumentContentOperations().InsertString(aPaM, OUString( 
D));
-CPPUNIT_ASSERT(pTxtNode-GetTxt().getLength() == (4*5) + 5 + 2);
-
-//set start of selection to first B
-aPaM.GetPoint()-nContent.Assign(aPaM.GetCntntNode(), 6

[Libreoffice-commits] core.git: sal/osl

2014-10-03 Thread Matthew J . Francis
 sal/osl/unx/thread.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 794e5c7a3f4292ac849ca993c12c7953b5e85102
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Fri Oct 3 14:29:12 2014 +0800

Fix unbalanced new/free() - new/delete

(Spotted while valgrinding an unrelated issue)

Change-Id: I2eab4c08e251d79f427fd01442c4dce20d7d89f0
Reviewed-on: https://gerrit.libreoffice.org/11785
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index f23f55b..f681175 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -166,7 +166,7 @@ static void osl_thread_destruct_Impl (Thread_Impl ** ppImpl)
 pthread_cond_destroy  (((*ppImpl)-m_Cond));
 pthread_mutex_destroy (((*ppImpl)-m_Lock));
 
-free (*ppImpl);
+delete *ppImpl;
 (*ppImpl) = 0;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-10-03 Thread Matthew J . Francis
 sw/source/core/text/itratr.cxx |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 7f5ed8228290e6e9ca9fac301d6a6adbda31ff23
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Fri Oct 3 11:27:20 2014 +0800

Speed up SwAttrIter::GetNextAttr()

The inner loop which iterates over the characters of
m_pTxtNode-GetTxt() is already bounded to the length of the
string, so there's no need to pay the price of checking its length
for each array position

Change-Id: I7674ea2b46db75fea30dd016b96ec932068fd73b
Reviewed-on: https://gerrit.libreoffice.org/11784
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 3c4451c..a66618f 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -306,11 +306,19 @@ sal_Int32 SwAttrIter::GetNextAttr( ) const
 // TODO maybe use hints like FieldHints for this instead of looking at 
the text...
 const sal_Int32 l = nNextm_pTxtNode-Len() ? nNext : 
m_pTxtNode-Len();
 sal_Int32 p=nPos;
-while (pl  m_pTxtNode-GetTxt()[p] != CH_TXT_ATR_FIELDSTART
-m_pTxtNode-GetTxt()[p] != CH_TXT_ATR_FIELDEND
-m_pTxtNode-GetTxt()[p] != CH_TXT_ATR_FORMELEMENT)
+const sal_Unicode* aStr = m_pTxtNode-GetTxt().getStr();
+while (pl)
 {
-++p;
+sal_Unicode aChar = aStr[p];
+if (aChar  CH_TXT_ATR_FORMELEMENT
+|| aChar  CH_TXT_ATR_FIELDEND)
+{
+++p;
+}
+else
+{
+break;
+}
 }
 if ((pl  pnPos) || nNext=p)
 nNext=p;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/unx

2014-09-30 Thread Matthew J . Francis
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 9db2eeea92d3a1e0571ae91eb74e218662732be9
Author: Matthew J. Francis mjay.fran...@gmail.com
Date:   Mon Sep 29 12:38:05 2014 +0800

Avoid leaking a GtkMenu

This is only freed on application exit, but in as far as there's
a point to freeing it at all we should do it properly.
Our handling of this GtkMenu is unique - it isn't owned by
anything, and we paint it ourself manually. Therefore, in order to
handle the refcounting correctly, we should sink the initially
floating reference, and explicitly unreference it to finalise.
Valgrind confirms that the leak is eliminated by doing this.

Change-Id: I4c796c4d37dd8f514aff9768fab66168d36bae64
Reviewed-on: https://gerrit.libreoffice.org/11682
Reviewed-by: Michael Meeks michael.me...@collabora.com
Tested-by: Michael Meeks michael.me...@collabora.com

diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx 
b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index ee623bc..bab4f5c 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -489,7 +489,7 @@ void GtkData::deInitNWF( void )
 if( gWidgetData[i].gCacheWindow )
 gtk_widget_destroy( gWidgetData[i].gCacheWindow );
 if( gWidgetData[i].gMenuWidget )
-gtk_widget_destroy( gWidgetData[i].gMenuWidget );
+g_object_unref (gWidgetData[i].gMenuWidget);
 if( gWidgetData[i].gTooltipPopup )
 gtk_widget_destroy( gWidgetData[i].gTooltipPopup );
 if( gWidgetData[i].gDialog )
@@ -4400,6 +4400,8 @@ static void NWEnsureGTKMenu( SalX11Screen nScreen )
 gWidgetData[nScreen].gMenuItemSeparatorMenuWidget = 
gtk_menu_item_new();
 gWidgetData[nScreen].gImageMenuItem   = 
gtk_image_menu_item_new();
 
+g_object_ref_sink (gWidgetData[nScreen].gMenuWidget);
+
 gtk_menu_shell_append( GTK_MENU_SHELL( 
gWidgetData[nScreen].gMenuWidget ), gWidgetData[nScreen].gMenuItemMenuWidget );
 gtk_menu_shell_append( GTK_MENU_SHELL( 
gWidgetData[nScreen].gMenuWidget ), 
gWidgetData[nScreen].gMenuItemCheckMenuWidget );
 gtk_menu_shell_append( GTK_MENU_SHELL( 
gWidgetData[nScreen].gMenuWidget ), 
gWidgetData[nScreen].gMenuItemRadioMenuWidget );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/04/11104/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/04/11104/3'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/04/11104/1'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/87/11187/5'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/87/11187/3'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/30/11530/1'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/87/11187/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/87/11187/6'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/38/11638/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/53/11553/7'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/06/11106/1'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/30/11530/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/87/11187/7'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/87/11187/1'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/53/11553/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/53/11553/9'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/87/11187/4'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/53/11553/3'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/06/11106/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/29/11629/1'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/80/11280/1'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/38/11638/3'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/05/11105/1'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/29/11629/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/13/11213/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/13/11213/1'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/53/11553/8'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/29/11629/4'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/53/11553/4'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/64/11264/1'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/29/11629/3'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/74/11374/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/66/11566/3'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/66/11566/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/02/11502/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/02/11502/1'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/78/11678/2'

2014-09-29 Thread Matthew J . Francis

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >