widget/windows/nsDeviceContextSpecWin.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/windows/nsDeviceContextSpecWin.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,82 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsDeviceContextSpecWin_h___
    1.10 +#define nsDeviceContextSpecWin_h___
    1.11 +
    1.12 +#include "nsCOMPtr.h"
    1.13 +#include "nsIDeviceContextSpec.h"
    1.14 +#include "nsIPrintOptions.h" // For nsIPrinterEnumerator
    1.15 +#include "nsIPrintSettings.h"
    1.16 +#include "nsISupportsPrimitives.h"
    1.17 +#include <windows.h>
    1.18 +#include "mozilla/Attributes.h"
    1.19 +
    1.20 +class nsIWidget;
    1.21 +
    1.22 +class nsDeviceContextSpecWin : public nsIDeviceContextSpec
    1.23 +{
    1.24 +public:
    1.25 +  nsDeviceContextSpecWin();
    1.26 +
    1.27 +  NS_DECL_ISUPPORTS
    1.28 +
    1.29 +  NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface);
    1.30 +  NS_IMETHOD BeginDocument(const nsAString& aTitle,
    1.31 +                           char16_t*       aPrintToFileName,
    1.32 +                           int32_t          aStartPage,
    1.33 +                           int32_t          aEndPage) { return NS_OK; }
    1.34 +  NS_IMETHOD EndDocument() { return NS_OK; }
    1.35 +  NS_IMETHOD BeginPage() { return NS_OK; }
    1.36 +  NS_IMETHOD EndPage() { return NS_OK; }
    1.37 +
    1.38 +  NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview);
    1.39 +
    1.40 +  void GetDriverName(wchar_t *&aDriverName) const   { aDriverName = mDriverName;     }
    1.41 +  void GetDeviceName(wchar_t *&aDeviceName) const   { aDeviceName = mDeviceName;     }
    1.42 +
    1.43 +  // The GetDevMode will return a pointer to a DevMode
    1.44 +  // whether it is from the Global memory handle or just the DevMode
    1.45 +  // To get the DevMode from the Global memory Handle it must lock it 
    1.46 +  // So this call must be paired with a call to UnlockGlobalHandle
    1.47 +  void GetDevMode(LPDEVMODEW &aDevMode);
    1.48 +
    1.49 +  // helper functions
    1.50 +  nsresult GetDataFromPrinter(char16ptr_t aName, nsIPrintSettings* aPS = nullptr);
    1.51 +
    1.52 +  static nsresult SetPrintSettingsFromDevMode(nsIPrintSettings* aPrintSettings, 
    1.53 +                                              LPDEVMODEW         aDevMode);
    1.54 +
    1.55 +protected:
    1.56 +
    1.57 +  void SetDeviceName(char16ptr_t aDeviceName);
    1.58 +  void SetDriverName(char16ptr_t aDriverName);
    1.59 +  void SetDevMode(LPDEVMODEW aDevMode);
    1.60 +
    1.61 +  void SetupPaperInfoFromSettings();
    1.62 +
    1.63 +  virtual ~nsDeviceContextSpecWin();
    1.64 +
    1.65 +  wchar_t*      mDriverName;
    1.66 +  wchar_t*      mDeviceName;
    1.67 +  LPDEVMODEW mDevMode;
    1.68 +
    1.69 +  nsCOMPtr<nsIPrintSettings> mPrintSettings;
    1.70 +};
    1.71 +
    1.72 +
    1.73 +//-------------------------------------------------------------------------
    1.74 +// Printer Enumerator
    1.75 +//-------------------------------------------------------------------------
    1.76 +class nsPrinterEnumeratorWin MOZ_FINAL : public nsIPrinterEnumerator
    1.77 +{
    1.78 +public:
    1.79 +  nsPrinterEnumeratorWin();
    1.80 +  ~nsPrinterEnumeratorWin();
    1.81 +  NS_DECL_ISUPPORTS
    1.82 +  NS_DECL_NSIPRINTERENUMERATOR
    1.83 +};
    1.84 +
    1.85 +#endif

mercurial