1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
/* -*- 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 <com/sun/star/awt/XPrinterPropertySet.hpp>
#include <com/sun/star/awt/XPrinterServer2.hpp>
#include <com/sun/star/awt/XInfoPrinter.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <comphelper/uno3.hxx>
#include <vcl/vclptr.hxx>
#include <vcl/jobset.hxx>
namespace com::sun::star::awt { class XPrinter; }
namespace vcl { class OldStylePrintAdaptor; }
class Printer;
// relevant properties for the printer:
/*
sal_Bool Horizontal
sal_uInt16 CopyCount;
sal_Bool Collate;
String FormDescriptor;
sal_uInt16 Orientation; // PORTRAIT, LANDSCAPE
*/
typedef ::cppu::WeakImplHelper < css::awt::XPrinterPropertySet
> VCLXPrinterPropertySet_Base;
class VCLXPrinterPropertySet :public VCLXPrinterPropertySet_Base
,public MutexAndBroadcastHelper
,public ::cppu::OPropertySetHelper
{
protected:
VclPtr<Printer> mxPrinter;
css::uno::Reference< css::awt::XDevice > mxPrnDevice;
sal_Int16 mnOrientation;
bool mbHorizontal;
public:
VCLXPrinterPropertySet( const OUString& rPrinterName );
virtual ~VCLXPrinterPropertySet() override;
Printer* GetPrinter() const { return mxPrinter.get(); }
css::uno::Reference< css::awt::XDevice > const & GetDevice();
// css::uno::XInterface
DECLARE_XINTERFACE();
// css::lang::XTypeProvider
DECLARE_XTYPEPROVIDER();
// css::beans::XPropertySet
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
void SAL_CALL setPropertyValue( const OUString& rPropertyName, const css::uno::Any& aValue ) override { OPropertySetHelper::setPropertyValue( rPropertyName, aValue ); }
css::uno::Any SAL_CALL getPropertyValue( const OUString& rPropertyName ) override { return OPropertySetHelper::getPropertyValue( rPropertyName ); }
void SAL_CALL addPropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { OPropertySetHelper::addPropertyChangeListener( rPropertyName, rxListener ); }
void SAL_CALL removePropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { OPropertySetHelper::removePropertyChangeListener( rPropertyName, rxListener ); }
void SAL_CALL addVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { OPropertySetHelper::addVetoableChangeListener( rPropertyName, rxListener ); }
void SAL_CALL removeVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { OPropertySetHelper::removeVetoableChangeListener( rPropertyName, rxListener ); }
// ::cppu::OPropertySetHelper
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any & rConvertedValue, css::uno::Any & rOldValue, sal_Int32 nHandle, const css::uno::Any& rValue ) override;
void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
using cppu::OPropertySetHelper::getFastPropertyValue;
void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override;
// css::awt::XPrinterPropertySet
void SAL_CALL setHorizontal( sal_Bool bHorizontal ) override;
css::uno::Sequence< OUString > SAL_CALL getFormDescriptions( ) override;
void SAL_CALL selectForm( const OUString& aFormDescription ) override;
css::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) override;
void SAL_CALL setBinarySetup( const css::uno::Sequence< sal_Int8 >& data ) override;
};
typedef ::cppu::ImplInheritanceHelper < VCLXPrinterPropertySet
, css::awt::XPrinter
> VCLXPrinter_Base;
class VCLXPrinter final : public VCLXPrinter_Base
{
std::shared_ptr<vcl::OldStylePrintAdaptor> mxListener;
JobSetup maInitJobSetup;
public:
VCLXPrinter( const OUString& rPrinterName );
virtual ~VCLXPrinter() override;
// css::beans::XPropertySet
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override { return VCLXPrinterPropertySet::getPropertySetInfo(); }
void SAL_CALL setPropertyValue( const OUString& rPropertyName, const css::uno::Any& aValue ) override { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); }
css::uno::Any SAL_CALL getPropertyValue( const OUString& rPropertyName ) override { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); }
void SAL_CALL addPropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); }
void SAL_CALL removePropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); }
void SAL_CALL addVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); }
void SAL_CALL removeVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); }
// css::awt::XPrinterPropertySet
void SAL_CALL setHorizontal( sal_Bool bHorizontal ) override { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); }
css::uno::Sequence< OUString > SAL_CALL getFormDescriptions( ) override { return VCLXPrinterPropertySet::getFormDescriptions(); }
void SAL_CALL selectForm( const OUString& aFormDescription ) override { VCLXPrinterPropertySet::selectForm( aFormDescription ); }
css::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) override { return VCLXPrinterPropertySet::getBinarySetup(); }
void SAL_CALL setBinarySetup( const css::uno::Sequence< sal_Int8 >& data ) override { VCLXPrinterPropertySet::setBinarySetup( data ); }
// css::awt::XPrinter
sal_Bool SAL_CALL start( const OUString& nJobName, sal_Int16 nCopies, sal_Bool nCollate ) override;
void SAL_CALL end( ) override;
void SAL_CALL terminate( ) override;
css::uno::Reference< css::awt::XDevice > SAL_CALL startPage( ) override;
void SAL_CALL endPage( ) override;
};
typedef ::cppu::ImplInheritanceHelper < VCLXPrinterPropertySet
, css::awt::XInfoPrinter
> VCLXInfoPrinter_Base;
class VCLXInfoPrinter final : public VCLXInfoPrinter_Base
{
public:
VCLXInfoPrinter( const OUString& rPrinterName );
virtual ~VCLXInfoPrinter() override;
// css::beans::XPropertySet
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override { return VCLXPrinterPropertySet::getPropertySetInfo(); }
void SAL_CALL setPropertyValue( const OUString& rPropertyName, const css::uno::Any& aValue ) override { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); }
css::uno::Any SAL_CALL getPropertyValue( const OUString& rPropertyName ) override { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); }
void SAL_CALL addPropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); }
void SAL_CALL removePropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); }
void SAL_CALL addVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); }
void SAL_CALL removeVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); }
// css::awt::XPrinterPropertySet
void SAL_CALL setHorizontal( sal_Bool bHorizontal ) override { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); }
css::uno::Sequence< OUString > SAL_CALL getFormDescriptions( ) override { return VCLXPrinterPropertySet::getFormDescriptions(); }
void SAL_CALL selectForm( const OUString& aFormDescription ) override { VCLXPrinterPropertySet::selectForm( aFormDescription ); }
css::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) override { return VCLXPrinterPropertySet::getBinarySetup(); }
void SAL_CALL setBinarySetup( const css::uno::Sequence< sal_Int8 >& data ) override { VCLXPrinterPropertySet::setBinarySetup( data ); }
// css::awt::XInfoPrinter
css::uno::Reference< css::awt::XDevice > SAL_CALL createDevice( ) override;
};
typedef ::cppu::WeakImplHelper < css::awt::XPrinterServer2,
css::lang::XServiceInfo
> VCLXPrinterServer_Base;
class VCLXPrinterServer final : public VCLXPrinterServer_Base
{
public:
// css::awt::XPrinterServer2
css::uno::Sequence< OUString > SAL_CALL getPrinterNames( ) override;
OUString SAL_CALL getDefaultPrinterName() override;
css::uno::Reference< css::awt::XPrinter > SAL_CALL createPrinter( const OUString& printerName ) override;
css::uno::Reference< css::awt::XInfoPrinter > SAL_CALL createInfoPrinter( const OUString& printerName ) override;
OUString SAL_CALL getImplementationName() override;
sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|