summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/printopt.hxx10
-rw-r--r--include/svtools/printoptions.hxx6
-rw-r--r--include/vcl/print.hxx108
-rw-r--r--include/vcl/printer/Options.hxx120
-rw-r--r--sfx2/source/dialog/printopt.cxx20
-rw-r--r--svtools/source/config/printoptions.cxx17
-rw-r--r--vcl/Library_vcl.mk1
-rw-r--r--vcl/inc/print.hrc2
-rw-r--r--vcl/source/gdi/print.cxx117
-rw-r--r--vcl/source/gdi/print2.cxx5
-rw-r--r--vcl/source/gdi/print3.cxx40
-rw-r--r--vcl/source/printer/Options.cxx110
-rw-r--r--vcl/source/window/printdlg.cxx30
-rw-r--r--vcl/unx/generic/print/genprnpsp.cxx1
14 files changed, 329 insertions, 258 deletions
diff --git a/include/sfx2/printopt.hxx b/include/sfx2/printopt.hxx
index e68286c1a2e1..2bdc6a9c2011 100644
--- a/include/sfx2/printopt.hxx
+++ b/include/sfx2/printopt.hxx
@@ -25,7 +25,7 @@
#include <sfx2/tabdlg.hxx>
#include <sal/types.h>
#include <vcl/print.hxx>
-
+#include <vcl/printer/Options.hxx>
class SFX2_DLLPUBLIC SfxCommonPrintOptionsTabPage final : public SfxTabPage
{
@@ -54,8 +54,8 @@ private:
private:
- PrinterOptions maPrinterOptions;
- PrinterOptions maPrintFileOptions;
+ vcl::printer::Options maPrinterOptions;
+ vcl::printer::Options maPrintFileOptions;
DECL_DLLPRIVATE_LINK( ToggleOutputPrinterRBHdl, weld::Toggleable&, void );
DECL_DLLPRIVATE_LINK( ToggleOutputPrintFileRBHdl, weld::Toggleable&, void);
@@ -67,8 +67,8 @@ private:
DECL_DLLPRIVATE_LINK( ToggleReduceGradientsStripesRBHdl, weld::Toggleable&, void );
DECL_DLLPRIVATE_LINK( ToggleReduceBitmapsResolutionRBHdl, weld::Toggleable&, void );
- SAL_DLLPRIVATE void ImplUpdateControls( const PrinterOptions* pCurrentOptions );
- SAL_DLLPRIVATE void ImplSaveControls( PrinterOptions* pCurrentOptions );
+ SAL_DLLPRIVATE void ImplUpdateControls( const vcl::printer::Options* pCurrentOptions );
+ SAL_DLLPRIVATE void ImplSaveControls( vcl::printer::Options* pCurrentOptions );
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
diff --git a/include/svtools/printoptions.hxx b/include/svtools/printoptions.hxx
index 6f2e86df3cf1..1223814a84b3 100644
--- a/include/svtools/printoptions.hxx
+++ b/include/svtools/printoptions.hxx
@@ -23,12 +23,12 @@
#include <svtools/svtdllapi.h>
#include <sal/types.h>
-class PrinterOptions;
+namespace vcl::printer { class Options; }
namespace svtools
{
- SVT_DLLPUBLIC void GetPrinterOptions( PrinterOptions& rOptions, bool bFile );
- SVT_DLLPUBLIC void SetPrinterOptions( const PrinterOptions& rOptions, bool bFile );
+ SVT_DLLPUBLIC void GetPrinterOptions( vcl::printer::Options& rOptions, bool bFile );
+ SVT_DLLPUBLIC void SetPrinterOptions( const vcl::printer::Options& rOptions, bool bFile );
};
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index b4db13959954..dba696eebf18 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -20,15 +20,22 @@
#ifndef INCLUDED_VCL_PRINT_HXX
#define INCLUDED_VCL_PRINT_HXX
+#include <sal/config.h>
+
#include <config_options.h>
+
+#include <sal/types.h>
#include <rtl/ustring.hxx>
+#include <tools/gen.hxx>
+#include <tools/long.hxx>
#include <i18nutil/paper.hxx>
-#include <vcl/errcode.hxx>
#include <vcl/dllapi.h>
+#include <vcl/PrinterSupport.hxx>
+#include <vcl/errcode.hxx>
#include <vcl/outdev.hxx>
#include <vcl/prntypes.hxx>
-#include <vcl/PrinterSupport.hxx>
+#include <vcl/region.hxx>
#include <vcl/jobset.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -48,97 +55,14 @@ enum class SalPrinterError;
namespace vcl {
class PrinterController;
+
+ namespace printer {
+ class Options;
+ }
}
namespace weld { class Window; }
-enum class PrinterTransparencyMode
-{
- Auto = 0,
- NONE = 1
-};
-
-
-enum class PrinterGradientMode
-{
- Stripes = 0,
- Color = 1
-};
-
-
-enum class PrinterBitmapMode
-{
- Optimal = 0,
- Normal = 1,
- Resolution = 2
-};
-
-
-class UNLESS_MERGELIBS(VCL_DLLPUBLIC) PrinterOptions
-{
-private:
-
- bool mbReduceTransparency;
- PrinterTransparencyMode meReducedTransparencyMode;
- bool mbReduceGradients;
- PrinterGradientMode meReducedGradientsMode;
- sal_uInt16 mnReducedGradientStepCount;
- bool mbReduceBitmaps;
- PrinterBitmapMode meReducedBitmapMode;
- sal_uInt16 mnReducedBitmapResolution;
- bool mbReducedBitmapsIncludeTransparency;
- bool mbConvertToGreyscales;
- bool mbPDFAsStandardPrintJobFormat;
-
-public:
- PrinterOptions();
-
- bool IsReduceTransparency() const { return mbReduceTransparency; }
- void SetReduceTransparency( bool bSet ) { mbReduceTransparency = bSet; }
-
- PrinterTransparencyMode GetReducedTransparencyMode() const { return meReducedTransparencyMode; }
- void SetReducedTransparencyMode( PrinterTransparencyMode eMode )
- { meReducedTransparencyMode = eMode; }
-
- bool IsReduceGradients() const { return mbReduceGradients; }
- void SetReduceGradients( bool bSet ) { mbReduceGradients = bSet; }
-
- PrinterGradientMode GetReducedGradientMode() const { return meReducedGradientsMode; }
- void SetReducedGradientMode( PrinterGradientMode eMode ) { meReducedGradientsMode = eMode; }
-
- sal_uInt16 GetReducedGradientStepCount() const { return mnReducedGradientStepCount; }
- void SetReducedGradientStepCount( sal_uInt16 nStepCount )
- { mnReducedGradientStepCount = nStepCount; }
-
- bool IsReduceBitmaps() const { return mbReduceBitmaps; }
- void SetReduceBitmaps( bool bSet ) { mbReduceBitmaps = bSet; }
-
- PrinterBitmapMode GetReducedBitmapMode() const { return meReducedBitmapMode; }
- void SetReducedBitmapMode( PrinterBitmapMode eMode ) { meReducedBitmapMode = eMode; }
-
- sal_uInt16 GetReducedBitmapResolution() const { return mnReducedBitmapResolution; }
- void SetReducedBitmapResolution( sal_uInt16 nResolution )
- { mnReducedBitmapResolution = nResolution; }
-
- bool IsReducedBitmapIncludesTransparency() const { return mbReducedBitmapsIncludeTransparency; }
- void SetReducedBitmapIncludesTransparency( bool bSet )
- { mbReducedBitmapsIncludeTransparency = bSet; }
-
- bool IsConvertToGreyscales() const { return mbConvertToGreyscales; }
- void SetConvertToGreyscales( bool bSet ) { mbConvertToGreyscales = bSet; }
-
- bool IsPDFAsStandardPrintJobFormat() const { return mbPDFAsStandardPrintJobFormat; }
- void SetPDFAsStandardPrintJobFormat( bool bSet ) { mbPDFAsStandardPrintJobFormat = bSet; }
-
- /** Read printer options from configuration
-
- parameter decides whether the set for
- print "to printer" or "to file" should be read.
- */
- void ReadFromConfig( bool bFile );
-};
-
-
class VCL_DLLPUBLIC Printer : public OutputDevice
{
friend class ::OutputDevice;
@@ -150,7 +74,7 @@ private:
VclPtr<Printer> mpPrev;
VclPtr<Printer> mpNext;
VclPtr<VirtualDevice> mpDisplayDev;
- std::unique_ptr<PrinterOptions> mpPrinterOptions;
+ std::unique_ptr<vcl::printer::Options> mpPrinterOptions;
OUString maPrinterName;
OUString maDriver;
OUString maPrintFile;
@@ -293,8 +217,8 @@ public:
should the need arise to set the printer options outside vcl, also a method would have to be devised
to not override these again internally
*/
- VCL_DLLPRIVATE void SetPrinterOptions( const PrinterOptions& rOptions );
- const PrinterOptions& GetPrinterOptions() const { return( *mpPrinterOptions ); }
+ VCL_DLLPRIVATE void SetPrinterOptions( const vcl::printer::Options& rOptions );
+ const vcl::printer::Options& GetPrinterOptions() const { return( *mpPrinterOptions ); }
bool SetOrientation( Orientation eOrient );
Orientation GetOrientation() const;
diff --git a/include/vcl/printer/Options.hxx b/include/vcl/printer/Options.hxx
new file mode 100644
index 000000000000..3899fd313b8f
--- /dev/null
+++ b/include/vcl/printer/Options.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <config_options.h>
+
+#include <sal/types.h>
+
+#include <vcl/dllapi.h>
+
+namespace vcl::printer
+{
+enum class TransparencyMode
+{
+ Auto = 0,
+ NONE = 1
+};
+
+enum class GradientMode
+{
+ Stripes = 0,
+ Color = 1
+};
+
+enum class BitmapMode
+{
+ Optimal = 0,
+ Normal = 1,
+ Resolution = 2
+};
+
+class UNLESS_MERGELIBS(VCL_DLLPUBLIC) Options
+{
+private:
+ bool mbReduceTransparency = false;
+ TransparencyMode meReducedTransparencyMode = TransparencyMode::Auto;
+ bool mbReduceGradients = false;
+ GradientMode meReducedGradientsMode = GradientMode::Stripes;
+ sal_uInt16 mnReducedGradientStepCount = 64;
+ bool mbReduceBitmaps = false;
+ BitmapMode meReducedBitmapMode = BitmapMode::Normal;
+ sal_uInt16 mnReducedBitmapResolution = 200;
+ bool mbReducedBitmapsIncludeTransparency = true;
+ bool mbConvertToGreyscales = false;
+ bool mbPDFAsStandardPrintJobFormat = false;
+
+public:
+ Options() = default;
+
+ bool IsReduceTransparency() const { return mbReduceTransparency; }
+ void SetReduceTransparency(bool bSet) { mbReduceTransparency = bSet; }
+
+ TransparencyMode GetReducedTransparencyMode() const { return meReducedTransparencyMode; }
+ void SetReducedTransparencyMode(TransparencyMode eMode) { meReducedTransparencyMode = eMode; }
+
+ bool IsReduceGradients() const { return mbReduceGradients; }
+ void SetReduceGradients(bool bSet) { mbReduceGradients = bSet; }
+
+ GradientMode GetReducedGradientMode() const { return meReducedGradientsMode; }
+ void SetReducedGradientMode(GradientMode eMode) { meReducedGradientsMode = eMode; }
+
+ sal_uInt16 GetReducedGradientStepCount() const { return mnReducedGradientStepCount; }
+ void SetReducedGradientStepCount(sal_uInt16 nStepCount)
+ {
+ mnReducedGradientStepCount = nStepCount;
+ }
+
+ bool IsReduceBitmaps() const { return mbReduceBitmaps; }
+ void SetReduceBitmaps(bool bSet) { mbReduceBitmaps = bSet; }
+
+ BitmapMode GetReducedBitmapMode() const { return meReducedBitmapMode; }
+ void SetReducedBitmapMode(BitmapMode eMode) { meReducedBitmapMode = eMode; }
+
+ sal_uInt16 GetReducedBitmapResolution() const { return mnReducedBitmapResolution; }
+ void SetReducedBitmapResolution(sal_uInt16 nResolution)
+ {
+ mnReducedBitmapResolution = nResolution;
+ }
+
+ bool IsReducedBitmapIncludesTransparency() const { return mbReducedBitmapsIncludeTransparency; }
+ void SetReducedBitmapIncludesTransparency(bool bSet)
+ {
+ mbReducedBitmapsIncludeTransparency = bSet;
+ }
+
+ bool IsConvertToGreyscales() const { return mbConvertToGreyscales; }
+ void SetConvertToGreyscales(bool bSet) { mbConvertToGreyscales = bSet; }
+
+ bool IsPDFAsStandardPrintJobFormat() const { return mbPDFAsStandardPrintJobFormat; }
+ void SetPDFAsStandardPrintJobFormat(bool bSet) { mbPDFAsStandardPrintJobFormat = bSet; }
+
+ /** Read printer options from configuration
+
+ parameter decides whether the set for
+ print "to printer" or "to file" should be read.
+ */
+ void ReadFromConfig(bool bFile);
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx
index f94b0204cd6f..8d16edfc0e3e 100644
--- a/sfx2/source/dialog/printopt.cxx
+++ b/sfx2/source/dialog/printopt.cxx
@@ -137,18 +137,18 @@ DeactivateRC SfxCommonPrintOptionsTabPage::DeactivatePage( SfxItemSet* pItemSet
return DeactivateRC::LeavePage;
}
-void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCurrentOptions )
+void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const vcl::printer::Options* pCurrentOptions )
{
m_xReduceTransparencyCB->set_active( pCurrentOptions->IsReduceTransparency() );
- if( pCurrentOptions->GetReducedTransparencyMode() == PrinterTransparencyMode::Auto )
+ if( pCurrentOptions->GetReducedTransparencyMode() == vcl::printer::TransparencyMode::Auto )
m_xReduceTransparencyAutoRB->set_active(true);
else
m_xReduceTransparencyNoneRB->set_active(true);
m_xReduceGradientsCB->set_active( pCurrentOptions->IsReduceGradients() );
- if( pCurrentOptions->GetReducedGradientMode() == PrinterGradientMode::Stripes )
+ if( pCurrentOptions->GetReducedGradientMode() == vcl::printer::GradientMode::Stripes )
m_xReduceGradientsStripesRB->set_active(true);
else
m_xReduceGradientsColorRB->set_active(true);
@@ -157,9 +157,9 @@ void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCu
m_xReduceBitmapsCB->set_active( pCurrentOptions->IsReduceBitmaps() );
- if( pCurrentOptions->GetReducedBitmapMode() == PrinterBitmapMode::Optimal )
+ if( pCurrentOptions->GetReducedBitmapMode() == vcl::printer::BitmapMode::Optimal )
m_xReduceBitmapsOptimalRB->set_active(true);
- else if( pCurrentOptions->GetReducedBitmapMode() == PrinterBitmapMode::Normal )
+ else if( pCurrentOptions->GetReducedBitmapMode() == vcl::printer::BitmapMode::Normal )
m_xReduceBitmapsNormalRB->set_active(true);
else
m_xReduceBitmapsResolutionRB->set_active(true);
@@ -189,16 +189,16 @@ void SfxCommonPrintOptionsTabPage::ImplUpdateControls( const PrinterOptions* pCu
ClickReduceBitmapsCBHdl(*m_xReduceBitmapsCB);
}
-void SfxCommonPrintOptionsTabPage::ImplSaveControls( PrinterOptions* pCurrentOptions )
+void SfxCommonPrintOptionsTabPage::ImplSaveControls( vcl::printer::Options* pCurrentOptions )
{
pCurrentOptions->SetReduceTransparency( m_xReduceTransparencyCB->get_active() );
- pCurrentOptions->SetReducedTransparencyMode( m_xReduceTransparencyAutoRB->get_active() ? PrinterTransparencyMode::Auto : PrinterTransparencyMode::NONE );
+ pCurrentOptions->SetReducedTransparencyMode( m_xReduceTransparencyAutoRB->get_active() ? vcl::printer::TransparencyMode::Auto : vcl::printer::TransparencyMode::NONE );
pCurrentOptions->SetReduceGradients( m_xReduceGradientsCB->get_active() );
- pCurrentOptions->SetReducedGradientMode( m_xReduceGradientsStripesRB->get_active() ? PrinterGradientMode::Stripes : PrinterGradientMode::Color );
+ pCurrentOptions->SetReducedGradientMode( m_xReduceGradientsStripesRB->get_active() ? vcl::printer::GradientMode::Stripes : vcl::printer::GradientMode::Color );
pCurrentOptions->SetReducedGradientStepCount(m_xReduceGradientsStepCountNF->get_value());
pCurrentOptions->SetReduceBitmaps( m_xReduceBitmapsCB->get_active() );
- pCurrentOptions->SetReducedBitmapMode( m_xReduceBitmapsOptimalRB->get_active() ? PrinterBitmapMode::Optimal :
- ( m_xReduceBitmapsNormalRB->get_active() ? PrinterBitmapMode::Normal : PrinterBitmapMode::Resolution ) );
+ pCurrentOptions->SetReducedBitmapMode( m_xReduceBitmapsOptimalRB->get_active() ? vcl::printer::BitmapMode::Optimal :
+ ( m_xReduceBitmapsNormalRB->get_active() ? vcl::printer::BitmapMode::Normal : vcl::printer::BitmapMode::Resolution ) );
pCurrentOptions->SetReducedBitmapResolution( aDPIArray[ std::min<sal_uInt16>( m_xReduceBitmapsResolutionLB->get_active(),
SAL_N_ELEMENTS(aDPIArray) - 1 ) ] );
pCurrentOptions->SetReducedBitmapIncludesTransparency( m_xReduceBitmapsTransparencyCB->get_active() );
diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx
index 4dd889186e6c..a81a62c3fb0f 100644
--- a/svtools/source/config/printoptions.cxx
+++ b/svtools/source/config/printoptions.cxx
@@ -19,6 +19,7 @@
#include <svtools/printoptions.hxx>
#include <vcl/print.hxx>
+#include <vcl/printer/Options.hxx>
#include <officecfg/Office/Common.hxx>
#include <sal/macros.h>
#include <tools/diagnose_ex.h>
@@ -33,19 +34,19 @@ using namespace ::com::sun::star::uno;
namespace svtools
{
-void GetPrinterOptions( PrinterOptions& rOptions, bool bFile )
+void GetPrinterOptions( vcl::printer::Options& rOptions, bool bFile )
{
if (bFile)
{
rOptions.SetReduceTransparency( officecfg::Office::Common::Print::Option::File::ReduceTransparency::get() );
- rOptions.SetReducedTransparencyMode( static_cast<PrinterTransparencyMode>(
+ rOptions.SetReducedTransparencyMode( static_cast<vcl::printer::TransparencyMode>(
officecfg::Office::Common::Print::Option::File::ReducedTransparencyMode::get() ) );
rOptions.SetReduceGradients( officecfg::Office::Common::Print::Option::File::ReduceGradients::get() );
- rOptions.SetReducedGradientMode( static_cast<PrinterGradientMode>(
+ rOptions.SetReducedGradientMode( static_cast<vcl::printer::GradientMode>(
officecfg::Office::Common::Print::Option::File::ReducedGradientMode::get()) );
rOptions.SetReducedGradientStepCount( officecfg::Office::Common::Print::Option::File::ReducedGradientStepCount::get() );
rOptions.SetReduceBitmaps( officecfg::Office::Common::Print::Option::File::ReduceBitmaps::get() );
- rOptions.SetReducedBitmapMode( static_cast<PrinterBitmapMode>(
+ rOptions.SetReducedBitmapMode( static_cast<vcl::printer::BitmapMode>(
officecfg::Office::Common::Print::Option::File::ReducedBitmapMode::get()) );
rOptions.SetReducedBitmapResolution( aDPIArray[ std::min( static_cast<sal_uInt16>(
officecfg::Office::Common::Print::Option::File::ReducedBitmapResolution::get()), sal_uInt16( DPI_COUNT - 1 ) ) ] );
@@ -57,14 +58,14 @@ void GetPrinterOptions( PrinterOptions& rOptions, bool bFile )
else
{
rOptions.SetReduceTransparency( officecfg::Office::Common::Print::Option::Printer::ReduceTransparency::get() );
- rOptions.SetReducedTransparencyMode( static_cast<PrinterTransparencyMode>(
+ rOptions.SetReducedTransparencyMode( static_cast<vcl::printer::TransparencyMode>(
officecfg::Office::Common::Print::Option::Printer::ReducedTransparencyMode::get() ) );
rOptions.SetReduceGradients( officecfg::Office::Common::Print::Option::Printer::ReduceGradients::get() );
- rOptions.SetReducedGradientMode( static_cast<PrinterGradientMode>(
+ rOptions.SetReducedGradientMode( static_cast<vcl::printer::GradientMode>(
officecfg::Office::Common::Print::Option::Printer::ReducedGradientMode::get()) );
rOptions.SetReducedGradientStepCount( officecfg::Office::Common::Print::Option::Printer::ReducedGradientStepCount::get() );
rOptions.SetReduceBitmaps( officecfg::Office::Common::Print::Option::Printer::ReduceBitmaps::get() );
- rOptions.SetReducedBitmapMode( static_cast<PrinterBitmapMode>(
+ rOptions.SetReducedBitmapMode( static_cast<vcl::printer::BitmapMode>(
officecfg::Office::Common::Print::Option::Printer::ReducedBitmapMode::get()) );
rOptions.SetReducedBitmapResolution( aDPIArray[ std::min( static_cast<sal_uInt16>(
officecfg::Office::Common::Print::Option::Printer::ReducedBitmapResolution::get()), sal_uInt16( DPI_COUNT - 1 ) ) ] );
@@ -75,7 +76,7 @@ void GetPrinterOptions( PrinterOptions& rOptions, bool bFile )
}
}
-void SetPrinterOptions( const PrinterOptions& rOptions, bool bFile )
+void SetPrinterOptions( const vcl::printer::Options& rOptions, bool bFile )
{
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
if (bFile)
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 99632be5c5ef..41d3ee3e7fc9 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -101,6 +101,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/animate/AnimationBitmap \
vcl/source/cnttype/mcnttfactory \
vcl/source/cnttype/mcnttype \
+ vcl/source/printer/Options \
vcl/source/printer/QueueInfo \
vcl/source/window/bubblewindow \
vcl/source/window/errinf \
diff --git a/vcl/inc/print.hrc b/vcl/inc/print.hrc
index ddc0e3e1699a..b654a77ec3b8 100644
--- a/vcl/inc/print.hrc
+++ b/vcl/inc/print.hrc
@@ -20,6 +20,8 @@
#ifndef INCLUDED_VCL_INC_PRINT_HRC
#define INCLUDED_VCL_INC_PRINT_HRC
+#include <unotools/resmgr.hxx>
+
#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
const TranslateId RID_STR_PAPERNAMES[] =
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 6b6b070a69f3..ea3d70053978 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -19,28 +19,27 @@
#include <sal/types.h>
#include <sal/log.hxx>
-
-#include <tools/helpers.hxx>
+#include <comphelper/processfactory.hxx>
#include <tools/debug.hxx>
+#include <tools/helpers.hxx>
#include <vcl/QueueInfo.hxx>
#include <vcl/event.hxx>
#include <vcl/virdev.hxx>
#include <vcl/print.hxx>
+#include <vcl/printer/Options.hxx>
-#include <comphelper/processfactory.hxx>
-
-#include <salinst.hxx>
-#include <salvd.hxx>
-#include <salgdi.hxx>
-#include <salptype.hxx>
-#include <salprn.hxx>
-#include <svdata.hxx>
-#include <print.hrc>
#include <jobset.h>
#include <outdev.h>
-#include <PhysicalFontCollection.hxx>
#include <print.h>
+#include <PhysicalFontCollection.hxx>
+#include <print.hrc>
+#include <salgdi.hxx>
+#include <salinst.hxx>
+#include <salprn.hxx>
+#include <salptype.hxx>
+#include <salvd.hxx>
+#include <svdata.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
@@ -89,96 +88,6 @@ void ImplUpdateJobSetupPaper( JobSetup& rJobSetup )
}
}
-// PrinterOptions
-PrinterOptions::PrinterOptions() :
- mbReduceTransparency( false ),
- meReducedTransparencyMode( PrinterTransparencyMode::Auto ),
- mbReduceGradients( false ),
- meReducedGradientsMode( PrinterGradientMode::Stripes ),
- mnReducedGradientStepCount( 64 ),
- mbReduceBitmaps( false ),
- meReducedBitmapMode( PrinterBitmapMode::Normal ),
- mnReducedBitmapResolution( 200 ),
- mbReducedBitmapsIncludeTransparency( true ),
- mbConvertToGreyscales( false ),
- mbPDFAsStandardPrintJobFormat( false )
-{
-}
-
-void PrinterOptions::ReadFromConfig( bool i_bFile )
-{
- bool bSuccess = false;
- // save old state in case something goes wrong
- PrinterOptions aOldValues( *this );
-
- // get the configuration service
- css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider;
- css::uno::Reference< css::container::XNameAccess > xConfigAccess;
- try
- {
- // get service provider
- css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
- // create configuration hierarchical access name
- try
- {
- xConfigProvider = css::configuration::theDefaultProvider::get( xContext );
-
- css::beans::PropertyValue aVal;
- aVal.Name = "nodepath";
- if( i_bFile )
- aVal.Value <<= OUString( "/org.openoffice.Office.Common/Print/Option/File" );
- else
- aVal.Value <<= OUString( "/org.openoffice.Office.Common/Print/Option/Printer" );
- xConfigAccess.set(
- xConfigProvider->createInstanceWithArguments(
- "com.sun.star.configuration.ConfigurationAccess", { css::uno::Any(aVal) } ),
- css::uno::UNO_QUERY );
- if( xConfigAccess.is() )
- {
- css::uno::Reference< css::beans::XPropertySet > xSet( xConfigAccess, css::uno::UNO_QUERY );
- if( xSet.is() )
- {
- sal_Int32 nValue = 0;
- bool bValue = false;
- if( xSet->getPropertyValue("ReduceTransparency") >>= bValue )
- SetReduceTransparency( bValue );
- if( xSet->getPropertyValue("ReducedTransparencyMode") >>= nValue )
- SetReducedTransparencyMode( static_cast<PrinterTransparencyMode>(nValue) );
- if( xSet->getPropertyValue("ReduceGradients") >>= bValue )
- SetReduceGradients( bValue );
- if( xSet->getPropertyValue("ReducedGradientMode") >>= nValue )
- SetReducedGradientMode( static_cast<PrinterGradientMode>(nValue) );
- if( xSet->getPropertyValue("ReducedGradientStepCount") >>= nValue )
- SetReducedGradientStepCount( static_cast<sal_uInt16>(nValue) );
- if( xSet->getPropertyValue("ReduceBitmaps") >>= bValue )
- SetReduceBitmaps( bValue );
- if( xSet->getPropertyValue("ReducedBitmapMode") >>= nValue )
- SetReducedBitmapMode( static_cast<PrinterBitmapMode>(nValue) );
- if( xSet->getPropertyValue("ReducedBitmapResolution") >>= nValue )
- SetReducedBitmapResolution( static_cast<sal_uInt16>(nValue) );
- if( xSet->getPropertyValue("ReducedBitmapIncludesTransparency") >>= bValue )
- SetReducedBitmapIncludesTransparency( bValue );
- if( xSet->getPropertyValue("ConvertToGreyscales") >>= bValue )
- SetConvertToGreyscales( bValue );
- if( xSet->getPropertyValue("PDFAsStandardPrintJobFormat") >>= bValue )
- SetPDFAsStandardPrintJobFormat( bValue );
-
- bSuccess = true;
- }
- }
- }
- catch( const css::uno::Exception& )
- {
- }
- }
- catch( const css::lang::WrappedTargetException& )
- {
- }
-
- if( ! bSuccess )
- *this = aOldValues;
-}
-
void Printer::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask,
const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel )
@@ -414,7 +323,7 @@ tools::Rectangle Printer::GetBackgroundComponentBounds() const
return tools::Rectangle( aPageOffset, aSize );
}
-void Printer::SetPrinterOptions( const PrinterOptions& i_rOptions )
+void Printer::SetPrinterOptions( const vcl::printer::Options& i_rOptions )
{
*mpPrinterOptions = i_rOptions;
}
@@ -553,7 +462,7 @@ void Printer::ImplInitData()
mpInfoPrinter = nullptr;
mpPrinter = nullptr;
mpDisplayDev = nullptr;
- mpPrinterOptions.reset(new PrinterOptions);
+ mpPrinterOptions.reset(new vcl::printer::Options);
// Add printer to the list
ImplSVData* pSVData = ImplGetSVData();
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index ca3f0c1901a1..4f05a779efb4 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -21,17 +21,18 @@
#include <vcl/metaact.hxx>
#include <vcl/print.hxx>
+#include <vcl/printer/Options.hxx>
#include <utility>
#include <vector>
void Printer::DrawGradientEx( OutputDevice* pOut, const tools::Rectangle& rRect, const Gradient& rGradient )
{
- const PrinterOptions& rPrinterOptions = GetPrinterOptions();
+ const vcl::printer::Options& rPrinterOptions = GetPrinterOptions();
if( rPrinterOptions.IsReduceGradients() )
{
- if( PrinterGradientMode::Stripes == rPrinterOptions.GetReducedGradientMode() )
+ if( vcl::printer::GradientMode::Stripes == rPrinterOptions.GetReducedGradientMode() )
{
if( !rGradient.GetSteps() || ( rGradient.GetSteps() > rPrinterOptions.GetReducedGradientStepCount() ) )
{
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index d4518bba4889..620a00f6e145 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -17,31 +17,33 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <vcl/weld.hxx>
-#include <vcl/print.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/metaact.hxx>
-#include <configsettings.hxx>
-#include <tools/urlobj.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/sequence.hxx>
#include <sal/types.h>
#include <sal/log.hxx>
-#include <tools/debug.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <tools/diagnose_ex.h>
+#include <tools/debug.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/metaact.hxx>
+#include <vcl/print.hxx>
+#include <vcl/printer/Options.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
+
+#include <configsettings.hxx>
#include <printdlg.hxx>
-#include <svdata.hxx>
#include <salinst.hxx>
#include <salprn.hxx>
#include <strings.hrc>
+#include <svdata.hxx>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/ui/dialogs/FilePicker.hpp>
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/view/DuplexMode.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/awt/Size.hpp>
#include <unordered_map>
#include <unordered_set>
@@ -827,7 +829,7 @@ void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter )
void PrinterController::resetPrinterOptions( bool i_bFileOutput )
{
- PrinterOptions aOpt;
+ vcl::printer::Options aOpt;
aOpt.ReadFromConfig( i_bFileOutput );
mpImplData->mxPrinter->SetPrinterOptions( aOpt );
}
@@ -1254,7 +1256,7 @@ DrawModeFlags PrinterController::removeTransparencies( GDIMetaFile const & i_rIn
sal_Int32 nMaxBmpDPIX = mpImplData->mxPrinter->GetDPIX();
sal_Int32 nMaxBmpDPIY = mpImplData->mxPrinter->GetDPIY();
- const PrinterOptions& rPrinterOptions = mpImplData->mxPrinter->GetPrinterOptions();
+ const vcl::printer::Options& rPrinterOptions = mpImplData->mxPrinter->GetPrinterOptions();
static const sal_Int32 OPTIMAL_BMP_RESOLUTION = 300;
static const sal_Int32 NORMAL_BMP_RESOLUTION = 200;
@@ -1262,12 +1264,12 @@ DrawModeFlags PrinterController::removeTransparencies( GDIMetaFile const & i_rIn
if( rPrinterOptions.IsReduceBitmaps() )
{
// calculate maximum resolution for bitmap graphics
- if( PrinterBitmapMode::Optimal == rPrinterOptions.GetReducedBitmapMode() )
+ if( printer::BitmapMode::Optimal == rPrinterOptions.GetReducedBitmapMode() )
{
nMaxBmpDPIX = std::min( sal_Int32(OPTIMAL_BMP_RESOLUTION), nMaxBmpDPIX );
nMaxBmpDPIY = std::min( sal_Int32(OPTIMAL_BMP_RESOLUTION), nMaxBmpDPIY );
}
- else if( PrinterBitmapMode::Normal == rPrinterOptions.GetReducedBitmapMode() )
+ else if( printer::BitmapMode::Normal == rPrinterOptions.GetReducedBitmapMode() )
{
nMaxBmpDPIX = std::min( sal_Int32(NORMAL_BMP_RESOLUTION), nMaxBmpDPIX );
nMaxBmpDPIY = std::min( sal_Int32(NORMAL_BMP_RESOLUTION), nMaxBmpDPIY );
@@ -1288,7 +1290,7 @@ DrawModeFlags PrinterController::removeTransparencies( GDIMetaFile const & i_rIn
}
// disable transparency output
- if( rPrinterOptions.IsReduceTransparency() && ( PrinterTransparencyMode::NONE == rPrinterOptions.GetReducedTransparencyMode() ) )
+ if( rPrinterOptions.IsReduceTransparency() && ( vcl::printer::TransparencyMode::NONE == rPrinterOptions.GetReducedTransparencyMode() ) )
{
mpImplData->mxPrinter->SetDrawMode( mpImplData->mxPrinter->GetDrawMode() | DrawModeFlags::NoTransparency );
}
@@ -1303,7 +1305,7 @@ DrawModeFlags PrinterController::removeTransparencies( GDIMetaFile const & i_rIn
}
mpImplData->mxPrinter->RemoveTransparenciesFromMetaFile( i_rIn, o_rOut, nMaxBmpDPIX, nMaxBmpDPIY,
rPrinterOptions.IsReduceTransparency(),
- rPrinterOptions.GetReducedTransparencyMode() == PrinterTransparencyMode::Auto,
+ rPrinterOptions.GetReducedTransparencyMode() == vcl::printer::TransparencyMode::Auto,
rPrinterOptions.IsReduceBitmaps() && rPrinterOptions.IsReducedBitmapIncludesTransparency(),
aBg
);
diff --git a/vcl/source/printer/Options.cxx b/vcl/source/printer/Options.cxx
new file mode 100644
index 000000000000..bc695622f670
--- /dev/null
+++ b/vcl/source/printer/Options.cxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <comphelper/processfactory.hxx>
+
+#include <vcl/printer/Options.hxx>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+namespace vcl::printer
+{
+void Options::ReadFromConfig(bool i_bFile)
+{
+ bool bSuccess = false;
+ // save old state in case something goes wrong
+ Options aOldValues(*this);
+
+ // get the configuration service
+ css::uno::Reference<css::lang::XMultiServiceFactory> xConfigProvider;
+ css::uno::Reference<css::container::XNameAccess> xConfigAccess;
+ try
+ {
+ // get service provider
+ css::uno::Reference<css::uno::XComponentContext> xContext(
+ comphelper::getProcessComponentContext());
+ // create configuration hierarchical access name
+ try
+ {
+ xConfigProvider = css::configuration::theDefaultProvider::get(xContext);
+
+ css::beans::PropertyValue aVal;
+ aVal.Name = "nodepath";
+ if (i_bFile)
+ aVal.Value <<= OUString("/org.openoffice.Office.Common/Print/Option/File");
+ else
+ aVal.Value <<= OUString("/org.openoffice.Office.Common/Print/Option/Printer");
+ xConfigAccess.set(
+ xConfigProvider->createInstanceWithArguments(
+ "com.sun.star.configuration.ConfigurationAccess", { css::uno::Any(aVal) }),
+ css::uno::UNO_QUERY);
+ if (xConfigAccess.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(xConfigAccess,
+ css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Int32 nValue = 0;
+ bool bValue = false;
+ if (xSet->getPropertyValue("ReduceTransparency") >>= bValue)
+ SetReduceTransparency(bValue);
+ if (xSet->getPropertyValue("ReducedTransparencyMode") >>= nValue)
+ SetReducedTransparencyMode(static_cast<TransparencyMode>(nValue));
+ if (xSet->getPropertyValue("ReduceGradients") >>= bValue)
+ SetReduceGradients(bValue);
+ if (xSet->getPropertyValue("ReducedGradientMode") >>= nValue)
+ SetReducedGradientMode(static_cast<GradientMode>(nValue));
+ if (xSet->getPropertyValue("ReducedGradientStepCount") >>= nValue)
+ SetReducedGradientStepCount(static_cast<sal_uInt16>(nValue));
+ if (xSet->getPropertyValue("ReduceBitmaps") >>= bValue)
+ SetReduceBitmaps(bValue);
+ if (xSet->getPropertyValue("ReducedBitmapMode") >>= nValue)
+ SetReducedBitmapMode(static_cast<BitmapMode>(nValue));
+ if (xSet->getPropertyValue("ReducedBitmapResolution") >>= nValue)
+ SetReducedBitmapResolution(static_cast<sal_uInt16>(nValue));
+ if (xSet->getPropertyValue("ReducedBitmapIncludesTransparency") >>= bValue)
+ SetReducedBitmapIncludesTransparency(bValue);
+ if (xSet->getPropertyValue("ConvertToGreyscales") >>= bValue)
+ SetConvertToGreyscales(bValue);
+ if (xSet->getPropertyValue("PDFAsStandardPrintJobFormat") >>= bValue)
+ SetPDFAsStandardPrintJobFormat(bValue);
+
+ bSuccess = true;
+ }
+ }
+ }
+ catch (const css::uno::Exception&)
+ {
+ }
+ }
+ catch (const css::lang::WrappedTargetException&)
+ {
+ }
+
+ if (!bSuccess)
+ *this = aOldValues;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 32a973a284ac..c6fde48ef28c 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -17,31 +17,31 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <printdlg.hxx>
-#include <svdata.hxx>
-#include <strings.hrc>
-#include <bitmaps.hlst>
+#include <sal/log.hxx>
+#include <osl/diagnose.h>
+#include <rtl/ustrbuf.hxx>
+#include <unotools/localedatawrapper.hxx>
#include <officecfg/Office/Common.hxx>
-#include <vcl/windowstate.hxx>
#include <vcl/QueueInfo.hxx>
#include <vcl/commandevent.hxx>
-#include <vcl/naturalsort.hxx>
-#include <vcl/print.hxx>
-#include <vcl/wall.hxx>
#include <vcl/decoview.hxx>
-#include <configsettings.hxx>
#include <vcl/help.hxx>
-#include <vcl/svapp.hxx>
+#include <vcl/naturalsort.hxx>
+#include <vcl/print.hxx>
+#include <vcl/printer/Options.hxx>
#include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
+#include <vcl/wall.hxx>
#include <vcl/weldutils.hxx>
+#include <vcl/windowstate.hxx>
-#include <unotools/localedatawrapper.hxx>
-
-#include <sal/log.hxx>
-#include <osl/diagnose.h>
-#include <rtl/ustrbuf.hxx>
+#include <bitmaps.hlst>
+#include <configsettings.hxx>
+#include <printdlg.hxx>
+#include <strings.hrc>
+#include <svdata.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 19ec3206287f..aa81b67e6ae7 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -46,6 +46,7 @@
#include <vcl/gdimtf.hxx>
#include <vcl/idle.hxx>
+#include <vcl/printer/Options.hxx>
#include <vcl/print.hxx>
#include <vcl/QueueInfo.hxx>
#include <vcl/pdfwriter.hxx>