| View previous topic :: View next topic |
| Author |
Message |
ykcim General User

Joined: 15 Jul 2003 Posts: 21
|
Posted: Fri Mar 24, 2006 5:03 am Post subject: How can i get dialogs |
|
|
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 |
|
 |
Pitounet OOo Enthusiast


Joined: 26 May 2005 Posts: 172 Location: Toulouse / France
|
Posted: Fri Mar 24, 2006 7:17 am Post subject: |
|
|
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 |
|
 |
ykcim General User

Joined: 15 Jul 2003 Posts: 21
|
Posted: Fri Mar 24, 2006 7:34 am Post subject: |
|
|
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 |
|
 |
Pitounet OOo Enthusiast


Joined: 26 May 2005 Posts: 172 Location: Toulouse / France
|
Posted: Fri Mar 24, 2006 7:53 am Post subject: |
|
|
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 |
|
 |
ykcim General User

Joined: 15 Jul 2003 Posts: 21
|
Posted: Fri Mar 24, 2006 8:08 am Post subject: |
|
|
In fact your code give me not the solution
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 |
|
 |
Pitounet OOo Enthusiast


Joined: 26 May 2005 Posts: 172 Location: Toulouse / France
|
Posted: Fri Mar 24, 2006 8:29 am Post subject: |
|
|
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 |
|
 |
ykcim General User

Joined: 15 Jul 2003 Posts: 21
|
Posted: Sun Mar 26, 2006 12:56 am Post subject: |
|
|
That's a nice way to get a list of dialogs.
But i can't delete or insert a dialog.
Michael |
|
| Back to top |
|
 |
KenSmith General User

Joined: 04 Nov 2005 Posts: 23 Location: Sanfransisco bay area
|
Posted: Tue Mar 28, 2006 7:12 pm Post subject: |
|
|
| 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 |
|
 |
KenSmith General User

Joined: 04 Nov 2005 Posts: 23 Location: Sanfransisco bay area
|
Posted: Fri Mar 31, 2006 11:52 am Post subject: |
|
|
| 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 |
|
 |
|