To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=68121
Issue #|68121
Summary|XPrintable and more than one stylised page hangs
Component|Word processor
Version|OOo 2.0.3
Platform|PC
URL|
OS/Version|All
Status|UNCONFIRMED
Status whiteboard|
Keywords|
Resolution|
Issue type|DEFECT
Priority|P2
Subcomponent|printing
Assigned to|mru
Reported by|rkentgibson
------- Additional comments from [EMAIL PROTECTED] Thu Aug 3 09:45:51 -0700
2006 -------
If you use XPrintable and you have more than one page which has a style, then it
either hangs, or you get connection reset.
This test case below illustrates the problem. You can comment out the line
xPrintable.setPrinter( prtDesc ) and this test case run ok on windows.
To reproduce this you need a XMultiServiceFactory and a XTextDocument. This is
in java and was found in developer build src680_m178. I am assigning it p2
because, it effectively means that landscape format for us is broken, and it
also sometimes hangs.
################################################
public void testHarness() throws Exception, CoreException
{
XMultiServiceFactory docFactory = this.connection.getDocumentFactory();
XTextDocument xTextDocument = this.connection.getTextDocument();
XText xText = xTextDocument.getText();
Object styleObj1 = docFactory.createInstance(
"com.sun.star.style.PageStyle" );
XStyle style1 = ( XStyle ) AnyConverter.toObject( XStyle.class, styleObj1 );
XPropertySet xPropertySetStyle1 = ( XPropertySet )
UnoRuntime.queryInterface( XPropertySet.class, style1 );
xPropertySetStyle1.setPropertyValue( "HeaderIsOn", Boolean.TRUE );
// get the StyleFamiliesSupplier interface
XStyleFamiliesSupplier supStyleFamilies = ( XStyleFamiliesSupplier )
UnoRuntime.queryInterface(
XStyleFamiliesSupplier.class,
xTextDocument );
// get the XNameAccess interface of the actual style families
XNameAccess nStyleFamilies = ( XNameAccess ) UnoRuntime.queryInterface(
XNameAccess.class,
supStyleFamilies.getStyleFamilies() );
// access the 'PageStyles' Family
XNameContainer xFamily = ( XNameContainer ) UnoRuntime.queryInterface(
XNameContainer.class,
nStyleFamilies.getByName( "PageStyles" ) );
String style1Name = "Style1";
if ( xFamily.hasByName( style1Name ) )
{
xFamily.replaceByName( style1Name, style1 );
}
else
{
// insert our style these need to be inserted in this order here and in
apply settings
xFamily.insertByName( style1Name, style1 );
}
xPropertySetStyle1.setPropertyValue( "HeaderIsDynamicHeight", Boolean.FALSE
);
xPropertySetStyle1.setPropertyValue( "HeaderHeight", new Short( ( short )
2000 ) );
XPrintable xPrintable = ( XPrintable ) UnoRuntime.queryInterface(
XPrintable.class, xTextDocument );
if ( true )
{
// get the printing properties of the document
PropertyValue[] prtDesc = xPrintable.getPrinter();
for ( int j = 0; j < prtDesc.length; j++ )
{
// go through them and set the paper orientation
if ( prtDesc[ j ].Name.equals( "PaperOrientation" ) ) //$NON-NLS-1$
{
prtDesc[ j ].Value = PaperOrientation.PORTRAIT;
}
}
// this line causes the hang
xPrintable.setPrinter( prtDesc );
}
XTextCursor xTextCursor = xText.createTextCursor();
XPropertySet cursorProperties = ( XPropertySet ) UnoRuntime.queryInterface(
XPropertySet.class, xTextCursor );
cursorProperties.setPropertyValue( OpenOfficeRenderingUtils.PAGE_DESC_NAME,
style1Name );
XTextTable xTable1 = ( XTextTable ) UnoRuntime.queryInterface(
XTextTable.class,
docFactory.createInstance( "com.sun.star.text.TextTable" ) );
xTable1.initialize( 1, 1 );
xText.insertTextContent( xTextCursor, xTable1, false );
XTextTable xTable2 = ( XTextTable ) UnoRuntime.queryInterface(
XTextTable.class,
docFactory.createInstance( "com.sun.star.text.TextTable" ) );
xTable2.initialize( 1, 1 );
xText.insertTextContent( xTextCursor, xTable2, false );
Object styleObj2 = docFactory.createInstance(
"com.sun.star.style.PageStyle" );
XStyle style2 = ( XStyle ) AnyConverter.toObject( XStyle.class, styleObj2 );
XPropertySet xPropertySetStyle2 = ( XPropertySet )
UnoRuntime.queryInterface( XPropertySet.class, style2 );
xPropertySetStyle2.setPropertyValue( "HeaderIsOn", Boolean.TRUE );
String style2Name = "Style2";
if ( xFamily.hasByName( style2Name ) )
{
xFamily.replaceByName( style2Name, style2 );
}
else
{
// insert our style these need to be inserted in this order here and in
apply settings
xFamily.insertByName( style2Name, style2 );
}
xPropertySetStyle2.setPropertyValue( "HeaderIsDynamicHeight", Boolean.FALSE
);
xPropertySetStyle2.setPropertyValue( "HeaderHeight", new Short( ( short )
2000 ) );
if ( true )
{
// get the printing properties of the document
PropertyValue[] prtDesc = xPrintable.getPrinter();
for ( int j = 0; j < prtDesc.length; j++ )
{
// go through them and set the paper orientation
if ( prtDesc[ j ].Name.equals( "PaperOrientation" ) ) //$NON-NLS-1$
{
prtDesc[ j ].Value = PaperOrientation.PORTRAIT;
}
}
// this line causes the hang
xPrintable.setPrinter( prtDesc );
}
cursorProperties.setPropertyValue( "PageDescName", style2Name );
XTextTable xTable3 = ( XTextTable ) UnoRuntime.queryInterface(
XTextTable.class,
docFactory.createInstance( "com.sun.star.text.TextTable" ) );
xTable3.initialize( 1, 1 );
xText.insertTextContent( xTextCursor, xTable3, false );
}
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]