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