Re: [api-dev] Using an Xframe as a parent for a Java dialog

2008-11-21 Thread Jan Füssel
Hi Peter,

the shown solution of mine is the result of longtime with Spring, AWT
 SWT. I don't think its possible out of the box. An early solution
is based on JNI, but it was to complex to realize my problems.

i'm going to fish for some source files when i arrive at home after work.

Jan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] soffice -headless

2008-11-05 Thread Jan Füssel
Hi,

i've a similar scenario with an headless openoffice. The first version
of OpenOffice.org which i have sucessfully used in headless mode and
without xvfb is 2.4.1.

All previous version didn't work for me.

I hope this information could help you.

Jan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Using an Xframe as a parent for a Java dialog

2008-10-31 Thread Jan Füssel
Hi,

i've currently a solution to open a modless java-dialog, which need
SWT and only works on a windows machine.

To get Windows Handle I used the following Basic-Code:

Dim oWindow : oWindow = ThisComponent.CurrentController.Frame.ContainerWindow
Dim HWND : HWND = oWindow.getWindowHandle(Array(),
com.sun.star.lang.SystemDependent.SYSTEM_WIN32)

With that handle I call java Java-Method which start an SWT-Dialog:

private void createDialog(int handle) {
final MyDialog myDialog = MyDialog.create(handle, componentContext);
myDialog.show();
}

Here a little piece of the MyDialog Class:

public class MyDialog {

private final Shell myShell;

private MyDialog(Shell shell) {
myShell = shell;
myShell.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
myShell.setVisible(true);
}
});
}

public static MyDialog create(int handle, XComponentContext
componentContext) {
final int style = SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE;
final Display display = new Display();
final Shell shell;
if (handle  0) {
final Shell parent = Shell.win32_new(display, handle);
shell = new Shell(parent, style);
} else {
shell = new Shell(style);
}
return new MyDialog(shell);
}

public void show() {
createMyShell();
myShell.open();
final Composite parent = myShell.getParent();
final Display display;
if (parent != null) {
display = parent.getDisplay();
} else {
display = Display.getDefault();
}
while (!myShell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
}

I hope this little pieces of code could show you a way to resolve your problem.

Jan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[api-dev] Export Textdocument to PDF/A

2008-04-07 Thread Jan Füssel
Hi,

after downloading OOo 2.4 i wan't to modify my Java-based PDF-Export from
Standard-PDF to PDF/A.
After a long time of searching, i can't find any information about a new
export-filter or a new filter-option.
Could anybody help?

Thanks

Jan


Re: [api-dev] Export Textdocument to PDF/A

2008-04-07 Thread Jan Füssel
Hi Giuseppe,

thanks, thats what i'm searching for.
i'm wondering why i wasn't able to find it with my wiki-search...

2008/4/7, Giuseppe Castagno [EMAIL PROTECTED]:

 Hi Jan,

 Jan Füssel wrote:

  Hi,
 
  after downloading OOo 2.4 i wan't to modify my Java-based PDF-Export
  from
  Standard-PDF to PDF/A.
  After a long time of searching, i can't find any information about a new
  export-filter or a new filter-option.
  Could anybody help?
 

 I guess you need to set 'SelectPdfVersion' property, there is a brand
 new wiki page here [1].

 The page is still under development, but I think you'll find there what
 you need.

 --
 Kind Regards,
 Giuseppe Castagno
 Acca Esse http://www.acca-esse.eu
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [1] http://wiki.services.openoffice.org/wiki/API/PDF_export


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: [api-dev] UserDefinedAttributes for TextSection....

2007-09-05 Thread Jan Füssel
Hi,

its a bug: http://qa.openoffice.org/issues/show_bug.cgi?id=58667


Re: [api-dev] UserDefinedAttributes for TextSection....

2007-09-05 Thread Jan Füssel
Sry, for my quickshot above...

UserDefinedAttributes are documentated Features that are currently buggy.

Regards jan


Re: [api-dev] UserDefinedAttributes for TextSection....

2007-09-05 Thread Jan Füssel
Seems not be be my day...
TextSection != Text...

Back to topic:
In some of my macros I use the UserDefinedAttributes of TextSections. To
store an Attribute i use the following function:

Function AddAttribute(AttributeContainer As
com.sun.star.xml.AttributeContainer, AttributeName As String, AttributeValue
As String)
  Dim oMyAttribute As Object

  oMyAttribute = createUnoStruct(com.sun.star.xml.AttributeData)

  With oMyAttribute
'.Namespace = citDesigner
.Type = CDATA
.Value = AttributeValue
  End With

  If AttributeContainer.hasByName(AttributeName) Then
AttributeContainer.removeByName(AttributeName, oMyAttribute)
AttributeContainer.insertByName(AttributeName, oMyAttribute)
  Else
AttributeContainer.insertByName(AttributeName, oMyAttribute)
  End If

  AddAttribute = AttributeContainer
End Function


The trick is to rewrite the Container to the section, eg.:
oSection.UserDefinedAttributes = AddAttribute(oSection.UserDefinedAttributes,
foo, bar)

i hope this does resolve your problems


Re: [api-dev] enumerating user defined attributes

2007-08-13 Thread Jan Füssel
Hi,

i couldn't answer your question, but currently there is a bug (
http://qa.openoffice.org/issues/show_bug.cgi?id=58667) which make the
TextUserDefinedAttributes unusable, cause the reference to the attributes
get lost after closing the document.

This bug was fixed in a 2.3 dev-build I tested a few weeks ago.

Regards
Jan


Re: [api-dev] Some Calc Java Macro Issues:

2007-07-05 Thread Jan Füssel

Hi Denis,

To 1)

The following code is a little example how to execute a dispatch in java:

private static void updateFields(XComponentContext componentContext, Object
oDesktop, String unoUrl) throws com.sun.star.uno.Exception,
MalformedURLException, UpdateIndexesException {
   XMultiComponentFactory serviceManager =
componentContext.getServiceManager();
   XDesktop xd = (XDesktop)UnoRuntime.queryInterface(XDesktop.class,
oDesktop);
   final Object helper = serviceManager.createInstanceWithContext(
com.sun.star.frame.DispatchHelper, componentContext);
   XDispatchHelper xdh = (XDispatchHelper)UnoRuntime.queryInterface(
XDispatchHelper.class, helper);

   // this code is executed from a remote machinbe via uno, so we need
to identify the right document
   XEnumerationAccess xea = xd.getComponents();
   XEnumeration xe = xea.createEnumeration();

   XModel currentModel = null;

   while (xe.hasMoreElements()) {
   final XModel xModel = (XModel)UnoRuntime.queryInterface(
XModel.class, xe.nextElement());
   if (xModel != null) {
   final String modelUrl = xModel.getURL();
   if (modelUrl.equals(unoUrl)) {
   currentModel = xModel;
   break;
   }
   }
   }

   if (currentModel != null) {
   final XFrame currentFrame = currentModel.getCurrentController
().getFrame();
   XDispatchProvider xdp =
(XDispatchProvider)UnoRuntime.queryInterface(XDispatchProvider.class,
currentFrame);
   // instert your uno-cmd
   xdh.executeDispatch(xdp, .uno:UpdateAllIndexes, , 0, new
PropertyValue[0]);
   } else {
   // should not happen
   throw new UpdateIndexesException();
   }
   }


Sometimes ist better to use the dispatch than do it by yourself in java,
cause of some performance and syncronize-issues

Regards

Jan


Re: [api-dev] Extend an Existing OpenOffice-Service

2007-03-08 Thread Jan Füssel



Hi Jan,

what do you excatly want to  do? can you give a quick usage scenario?
I am not really sure what you are trying to do.

Cheers
Harald


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




hi harald,

i want to insert a field and add some properties which are not supported by
the default field-elements of OOo.
this properties must be stored in document.
i store these properties in invisible document vaiables, like it's described
in andrew pontyaks macro book.
but actual i need a way to associate 1-n invisible document vaiables to one
field.

eg.

placeholder-field:
Displayed Value in Text-Document: Surename
Tooltip:  The first name of issuer

invisible document vaiables (name|value):
ID.isRepeatable|true
ID.defaultValue|Vorname

the missing part is the ID

regards jan


Re: [api-dev] Extend an Existing OpenOffice-Service

2007-03-08 Thread Jan Füssel

Hi Jan,



