Pyuno Libreoffice

admin

Presentation of the current state of the Development Infrastructure of the project

  1. Piano Libreoffice Download
  2. Pyuno Libreoffice Tutorial
  3. Piano Libreoffice Software

Pyuno for py3o py3o.renderers.pyuno is a pyuno based driver for py3o to transform an OpenOffice document into a PDF or other supported format. I have 2 LibreOfffices as follows: By default from clean installation of Fedora 33 Workstation + LibreOffice Base from ‘Software’. From LibreOffice RPM package. I need to uninstall LibreOffice installed with RPM package. Can you please teach me?

Jul 08, 2014 As a follow up, we've since learned that it is possible to connect Python to LibreOffice in almost any way. For example, Basic procedures can be run from Python, Libreoffice can be placed entirely under the control of Python, Python procedures can be run from Basic, with wrappers, as part of an extension, etc. The state of PyUNO as of LibreOffice 5.0 Implemented near the dawn of Python, barely changed since Very little syntactic sugar Generally a lot like writing Java Slower than it should be – especially from a remote process What I hope to achieve with the new changes for 5.1 Make working with UNO in Python feel more Pythonic. As a follow up, we've since learned that it is possible to connect Python to LibreOffice in almost any way. For example, Basic procedures can be run from Python, Libreoffice can be placed entirely under the control of Python, Python procedures can be run from Basic, with wrappers, as part of an extension, etc.

By Norbert Thiebaud

Presentation of the current state of the Development Infrastructure of the project. which services we provide, how they articulates with each others, and some awesome numbers about it all. Review what works well, what works not so well and future plans...

Bio: Volunteer to the project, currently in charge of our git/gerrit/jenkins infrastructure

Easy Infrastructure

By Alexander Werner

As The Document Foundation uses SaltStack for configuration management, it is reasonably easy to hack on the infrastructure without touching the production hardware. This makes it easier for existing admins to offload certain tasks. Hands on setup of a local development environment and some easy hacks will be shown so you can easily get started. You can deploy the same services our infrastructure uses on your laptop without spending much of your time or a lot disk space and test the salt states you build on your own machine before sending a patch.

Bio: Alexander Werner is a long-term free software addict and with The Document Foundation since its beginning. He is responsible for the infrastructure of the project and loves hacking in python and centralized configuration management with salt.

Easy Infrastructure

Box Office: The xdg-app sandboxing initiative

By Stephan Bergman

Box Office: The xdg-app sandboxing initiative aims at making it easier for developers to distribute applications, and at making it more predictable and more secure for users to run them. Fitting a behemoth like LibreOffice into that framework is a good exercise at challenging the framework and gaining insight into applications' needs. And at demonstrating that xdg-app isn't only about GNOME-y apps at all.

Bio: Software Developer at Red Had, Inc. From the original Hamburg StarOffice crowd, now a full-time LibreOffice guy at Red Hat.

Plone administration

By Andreas Mantke

we use in the LibreOffice project some Plone instances, e.g. LibreOffice extensions and templates website, OFDAuthors and the LibOConference websites 2012 and 2013. I could provide a workshop about the administration of Plone, if that is of any interest. That workshop would be intended for volunteers who want to help with the administration of the projects Plone websites.

Pyuno Libreoffice

Bio: Born in 1959, I'm working for a social insurance institution in Germany. Since autumn 2002 I support LibreOffice and it's antecessor. Currently I'm one of the members of the Board of Directors at The Document
Foundation and working on admin task for LibreOffice and The Document Foundation, especially on Plone related tasks.

LibreOffice Development and Release Process

By Bjoern Michaelsen

This talk will show how the release train of LibreOffice works: What happens on the way to a major or minor release, when does it happen and why. It will discuss:

  • the way change is applied to LibreOffice
  • how we balance ease of contribution with safeguards against bugs and regressions
  • how this balance changes during the lifecycle of a release

