Kaydet (Commit) 60ae5f53 authored tarafından Caolán McNamara's avatar Caolán McNamara

make it possible to set parent window for printer error messages

Change-Id: I0effa3645454ef9d03393ae8b256cd624ca04f03
Reviewed-on: https://gerrit.libreoffice.org/50008Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 26b51c95
...@@ -30,7 +30,7 @@ namespace vcl ...@@ -30,7 +30,7 @@ namespace vcl
{ {
std::unique_ptr<ImplOldStyleAdaptorData> mpData; std::unique_ptr<ImplOldStyleAdaptorData> mpData;
public: public:
OldStylePrintAdaptor( const VclPtr< Printer >& ); OldStylePrintAdaptor(const VclPtr<Printer>&, const VclPtr<vcl::Window>&);
virtual ~OldStylePrintAdaptor() override; virtual ~OldStylePrintAdaptor() override;
void StartPage(); void StartPage();
......
...@@ -398,7 +398,7 @@ class VCL_DLLPUBLIC PrinterController ...@@ -398,7 +398,7 @@ class VCL_DLLPUBLIC PrinterController
std::unique_ptr<ImplPrinterControllerData> std::unique_ptr<ImplPrinterControllerData>
mpImplData; mpImplData;
protected: protected:
PrinterController( const VclPtr<Printer>& ); PrinterController( const VclPtr<Printer>&, const VclPtr<vcl::Window>& );
public: public:
struct MultiPageSetup struct MultiPageSetup
{ {
...@@ -440,6 +440,7 @@ public: ...@@ -440,6 +440,7 @@ public:
virtual ~PrinterController(); virtual ~PrinterController();
const VclPtr<Printer>& getPrinter() const; const VclPtr<Printer>& getPrinter() const;
const VclPtr<vcl::Window>& getWindow() const;
/** For implementations: get current job properties as changed by e.g. print dialog /** For implementations: get current job properties as changed by e.g. print dialog
......
...@@ -101,7 +101,7 @@ SfxPrinterController::SfxPrinterController( const VclPtr<Printer>& i_rPrinter, ...@@ -101,7 +101,7 @@ SfxPrinterController::SfxPrinterController( const VclPtr<Printer>& i_rPrinter,
SfxViewShell* pView, SfxViewShell* pView,
const uno::Sequence< beans::PropertyValue >& rProps const uno::Sequence< beans::PropertyValue >& rProps
) )
: PrinterController( i_rPrinter) : PrinterController(i_rPrinter, pView ? pView->GetWindow() : nullptr)
, maCompleteSelection( i_rComplete ) , maCompleteSelection( i_rComplete )
, maSelection( i_rSelection ) , maSelection( i_rSelection )
, mxRenderable( i_xRender ) , mxRenderable( i_xRender )
......
...@@ -82,7 +82,6 @@ class SwAccessibleMap; ...@@ -82,7 +82,6 @@ class SwAccessibleMap;
namespace vcl namespace vcl
{ {
typedef OutputDevice RenderContext; typedef OutputDevice RenderContext;
class OldStylePrintAdaptor;
} }
// Define for flags needed in ctor or layers below. // Define for flags needed in ctor or layers below.
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <vcl/print.hxx> #include <vcl/print.hxx>
#include <vcl/jobset.hxx> #include <vcl/jobset.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
...@@ -283,7 +284,7 @@ sal_Bool VCLXPrinter::start( const OUString& /*rJobName*/, sal_Int16 /*nCopies*/ ...@@ -283,7 +284,7 @@ sal_Bool VCLXPrinter::start( const OUString& /*rJobName*/, sal_Int16 /*nCopies*/
if (mxPrinter.get()) if (mxPrinter.get())
{ {
maInitJobSetup = mxPrinter->GetJobSetup(); maInitJobSetup = mxPrinter->GetJobSetup();
mxListener.reset(new vcl::OldStylePrintAdaptor(mxPrinter)); mxListener.reset(new vcl::OldStylePrintAdaptor(mxPrinter, nullptr));
} }
return true; return true;
......
...@@ -44,9 +44,9 @@ namespace vcl ...@@ -44,9 +44,9 @@ namespace vcl
}; };
} }
OldStylePrintAdaptor::OldStylePrintAdaptor( const VclPtr< Printer >& i_xPrinter ) OldStylePrintAdaptor::OldStylePrintAdaptor(const VclPtr<Printer>& i_xPrinter, const VclPtr<vcl::Window>& i_xWindow)
: PrinterController( i_xPrinter ) : PrinterController(i_xPrinter, i_xWindow)
, mpData( new ImplOldStyleAdaptorData ) , mpData(new ImplOldStyleAdaptorData)
{ {
} }
......
...@@ -140,6 +140,7 @@ public: ...@@ -140,6 +140,7 @@ public:
typedef std::unordered_map< OUString, css::uno::Sequence< sal_Bool > > ChoiceDisableMap; typedef std::unordered_map< OUString, css::uno::Sequence< sal_Bool > > ChoiceDisableMap;
VclPtr< Printer > mxPrinter; VclPtr< Printer > mxPrinter;
VclPtr<vcl::Window> mxWindow;
css::uno::Sequence< css::beans::PropertyValue > maUIOptions; css::uno::Sequence< css::beans::PropertyValue > maUIOptions;
std::vector< css::beans::PropertyValue > maUIProperties; std::vector< css::beans::PropertyValue > maUIProperties;
std::vector< bool > maUIPropertyEnabled; std::vector< bool > maUIPropertyEnabled;
...@@ -207,10 +208,11 @@ public: ...@@ -207,10 +208,11 @@ public:
void resetPaperToLastConfigured(); void resetPaperToLastConfigured();
}; };
PrinterController::PrinterController( const VclPtr<Printer>& i_xPrinter ) PrinterController::PrinterController(const VclPtr<Printer>& i_xPrinter, const VclPtr<vcl::Window>& i_xWindow)
: mpImplData( new ImplPrinterControllerData ) : mpImplData( new ImplPrinterControllerData )
{ {
mpImplData->mxPrinter = i_xPrinter; mpImplData->mxPrinter = i_xPrinter;
mpImplData->mxWindow = i_xWindow;
} }
static OUString queryFile( Printer const * pPrinter ) static OUString queryFile( Printer const * pPrinter )
...@@ -304,7 +306,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, ...@@ -304,7 +306,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
if (xController->isShowDialogs()) if (xController->isShowDialogs())
{ {
ScopedVclPtrInstance<MessageDialog> aBox( ScopedVclPtrInstance<MessageDialog> aBox(
nullptr, "ErrorNoPrinterDialog", xController->getWindow(), "ErrorNoPrinterDialog",
"vcl/ui/errornoprinterdialog.ui"); "vcl/ui/errornoprinterdialog.ui");
aBox->Execute(); aBox->Execute();
} }
...@@ -455,7 +457,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, ...@@ -455,7 +457,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
if( xController->getFilteredPageCount() == 0 ) if( xController->getFilteredPageCount() == 0 )
{ {
ScopedVclPtrInstance<MessageDialog> aBox( ScopedVclPtrInstance<MessageDialog> aBox(
nullptr, "ErrorNoContentDialog", xController->getWindow(), "ErrorNoContentDialog",
"vcl/ui/errornocontentdialog.ui"); "vcl/ui/errornocontentdialog.ui");
aBox->Execute(); aBox->Execute();
return false; return false;
...@@ -768,6 +770,11 @@ const VclPtr<Printer>& PrinterController::getPrinter() const ...@@ -768,6 +770,11 @@ const VclPtr<Printer>& PrinterController::getPrinter() const
return mpImplData->mxPrinter; return mpImplData->mxPrinter;
} }
const VclPtr<vcl::Window>& PrinterController::getWindow() const
{
return mpImplData->mxWindow;
}
void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter ) void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter )
{ {
mpImplData->mxPrinter = i_rPrinter; mpImplData->mxPrinter = i_rPrinter;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment