/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ /* * This file is part of LibreOffice published API. */ #ifndef INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX #define INCLUDED_CPPUHELPER_PROPERTYSETMIXIN_HXX #include "sal/config.h" #include "com/sun/star/beans/XFastPropertySet.hpp" #include "com/sun/star/beans/XPropertyAccess.hpp" #include "com/sun/star/beans/XPropertySet.hpp" #include "com/sun/star/uno/Reference.h" #include "com/sun/star/uno/Sequence.hxx" #include "sal/types.h" #include "cppuhelper/cppuhelperdllapi.h" namespace com { namespace sun { namespace star { namespace beans { class XPropertyChangeListener; class XPropertySetInfo; class XVetoableChangeListener; struct PropertyValue; } namespace uno { class Type; class XComponentContext; } } } } namespace cppu { /** @short A helper base class for cppu::PropertySetMixin. See the documentation of cppu::PropertySetMixin for further details. That cppu::PropertySetMixin is derived from this base class should be considered an implementation detail. The functionality of cppu::PropertySetMixin that is inherited from this base class and is visible to subclasses of cppu::PropertySetMixin should be treated by such subclasses as being provided by cppu::PropertySetMixin directly (e.g., in such subclasses, use “PropertySetMixin::Implements” instead of “PropertySetMixinImpl::Implements”). @since UDK 3.2.1 */ class CPPUHELPER_DLLPUBLIC PropertySetMixinImpl: public css::beans::XPropertySet, public css::beans::XFastPropertySet, public css::beans::XPropertyAccess { protected: /** @short Flags used by subclasses of cppu::PropertySetMixin to specify what UNO interface types shall be supported. */ enum Implements { /** @short Flag specifying that the UNO interface type css::beans::XPropertySet shall be supported. */ IMPLEMENTS_PROPERTY_SET = 1, /** @short Flag specifying that the UNO interface type css::beans::XFastPropertySet shall be supported. */ IMPLEMENTS_FAST_PROPERTY_SET = 2, /** @short Flag specifying that the UNO interface type css::beans::XPropertyAccess shall be supported. */ IMPLEMENTS_PROPERTY_ACCESS = 4 }; /** @short A class used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribute setter functions. This class is not thread safe; that is, the constructor, notify, and the destructor must be called from the same thread. See cppu::PropertySetMixinImpl::prepareSet for further details. */ class CPPUHELPER_DLLPUBLIC BoundListeners { public: /** @short The constructor. May throw std::bad_alloc. */ BoundListeners(); /** @short The destructor. Does not throw. */ ~BoundListeners(); /** @short Notifies any css::beans::XPropertyChangeListeners. May throw css::uno::RuntimeException and std::bad_alloc. See cppu::PropertySetMixinImpl::prepareSet for further details. */ void notify() const; private: BoundListeners( const BoundListeners&) SAL_DELETED_FUNCTION; void operator=( const BoundListeners&) SAL_DELETED_FUNCTION; class Impl; Impl * m_impl; friend class PropertySetMixinImpl; }; /** @short A function used by subclasses of cppu::PropertySetMixin when implementing UNO interface type attribute setter functions. First, this function checks whether this instance has already been disposed (see cppu::PropertySetMixinImpl::dispose), and throws a css::lang::DisposedException if applicable. For a constrained attribute (whose setter can explicitly raise css::beans::PropertyVetoException), this function notifies any css::beans::XVetoableChangeListeners. For a bound attribute, this function modifies the passed-in boundListeners so that it can afterwards be used to notify any css::beans::XPropertyChangeListeners. This function should be called before storing the new attribute value, and boundListeners->notify() should be called exactly once after storing the new attribute value (in case the attribute is bound; otherwise, calling boundListeners->notify() is ignored). Furthermore, boundListeners->notify() and this function have to be called from the same thread. May throw css::beans::PropertyVetoException, css::uno::RuntimeException (and css::lang::DisposedException in particular), and std::bad_alloc. @param propertyName the name of the property (which is the same as the name of the attribute that is going to be set) @param oldValue the property value corresponding to the old attribute value. This is only used as css::beans::PropertyChangeEvent::OldValue, which is rather useless, anyway (see “Using the Observer Pattern” in OpenOffice.org Coding Guidelines). If the attribute that is going to be set is neither bound nor constrained, or if css::beans::PropertyChangeEvent::OldValue should not be set, a VOID Any can be used instead. @param newValue the property value corresponding to the new attribute value. This is only used as css::beans::PropertyChangeEvent::NewValue, which is rather useless, anyway (see “Using the Observer Pattern” in OpenOffice.org Coding Guidelines), unless the attribute that is going to be set is constrained. If the attribute that is going to be set is neither bound nor constrained, or if it is only bound but css::beans::PropertyChangeEvent::NewValue should not be set, a VOID Any can be used instead. @param boundListeners a pointer to a fresh cppu::PropertySetMixinImpl::BoundListeners instance (which has not been passed to this function before, and on which notify has not yet been called); may only be null if the attribute that is going to be set is not bound */ void prepareSet( rtl::OUString const & propertyName, css::uno::Any const & oldValue, css::uno::Any const & newValue, BoundListeners * boundListeners); /** @short Mark this instance as being disposed. See css::lang::XComponent for the general concept of disposing UNO objects. On the first call to this function, all registered listeners (css::beans::XPropertyChangeListeners and css::beans::XVetoableChangeListeners) are notified of the disposing source. Any subsequent calls to this function are ignored. May throw css::uno::RuntimeException and std::bad_alloc. */ void dispose(); /** @short A function used by subclasses of cppu::PropertySetMixin when implementing css::uno::XInterface::queryInterface. This function checks for support of any of the UNO interface types specified in the call of the cppu::PropertySetMixin constructor. It does not check for any other UNO interface types (not even for css::uno::XInterface), and should not be used directly as the implementation of css::uno::XInterface::queryInterface of this UNO object. */ virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & type) SAL_OVERRIDE; // @see css::beans::XPropertySet::getPropertySetInfo virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() SAL_OVERRIDE; // @see css::beans::XPropertySet::setPropertyValue virtual void SAL_CALL setPropertyValue( rtl::OUString const & propertyName, css::uno::Any const & value) SAL_OVERRIDE; // @see css::beans::XPropertySet::getPropertyValue virtual css::uno::Any SAL_CALL getPropertyValue( rtl::OUString const & propertyName) SAL_OVERRIDE; /** @short Adds a css::beans::XPropertyChangeListener. If a listener is added more than once, it will receive all relevant notifications multiple times. @see css::beans::XPropertySet::addPropertyChangeListener */ virtual void SAL_CALL addPropertyChangeListener( rtl::OUString const & propertyName, css::uno::Reference< css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE; // @see css::beans::XPropertySet::removePropertyChangeListener virtual void SAL_CALL removePropertyChangeListener( rtl::OUString const & propertyName, css::uno::Reference< css::beans::XPropertyChangeListener > const & listener) SAL_OVERRIDE; /** @short Adds a css::beans::XVetoableChangeListener. If a listener is added more than once, it will receive all relevant notifications multiple times. @see css::beans::XPropertySet::addVetoableChangeListener */ virtual void SAL_CALL addVetoableChangeListener( rtl::OUString const & propertyName, css::uno::Reference< css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE; // @see css::beans::XPropertySet::removeVetoableChangeListener virtual void SAL_CALL removeVetoableChangeListener( rtl::OUString const & propertyName, css::uno::Reference< css::beans::XVetoableChangeListener > const & listener) SAL_OVERRIDE; // @see css::beans::XFastPropertySet::setFastPropertyValue virtual void SAL_CALL setFastPropertyValue( sal_Int32 handle, css::uno::Any const & value) SAL_OVERRIDE; // @see css::beans::XFastPropertySet::getFastPropertyValue virtual css::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 handle) SAL_OVERRIDE; // @see css::beans::XPropertyAccess::getPropertyValues virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues() SAL_OVERRIDE; // @see css::beans::XPropertyAccess::setPropertyValues virtual void SAL_CALL setPropertyValues( css::uno::Sequence< css::beans::PropertyValue > const & props) SAL_OVERRIDE; private: PropertySetMixinImpl( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION; void operator=( const PropertySetMixinImpl&) SAL_DELETED_FUNCTION; PropertySetMixinImpl( css::uno::Reference< css::uno::XComponentContext > const & context, Implements implements, css::uno::Sequence< rtl::OUString > const & absentOptional, css::uno::Type const & type); class Impl; Impl * m_impl; friend class Impl; template< typename T > friend class PropertySetMixin; ~PropertySetMixinImpl(); void checkUnknown(rtl::OUString const & propertyName); }; /** @short A helper mixin to implement certain UNO interfaces related to property set handling on top of the attributes of a given UNO interface type. The UNO interface type is specified by the type parameter T (which must correspond to a UNO interface type). No specializations of this class template should be added by client code. @since UDK 3.2.1 */ template< typename T > class PropertySetMixin: public PropertySetMixinImpl { protected: /** @short The constructor. May throw css::uno::RuntimeException and std::bad_alloc. @param context the component context used by this class template; must not be null, and must supply the com.sun.star.reflection.theCoreReflection and com.sun.star.reflection.theTypeDescriptionManager singletons @param implements a combination of zero or more flags specifying what UNO interface types shall be supported @param absentOptional a list of optional properties that are not present, and should thus not be visible via css::beans::XPropertySet::getPropertySetInfo, css::beans::XPropertySet::addPropertyChangeListener, css::beans::XPropertySet::removePropertyChangeListener, css::beans::XPropertySet::addVetoableChangeListener, and css::beans::XPropertySet::removeVetoableChangeListener. For consistency reasons, the given absentOptional should only contain the names of attributes that represent optional properties that are not present (that is, the attribute getters and setters always throw a css::beans::UnknownPropertyException), and should contain each such name only once. If an optional property is not present (that is, the corresponding attribute getter and setter always throw a css::beans::UnknownPropertyException) but is not contained in the given absentOptional, then it will be visible via css::beans::XPropertySet::getPropertySetInfo as a css::beans::Property with a set css::beans::PropertyAttribute::OPTIONAL. If the given implements specifies that css::beans::XPropertySet is not supported, then the given absentOptional is effectively ignored and can be empty. */ PropertySetMixin( css::uno::Reference< css::uno::XComponentContext > const & context, Implements implements, css::uno::Sequence< rtl::OUString > const & absentOptional): PropertySetMixinImpl( context, implements, absentOptional, T::static_type()) {} /** @short The destructor. Does not throw. */ ~PropertySetMixin() {} private: PropertySetMixin( const PropertySetMixin&) SAL_DELETED_FUNCTION; void operator=( const PropertySetMixin&) SAL_DELETED_FUNCTION; }; } #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ tion value='libreoffice-7-1-1'>libreoffice-7-1-1 LibreOffice 界面翻译代码仓库文档基金会
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2020-10-23 14:42:04 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2020-10-23 15:00:58 +0200
commit236b483252c94f7b38ca7fecfa16cabab498a1ac (patch)
treefaa476db220327b506da62cd4fcdda7c1d601981
parentc40c10b4dcb3363806f7ad309f5895684948513c (diff)
update translations for master/7.1.0 alpha1
and force-fix errors using pocheck Change-Id: If200fbab2e1c793a45c3f361275028afdced7b91
Diffstat