Re: [api-dev] printing current sheet

2006-11-15 Thread Mathias Röllig
Hello Marc!

Am 14.11.2006 00:09 schrieb Marc Santhoff:
 So the question is: how can i figure out, which print page number has
 the actual sheet? Or, how can i figure out, on which print page(s) will
 a special print area reside?

 As a workaround you can:
 - use the PrintAreas of the calc doc:
   - store old print areas - Sheet.getPrintAreas()

... at every sheet
   - clear all print areas at all sheets

   - set a new one for the used range of the sheet you want to print,
 maybe adapt scaling to 100%
   - print
   - restore old print areas

Now i preferred this solution. If i have the time i will create a code
snippet.


Thanks
Mathias
-- 
·-· cut here ·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-8·-·

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



Re: [api-dev] printing current sheet

2006-11-14 Thread Oliver Brinzing
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Marc,

 You can't, OO.o does not allow to do so. This should be worth an RFE (if
 not already written).

would be nice if someone will vote for my rfe ... :-)

http://qa.openoffice.org/issues/show_bug.cgi?id=10658


Oliver


- --

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFFWf5qTiyrQM/QSkURApXRAJiIbmZTQKcW93ZYnIlLgON25qLUAJ4yGzJl
+k0v9bNSJy0RN6c8XRBNXw==
=0862
-END PGP SIGNATURE-

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



Re: [api-dev] printing current sheet

2006-11-14 Thread Marc Santhoff
Am Dienstag, den 14.11.2006, 18:35 +0100 schrieb Oliver Brinzing:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi Marc,
 
  You can't, OO.o does not allow to do so. This should be worth an RFE (if
  not already written).
 
 would be nice if someone will vote for my rfe ... :-)
 
 http://qa.openoffice.org/issues/show_bug.cgi?id=10658

Done, thanks for pointing out.

There could be some more votes though ...

Marc


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



Re: [api-dev] printing current sheet

2006-11-13 Thread Tobias Krais
Hi Mathias,

 In a calc document i want to place a button with that the user can print
 the actual sheet or rather the defined (and named) print area at the
 sheet. But i can't find the right print options to do that.

please see the code attached. It is free, again.

Greetings, Tobias


package de.twc.oocom.oo;

import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameAccess;
import com.sun.star.container.XNameContainer;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.XComponent;
import com.sun.star.sheet.XSpreadsheetDocument;
import com.sun.star.sheet.XSpreadsheets;
import com.sun.star.style.XStyle;
import com.sun.star.style.XStyleFamiliesSupplier;
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.view.PrintableState;
import com.sun.star.view.XPrintJobBroadcaster;
import com.sun.star.view.XPrintable;

import de.twc.oocom.oo.calc.OOCalcDoc;
import de.twc.oocom.oo.text.OOTextDoc;
import de.twc.oocom.server.PrintJobListener;

/**
 * @author tobias
 *
 */
public class OOPrint {

/**
 * OpenOffice.org representative of the opened file.
 */
private XComponent xComponent = null; 

	/**
 * Turns on the debug mode: 0 = absolute quiet, 1 = normal, 2 = verbose.
 */
private static int debug = 0;

public OOPrint (XComponent myXComponent) {
	this.xComponent = myXComponent;
}

/**
 * This method sets the printer tray of the loaded Document.
 * 
 * @param myTray The paper tray the printer should use
 * [EMAIL PROTECTED] de.twc.oocom.OOCom#tray1}

 */
public void setPrinterTray(String printerTray)
{
	if (debug  0)
	System.out.print(Setting printer tray  + printerTray +  ... );
try {
	// Get application name of the loaded document
String applicationName = 
		OODocument.getApplicationName(this.xComponent);

// If loaded document is a Text Document
if (applicationName.equals(com.sun.star.text.TextDocument)) {
// Get the text document
	XTextDocument xTextDocument = (XTextDocument)
		UnoRuntime.queryInterface(XTextDocument.class,
		this.xComponent);
		if(xTextDocument == null) {
if (debug  0)
System.out.println(failed.);
			return;
		}
	
	// Get the StyleFamiliesSupplier interface of the document
	XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier)
	UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
	xTextDocument);
	setPrinterTrayHelper(xSupplier,
			OOTextDoc.getXTextDocumentPageStyleName(xTextDocument),
	printerTray);
}
// If loaded Document is Spread Sheet
else if (applicationName.equals(com.sun.star.sheet.SpreadsheetDocument)) {
// Get SpreadSheet Document
XSpreadsheetDocument xSpreadsheetDocument = (XSpreadsheetDocument)
		UnoRuntime.queryInterface(XSpreadsheetDocument.class,
this.xComponent);
if(xSpreadsheetDocument == null) {
	if (debug  0)
	System.out.println(failed.);
	return;
}

// Get the StyleFamiliesSupplier interface of the document
XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier)
UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
xSpreadsheetDocument);