Bio: Bjoern Michaelsen is a currently employed by Canoncial Ltd. and is responsible for the packaging for LibreOffice on Ubuntu. He joined the company and LibreOffice development in February 2011, coming from Oracle (and before that Sun), where he was working on the same codebase for a few years in the Writer/Framework area. Even since long before that he is an open source enthusiast and did start with minor contributions to a range of open source projects. He is currently serving on the board of the Document Foundation, the engineering steering committee and the certification committee for LibreOffice.

Upcoming PyUNO improvements in LibreOffice 5.1

By Matthew J. Francis
A brief overview of how and when to use the new, more modern Python syntax now in current LibreOffice master, which will be available from LibreOffice 5.1. Comparison of scripting LibreOffice in Python (using the new features) with the same tasks in BASIC, Java

Bio: Involvement with LibreOffice: QA / testing / PyUNO related development Company affiliation: N/A.

VCL re-work to LibreOffice 5.0

By Michael Meeks

Come hear about the work on the Visual Class Library (VCL) in the last year - the bottom of the cross-platform graphics system that LibreOffice is built on. See how we've re-factored the backends, improved the lifecycle mechanism (VclPtr), re-vamped our main-loop (the idle handler re-work) as well as many other long overdue improvements. Also see what else needs doing and get stuck in to help out.

Bio: Michael is a Christian and enthusiastic believer in Free Software. He is the General Manager of Collabora Productivity, leading our LibreOffice team, supporting customers, consulting on development alongside an extremely talented team. He serves as a member of the board of The Document Foundation, and the LibreOffice Engineering Steering Committee; in the past he served on ECMA/TC45 improving Microsoft's description of the proprietary OOXML. Prior to this he was a Novell/SUSE Distinguished Engineer working on various pieces of Free Software infrastructure across the Linux desktop stackm and before that he worked on both hardware and software for real-time video editing at Quantel.

Rendercontext and double-buffering: Flicker-free UI in LibreOffice

By Jan Holesovsky

Come and hear how the LibreOffice's toolkit VCL was extended to provide UI without flickering - When you resize windows or eg. see the mouse-over effect in the startcenter. Many dots had to be connected together to result in much more natural behavior.

Bio: Jan / Kendy is with LibreOffice since the very first day, but his knowledge of our codebase goes back to 2003 when he joined OpenOffice.org. He started developing office software even earlier, in 1998-9 he programmed the drawing part of KTTV, a Linux word processor and vector drawing program for lecture notes. Over the years, he has contributed to many areas, including the KDE integration, x86-64 porting, build/SCM related problems, DOCX export, and user interface in general. Kendy proudly works for Collabora Productivity.

Creativity unlocked: making LibreOffice UI elements move

By Katarina Behrens

Code controlling user interface of LibreOffice is largely undocumented and adding a new toolbar button, menu entry, dialog or even an icon is pain, especially when you do it for the first time. This talk (or better, tutorial) attempts to close that gap and explain in detail how to add UI elements to LibreOffice and how to make them move and do stuff.

Bio: Katarina / Bubli started working on LibreOffice in 2010 as a member of SUSE LibreOffice team. She continued her involvement with the project as a volunteer even after she left that job, while being busy with working in computer security business and becoming a parent. Hired by CIB in 2015, she is happy to work on LibreOffice full-time again. She has a passion for all things UI and, as a member of LibreOffice design team, enjoys turning design ideas into code.
In other life, she's foodie, out of mainstream movie enthusiast, xkcd comic strip lover and jokes collector.

LibreOffice Gtk3 Port

By Caolán McNamara

LibreOffice has long supported Gtk2, but support for Gtk3 was lacking. LibreOffice 5.0 finally supports Gtk3. This talk demonstrates the Gtk3 port, discusses its differences and similarities with the other platforms that LibreOffice targets, and why the gtk3 vclplug inherits from the headless vclplug.

Libreoffice-pyuno ubuntu

Bio: Caolán McNamara is an all-around hero; he has been involved in reverse engineering and writing filters for Microsoft file formats from the very beginning of Free Software support for them. He has contributed extensively to LibreOffice fixing issues from graphics subsystems, through to the Writer core. After working for Sun‘s StarDivision, he now works for RedHat full time leading their LibreOffice team.

