failed(e.getMessage());
return;
}
//get the property-set
final XPropertySet PropSet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, StdStyle);
XHeaderFooterContent RPHFC = null;
// get the header
log.println( "Creating a test environment" );
try {
Object o = PropSet.getPropertyValue("RightPageHeaderContent");
RPHFC = (XHeaderFooterContent)AnyConverter.toObject(
new com.sun.star.uno.Type(XHeaderFooterContent.class), o);
} catch(com.sun.star.lang.IllegalArgumentException e) {
failed(e.getMessage());
} catch(com.sun.star.lang.WrappedTargetException e){
failed(e.getMessage());
return;
} catch(com.sun.star.beans.UnknownPropertyException e){
failed(e.getMessage());
return;
}
// insert text into header
XText center = RPHFC.getCenterText();
center.setString("First line \n\r Second line \n\r third line ");
try {
PropSet.setPropertyValue("RightPageHeaderContent",RPHFC);
} catch (com.sun.star.beans.UnknownPropertyException e) {
} catch (com.sun.star.beans.PropertyVetoException e) {
} catch (com.sun.star.lang.IllegalArgumentException e) {
} catch (com.sun.star.lang.WrappedTargetException e) {}
// get footer
RPHFC = null;
try {
Object o = PropSet.getPropertyValue("RightPageFooterContent");
RPHFC = (XHeaderFooterContent)AnyConverter.toObject(
new com.sun.star.uno.Type(XHeaderFooterContent.class), o);
} catch(com.sun.star.lang.IllegalArgumentException e) {
failed(e.getMessage());
} catch(com.sun.star.lang.WrappedTargetException e){
failed(e.getMessage());
return;
} catch(com.sun.star.beans.UnknownPropertyException e){
failed(e.getMessage());
return;
}
// insert text into footer
center = RPHFC.getCenterText();
center.setString("Third last line\n\r Second last line\n\r last line");
try {
PropSet.setPropertyValue("RightPageFooterContent",RPHFC);
} catch (com.sun.star.beans.UnknownPropertyException e) {
} catch (com.sun.star.beans.PropertyVetoException e) {
} catch (com.sun.star.lang.IllegalArgumentException e) {
} catch (com.sun.star.lang.WrappedTargetException e) {}