Bump version to 5.0-14
[LibreOffice.git] / shell / source / win32 / shlxthandler / ooofilt / ooofilt.hxx
blobbad8da14a8b9895825b6df7743f329a53add9555
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_OOOFILT_HXX
21 #define INCLUDED_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_OOOFILT_HXX
23 #include "internal/types.hxx"
25 //+-------------------------------------------------------------------------
26 // Contents: LibreOffice filter declarations
27 // Platform: Windows 2000, Windows XP
29 //+-------------------------------------------------------------------------
31 class CContentReader;
32 class CMetaInfoReader;
33 class CFullPropSpec;
35 long g_lInstances = 0; // Global count of COooFilter and COooFilterCF instances
36 GUID const guidStorage = PSGUID_STORAGE; // GUID for storage property set
38 //C-------------------------------------------------------------------------
39 // Class: COooFilter
40 // Purpose: Implements interfaces of LibreOffice filter
42 // OooFilter Class ID
43 // {7BC0E710-5703-45be-A29D-5D46D8B39262}
44 GUID const CLSID_COooFilter =
46 0x7bc0e710,
47 0x5703,
48 0x45be,
49 { 0xa2, 0x9d, 0x5d, 0x46, 0xd8, 0xb3, 0x92, 0x62 }
52 // LibreOffice Persistent Handler Class ID
53 // {7BC0E713-5703-45be-A29D-5D46D8B39262}
54 const CLSID CLSID_PERSISTENT_HANDLER =
55 {0x7bc0e713, 0x5703, 0x45be, {0xa2, 0x9d, 0x5d, 0x46, 0xd8, 0xb3, 0x92, 0x62}};
57 // LibreOffice Persistent Handler Addin Registered Class ID
58 // {89BCB740-6119-101A-BCB7-00DD010655AF}
59 const CLSID CLSID_PERSISTENT_HANDLER_ADDIN =
60 {0x89bcb740, 0x6119, 0x101a, {0xbc, 0xb7, 0x00, 0xdd, 0x01, 0x06, 0x55, 0xaf}};
62 // LibreOffice Filter Handler Class ID
63 // {7BC0E710-5703-45be-A29D-5D46D8B39262}
64 const CLSID CLSID_FILTER_HANDLER =
65 {0x7bc0e710, 0x5703, 0x45be, {0xa2, 0x9d, 0x5d, 0x46, 0xd8, 0xb3, 0x92, 0x62}};
67 enum FilterState
69 FilteringContent, // Filtering the content property
70 FilteringProperty // Filtering the pseudo property
72 class COooFilter : public IFilter, public IPersistFile, public IPersistStream
74 public:
75 // From IUnknown
76 virtual SCODE STDMETHODCALLTYPE QueryInterface(
77 REFIID riid,
78 void ** ppvObject);
79 virtual ULONG STDMETHODCALLTYPE AddRef();
80 virtual ULONG STDMETHODCALLTYPE Release();
82 // From IFilter
83 virtual SCODE STDMETHODCALLTYPE Init(
84 ULONG grfFlags,
85 ULONG cAttributes,
86 FULLPROPSPEC const * aAttributes,
87 ULONG * pFlags);
88 virtual SCODE STDMETHODCALLTYPE GetChunk(
89 STAT_CHUNK * pStat);
90 virtual SCODE STDMETHODCALLTYPE GetText(
91 ULONG * pcwcBuffer,
92 WCHAR * awcBuffer);
94 virtual SCODE STDMETHODCALLTYPE GetValue(
95 PROPVARIANT ** ppPropValue);
97 virtual SCODE STDMETHODCALLTYPE BindRegion(
98 FILTERREGION origPos,
99 REFIID riid,
100 void ** ppunk);
102 // From IPersistFile
103 virtual SCODE STDMETHODCALLTYPE GetClassID(
104 CLSID * pClassID);
105 virtual SCODE STDMETHODCALLTYPE IsDirty();
106 virtual SCODE STDMETHODCALLTYPE Load(
107 LPCWSTR pszFileName,
108 DWORD dwMode);
109 virtual SCODE STDMETHODCALLTYPE Save(
110 LPCWSTR pszFileName,
111 BOOL fRemember);
113 virtual SCODE STDMETHODCALLTYPE SaveCompleted(
114 LPCWSTR pszFileName);
116 virtual SCODE STDMETHODCALLTYPE GetCurFile(
117 LPWSTR * ppszFileName);
119 // From IPersistStream
120 virtual SCODE STDMETHODCALLTYPE Load(
121 IStream *pStm);
123 virtual SCODE STDMETHODCALLTYPE Save(
124 IStream *pStm,
125 BOOL fClearDirty);
127 virtual SCODE STDMETHODCALLTYPE GetSizeMax(
128 ULARGE_INTEGER *pcbSize);
131 private:
132 friend class COooFilterCF;
134 COooFilter();
135 virtual ~COooFilter();
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
153 StreamInterface * m_pStream;
157 //C-------------------------------------------------------------------------
158 // Class: COooFilterCF
159 // Purpose: Implements class factory for LibreOffice filter
162 class COooFilterCF : public IClassFactory
164 public:
165 // From IUnknown
166 virtual SCODE STDMETHODCALLTYPE QueryInterface(
167 REFIID riid,
168 void ** ppvObject);
170 virtual ULONG STDMETHODCALLTYPE AddRef();
171 virtual ULONG STDMETHODCALLTYPE Release();
173 // From IClassFactory
174 virtual SCODE STDMETHODCALLTYPE CreateInstance(
175 IUnknown * pUnkOuter,
176 REFIID riid, void ** ppvObject);
178 virtual SCODE STDMETHODCALLTYPE LockServer(
179 BOOL fLock);
181 private:
182 friend SCODE STDMETHODCALLTYPE DllGetClassObject(
183 REFCLSID cid,
184 REFIID iid,
185 void ** ppvObj);
187 COooFilterCF();
188 virtual ~COooFilterCF();
190 long m_lRefs; // Reference count
193 #endif // INCLUDED_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_OOOFILT_HXX
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */