Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / ucbhelper / contentinfo.hxx
blobb69f75d1e8b562fed200747ccf004e56548a62bc
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_UCBHELPER_CONTENTINFO_HXX
21 #define INCLUDED_UCBHELPER_CONTENTINFO_HXX
23 #include <memory>
24 #include <com/sun/star/ucb/XCommandInfo.hpp>
25 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
26 #include <com/sun/star/lang/XTypeProvider.hpp>
27 #include <com/sun/star/beans/XPropertySetInfo.hpp>
28 #include <cppuhelper/weak.hxx>
30 #include <osl/mutex.hxx>
31 #include <ucbhelper/macros.hxx>
33 namespace ucbhelper {
36 // class PropertySetInfo.
39 class ContentImplHelper;
41 /**
42 * This class provides a propertyset info ( the complete implementation of
43 * the interface XPropertySetInfo ) for an object derived from class
44 * ucb::ContentImplHelper. The implementation takes care about Additional
45 * Core Properties that may have been added to the content.
47 class PropertySetInfo :
48 public cppu::OWeakObject,
49 public css::lang::XTypeProvider,
50 public css::beans::XPropertySetInfo
52 css::uno::Reference< css::ucb::XCommandEnvironment >
53 m_xEnv;
54 std::unique_ptr<css::uno::Sequence< css::beans::Property >>
55 m_pProps;
56 osl::Mutex m_aMutex;
57 ContentImplHelper* m_pContent;
59 private:
60 bool queryProperty( const OUString& rName,
61 css::beans::Property& rProp );
63 public:
64 PropertySetInfo( const css::uno::Reference< css::ucb::XCommandEnvironment >& rxEnv,
65 ContentImplHelper* pContent );
66 virtual ~PropertySetInfo() override;
68 // XInterface
69 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
70 virtual void SAL_CALL acquire()
71 throw() override;
72 virtual void SAL_CALL release()
73 throw() override;
75 // XTypeProvider
76 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
77 getImplementationId() override;
78 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
79 getTypes() override;
81 // XPropertySetInfo
82 virtual css::uno::Sequence<
83 css::beans::Property > SAL_CALL
84 getProperties() override;
85 virtual css::beans::Property SAL_CALL
86 getPropertyByName( const OUString& aName ) override;
87 virtual sal_Bool SAL_CALL
88 hasPropertyByName( const OUString& Name ) override;
90 // Non-Interface methods.
91 void reset();
95 // class CommandProcessorInfo.
98 /**
99 * This class provides a command info ( the complete implementation of
100 * the interface XCommandInfo ) for an object derived from class
101 * ucb::ContentImplHelper.
103 class CommandProcessorInfo :
104 public cppu::OWeakObject,
105 public css::lang::XTypeProvider,
106 public css::ucb::XCommandInfo
108 css::uno::Reference< css::ucb::XCommandEnvironment >
109 m_xEnv;
110 std::unique_ptr<css::uno::Sequence< css::ucb::CommandInfo >>
111 m_pCommands;
112 osl::Mutex m_aMutex;
113 ContentImplHelper* m_pContent;
115 private:
116 bool queryCommand( const OUString& rName,
117 css::ucb::CommandInfo& rCommand );
118 bool queryCommand( sal_Int32 nHandle,
119 css::ucb::CommandInfo& rCommand );
121 public:
122 CommandProcessorInfo( const css::uno::Reference< css::ucb::XCommandEnvironment >& rxEnv,
123 ContentImplHelper* pContent );
124 virtual ~CommandProcessorInfo() override;
126 // XInterface
127 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
128 virtual void SAL_CALL acquire()
129 throw() override;
130 virtual void SAL_CALL release()
131 throw() override;
133 // XTypeProvider
134 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
135 getImplementationId() override;
136 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
137 getTypes() override;
139 // XCommandInfo
140 virtual css::uno::Sequence<
141 css::ucb::CommandInfo > SAL_CALL
142 getCommands() override;
143 virtual css::ucb::CommandInfo SAL_CALL
144 getCommandInfoByName( const OUString& Name ) override;
145 virtual css::ucb::CommandInfo SAL_CALL
146 getCommandInfoByHandle( sal_Int32 Handle ) override;
147 virtual sal_Bool SAL_CALL
148 hasCommandByName( const OUString& Name ) override;
149 virtual sal_Bool SAL_CALL
150 hasCommandByHandle( sal_Int32 Handle ) override;
152 // Non-Interface methods.
153 void reset();
156 } // namespace ucbhelper
158 #endif /* ! INCLUDED_UCBHELPER_CONTENTINFO_HXX */
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */