[api-dev] Re: using connection and https

2011-05-25 Thread Christian Lohmaier
Hi Fernand, *,

On Wed, May 25, 2011 at 9:24 AM, Fernand Vanrie s...@pmgroup.be wrote:

 I trie to connect to Googleapis using OO and https ?

 Code:
 oConnector = createUnoService(com.sun.star.connection.Connector)
 oConnection = oConnector.connect(socket,host=www.googleapis.com,port=80)

first: don't know whether it is  supported by OOo like this, but your
example has several general problems, so here we go...

If you want to use ssl, then you should try with the default ssl-port (443)

 oConnection.write( StringToByteArray( GET
 https://www.googleapis.com/tasks/v1/lists/MDk5Nzc1MDY0NzQyMTk4NjEyMzM6MDow/tasks/MDk5Nzc1MDY0NzQyMTk4NjEyMzM6MDo4?pp=1key=

And http GET doesn't include the hostname, just the path. Specify the
host in the Host parameter.

https://www.googleapis.com/tasks/v1/lists/MDk5Nzc1MDY0NzQyMTk4NjEyMzM6MDow/tasks/MDk5Nzc1MDY0NzQyMTk4NjEyMzM6MDo4?pp=1key={YOUR_API_KEY}

and you're not supposed to write it twice either, but maybe I'm
getting things wrong here.
And obviously YOUR_API_KEY is to be replaced by your API key.

it's
GET /path/to?param=valueparam2=value2 HTTP/1.1
Host: www.myhost.com
Connection: close

(well, connection: close as it is the only request, you can also just
use http 1.0 request that only have one request at a time anyway)

ciao
Christian
-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: using connection and https

2011-05-25 Thread Christian Lohmaier
On Wed, May 25, 2011 at 4:01 PM, Fernand Vanrie s...@pmgroup.be wrote:
 Christian ,

 Thanks for your valuable help.

 After i succeeded to use the OO connection stuff to use Google Translations
 i was tempted to use the newest Google Tasks API too.

 Using port 443  i get no respons at all ?

As written before: I don't know whether this is the correct way to set
up a ssl connection. I kind of doubt that it handles that
automatically.

 I left my API_Key out for security reasons.
 But

 In my working code for Translations i used
 GET http://ajax.googleapis.com/

 so i am a bit confused about the syntax to make HHTP requests :-)

yes, absolute URL is valid, but rather only when talking to a proxy.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2
The most common form of Request-URI is that used to identify a
resource on an origin server or gateway. In this case the absolute
path of the URI MUST be transmitted (see section 3.2.1, abs_path) as
the Request-URI, and the network location of the URI (authority) MUST
be transmitted in a Host header field. For example, a client wishing
to retrieve the resource above directly from the origin server would
create a TCP connection to port 80 of the host www.w3.org and send
the lines:

note the use of MUST - when talking to the origin directly, you (if
you want to comply with the protocol) MUST use the absolute path, and
not the full URL

ciao
Christian
-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


Re: [api-dev] Compiler for MS Windows

2010-06-18 Thread Christian Lohmaier
Hi Patrick,

On Fri, Jun 18, 2010 at 4:49 PM, Patrick Bernard patr...@kilargo.com wrote:

 Is C++ recommended for extensions ? Can it lead to problems ?

It leads to the problem that you need to compile for all platforms
separately.
Also linux-Distributions compile with system-stlport and not agains
the version that comes with OOo sources. So c++ extensions are
incompatible between vanilla and distro-version (unless distribution
also provides OOo's version)

I'd go for java (but mainly because I know java better :-)) Only
drawback of java is rather slow start of the JVM - but that's not a
problem if the JVM is loaded anyway.

So depends on the use-case of your extension..

ciao
Christian

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] New ooo code snippet: export all graphics in 300dpi

2010-02-02 Thread Christian Lohmaier
Hi Joseph, *,

2010/1/31 ost...@freemail.hu ost...@freemail.hu:

 I have created a new OOO Writer code snippet in Basic.
 It exports all graphical objects, formulas, bitmaps, drawings, charts in
 hi-resolution PNG files.

Thanks a lot - this questions comes up again and again, so soon we'll
have something to refer to :-)

ciao
Christian

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] source code of open office

2009-10-21 Thread Christian Lohmaier
Hi *,

On Wed, Oct 21, 2009 at 9:24 AM, Thomas Lange - Sun Germany - ham02 -
Hamburg thomas.la...@sun.com wrote:
 Santhosh Ejanthkar wrote:

    i am trying to extend developing of open office in android application.
 can u let me from where i should i download the source code of the open
 office.
i ve explored the site of the open office but not able to download it. any
 help.

Hmm. Cannot see the forsest because of all those trees?
http://download.openoffice.org/ → Source from the Additional
information section at the top-right

Or http://www.openoffice.org/ → I want to participate  →
Programming →get the source code

As a usual RTFM-style comment: You'll be having a tough time with
building OOo if you couldn't find out how to download the sources...

 Usually you would need to install subversion and get access with that.
 See http://wiki.services.openoffice.org/wiki/Setting_up_Subversion_Access

As OOo will switch to mercurial soon, I suggest to start with
mercurial from the beginning.
The repository is at http://hg.services.openoffice.org/DEV300

(hg clone -U http://hg.services.openoffice.org/DEV300 local_clone
cd local_clone; hg update -r DEV300_m62 (or some other milestone - and
of course you can create a second local clone instead and keep one
pristine copy, in case you want to work on different stuff))

http://wiki.services.openoffice.org/wiki/OOo_and_Mercurial

ciao
Christian

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Migrating simple bootstrap to OOo3

2008-09-29 Thread Christian Lohmaier
Hi Jürgen, *,

On Mon, Sep 29, 2008 at 1:52 PM, Juergen Schmidt
[EMAIL PROTECTED] wrote:
 Hi Tobias,

 you can find a SDK under http://distribution.openoffice.org/mirrors/#mirrors
 - select one of the mirrors and search under .../contrib/rc/3.0.0rc2

Won't have any luck there since:
a) The SDK upload is an empty tarball
b) rc2 will disappear soon/is already announced as getting deleted

Ask Joost/Marting when the situation will be fixed.

ciao
Christian

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Basic Dialogues doesn't look like when I created them.

2008-09-14 Thread Christian Lohmaier
Hi *,

On Sun, Sep 14, 2008 at 7:53 AM, Bernard Marcelly
[EMAIL PROTECTED] wrote:
 Message de Johnny Rosenberg  date 2008-09-14 02:27 :
 After loading the document into my Ubuntu 8.04 laptop (not the Eee) with
 OpenOffice.org 2.4.1 it looks wrong.

 Probable reason:
 Ubuntu own version of OpenOffice is troubled by Compiz. Workaround : disable
 Compiz or install original OpenOffice.

https://bugs.edge.launchpad.net/ubuntu/+source/openoffice.org/+bug/149586
http://qa.openoffice.org/issues/show_bug.cgi?id=86302

ciao
Christian

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] How to open the Web Module

2007-11-16 Thread Christian Lohmaier
Hi Alexandro,

On Nov 17, 2007 7:36 AM, Alexandro Colorado [EMAIL PROTECTED] wrote:
 I would like to know how can I get a web document:
 private:factory/swriter  will open a document on writer using the
 StarDesktop.LoadComponentfromanURL(private:factory/swriter, _blank, 0,
 a())
 What if I want to open a webpage:
 private:factory/sweb? didn't work.

Because that's not the correct identifier.
Use private:factory/swriter/web

ciao
Christian

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] List and webarchive IDs

2007-06-26 Thread Christian Lohmaier

Hi Paolo, *,

On 6/26/07, Paolo Mantovani [EMAIL PROTECTED] wrote:

Alle 13:10, lunedì 25 giugno 2007, Christian Lohmaier ha scritto:
 [IDs of the ML and the Webinterface]

Thank you for the useful information.

But  (perhaps I'm missing something), does it exist any way to obtain the
mailinglist-ID  for a given message? or shoud I find it by tries and errors?


One that was delivered to you: Yes, there is a Return-Path header like this:
Return-Path: [EMAIL PROTECTED]

Where the 17945 would be the mailinglist-ID of that message.

Unfortunately, this header is not added to the web-archive on the ooo site,
and most other web-archives strip many headers as well.

(And getting the mail again, when you still have access to it is
pretty pointless)

So the only way to get it is via the index unfortunately :-(

ciao
Christian

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] external application getting OOo version number

2007-03-22 Thread Christian Lohmaier
On Thu, Mar 22, 2007 at 03:23:10PM +0100, Laurent Godard wrote:
 Hi
 
 I'd like to know what is the easiest way for an external application (say,
 an ebuild binary) to find out OOo's version number (e.g. 2.0.2).
 
 
 the information is stored in the ooo/share/registry/.../Setup.xcu file 
 (Node Product/ooSetupVersion)
 
That won't work if you want to detect the minor version.

ciao
Christian
-- 
NP: Pantera - Hollow

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] external application getting OOo version number

2007-03-22 Thread Christian Lohmaier
On Thu, Mar 22, 2007 at 05:38:29PM +0100, Laurent Godard wrote:
 the information is stored in the ooo/share/registry/.../Setup.xcu file 
 (Node Product/ooSetupVersion)
  
 That won't work if you want to detect the minor version.
 
 this a bug IMHO as it worked in the OOo 1.1.x branch
 could it be solved ?
 
 btw, you'll have the minor version but not the third number (build)

I meant the micro version, sorry... You cannot tell whehter it is 2.0.1
or 2.0.4, and you won't be able to tell whether it is 2.2.0 or 2.2.1

ciao
Chrisitan
-- 
NP: Pantera - Hollow

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Registering an XMailMergeListener - possible at all?

2007-03-12 Thread Christian Lohmaier
Hi Noelson, *,

