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

How can i get dialogs

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


Joined: 15 Jul 2003
Posts: 21

PostPosted: Fri Mar 24, 2006 5:03 am    Post subject: How can i get dialogs Reply with quote

Hi,

if i get the basiclibraries in a document, so i can delete, change and insert modules.
But i did'nt find a way to get the dialoglibraries of a document.

I can get the basic and dialogs of OO thelf:

oGlobalBasicLibrary = Globalscope.BasicLibraries
oGlobalDlgLibrary = Globalscope.DialogLibraries

I can get the basiclibraires of a document

oDoclBasicLibrary = odoc.BasicLibraries

And the dialogs?

best regards
Michael
Back to top
View user's profile Send private message Visit poster's website
Pitounet
OOo Enthusiast
OOo Enthusiast


Joined: 26 May 2005
Posts: 172
Location: Toulouse / France

PostPosted: Fri Mar 24, 2006 7:17 am    Post subject: Reply with quote

Hi,

Here is an example to adapt to your code:
Code:
' Load your document dialogs in your document Standard library 
DialogLibraries.LoadLibrary("Standard")
'Load one of your dialog
oDialog = CreateUnoDialog(DialogLibraries.Standard.YourDialog)   


Is that OK?

Antoine.
Back to top
View user's profile Send private message
ykcim
General User
General User


Joined: 15 Jul 2003
Posts: 21

PostPosted: Fri Mar 24, 2006 7:34 am    Post subject: Reply with quote

Sorry, that's not for what i am looking for. I know how to use a dialog.

I want a all dialogs of a document in an object.

See, if i use the global makros i can get all modules and dialogs with this code:

Code:

   oGlobalBasicLibrary = Globalscope.BasicLibraries 
   oGlobalDlgLibrary = Globalscope.DialogLibraries 
   oquell_Lib = oGlobalBasicLibrary.getByName("Standard")
   elements=oquell_lib.getElementnames()
    for i=0 to ubound(elements)
       msgbox    elements(i)
   next i
  oquell_Lib = oGlobalDlgLibrary.getByName("Standard")
  elements=oquell_lib.getElementnames()
   for i=0 to ubound(elements)
       msgbox    elements(i)
   next i


Now i want the same for a document. But i can't get the dialogs.

Michael
Back to top
View user's profile Send private message Visit poster's website
Pitounet
OOo Enthusiast
OOo Enthusiast


Joined: 26 May 2005
Posts: 172
Location: Toulouse / France

PostPosted: Fri Mar 24, 2006 7:53 am    Post subject: Reply with quote

In fact my code gives you the solution...

To obtain the Dialog inside a document you must use "DialogLibraries" instead of "Globalscope.DialogLibraries" which is for user and system libraries.

Then you will be able to have the list of your dialogs:
Code:
Sub TestAllDialogs()
  oquell_Lib = DialogLibraries.getByName("Standard")
  elements=oquell_lib.getElementnames()
   for i=0 to ubound(elements)
       msgbox    elements(i)
   next i

End Sub


Antoine
Back to top
View user's profile Send private message
ykcim
General User
General User


Joined: 15 Jul 2003
Posts: 21

PostPosted: Fri Mar 24, 2006 8:08 am    Post subject: Reply with quote

In fact your code give me not the solution Sad

This way is only good if the macro is inside the document.
But my macro is inside my user macros.
I can read the modules:

Code:

  odoc=thiscomponent
  oquell_Lib = odoc.BasicLibraries.getByName("Standard")
  elements=oquell_lib.getElementnames()
   for i=0 to ubound(elements)
       msgbox    elements(i)
   next i


But not the dialogs. The object dialoglibaries is not given.

Michael
Back to top
View user's profile Send private message Visit poster's website
Pitounet
OOo Enthusiast
OOo Enthusiast


Joined: 26 May 2005
Posts: 172
Location: Toulouse / France

PostPosted: Fri Mar 24, 2006 8:29 am    Post subject: Reply with quote

I had not understand you were not in the document...

I know a wauy to find the dialogs but is a bit more complicated and the first item shall not be taken into account.
Try ( To more coherent you shall go through all libraries after "test.getByName("Dialogs")")
Code:
 test = oDoc.DocumentStorage
  oquell_Lib = test.getByName("Dialogs").getByName("Standard")
  elements=oquell_lib.getElementnames()
   for i=0 to ubound(elements)
       msgbox    elements(i)
   next i


Antoine.
Back to top
View user's profile Send private message
ykcim
General User
General User


Joined: 15 Jul 2003
Posts: 21

PostPosted: Sun Mar 26, 2006 12:56 am    Post subject: Reply with quote

That's a nice way to get a list of dialogs.
But i can't delete or insert a dialog.

Michael
Back to top
View user's profile Send private message Visit poster's website
KenSmith
General User
General User


Joined: 04 Nov 2005
Posts: 23
Location: Sanfransisco bay area

PostPosted: Tue Mar 28, 2006 7:12 pm    Post subject: Reply with quote

ykcim wrote:
That's a nice way to get a list of dialogs.
But i can't delete or insert a dialog.

Michael


I assume that there is a .HasByName and .InsertByName

I haven't been able to even do the

Code:

TheDocument.DocumentStorage.GetByName("Dialogs")


I get an error telling me there is no such element. My document has no dialogs in it yet.[/code]
_________________
I'm new here
Back to top
View user's profile Send private message
KenSmith
General User
General User


Joined: 04 Nov 2005
Posts: 23
Location: Sanfransisco bay area

PostPosted: Fri Mar 31, 2006 11:52 am    Post subject: Reply with quote

Pitounet wrote:
I had not understand you were not in the document...

I know a wauy to find the dialogs but is a bit more complicated and the first item shall not be taken into account.
Try ( To more coherent you shall go through all libraries after "test.getByName("Dialogs")")
Code:
 test = oDoc.DocumentStorage
  oquell_Lib = test.getByName("Dialogs").getByName("Standard")
 [....]



An Xray() of TheDocument and TheDocument.DocumentStorage shows that there is no part of either called "Dialogs". This seems to be why the above doesn't work.

The solution I'm working on is to shell out to "unzip TheDocName", diddle with the contents and then shell to a "zip TheDocumentName". It won't be very portable but the OP may be interested.
_________________
I'm new here
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