Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / shell / source / win32 / shlxthandler / ooofilt / propspec.hxx
blobf9e1fc2897572af4ae8eac9dc5a1e6102f297b82
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_PROPSPEC_HXX
21 #define INCLUDED_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_PROPSPEC_HXX
23 //+-------------------------------------------------------------------------
24 // File: propspec.hxx
25 // Contents: C++ wrapper(s) for FULLPROPSPEC
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
39 //+-------------------------------------------------------------------------
40 // Class: CFullPropertySpec
41 // Purpose: Describes full (PropertySet\Property) name of a property.
44 class CFullPropSpec
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;
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;
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;
80 // Inline methods for CFullPropSpec
81 inline void * CFullPropSpec::operator new( size_t size )
83 void * p = CoTaskMemAlloc( size );
84 return p;
86 inline void CFullPropSpec::operator delete( void * p )
88 if ( p )
89 CoTaskMemFree( p );
91 inline BOOL CFullPropSpec::IsValid() const
93 return ( _psProperty.ulKind == PRSPEC_PROPID ||
94 nullptr != _psProperty.lpwstr );
96 inline void CFullPropSpec::SetPropSet( GUID const & guidPropSet )
98 _guidPropSet = guidPropSet;
100 inline GUID const & CFullPropSpec::GetPropSet() const
102 return _guidPropSet;
104 inline PROPSPEC CFullPropSpec::GetPropSpec() const
106 return _psProperty;
108 inline WCHAR const * CFullPropSpec::GetPropertyName() const
110 return _psProperty.lpwstr;
112 inline PROPID CFullPropSpec::GetPropertyPropid() const
114 return _psProperty.propid;
116 inline BOOL CFullPropSpec::IsPropertyName() const
118 return _psProperty.ulKind == PRSPEC_LPWSTR;
120 inline BOOL CFullPropSpec::IsPropertyPropid() const
122 return _psProperty.ulKind == PRSPEC_PROPID;
125 #endif // INCLUDED_SHELL_SOURCE_WIN32_SHLXTHANDLER_OOOFILT_PROPSPEC_HXX
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */