OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

a Macro for granma

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Martmel
General User
General User


Joined: 01 Sep 2004
Posts: 14

PostPosted: Wed Sep 01, 2004 6:40 am    Post subject: a Macro for granma Reply with quote

Hi all, I'm new in this forum
And I'd like to build simplified "open" and "save" dialog boxes for my grand mother:

Open :
A list of documents she can open (restricted to one folder)
OK and cancel buttons

Save
A list of existing documents (restriced too)
OK and cancel buttons

(She definitely needs something simple)

I will then simplify the toolbars for her.
Unfortunately I'm only a beginner in writing macros. Does someone know a similar project that could get me inspired ?
How would you start programming it? Sould I modify the existing dialogs? Should I write my own ones?

Thank you

Martin
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Wed Sep 01, 2004 7:55 am    Post subject: Reply with quote

I don't believe that you can modify the existing dialogs. Think about it. OOo runs on various platforms, each of which have their own open / save dialog boxes. Mac OS X. Windows. Various Linux.

It seems that the best approach would be to build your own dialog boxes. Customize the menus so that Open and Save call Basic macros which display your dialog boxes.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Martmel
General User
General User


Joined: 01 Sep 2004
Posts: 14

PostPosted: Thu Sep 02, 2004 2:01 am    Post subject: Reply with quote

Thanks DannyB !
Ok, I've started writing my own open and save macros

I still have a problem trying to open all documents in the same window :

SearchFlags = com.sun.star.frame.FrameSearchFlag.CREATE + _
com.sun.star.frame.FrameSearchFlag.ALL
Doc = StarDesktop.loadComponentFromURL(Url, "framename", SearchFlags, Dummy())

This works well when I'm opening the second document because the framename is allready set to "framename" but I would like to avoid grandma having to deal with multiple windows.

Does someone knows how to get the framename of the current window?

Thanks !
Martin
Back to top
View user's profile Send private message
Martmel
General User
General User


Joined: 01 Sep 2004
Posts: 14

PostPosted: Thu Sep 02, 2004 4:47 am    Post subject: Reply with quote

Also, when I try to save the document I know I have to use this command :

Doc.storeAsURL("file://" + PATH + FileName.Text, Dummy())

but I have no idea of how to initialize the variable Doc ?
How should i initialize it?

Thanks !
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Thu Sep 02, 2004 5:18 am    Post subject: Reply with quote

Here are some loader tricks, loading a new document into the same frame. It is not necessary to mess with frame names.

Load new document into existing window frame
http://www.oooforum.org/forum/viewtopic.php?t=6076
Two Frames in a single window
http://www.oooforum.org/forum/viewtopic.php?p=36764#36764

The variable "Doc" is the document model of the document.

Document model, controller and frame
http://www.oooforum.org/forum/viewtopic.php?t=5057

When you first open a document....

Open and Create documents, various prog. languages
http://www.oooforum.org/forum/viewtopic.php?t=5252

MakePropertyValue function
http://www.oooforum.org/forum/viewtopic.php?t=5108
In Visual Basic...
http://www.oooforum.org/forum/viewtopic.php?p=22029#22029
In Python...
http://www.oooforum.org/forum/viewtopic.php?p=26198#26198

you get back the document model from loadComponentFromURL.

In OOo basic, you can use the variable ThisComponent to obtain the document model of the doc which contains the currently running macro.

You can use StarDesktop.getCurrentComponent() to get the document model of the front most document. But then you need to do some additional checks on it to make sure it is a document rather than some other type of component, such as the Help window, or Basic IDE, or third party lightweight component.

Some Introspection techniques (various languages)
http://www.oooforum.org/forum/viewtopic.php?t=7068
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Martmel
General User
General User


Joined: 01 Sep 2004
Posts: 14

PostPosted: Fri Sep 03, 2004 5:49 am    Post subject: Reply with quote

Thanks again DannyB !

I managed to program my own open and save dialog boxes.

I would like now to get rid of the menu bar (to keep only the toolbars I created). Do you know if such a thing is possible ? Should I try to find how to hide it ? Is there a config file that can be rewritten in order to make it disappear? Or should I write a macro that will hide it at startup?

I would also remove the contextual menu that appears with the right click. How can such a thing be done?

I really ur apreciate your help.
Thanks

Martin
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Fri Sep 03, 2004 11:36 am    Post subject: Reply with quote

Tools --> Configure
This lets you change the menu bars.

After you have done this, you may notice some new XML config files in your "user" folder.

On Windows, the "user" folder may be directly under your OOo installation folder, if you did a single user install.
On Windows, the "user" folder may be somewhere in your "home directory" if you did a network install.
On Linux, the "user" folder is in a place such as....
/home/danny/OpenOffice.org1.1.3/user

In your "user" folder see this....
OOo/user/config/soffice.cfg

In this folder, you may see some new files such as...
drawmenubar.xml
drawtoolbar.xml
calcmenubar.xml
etc...

These xml files contain the configuration that you changed from the
Tools --> Configure
dialog box.

In OOo 2.0, the configuration will be officially stored in the Configuration Manager data. Therefore, in 2.0, it will be possible to reconfigure the menus and toolbars programmatically.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Martmel
General User
General User


Joined: 01 Sep 2004
Posts: 14

PostPosted: Mon Oct 11, 2004 7:00 am    Post subject: Reply with quote

DannyB wrote:
In your "user" folder see this....
OOo/user/config/soffice.cfg

In this folder, you may see some new files such as...
drawmenubar.xml
drawtoolbar.xml
calcmenubar.xml
etc...