LibreOffice's Android port

By Miklos Vajna

LibreOffice's Android port improved a lot since last year, primarily thanks to TDF's donors, so basic editing features are now available. The talk will present previous (failed) prototypes, how LibreOfficeKit makes a difference here, and what did we do to Mozila's Fennec Java UI to make it suitable for LibreOffice's native Android editing interface. Come and see where we are, what still needs to be done, and how you can help.

Bio: Involved with OpenOffice.org since 2006 where I started as a packager for Frugalware Linux. Then I completed two Google Summer of Code projects to improve the RTF import/export filter of Writer. Hacking on LibreOffice Writer for Collabora.

LibreOffice On-Line server

By Tor Lillqvist

It is well known that the purpose of the Internet is a distribution channel for cat videos, but soon we will also have LibreOffice On-Line. This talk will describe implementation details of the LibreOffice On-Line server, loolwsd.

Bio: Tor Lillqvist has been involved in development of LibreOffice and its predecessor for close to ten years, and still is surprised every week by some part of the codebase. He lives in Helsinki, Finland, with family including a dog. He works as a contractor for Collabora Productivity.

LibreOffice as a ZeroInstall document editing solution

By Thorsten Behrens

Demo / BoF-Session: LibreOffice as a ZeroInstall document editing solution. Overview of existing and future solutions, and some hard questions on technology. Expect some deep dives into code, and possibly a demo.

Bio: Proudly working for CIB on LibreOffice, TDF Founder, Hacker, OASIS ODF TC member, working on the code since 2001. Thorsten was part of the OpenOffice.org project almost from the start, when he joined the then-Sun-Microsystems development team back in early 2001. He's a computer scientist by education, and a Free Software enthusiast by heart, a geek from early childhood - and someone who was lucky enough to turn a hobby into an occupation.

Hacking LibreOffice viewer for Android

Piano Libreoffice Download

By Christian Lohmaier

Hacking on the core LO code is intimidating, so the smaller-chunk projects are an easy way starting small and still being able to make a big difference in those projects. While the Impress Remotes are standalone projects, and comparably easy to setup, building the LibreOffice viewer for Android still is a little more work (and doesn't offer the nice Android Studio integration yet). This talk will show how to get started in setting up a build environment for those projects.

  • requirements for Android
  • running in Android emulator (esp. emulating both a Android Wear as well as Android Smarphone)

LibreOffice Online - the client

By Mihai Varga

I will present how we repurposed Leaflet, an open-source javascript library for interactive maps, to allow the user to view and edit a document.

Bio: Mihai Varga is Software Engineer Consultant Intern at Collabora. He is from Romania, and is a student at the Polytechnic University of Bucharest in his 4th year.

Ace of base

Pyuno

By Lionel Elie Mamane

* bundles one, HSQLDB 1.8
- old, buggy, because Open/LibreOffice did NOT update to newer upstreams
- C++ <-> Java barrier slow to pass
---> contribution opportunity
- hacks to be done there
- to be replaced by Firebird
---> contribution opportunity
- some work done
- needs finishing
* DB access API layer: SDBC
- C++ version of JDBC
- drivers for
ADO (including on Microsoft Windows, access to Microsoft access files)
ODBC
JDBC (slow, including embedded HSQLDB)
---> contribution opportunity
- hacks to be done there
MariaDB / MySQL (no binaries by TDF; uses GPL MySQL Connector/C++)
---> contribution opportunity: write out MySQL Connector/C++
PostgreSQL
WiP: Firebird
- Data manipulation everywhere
- Data definition where reasonably possiible (not ODBC/JDBC/ADO)
* Not that much of API actually used internally...
DatabaseMetadata: getTables, getPrivileges, ...
RecordsetMetadata: getColumns, ...
RecordSet: getString, getInt, getLong, ...
move: next(), absolute(), ...
Writes mostly done by issuing SQL commands... No cursor use, no API use, ...
Data refresh done by query 'WHERE primary_key = ...'
(no use of dynamic recordsets, etc)
Tension:
1) work with 'simple databases' (we have to do the work)
2) for 'good feature-rich DBMS', trust the driver, it knows better the idiosyncrasies
---> less bugs?
* Forms:
Writer documents in 'Web mode' (not bound to a specific page size) and. Cannot be bound to other connection!
---> contribution opportunity: add that possibility, IT ALREADY EXISTS IN WRITER in principle, just need to un-cripple the form relation (table, query) access abstraction
* Reports
result:
Writer document with tables or Calc document
---> overlap forbidden
---> hacks for overlap break with pagination
not much more than a writer / calc document with embedded placeholders that are repeated once per row / row group as much work as possible pushed to writer / calc
---> contribution opportunity: fix writer, add missing features
- OpenDocument tables not fully implemented
- ALL LAYOUT done by writer: cell / row sizes, what goes on what page, ...
- lousy 'header stays with detail', 'whole section stays together', ...
- no automatic sizing
- easy / in reporting system: automatic row height to biggest of all columns
- needs new feature from writer/calc: automatic row height based on biggest of a few columns
- group headers/footers sums/... not robust when multiple embedded grouping layers
General need:
* Microsoft Windows guy
- bundle MSDAC / Office 2010 data access components / ...

