blob: 2ad3a4f94c067fba91d68dde953fda493a3b98d9 (
plain)
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
|
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
//
// File Name:
//
// xpsrasfilter.h
//
// Abstract:
//
// Xps Rasterization Service sample filter definition. The
// XPSRasFilter provides the interface to the filter pipeline manager.
//
#pragma once
namespace xpsrasfilter
{
//
// Class to maintain the shared state of operation between multiple components
// of the filter. Also provides the callback for the Xps Rasterization Service.
//
class FilterLiveness : public UnknownBase<IXpsRasterizerNotificationCallback>
{
public:
FilterLiveness() :
m_isAlive(TRUE)
{}
virtual
~FilterLiveness() {}
BOOL
IsAlive()
{
return m_isAlive;
}
void
Cancel()
{
//
// May be called from a different thread
//
m_isAlive = FALSE;
}
//
// IXpsRasterizerNotificationCallback Method
//
virtual _Must_inspect_result_
HRESULT STDMETHODCALLTYPE
Continue()
{
return (m_isAlive) ? (S_OK) : (HRESULT_FROM_WIN32(ERROR_PRINT_CANCELLED));
}
private:
volatile BOOL m_isAlive;
//
// prevent copy semantics
//
FilterLiveness(const FilterLiveness&);
FilterLiveness& operator=(const FilterLiveness&);
};
class XPSRasFilter : public UnknownBase<IPrintPipelineFilter>
{
public:
static LONG ms_numObjects; // Number of instances of XPSRasFilter
XPSRasFilter();
virtual
~XPSRasFilter();
//
// IPrintPipelineFilter Methods
//
virtual _Must_inspect_result_
HRESULT STDMETHODCALLTYPE
InitializeFilter(
_In_ IInterFilterCommunicator *pICommunicator,
_In_ IPrintPipelinePropertyBag *pIPropertyBag,
_In_ IPrintPipelineManagerControl *pIPipelineControl
);
virtual _Must_inspect_result_
HRESULT STDMETHODCALLTYPE
ShutdownOperation();
virtual _Must_inspect_result_
HRESULT STDMETHODCALLTYPE
StartOperation();
private:
//
// prevent copy semantics
//
XPSRasFilter(const XPSRasFilter&);
XPSRasFilter& operator=(const XPSRasFilter&);
//
// Xps package part reader
//
IXpsDocumentProvider_t m_pReader;
IPrintWriteStream_t m_pWriter;
//
// Pipeline Property Bag
//
IPrintPipelinePropertyBag_t m_pIPropertyBag;
//
// IPrintPipelineFilter Methods (throwing)
//
VOID
StartOperation_throws();
VOID
InitializeFilter_throws(
const IInterFilterCommunicator_t &pICommunicator,
const IPrintPipelinePropertyBag_t &pIPropertyBag
);
//
// Keeps track of whether the operation has been cancelled
//
FilterLiveness_t m_pLiveness;
};
} // namespace xpsrasfilter
|