LibreOffice Module vcl (master)  1
salprn.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_VCL_INC_SALPRN_HXX
21 #define INCLUDED_VCL_INC_SALPRN_HXX
22 
23 #include <i18nutil/paper.hxx>
24 #include <vcl/prntypes.hxx>
25 #include <vcl/dllapi.h>
26 
27 #include "salptype.hxx"
28 
29 #include <vector>
30 
31 class SalGraphics;
32 class SalFrame;
33 class ImplJobSetup;
34 namespace vcl { class PrinterController; }
35 namespace weld { class Window; }
36 
38 {
39  OUString maPrinterName;
40  OUString maDriver;
41  OUString maLocation;
42  OUString maComment;
44  sal_uInt32 mnJobs;
45  std::unique_ptr<OUString> mpPortName; // only used by Windows backend
46 
49 };
50 
52 {
53 public:
54  std::vector< PaperInfo > m_aPaperFormats; // all printer supported formats
55  bool m_bPapersInit; // set to true after InitPaperFormats
56 
57  SalInfoPrinter() : m_bPapersInit( false ) {}
58  virtual ~SalInfoPrinter();
59 
60  // SalGraphics or NULL, but two Graphics for all SalFrames
61  // must be returned
62  virtual SalGraphics* AcquireGraphics() = 0;
63  virtual void ReleaseGraphics( SalGraphics* pGraphics ) = 0;
64 
65  virtual bool Setup(weld::Window* pFrame, ImplJobSetup* pSetupData) = 0;
66  // This function set the driver data and
67  // set the new indepen data in pSetupData
68  virtual bool SetPrinterData( ImplJobSetup* pSetupData ) = 0;
69  // This function merged the indepen driver data
70  // and set the new indepen data in pSetupData
71  // Only the data must changed, where the bit
72  // in nFlags is set
73  virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) = 0;
74 
75  virtual void GetPageInfo( const ImplJobSetup* pSetupData,
76  long& rOutWidth, long& rOutHeight,
77  Point& rPageOffset,
78  Size& rPaperSize ) = 0;
79  virtual sal_uInt32 GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) = 0;
80  virtual sal_uInt16 GetPaperBinCount( const ImplJobSetup* pSetupData ) = 0;
81  virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) = 0;
82  // fills m_aPaperFormats and sets m_bPapersInit to true
83  virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) = 0;
84  // returns angle that a landscape page will be turned counterclockwise wrt to portrait
85  virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) = 0;
86 };
87 
89 {
90  SalPrinter( const SalPrinter& ) = delete;
91  SalPrinter& operator=( const SalPrinter& ) = delete;
92 
93 public:
95  virtual ~SalPrinter();
96 
97  virtual bool StartJob( const OUString* pFileName,
98  const OUString& rJobName,
99  const OUString& rAppName,
100  sal_uInt32 nCopies,
101  bool bCollate,
102  bool bDirect,
103  ImplJobSetup* pSetupData ) = 0;
104 
105  // implement for pull model print systems only,
106  // default implementations (see salvtables.cxx) just returns false
107  virtual bool StartJob( const OUString* pFileName,
108  const OUString& rJobName,
109  const OUString& rAppName,
110  ImplJobSetup* pSetupData,
111  vcl::PrinterController& rController );
112 
113  virtual bool EndJob() = 0;
114  virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) = 0;
115  virtual void EndPage() = 0;
117 
118 };
119 
120 #endif // INCLUDED_VCL_INC_SALPRN_HXX
121 
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PrinterCapType
Definition: prntypes.hxx:71
std::vector< PaperInfo > m_aPaperFormats
Definition: salprn.hxx:54
OUString maComment
Definition: salprn.hxx:42
OUString maLocation
Definition: salprn.hxx:41
std::unique_ptr< OUString > mpPortName
Definition: salprn.hxx:45
OUString maDriver
Definition: salprn.hxx:40
PrintQueueFlags mnStatus
Definition: salprn.hxx:43
JobSetFlags
Definition: salptype.hxx:27
#define VCL_PLUGIN_PUBLIC
Definition: dllapi.h:40
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:112
PrintQueueFlags
Definition: prntypes.hxx:34
virtual SalPrinterError GetErrorCode()
Definition: salprn.hxx:116
SalPrinter()
Definition: salprn.hxx:94
bool m_bPapersInit
Definition: salprn.hxx:55
SalPrinterError
Definition: salptype.hxx:41
OUString maPrinterName
Definition: salprn.hxx:39
sal_uInt32 mnJobs
Definition: salprn.hxx:44