Ace of Base

Interesting missing features in Impress

By Muthu Subramanian

Interesting missing features in Impress This talk is an attempt to highlight and discuss some interesting missing functionalities in Impress and the work that we are trying to do there.
a) Presentation Master Pages vs Layouts:
Layouts in simpler terms can be considered as child-master-pages. While
LibreOffice Impress doesn't support Layouts, there are few other competing
presentation tools which provide support for those. This talk would be more
like thoughts and discussions around the pros and cons of having such a
feature in LibreOffice
b) Fill Angles
c) Gradient colors for Text (not specific to Impress, though) and lines

Bio: Started my foss adventure as a Novell intern. And have been contributing to go-oo/libreoffice for more than 10yrs now - to the Calc (spreadsheet) and Impress presentation) modules. Currently working for Ericsson and mentoring a team of developers to contribute to LibreOffice and other open source projects.

LibreOffice Impress and Pebble smartwatch

By Gülşah Köse

Pebble smartwatch has been designed to work with the Android and IOS phone connected via Bluetooth. Pebble-remote application provides comunication between Pebble smartwatch and GNU/Linux operating systems. Pebble Remote is a free software that provides remote control for Libreoffice with Pebble. You can change LibreOffice Impress slides and exit from presentation by using Pebble smartwatch. A short time ago Pebble Company released a new smartwatch which name is Pebble Time. Now pebble-remote application can run both of these smartwatches.

Bio: My name is Gülşah. I'm voluunter of free software. I'm senior at Onsekiz Mart University, Turkey. My department is computer engineering. This year I've written an application provides interaction between LibreOffice Impress and Pebble smartwatch. And this application was liked by LibreOffice developers and accepted in The Document Foundation repos. It's name is pebble-remote. I'm very happy to have established the first interaction between LibreOffice and wearable devices in the period in which the proliferation of wearable devices.

Vertical Writing: typical use-cases and current status in LibreOffice

By Naruhiko Ogasawara

Japanese language has two writing mode; horizontal writing (left to right: LTR) and vertical writing (top to bottom; TTB). Nowadays, we, Japanese use mainly horizontal writing mode in office documents, but we still need vertical writing in some situations, such as official letters, diplomas, magazines or novels. Thus, vertical writing mode is less usage but still important functionality for multilingual office suites such as LibreOffice, however, we have observed several defects about vertical writing in LibreOffice. I’ll tell you the typical use-cases of vertical writing with examples, and discuss some issues how they should be fix, or what should be “right”specifications for each cases.

