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