fune/toolkit/components/printingui/ipc/PrintDataUtils.cpp
Jonathan Watt 9ff8f044a3 Bug 1558071. Rename nsIWebBrowserPrint.printPreviewNavigate to printPreviewScrollToPage. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D34297

--HG--
extra : rebase_source : 58343bee2ce7e2761fcc93b8e842051a14cf3684
extra : amend_source : ff72ab52d1274f0bcfad59f30c43364af05a0310
2019-06-03 12:48:21 +01:00

101 lines
2.9 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et tw=80 : */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "PrintDataUtils.h"
#include "nsIPrintSettings.h"
#include "nsIServiceManager.h"
#include "nsIWebBrowserPrint.h"
#include "nsString.h"
namespace mozilla {
namespace embedding {
/**
* MockWebBrowserPrint is a mostly useless implementation of nsIWebBrowserPrint,
* but wraps a PrintData so that it's able to return information to print
* settings dialogs that need an nsIWebBrowserPrint to interrogate.
*/
NS_IMPL_ISUPPORTS(MockWebBrowserPrint, nsIWebBrowserPrint);
MockWebBrowserPrint::MockWebBrowserPrint(const PrintData& aData)
: mData(aData) {}
MockWebBrowserPrint::~MockWebBrowserPrint() {}
NS_IMETHODIMP
MockWebBrowserPrint::GetGlobalPrintSettings(
nsIPrintSettings** aGlobalPrintSettings) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MockWebBrowserPrint::GetCurrentPrintSettings(
nsIPrintSettings** aCurrentPrintSettings) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MockWebBrowserPrint::GetDocumentName(nsAString& aDocName) {
// The only consumer that cares about this is the OS X printing dialog.
aDocName = mData.printJobName();
return NS_OK;
}
NS_IMETHODIMP
MockWebBrowserPrint::GetDoingPrint(bool* aDoingPrint) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MockWebBrowserPrint::GetDoingPrintPreview(bool* aDoingPrintPreview) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MockWebBrowserPrint::GetIsIFrameSelected(bool* aIsIFrameSelected) {
*aIsIFrameSelected = mData.isIFrameSelected();
return NS_OK;
}
NS_IMETHODIMP
MockWebBrowserPrint::GetIsRangeSelection(bool* aIsRangeSelection) {
*aIsRangeSelection = mData.isRangeSelection();
return NS_OK;
}
NS_IMETHODIMP
MockWebBrowserPrint::GetPrintPreviewNumPages(int32_t* aPrintPreviewNumPages) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MockWebBrowserPrint::Print(nsIPrintSettings* aThePrintSettings,
nsIWebProgressListener* aWPListener) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MockWebBrowserPrint::PrintPreview(nsIPrintSettings* aThePrintSettings,
mozIDOMWindowProxy* aChildDOMWin,
nsIWebProgressListener* aWPListener) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MockWebBrowserPrint::PrintPreviewScrollToPage(int16_t aNavType,
int32_t aPageNum) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MockWebBrowserPrint::Cancel() { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP
MockWebBrowserPrint::ExitPrintPreview() { return NS_ERROR_NOT_IMPLEMENTED; }
} // namespace embedding
} // namespace mozilla