1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 //+------------------------------------------------------------------------- 28 // 29 // File: propspec.hxx 30 // 31 // Contents: C++ wrapper(s) for FULLPROPSPEC 32 // 33 //------------------------------------------------------------------------- 34 #pragma once 35 #if defined _MSC_VER 36 #pragma warning(push, 1) 37 #endif 38 #include <windows.h> 39 #include <ole2.h> 40 #include <ntquery.h> 41 #if defined _MSC_VER 42 #pragma warning(pop) 43 #endif 44 //+------------------------------------------------------------------------- 45 // 46 // Declare: CLSID_SummaryInforation, GUID 47 // CLSID_Storage, GUID 48 // 49 // Contents: Definitions of OpenOffice.org Document properties 50 // 51 //-------------------------------------------------------------------------- 52 53 //extern GUID CLSID_Storage; 54 // 55 //extern GUID CLSID_SummaryInformation; 56 //const PID_TITLE = PIDSI_TITLE; // 2; 57 //const PID_SUBJECT = PIDSI_SUBJECT; // 3; 58 //const PID_AUTHOR = PIDSI_AUTHOR; // 4; 59 //const PID_KEYWORDS = PIDSI_KEYWORDS; // 5; 60 //const PID_COMMENTS = PIDSI_COMMENTS; //6; 61 //const PID_REVNUMBER = PIDSI_REVNUMBER; //9; 62 //const PID_WORDCOUNT = PIDSI_WORDCOUNT; //f; 63 //+------------------------------------------------------------------------- 64 // 65 // Class: CFullPropertySpec 66 // 67 // Purpose: Describes full (PropertySet\Property) name of a property. 68 // 69 //-------------------------------------------------------------------------- 70 71 class CFullPropSpec 72 { 73 public: 74 CFullPropSpec(); 75 CFullPropSpec( GUID const & guidPropSet, PROPID pidProperty ); 76 CFullPropSpec( GUID const & guidPropSet, WCHAR const * wcsProperty ); 77 // Validity check 78 inline BOOL IsValid() const; 79 80 // Copy constructors/assignment/clone 81 CFullPropSpec( CFullPropSpec const & Property ); 82 CFullPropSpec & operator=( CFullPropSpec const & Property ); 83 ~CFullPropSpec(); 84 // Memory allocation 85 void * operator new( size_t size ); 86 inline void * operator new( size_t size, void * p ); 87 void operator delete( void * p ); 88 inline FULLPROPSPEC * CastToStruct(); 89 inline FULLPROPSPEC const * CastToStruct() const; 90 // Comparators 91 int operator==( CFullPropSpec const & prop ) const; 92 int operator!=( CFullPropSpec const & prop ) const; 93 // Member variable access 94 inline void SetPropSet( GUID const & guidPropSet ); 95 inline GUID const & GetPropSet() const; 96 97 void SetProperty( PROPID pidProperty ); 98 BOOL SetProperty( WCHAR const * wcsProperty ); 99 inline WCHAR const * GetPropertyName() const; 100 inline PROPID GetPropertyPropid() const; 101 inline PROPSPEC GetPropSpec() const; 102 inline BOOL IsPropertyName() const; 103 inline BOOL IsPropertyPropid() const; 104 private: 105 GUID _guidPropSet; 106 PROPSPEC _psProperty; 107 }; 108 // Inline methods for CFullPropSpec 109 inline void * CFullPropSpec::operator new( size_t size ) 110 { 111 void * p = CoTaskMemAlloc( size ); 112 return( p ); 113 } 114 inline void * CFullPropSpec::operator new( size_t /*size*/, void * p ) 115 { 116 return( p ); 117 } 118 inline void CFullPropSpec::operator delete( void * p ) 119 { 120 if ( p ) 121 CoTaskMemFree( p ); 122 } 123 inline BOOL CFullPropSpec::IsValid() const 124 { 125 return ( _psProperty.ulKind == PRSPEC_PROPID || 126 0 != _psProperty.lpwstr ); 127 } 128 inline void CFullPropSpec::SetPropSet( GUID const & guidPropSet ) 129 { 130 _guidPropSet = guidPropSet; 131 } 132 inline GUID const & CFullPropSpec::GetPropSet() const 133 { 134 return( _guidPropSet ); 135 } 136 inline PROPSPEC CFullPropSpec::GetPropSpec() const 137 { 138 return( _psProperty ); 139 } 140 inline WCHAR const * CFullPropSpec::GetPropertyName() const 141 { 142 return( _psProperty.lpwstr ); 143 } 144 inline PROPID CFullPropSpec::GetPropertyPropid() const 145 { 146 return( _psProperty.propid ); 147 } 148 inline BOOL CFullPropSpec::IsPropertyName() const 149 { 150 return( _psProperty.ulKind == PRSPEC_LPWSTR ); 151 } 152 inline BOOL CFullPropSpec::IsPropertyPropid() const 153 { 154 return( _psProperty.ulKind == PRSPEC_PROPID ); 155 } 156 157 158 159 160