{
if (_aGTA.getPrinterName() != null)
{
ArrayList aPropertyList = new ArrayList();
// PropertyValue [] aPrintProps = new PropertyValue[1];
PropertyValue Arg = new PropertyValue();
Arg.Name = "Name";
Arg.Value = _aGTA.getPrinterName();
aPropertyList.add(Arg);
showProperty(Arg);
// GlobalLogWriter.get().println("Printername is not null, so set to " + _aGTA.getPrinterName());
aPrintable.setPrinter(PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList));
}
}
// set property values for XPrintable.print()
// more can be found at "http://api.openoffice.org/docs/common/ref/com/sun/star/view/PrintOptions.html"
// int nProperties = 1; // default for 'FileName' property
// if (_aGTA.printAllPages() == false)
// {
// // we don't want to print all pages, build Pages string by ourself
// nProperties ++;
// }
// int nPropsCount = 0;
// If we are a SpreadSheet (calc), we need to set PrintAllSheets property to 'true'
XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, _aDoc );
if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
{
XMultiServiceFactory xMSF = _aGTA.getMultiServiceFactory();
Object aSettings = xMSF.createInstance( "com.sun.star.sheet.GlobalSheetSettings" );
if (aSettings != null)
{
XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, aSettings );
xPropSet.setPropertyValue( "PrintAllSheets", new Boolean( true ) );
}
}
ArrayList aPrintProps = new ArrayList();
GlobalLogWriter.get().println("Property FileName:=" + _sPrintFileURL);
// PropertyValue [] aPrintProps = new PropertyValue[nProperties];
PropertyValue Arg = new PropertyValue();
Arg.Name = "FileName";
Arg.Value = _sPrintFileURL;
// aPrintProps[nPropsCount ++] = Arg;
aPrintProps.add(Arg);
// showProperty(Arg);
if (_aGTA.printAllPages() == false)
{
String sPages = "";
if (_aGTA.getMaxPages() > 0)
{
sPages = "1-" + String.valueOf(_aGTA.getMaxPages());
}
if (_aGTA.getOnlyPages().length() != 0)
{
if (sPages.length() != 0)
{
sPages += ";";
}
sPages += String.valueOf(_aGTA.getOnlyPages());
}
Arg = new PropertyValue();
Arg.Name = "Pages";
Arg.Value = sPages;
aPrintProps.add(Arg);
}
showProperty(Arg);