Ok, I know it's been a while... I've checked and found writermenubar.xml in the soffice.cfg dir. Unfortunately I did not manage to remove the bar itself. I managed to empty it messing around with the file but didn't succeded removing (hiding) it.

is there an option i should use in that file?

Is there an api for starbasic like javadoc for java?

Thanks,
Martin
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Mon Oct 11, 2004 8:37 am    Post subject: Reply with quote

Martmel wrote:
Unfortunately I did not manage to remove the bar itself. I managed to empty it messing around with the file but didn't succeded removing (hiding) it.

There is an API for manipulating toolbars and menubars in OOo 2.0. Maybe that will help? I don't know of a way to completely remove the menu bar in OOo. It may not be possible now or in the future.

Martmel wrote:
Is there an api for starbasic like javadoc for java?


See this....

online API reference....
http://api.openoffice.org/docs/common/ref/com/sun/star/module-ix.html
This is what you're looking for. It's javadoc like.

If you download the SDK, you can then have this reference on your local drive.

Also very important to see....

Developer's Guide
http://api.openoffice.org/DevelopersGuide/DevelopersGuide.html

(Developer's Guide TOC is here)
http://api.openoffice.org/docs/DevelopersGuide/DevelopersGuide.htm




Also see.....

How do I get started?
=====================

Very large list of links here...
http://www.oooforum.org/forum/viewtopic.php?p=24224#24224



http://www.oooforum.org/forum/viewtopic.php?t=5421
http://www.oooforum.org/forum/viewtopic.php?t=3687
http://www.oooforum.org/forum/viewtopic.php?t=3590

Basic Programmer's Guide is here....
http://docs.sun.com/db/coll/999.2

StarOffice 7 Basic Programmer's Guide, English
http://docs.sun.com/db/doc/817-1826?q=StarOffice

Available in other languages...
http://api.openoffice.org/TipsAndTricks/external.html

StarOffice 6 Basic Programmer's Guide, English
http://docs.sun.com/db/doc/817-1826-10

StarOffice 6 Product Documentation
http://docs.sun.com/db/coll/999.2

OpenOffice Macro Document by Andrew Pitonyak
http://www.pitonyak.org/AndrewMacro.sxw

Lots of macros here...
http://www.OOoMacros.org

StarBasic FAQ (German only)
http://www.dannenhoefer.de/faqstarbasic.htm

API Tips and Tricks (external)
http://api.openoffice.org/TipsAndTricks/external.html
http://www.oooforum.org/forum/viewtopic.php?p=13511#13511
http://www.oooforum.org/forum/viewtopic.php?p=15399#15399
http://www.oooforum.org/forum/viewtopic.php?p=15246#15246
http://www.oooforum.org/forum/viewtopic.php?p=11995#11995
http://www.oooforum.org/forum/viewtopic.php?t=3479
http://www.oooforum.org/forum/viewtopic.php?p=16186#16186
http://www.oooforum.org/forum/viewtopic.php?t=4608
http://www.oooforum.org/forum/viewtopic.php?p=13834#13834
http://www.oooforum.org/forum/viewtopic.php?p=15034#15034
http://www.oooforum.org/forum/viewtopic.php?t=3735
http://www.oooforum.org/forum/viewtopic.php?t=3681

XShapes, DrawPage, GenericDrawPage
http://www.oooforum.org/forum/viewtopic.php?t=5328


Developer's Guide
http://api.openoffice.org/DevelopersGuide/DevelopersGuide.html

(Developer's Guide TOC is here)
http://api.openoffice.org/docs/DevelopersGuide/DevelopersGuide.htm

and the online API reference....
http://api.openoffice.org/docs/common/ref/com/sun/star/module-ix.html

Useful links from Russ...
http://www.oooforum.org/forum/viewtopic.php?p=16374#16374

Description of OOo as a large collection of services
http://www.oooforum.org/forum/viewtopic.php?p=28094#28094




How to navigate the OOo API Docs
================================

In this post, begin at the sentence...
"So how did I learn about how to use removeByIndex() ?"
http://www.oooforum.org/forum/viewtopic.php?p=25537#25537

http://www.oooforum.org/forum/viewtopic.php?p=29989#29989
http://www.oooforum.org/forum/viewtopic.php?p=13511#13511
http://www.oooforum.org/forum/viewtopic.php?p=15399#15399
http://www.oooforum.org/forum/viewtopic.php?p=15246#15246
http://www.oooforum.org/forum/viewtopic.php?p=11995#11995
http://www.oooforum.org/forum/viewtopic.php?t=3479
http://www.oooforum.org/forum/viewtopic.php?p=16186#16186
http://www.oooforum.org/forum/viewtopic.php?t=4608
http://www.oooforum.org/forum/viewtopic.php?p=13834#13834
http://www.oooforum.org/forum/viewtopic.php?p=15034#15034
http://www.oooforum.org/forum/viewtopic.php?t=3735
http://www.oooforum.org/forum/viewtopic.php?t=3681

XShapes, DrawPage, GenericDrawPage
http://www.oooforum.org/forum/viewtopic.php?t=5328

Developer's Guide
http://api.openoffice.org/DevelopersGuide/DevelopersGuide.html

(Developer's Guide TOC is here)
http://api.openoffice.org/docs/DevelopersGuide/DevelopersGuide.htm

and the online API reference....
http://api.openoffice.org/docs/common/ref/com/sun/star/module-ix.html

Useful links from Russ...
http://www.oooforum.org/forum/viewtopic.php?p=16374#16374
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group