1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 //+-------------------------------------------------------------------------
32 class CMetaInfoReader
;
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-------------------------------------------------------------------------
40 // Purpose: Implements interfaces of LibreOffice filter
43 // {7BC0E710-5703-45be-A29D-5D46D8B39262}
44 GUID
const CLSID_COooFilter
=
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}};
69 FilteringContent
, // Filtering the content property
70 FilteringProperty
// Filtering the pseudo property
72 class COooFilter
: public IFilter
, public IPersistFile
, public IPersistStream
76 virtual SCODE STDMETHODCALLTYPE
QueryInterface(
79 virtual ULONG STDMETHODCALLTYPE
AddRef();
80 virtual ULONG STDMETHODCALLTYPE
Release();
83 virtual SCODE STDMETHODCALLTYPE
Init(
86 FULLPROPSPEC
const * aAttributes
,
88 virtual SCODE STDMETHODCALLTYPE
GetChunk(
90 virtual SCODE STDMETHODCALLTYPE
GetText(
94 virtual SCODE STDMETHODCALLTYPE
GetValue(
95 PROPVARIANT
** ppPropValue
);
97 virtual SCODE STDMETHODCALLTYPE
BindRegion(
103 virtual SCODE STDMETHODCALLTYPE
GetClassID(
105 virtual SCODE STDMETHODCALLTYPE
IsDirty();
106 virtual SCODE STDMETHODCALLTYPE
Load(
109 virtual SCODE STDMETHODCALLTYPE
Save(
113 virtual SCODE STDMETHODCALLTYPE
SaveCompleted(
114 LPCWSTR pszFileName
);
116 virtual SCODE STDMETHODCALLTYPE
GetCurFile(
117 LPWSTR
* ppszFileName
);
119 // From IPersistStream
120 virtual SCODE STDMETHODCALLTYPE
Load(
123 virtual SCODE STDMETHODCALLTYPE
Save(
127 virtual SCODE STDMETHODCALLTYPE
GetSizeMax(
128 ULARGE_INTEGER
*pcbSize
);
132 friend class COooFilterCF
;
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
166 virtual SCODE STDMETHODCALLTYPE
QueryInterface(
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(
182 friend SCODE STDMETHODCALLTYPE
DllGetClassObject(
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: */