summaryrefslogtreecommitdiffstats
path: root/pyuno/inc
Commit message (Collapse)AuthorAgeFilesLines
* Remove dynamic exception specificationsStephan Bergmann2017-01-261-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | ...(for now, from LIBO_INTERNAL_CODE only). See the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html> "Dynamic Exception Specifications" for details. Most changes have been done automatically by the rewriting loplugin:dynexcspec (after enabling the rewriting mode, to be committed shortly). The way it only removes exception specs from declarations if it also sees a definition, it identified some dead declarations-w/o-definitions (that have been removed manually) and some cases where a definition appeared in multiple include files (which have also been cleaned up manually). There's also been cases of macro paramters (that were used to abstract over exception specs) that have become unused now (and been removed). Furthermore, some code needed to be cleaned up manually (avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no configurations available that would actually build that code. Missing @throws documentation has not been applied in such manual clean-up. Change-Id: I3408691256c9b0c12bc5332de976743626e13960 Reviewed-on: https://gerrit.libreoffice.org/33574 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* New loplugin:dynexcspec: Add @throws documentation, pyunoStephan Bergmann2017-01-191-0/+10
| | | | Change-Id: I1888938e447f8ca115d326d5e4849d6b21904b04
* coverity#1371219 Missing move assignment operatorCaolán McNamara2016-09-231-3/+13
| | | | | | | Change-Id: I72ed6082b561079b45e82d8258fa1abbe23117e2 Reviewed-on: https://gerrit.libreoffice.org/29228 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
* Normalize on using @throws instead of @raise[s]Stephan Bergmann2016-06-061-1/+1
| | | | | | ...as the former is used almost exclusively Change-Id: I38ff11cd0d5125534550df99dd427666011c3b7b
* Get rid of unnecessary directory levels $D/inc/$DTor Lillqvist2016-05-271-2/+2
| | | | | | | | Change-Id: Ibf313b8948a493043006ebf3a8281487c1f67b48 Reviewed-on: https://gerrit.libreoffice.org/25532 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
* Avoid reserved identifierStephan Bergmann2016-03-291-2/+2
| | | | Change-Id: Icf8858590d0e1563acebc9d55fe6898ce7416dd5
* loplugin:nullptr (automatic rewrite)Stephan Bergmann2015-11-101-3/+3
| | | | Change-Id: I7a5fda2606f42e2736ad0618f2d8bcc5ba4028fb
* com::sun::star->css in package,pyunoNoel Grandin2015-10-231-15/+15
| | | | Change-Id: I7b7b0e7fea2d1a2b9f6f5501ad5e0b8c1b4a17b9
* Replace "SAL_DELETED_FUNCTION" with "= delete" in LIBO_INTERNAL_ONLY codeStephan Bergmann2015-10-121-4/+4
| | | | Change-Id: I328ac7a95ccc87732efae48b567a0556865928f3
* loplugin:unusedmethods bridges,ucbhelper,io,pyunoNoel Grandin2015-07-021-8/+0
| | | | | | | Change-Id: I483deb33b9d861af679d4a36e13585345401e10d Reviewed-on: https://gerrit.libreoffice.org/16681 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
* coverity#1309066 Uncaught exceptionCaolán McNamara2015-07-021-1/+1
| | | | Change-Id: If02a62e814051bb2d75a683877f8d17ec9201993
* Make PyUNO provide more Pythonic behaviourMatthew J. Francis2015-06-261-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* WaE: redundant const_cast on lhs of pointer comparison expressionTor Lillqvist2015-03-261-1/+1
| | | | Change-Id: Idd06653813e3f4863a5186eb6dce074227c25579
* loplugin:deletedspecialStephan Bergmann2015-02-071-4/+4
| | | | Change-Id: If27afeb618435bb1d0d69cad26942ce6dd2cdb92
* Fix common typos. No automatic tools. Handmade…Andrea Gelmini2014-11-121-1/+1
| | | | | | | Change-Id: I1ab4e23b0539f8d39974787f226e57a21f96e959 Reviewed-on: https://gerrit.libreoffice.org/12164 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
* coverity#982760 Dereference null return valueCaolán McNamara2014-05-261-0/+13
| | | | Change-Id: I779fa5fa418370dd6c53308943374e981f65ae29
* Resolves fdo#70681: fixincludeguards.pl: all that's leftThomas Arnhold2014-05-151-2/+2
| | | | | | | Change-Id: I3e51a62710bb46c8255fd228d41d9300c90a1fb5 Reviewed-on: https://gerrit.libreoffice.org/9360 Reviewed-by: Thomas Arnhold <thomas@arnhold.org> Tested-by: Thomas Arnhold <thomas@arnhold.org>
* pyuno: sal_Bool->boolNoel Grandin2014-05-081-1/+1
| | | | Change-Id: I071c8984cd86b523d8ebae04b5fb2bdc1ac1a5b1
* re-base on ALv2 code. Removing:Michael Meeks2012-07-021-0/+18
| | | | | | a patch contributed by Pedro Giffuni to handle FreeBSD issues that are unlikely to be an issue with a two-layer LibreOffice. http://svn.apache.org/viewvc?view=revision&revision=1180509
* gbuild migration: pyuno moduleDavid Ostrovsky2012-06-141-7/+8
| | | | Change-Id: I7f923a5622214f7540a789bcdd93bf6fd1d166db
* Fix typos in commentsElton Chung2012-02-181-1/+1
|
* Removed unused codeAlexander Bergmann2012-02-101-11/+0
|
* Fix dbgutil build of pyunoTor Lillqvist2011-08-221-6/+0
| | | | | | | Whether things actually work when pyuno is built against the debugging runtime, but the internal Python (to the best of my knowledge) still against the normal one, I don't know. But anyway, this makes the build succeed here.
* Port PyUno to support Python 3Andreas Becker2011-05-071-2/+6
|
* Add vim/emacs modelines to all source filesSebastian Spaeth2010-10-141-0/+3
| | | | | | | | Fixes #fdo30794 Based on bin/add-modelines script (originally posted in mail 1286706307.1871.1399280959@webmail.messagingengine.com) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* INTEGRATION: CWS changefileheader (1.5.54); FILE MERGEDRüdiger Timm2008-04-111-9/+0
| | | | 2008/04/01 12:32:27 thb 1.5.54.1: #i85898# Stripping all external header guards
* INTEGRATION: CWS warnings01 (1.4.8); FILE MERGEDJens-Heiner Rechtien2006-06-201-1/+6
| | | | 2006/03/01 10:00:46 sb 1.4.8.1: #i53898# Made code waring-free.
* INTEGRATION: CWS pj43 (1.3.64); FILE MERGEDJens-Heiner Rechtien2005-12-281-1/+1
| | | | 2005/12/05 08:22:21 kendy 1.3.64.1: #i58332# int -> sal_IntPtr fix for 64bit in Hash.
* INTEGRATION: CWS geordi2q11 (1.2.30); FILE MERGEDVladimir Glazounov2003-12-171-0/+4
| | | | 2003/12/16 14:04:26 hr 1.2.30.1: #111934#: join CWS ooo111fix1
* #i12504# added conversion modeJörg Budischewski2003-05-241-1/+4
|
* initial checkin for the pyuno-0.9.2 releaseJörg Budischewski2003-03-231-0/+293