LibreOffice Module shell (master) 1
propspec.hxx
Go to the documentation of this file.
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
45{
46public:
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
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;
76private:
77 GUID _guidPropSet = {};
78 PROPSPEC _psProperty;
79};
80// Inline methods for CFullPropSpec
81inline void * CFullPropSpec::operator new( size_t size )
82{
83 void * p = CoTaskMemAlloc( size );
84 return p;
85}
86inline void CFullPropSpec::operator delete( void * p )
87{
88 if ( p )
89 CoTaskMemFree( p );
90}
92{
93 return ( _psProperty.ulKind == PRSPEC_PROPID ||
94 nullptr != _psProperty.lpwstr );
95}
96inline void CFullPropSpec::SetPropSet( GUID const & guidPropSet )
97{
98 _guidPropSet = guidPropSet;
99}
100inline GUID const & CFullPropSpec::GetPropSet() const
101{
102 return _guidPropSet;
103}
104inline PROPSPEC CFullPropSpec::GetPropSpec() const
105{
106 return _psProperty;
107}
108inline WCHAR const * CFullPropSpec::GetPropertyName() const
109{
110 return _psProperty.lpwstr;
111}
113{
114 return _psProperty.propid;
115}
117{
118 return _psProperty.ulKind == PRSPEC_LPWSTR;
119}
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: */
PROPID GetPropertyPropid() const
Definition: propspec.hxx:112
BOOL IsPropertyPropid() const
Definition: propspec.hxx:120
void SetProperty(PROPID pidProperty)
Definition: propspec.cxx:132
FULLPROPSPEC const * CastToStruct() const
PROPSPEC _psProperty
Definition: propspec.hxx:78
BOOL IsValid() const
Definition: propspec.hxx:91
bool operator!=(CFullPropSpec const &prop) const
Definition: propspec.cxx:184
bool operator==(CFullPropSpec const &prop) const
Definition: propspec.cxx:165
WCHAR const * GetPropertyName() const
Definition: propspec.hxx:108
void SetPropSet(GUID const &guidPropSet)
Definition: propspec.hxx:96
PROPSPEC GetPropSpec() const
Definition: propspec.hxx:104
FULLPROPSPEC * CastToStruct()
GUID _guidPropSet
Definition: propspec.hxx:77
CFullPropSpec & operator=(CFullPropSpec const &Property)
Definition: propspec.cxx:111
BOOL IsPropertyName() const
Definition: propspec.hxx:116
GUID const & GetPropSet() const
Definition: propspec.hxx:100
void * p
size
const wchar_t *typedef BOOL