Branch libreoffice-5-0-4
[LibreOffice.git] / include / ucbhelper / contentinfo.hxx
blob032337e5c059e0bb14999021c74f74371b2e6d72
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 <com/sun/star/ucb/XCommandInfo.hpp>
24 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
25 #include <com/sun/star/lang/XTypeProvider.hpp>
26 #include <com/sun/star/beans/XPropertySetInfo.hpp>
27 #include <cppuhelper/weak.hxx>
29 #include <osl/mutex.hxx>
30 #include <ucbhelper/macros.hxx>
32 namespace ucbhelper {
36 // class PropertySetInfo.
40 class ContentImplHelper;
42 /**
43 * This class provides a propertyset info ( the complete implementation of
44 * the interface XPropertySetInfo ) for an object derived from class
45 * ucb::ContentImplHelper. The implementation takes care about Additional
46 * Core Properties that may have been added to the content.
48 class PropertySetInfo :
49 public cppu::OWeakObject,
50 public com::sun::star::lang::XTypeProvider,
51 public com::sun::star::beans::XPropertySetInfo
53 com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >
54 m_xEnv;
55 com::sun::star::uno::Sequence< com::sun::star::beans::Property >*
56 m_pProps;
57 osl::Mutex m_aMutex;
58 ContentImplHelper* m_pContent;
60 private:
61 bool queryProperty( const OUString& rName,
62 com::sun::star::beans::Property& rProp );
64 public:
65 PropertySetInfo( const com::sun::star::uno::Reference<
66 com::sun::star::ucb::XCommandEnvironment >& rxEnv,
67 ContentImplHelper* pContent );
68 virtual ~PropertySetInfo();
70 // XInterface
71 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
72 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
73 virtual void SAL_CALL acquire()
74 throw() SAL_OVERRIDE;
75 virtual void SAL_CALL release()
76 throw() SAL_OVERRIDE;
78 // XTypeProvider
79 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
80 getImplementationId()
81 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
82 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
83 getTypes()
84 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
86 // XPropertySetInfo
87 virtual com::sun::star::uno::Sequence<
88 com::sun::star::beans::Property > SAL_CALL
89 getProperties()
90 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
91 virtual com::sun::star::beans::Property SAL_CALL
92 getPropertyByName( const OUString& aName )
93 throw( com::sun::star::beans::UnknownPropertyException,
94 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
95 virtual sal_Bool SAL_CALL
96 hasPropertyByName( const OUString& Name )
97 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
99 // Non-Interface methods.
100 void reset();
105 // class CommandProcessorInfo.
110 * This class provides a command info ( the complete implementation of
111 * the interface XCommandInfo ) for an object derived from class
112 * ucb::ContentImplHelper.
114 class CommandProcessorInfo :
115 public cppu::OWeakObject,
116 public com::sun::star::lang::XTypeProvider,
117 public com::sun::star::ucb::XCommandInfo
119 com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >
120 m_xEnv;
121 com::sun::star::uno::Sequence< com::sun::star::ucb::CommandInfo >*
122 m_pCommands;
123 osl::Mutex m_aMutex;
124 ContentImplHelper* m_pContent;
126 private:
127 bool queryCommand( const OUString& rName,
128 com::sun::star::ucb::CommandInfo& rCommand );
129 bool queryCommand( sal_Int32 nHandle,
130 com::sun::star::ucb::CommandInfo& rCommand );
132 public:
133 CommandProcessorInfo( const com::sun::star::uno::Reference<
134 com::sun::star::ucb::XCommandEnvironment >& rxEnv,
135 ContentImplHelper* pContent );
136 virtual ~CommandProcessorInfo();
138 // XInterface
139 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
140 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
141 virtual void SAL_CALL acquire()
142 throw() SAL_OVERRIDE;
143 virtual void SAL_CALL release()
144 throw() SAL_OVERRIDE;
146 // XTypeProvider
147 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
148 getImplementationId()
149 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
150 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
151 getTypes()
152 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
154 // XCommandInfo
155 virtual com::sun::star::uno::Sequence<
156 com::sun::star::ucb::CommandInfo > SAL_CALL
157 getCommands()
158 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
159 virtual com::sun::star::ucb::CommandInfo SAL_CALL
160 getCommandInfoByName( const OUString& Name )
161 throw( com::sun::star::ucb::UnsupportedCommandException,
162 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
163 virtual com::sun::star::ucb::CommandInfo SAL_CALL
164 getCommandInfoByHandle( sal_Int32 Handle )
165 throw( com::sun::star::ucb::UnsupportedCommandException,
166 com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
167 virtual sal_Bool SAL_CALL
168 hasCommandByName( const OUString& Name )
169 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
170 virtual sal_Bool SAL_CALL
171 hasCommandByHandle( sal_Int32 Handle )
172 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
174 // Non-Interface methods.
175 void reset();
178 } // namespace ucbhelper
180 #endif /* ! INCLUDED_UCBHELPER_CONTENTINFO_HXX */
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */