nsDeviceContextSpecProxy.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef nsDeviceContextSpecProxy_h
  6. #define nsDeviceContextSpecProxy_h
  7. #include "nsIDeviceContextSpec.h"
  8. #include "nsCOMPtr.h"
  9. #include "nsString.h"
  10. class nsIFile;
  11. class nsIPrintSession;
  12. class nsIUUIDGenerator;
  13. namespace mozilla {
  14. namespace gfx {
  15. class DrawEventRecorderFile;
  16. }
  17. namespace layout {
  18. class RemotePrintJobChild;
  19. }
  20. }
  21. class nsDeviceContextSpecProxy final : public nsIDeviceContextSpec
  22. {
  23. public:
  24. NS_DECL_ISUPPORTS
  25. NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPrintSettings,
  26. bool aIsPrintPreview) final;
  27. virtual already_AddRefed<PrintTarget> MakePrintTarget() final;
  28. NS_IMETHOD GetDrawEventRecorder(mozilla::gfx::DrawEventRecorder** aDrawEventRecorder) final;
  29. float GetDPI() final;
  30. float GetPrintingScale() final;
  31. NS_IMETHOD BeginDocument(const nsAString& aTitle,
  32. const nsAString& aPrintToFileName,
  33. int32_t aStartPage, int32_t aEndPage) final;
  34. NS_IMETHOD EndDocument() final;
  35. NS_IMETHOD AbortDocument() final;
  36. NS_IMETHOD BeginPage() final;
  37. NS_IMETHOD EndPage() final;
  38. private:
  39. ~nsDeviceContextSpecProxy() {}
  40. nsresult CreateUniqueTempPath(nsACString& aFilePath);
  41. nsCOMPtr<nsIPrintSettings> mPrintSettings;
  42. nsCOMPtr<nsIPrintSession> mPrintSession;
  43. nsCOMPtr<nsIDeviceContextSpec> mRealDeviceContextSpec;
  44. RefPtr<mozilla::layout::RemotePrintJobChild> mRemotePrintJob;
  45. RefPtr<mozilla::gfx::DrawEventRecorderFile> mRecorder;
  46. nsCOMPtr<nsIFile> mRecordingDir;
  47. nsCOMPtr<nsIUUIDGenerator> mUuidGenerator;
  48. nsCString mRecordingFileName;
  49. };
  50. #endif // nsDeviceContextSpecProxy_h