1ed2f6d3bSAndrew Rist /**************************************************************
2*c8265279Smseidel *
3ed2f6d3bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4ed2f6d3bSAndrew Rist * or more contributor license agreements. See the NOTICE file
5ed2f6d3bSAndrew Rist * distributed with this work for additional information
6ed2f6d3bSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7ed2f6d3bSAndrew Rist * to you under the Apache License, Version 2.0 (the
8ed2f6d3bSAndrew Rist * "License"); you may not use this file except in compliance
9ed2f6d3bSAndrew Rist * with the License. You may obtain a copy of the License at
10*c8265279Smseidel *
11ed2f6d3bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*c8265279Smseidel *
13ed2f6d3bSAndrew Rist * Unless required by applicable law or agreed to in writing,
14ed2f6d3bSAndrew Rist * software distributed under the License is distributed on an
15ed2f6d3bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ed2f6d3bSAndrew Rist * KIND, either express or implied. See the License for the
17ed2f6d3bSAndrew Rist * specific language governing permissions and limitations
18ed2f6d3bSAndrew Rist * under the License.
19*c8265279Smseidel *
20ed2f6d3bSAndrew Rist *************************************************************/
21ed2f6d3bSAndrew Rist
22ed2f6d3bSAndrew Rist
23*c8265279Smseidel
24cdf0e10cSrcweir //+-------------------------------------------------------------------------
25cdf0e10cSrcweir //
26cdf0e10cSrcweir // File: propspec.hxx
27cdf0e10cSrcweir //
28cdf0e10cSrcweir // Contents: C++ wrapper(s) for FULLPROPSPEC
29cdf0e10cSrcweir //
30cdf0e10cSrcweir //-------------------------------------------------------------------------
31cdf0e10cSrcweir #pragma once
32cdf0e10cSrcweir #if defined _MSC_VER
33cdf0e10cSrcweir #pragma warning(push, 1)
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #include <windows.h>
36cdf0e10cSrcweir #include <ole2.h>
37cdf0e10cSrcweir #include <ntquery.h>
38cdf0e10cSrcweir #if defined _MSC_VER
39cdf0e10cSrcweir #pragma warning(pop)
40*c8265279Smseidel #endif
41cdf0e10cSrcweir //+-------------------------------------------------------------------------
42cdf0e10cSrcweir //
43cdf0e10cSrcweir // Declare: CLSID_SummaryInforation, GUID
44cdf0e10cSrcweir // CLSID_Storage, GUID
45cdf0e10cSrcweir //
46*c8265279Smseidel // Contents: Definitions of OpenOffice Document properties
47cdf0e10cSrcweir //
48cdf0e10cSrcweir //--------------------------------------------------------------------------
49cdf0e10cSrcweir
50cdf0e10cSrcweir //extern GUID CLSID_Storage;
51cdf0e10cSrcweir //
52cdf0e10cSrcweir //extern GUID CLSID_SummaryInformation;
53cdf0e10cSrcweir //const PID_TITLE = PIDSI_TITLE; // 2;
54cdf0e10cSrcweir //const PID_SUBJECT = PIDSI_SUBJECT; // 3;
55cdf0e10cSrcweir //const PID_AUTHOR = PIDSI_AUTHOR; // 4;
56cdf0e10cSrcweir //const PID_KEYWORDS = PIDSI_KEYWORDS; // 5;
57cdf0e10cSrcweir //const PID_COMMENTS = PIDSI_COMMENTS; //6;
58cdf0e10cSrcweir //const PID_REVNUMBER = PIDSI_REVNUMBER; //9;
59cdf0e10cSrcweir //const PID_WORDCOUNT = PIDSI_WORDCOUNT; //f;
60cdf0e10cSrcweir //+-------------------------------------------------------------------------
61cdf0e10cSrcweir //
62cdf0e10cSrcweir // Class: CFullPropertySpec
63cdf0e10cSrcweir //
64cdf0e10cSrcweir // Purpose: Describes full (PropertySet\Property) name of a property.
65cdf0e10cSrcweir //
66cdf0e10cSrcweir //--------------------------------------------------------------------------
67cdf0e10cSrcweir
68cdf0e10cSrcweir class CFullPropSpec
69cdf0e10cSrcweir {
70*c8265279Smseidel public:
71cdf0e10cSrcweir CFullPropSpec();
72cdf0e10cSrcweir CFullPropSpec( GUID const & guidPropSet, PROPID pidProperty );
73cdf0e10cSrcweir CFullPropSpec( GUID const & guidPropSet, WCHAR const * wcsProperty );
74cdf0e10cSrcweir // Validity check
75cdf0e10cSrcweir inline BOOL IsValid() const;
76*c8265279Smseidel
77cdf0e10cSrcweir // Copy constructors/assignment/clone
78cdf0e10cSrcweir CFullPropSpec( CFullPropSpec const & Property );
79cdf0e10cSrcweir CFullPropSpec & operator=( CFullPropSpec const & Property );
80cdf0e10cSrcweir ~CFullPropSpec();
81cdf0e10cSrcweir // Memory allocation
82cdf0e10cSrcweir void * operator new( size_t size );
83cdf0e10cSrcweir inline void * operator new( size_t size, void * p );
84cdf0e10cSrcweir void operator delete( void * p );
85cdf0e10cSrcweir inline FULLPROPSPEC * CastToStruct();
86cdf0e10cSrcweir inline FULLPROPSPEC const * CastToStruct() const;
87cdf0e10cSrcweir // Comparators
88cdf0e10cSrcweir int operator==( CFullPropSpec const & prop ) const;
89cdf0e10cSrcweir int operator!=( CFullPropSpec const & prop ) const;
90cdf0e10cSrcweir // Member variable access
91cdf0e10cSrcweir inline void SetPropSet( GUID const & guidPropSet );
92cdf0e10cSrcweir inline GUID const & GetPropSet() const;
93*c8265279Smseidel
94cdf0e10cSrcweir void SetProperty( PROPID pidProperty );
95cdf0e10cSrcweir BOOL SetProperty( WCHAR const * wcsProperty );
96cdf0e10cSrcweir inline WCHAR const * GetPropertyName() const;
97cdf0e10cSrcweir inline PROPID GetPropertyPropid() const;
98cdf0e10cSrcweir inline PROPSPEC GetPropSpec() const;
99cdf0e10cSrcweir inline BOOL IsPropertyName() const;
100cdf0e10cSrcweir inline BOOL IsPropertyPropid() const;
101cdf0e10cSrcweir private:
102cdf0e10cSrcweir GUID _guidPropSet;
103cdf0e10cSrcweir PROPSPEC _psProperty;
104cdf0e10cSrcweir };
105cdf0e10cSrcweir // Inline methods for CFullPropSpec
operator new(size_t size)106cdf0e10cSrcweir inline void * CFullPropSpec::operator new( size_t size )
107cdf0e10cSrcweir {
108cdf0e10cSrcweir void * p = CoTaskMemAlloc( size );
109cdf0e10cSrcweir return( p );
110cdf0e10cSrcweir }
operator new(size_t,void * p)111cdf0e10cSrcweir inline void * CFullPropSpec::operator new( size_t /*size*/, void * p )
112cdf0e10cSrcweir {
113cdf0e10cSrcweir return( p );
114cdf0e10cSrcweir }
operator delete(void * p)115cdf0e10cSrcweir inline void CFullPropSpec::operator delete( void * p )
116cdf0e10cSrcweir {
117cdf0e10cSrcweir if ( p )
118cdf0e10cSrcweir CoTaskMemFree( p );
119cdf0e10cSrcweir }
IsValid() const120cdf0e10cSrcweir inline BOOL CFullPropSpec::IsValid() const
121cdf0e10cSrcweir {
122cdf0e10cSrcweir return ( _psProperty.ulKind == PRSPEC_PROPID ||
123cdf0e10cSrcweir 0 != _psProperty.lpwstr );
124cdf0e10cSrcweir }
SetPropSet(GUID const & guidPropSet)125cdf0e10cSrcweir inline void CFullPropSpec::SetPropSet( GUID const & guidPropSet )
126cdf0e10cSrcweir {
127cdf0e10cSrcweir _guidPropSet = guidPropSet;
128cdf0e10cSrcweir }
GetPropSet() const129cdf0e10cSrcweir inline GUID const & CFullPropSpec::GetPropSet() const
130cdf0e10cSrcweir {
131cdf0e10cSrcweir return( _guidPropSet );
132cdf0e10cSrcweir }
GetPropSpec() const133cdf0e10cSrcweir inline PROPSPEC CFullPropSpec::GetPropSpec() const
134cdf0e10cSrcweir {
135cdf0e10cSrcweir return( _psProperty );
136cdf0e10cSrcweir }
GetPropertyName() const137cdf0e10cSrcweir inline WCHAR const * CFullPropSpec::GetPropertyName() const
138cdf0e10cSrcweir {
139cdf0e10cSrcweir return( _psProperty.lpwstr );
140cdf0e10cSrcweir }
GetPropertyPropid() const141cdf0e10cSrcweir inline PROPID CFullPropSpec::GetPropertyPropid() const
142cdf0e10cSrcweir {
143cdf0e10cSrcweir return( _psProperty.propid );
144cdf0e10cSrcweir }
IsPropertyName() const145cdf0e10cSrcweir inline BOOL CFullPropSpec::IsPropertyName() const
146cdf0e10cSrcweir {
147cdf0e10cSrcweir return( _psProperty.ulKind == PRSPEC_LPWSTR );
148cdf0e10cSrcweir }
IsPropertyPropid() const149cdf0e10cSrcweir inline BOOL CFullPropSpec::IsPropertyPropid() const
150cdf0e10cSrcweir {
151cdf0e10cSrcweir return( _psProperty.ulKind == PRSPEC_PROPID );
152cdf0e10cSrcweir }
153