why don't you use a naming konvention like: name your invisible
variables like placeholderfieldnamevariable_name? This way the
placeholder name would act as ID.

Cheers
Harald



hi,

if you take the prior example, it is possible to have more than one field
with the placeholderfieldname == surname.
for example the issuer-surname and a requestor-surename.
if there is no other way i have to choose that resolution. but i have
problems in another project using not unique fields for ids. you have to
lookup ervery time you create an object, if there is another one with that
name. you also have to handle things like copypaste an existing field.
using the build-in copy and paste cause 2 fields references to the same
variables

regards
jan


Re: [api-dev] Extend an Existing OpenOffice-Service

2007-03-08 Thread Jan Füssel



 hi harald,

 i want to insert a field and add some properties which are not
 supported by
 the default field-elements of OOo.
 this properties must be stored in document.
 i store these properties in invisible document vaiables, like it's
 described
 in andrew pontyaks macro book.
do not kwow's that, I use the Userfields for this purpuse , but they
are visible, i look in the Book but lo luck, please at what page can i
find this stuff ?



try that http://www.pitonyak.org/AndrewMacro.odt
you find that part in Listing 5.47: Setting document variables. p 56ff


Re: [api-dev] Extend an Existing OpenOffice-Service

2007-03-07 Thread Jan Füssel

This service seems to be an internal service that is not
instantiatable without a certain context. I assume that you can
instantiate it only with the XMultiServiceFactory interface of a text
document, but not from the general service manager you either received
or bootstrapped. Such services very often are just UNO wrappers around
some C++ classes bound to other C++ classes so that these services are
not exchangeable.

Can you explain why you wanted to extend this service?



i want to write an addon which is similar to known mailmerge-scenarios.

the user can add a placeholder via an basic dialog into an textdocument.
this placeholder has the following properties:
- a displayed value
- an expression which selects the value in an datasource
- some other conditions, like repeatable, inserted value if value isn't
present in the datasource, ...

this properties must be stored persistent IN the document.
the placeholder have to be unmodifiable by the user directly
if the user (double-)click on the placeholder an edit dialog should be shown

i have a resolution for the most of this cases. i can also store the
properties of the placeholder in the document in different ways, but i need
a way to reference the placeholder, like an id.

is there an undocumented way to get an document-wide, unique identifier of
an text-element?

regards

jan


Re: [api-dev] Extend an Existing OpenOffice-Service

2007-03-07 Thread Jan Füssel

Hi Jan,



in content.xml of a document containing placeholders you will find an
attribute text:description in every placeholder:

text:placeholder text:placeholder-type=text
text:description=reference1

you can define this description in the dialog while creating the
placeholder. I don't know how you can get this information through the
API but I would bet it's easy to find if you have already found all
placeholders :).

Perhaps someone on the list will post a snippet .

Cheers
Harald



hi harald,

i  used the synonym placeholder in an abstract meaning, unkowing that an
with that name exists ;)
i know the way to set that property, but i feel much better if the
id/reference isn't shown to the user by UI. in your case it's shwon in the
tooltip. but that element is an option, if the worst comes to the worst

but i would prefer a way to get an internal id (OOo-generated) of an
element.


[api-dev] Extend an Existing OpenOffice-Service

2007-03-06 Thread Jan Füssel

Hi,

i have a question about the uno api. is it possible to extend an existing
service via an own uno component?
in my case, i want to add some special functions to the service 
com.sun.star.text.textfield.Macro .
the new service should delegate all default calls to original service.
i have tried to implement such component, but without success. Reading the
devgiude, forums and other ressources
didn't helped me.

currently i'm not sure that such an approach is possible.
i'm thankful for every hint, link or something else which could help me.

regards

--
Jan


Re: [api-dev] Extend an Existing OpenOffice-Service

2007-03-06 Thread Jan Füssel

I don't want a second service with an equal name. i need a component, that
has the same functionality like the other fields in OOo. In other words: i
want an own component, which i can insert in an textdoc via the
insertTextContent-method out of a basic macro. this component has a few
more application-specific methods like getId().

does anybody know a way to do this?

off-topic: is its good-stil of this mailing-list to mark the subject with
[api-dev]? cause i didn't found such an comment in the mailinglist-rules on
project-hp.

regards

jan