Bio: Naruhiko Ogasawara Naruhiko is a member of LibreOffice Japanese Team (Japanese Native Language Project). He have focused building LibreOffice community in Japan, clarify the UI/Help translation process, and growing new LibreOffice developers in Japan, includes himself.

New features in Calc and their implementation

Pyuno Libreoffice Tutorial

By Eike Rathke

New features in Calc and their implementation, for the technically inclined..

Bio: A LibreOffice hacker since the early days at Star Division, later Sun Microsystems, one other company and now Red Hat, Inc. Main areas of expertise are the Calc spreadsheet core, formula compiler and interpreter, number formatter/scanner, the i18n framework and locale data. Ardent supporter of Free Software, knowledge spreader, cyclist and sailor.

Styles and Themes: Next level

By Tomaz Vajngerl

Styles and Themes: Next level Styles are a valuable part of LibreOffice but they are incomplete and for casual users somewhat hidden in the user interface. In the talk I will present the suggestions and the work that tries to fix this. Themes are the next big step. They were introduced in Microsoft Office 2007 as a way to compliment the styles and present new ways for the user to change the document in a (design) consistent way. I will present what themes exactly are, what needs to change to integrate them into LibreOffice, and show some initial support for themes in LibreOffice.

Bio: Tomaž Vajngerl is a software engineer from Maribor, Slovenia. He worked in insurance software field for 7 years and gained experience in information system, software design and XP methodologies. In 2012 he started working on LibreOffice as volunteer and later started working for Collabora Productivity as his full-time job.

Plug Yourself In: Learn how to write a Clang compiler plugin

By Stephan Bergman

Bring your computer.

LibreOffice: From extension to core

By Bjoern Michaelsen

Piano Libreoffice Software

This workshop will show one way of writing a LibreOffice extension -- and then goes deeper: It will explore what UNO-code inside LibreOffice itself an extension triggers, how to find it and how to move on from the UNO layer to the core of LibreOffice applications. This workshop should enable someone writing
an extension and experiencing unexpected behaviour to debug into LibreOffice itself, and should provide some hints on how to move extensions into LibreOffice itself -- either as tests to prevent future regressions or to add
new functionality to LibreOffice itself.

