LibreOffice Module shell (master) 1
ooofilt.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_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_OOOFILT_HXX
21#define INCLUDED_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_OOOFILT_HXX
22
23#include <types.hxx>
24
25//+-------------------------------------------------------------------------
26// Contents: LibreOffice filter declarations
27// Platform: Windows 2000, Windows XP
28
29//+-------------------------------------------------------------------------
30
31class CContentReader;
32class CMetaInfoReader;
33class CFullPropSpec;
34
35LONG g_lInstances = 0; // Global count of COooFilter and COooFilterCF instances
36GUID const guidStorage = PSGUID_STORAGE; // GUID for storage property set
37
38//C-------------------------------------------------------------------------
39// Class: COooFilter
40// Purpose: Implements interfaces of LibreOffice filter
41
42// OooFilter Class ID
43// {7BC0E710-5703-45be-A29D-5D46D8B39262}
44GUID const CLSID_COooFilter =
45{
46 0x7bc0e710,
47 0x5703,
48 0x45be,
49 { 0xa2, 0x9d, 0x5d, 0x46, 0xd8, 0xb3, 0x92, 0x62 }
50};
51
52// LibreOffice Persistent Handler Class ID
53// {7BC0E713-5703-45be-A29D-5D46D8B39262}
55{0x7bc0e713, 0x5703, 0x45be, {0xa2, 0x9d, 0x5d, 0x46, 0xd8, 0xb3, 0x92, 0x62}};
56
57// LibreOffice Persistent Handler Addin Registered Class ID
58// {89BCB740-6119-101A-BCB7-00DD010655AF}
60{0x89bcb740, 0x6119, 0x101a, {0xbc, 0xb7, 0x00, 0xdd, 0x01, 0x06, 0x55, 0xaf}};
61
62// LibreOffice Filter Handler Class ID
63// {7BC0E710-5703-45be-A29D-5D46D8B39262}
65{0x7bc0e710, 0x5703, 0x45be, {0xa2, 0x9d, 0x5d, 0x46, 0xd8, 0xb3, 0x92, 0x62}};
66
67enum class FilterState
68{
69 FilteringContent, // Filtering the content property
70 FilteringProperty // Filtering the pseudo property
71};
72class COooFilter : public IFilter, public IPersistFile, public IPersistStream
73{
74public:
75 // From IUnknown
76 virtual HRESULT STDMETHODCALLTYPE QueryInterface(
77 REFIID riid,
78 void ** ppvObject) override;
79 virtual ULONG STDMETHODCALLTYPE AddRef() override;
80 virtual ULONG STDMETHODCALLTYPE Release() override;
81
82 // From IFilter
83 virtual SCODE STDMETHODCALLTYPE Init(
84 ULONG grfFlags,
85 ULONG cAttributes,
86 FULLPROPSPEC const * aAttributes,
87 ULONG * pFlags) override;
88 virtual SCODE STDMETHODCALLTYPE GetChunk(
89 STAT_CHUNK * pStat) override;
90 virtual SCODE STDMETHODCALLTYPE GetText(
91 ULONG * pcwcBuffer,
92 WCHAR * awcBuffer) override;
93
94 virtual SCODE STDMETHODCALLTYPE GetValue(
95 PROPVARIANT ** ppPropValue) override;
96
97 virtual SCODE STDMETHODCALLTYPE BindRegion(
98 FILTERREGION origPos,
99 REFIID riid,
100 void ** ppunk) override;
101
102 // From IPersistFile
103 virtual HRESULT STDMETHODCALLTYPE GetClassID(
104 CLSID * pClassID) override;
105 virtual HRESULT STDMETHODCALLTYPE IsDirty() override;
106 virtual HRESULT STDMETHODCALLTYPE Load(
107 LPCOLESTR pszFileName,
108 DWORD dwMode) override;
109 virtual HRESULT STDMETHODCALLTYPE Save(
110 LPCOLESTR pszFileName,
111 BOOL fRemember) override;
112
113 virtual HRESULT STDMETHODCALLTYPE SaveCompleted(
114 LPCOLESTR pszFileName) override;
115
116 virtual HRESULT STDMETHODCALLTYPE GetCurFile(
117 LPOLESTR * ppszFileName) override;
118
119 // From IPersistStream
120 virtual HRESULT STDMETHODCALLTYPE Load(
121 IStream *pStm) override;
122
123 virtual HRESULT STDMETHODCALLTYPE Save(
124 IStream *pStm,
125 BOOL fClearDirty) override;
126
127 virtual HRESULT STDMETHODCALLTYPE GetSizeMax(
128 ULARGE_INTEGER *pcbSize) override;
129
130
131private:
132 friend class COooFilterCF;
133
134 COooFilter();
135 virtual ~COooFilter();
136
137 LONG m_lRefs; // Reference count
138 CContentReader * m_pContentReader; // A content reader that retrieves document content.
139 CMetaInfoReader * m_pMetaInfoReader; // A metainfo reader that retrieves document metainfo.
140 FilterState m_eState; // State of filtering
141 ::std::wstring m_pwszFileName; // Name of input file to filter
142 ULONG m_ulUnicodeBufferLen; // UNICODE Characters read from file to chunk buffer
143 ULONG m_ulUnicodeCharsRead; // UNICODE Characters read from chunk buffer
144 ULONG m_ulPropertyNum; // Number of properties that has been processed
145 ULONG m_ulCurrentPropertyNum; // Current Property that is processing;
146 ULONG m_ulChunkID; // Current chunk id
147 bool m_fContents; // TRUE if contents requested
148 bool m_fEof; // TRUE if end of file reached
149 ::std::wstring m_pwsBuffer; // Buffer to save UNICODE content from ChunkBuffer.
150 ULONG m_ChunkPosition; // Chunk pointer to specify the current Chunk;
151 ULONG m_cAttributes; // Count of attributes
152 CFullPropSpec * m_pAttributes; // Attributes to filter
154
155};
156
157//C-------------------------------------------------------------------------
158// Class: COooFilterCF
159// Purpose: Implements class factory for LibreOffice filter
160
161
162class COooFilterCF : public IClassFactory
163{
164public:
165 // From IUnknown
166 virtual HRESULT STDMETHODCALLTYPE QueryInterface(
167 REFIID riid,
168 void ** ppvObject) override;
169
170 virtual ULONG STDMETHODCALLTYPE AddRef() override;
171 virtual ULONG STDMETHODCALLTYPE Release() override;
172
173 // From IClassFactory
174 virtual HRESULT STDMETHODCALLTYPE CreateInstance(
175 IUnknown * pUnkOuter,
176 REFIID riid, void ** ppvObject) override;
177
178 virtual HRESULT STDMETHODCALLTYPE LockServer(
179 BOOL fLock) override;
180
181private:
182 friend HRESULT STDMETHODCALLTYPE DllGetClassObject(
183 REFCLSID cid,
184 REFIID iid,
185 LPVOID * ppvObj);
186
187 COooFilterCF();
188 virtual ~COooFilterCF();
189
190 LONG m_lRefs; // Reference count
191};
192
193#endif // INCLUDED_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_OOOFILT_HXX
194
195/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
friend HRESULT STDMETHODCALLTYPE DllGetClassObject(REFCLSID cid, REFIID iid, LPVOID *ppvObj)
Definition: ooofilt.cxx:873
virtual ULONG STDMETHODCALLTYPE AddRef() override
Definition: ooofilt.cxx:744
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject) override
Definition: ooofilt.cxx:721
virtual HRESULT STDMETHODCALLTYPE CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject) override
Definition: ooofilt.cxx:783
virtual ULONG STDMETHODCALLTYPE Release() override
Definition: ooofilt.cxx:754
virtual ~COooFilterCF()
Definition: ooofilt.cxx:705
virtual HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock) override
Definition: ooofilt.cxx:819
LONG m_lRefs
Definition: ooofilt.hxx:190
COooFilter()
Definition: ooofilt.cxx:77
ULONG m_ulUnicodeCharsRead
Definition: ooofilt.hxx:143
virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize) override
Definition: ooofilt.cxx:644
virtual ULONG STDMETHODCALLTYPE Release() override
Definition: ooofilt.cxx:164
CContentReader * m_pContentReader
Definition: ooofilt.hxx:138
CFullPropSpec * m_pAttributes
Definition: ooofilt.hxx:152
CMetaInfoReader * m_pMetaInfoReader
Definition: ooofilt.hxx:139
virtual SCODE STDMETHODCALLTYPE Init(ULONG grfFlags, ULONG cAttributes, FULLPROPSPEC const *aAttributes, ULONG *pFlags) override
Definition: ooofilt.cxx:196
ULONG m_ChunkPosition
Definition: ooofilt.hxx:150
virtual SCODE STDMETHODCALLTYPE GetValue(PROPVARIANT **ppPropValue) override
Definition: ooofilt.cxx:461
virtual SCODE STDMETHODCALLTYPE GetText(ULONG *pcwcBuffer, WCHAR *awcBuffer) override
Definition: ooofilt.cxx:398
ULONG m_cAttributes
Definition: ooofilt.hxx:151
bool m_fEof
Definition: ooofilt.hxx:148
::std::wstring m_pwszFileName
Definition: ooofilt.hxx:141
FilterState m_eState
Definition: ooofilt.hxx:140
virtual HRESULT STDMETHODCALLTYPE IsDirty() override
Definition: ooofilt.cxx:537
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject) override
Definition: ooofilt.cxx:124
virtual SCODE STDMETHODCALLTYPE GetChunk(STAT_CHUNK *pStat) override
Definition: ooofilt.cxx:304
ULONG m_ulChunkID
Definition: ooofilt.hxx:146
StreamInterface * m_pStream
Definition: ooofilt.hxx:153
::std::wstring m_pwsBuffer
Definition: ooofilt.hxx:149
virtual HRESULT STDMETHODCALLTYPE Save(LPCOLESTR pszFileName, BOOL fRemember) override
Definition: ooofilt.cxx:590
virtual HRESULT STDMETHODCALLTYPE SaveCompleted(LPCOLESTR pszFileName) override
Definition: ooofilt.cxx:604
ULONG m_ulCurrentPropertyNum
Definition: ooofilt.hxx:145
virtual SCODE STDMETHODCALLTYPE BindRegion(FILTERREGION origPos, REFIID riid, void **ppunk) override
Definition: ooofilt.cxx:505
virtual ~COooFilter()
Definition: ooofilt.cxx:103
bool m_fContents
Definition: ooofilt.hxx:147
ULONG m_ulUnicodeBufferLen
Definition: ooofilt.hxx:142
virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID) override
Definition: ooofilt.cxx:523
LONG m_lRefs
Definition: ooofilt.hxx:137
virtual HRESULT STDMETHODCALLTYPE GetCurFile(LPOLESTR *ppszFileName) override
Definition: ooofilt.cxx:679
ULONG m_ulPropertyNum
Definition: ooofilt.hxx:144
virtual ULONG STDMETHODCALLTYPE AddRef() override
Definition: ooofilt.cxx:154
virtual HRESULT STDMETHODCALLTYPE Load(LPCOLESTR pszFileName, DWORD dwMode) override
Definition: ooofilt.cxx:557
const CLSID CLSID_PERSISTENT_HANDLER
Definition: ooofilt.hxx:54
const CLSID CLSID_PERSISTENT_HANDLER_ADDIN
Definition: ooofilt.hxx:59
LONG g_lInstances
Definition: ooofilt.hxx:35
FilterState
Definition: ooofilt.hxx:68
GUID const CLSID_COooFilter
Definition: ooofilt.hxx:44
const CLSID CLSID_FILTER_HANDLER
Definition: ooofilt.hxx:64
GUID const guidStorage
Definition: ooofilt.hxx:36
const wchar_t *typedef BOOL
LONG