// Get Spreadsheets
XSpreadsheets xSpreadsheets = xSpreadsheetDocument.getSheets();
String[] sheets = xSpreadsheets.getElementNames();

for (int i = 0; i  sheets.length; i++) {
setPrinterTrayHelper(xSupplier,
		OOCalcDoc.getXSpreadsheetPageStyleName(
xSpreadsheets, sheets[i]),
	printerTray);
}
}
else if (applicationName.equals(com.sun.star.text.WebDocument)) {
	
}
else if (applicationName.equals(com.sun.star.text.GlobalDocument)) {
	
}
else if (applicationName.equals(com.sun.star.presentation.PresentationDocument)) {
	
}
else if (applicationName.equals(com.sun.star.drawing.DrawingDocument)) {
	
}
else if (applicationName.equals(com.sun.star.chart.ChartDocument)) {
	
}
else if (applicationName.equals(com.sun.star.formula.FormulaProperties)) {
	
}
else if 

Re: [api-dev] printing current sheet

2006-11-13 Thread Mathias Röllig
Hello Tobias!

Thank you for your answer.

Am 13.11.2006 13:14 schrieb Tobias Krais:
 In a calc document i want to place a button with that the user can print
 the actual sheet or rather the defined (and named) print area at the
 sheet. But i can't find the right print options to do that.

 please see the code attached. It is free, again.

This is a good example, but not this that i need.
(I use Basic, but this isn't a problem.)

My workaround is equivalent to this code, where myPages is set by the
button tag. (Ich habe einen Knopf auf der Tabelle, der das Makro auslöst
und in der Zusatzinformation die zu druckende Seite(nnummer) übergibt.)

   // Setting the property Pages so that only the desired pages
   // will be printed.
   PropertyValue[] printOpts = new PropertyValue[1];
   printOpts[0] = new PropertyValue();
   printOpts[0].Name = Pages;
   printOpts[0].Value = myPages;

The problem is, that in the document the tables must not be moved or
deleted, because the print page number will not be right further more.

So the question is: how can i figure out, which print page number has
the actual sheet? Or, how can i figure out, on which print page(s) will
a special print area reside?


greetings
Mathias
-- 
·-· cut here ·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-8·-·

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



Re: [api-dev] printing current sheet

2006-11-13 Thread Marc Santhoff
Am Montag, den 13.11.2006, 17:48 +0100 schrieb Mathias Röllig:

 So the question is: how can i figure out, which print page number has
 the actual sheet? Or, how can i figure out, on which print page(s) will
 a special print area reside?

You can't, OO.o does not allow to do so. This should be worth an RFE (if
not already written).

As a workaround you can:

- try to use the print preview (not tested, would be an interesting
solution)

- use the PrintAreas of the calc doc:
  - store old print areas - Sheet.getPrintAreas()
  - set a new one for the used range of the sheet you want to print,
maybe adapt scaling to 100%
  - print
  - restore old print areas

Have fun,
Marc


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



Re: [api-dev] printing current sheet

2006-11-13 Thread Mathias Röllig
Hello Marc!

Am 14.11.2006 00:09 schrieb Marc Santhoff:
 So the question is: how can i figure out, which print page number has
 the actual sheet? Or, how can i figure out, on which print page(s) will
 a special print area reside?

 You can't, OO.o does not allow to do so. This should be worth an RFE (if
 not already written).

That I already imagined. :-(


 - try to use the print preview (not tested, would be an interesting
 solution)

 - use the PrintAreas of the calc doc:
   - store old print areas - Sheet.getPrintAreas()
   - set a new one for the used range of the sheet you want to print,
 maybe adapt scaling to 100%
   - print
   - restore old print areas

I also imagined that it could be a solution if i define no print areas
and only set one with the print job.

Thank you.

Greetings, Mathias
-- 
·-· cut here ·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-8·-·

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