summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2009-11-18 17:23:09 +0100
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2009-11-18 17:23:09 +0100
commitc0879d0fd9c440e690ca24b4b4085b2863b46694 (patch)
treeaa5de52fdd359aea9e71acc3de71a43330b5705b
parent5e9fc7a71efaf83fde0766a78c72ee6b7b781ea8 (diff)
printerpullpages: #i106559# warn about missing default printer
-rw-r--r--vcl/inc/vcl/svids.hrc1
-rw-r--r--vcl/source/gdi/print.cxx13
-rw-r--r--vcl/source/gdi/print3.cxx19
-rw-r--r--vcl/source/src/print.src6
4 files changed, 35 insertions, 4 deletions
diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc
index c54dfb70c3ed..b3fcf9c70dd3 100644
--- a/vcl/inc/vcl/svids.hrc
+++ b/vcl/inc/vcl/svids.hrc
@@ -163,6 +163,7 @@
#define SV_PRINT_PROGRESS_TEXT 2
#define SV_PRINT_NATIVE_STRINGS 2050
+#define SV_PRINT_NOPRINTERWARNING 2051
#define SV_HELPTEXT_CLOSE 10000
#define SV_HELPTEXT_MINIMIZE 10001
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] =