Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Protected Member Functions | Protected Attributes
CPrintAttachment Class Reference

#include <CPrintAttachment.h>

Collaboration diagram for CPrintAttachment:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { class_ID = FOUR_CHAR_CODE('BRPR') }

Public Member Functions

 CPrintAttachment (PaneIDT inBrowserPaneID, MessageT inMessage=msg_AnyMessage, Boolean inExecuteHost=true)
 CPrintAttachment (LStream *inStream)
virtual ~CPrintAttachment ()
virtual void SetOwnerHost (LAttachable *inOwnerHost)
virtual void ExecuteSelf (MessageT inMessage, void *ioParam)
virtual void DoPrint ()
virtual void DoPageSetup ()

Static Protected Member Functions

static LView * GetTopmostView (LPane *inStartPane)

Protected Attributes

CBrowserShellmBrowserShell
PaneIDT mBrowserShellPaneID

Detailed Description

Definition at line 46 of file CPrintAttachment.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
class_ID 

Definition at line 49 of file CPrintAttachment.h.

{ class_ID = FOUR_CHAR_CODE('BRPR') };

Constructor & Destructor Documentation

CPrintAttachment::CPrintAttachment ( PaneIDT  inBrowserPaneID,
MessageT  inMessage = msg_AnyMessage,
Boolean  inExecuteHost = true 
)

Definition at line 58 of file CPrintAttachment.cpp.

                                                          :
    LAttachment(inMessage,inExecuteHost),
    mBrowserShell(nil), mBrowserShellPaneID(inBrowserPaneID)
{
}
CPrintAttachment::CPrintAttachment ( LStream *  inStream)

Definition at line 67 of file CPrintAttachment.cpp.

                                                    :
    LAttachment(inStream),
    mBrowserShell(nil), mBrowserShellPaneID(PaneIDT_Unspecified)
{
       *inStream >> mBrowserShellPaneID;
}

Definition at line 75 of file CPrintAttachment.cpp.

{
}

Member Function Documentation

Definition at line 151 of file CPrintAttachment.cpp.

{
    nsCOMPtr<nsIWebBrowser> wb;
    mBrowserShell->GetWebBrowser(getter_AddRefs(wb));
    ThrowIfNil_(wb);
    nsCOMPtr<nsIDOMWindow> domWindow;
    wb->GetContentDOMWindow(getter_AddRefs(domWindow));
    ThrowIfNil_(domWindow);
    nsCOMPtr<nsIPrintSettings> settings;
    mBrowserShell->GetPrintSettings(getter_AddRefs(settings));
    ThrowIfNil_(settings);
    
    nsCOMPtr<nsIPrintingPromptService> printingPromptService =
             do_GetService("@mozilla.org/embedcomp/printingprompt-service;1");
    ThrowIfNil_(printingPromptService);

    nsresult rv = printingPromptService->ShowPageSetup(domWindow, settings, nsnull);
    if (rv != NS_ERROR_ABORT)
        ThrowIfError_(rv);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 134 of file CPrintAttachment.cpp.

{
    nsCOMPtr<nsIWebBrowser> wb;
    mBrowserShell->GetWebBrowser(getter_AddRefs(wb));
    ThrowIfNil_(wb);
    nsCOMPtr<nsIWebBrowserPrint> wbPrint(do_GetInterface(wb));
    ThrowIfNil_(wbPrint);
    nsCOMPtr<nsIPrintSettings> settings;
    mBrowserShell->GetPrintSettings(getter_AddRefs(settings));
    ThrowIfNil_(settings);
       
    nsresult rv = wbPrint->Print(settings, nsnull);
    if (rv != NS_ERROR_ABORT)
        ThrowIfError_(rv);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CPrintAttachment::ExecuteSelf ( MessageT  inMessage,
void ioParam 
) [virtual]

Definition at line 103 of file CPrintAttachment.cpp.

{
       mExecuteHost = true;

       if (inMessage == msg_CommandStatus) {
              SCommandStatus       *status = (SCommandStatus *)ioParam;
              if (status->command == cmd_Print) {
                     *status->enabled = true;
                     *status->usesMark = false;
                     mExecuteHost = false; // we handled it
              }
              else if (status->command == cmd_PageSetup) {
                     *status->enabled = true;
                     *status->usesMark = false;
                     mExecuteHost = false; // we handled it
              }
       }
       else if (inMessage == cmd_Print) {
           DoPrint();
           mExecuteHost = false; // we handled it
       }
       else if (inMessage == cmd_PageSetup) {
           DoPageSetup();
           mExecuteHost = false; // we handled it
       }
}

Here is the call graph for this function:

LView * CPrintAttachment::GetTopmostView ( LPane *  inStartPane) [static, protected]

Definition at line 173 of file CPrintAttachment.cpp.

{
                                                                      // Begin with the start Pane as a
                                                                      //   View. Will be nil if start Pane
                                                                      //   is nil or is not an LView.
       LView* theView = dynamic_cast<LView*>(inStartPane);
       
       if (inStartPane != nil) {
                                                                      // Look at SuperView of start Pane
              LView* superView = inStartPane->GetSuperView();
              
              while (superView != nil) {         // Move up view hierarchy until
                     theView = superView;        //   reaching a nil SuperView
                     superView = theView->GetSuperView();
              }
       }
       
       return theView;
}

Here is the caller graph for this function:

void CPrintAttachment::SetOwnerHost ( LAttachable *  inOwnerHost) [virtual]

Definition at line 83 of file CPrintAttachment.cpp.

{
    LAttachment::SetOwnerHost(inOwnerHost);
    
       if (mBrowserShell == nil) {
              if (mBrowserShellPaneID != PaneIDT_Unspecified) {
                     LView* container = GetTopmostView(dynamic_cast<LPane*>(mOwnerHost));
                     if (container != nil) {
                            LPane* targetPane = container->FindPaneByID(mBrowserShellPaneID);
                            if (targetPane != nil)
                                   mBrowserShell = dynamic_cast<CBrowserShell*>(targetPane);
                     }
              }
              else
                     mBrowserShell = dynamic_cast<CBrowserShell*>(mOwnerHost);

           Assert_(mBrowserShell != nil);        // Programmer error
       }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 72 of file CPrintAttachment.h.

Definition at line 73 of file CPrintAttachment.h.


The documentation for this class was generated from the following files: