23#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
24#include <com/sun/star/lang/IllegalArgumentException.hpp>
25#include <com/sun/star/uno/XComponentContext.hpp>
32 using ::com::sun::star::uno::XComponentContext;
33 using ::com::sun::star::uno::Sequence;
34 using ::com::sun::star::uno::Any;
35 using ::com::sun::star::inspection::PropertyCategoryDescriptor;
36 using ::com::sun::star::uno::XInterface;
37 using ::com::sun::star::lang::IllegalArgumentException;
38 using ::com::sun::star::ucb::AlreadyInitializedException;
45 class ObjectInspectorModel :
public ImplInspectorModel
48 Sequence< Any > m_aFactories;
51 ObjectInspectorModel();
54 virtual Sequence< Any > SAL_CALL getHandlerFactories()
override;
55 virtual Sequence< PropertyCategoryDescriptor > SAL_CALL describeCategories( )
override;
56 virtual ::sal_Int32 SAL_CALL getPropertyOrderIndex(
const OUString& PropertyName )
override;
59 virtual void SAL_CALL initialize(
const Sequence< Any >& aArguments )
override;
67 void createWithHandlerFactories(
const Sequence< Any >& _rFactories );
68 void createWithHandlerFactoriesAndHelpSection(
const Sequence< Any >& _rFactories, sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines );
73 void impl_verifyArgument_throw(
bool _bCondition, sal_Int16 _nArgumentPosition );
80 ObjectInspectorModel::ObjectInspectorModel()
85 Sequence< Any > SAL_CALL ObjectInspectorModel::getHandlerFactories()
91 Sequence< PropertyCategoryDescriptor > SAL_CALL ObjectInspectorModel::describeCategories( )
94 return Sequence< PropertyCategoryDescriptor >( );
98 ::sal_Int32 SAL_CALL ObjectInspectorModel::getPropertyOrderIndex(
const OUString& )
105 void SAL_CALL ObjectInspectorModel::initialize(
const Sequence< Any >& _arguments )
107 ::osl::MutexGuard aGuard(
m_aMutex );
108 if ( m_aFactories.hasElements() )
109 throw AlreadyInitializedException();
111 StlSyntaxSequence< Any > arguments( _arguments );
112 if ( arguments.empty() )
118 Sequence< Any > factories;
119 impl_verifyArgument_throw( arguments[0] >>= factories, 1 );
121 if ( arguments.size() == 1 )
123 createWithHandlerFactories( factories );
127 if ( arguments.size() == 3 )
129 sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 );
130 impl_verifyArgument_throw( arguments[1] >>= nMinHelpTextLines, 2 );
131 impl_verifyArgument_throw( arguments[2] >>= nMaxHelpTextLines, 3 );
132 createWithHandlerFactoriesAndHelpSection( factories, nMinHelpTextLines, nMaxHelpTextLines );
136 impl_verifyArgument_throw(
false, 2 );
140 OUString SAL_CALL ObjectInspectorModel::getImplementationName( )
142 return "org.openoffice.comp.extensions.ObjectInspectorModel";
146 Sequence< OUString > SAL_CALL ObjectInspectorModel::getSupportedServiceNames( )
148 return {
"com.sun.star.inspection.ObjectInspectorModel" };
152 void ObjectInspectorModel::createDefault()
154 m_aFactories = {
Any(OUString(
"com.sun.star.inspection.GenericPropertyHandler" )) };
158 void ObjectInspectorModel::createWithHandlerFactories(
const Sequence< Any >& _rFactories )
160 impl_verifyArgument_throw( _rFactories.hasElements(), 1 );
161 m_aFactories = _rFactories;
165 void ObjectInspectorModel::createWithHandlerFactoriesAndHelpSection(
const Sequence< Any >& _rFactories, sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines )
167 impl_verifyArgument_throw( _rFactories.hasElements(), 1 );
168 impl_verifyArgument_throw( _nMinHelpTextLines >= 1, 2 );
169 impl_verifyArgument_throw( _nMaxHelpTextLines >= 1, 3 );
170 impl_verifyArgument_throw( _nMinHelpTextLines <= _nMaxHelpTextLines, 2 );
172 m_aFactories = _rFactories;
173 enableHelpSectionProperties( _nMinHelpTextLines, _nMaxHelpTextLines );
177 void ObjectInspectorModel::impl_verifyArgument_throw(
bool _bCondition, sal_Int16 _nArgumentPosition )
180 throw IllegalArgumentException( OUString(), *
this, _nArgumentPosition );
186extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
188 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any>
const&)
190 return cppu::acquire(
new pcr::ObjectInspectorModel());
css::uno::Reference< css::uno::XInterface > createDefault(css::uno::Reference< css::uno::XComponentContext > const &context)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
a property handler for any virtual string properties
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * extensions_propctrlr_ObjectInspectorModel_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)