summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2016-03-28 02:29:30 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2016-03-28 02:33:11 +1100
commit6b2889b3c4b2da175c4f95bde4495a1a89deedc3 (patch)
treed3ad82de07744b693c1bbe775af920716781a6d2 /vcl
parentc85a438f412f32a94f8e872ed7b419b9f7667d6e (diff)
vcl: two printing headers should be private Unix headers
Change-Id: I17a8d361b6c24dd9c4853d82e788c48084133e69
Diffstat (limited to 'vcl')
-rw-r--r--vcl/headless/svpprn.cxx2
-rw-r--r--vcl/inc/headless/svpprn.hxx2
-rw-r--r--vcl/inc/unx/cupsmgr.hxx2
-rw-r--r--vcl/inc/unx/genprn.h2
-rw-r--r--vcl/inc/unx/jobdata.hxx87
-rw-r--r--vcl/inc/unx/printerinfomanager.hxx205
-rw-r--r--vcl/inc/unx/printerjob.hxx2
-rw-r--r--vcl/null/printerinfomanager.cxx2
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx2
-rw-r--r--vcl/unx/generic/plugadapt/salplug.cxx2
-rw-r--r--vcl/unx/generic/print/common_gfx.cxx2
-rw-r--r--vcl/unx/generic/print/genprnpsp.cxx2
-rw-r--r--vcl/unx/generic/print/genpspgraphics.cxx4
-rw-r--r--vcl/unx/generic/print/printerjob.cxx2
-rw-r--r--vcl/unx/generic/print/prtsetup.hxx2
-rw-r--r--vcl/unx/generic/printer/jobdata.cxx4
-rw-r--r--vcl/unx/generic/window/salframe.cxx2
17 files changed, 309 insertions, 17 deletions
diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx
index 1d8557f6fc24..3cc36244e487 100644
--- a/vcl/headless/svpprn.cxx
+++ b/vcl/headless/svpprn.cxx
@@ -19,7 +19,7 @@
#include <vcl/svapp.hxx>
#include <vcl/timer.hxx>
-#include <vcl/printerinfomanager.hxx>
+#include "unx/printerinfomanager.hxx"
#include "jobset.h"
#include "print.h"
diff --git a/vcl/inc/headless/svpprn.hxx b/vcl/inc/headless/svpprn.hxx
index 1c6d05d2069d..b23aec9b07fc 100644
--- a/vcl/inc/headless/svpprn.hxx
+++ b/vcl/inc/headless/svpprn.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_VCL_INC_HEADLESS_SVPPRN_HXX
#define INCLUDED_VCL_INC_HEADLESS_SVPPRN_HXX
-#include <vcl/jobdata.hxx>
+#include "unx/jobdata.hxx"
#include "unx/printergfx.hxx"
#include "unx/printerjob.hxx"
#include "unx/genprn.h"
diff --git a/vcl/inc/unx/cupsmgr.hxx b/vcl/inc/unx/cupsmgr.hxx
index 576afd4fe3cc..52c8a8a67b3f 100644
--- a/vcl/inc/unx/cupsmgr.hxx
+++ b/vcl/inc/unx/cupsmgr.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_VCL_INC_UNX_CUPSMGR_HXX
#define INCLUDED_VCL_INC_UNX_CUPSMGR_HXX
-#include <vcl/printerinfomanager.hxx>
+#include "unx/printerinfomanager.hxx"
#include "osl/module.h"
#include "osl/thread.h"
#include "osl/mutex.hxx"
diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h
index 94a4046a08a0..c1f299016193 100644
--- a/vcl/inc/unx/genprn.h
+++ b/vcl/inc/unx/genprn.h
@@ -20,7 +20,7 @@
#ifndef INCLUDED_VCL_INC_GENERIC_GENPRN_H
#define INCLUDED_VCL_INC_GENERIC_GENPRN_H
-#include <vcl/jobdata.hxx>
+#include "unx/jobdata.hxx"
#include "unx/printergfx.hxx"
#include "unx/printerjob.hxx"
#include "salprn.hxx"
diff --git a/vcl/inc/unx/jobdata.hxx b/vcl/inc/unx/jobdata.hxx
new file mode 100644
index 000000000000..13b34de93320
--- /dev/null
+++ b/vcl/inc/unx/jobdata.hxx
@@ -0,0 +1,87 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_VCL_JOBDATA_HXX
+#define INCLUDED_VCL_JOBDATA_HXX
+
+#include <vcl/ppdparser.hxx>
+
+namespace psp {
+
+namespace orientation {
+enum type {
+ Portrait,
+ Landscape
+};
+}
+
+struct VCL_DLLPUBLIC JobData
+{
+ int m_nCopies;
+ bool m_bCollate;
+ int m_nLeftMarginAdjust;
+ int m_nRightMarginAdjust;
+ int m_nTopMarginAdjust;
+ int m_nBottomMarginAdjust;
+ // user overrides for PPD
+ int m_nColorDepth;
+ int m_nPSLevel; // 0: no override, else languagelevel to use
+ int m_nColorDevice; // 0: no override, -1 grey scale, +1 color
+ int m_nPDFDevice; // 0: no override, -1 PostScript, +1: Automatically PDF, +2: Explicitly PDF
+ orientation::type m_eOrientation;
+ OUString m_aPrinterName;
+ const PPDParser* m_pParser;
+ PPDContext m_aContext;
+
+ JobData() :
+ m_nCopies( 1 ),
+ m_bCollate(false),
+ m_nLeftMarginAdjust( 0 ),
+ m_nRightMarginAdjust( 0 ),
+ m_nTopMarginAdjust( 0 ),
+ m_nBottomMarginAdjust( 0 ),
+ m_nColorDepth( 24 ),
+ m_nPSLevel( 0 ),
+ m_nColorDevice( 0 ),
+ m_nPDFDevice( 0 ),
+ m_eOrientation( orientation::Portrait ),
+ m_pParser( nullptr ) {}
+
+ JobData& operator=(const psp::JobData& rRight);
+
+ JobData( const JobData& rData ) { *this = rData; }
+
+ void setCollate( bool bCollate );
+ bool setPaper( int nWidth, int nHeight ); // dimensions in pt
+ bool setPaperBin( int nPaperBin );
+ void resolveDefaultBackend();
+ void setDefaultBackend(bool bUsePDF);
+
+ // creates a new buffer using new
+ // it is up to the user to delete it again
+ bool getStreamBuffer( void*& pData, sal_uInt32& bytes );
+ static bool constructFromStreamBuffer( void* pData, sal_uInt32 bytes, JobData& rJobData );
+};
+
+} // namespace
+
+
+#endif // PSPRINT_JOBDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/printerinfomanager.hxx b/vcl/inc/unx/printerinfomanager.hxx
new file mode 100644
index 000000000000..8e4b493e8daa
--- /dev/null
+++ b/vcl/inc/unx/printerinfomanager.hxx
@@ -0,0 +1,205 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_VCL_PRINTERINFOMANAGER_HXX
+#define INCLUDED_VCL_PRINTERINFOMANAGER_HXX
+
+#include <list>
+#include <unordered_map>
+
+#include <vcl/dllapi.h>
+#include <vcl/helper.hxx>
+#include "unx/jobdata.hxx"
+#include <osl/file.hxx>
+
+#include <cstdio>
+
+namespace psp
+{
+
+class SystemQueueInfo;
+
+struct PrinterInfo : JobData
+{
+ // basename of PPD
+ OUString m_aDriverName;
+ // can be the queue
+ OUString m_aLocation;
+ // a user defined comment
+ OUString m_aComment;
+ // a command line to pipe a PS-file to
+ OUString m_aCommand;
+ // a command line to pipe a PS-file to in case of direct print
+ OUString m_aQuickCommand;
+ // a list of special features separated by ',' not used by psprint
+ // but assigned from the outside (currently for "fax","pdf=","autoqueue","external_dialog")
+ OUString m_aFeatures;
+ bool m_bPapersizeFromSetup;
+
+ PrinterInfo()
+ : JobData()
+ , m_bPapersizeFromSetup(false)
+ {}
+};
+
+class VCL_DLLPUBLIC PrinterInfoManager
+{
+public:
+ enum Type { Default = 0, CUPS = 1 };
+
+ struct SystemPrintQueue
+ {
+ OUString m_aQueue;
+ OUString m_aLocation;
+ OUString m_aComment;
+ };
+protected:
+ // needed for checkPrintersChanged: files (not necessarily existent)
+ // and their last known modification time
+ struct WatchFile
+ {
+ // the file in question
+ OUString m_aFilePath;
+ // the last know modification time or 0, if file did not exist
+ TimeValue m_aModified;
+ };
+
+ // internal data to describe a printer
+ struct Printer
+ {
+ // configuration file containing this printer
+ // empty means a freshly added printer that has to be saved yet
+ OUString m_aFile;
+ // details other config files that have this printer
+ // in case of removal all have to be removed
+ std::list< OUString > m_aAlternateFiles;
+ // group in m_aFile containing the printer
+ // this must be unique over all configuration files
+ // it usually should be the printer name
+ OString m_aGroup;
+ // whether changes need to be saved
+ bool m_bModified;
+ // the corresponding info and job data
+ PrinterInfo m_aInfo;
+ };
+
+ std::unordered_map< OUString, Printer, OUStringHash > m_aPrinters;
+ PrinterInfo m_aGlobalDefaults;
+ std::list< WatchFile > m_aWatchFiles;
+ OUString m_aDefaultPrinter;
+ OUString m_aSystemPrintCommand;
+
+ std::list< SystemPrintQueue > m_aSystemPrintQueues;
+
+ SystemQueueInfo* m_pQueueInfo;
+
+ Type m_eType;
+ bool m_bUseIncludeFeature;
+ bool m_bUseJobPatch;
+ OUString m_aSystemDefaultPaper;
+
+ PrinterInfoManager( Type eType = Default );
+
+ virtual void initialize();
+
+ // fill default paper if not configured in config file
+ // default paper is e.g. locale dependent
+ // if a paper is already set it will not be overwritten
+ void setDefaultPaper( PPDContext& rInfo ) const;
+
+ void initSystemDefaultPaper();
+public:
+
+ // there can only be one
+ static PrinterInfoManager& get();
+ // only called by SalData destructor, frees the global instance
+ static void release();
+
+ // get PrinterInfoManager type
+ Type getType() const { return m_eType; }
+
+ // lists the names of all known printers
+ void listPrinters( std::list< OUString >& rList ) const;
+
+ // gets info about a named printer
+ const PrinterInfo& getPrinterInfo( const OUString& rPrinter ) const;
+
+ // gets the name of the default printer
+ const OUString& getDefaultPrinter() const { return m_aDefaultPrinter; }
+
+ virtual void setupJobContextData( JobData& rData );
+
+ // changes the info about a named printer
+ virtual void changePrinterInfo( const OUString& rPrinter, const PrinterInfo& rNewInfo );
+
+ // check if the printer configuration has changed
+ // if bwait is true, then this method waits for eventual asynchronous
+ // printer discovery to finish
+ virtual bool checkPrintersChanged( bool bWait );
+
+ // members for administration
+
+ // add a named printer
+ // addPrinter fails if a printer with the same name already exists
+ // or the driver does not exist
+ virtual bool addPrinter( const OUString& rPrinterName, const OUString& rDriverName );
+
+ // remove a named printer
+ // this fails if the config file belonging to this printer
+ // is not writeable
+ // if bCheckOnly is true, the printer is not really removed;
+ // this is for checking if the removal would fail
+ virtual bool removePrinter( const OUString& rPrinterName, bool bCheckOnly = false );
+
+ // save the changes to all printers. this fails if there
+ // is no writable config file at all
+ virtual bool writePrinterConfig();
+
+ // set a new default printer
+ // fails if the specified printer does not exist
+ virtual bool setDefaultPrinter( const OUString& rPrinterName );
+
+ // primarily used internally
+ // returns the printer queue names
+ const std::list< SystemPrintQueue >& getSystemPrintQueues();
+
+ // abstract print command
+ // returns a stdio FILE* that a postscript file may be written to
+ // this may either be a regular file or the result of popen()
+ virtual FILE* startSpool( const OUString& rPrinterName, bool bQuickCommand );
+ // close the FILE* returned by startSpool and does the actual spooling
+ // set bBanner to "false" will attempt to suppress banner printing
+ // set bBanner to "true" will rely on the system default
+ // returns true on success
+ virtual bool endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const OUString &rFaxNumber );
+
+ bool getUseIncludeFeature() const { return m_bUseIncludeFeature; }
+ bool getUseJobPatch() const { return m_bUseJobPatch; }
+
+ // check whether a printer's feature string contains a subfeature
+ bool checkFeatureToken( const OUString& rPrinterName, const char* pToken ) const;
+
+ virtual ~PrinterInfoManager();
+};
+
+} // namespace
+
+#endif // INCLUDED_VCL_PRINTERINFOMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/printerjob.hxx b/vcl/inc/unx/printerjob.hxx
index 8f283cdaff1d..3bb214bccf60 100644
--- a/vcl/inc/unx/printerjob.hxx
+++ b/vcl/inc/unx/printerjob.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_VCL_INC_GENERIC_PRINTERJOB_HXX
#define INCLUDED_VCL_INC_GENERIC_PRINTERJOB_HXX
-#include <vcl/jobdata.hxx>
+#include "unx/jobdata.hxx"
#include "osl/file.hxx"
#include "rtl/string.hxx"
diff --git a/vcl/null/printerinfomanager.cxx b/vcl/null/printerinfomanager.cxx
index e79701e0cdbb..4be5efb5e5f6 100644
--- a/vcl/null/printerinfomanager.cxx
+++ b/vcl/null/printerinfomanager.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <vcl/printerinfomanager.hxx>
+#include "unx/printerinfomanager.hxx"
#include "unx/gendata.hxx"
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index b470eff7052a..3bc93f3b0c84 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -41,7 +41,7 @@
#include "basegfx/polygon/b2dpolypolygoncutter.hxx"
#include "basegfx/polygon/b2dtrapezoid.hxx"
-#include <vcl/jobdata.hxx>
+#include "unx/jobdata.hxx"
#include <vcl/virdev.hxx>
#include "unx/salunx.h"
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx b/vcl/unx/generic/plugadapt/salplug.cxx
index 6852c0652024..adb46eb501da 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -28,7 +28,7 @@
#include "unx/gendata.hxx"
#include "headless/svpinst.hxx"
#include "unx/desktops.hxx"
-#include <vcl/printerinfomanager.hxx>
+#include "unx/printerinfomanager.hxx"
#include <config_vclplug.h>
#include <cstdio>
diff --git a/vcl/unx/generic/print/common_gfx.cxx b/vcl/unx/generic/print/common_gfx.cxx
index e8cfadafce76..5a8df567ff5f 100644
--- a/vcl/unx/generic/print/common_gfx.cxx
+++ b/vcl/unx/generic/print/common_gfx.cxx
@@ -28,7 +28,7 @@
#include "unx/printerjob.hxx"
#include "unx/fontmanager.hxx"
#include <vcl/strhelper.hxx>
-#include <vcl/printerinfomanager.hxx>
+#include "unx/printerinfomanager.hxx"
#include "tools/debug.hxx"
#include "tools/color.hxx"
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index 45e3e16fa40e..7deff32e84ea 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -47,7 +47,7 @@
#include <vcl/svapp.hxx>
#include <vcl/print.hxx>
#include <vcl/pdfwriter.hxx>
-#include <vcl/printerinfomanager.hxx>
+#include "unx/printerinfomanager.hxx"
#include <vcl/settings.hxx>
#include "svids.hrc"
#include "saldatabasic.hxx"
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 85b6f17cfe3b..e1022a68e128 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -35,8 +35,8 @@
#include <comphelper/string.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <vcl/bitmapaccess.hxx>
-#include <vcl/jobdata.hxx>
-#include <vcl/printerinfomanager.hxx>
+#include "unx/jobdata.hxx"
+#include "unx/printerinfomanager.hxx"
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/sysdata.hxx>
diff --git a/vcl/unx/generic/print/printerjob.cxx b/vcl/unx/generic/print/printerjob.cxx
index 9266c820a584..1e37dfc806be 100644
--- a/vcl/unx/generic/print/printerjob.cxx
+++ b/vcl/unx/generic/print/printerjob.cxx
@@ -30,7 +30,7 @@
#include "unx/printergfx.hxx"
#include <vcl/ppdparser.hxx>
#include <vcl/strhelper.hxx>
-#include <vcl/printerinfomanager.hxx>
+#include "unx/printerinfomanager.hxx"
#include "rtl/ustring.hxx"
#include "rtl/strbuf.hxx"
diff --git a/vcl/unx/generic/print/prtsetup.hxx b/vcl/unx/generic/print/prtsetup.hxx
index 3d02468658d7..2bbc513c276a 100644
--- a/vcl/unx/generic/print/prtsetup.hxx
+++ b/vcl/unx/generic/print/prtsetup.hxx
@@ -32,7 +32,7 @@
#include <vcl/field.hxx>
#include <vcl/combobox.hxx>
#include <vcl/ppdparser.hxx>
-#include <vcl/printerinfomanager.hxx>
+#include "unx/printerinfomanager.hxx"
class RTSPaperPage;
class RTSDevicePage;
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index aead34c96eb1..b4e3e1a03481 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -18,8 +18,8 @@
*/
#include <officecfg/Office/Common.hxx>
-#include <vcl/jobdata.hxx>
-#include <vcl/printerinfomanager.hxx>
+#include "unx/jobdata.hxx"
+#include "unx/printerinfomanager.hxx"
#include "tools/stream.hxx"
#include <rtl/strbuf.hxx>
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index a8e0cabf7bba..046cc89a4552 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -31,7 +31,7 @@
#include <vcl/svapp.hxx>
#include <vcl/keycodes.hxx>
#include <vcl/layout.hxx>
-#include <vcl/printerinfomanager.hxx>
+#include "unx/printerinfomanager.hxx"
#include <vcl/settings.hxx>
#include <vcl/bitmapaccess.hxx>
#include <vcl/opengl/OpenGLContext.hxx>