Re: [EXT]How to declare a unique-instance and all-contexts component

2014-07-10 Thread Amenel VOGLOZIN
Yes, I was indeed using the same class for everything, with the intention of 
creating dedicated classes for each responsibility (component, event handlers, 
listeners, etc.).

As to tracking recent documents. For now, I'm installing a document event 
listener in the initialize (com.sun.star.lang.XInitialization interface) 
method... Yes, it's wrong: each event is notified several times depending on 
whether several documents are opened or whether a menu item of the extension 
was clicked. I'm "intercepting" OnLoad, OnSaveDone and OnSaveAsDone events. My 
list of files will be stored in a text format (JSON or INI or else, haven't 
chosen yet) in (I guess) the user's application data folder. This means I do 
not replace the standard MRU files list; I just complement it with a richer set 
of features (pinning, grouping, tagging, hiding, "forgetting about", etc.). The 
text file is loaded in the initialize method and saved on the OnCloseApp event.

It's coming along nicely but definitely not beautifully :)

Thanks for your reply.




How are you tracking the recent documents? The ProtocolHandler is not
the place to do that ;)

Re: UNO for Dummies wanted

2014-07-10 Thread Alexandro Colorado
I am assuming you are using C++ to code to the API. This is not as
 common, and most of the tools are done for other languages like Java,
 that said. You can read the Development guide which includes
 information about which interface to use, or what tool to use. Even a
 Macro could be much easier to do if all you want is to code to the
 document as opposed to the application.

 There are many guides that talk about all the things you just
 mentioned here are some links:
https://wiki.openoffice.org/wiki/API/Samples/Java/Writer/TextDocumentStructure
https://wiki.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
https://wiki.openoffice.org/wiki/UNO_automation_with_a_binary_(executable)#Create_a_new_Document

On 7/8/14, DEWI - N. Zacharias  wrote:
> Hi,
>
> I thougt that M$ Word was complicated to interface from C++.  But for me OO
> seems to be much much more a pain in the ass because of all the tons of
> information about services, interfaces and factories etc.  you have to know
> before you are able to do something useful.  I assume that this concept
> superior over the M$ office concept, but for a simple C++ user who simply
> wants to create a document which presents the result of measurements and
> other data by using tables plots and some text it is far too complicated.
>
> I would gratefully appreciate  a howto which explain with practical examples
> how  to create a writer document and creating tables , formatted text (with
> sub and superscript)  inserting plots (e.g. SVG or postscript), filling
> document variables with formatted text  etc.  Which also explain in very
> simple manner how to change the properties of a table like the back ground
> color or the font of the text or the width of a column.
>
> Thank you very much and best regards
> Norbert Zacharias
>
>
> 
>
> Dipl. Phys.
>
> Norbert Zacharias
>
> Wind Measurements & Power Curve Measurements
>
>
> DEWI GmbH
>
> Ebertstrasse 96
>
> 26382 Wilhelmshaven
>
> Germany
>
> Tel.:   +49 4421 4808 876
> Fax:+49 4421 4808 843
>
> Email:  n.zachar...@dewi.de
> Home:   www.dewi.de
>
> a UL company
>
>
>
> DEWI GmbH has been acquired by UL (Underwriters Laboratories) and now
> operates as a UL Company.
>
> DEWI GmbH
>
> Commercial Register No.: Amtsgericht Oldenburg, HRB 130241
>
> Managing Director: Juan Francisco Martinez Cobo, Jens Peter Molly, Michael
> A. Saltzman, Sajeev Jesudas, Gitte Schj?tz
>
> P Please consider the environment before printing this email.
>
>
>
>
>


-- 
Alexandro Colorado
Apache OpenOffice Contributor
882C 4389 3C27 E8DF 41B9  5C4C 1DB7 9D1C 7F4C 2614

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



Re: UNO for Dummies wanted

2014-07-10 Thread Ariel Constenla-Haile
Hello Norbert,

