org.eclipse.gmf.runtime.common.ui.printing
Class PrintHelper
java.lang.Object
org.eclipse.gmf.runtime.common.ui.printing.PrintHelper
-
All Implemented Interfaces:
-
IPrintHelper
-
public class PrintHelper
- extends java.lang.Object
- implements
IPrintHelper
The PrintHelper implements the IPrintHelper interface for the platform
specfic print code.
This is for Win32.
Constructor Summary
|
PrintHelper
()
Make an instance of PrintHelper |
Method Summary
|
static void
|
addDiagramString
(java.lang.String string)
Add a string to the diagrams list of the dialog box. |
static boolean
|
getCollate
()
Returns if collate was selected |
static boolean
|
getDiagramPrintRangeAll
()
Returns if diagram print range all was selected |
static boolean
|
getDiagramPrintRangeCurrent
()
Returns if diagram print range current was selected |
static boolean
|
getDiagramPrintRangeSelection
()
Returns if diagram print range selection was selected |
boolean
|
getDlgCollate
()
Returns if collate was selected |
boolean
|
getDlgDiagramPrintRangeAll
()
Returns if diagram print range all was selected |
boolean
|
getDlgDiagramPrintRangeCurrent
()
Returns if diagram print range current was selected |
boolean
|
getDlgDiagramPrintRangeSelection
()
Returns if diagram print range selection was selected |
int
|
getDlgNumberOfCopies
()
Returns the number of copies the user wants to print. |
int
|
getDlgPagesFrom
()
Returns the pages from int value, check if (getDlgPrintRangesPages())
first. |
int
|
getDlgPagesTo
()
Returns the pages from int value, check if (getDlgPrintRangesPages())
first. |
boolean
|
getDlgPrintRangeAll
()
Returns if print range all was selected |
boolean
|
getDlgPrintRangePages
()
Returns if print range pages was selected |
int
|
getDlgScaleFitToM
()
If not > 0 then user has clicked percent scaling |
int
|
getDlgScaleFitToN
()
If not > 0 then user has clicked percent scaling |
int
|
getDlgScalePercent
()
If not > 0 then user has clicked fit to m x n scaling |
static int
|
getNumberOfCopies
()
Returns the number of copies the user wants to print. |
static int
|
getPagesFrom
()
Returns the pages from int value, check if (getPrintRangesPages()) first. |
static int
|
getPagesTo
()
Returns the pages from int value, check if (getPrintRangesPages()) first. |
static boolean
|
getPrintRangeAll
()
Returns if print range all was selected |
static boolean
|
getPrintRangePages
()
Returns if print range pages was selected |
static int
|
getScaleFitToM
()
If not > 0 then user has clicked percent scaling |
static int
|
getScaleFitToN
()
If not > 0 then user has clicked percent scaling |
static int
|
getScalePercent
()
If not > 0 then user has clicked fit to m x n scaling |
static void
|
initScaleFitTo
(int m,
int n)
Init print dialog box's scale fit to. |
static void
|
initScalePercent
(int percent)
Init print dialog box's scale percent. |
static boolean
|
isDiagramSelected
(int index)
Returns true if the diagram at the index was selected |
boolean
|
isDlgDiagramSelected
(int index)
Returns true if the diagram at the index was selected |
static boolean
|
open
(
PrinterData pd)
Opens the dialog box. |
PrinterData
|
openPrintDlg
(java.util.List diagramList)
Open the print dialog box with the diagram list. |
static void
|
resetDialog
()
Resets the dialog. |
void
|
setDlgOrientation
(boolean bLandscape)
Allows to set the orientation (portrait/landscape) in the print dialog. |
void
|
setDlgPaperSize
(int index,
double width,
double height)
Allows to set the paper size in the print dialog. |
static void
|
setHwndOwner
(java.lang.String windowClass,
java.lang.String title)
Set the owner hwnd so that the displyed print dialog is modal. |
static void
|
setOrientation
(boolean isLandscape)
Allows to set the orientation (portrait/landscape) in the print dialog. |
static void
|
setPaperSize
(int index,
double width,
double height)
Allows to set the paper size in the print dialog. |
void
|
setScaleFactor
(int scaleFactor)
Initialize the scaling factor in the print dialog. |
void
|
setScaleToWidthHeight
(int width,
int height)
Initialize the scale width and height in the print dialog. |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
PrintHelper
public PrintHelper()
- Make an instance of PrintHelper
initScaleFitTo
public static void initScaleFitTo(int m,
int n)
- Init print dialog box's scale fit to.
-
-
-
Parameters:
-
m
- -
n
-
initScalePercent
public static void initScalePercent(int percent)
- Init print dialog box's scale percent.
-
-
-
Parameters:
-
percent
-
resetDialog
public static void resetDialog()
- Resets the dialog. Call this before addDiagramString if you've already
added strings.
-
-
addDiagramString
public static void addDiagramString(java.lang.String string)
- Add a string to the diagrams list of the dialog box.
-
-
-
Parameters:
-
string
-
setHwndOwner
public static void setHwndOwner(java.lang.String windowClass,
java.lang.String title)
- Set the owner hwnd so that the displyed print dialog is modal.
-
-
-
Parameters:
-
windowClass
- String with class -
title
- String with shell title
setOrientation
public static void setOrientation(boolean isLandscape)
- Allows to set the orientation (portrait/landscape) in the print dialog.
-
-
-
Parameters:
-
isLandscape
- true if orientation should be landscape, false otherwise.
setPaperSize
public static void setPaperSize(int index,
double width,
double height)
- Allows to set the paper size in the print dialog.
-
-
-
Parameters:
-
index
- index of type of paper size, -
width
- specifies the custom width of the paper. Leave as 0 if paper
size index is user-defined. -
height
- specifies the custom width of the paper. Leave as 0 if paper
size index is user-defined. -
See Also:
-
for the type of paper sizes available and their indices.
getScaleFitToM
public static int getScaleFitToM()
- If not > 0 then user has clicked percent scaling
-
-
-
Returns:
- scale to m int
getScaleFitToN
public static int getScaleFitToN()
- If not > 0 then user has clicked percent scaling
-
-
-
Returns:
- scale to n int
getScalePercent
public static int getScalePercent()
- If not > 0 then user has clicked fit to m x n scaling
-
-
-
Returns:
- scale percent int
isDiagramSelected
public static boolean isDiagramSelected(int index)
- Returns true if the diagram at the index was selected
-
-
-
Parameters:
-
index
- the index of the diagrams you passed in
-
Returns:
- true if selected, false if not selected
getDiagramPrintRangeAll
public static boolean getDiagramPrintRangeAll()
- Returns if diagram print range all was selected
-
-
-
Returns:
- true if selected, false if not selected
getDiagramPrintRangeCurrent
public static boolean getDiagramPrintRangeCurrent()
- Returns if diagram print range current was selected
-
-
-
Returns:
- true if selected, false if not selected
getDiagramPrintRangeSelection
public static boolean getDiagramPrintRangeSelection()
- Returns if diagram print range selection was selected
-
-
-
Returns:
- true if selected, false if not selected
getPrintRangeAll
public static boolean getPrintRangeAll()
- Returns if print range all was selected
-
-
-
Returns:
- true if selected, false if not selected
getPrintRangePages
public static boolean getPrintRangePages()
- Returns if print range pages was selected
-
-
-
Returns:
- true if selected, false if not selected
getCollate
public static boolean getCollate()
- Returns if collate was selected
-
-
-
Returns:
- true if selected, false if not selected
getPagesFrom
public static int getPagesFrom()
- Returns the pages from int value, check if (getPrintRangesPages()) first.
-
-
-
Returns:
- int of the pages from box
getPagesTo
public static int getPagesTo()
- Returns the pages from int value, check if (getPrintRangesPages()) first.
-
-
-
Returns:
- int of the pages to box
getNumberOfCopies
public static int getNumberOfCopies()
- Returns the number of copies the user wants to print. This is nCopies
from PRINTDLG
-
-
-
Returns:
- int with the number of copies
open
public static boolean open(
PrinterData pd)
- Opens the dialog box.
-
-
-
Parameters:
-
pd
-
-
Returns:
-
true
if dialog box opened succesfully,
false
otherwise
openPrintDlg
public
PrinterData openPrintDlg(java.util.List diagramList)
- Open the print dialog box with the diagram list.
XXX: internal access SWT_Window0 is a hardcoded internal access string
-
-
Specified by:
-
openPrintDlg
in interface
IPrintHelper
-
-
Parameters:
-
diagramList
-
-
Returns:
-
PrinterData
getDlgScaleFitToM
public int getDlgScaleFitToM()
- If not > 0 then user has clicked percent scaling
-
-
Specified by:
-
getDlgScaleFitToM
in interface
IPrintHelper
-
-
Returns:
- scale to m int
getDlgScaleFitToN
public int getDlgScaleFitToN()
- If not > 0 then user has clicked percent scaling
-
-
Specified by:
-
getDlgScaleFitToN
in interface
IPrintHelper
-
-
Returns:
- scale to n int
getDlgScalePercent
public int getDlgScalePercent()
- If not > 0 then user has clicked fit to m x n scaling
-
-
Specified by:
-
getDlgScalePercent
in interface
IPrintHelper
-
-
Returns:
- scale percent int
isDlgDiagramSelected
public boolean isDlgDiagramSelected(int index)
- Returns true if the diagram at the index was selected
-
-
Specified by:
-
isDlgDiagramSelected
in interface
IPrintHelper
-
-
Parameters:
-
index
- the index of the diagrams you passed in
-
Returns:
- true if selected, false if not selected
getDlgDiagramPrintRangeAll
public boolean getDlgDiagramPrintRangeAll()
- Returns if diagram print range all was selected
-
-
Specified by:
-
getDlgDiagramPrintRangeAll
in interface
IPrintHelper
-
-
Returns:
- true if selected, false if not selected
getDlgDiagramPrintRangeCurrent
public boolean getDlgDiagramPrintRangeCurrent()
- Returns if diagram print range current was selected
-
-
Specified by:
-
getDlgDiagramPrintRangeCurrent
in interface
IPrintHelper
-
-
Returns:
- true if selected, false if not selected
getDlgDiagramPrintRangeSelection
public boolean getDlgDiagramPrintRangeSelection()
- Returns if diagram print range selection was selected
-
-
Specified by:
-
getDlgDiagramPrintRangeSelection
in interface
IPrintHelper
-
-
Returns:
- true if selected, false if not selected
getDlgPrintRangeAll
public boolean getDlgPrintRangeAll()
- Returns if print range all was selected
-
-
Specified by:
-
getDlgPrintRangeAll
in interface
IPrintHelper
-
-
Returns:
- true if selected, false if not selected
getDlgPrintRangePages
public boolean getDlgPrintRangePages()
- Returns if print range pages was selected
-
-
Specified by:
-
getDlgPrintRangePages
in interface
IPrintHelper
-
-
Returns:
- true if selected, false if not selected
getDlgCollate
public boolean getDlgCollate()
- Returns if collate was selected
-
-
Specified by:
-
getDlgCollate
in interface
IPrintHelper
-
-
Returns:
- true if selected, false if not selected
getDlgPagesFrom
public int getDlgPagesFrom()
- Returns the pages from int value, check if (getDlgPrintRangesPages())
first.
-
-
Specified by:
-
getDlgPagesFrom
in interface
IPrintHelper
-
-
Returns:
- int of the pages from box
getDlgPagesTo
public int getDlgPagesTo()
- Returns the pages from int value, check if (getDlgPrintRangesPages())
first.
-
-
Specified by:
-
getDlgPagesTo
in interface
IPrintHelper
-
-
Returns:
- int of the pages to box
getDlgNumberOfCopies
public int getDlgNumberOfCopies()
- Returns the number of copies the user wants to print. This is nCopies
from PRINTDLG
-
-
Specified by:
-
getDlgNumberOfCopies
in interface
IPrintHelper
-
-
Returns:
- int with the number of copies
setDlgOrientation
public void setDlgOrientation(boolean bLandscape)
- Allows to set the orientation (portrait/landscape) in the print dialog.
-
-
Specified by:
-
setDlgOrientation
in interface
IPrintHelper
-
-
Parameters:
-
isLandscape
- true if orientation should be landscape, false otherwise.
setDlgPaperSize
public void setDlgPaperSize(int index,
double width,
double height)
- Allows to set the paper size in the print dialog.
-
-
Specified by:
-
setDlgPaperSize
in interface
IPrintHelper
-
-
Parameters:
-
index
- index of type of paper size, -
width
- specifies the custom width of the paper. Leave as 0 if paper
size index is user-defined. -
height
- specifies the custom width of the paper. Leave as 0 if paper
size index is user-defined. -
See Also:
-
for the type of paper sizes available and their indices.
setScaleFactor
public void setScaleFactor(int scaleFactor)
- Initialize the scaling factor in the print dialog.
-
-
Specified by:
-
setScaleFactor
in interface
IPrintHelper
-
-
Parameters:
-
scaleFactor
- a zoom factor integer value greater than 0.
setScaleToWidthHeight
public void setScaleToWidthHeight(int width,
int height)
- Initialize the scale width and height in the print dialog.
-
-
Specified by:
-
setScaleToWidthHeight
in interface
IPrintHelper
-
-
Parameters:
-
width
- scale to number of pages wide -
height
- scale to number of pages high
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.