summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-11-29 11:50:54 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-11-29 14:40:45 +0000
commit59b98580bfd70205a9ebdb0ba67e74225d875b43 (patch)
tree49ae5fefb8e5df4fdcce26f77740fc0fef70cdc5 /svtools
parent7e1b156a4103bbb6d1dc110ffac53528c00b5dd2 (diff)
Resolves: fdo#44664 Provide a way to set the default print job format.
a) In the print dialog you can temporarily override the default print job format for a single print job b) In the printer options dialog you can override the default print job format for a single printer c) Under tools->options->print you can override the default print job format for all printers. Tidy up the restart dialog in passing Change-Id: Ibea94bab6a79c3590dbf34583013db4e2ac06f45
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/svtools/printoptions.hxx6
-rw-r--r--svtools/inc/svtools/restartdialog.hxx5
-rw-r--r--svtools/source/config/printoptions.cxx52
-rw-r--r--svtools/source/dialogs/restartdialog.cxx9
-rw-r--r--svtools/uiconfig/ui/restartdialog.ui36
5 files changed, 91 insertions, 17 deletions
diff --git a/svtools/inc/svtools/printoptions.hxx b/svtools/inc/svtools/printoptions.hxx
index 8c882e144fc6..e3e70e7750e6 100644
--- a/svtools/inc/svtools/printoptions.hxx
+++ b/svtools/inc/svtools/printoptions.hxx
@@ -60,7 +60,8 @@ public:
sal_Int16 GetReducedBitmapMode() const;
sal_Int16 GetReducedBitmapResolution() const;
sal_Bool IsReducedBitmapIncludesTransparency() const;
- sal_Bool IsConvertToGreyscales() const;
+ sal_Bool IsConvertToGreyscales() const;
+ sal_Bool IsPDFAsStandardPrintJobFormat() const;
void SetReduceTransparency( sal_Bool bState );
void SetReducedTransparencyMode( sal_Int16 nMode );
@@ -71,7 +72,8 @@ public:
void SetReducedBitmapMode( sal_Int16 bState );
void SetReducedBitmapResolution( sal_Int16 nResolution );
void SetReducedBitmapIncludesTransparency( sal_Bool bState );
- void SetConvertToGreyscales( sal_Bool bState );
+ void SetConvertToGreyscales( sal_Bool bState );
+ void SetPDFAsStandardPrintJobFormat( sal_Bool bState );
public:
diff --git a/svtools/inc/svtools/restartdialog.hxx b/svtools/inc/svtools/restartdialog.hxx
index 85afd7d89f3c..91ff4eafa445 100644
--- a/svtools/inc/svtools/restartdialog.hxx
+++ b/svtools/inc/svtools/restartdialog.hxx
@@ -23,9 +23,12 @@ namespace com { namespace sun { namespace star { namespace uno {
namespace svtools {
enum RestartReason {
- RESTART_REASON_JAVA
+ RESTART_REASON_JAVA,
// "For the selected Java runtime environment to work properly,
// %PRODUCTNAME must be restarted."
+ RESTART_REASON_PDF_AS_STANDARD_JOB_FORMAT
+ // For the modified default print job format to take effect,
+ // %PRODUCTNAME must be restarted.
};
SVT_DLLPUBLIC void executeRestartDialog(
diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx
index 039c7e9da529..3d0c0c0d07bd 100644
--- a/svtools/source/config/printoptions.cxx
+++ b/svtools/source/config/printoptions.cxx
@@ -64,6 +64,7 @@ static sal_uInt16 aDPIArray[] = { 72, 96, 150, 200, 300, 600 };
#define PROPERTYNAME_REDUCEDBITMAPRESOLUTION OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapResolution"))
#define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapIncludesTransparency"))
#define PROPERTYNAME_CONVERTTOGREYSCALES OUString(RTL_CONSTASCII_USTRINGPARAM("ConvertToGreyscales"))
+#define PROPERTYNAME_PDFASSTANDARDPRINTJOBFORMAT OUString(RTL_CONSTASCII_USTRINGPARAM("PDFAsStandardPrintJobFormat"))
// --------------
// - Namespaces -
@@ -116,7 +117,8 @@ public:
sal_Int16 GetReducedBitmapMode() const ;
sal_Int16 GetReducedBitmapResolution() const ;
sal_Bool IsReducedBitmapIncludesTransparency() const ;
- sal_Bool IsConvertToGreyscales() const;
+ sal_Bool IsConvertToGreyscales() const;
+ sal_Bool IsPDFAsStandardPrintJobFormat() const;
void SetReduceTransparency( sal_Bool bState ) ;
void SetReducedTransparencyMode( sal_Int16 nMode ) ;
@@ -127,7 +129,8 @@ public:
void SetReducedBitmapMode( sal_Int16 nMode ) ;
void SetReducedBitmapResolution( sal_Int16 nResolution ) ;
void SetReducedBitmapIncludesTransparency( sal_Bool bState ) ;
- void SetConvertToGreyscales( sal_Bool bState ) ;
+ void SetConvertToGreyscales( sal_Bool bState ) ;
+ void SetPDFAsStandardPrintJobFormat( sal_Bool bState ) ;
//-------------------------------------------------------------------------------------------------------------
// private API
@@ -393,6 +396,28 @@ sal_Bool SvtPrintOptions_Impl::IsConvertToGreyscales() const
}
+sal_Bool SvtPrintOptions_Impl::IsPDFAsStandardPrintJobFormat() const
+{
+ sal_Bool bRet = sal_True;
+ try
+ {
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_PDFASSTANDARDPRINTJOBFORMAT) >>= bRet;
+ }
+ }
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
+ }
+
+ return bRet;
+}
+
void SvtPrintOptions_Impl::SetReduceTransparency(sal_Bool bState)
{
impl_setValue(PROPERTYNAME_REDUCETRANSPARENCY, bState);
@@ -443,6 +468,11 @@ void SvtPrintOptions_Impl::SetConvertToGreyscales(sal_Bool bState)
impl_setValue(PROPERTYNAME_CONVERTTOGREYSCALES, bState);
}
+void SvtPrintOptions_Impl::SetPDFAsStandardPrintJobFormat(sal_Bool bState)
+{
+ impl_setValue(PROPERTYNAME_PDFASSTANDARDPRINTJOBFORMAT, bState);
+}
+
SvtPrintOptions_Impl::~SvtPrintOptions_Impl()
{
m_xNode.clear();
@@ -628,6 +658,14 @@ sal_Bool SvtBasePrintOptions::IsConvertToGreyscales() const
// -----------------------------------------------------------------------------
+sal_Bool SvtBasePrintOptions::IsPDFAsStandardPrintJobFormat() const
+{
+ MutexGuard aGuard( GetOwnStaticMutex() );
+ return m_pDataContainer->IsPDFAsStandardPrintJobFormat();
+}
+
+// -----------------------------------------------------------------------------
+
void SvtBasePrintOptions::SetReduceTransparency( sal_Bool bState )
{
MutexGuard aGuard( GetOwnStaticMutex() );
@@ -708,6 +746,14 @@ void SvtBasePrintOptions::SetConvertToGreyscales( sal_Bool bState )
// -----------------------------------------------------------------------------
+void SvtBasePrintOptions::SetPDFAsStandardPrintJobFormat( sal_Bool bState )
+{
+ MutexGuard aGuard( GetOwnStaticMutex() );
+ m_pDataContainer->SetPDFAsStandardPrintJobFormat( bState );
+}
+
+// -----------------------------------------------------------------------------
+
void SvtBasePrintOptions::GetPrinterOptions( PrinterOptions& rOptions ) const
{
rOptions.SetReduceTransparency( IsReduceTransparency() );
@@ -720,6 +766,7 @@ void SvtBasePrintOptions::GetPrinterOptions( PrinterOptions& rOptions ) const
rOptions.SetReducedBitmapResolution( aDPIArray[ Min( (sal_uInt16) GetReducedBitmapResolution(), (sal_uInt16)( DPI_COUNT - 1 ) ) ] );
rOptions.SetReducedBitmapIncludesTransparency( IsReducedBitmapIncludesTransparency() );
rOptions.SetConvertToGreyscales( IsConvertToGreyscales() );
+ rOptions.SetPDFAsStandardPrintJobFormat( IsPDFAsStandardPrintJobFormat() );
}
// -----------------------------------------------------------------------------
@@ -739,6 +786,7 @@ void SvtBasePrintOptions::SetPrinterOptions( const PrinterOptions& rOptions )
sal::static_int_cast< sal_Int16 >(rOptions.GetReducedBitmapMode()) );
SetReducedBitmapIncludesTransparency( rOptions.IsReducedBitmapIncludesTransparency() );
SetConvertToGreyscales( rOptions.IsConvertToGreyscales() );
+ SetPDFAsStandardPrintJobFormat( rOptions.IsPDFAsStandardPrintJobFormat() );
const sal_uInt16 nDPI = rOptions.GetReducedBitmapResolution();
diff --git a/svtools/source/dialogs/restartdialog.cxx b/svtools/source/dialogs/restartdialog.cxx
index 1004a2d6d394..2e8428f935cf 100644
--- a/svtools/source/dialogs/restartdialog.cxx
+++ b/svtools/source/dialogs/restartdialog.cxx
@@ -30,16 +30,19 @@ public:
RestartDialog(Window * parent, svtools::RestartReason reason):
ModalDialog(parent, "RestartDialog", "svt/ui/restartdialog.ui")
{
- get(reasonJava_, "reason_java");
get(btnYes_, "yes");
get(btnNo_, "no");
switch (reason) {
case svtools::RESTART_REASON_JAVA:
- reasonJava_->Show();
+ get(reason_, "reason_java");
+ break;
+ case svtools::RESTART_REASON_PDF_AS_STANDARD_JOB_FORMAT:
+ get(reason_, "reason_pdf");
break;
default:
assert(false); // this cannot happen
}
+ reason_->Show();
btnYes_->SetClickHdl(LINK(this, RestartDialog, hdlYes));
btnNo_->SetClickHdl(LINK(this, RestartDialog, hdlNo));
}
@@ -48,7 +51,7 @@ private:
DECL_LINK(hdlYes, void *);
DECL_LINK(hdlNo, void *);
- Window * reasonJava_;
+ Window * reason_;
PushButton * btnYes_;
PushButton * btnNo_;
};
diff --git a/svtools/uiconfig/ui/restartdialog.ui b/svtools/uiconfig/ui/restartdialog.ui
index dd041b4ec52b..475dfbdf1756 100644
--- a/svtools/uiconfig/ui/restartdialog.ui
+++ b/svtools/uiconfig/ui/restartdialog.ui
@@ -1,17 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * This file is part of the LibreOffice project.
- *
- * 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/.
- *
--->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="RestartDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
+ <property name="title" translatable="yes">Restart %PRODUCTNAME</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
@@ -26,9 +19,13 @@
<child>
<object class="GtkButton" id="yes">
<property name="label" translatable="yes">Restart now</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
<property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -39,9 +36,11 @@
<child>
<object class="GtkButton" id="no">
<property name="label" translatable="yes">Restart later</property>
+ <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -62,10 +61,14 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
+ <property name="spacing">16</property>
<child>
<object class="GtkLabel" id="reason_java">
<property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
<property name="label" translatable="yes">For the selected Java runtime environment to work properly, %PRODUCTNAME must be restarted.</property>
+ <property name="wrap">True</property>
+ <property name="max_width_chars">30</property>
</object>
<packing>
<property name="expand">False</property>
@@ -74,15 +77,30 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="reason_pdf">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">For the modified default print job format to take effect, %PRODUCTNAME must be restarted.</property>
+ <property name="wrap">True</property>
+ <property name="max_width_chars">50</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Do you want to restart %PRODUCTNAME now?</property>
+ <property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>