Debian Codegraph @

shell/source/win32/shlxthandler/ooofilt/propspec.hxx

raw
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20 #ifndef INCLUDED_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_PROPSPEC_HXX
21 #define INCLUDED_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_PROPSPEC_HXX
22
23 //+-------------------------------------------------------------------------
24 // File: propspec.hxx
25 // Contents: C++ wrapper(s) for FULLPROPSPEC
26
27 #if !defined WIN32_LEAN_AND_MEAN
28 # define WIN32_LEAN_AND_MEAN
29 #endif
30 #include <windows.h>
31 #include <ole2.h>
32 #include <ntquery.h>
33 //+-------------------------------------------------------------------------
34 // Declare: CLSID_SummaryInformation, GUID
35 // CLSID_Storage, GUID
36 // Contents: Definitions of OpenOffice.org Document properties
37
38
39 //+-------------------------------------------------------------------------
40 // Class: CFullPropertySpec
41 // Purpose: Describes full (PropertySet\Property) name of a property.
42
43
44 class CFullPropSpec
45 {
46 public:
47 CFullPropSpec();
48 CFullPropSpec( GUID const & guidPropSet, PROPID pidProperty );
49 CFullPropSpec( GUID const & guidPropSet, WCHAR const * wcsProperty );
50 // Validity check
51 inline BOOL IsValid() const;
52
53 // Copy constructors/assignment/clone
54 CFullPropSpec( CFullPropSpec const & Property );
55 CFullPropSpec & operator=( CFullPropSpec const & Property );
56 ~CFullPropSpec();
57 // Memory allocation
58 void * operator new( size_t size );
59 void operator delete( void * p );
60 inline FULLPROPSPEC * CastToStruct();
61 inline FULLPROPSPEC const * CastToStruct() const;
62 // Comparators
63 bool operator==( CFullPropSpec const & prop ) const;
64 bool operator!=( CFullPropSpec const & prop ) const;
65 // Member variable access
66 inline void SetPropSet( GUID const & guidPropSet );
67 inline GUID const & GetPropSet() const;
68
69 void SetProperty( PROPID pidProperty );
70 BOOL SetProperty( WCHAR const * wcsProperty );
71 inline WCHAR const * GetPropertyName() const;
72 inline PROPID GetPropertyPropid() const;
73 inline PROPSPEC GetPropSpec() const;
74 inline BOOL IsPropertyName() const;
75 inline BOOL IsPropertyPropid() const;
76 private:
77 GUID _guidPropSet = {};
78 PROPSPEC _psProperty;
79 };
80 // Inline methods for CFullPropSpec
81 inline void * CFullPropSpec::operator new( size_t size )
82 {
83 void * p = CoTaskMemAlloc( size );
84 return p;
85 }
86 inline void CFullPropSpec::operator delete( void * p )
87 {
88 if ( p )
89 CoTaskMemFree( p );
90 }
91 inline BOOL CFullPropSpec::IsValid() const
92 {
93 return ( _psProperty.ulKind == PRSPEC_PROPID ||
94 nullptr != _psProperty.lpwstr );
95 }
96 inline void CFullPropSpec::SetPropSet( GUID const & guidPropSet )
97 {
98 _guidPropSet = guidPropSet;
99 }
100 inline GUID const & CFullPropSpec::GetPropSet() const
101 {
102 return _guidPropSet;
103 }
104 inline PROPSPEC CFullPropSpec::GetPropSpec() const
105 {
106 return _psProperty;
107 }
108 inline WCHAR const * CFullPropSpec::GetPropertyName() const
109 {
110 return _psProperty.lpwstr;
111 }
112 inline PROPID CFullPropSpec::GetPropertyPropid() const
113 {
114 return _psProperty.propid;
115 }
116 inline BOOL CFullPropSpec::IsPropertyName() const
117 {
118 return _psProperty.ulKind == PRSPEC_LPWSTR;
119 }
120 inline BOOL CFullPropSpec::IsPropertyPropid() const
121 {
122 return _psProperty.ulKind == PRSPEC_PROPID;
123 }
124
125 #endif // INCLUDED_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_PROPSPEC_HXX
126
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */