Age | Commit message (Collapse) | Author |
|
Change-Id: I483deb33b9d861af679d4a36e13585345401e10d
Reviewed-on: https://gerrit.libreoffice.org/16681
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
|
|
Change-Id: If02a62e814051bb2d75a683877f8d17ec9201993
|
|
Change-Id: I0ea809a888187624261182552cf7fa0a9c96c648
|
|
Change-Id: I0dd118f0215e06fec0cccff9b46d80f13bd802cc
Reviewed-on: https://gerrit.libreoffice.org/16620
Reviewed-by: Matthew Francis <mjay.francis@gmail.com>
Tested-by: Matthew Francis <mjay.francis@gmail.com>
|
|
Change-Id: Ie0266c7e8ab5980dc25ce14edd42b3f599f71245
|
|
Change-Id: If495a415d4263d1932c03a31d07a517218533847
|
|
Change-Id: I5f0bceb240a492c7c010b4356bc8efafdd83bf24
|
|
Change-Id: I66410932347b4f65c4b24b5316009ecffc8aef06
|
|
Change-Id: I4875b12807aed36f758d81c731e2ac52a3a606e4
|
|
Change-Id: I9975a87f6df2b7a79c376130864e9eb54bc3452b
|
|
Change-Id: I19d801444e4d1db5576b5742c60fc138384d3b70
|
|
Change-Id: Id2efd6f38390bb73620cf40121430c4226024103
|
|
- 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 by slices
rng = cellrange['A1:B2'] # Access cell range by descriptor
rng = cellrange['Name'] # Access cell range by name
Note that the indices used are in Python/C order, and differ from
the arguments to methods provided by XCellRange.
- The statement cellrange[r,c], which returns the cell from row r
and column c, is equivalent to calling
XCellRange::getCellByPosition(c,r)
- The statement cellrange[t:b,l:r], which returns a cell range
covering rows t to b(non-inclusive) and columns l to r(non-
inclusive), is equivalent to calling
XCellRange::getCellRangeByPosition(l,t,r-1,b-1).
In contrast to the handling of objects implementing XIndex*,
extended slice syntax is not supported. Negative indices (from-end
addresses) are supported only for objects which also implement
com::sun::star::table::XColumnRowRange (currently Calc spreadsheet
sheets and cell ranges created upon these). For such objects, the
following syntax is also available:
rng = cellrange[0] # Access cell range by row index
rng = cellrange[0,:] # Access cell range by row index
rng = cellrange[:,0] # Access cell range by column index
3. Elimination of explicit Any
==============================
PyUNO has not previously been able to cope with certain method
arguments which are typed as Any but require a sequence of specific
type to be passed. This is a particular issue for container
interfaces such as XIndexContainer and XNameContainer.
The existing solution to dealing with such methods is to use a
special method to pass an explicitly typed Any, giving code such as:
index = doc.createInstance("com.sun.star.text.ContentIndex");
...
uno.invoke( index.LevelParagraphStyles , "replaceByIndex",
(0, uno.Any("[]string", ('Caption',))) )
The new Pythonic container access is able to correctly infer the
expected type of the sequences required by these arguments. In the
new style, the above call to .replaceByIndex() can instead be
written:
index.LevelParagraphStyles[0] = ('Caption',)
4. List and iterator arguments
==============================
Wherever a UNO API expects a sequence, a Python list or iterator can
now be passed. This enables the use of list comprehensions and
generator expressions for method calls and property assignments.
Example:
tbl = doc.createInstance('com.sun.star.text.TextTable')
tbl.initialize(10,10)
# ... insert table ...
# Assign numbers 0..99 to the cells using a generator expression
tbl.Data = ((y for y in range(10*x,10*x + 10)) for x in range(10))
5. Tolerant struct initialisation
=================================
Previously, a UNO struct could be created fully uninitialised, or by
passing a combination of positional and/or named arguments to its
constructor. However, if any arguments were passed, all members were
required to be initialised or an exception was thrown.
This requirement is relaxed such that when all arguments passed to a
struct constructor are by name, some may be omitted. The existing
requirement that all members must be explicitly initialised when
some constructor arguments are unnamed (positional) is not affected.
Example:
from com.sun.star.beans import PropertyValue
prop = PropertyValue(Name='foo', Value='bar')
Change-Id: Id29bff10a18099b1a00af1abee1a6c1bc58b3978
Reviewed-on: https://gerrit.libreoffice.org/16272
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Matthew Francis <mjay.francis@gmail.com>
|
|
Change-Id: I16d99991b8b88753c593a5a1ab9e32a8e0264514
|
|
Change-Id: I21c352a63d668c174eef212dbfbe6346c678ce4d
|
|
Change-Id: I696c0693dc7a69dc3a4b8df0c4e8571414d5b9a6
|
|
The CPython changelog says for version 2.4:
- Python no longer relies on the LC_NUMERIC locale setting to be
the "C" locale; as a result, it no longer tries to prevent changing
the LC_NUMERIC category.
Change-Id: I6d63c4dedca48c99bf81135d69285d9116a19740
|
|
Change-Id: Iffa346c16a6775b206c8f8613eee9e7201e3badb
|
|
Change-Id: Ib4def3435eab4625645c5afe3b151f9f430564ac
|
|
Change-Id: I0968c4b37b97bb89ebc8b873c78a96431245f480
|
|
...and css::uno::makeAny<css::uno::Any>() was never meant to be used. Introduce
css::uno::toAny for the (template-code) cases that shall return an Any for both
Any and non-Any inputs.
Change-Id: Ifa977d73f1da71b2fedde7e8140b19497c4a0257
|
|
Change-Id: Id848d14133fee5104e79ba0683cbaf942598faa7
|
|
Change-Id: I1b49c020d597b569e330482f4dbf20c15ccdae3f
|
|
Change-Id: I3676d56e65dd2d5b36882073c63e571a79819fee
|
|
Change-Id: Idd06653813e3f4863a5186eb6dce074227c25579
|
|
Change-Id: I71ebd11d850304772535cfb873086176d301172a
|
|
Change-Id: Ice8504041f22e00f2e5010813d9dff1d2987c8d6
|
|
Change-Id: I4a33bd92fc8448638a4bfe1eab7e5041a4c5cc39
|
|
Change-Id: Id108693d84fbca7764614e126ee1b3b045baec17
|
|
Change-Id: If27afeb618435bb1d0d69cad26942ce6dd2cdb92
|
|
Change-Id: I80c9fdb45c9f58ac3cd1b0fab2631b903194e268
|
|
Change-Id: I55abf17a1da2616ca2b1303747ca8cc7e402634e
|
|
you can get debug stl this way
Change-Id: Ia70a3e7c7c452390e8bee34975d296c9318e4a19
|
|
Change-Id: Ib507da6fc85d8bc81fd48108a98ef96d188643ac
|
|
...assuming the delayLoadHook in cli_ure/source/native/native_bootstrap.cxx is
no longer necessary and loading of cppuhelper from the program dir cannot fail
regardless in whatever scenario the cli_cppuhelper library itself is loaded.
Change-Id: I13f32b327bca4cce9780864f5e57cdad3860afe5
|
|
... because at least in Fedora packages with system python it's a pain
to use officehelper.bootstrap() because unlike pyuno it is not installed
in the standard python directories but in libreoffice/program.
You might think that bootstrap() is not appropriate functionality for a
UNO langauge binding, but then why does ::cppu::bootstrap() exist?
Change-Id: I5fd4b344a811c087d32fb6304e55105ab3cb137e
Reviewed-on: https://gerrit.libreoffice.org/12968
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
|
|
Change-Id: Ifa9d12fa190f929807dc0dc7342e162aeb9a0576
|
|
This reverts commit 2386a92c1e6e8ec263edb4dc4fdcfeaa4673ce1f and its follow-ups
1acaa577b67158c060d2f57414f7aea86504a489 "sal: add special handling of argc==0
to osl_setCommandArgs()" and 01f27b5e5d428cc3c4aeabdcbbb8204494fbd435 "sal: fix
osl_setCommandArgs() on WNT."
The situation that osl_getCommandArgCount is called without a prior call to
osl_setCommandArgs should be considered as harmless and can legitimately not
only happen in the pyuno case discussed in the reverted commits, but also in
case binary UNO is bootstrapped from within a Java process, as happens in
test-javanative in ure/source/uretest/Makefile.
Change-Id: I2829db390e37dfe5daeda33a4c0659b7d35e565a
|
|
Change-Id: I41ba46831f24b2960a1fe982b74a2b623e682e0b
|
|
Sadly cannot forward declare "struct {...} TimeValue;".
rtl/(u)?string.hxx still include sal/log.hxx but removing osl/diagnose.h
was painful enough for now...
Change-Id: Id41e17f3870c4f24c53ce7b11f2c40a3d14d1f05
|
|
Change-Id: I1ab4e23b0539f8d39974787f226e57a21f96e959
Reviewed-on: https://gerrit.libreoffice.org/12164
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
|
|
Change-Id: I5ac499df1f4063a80a5d41f60778106a7b96940d
|
|
Change-Id: I0598e9d0c9c33c538aa02eabc2c09d96ec3c9b4d
|
|
- Clean up OSL_ASSERT
Change-Id: I1f3a5dcfe08876da9bb4a8486311eb0ca9bab215
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Change-Id: Icfac94022ee026ad8e9d9d5298e5cc7fbd7121be
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Change-Id: I53b69a488c70769cbb841db519bc28fd211dc087
|
|
It causes annoying messages in the system log in the OS X sandboxed
case.
Change-Id: I8ae3eb34df2c045bdbdfc63cae9007f973c42537
|
|
Change-Id: Ie280325ddc45a79f3b73ae10f6e9cf952657091b
|
|
In other words, only executable files go in the MacOS folder. Dynamic
libraries and bundled frameworks (i.e., LibreOfficePython), and
nothing else, go in the Frameworks folder, and all other files go in
the Resources folder.
Especially, note that Java class files and rc (.ini) files also go in
Resources.
Such an app bundle structure is what Apple strongly suggests one
should use, and it has been hinted that future versions of code
signing and/or Gatekeeper will require such a structure.
There is still some ugliness thanks to traces of the historical
separation of URE from "the office". Like there are two separate
"unorc" files, one for URE, one for the LibreOffice application. IMHO,
this should be cleaned up, but is probably controversial.
(Eek! I now see there are actually *three* unorc files in the app
bundle. Not intentional. Need to fix that later.)
Change-Id: Idcf235038deb5b8e1d061734993e9f31869b7606
|
|
When calling XUnoTunnel::getSomething(), the function must drop the
CPython GIL to avoid deadlock since there are implementations of
XUnoTunnel that acquire SolarMutex.
Change-Id: I51ffce9bdee9a51c932902e77856f865eae81d2a
|