summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-19 16:33:35 +0000
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-04-17 08:41:27 +0200
commit22441165ecfeeae2953246eb9e0ad2a18fea21d1 (patch)
tree0725eaa2eca77390890b2d22201238c5190169be
parent1638a4a740e84af7e441dbb3d6c04fb9b3439ce7 (diff)
make it possible to set parent window for printer error messages
Reviewed-on: https://gerrit.libreoffice.org/50008 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 60ae5f530c3123341a8c2d49793693c2cd4521c2) Change-Id: I0effa3645454ef9d03393ae8b256cd624ca04f03
-rw-r--r--include/vcl/oldprintadaptor.hxx2
-rw-r--r--include/vcl/print.hxx3
-rw-r--r--sfx2/source/view/viewprn.cxx2
-rw-r--r--sw/inc/viewsh.hxx1
-rw-r--r--toolkit/source/awt/vclxprinter.cxx3
-rw-r--r--vcl/source/gdi/oldprintadaptor.cxx4
-rw-r--r--vcl/source/gdi/print3.cxx13
7 files changed, 18 insertions, 10 deletions
diff --git a/include/vcl/oldprintadaptor.hxx b/include/vcl/oldprintadaptor.hxx
index bd65f4d2ce27..23cbcf8112be 100644
--- a/include/vcl/oldprintadaptor.hxx
+++ b/include/vcl/oldprintadaptor.hxx
@@ -29,7 +29,7 @@ namespace vcl
{
ImplOldStyleAdaptorData* mpData;
public:
- OldStylePrintAdaptor( const VclPtr< Printer >& );
+ OldStylePrintAdaptor(const VclPtr<Printer>&, const VclPtr<vcl::Window>&);
virtual ~OldStylePrintAdaptor() override;
void StartPage();
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index f452564c107d..83e086fd1d0a 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -394,7 +394,7 @@ class VCL_DLLPUBLIC PrinterController
{
ImplPrinterControllerData* mpImplData;
protected:
- PrinterController( const VclPtr<Printer>& );
+ PrinterController( const VclPtr<Printer>&, const VclPtr<vcl::Window>& );
public:
struct MultiPageSetup
{
@@ -436,6 +436,7 @@ public:
virtual ~PrinterController();
const VclPtr<Printer>& getPrinter() const;
+ const VclPtr<vcl::Window>& getWindow() const;
/** For implementations: get current job properties as changed by e.g. print dialog
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index ca5baf74771f..22ebdfc7bb6a 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -104,7 +104,7 @@ SfxPrinterController::SfxPrinterController( const VclPtr<Printer>& i_rPrinter,
SfxViewShell* pView,
const uno::Sequence< beans::PropertyValue >& rProps
)
- : PrinterController( i_rPrinter)
+ : PrinterController(i_rPrinter, pView ? pView->GetWindow() : nullptr)
, maCompleteSelection( i_rComplete )
, maSelection( i_rSelection )
, mxRenderable( i_xRender )
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 1d5a34b6c343..eaa28183b9ef 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -82,7 +82,6 @@ class SwAccessibleMap;
namespace vcl
{
typedef OutputDevice RenderContext;
- class OldStylePrintAdaptor;
}
// Define for flags needed in ctor or layers below.
diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx
index 9adc64e1196e..a3f19096d6ea 100644
--- a/toolkit/source/awt/vclxprinter.cxx
+++ b/toolkit/source/awt/vclxprinter.cxx
@@ -28,6 +28,7 @@
#include <vcl/print.hxx>
#include <vcl/jobset.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
#include <tools/debug.hxx>
#include <tools/stream.hxx>
@@ -284,7 +285,7 @@ sal_Bool VCLXPrinter::start( const OUString& /*rJobName*/, sal_Int16 /*nCopies*/
if (mxPrinter.get())
{
maInitJobSetup = mxPrinter->GetJobSetup();
- mxListener.reset(new vcl::OldStylePrintAdaptor(mxPrinter));
+ mxListener.reset(new vcl::OldStylePrintAdaptor(mxPrinter, nullptr));
}
return bDone;
diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx
index 1f354febbd25..03bdd1c800fe 100644
--- a/vcl/source/gdi/oldprintadaptor.cxx
+++ b/vcl/source/gdi/oldprintadaptor.cxx
@@ -44,8 +44,8 @@ namespace vcl
};
}
-OldStylePrintAdaptor::OldStylePrintAdaptor( const VclPtr< Printer >& i_xPrinter )
- : PrinterController( i_xPrinter )
+OldStylePrintAdaptor::OldStylePrintAdaptor( const VclPtr< Printer >& i_xPrinter, const VclPtr<vcl::Window>& i_xWindow )
+ : PrinterController( i_xPrinter, i_xWindow )
, mpData( new ImplOldStyleAdaptorData() )
{
}
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index b9de9928cc76..edb5ff7ff7c3 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -139,6 +139,7 @@ public:
typedef std::unordered_map< OUString, css::uno::Sequence< sal_Bool >, OUStringHash > ChoiceDisableMap;
VclPtr< Printer > mxPrinter;
+ VclPtr<vcl::Window> mxWindow;
css::uno::Sequence< css::beans::PropertyValue > maUIOptions;
std::vector< css::beans::PropertyValue > maUIProperties;
std::vector< bool > maUIPropertyEnabled;
@@ -206,10 +207,11 @@ public:
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->mxPrinter = i_xPrinter;
+ mpImplData->mxWindow = i_xWindow;
}
static OUString queryFile( Printer* pPrinter )
@@ -303,7 +305,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
if (xController->isShowDialogs())
{
ScopedVclPtrInstance<MessageDialog> aBox(
- nullptr, "ErrorNoPrinterDialog",
+ xController->getWindow(), "ErrorNoPrinterDialog",
"vcl/ui/errornoprinterdialog.ui");
aBox->Execute();
}
@@ -453,7 +455,7 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
if( xController->getFilteredPageCount() == 0 )
{
ScopedVclPtrInstance<MessageDialog> aBox(
- nullptr, "ErrorNoContentDialog",
+ xController->getWindow(), "ErrorNoContentDialog",
"vcl/ui/errornocontentdialog.ui");
aBox->Execute();
return false;
@@ -775,6 +777,11 @@ const VclPtr<Printer>& PrinterController::getPrinter() const
return mpImplData->mxPrinter;
}
+const VclPtr<vcl::Window>& PrinterController::getWindow() const
+{
+ return mpImplData->mxWindow;
+}
+
void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter )
{
mpImplData->mxPrinter = i_rPrinter;