/* -*- 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 .
*/
class OPropertyInfoService; typedef ::cppu::WeakComponentImplHelper < css::inspection::XPropertyHandler
> PropertyHandler_Base; /** the base class for property handlers
*/ class PropertyHandler : public ::cppu::BaseMutex
, public PropertyHandler_Base
{ private: /// cache for getSupportedProperties mutable StlSyntaxSequence< css::beans::Property >
m_aSupportedProperties; mutablebool m_bSupportedPropertiesAreKnown;
private: /// the property listener which has been registered
PropertyChangeListeners m_aPropertyListeners;
protected: /// the context in which the instance was created
css::uno::Reference< css::uno::XComponentContext > m_xContext; /// the component we're inspecting
css::uno::Reference< css::beans::XPropertySet > m_xComponent; /// info about our component's properties
css::uno::Reference< css::beans::XPropertySetInfo > m_xComponentPropertyInfo; /// type converter, needed on various occasions
css::uno::Reference< css::script::XTypeConverter > m_xTypeConverter; /// access to property meta data
std::unique_ptr< OPropertyInfoService > m_pInfoService;
/// called when XPropertyHandler::inspect has been called, and we thus have a new component to inspect virtualvoid onNewComponent();
protected: /** fires the change in a property value to our listener (if any) @see addPropertyChangeListener
*/ void firePropertyChange( const OUString& _rPropName, PropertyId _nPropId, const css::uno::Any& _rOldValue, const css::uno::Any& _rNewValue );
/** retrieves a window which can be used as parent for dialogs
*/
weld::Window* impl_getDefaultDialogFrame_nothrow() const;
/** retrieves the property id for a given property name @throw css::beans::UnknownPropertyException if the property name is not known to our ->m_pInfoService
*/
PropertyId impl_getPropertyId_throwUnknownProperty( const OUString& _rPropertyName ) const;
/** retrieves the property id for a given property name @throw css::uno::RuntimeException if the property name is not known to our ->m_pInfoService
*/
PropertyId impl_getPropertyId_throwRuntime( const OUString& _rPropertyName ) const;
/** retrieves the property id for a given property name @returns -1 if the property name is not known to our ->m_pInfoService
*/
PropertyId impl_getPropertyId_nothrow( const OUString& _rPropertyName ) const;
// helper for implementing doDescribeSupportedProperties /** adds a description for the given string property to the given property vector Most probably to be called from within getSupportedProperties
*/ inlinevoid addStringPropertyDescription(
std::vector< css::beans::Property >& _rProperties, const OUString& _rPropertyName
) const;
/** adds a description for the given int32 property to the given property vector
*/ inlinevoid addInt32PropertyDescription(
std::vector< css::beans::Property >& _rProperties, const OUString& _rPropertyName,
sal_Int16 _nAttribs = 0
) const;
/** adds a description for the given int16 property to the given property vector
*/ inlinevoid addInt16PropertyDescription(
std::vector< css::beans::Property >& _rProperties, const OUString& _rPropertyName,
sal_Int16 _nAttribs = 0
) const;
/** adds a description for the given double property to the given property vector
*/ inlinevoid addDoublePropertyDescription(
std::vector< css::beans::Property >& _rProperties, const OUString& _rPropertyName,
sal_Int16 _nAttribs
) const;
/** adds a description for the given date property to the given property vector
*/ inlinevoid addDatePropertyDescription(
std::vector< css::beans::Property >& _rProperties, const OUString& _rPropertyName,
sal_Int16 _nAttribs
) const;
/** adds a description for the given time property to the given property vector
*/ inlinevoid addTimePropertyDescription(
std::vector< css::beans::Property >& _rProperties, const OUString& _rPropertyName,
sal_Int16 _nAttribs
) const;
/** adds a description for the given DateTime property to the given property vector
*/ inlinevoid addDateTimePropertyDescription(
std::vector< css::beans::Property >& _rProperties, const OUString& _rPropertyName,
sal_Int16 _nAttribs
) const;
/// adds a Property, given by name only, to a given vector of Properties void implAddPropertyDescription(
std::vector< css::beans::Property >& _rProperties, const OUString& _rPropertyName, const css::uno::Type& _rType,
sal_Int16 _nAttribs = 0
) const;
// helper for accessing and maintaining meta data about our supported properties
/** retrieves a property given by handle
@return a pointer to the descriptor for the given properties, if it is one of our supported properties, <NULL/> else.
/** get the name of a property given by handle
*/ inline OUString
impl_getPropertyNameFromId_nothrow( PropertyId _nPropId ) const;
/** returns the value of the ContextDocument property in the ComponentContext which was used to create this handler.
*/
css::uno::Reference< css::frame::XModel >
impl_getContextDocument_nothrow() const
{ return css::uno::Reference< css::frame::XModel >(
m_xContext->getValueByName( u"ContextDocument"_ustr ), css::uno::UNO_QUERY );
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.