1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the 'License'); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <config_folders.h>
21
22#include <pyuno/pyuno.hxx>
23
24#include <osl/process.h>
25#include <osl/file.hxx>
26#include <osl/thread.h>
27
28#include <rtl/ustrbuf.hxx>
29#include <rtl/strbuf.hxx>
30#include <rtl/bootstrap.hxx>
31
32#include <cppuhelper/implementationentry.hxx>
33#include <cppuhelper/factory.hxx>
34
35// apparently PATH_MAX is not standard and not defined by MSVC
36#ifndef PATH_MAX
37#ifdef _MAX_PATH
38#define PATH_MAX _MAX_PATH
39#else
40#ifdef MAX_PATH
41#define PATH_MAX MAX_PATH
42#else
43#error no PATH_MAX
44#endif
45#endif
46#endif
47
48
49usingpyuno::PyRef;
50usingpyuno::Runtime;
51usingpyuno::PyThreadAttach;
52
53usingcom::sun::star::registry::XRegistryKey;
54usingcom::sun::star::uno::Reference;
55usingcom::sun::star::uno::XInterface;
56usingcom::sun::star::uno::Sequence;
57usingcom::sun::star::uno::XComponentContext;
58usingcom::sun::star::uno::RuntimeException;
59
60namespacepyuno_loader
61{
62
63staticvoidraiseRuntimeExceptionWhenNeeded() throw ( RuntimeException )
64{
65if( PyErr_Occurred() )
66 {
67PyRefexcType, excValue, excTraceback;
68PyErr_Fetch( (PyObject **)&excType, (PyObject**)&excValue,(PyObject**)&excTraceback);
69Runtimeruntime;
70com::sun::star::uno::Anya = runtime.extractUnoException( excType, excValue, excTraceback );
71OUStringBufferbuf;
72buf.appendAscii( 'python-loader:' );
73if( a.hasValue() )
74buf.append( ((com::sun::star::uno::Exception *)a.getValue())->Message );
75throwRuntimeException(buf.makeStringAndClear(), Reference< XInterface> () );
76 }
77}
78
79staticPyRefgetLoaderModule() throw( RuntimeException )
80{
81PyRefmodule(
82PyImport_ImportModule( 'pythonloader' ),
83SAL_NO_ACQUIRE );
84raiseRuntimeExceptionWhenNeeded();
85if( !module.is() )
86 {
87throwRuntimeException(
88OUString( 'pythonloader: Couldn't load pythonloader module' ),
89Reference< XInterface > () );
90 }
91returnPyRef( PyModule_GetDict( module.get() ));
92}
93
94staticPyRefgetObjectFromLoaderModule( constchar * func )
95throw ( RuntimeException )
96{
97PyRefobject(PyDict_GetItemString(getLoaderModule().get(), (char*)func ) );
98if( !object.is() )
99 {
100OUStringBufferbuf;
101buf.appendAscii( 'pythonloader: couldn't find core element pythonloader.' );
102buf.appendAscii( func );
103throwRuntimeException(buf.makeStringAndClear(),Reference< XInterface >());
104 }
105returnobject;
106}
107
108OUStringgetImplementationName()
109{
110returnOUString( 'org.openoffice.comp.pyuno.Loader' );
111}
112
113Sequence< OUString > getSupportedServiceNames()
114{
115OUStringserviceName('com.sun.star.loader.Python' );
116returnSequence< OUString > ( &serviceName, 1 );
117}
118
119staticvoidsetPythonHome ( constOUString & pythonHome )
120{
121OUStringsystemPythonHome;
122osl_getSystemPathFromFileURL( pythonHome.pData, &(systemPythonHome.pData) );
123OStringo = OUStringToOString( systemPythonHome, osl_getThreadTextEncoding() );
124#if PY_MAJOR_VERSION >= 3
125// static because Py_SetPythonHome just copies the 'wide' pointer
126staticwchar_twide[PATH_MAX + 1];
127size_tlen = mbstowcs(wide, o.pData->buffer, PATH_MAX + 1);
128if(len (size_t)-1)
129 {
130PyErr_SetString(PyExc_SystemError, 'invalid multibyte sequence in python home path');
131return;
132 }
133if(len PATH_MAX + 1)
134 {
135PyErr_SetString(PyExc_SystemError, 'python home path is too long');
136return;
137 }
138Py_SetPythonHome(wide);
139#else
140 rtl_string_acquire(o.pData); // increase reference count
141 Py_SetPythonHome(o.pData->buffer);
142#endif
143}
144
145staticvoidprependPythonPath( constOUString & pythonPathBootstrap )
146{
147OUStringBufferbufPYTHONPATH(256 );
148sal_Int32nIndex = 0;
149while( true )
150 {
151sal_Int32nNew = pythonPathBootstrap.indexOf( ' ', nIndex );
152OUStringfileUrl;
153if( nNew -1 )
154 {
155fileUrl=pythonPathBootstrap.copy(nIndex);
156 }
157else
158 {
159fileUrl=pythonPathBootstrap.copy(nIndex, nNew - nIndex);
160 }
161OUStringsystemPath;
162osl_getSystemPathFromFileURL( fileUrl.pData, &(systemPath.pData) );
163bufPYTHONPATH.append( systemPath );
164bufPYTHONPATH.append( static_cast<sal_Unicode>(SAL_PATHSEPARATOR) );
165if( nNew -1 )
166break;
167nIndex = nNew + 1;
168 }
169constchar * oldEnv = getenv( 'PYTHONPATH');
170if( oldEnv )
171bufPYTHONPATH.append( OUString(oldEnv, strlen(oldEnv), osl_getThreadTextEncoding()) );
172
173OUStringenvVar('PYTHONPATH');
174OUStringenvValue(bufPYTHONPATH.makeStringAndClear());
175osl_setEnvironment(envVar.pData, envValue.pData);
176}
177
178Reference< XInterface > CreateInstance( constReference< XComponentContext > & ctx )
179{
180Reference< XInterface > ret;
181
182if( ! Py_IsInitialized() )
183 {
184OUStringpythonPath;
185OUStringpythonHome;
186OUStringpath('$BRAND_BASE_DIR/'LIBO_ETC_FOLDER'/'SAL_CONFIGFILE('pythonloader.uno' ));
187rtl::Bootstrap::expandMacros(path); //TODO: detect failure
188rtl::Bootstrapbootstrap(path);
189
190// look for pythonhome
191bootstrap.getFrom( OUString( 'PYUNO_LOADER_PYTHONHOME'), pythonHome );
192bootstrap.getFrom( OUString( 'PYUNO_LOADER_PYTHONPATH' ) , pythonPath );
193
194// pythonhome+pythonpath must be set before Py_Initialize(), otherwise there appear warning on the console
195 // sadly, there is no api for setting the pythonpath, we have to use the environment variable
196if( !pythonHome.isEmpty() )
197setPythonHome( pythonHome );
198
199if( !pythonPath.isEmpty() )
200prependPythonPath( pythonPath );
201
202#ifdef WNT
203//extend PATH under windows to include the branddir/program so ssl libs will be found
204 //for use by terminal mailmerge dependency _ssl.pyd
205 OUString sEnvName('PATH');
206 OUString sPath;
207 osl_getEnvironment(sEnvName.pData, &sPath.pData);
208 OUString sBrandLocation('$BRAND_BASE_DIR/program');
209 rtl::Bootstrap::expandMacros(sBrandLocation);
210 osl::FileBase::getSystemPathFromFileURL(sBrandLocation, sBrandLocation);
211 sPath = OUStringBuffer(sPath).
212 append(static_cast<sal_Unicode>(SAL_PATHSEPARATOR)).
213 append(sBrandLocation).makeStringAndClear();
214 osl_setEnvironment(sEnvName.pData, sPath.pData);
215#endif
216
217#if PY_MAJOR_VERSION >= 3
218PyImport_AppendInittab( (char*)'pyuno', PyInit_pyuno );
219#else
220 PyImport_AppendInittab( (char*)'pyuno', initpyuno );
221#endif
222// initialize python
223Py_Initialize();
224PyEval_InitThreads();
225
226PyThreadState *tstate = PyThreadState_Get();
227PyEval_ReleaseThread( tstate );
228// This tstate is never used again, so delete it here.
229 // This prevents an assertion in PyThreadState_Swap on the
230 // PyThreadAttach below.
231PyThreadState_Delete(tstate);
232 }
233
234PyThreadAttachattach(PyInterpreterState_Head() );
235 {
236if( ! Runtime::isInitialized() )
237 {
238Runtime::initialize( ctx );
239 }
240Runtimeruntime;
241
242PyRefpyCtx = runtime.any2PyObject(
243com::sun::star::uno::makeAny( ctx ) );
244
245PyRefclazz = getObjectFromLoaderModule( 'Loader' );
246PyRefargs(PyTuple_New( 1 ), SAL_NO_ACQUIRE );
247PyTuple_SetItem( args.get(), 0 , pyCtx.getAcquired() );
248PyRefpyInstance(PyObject_CallObject( clazz.get() , args.get() ), SAL_NO_ACQUIRE );
249runtime.pyObject2Any( pyInstance ) >>=ret;
250 }
251returnret;
252}
253
254}
255
256
257staticconststructcppu::ImplementationEntryg_entries[] =
258{
259 {
260pyuno_loader::CreateInstance, pyuno_loader::getImplementationName,
261pyuno_loader::getSupportedServiceNames, cppu::createSingleComponentFactory,
2620 , 0
263 },
264 { 0, 0, 0, 0, 0, 0 }
265};
266
267extern'C'
268{
269
270SAL_DLLPUBLIC_EXPORTvoid * SAL_CALLpythonloader_component_getFactory(
271constsal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
272{
273returncppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
274}
275
276}
277
278/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
279