diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2009-11-18 17:23:09 +0100 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2009-11-18 17:23:09 +0100 |
commit | c0879d0fd9c440e690ca24b4b4085b2863b46694 (patch) | |
tree | aa5de52fdd359aea9e71acc3de71a43330b5705b /vcl/source | |
parent | 5e9fc7a71efaf83fde0766a78c72ee6b7b781ea8 (diff) |
printerpullpages: #i106559# warn about missing default printer
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/print.cxx | 13 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 19 | ||||
-rw-r--r-- | vcl/source/src/print.src | 6 |
3 files changed, 34 insertions, 4 deletions
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index c70835de47e7..16f6b53af7a8 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -277,7 +277,9 @@ static void ImplInitPrnQueueList() pSVData->maGDIData.mpPrinterQueueList = new ImplPrnQueueList; - pSVData->mpDefInst->GetPrinterQueueInfo( pSVData->maGDIData.mpPrinterQueueList ); + static const char* pEnv = getenv( "SAL_DISABLE_PRINTERLIST" ); + if( !pEnv || !*pEnv ) + pSVData->mpDefInst->GetPrinterQueueInfo( pSVData->maGDIData.mpPrinterQueueList ); } // ----------------------------------------------------------------------- @@ -336,9 +338,14 @@ const QueueInfo* Printer::GetQueueInfo( const String& rPrinterName, bool bStatus XubString Printer::GetDefaultPrinterName() { - ImplSVData* pSVData = ImplGetSVData(); + static const char* pEnv = getenv( "SAL_DISABLE_DEFAULTPRINTER" ); + if( !pEnv || !*pEnv ) + { + ImplSVData* pSVData = ImplGetSVData(); - return pSVData->mpDefInst->GetDefaultPrinter(); + return pSVData->mpDefInst->GetDefaultPrinter(); + } + return XubString(); } // ======================================================================= diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 609fe5ad339b..e958994c0c6a 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -38,6 +38,7 @@ #include "vcl/salprn.hxx" #include "vcl/svids.hrc" #include "vcl/metaact.hxx" +#include "vcl/msgbox.hxx" #include "tools/urlobj.hxx" @@ -310,8 +311,24 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr const JobSetup& i_rInitSetup ) { - // setup printer boost::shared_ptr<PrinterController> pController( i_pController ); + + // check if there is a default printer; if not, show an error box (if appropriate) + if( GetDefaultPrinterName().Len() == 0 ) + { + if( pController->isShowDialogs() + // && ! pController->isDirectPrint() + ) + { + ErrorBox aBox( NULL, VclResId( SV_PRINT_NOPRINTERWARNING ) ); + aBox.Execute(); + } + pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDirect" ) ), + makeAny( sal_False ) ); + } + + // setup printer + // if no specific printer is already set, create one if( ! pController->getPrinter() ) { diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src index 856ba88525fa..83ea13e8478a 100644 --- a/vcl/source/src/print.src +++ b/vcl/source/src/print.src @@ -465,6 +465,12 @@ ModelessDialog SV_DLG_PRINT_PROGRESS }; }; +ErrorBox SV_PRINT_NOPRINTERWARNING +{ + Title = "%PRODUCTNAME"; + Message [en-US] = "No default printer found.\nPlease choose a printer and try again."; +}; + StringArray SV_PRINT_NATIVE_STRINGS { ItemList [en-US] = |