On Thu, Mar 08, 2007 at 09:35:26AM -0300, Noelson Duarte wrote:
 
 The service OfficeDocument has an interface XEventBroadcast to register
 listeners of event documents. There are two events of interest here:
 OnMailMerge e OnMailMergeFinished. Maybe this is the way to do your work
 (only a guess).

I assume these are the same as you can reach wia Tools|Macros → Organize
→ Assign (although OnMailMergeFinished isn't listed there)

Unfortunately, this doesn't work for the following reasons:
* Event is only triggered using the old (IMHO better) dialog, not with
  the new one
* Only one event is triggered, so I have no way to edit the individual
  documents

And looking at 
http://api.openoffice.org/docs/common/ref/com/sun/star/document/Events.html

What is the difference between OnSaveDone and OnSaveFinished?

Thanks for your suggestion though

ciao
Christian
-- 
NP: Kashmir 9:41 - For Srila Prabhupada

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Registering an XMailMergeListener - possible at all?

2007-03-07 Thread Christian Lohmaier
Hi Marc, *,

On Sat, Mar 03, 2007 at 05:29:12AM +0100, Marc Santhoff wrote:
 Am Freitag, den 02.03.2007, 16:09 +0100 schrieb Christian Lohmaier:
  On Mon, Feb 19, 2007 at 06:32:12PM +0100, Marc Santhoff wrote:
   Am Montag, den 19.02.2007, 15:43 +0100 schrieb Christian Lohmaier:
[mailmerge-listener]
  [...]
  I think I found the mail you're refering to, but unforutnately it
  doesn't use the wizard-functionality, but instead requests the
  database/table to use in the merge as arguments.
  http://api.openoffice.org/servlets/ReadMsg?listName=devmsgNo=11328
 
 But at least it showshow this stuff is expected to work.

Yes, the basic-macro already hinted to that... :-(

I personally think this doesn't make too much sense then. If you have to
set up all yourself, then you can do (have to basically if you want the
user to be able to choose only parts of the dataset) the additional step
to iterate through the database as well and the mailmergelistener is
pretty useless/not much of a shortcut then.

(and indeed the cited sample doesn't use the mailmergelistener at all)

I guess I'll just file an issue to have something like you need to
create your own mail-merge to use the listener to the docs.

   From having a quick look at the code at least the setup of a database
   connection is shown, too.
  
  Yes, but this still would require me to write code to ask the user for
  the requested database and to duplicate all the stuff the current
  mail-merge wizard has builtin. (I personally don't like the wizard at 
  all, but I don't want to write one myself either)
 
 Okay, thinking about it two ideas come to my mind:
 
 1. Hacking up^w Improving the wizard

Honestly, I like the OOo 1.x way much better. No fancy wizard. Just drag
the fields into your document where you want them, optionally add some
conditions (that's where help from a wizard would come handy), then
select the set of rows you want to have included and fire off the
mailmerge.
Choose whether print/save and maybe offer a way to see a preview. 
That is my view of a useful wizard.

 The sources should be somewhere near the database wizard. That is found
 here:
 
 http://installation.openoffice.org/source/browse/installation/wizards

As written earlier, I'd love to avoid any unnecessary stuff. I'm a
novice/beginner. So hacking together a complete wizard/replacement is
just over my capabilities.

 It could be a nice feature to have ... although I don't know if there is
 something similar in other countries or if this would be german only.

In that case it would be US-only (the postnet barcodes) The principle
however could apply to other use-cases as well of course.
 
 2. Trying to use one of the event hooks at the document in process
 
 There is an event Serienbriefe drucken, or maybe Dokument drucken
 will fit your needs. I think you could hook to one of them and trigger
 your macro there.

Would still be a hack though... And not sure whether I'll get the
individual documents (with the individual data) then, and not only the
base document...

 The only question left then is, whether the hook is called only once at
 the start of mail merging or for each document with the actual data
 merged in already.

Exactly..

ciao
Christian
-- 
NP: nichts

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Registering an XMailMergeListener - possible at all?

2007-03-07 Thread Christian Lohmaier
Hi Marc,

On Wed, Mar 07, 2007 at 07:31:52PM +0100, Marc Santhoff wrote:
 Am Mittwoch, den 07.03.2007, 14:59 +0100 schrieb Christian Lohmaier:
http://api.openoffice.org/servlets/ReadMsg?listName=devmsgNo=11328
   
   But at least it showshow this stuff is expected to work.
  [...]
  (and indeed the cited sample doesn't use the mailmergelistener at all)
  
  I guess I'll just file an issue to have something like you need to
  create your own mail-merge to use the listener to the docs.
 
 Please do that, it happens that some framework designs from the
 thinking lab are conceptually nice and orthogonal but not well suited
 for practically using them.

???
Why not add a hint for other users that they cannot use the
mailmerge-listener to hook-up into the existing wizard?
That would save those that come after me the fuzz about trying with no
success and asking on the mailinglist and waiting for an answer, only to
get to know that trying with the mailmerge-listener was wasted time
since it cannot be used that way?

 From having a quick look at the code at least the setup of a database
 connection is shown, too.

Yes, but this still would require me to write code to ask the user for
the requested database and to duplicate all the stuff the current
mail-merge wizard has builtin. (I personally don't like the wizard at 
all, but I don't want to write one myself either)
   
   Okay, thinking about it two ideas come to my mind:
   
   1. Hacking up^w Improving the wizard
  
  Honestly, I like the OOo 1.x way much better. No fancy wizard. Just drag
  the fields into your document where you want them, optionally add some
  conditions (that's where help from a wizard would come handy), then
  select the set of rows you want to have included and fire off the
  mailmerge.
 
 If I'm honest too, I must admit that I'm only rarely using 2.x and never
 did use the wizard myself. Isn't it possible to switch that thing off?

It is somewhat possible. You must edit your toolbar to add an icon for
the old mailmerge. The new wizard and the old way have the same name, so
you have to guess. You cannot add this icon to the database-beamer
toolbar, you have to add it to the default toolbar.
And even worse: you cannot select the datarows before launching the
wizard, the selection is lost. Instead the old-style-dialog will open a
new dialog that has a grid control that showst the databasetable. There
you can highlight the rows that should be part of the mailmerge.

 I'll try mail merge on 2.x later on ...

Please do. And you'll shake your head...

 For me 1.1.[3|5] is still working well in most situations. ;)
 
  Choose whether print/save and maybe offer a way to see a preview. 
  That is my view of a useful wizard.
 
 Sounds good, the preview widget is already in the code somewhere.
 
 On the other hand: you might have choosen the wrong task for beginners
 level.

You got me totally wrong. I do not intend to write a new wizard. I was
seeking an easy solution to integrate the functionality of my addon.
Both for me, as well for the user who'll use the addon.

I thought of adding a button run the merge with the addon, that would
just launch OOo own's mail-merge wizard, but with the listener added, so
that I could modify the created documents (but now I know that this
doesn't work)... Everything else, especially hacking OOo itself is much
of an effort (and as you wrote yourself: Not something for a beginner
like me :-)

ciao
Christian
-- 
NP: Evanescence - Like You

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Registering an XMailMergeListener - possible at all?

2007-03-02 Thread Christian Lohmaier
Hi Marc, *,

On Mon, Feb 19, 2007 at 06:32:12PM +0100, Marc Santhoff wrote:
 Am Montag, den 19.02.2007, 15:43 +0100 schrieb Christian Lohmaier:
  [mailmerge-listener]
  If I cannot use the builtin wizard, but have to ask the user for the
  desired Database, etc myself and have to start the mailmerge from within
  my extension, then this would be far too much effort and thus pretty
  useless to me.
 
 You could search the archives of this list for:
 
  From [EMAIL PROTECTED] Mon Sep 27 14:43:34 2004
  Subject: Re: [api-dev] mailmerge api usage
  Message-id: [EMAIL PROTECTED]
 
 There you can find a complete working example of doing MailMerge written
 in Java. If it is not on the list please tell me, I'll forward it to
 you.

I think I found the mail you're refering to, but unforutnately it
doesn't use the wizard-functionality, but instead requests the
database/table to use in the merge as arguments.
http://api.openoffice.org/servlets/ReadMsg?listName=devmsgNo=11328

 From having a quick look at the code at least the setup of a database
 connection is shown, too.

Yes, but this still would require me to write code to ask the user for
the requested database and to duplicate all the stuff the current
mail-merge wizard has builtin. (I personally don't like the wizard at 
all, but I don't want to write one myself either)

 [...]---
 
 % java MailMerger -merge URL of template file Data Source name Table 
 name

I don't want to deal with selecting the datasource/table at all. I only
want to replace either a field or a bookmark/placeholder in the
merge-document before it is printed/saved.

 /---
 
 So it shows much more than doing MailMerge ...

Yes, it shows how one could do this, but I want to avoid all this...

I think I'll just tell the user to use the modify document button and
then run the macro.

Not perfect, but still far easier than setting up a mail-merge from
scratch.

ciao
Christian
-- 
NP: The Smashing Pumpkins - Porcelina Of The Vast Oceans

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Registering an XMailMergeListener - possible at all?

2007-02-19 Thread Christian Lohmaier
Hi Noëlson, Marc, *,

On Fri, Feb 16, 2007 at 04:54:13PM -0300, Noelson Duarte wrote:
  
  Does anybody have the solution or even a working sample at hand?
  I'd really appreciate it.
 
 You'll find a sample (OOoBasic) here:
  http://www.oooforum.org/forum/viewtopic.phtml?t=8393

oProps must be Variant, not object here, but apart form that this macro
shows that it is possible to use a mailmergelistener.

 Perhaps it helps you.

That snippet, along with Marcs answer helped somewhat:
I know that the mailmerge listener is not suitable for my case.

If I cannot use the builtin wizard, but have to ask the user for the
desired Database, etc myself and have to start the mailmerge from within
my extension, then this would be far too much effort and thus pretty
useless to me.

If there would be a way to still use the wizard however, then this could
work...
Mut the mailmerge-object requires a documentURL and other properties
before it can be executed. (and the documentURL would require the user
to save the document first, etc...), so I doubt that this is possible
:-(

So thank you very much for the pointer  answers.

ciao
Christian
-- 
NP: Marilyn Manson - Kinderfeld

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Registering an XMailMergeListener - possible at all?

2007-02-16 Thread Christian Lohmaier
Hi Marc, *,

On Wed, Feb 14, 2007 at 11:22:45PM +0100, Marc Santhoff wrote:
 Am Mittwoch, den 14.02.2007, 20:32 +0100 schrieb Christian Lohmaier:
  On Wed, Feb 14, 2007 at 07:14:37PM +0100, Steffen Grund wrote:
  [throwing away the mail-merge-object]
 
 From your other mail:
 [variable scope: only within the method]
 
 ... and if this exit point is reached the object is lost because there
 is no further reference to it. I don't know if the object is really
 needed, but if you want to store it you have to hold a reference in a
 variable, otherwise the java garbage collector will dispose it at it's
 next run.

Hmm - Thanks for pointing this out, but I don't think the object is
still necessary (but I'm not sure about this, so I tried what you
suggested:)

 You could simply do:
 
 public final class PostNetJavaImpl extends WeakBase
implements com.sun.star.lang.XServiceInfo,
   org.openoffice.cloph.postnet.XPostnetjava
 {
 private final XComponentContext m_xContext;
  
 private static final String m_implementationName = 
 PostNetJavaImpl.class.getName();
 private static final String[] m_serviceNames = {
 org.openoffice.cloph.postnet.Postnetjava };
 
 -- private static final(?) Object mailMerge = null;

That unfortunately did not make any difference.

Does anybody have the solution or even a working sample at hand?
I'd really appreciate it.

ciao
Christian
-- 
NP: As I Lay Dying - Meaning In Tragedy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Registering an XMailMergeListener - possible at all?

2007-02-14 Thread Christian Lohmaier
Hi Steffen,

On Wed, Feb 14, 2007 at 07:14:37PM +0100, Steffen Grund wrote:

thank you for having a look!
 
 perhaps I am getting this wrong, because you shortened your code to post 
 it here, but: you add a listener to a MailMerge object and then throw 
 the object away?

Hmm - I don't mean to throw it away. I'm a novice, and I don't see where
I throw it away. If you say it is thrown away, then this is very likely
my problem, although with a terminate listener that way works.
 
 Second, exactly what kind of event do you want to be notified of?

? I don't have a choice to choose between events, do I? There only is
that one listener with only that single notify-method.

But here's what I intend to do:

I want to write an extension for issue
http://www.openoffice.org/issues/show_bug.cgi?id=5948 to insert PostNet
Barcodes for envelopes.
A while back I hacked something together that used autoTexts made of
drawing shapes to insert the barcode. That was a hackish method that is
rather slow. 
I now rewrote that thing in java and use barcode4j to generate the
barcode in png format and insert the image into the document. This is
much faster than the autotext approach.

But to be useful, this needs to be hooked-up to the mailmerge, otherwise
you would have to manually print each envelope.

Wo what I hope for is a way to get notified with Hey, this doc is about
to get printed/saved: Do something with it, and then my extensions gets
the chance to parse the address and insert the barcode and proceed to
the next doc, or alternatively: Here's all the merged docs in one single
document: Do something with it.

If the MailMerge-Listener is not the way to go here, what else would you
suggest?

ciao
Christian
-- 
NP: Linkin Park - Hit The Floor

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Registering an XMailMergeListener - possible at all?

2007-02-13 Thread Christian Lohmaier
Hi Oliver, *,

On Mon, Feb 12, 2007 at 11:19:27AM +0100, Oliver Specht wrote:
 Christian Lohmaier wrote:
 
 Before I waste my time again I'd rather ask here:
 Is it possible at all to register a mail-merge Listener?
 
 My first attempts failed. I don't get any events/the method
 notifyMailMergeEvent of my listener never is called.

 at least the code (sw/source/ui/uno/unomailmerge.cxx, 
 sw/source/ui/dbui/dbmgr.cxx) says it is possible;-)
 
 I didn't verify that it actually works but added listeners should be 
 notified for each print/save operation that is done.

I guess then it's time to show my code, maybe I just do something very
wrong and you can point me to the right direction:

package org.openoffice.cloph.postnet.comp;

import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.lang.XSingleComponentFactory;
import com.sun.star.lib.uno.helper.Factory;
import com.sun.star.lib.uno.helper.WeakBase;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.text.MailMergeEvent;
import com.sun.star.text.XMailMergeBroadcaster;
import com.sun.star.text.XMailMergeListener;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;

public final class PostNetJavaImpl extends WeakBase
   implements com.sun.star.lang.XServiceInfo,
  org.openoffice.cloph.postnet.XPostnetjava
{
private final XComponentContext m_xContext;
 
private static final String m_implementationName = 
PostNetJavaImpl.class.getName();
private static final String[] m_serviceNames = {
org.openoffice.cloph.postnet.Postnetjava };

public PostNetJavaImpl( XComponentContext context )
{
m_xContext = context;
};

public static XSingleComponentFactory __getComponentFactory( String 
sImplementationName ) {
XSingleComponentFactory xFactory = null;

if ( sImplementationName.equals( m_implementationName ) )
xFactory = Factory.createComponentFactory(PostNetJavaImpl.class, 
m_serviceNames);
return xFactory;
}

public static boolean __writeRegistryServiceInfo( XRegistryKey xRegistryKey 
) {
return Factory.writeRegistryServiceInfo(m_implementationName,
m_serviceNames,
xRegistryKey);
}

// com.sun.star.lang.XServiceInfo:
public String getImplementationName() {
 return m_implementationName;
}

public boolean supportsService( String sService ) {
int len = m_serviceNames.length;

for( int i=0; i  len; i++) {
if (sService.equals(m_serviceNames[i]))
return true;
}
return false;
}

public String[] getSupportedServiceNames() {
return m_serviceNames;
}

private static class MailmergeEventListener implements XMailMergeListener {

public void notifyMailMergeEvent(MailMergeEvent mergeEvent) {
System.out.println(Listener called :-));  
}

}

// org.openoffice.cloph.postnet.XPostnetjava:
public void addMMEListener()
{
MailmergeEventListener MMListener = new MailmergeEventListener();

XMultiComponentFactory xMCF = m_xContext.getServiceManager();

Object mailMerge = null;
try {
mailMerge = xMCF.createInstanceWithContext(
com.sun.star.text.MailMerge, m_xContext);
} catch (Exception e) {
e.printStackTrace();
}
XMailMergeBroadcaster xMMB = null;
xMMB = (XMailMergeBroadcaster) UnoRuntime.queryInterface(
XMailMergeBroadcaster.class, mailMerge);
xMMB.addMailMergeEventListener(MMListener);
System.out.println(added listener);
}

}

ciao
Christian
-- 
NP: nichts

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Setting the default language (spell check)

2007-02-06 Thread Christian Lohmaier
Hi Mathias,

On Tue, Feb 06, 2007 at 09:19:46PM +0100, Mathias Bauer wrote:
 Christian Lohmaier wrote:
  On Mon, Feb 05, 2007 at 07:01:54PM +0100, Mathias Bauer wrote:
  Alamo Vallejo, Joan wrote:
  
   Is there a way to select the language the document is written in when
   you're loading the document? I want to have the right spell checker set
   already when the doc is loaded
  
  There is no such thing as a document language in OOo.
  
  Hmm - but how would you explain the setting Tools|Options → Languages →
  Language Settings?
  
  It has a default language for documents settings that can be applied
  to the current document only as well.
 
 That's the user experience, yes. Here on a developer's list I try to
 explain how Writer works internally.

No, not only user experience, but file-fromat-level as well...
 
 The document language the spell checker uses is what I described: the
 language attribute in the default paragraph style.

No, since that can be empty.
If fully agree with the statement that the langauge is a character
format and if it is defined either by hard formatting or inherited by a
character of paragraph style, that language will be used.
But by default the paragraph or character styles don't have a language
property set.

 Writer does use the
 language stored in the metadata (as described by yourself) only as a
 fallback if no language is set at the style. And until now I never saw
 any document *created by OOo* where the language wasn't set (see below).

Well, then you apparently never used (vanilla) OOo :-)

  The language the
  spell checker uses is a character attribute that (if no setting has been
  applied by the user) is taken from the default paragraph style.
  
  Default paragraph style doesn't has a language set by default.
 
 Open a blank new document. Save it and look into the styles.xml. You
 will find the language attribute in the default style.

No. I'll get
[...]style:style style:name=Standard style:family=paragraph
style:class=text/[...]

  So if you load a document it has its document language built in - it's
  the one stored in its default paragraph style.
  
  No, it's not... (Organize tab of the style doesn't list language
  setting)
 
 Interesting. It *does* here.

Then you're not using the built-in default template, but some other one
that already has the langauge set.

Only if I assign a langauge to the default paragraph stlye, styles.xml
will contain:
[...]
style:style style:name=Standard style:family=paragraph
   style:class=text
  style:text-properties fo:language=it fo:country=IT/
/style:style[...] 

 Did you look on the font tab page in the modify style dialog? Or where
 else?

That doesn't count since that always shows values, even when not
assigned in the style, but only inherited, either from another inherited
style of from factory defaults, or from other places in the document.

 Did you check the styles.xml in the document?

Yes, of course.

 How did you create your document?

With vanilla OOo, just create a new doc  save.

 [...]
  I mentioned here recently that the documentation for DocumentInfo
  mentions a Language property that I would have expected to be just that.
  But api is broken and doesn't return that property.
  http://qa.openoffice.org/issues/show_bug.cgi?id=26672
 
 It never returned that property so it isn't broken. Something must have
 been fine before it can get broken. ;-)

I don't really distinguish between documentation and implementation
here.
The wrong documentation (or behaviour) did cost me at least two hours of
useless fiddling around.

 Of course it's buggy, no question. Perhaps I should raise the target...
 
  The default language is a dc:languageen-US/dc:language property in
  content.xml
 
 But as described this is only the fallback language. We have yet to
 check how you managed to get documents without a language attribute in
 the default style.

It is not in the default paragraph-style, but in the general section,
that also contains the default font chosen (since in vanilla docs, this
is also not a property of the default paragraph style).

For the spellcheck-functionality inside OOo, it might look like a
property of the default paragraph style, but on the xml-level it isn't.
(of course you can manually set the property in the style)

ciao
Chrsitan
-- 
NP: 4Lyn - One 2 Three

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Codesnippet: [Java] Embed a graphic into a textdocument

2007-02-06 Thread Christian Lohmaier
On Tue, Feb 06, 2007 at 10:57:45AM +0100, Tom Schindl wrote:
 Snippet is integrated at
 http://codesnippets.services.openoffice.org/Writer/Writer.EmbedAGraphicIntoATextdocument.snip

Thanks,
ciao
Christian
-- 
NP: 4Lyn - One 2 Three

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[api-dev] Codesnippet: [Java] Embed a graphic into a textdocument

2007-02-04 Thread Christian Lohmaier
Hi *,

attached is a codesnippet to insert a graphic as embedded, and not as
linked.

It is more or less some workaround, but it seems to work just fine.

The workaround is to use the BitmapTable to let OOo insert the file into
the zip-container (including the name-change to the checksum based one
that makes it impossible to just copy a file in the container). This
gives you the internal URL that can be used as GraphicURL.

While still a workaround, it is quite a comfortable one :-)

The idea to use the BitmapTable is from Danny Brewer (found the
corresponding Basic-Code in Andrew Pitonyak's Macro-Doc)

ciao
Christian
-- 
NP: Marilyn Manson - Antichrist Superstar
?xml version=1.0?
snippet language=Java application=Writer

keywords
keywordembed/keyword
keywordgraphic/keyword
keywordBitmapTable/keyword
keywordTextGraphicObject/keyword
keywordinternal URL/keyword
/keywords

authors
author id=cloph initial=true email=[EMAIL PROTECTED] 
copyright=Public Domain / noneChristian Lohmaier (of the 
Java-snippet)/author
author id= initial=false email=Danny Brewer (the idea to use 
the BitmapTable was his)/author
/authors

question heading=Embed a Graphic into a TextdocumentHow can I embed 
(instead of link to) a graphic into a Document?

pYou can only insert graphics using a GraphicURL - there doesnapos;t/p
pseem to be a way to embed a graphic/p
/question

answer
pThe solution is to let the GraphicURL point to an internal Graphic./p
pThe problem is that you cannot simply copy a file into the /p
pzip-container since OOo will change the name of the graphic to /p
psome checksum-based Name./p
pThat is where the BitmapTable comes into play. It allows you to /p
pspecify an external URL and it will embed the graphic into the /p
pzip-container and allows you to get the internalURL to it./p
pWith that URL, inserting the graphic as embedded is a cakewalk./p
listing/**
 * Embeds the given Image into a Textdocument at the given cursor position
 * (Anchored as character)
 *
 * @param grProps OOo-style URL and width amp; height of the graphic
 * @param xMSFthe factory to create services from
 * @param xCursor the cursor where to insert the graphic
 */
private void embedGraphic(GraphicInfo grProps,
XMultiServiceFactory xMSF, XTextCursor xCursor) {

XNameContainer xBitmapContainer = null;
XText xText = xCursor.getText();
XTextContent xImage = null;
String internalURL = null;

try {
xBitmapContainer = (XNameContainer) UnoRuntime.queryInterface(
XNameContainer.class, xMSF.createInstance(

quot;com.sun.star.drawing.BitmapTablequot;));
xImage = (XTextContent) UnoRuntime.queryInterface(
XTextContent.class, xMSF.createInstance(

quot;com.sun.star.text.TextGraphicObjectquot;));
XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, xImage);

// helper-stuff to let OOo create an internal name of the 
graphic
// that can be used later (internal name consists of various 
checksums)
xBitmapContainer.insertByName(quot;someIDquot;, 
grProps.unoURL);
internalURL = AnyConverter.toString(xBitmapContainer
.getByName(quot;someIDquot;));

xProps.setPropertyValue(quot;AnchorTypequot;,

com.sun.star.text.TextContentAnchorType.AS_CHARACTER);
xProps.setPropertyValue(quot;GraphicURLquot;, internalURL);
xProps.setPropertyValue(quot;Widthquot;, (int) 
grProps.widthOfGraphic);
xProps.setPropertyValue(quot;Heightquot;, (int) 
grProps.heightOfGraphic);

// inser the graphic at the cursor position
xText.insertTextContent(xCursor, xImage, false);

// remove the helper-entry
xBitmapContainer.removeByName(quot;someIDquot;);
} catch (Exception e) {
System.out.println(quot;Failed to insert Graphicquot;);
}
}
/listing
/answer

versions
version number=2.0.x status=tested/
version number=1.1.x status=can not work/
version number=1.0.x status=can not work/
/versions

operating-systems
operating-system name=All/
/operating-systems

changelog
change author-id=cloph date=2007-02-05Initial version/change
/changelog

/snippet

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

[api-dev] DocumentInfo: Wrong documentation, broken functionality or PEBKAC?

2007-02-02 Thread Christian Lohmaier
Hi *,

I got some trouble with the DocumentInfo's properties.
file:///opt/openoffice.org2.1_sdk/docs/common/ref/com/sun/star/document/DocumentInfo.html
http://api.openoffice.org/docs/common/ref/com/sun/star/document/DocumentInfo.html

The properties I can query don't match those that are listed in the
reference.

I originally tried in Java, but I get the same results when using Basic.

Try the following macro:
sub docinfoprops()
  Dim props() as Variant
  oDoc = ThisComponent
  oText = oDoc.getText()

  xprops = oDoc.getDocumentInfo()
  xpsi = xprops.getPropertySetInfo()
  props =  xpsi.getProperties()
  
  for i = 0 To UBound(props)
oText.InsertString(oCursor, Prop   i props(i).Name , false)
oinspect = xprops.getPropertyValue(props(i).Name) ' can watch this... 
oText.insertControlCharacter(oCursor, 
com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
  next
  
  print Done
end sub

You'll get 33 Properties, but not all are listed in the docs, and you don't get
all that are listed in the docs.

(look e.g. for the Language property listed in the docs. It is not
available. Instead you got a property CharLocale)

But the trouble doesn't stop here. Some properties cannot be retrieved.
You get an empty/void object instead.
So while you can use
oText.InsertString(oCursor, :
xprops.getPropertyValue(CreationDate).Year , false)

to get the Year-field from the DateTime struct, you cannot use
oText.InsertString(oCursor, :
xprops.getPropertyValue(CharLocale).Language , false)
to get the Language field from the Locale struct, since it doesn't
return a struct, but an empty object.

Is the problem my understanding of the whole thing? (please direct me to
my error/show me how I would do this properly)
Is the problem the documentation? Is the problem in the functionality of
the Office?

ciao
Christian
-- 
NP: Helmet - Ironhead

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] DocumentInfo: Wrong documentation, broken functionality or PEBKAC?

2007-02-02 Thread Christian Lohmaier
Hi Bernard, *,

On Fri, Feb 02, 2007 at 01:40:32PM +0100, Bernard Marcelly wrote:
 Message de Christian Lohmaier  date 2007-02-02 12:38 :
 
 I got some trouble with the DocumentInfo's properties.
 file:///opt/openoffice.org2.1_sdk/docs/common/ref/com/sun/star/document/DocumentInfo.html
 http://api.openoffice.org/docs/common/ref/com/sun/star/document/DocumentInfo.html
 
 The properties I can query don't match those that are listed in the
 reference.
 [...]
 You'll get 33 Properties, but not all are listed in the docs, and you 
 don't get
 all that are listed in the docs.
 
 I get 31 properties in a Writer or Calc document.

Hmm. I get 33 - no matter whether I use basic or java. (OOo 2.1 680_m6 (9095) -
Sun provided german build)
And in calc as well the props-Array contains 33 entries.

 You can read them easily in Basic with Xray macro.
 Xray thisComponent.DocumentInfo

When I set a watch on xprops and have a look at it, it has the 33 properties as
well.

 (look e.g. for the Language property listed in the docs. It is not
 available. Instead you got a property CharLocale)
 
 Language is documented but does not exist.
 CharLocale is not documented in DocumentInfo page, and does not exist in 
 DocumentInfo object.

But why is it included in the poperties then?

It is true that the doc has this property, but it has others as well that are
not included in the set returned.

 CharLocale is directly accessible (with Basic) from the document itself.

Well - that should not be possible in java, but I get it there as well.
 //xtd is XTextDocument
 XDocumentInfoSupplier xdis = (XDocumentInfoSupplier)UnoRuntime.queryInterface(
   XDocumentInfoSupplier.class,xtd);
 XDocumentInfo xdi = xdis.getDocumentInfo();
 XPropertySet xps = 
(XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xdi);
 XPropertySetInfo xpsi = xps.getPropertySetInfo();
 Property[] props = xpsi.getProperties();
 
 for (int i = 0; i  props.length; i++) {
   xText.insertString(xCursor, i +: + props[i].Name, false);
 }  

Gives me the same properties as in basic.

But maybe you meant this as a workaround and I got your wrong?

 Is the problem the documentation? Is the problem in the functionality of
 the Office?
 
 Documentation is incorrect. See Issue 26672 created nearly 3 years ago.

That talks about StandaloneDocumentInfo, but I want to query real DocumentInfo
- not sure whether that is still the same 

ciao
Christian
-- 
NP: Bif Naked - Daddy's Getting Married

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]