Hello Kushal,

> its my first time developing the dialog boxes, hence need some help.
> i have a dialog box to be implemented, for reference it can be seen here:
> http://wiki.services.openoffice.org/wiki/OpenOffice.org_Internship/Projects/2010/Customizable_html_export_for_Impress#Option_8
> .
> the code i am using to put a "fixedtext"(label) on the dialog is:
> WindowDescriptor windowDescriptor;

ehm ...

What you do here is to create a mere window peer, without an associated
control, or even control model.
While this is possible, some things you'll want to achieve will become
more difficult by this (admittedly, some will become easier ...)

The correct way to do this would be
- obtain the dialog model (I suppose you have one, yes?)
- let it create a control model
- insert this control model into the dialog model

In pseudo-code, this would look like this
  XMultiServiceFactory controlModelFactory =
    (XMultiServiceFactory)dialogModel;
  XPropertySet controlModel = (XPropertySet)
    controlModelFactory.createInstance(
      "com.sun.star.awt.UnoControlFixedTexModel" )
  controlModel.setPropertyValue( "PositionX", ... );
  controlModel.setPropertyValue( ... );
  XNameContainer modelContainer =
    (XNameContainer)dialogModel;
  modelContainer.insertByName( "MyControl", controlModel );

After the insertion, your dialog window (mxDialogWindow) will
automatically have a new child window, which corresponds to the control
model you just inserted.

> windowDescriptor.Type = WindowClass_SIMPLE;
> windowDescriptor.WindowServiceName = OUString(
> RTL_CONSTASCII_USTRINGPARAM("fixedtext") );
> windowDescriptor.Bounds = Rectangle( 6, 46, 59, 13 );

Note that you're using fixed pixel coordinates here. This will work for
your particular system/desktop/theme, but is likely to break on other
desktops. The problem is that as soon as, for instance, the font size
changes, your pixel coordinates will be wrong.

Model properties (PositionX, PositionY, Width, Height), on the other
hand, use "AppFont" coordinates: "1" means "1/8 of the average
height/width of a character of the application's UI font". So, when you
work with models instead of windows, your dialog will automatically
adjust itself to different desktops.

> the question is,,, how can i set the font properties??? like bold,font size
> etc, i.e FontDescriptor

At the model (controlModel in the above example code), you'd find a
property "FontDescriptor", being a css.awt.FontDescriptor structure,
which has all the members you need.

> another question is how can i add images to mxDialogWindow, such that i can
> set its source URL at runtime along with other properties like stretch to
> fit???

Use the same code as above, but let the dialog's factory create an
css.awt.UnoControlImageControlModel, and set its ImageURL and ScaleMode
properties
(http://api.openoffice.org/docs/common/ref/com/sun/star/awt/UnoControlImageControlModel.html)

Ciao
Frank

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to