summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/print.cxx
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2021-09-01 02:19:27 +1000
committerMike Kaganski <mike.kaganski@collabora.com>2021-09-07 17:59:47 +0200
commit7228a2dbfa11cd846678aaacd248c68adcda5f34 (patch)
tree5a81fa7d3f225952747c2982d4a8baf2bd17817d /vcl/source/gdi/print.cxx
parentb42516b433c1d71487db061a058887f6dd76dd74 (diff)
vcl: rename PrinterOptions to vcl::printer::Options
Move Options to own source and header files. Options moved to own source and header files, however also put Options into vcl::printer namespace. I have renamed and moved PrinterOptions into the vcl::printer namespace because the word "Printer" is redundant, and we want to organize the vcl namespace better. Change-Id: I2ef188af381dd65907d48f7b190e4ab69417606d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121389 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'vcl/source/gdi/print.cxx')
-rw-r--r--vcl/source/gdi/print.cxx117
1 files changed, 13 insertions, 104 deletions
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();