On Thu, 11 Nov 2004 17:13:03 +0100, Axel Hecht <[EMAIL PROTECTED]> wrote:

>Oh, page breaks and print preview, that can produce anything.
>
>Bernd may know more.

Well, lets hope then that he jumps in here. The code I use for print
preview is like this:

The XUL app's window contains just a toolbar with browser element

<script type="application/x-javascript" 
src="chrome://global/content/printUtils.js" />

<broadcasterset id="brdMainSet">
  <broadcaster id="brdRepPrintPV" disabled="true" checked="false"
image="print_preview24d.png"/>
...
</broadcasterset>

<commandset id="cmdMainSet" commandupdater="false">
  <command id="cmdRepPrintPV" observes="brdRepPrintPV"
oncommand="TogglePrintPreview();"/>
...
</commandset>

<toolbox id="tap-main-toolbox">
  <toolbar id="tb-main-toolbar" grippyhidden="false" mode="icons" >
    <toolbarbutton command="cmdRepPrintOpt"/>
    <toolbarbutton command="cmdRepPrintPV"/>
    <toolbarbutton command="cmdRepPrint"/>
  </toolbar>
</toolbox>

  <box flex="1" style:="width:100%;height:100%">
    <browser id="RepContent" src="empty.html" type="content-primary"
flex="1" />
  </box>

and to toggle between print preview and browser mode

function TogglePrintPreview(){
  var cmd = document.getElementById('brdRepPrintPV');
  if(cmd){
     var cs = cmd.getAttribute('checked');
     if(String(cs)=='true'){
        cmd.setAttribute('checked', 'false');
        // exit print preview galley mode in content area
        var ifreq =
_content.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
        var webBrowserPrint =
ifreq.getInterface(Components.interfaces.nsIWebBrowserPrint);
        webBrowserPrint.exitPrintPreview();
        _content.focus();
     }else{
        cmd.setAttribute('checked', 'true');
        PrintUtils.printPreview(DoNothing, DoNothing);
     }
  }
} 

function DoNothing(){} 


><bernd> Pike: philabug

Hmmm? I'm not native english speaker and can't parse this...


ain
_______________________________________________
mozilla-layout mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-layout

Reply via email to