note that you are not subscribed to the list, so you may miss some
answers.

On Tue, Jul 08, 2014 at 07:21:01PM +0200, DEWI - N. Zacharias wrote:
> Hi,
> 
> I thougt that M$ Word was complicated to interface from C++.  But for
> me OO seems to be much much more a pain in the ass because of all the
> tons of information about services, interfaces and factories etc.  you
> have to know before you are able to do something useful.  I assume
> that this concept superior over the M$ office concept, but for
> a simple C++ user who simply wants to create a document which presents
> the result of measurements and other data by using tables plots and
> some text it is far too complicated.
> 
> I would gratefully appreciate  a howto which explain with practical
> examples how  to create a writer document and creating tables
> , formatted text (with sub and superscript)  inserting plots (e.g. SVG
> or postscript), filling document variables with formatted text  etc.
> Which also explain in very simple manner how to change the properties
> of a table like the back ground color or the font of the text or the
> width of a column.

Did you set up the SDK and try to build the C++ examples? At least try
with 

sdk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_cpp
sdk/examples/DevelopersGuide/ProfUNO/CppBinding
sdk/examples/cpp/complextoolbarcontrols

I have a collection of C++ examples (with VS C++ project files), but
didn't check them in a while, it will have to wait until the weekend.

You can also search this mailing list for mails with attachments,
something like
http://markmail.org/search/?q=list%3A+org.apache.incubator.ooo-api+attach%3Acxx


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina


signature.asc
Description: Digital signature


Re: [EXT]How to declare a unique-instance and all-contexts component

2014-07-10 Thread Ariel Constenla-Haile
Hello Amenel,

On Thu, Jul 10, 2014 at 01:40:21PM +0100, Amenel VOGLOZIN wrote:
> Hi all,
> 
> For a few weeks, I have been writing an extension that can be seen as
> a "Recent files manager". I'm using Java and it's going great so far.
> 
> 
> The problem that I'm encountering is that (I have confirmed this fact
> several times) the extension is being instantiated once for each
> document that I open. It is also instantiated the first time that
> I click on its menu in the menu bar.
> 
> 
> There's probably something that I didn't do well. How can I make the
> extension's component a singleton? Should I add an entry in the
> service names in addition to "com.sun.star.frame.ProtocolHandler"? If
> yes, what value should I provide? Is it the fully qualified name of
> the main class?

You didn't do anything wrong, a ProtocolHandler is supposed to be
instantiated and initialized on a per Frame/UI element controller basis
(that is, add your command to a toolbar item and a menu bar item, then
you'll find that the component gets instantiated twice, or even more).

You can design UNO components as singletons, make the component factory
return always the same instance, etc.; but in this case, the
ProtocolHandler was not designed for that; it is better to implement the
singleton patter in another class. You have different options:

- it is a better practice to separate the implementation from the
  ProtocolHandler and the Dispatch object (I assume you are implementing
  both in the same class, and queryDispatch/es returns this) so that you
  have different roles and responsibilities; you can make the
  ProtocolHandle's return always the same dispatch object per Frame so
  that you have a n-1 relationship

- implement the singleton pattern on a helper class that handles all the
  recent documents handling

How are you tracking the recent documents? The ProtocolHandler is not
the place to do that ;)


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina


signature.asc
Description: Digital signature


[EXT]How to declare a unique-instance and all-contexts component

2014-07-10 Thread Amenel VOGLOZIN
Hi all,

For a few weeks, I have been writing an extension that can be seen as a "Recent 
files manager". I'm using Java and it's going great so far.


The problem that I'm encountering is that (I have confirmed this fact several 
times) the extension is being instantiated once for each document that I open. 
It is also instantiated the first time that I click on its menu in the menu bar.


There's probably something that I didn't do well. How can I make the 
extension's component a singleton? Should I add an entry in the service names 
in addition to "com.sun.star.frame.ProtocolHandler"? If yes, what value should 
I provide? Is it the fully qualified name of the main class?

Thank you.