Files
libreoffice/forms/source/inc/property.hxx

231 lines
8.7 KiB
C++
Raw Normal View History

2010-10-27 12:45:03 +01:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patch contributed by Christian Lippka impress212: #i113063# patch: dubios self assign in svx/source/dialog/framelink.cxx http://svn.apache.org/viewvc?view=revision&revision=1167619 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117712#: fix several resource errors introduced by IAccessible2 implementation http://svn.apache.org/viewvc?view=revision&revision=1172343 cws mba34issues01: #i117719#: use correct resource ID http://svn.apache.org/viewvc?view=revision&revision=1172351 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 Patches contributed by Armin Le-Grand #118804# corrected GraphicExporter behaviour on shortcut when pixel graphic is requested http://svn.apache.org/viewvc?view=revision&revision=1240195 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 13f79535-47bb-0310-9956-ffa450edef68 Patch contributed by Regina Henschel linecap: Reintegrating finished LineCap feature http://svn.apache.org/viewvc?view=revision&revision=1232507 Patch contributed by Wang Lei (leiw) #i118760# split the first table cell vertically, then undo&redo, the Presentation app will crash http://svn.apache.org/viewvc?view=revision&revision=1301361 cleanup globlmn hacks, undo dependent fixmes.
2012-11-21 22:06:52 +00:00
/*
* 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 .
*/
2000-09-18 15:33:13 +00:00
#ifndef INCLUDED_FORMS_SOURCE_INC_PROPERTY_HXX
#define INCLUDED_FORMS_SOURCE_INC_PROPERTY_HXX
2000-09-18 15:33:13 +00:00
#include <sal/config.h>
#include <vector>
#include <com/sun/star/uno/XAggregation.hpp>
2000-09-18 15:33:13 +00:00
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/proptypehlp.hxx>
2000-10-19 10:52:20 +00:00
#include <comphelper/property.hxx>
#include <comphelper/propagg.hxx>
#include <tools/debug.hxx>
2000-09-18 15:33:13 +00:00
2000-10-19 10:52:20 +00:00
using namespace comphelper;
2000-09-18 15:33:13 +00:00
//= property helper classes
2000-09-18 15:33:13 +00:00
namespace frm
{
//= assigment property handle <-> property name
//= used by the PropertySetAggregationHelper
2000-09-18 15:33:13 +00:00
class PropertyInfoService
{
2000-09-18 15:33:13 +00:00
struct PropertyAssignment
{
OUString sName;
2000-09-18 15:33:13 +00:00
sal_Int32 nHandle;
PropertyAssignment() { nHandle = -1; }
PropertyAssignment(const PropertyAssignment& _rSource)
:sName(_rSource.sName), nHandle(_rSource.nHandle) { }
PropertyAssignment(const OUString& _rName, sal_Int32 _nHandle)
2000-09-18 15:33:13 +00:00
:sName(_rName), nHandle(_nHandle) { }
};
typedef std::vector<PropertyAssignment> PropertyMap;
2000-09-18 15:33:13 +00:00
static PropertyMap s_AllKnownProperties;
2000-09-18 15:33:13 +00:00
// comparing two PropertyAssignment's
public:
typedef PropertyAssignment PUBLIC_SOLARIS_COMPILER_HACK;
// did not get the following compiled under with SUNPRO 5 without this
// public typedef
private:
friend struct PropertyAssignmentNameCompareLess;
typedef ::std::binary_function< PUBLIC_SOLARIS_COMPILER_HACK, PUBLIC_SOLARIS_COMPILER_HACK, sal_Bool > PropertyAssignmentNameCompareLess_Base;
2000-09-18 15:33:13 +00:00
struct PropertyAssignmentNameCompareLess : public PropertyAssignmentNameCompareLess_Base
{
inline bool operator() (const PUBLIC_SOLARIS_COMPILER_HACK& _rL, const PUBLIC_SOLARIS_COMPILER_HACK& _rR) const
2000-09-18 15:33:13 +00:00
{
return (_rL.sName.compareTo(_rR.sName) < 0);
}
};
public:
PropertyInfoService() { }
public:
static sal_Int32 getPropertyId(const OUString& _rName);
static OUString getPropertyName(sal_Int32 _nHandle);
2000-09-18 15:33:13 +00:00
private:
static void initialize();
};
2000-10-19 10:52:20 +00:00
// a class implementing the comphelper::IPropertyInfoService
class ConcreteInfoService : public ::comphelper::IPropertyInfoService
2000-09-18 15:33:13 +00:00
{
public:
virtual ~ConcreteInfoService() {}
virtual sal_Int32 getPreferredPropertyId(const OUString& _rName) SAL_OVERRIDE;
2000-09-18 15:33:13 +00:00
};
2000-09-18 15:33:13 +00:00
#define DECL_PROP_IMPL(varname, type) \
*pProperties++ = com::sun::star::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, cppu::UnoType<type>::get(),
2000-09-18 15:33:13 +00:00
2000-09-18 15:33:13 +00:00
#define DECL_BOOL_PROP_IMPL(varname) \
*pProperties++ = com::sun::star::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, cppu::UnoType<bool>::get(),
2000-09-18 15:33:13 +00:00
2000-09-18 15:33:13 +00:00
#define DECL_IFACE_PROP_IMPL(varname, type) \
*pProperties++ = com::sun::star::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, cppu::UnoType<type>::get(),
2000-09-18 15:33:13 +00:00
#define BEGIN_DESCRIBE_PROPERTIES( count, baseclass ) \
baseclass::describeFixedProperties( _rProps ); \
sal_Int32 nOldCount = _rProps.getLength(); \
_rProps.realloc( nOldCount + ( count ) ); \
::com::sun::star::beans::Property* pProperties = _rProps.getArray() + nOldCount; \
#define BEGIN_DESCRIBE_BASE_PROPERTIES( count ) \
_rProps.realloc( count ); \
::com::sun::star::beans::Property* pProperties = _rProps.getArray(); \
#define BEGIN_DESCRIBE_AGGREGATION_PROPERTIES( count, aggregate ) \
_rProps.realloc( count ); \
::com::sun::star::beans::Property* pProperties = _rProps.getArray(); \
2000-09-18 15:33:13 +00:00
\
if (aggregate.is()) \
_rAggregateProps = aggregate->getPropertySetInfo()->getProperties(); \
2000-09-18 15:33:13 +00:00
#define DECL_PROP0(varname, type) \
DECL_PROP_IMPL(varname, type) 0)
2000-09-18 15:33:13 +00:00
#define DECL_PROP1(varname, type, attrib1) \
DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1)
2000-09-18 15:33:13 +00:00
2000-09-18 15:33:13 +00:00
#define DECL_PROP2(varname, type, attrib1, attrib2) \
DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2)
2000-09-18 15:33:13 +00:00
2000-09-18 15:33:13 +00:00
#define DECL_PROP3(varname, type, attrib1, attrib2, attrib3) \
DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2 | com::sun::star::beans::PropertyAttribute::attrib3)
2000-09-18 15:33:13 +00:00
2000-09-18 15:33:13 +00:00
#define DECL_PROP4(varname, type, attrib1, attrib2, attrib3, attrib4) \
DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2 | com::sun::star::beans::PropertyAttribute::attrib3 | com::sun::star::beans::PropertyAttribute::attrib4)
2000-09-18 15:33:13 +00:00
// === some property types require special handling
// === such as interfaces
2000-09-18 15:33:13 +00:00
#define DECL_IFACE_PROP0(varname, type) \
DECL_IFACE_PROP_IMPL(varname, type) 0)
2000-09-18 15:33:13 +00:00
#define DECL_IFACE_PROP1(varname, type, attrib1) \
DECL_IFACE_PROP_IMPL(varname, type) css::beans::PropertyAttribute::attrib1)
2000-09-18 15:33:13 +00:00
2000-09-18 15:33:13 +00:00
#define DECL_IFACE_PROP2(varname, type, attrib1, attrib2) \
DECL_IFACE_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2)
2000-09-18 15:33:13 +00:00
2000-09-18 15:33:13 +00:00
#define DECL_IFACE_PROP3(varname, type, attrib1, attrib2, attrib3) \
DECL_IFACE_PROP_IMPL(varname, type) css::beans::PropertyAttribute::attrib1 | css::beans::PropertyAttribute::attrib2 | css::beans::PropertyAttribute::attrib3)
2000-09-18 15:33:13 +00:00
2000-09-18 15:33:13 +00:00
#define DECL_IFACE_PROP4(varname, type, attrib1, attrib2, attrib3, attrib4) \
DECL_IFACE_PROP_IMPL(varname, type) css::beans::PropertyAttribute::attrib1 | css::beans::PropertyAttribute::attrib2 | css::beans::PropertyAttribute::attrib3 | PropertyAttribute::attrib4)
2000-09-18 15:33:13 +00:00
// === or Boolean properties
2000-09-18 15:33:13 +00:00
#define DECL_BOOL_PROP0(varname) \
DECL_BOOL_PROP_IMPL(varname) 0)
2000-09-18 15:33:13 +00:00
#define DECL_BOOL_PROP1(varname, attrib1) \
DECL_BOOL_PROP_IMPL(varname) com::sun::star::beans::PropertyAttribute::attrib1)
2000-09-18 15:33:13 +00:00
2000-09-18 15:33:13 +00:00
#define DECL_BOOL_PROP2(varname, attrib1, attrib2) \
DECL_BOOL_PROP_IMPL(varname) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2)
2000-09-18 15:33:13 +00:00
#define DECL_BOOL_PROP3( varname, attrib1, attrib2, attrib3 ) \
DECL_BOOL_PROP_IMPL(varname) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2 | com::sun::star::beans::PropertyAttribute::attrib3 )
2000-09-18 15:33:13 +00:00
#define END_DESCRIBE_PROPERTIES() \
DBG_ASSERT( pProperties == _rProps.getArray() + _rProps.getLength(), "<...>::describeFixedProperties/getInfoHelper: forgot to adjust the count ?"); \
2000-09-18 15:33:13 +00:00
#define REGISTER_PROP_1( prop, member, attrib1 ) \
registerProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::attrib1, \
&member, cppu::UnoType<decltype(member)>::get() );
#define REGISTER_PROP_2( prop, member, attrib1, attrib2 ) \
registerProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::attrib1 | PropertyAttribute::attrib2, \
&member, cppu::UnoType<decltype(member)>::get() );
CWS-TOOLING: integrate CWS rtlcontrols 2008-12-11 21:08:49 +0100 fs r265367 : CONTEXT_WRITING_MODE is transient 2008-12-11 21:08:00 +0100 fs r265365 : REGISTER_PROP_3 2008-12-11 20:53:44 +0100 fs r265362 : ContextWritingMode is not MAYBEVOID 2008-12-11 15:29:08 +0100 fs r265315 : prevent a deadlock during complex.dbaccess.DatabaseDocument test 2008-12-11 15:01:13 +0100 fs r265304 : manual RESYNC to m37 2008-12-10 20:04:38 +0100 pl r265230 : #i30631# fix a snafu in mirroring 2008-12-10 19:14:45 +0100 pl r265229 : #i30631# rework PaintToDevice for RTL controls 2008-12-05 10:19:13 +0100 fs r264893 : #i10000# ImplInitSettings => ImplInitWindow (ImplInitSettings clashed with base classes ImplInitSettings on unxsols4) 2008-12-03 12:55:24 +0100 fs r264768 : #i100000# 2008-12-03 07:11:48 +0100 fs r264741 : #i10000# 2008-12-02 10:37:51 +0100 fs r264670 : CWS-TOOLING: rebase CWS rtlcontrols to trunk@264325 (milestone: DEV300:m36) 2008-12-02 09:27:50 +0100 fs r264660 : merge from trunk 2008-11-25 10:28:36 +0100 ama r264277 : Fix #i94572# 2008-11-24 11:46:48 +0100 fs r264218 : #i30631# proper context writing mode 2008-11-24 09:38:04 +0100 fs r264204 : #i30631# (approved by PL) 2008-11-24 09:35:47 +0100 fs r264203 : #i30631# Context/WritingMode 2008-11-24 09:33:36 +0100 fs r264202 : #i30631# Context/WritingMode 2008-11-24 09:31:53 +0100 fs r264200 : #i30631# RTL 2008-11-19 08:51:48 +0100 fs r263963 : #i10000# 2008-11-18 20:58:11 +0100 fs r263878 : #i10000# 2008-11-18 15:30:44 +0100 fs r263778 : migrate the CWS from CVS to SVN the CVS changes contained in this change set are the ones between the following two CVS tags: CWS_DEV300_RTLCONTROLS_ANCHOR CWS_DEV300_RTLCONTROLS_PRE_MIGRATION 2008-11-18 12:29:04 +0100 ama r263762 : Fix #i94572#: Context direction for drawing objects 2008-11-18 12:25:50 +0100 ama r263761 : Fix #i94572#: Context direction for drawing objects 2008-11-18 12:02:30 +0100 ama r263759 : Fix #i94572#: Context direction for drawing objects
2008-12-16 13:30:53 +00:00
#define REGISTER_PROP_3( prop, member, attrib1, attrib2, attrib3 ) \
registerProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::attrib1 | PropertyAttribute::attrib2 | PropertyAttribute::attrib3, \
&member, cppu::UnoType<decltype(member)>::get() );
CWS-TOOLING: integrate CWS rtlcontrols 2008-12-11 21:08:49 +0100 fs r265367 : CONTEXT_WRITING_MODE is transient 2008-12-11 21:08:00 +0100 fs r265365 : REGISTER_PROP_3 2008-12-11 20:53:44 +0100 fs r265362 : ContextWritingMode is not MAYBEVOID 2008-12-11 15:29:08 +0100 fs r265315 : prevent a deadlock during complex.dbaccess.DatabaseDocument test 2008-12-11 15:01:13 +0100 fs r265304 : manual RESYNC to m37 2008-12-10 20:04:38 +0100 pl r265230 : #i30631# fix a snafu in mirroring 2008-12-10 19:14:45 +0100 pl r265229 : #i30631# rework PaintToDevice for RTL controls 2008-12-05 10:19:13 +0100 fs r264893 : #i10000# ImplInitSettings => ImplInitWindow (ImplInitSettings clashed with base classes ImplInitSettings on unxsols4) 2008-12-03 12:55:24 +0100 fs r264768 : #i100000# 2008-12-03 07:11:48 +0100 fs r264741 : #i10000# 2008-12-02 10:37:51 +0100 fs r264670 : CWS-TOOLING: rebase CWS rtlcontrols to trunk@264325 (milestone: DEV300:m36) 2008-12-02 09:27:50 +0100 fs r264660 : merge from trunk 2008-11-25 10:28:36 +0100 ama r264277 : Fix #i94572# 2008-11-24 11:46:48 +0100 fs r264218 : #i30631# proper context writing mode 2008-11-24 09:38:04 +0100 fs r264204 : #i30631# (approved by PL) 2008-11-24 09:35:47 +0100 fs r264203 : #i30631# Context/WritingMode 2008-11-24 09:33:36 +0100 fs r264202 : #i30631# Context/WritingMode 2008-11-24 09:31:53 +0100 fs r264200 : #i30631# RTL 2008-11-19 08:51:48 +0100 fs r263963 : #i10000# 2008-11-18 20:58:11 +0100 fs r263878 : #i10000# 2008-11-18 15:30:44 +0100 fs r263778 : migrate the CWS from CVS to SVN the CVS changes contained in this change set are the ones between the following two CVS tags: CWS_DEV300_RTLCONTROLS_ANCHOR CWS_DEV300_RTLCONTROLS_PRE_MIGRATION 2008-11-18 12:29:04 +0100 ama r263762 : Fix #i94572#: Context direction for drawing objects 2008-11-18 12:25:50 +0100 ama r263761 : Fix #i94572#: Context direction for drawing objects 2008-11-18 12:02:30 +0100 ama r263759 : Fix #i94572#: Context direction for drawing objects
2008-12-16 13:30:53 +00:00
#define REGISTER_VOID_PROP_1( prop, memberAny, type, attrib1 ) \
registerMayBeVoidProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::MAYBEVOID | PropertyAttribute::attrib1, \
&memberAny, cppu::UnoType<type>::get() );
#define REGISTER_VOID_PROP_2( prop, memberAny, type, attrib1, attrib2 ) \
registerMayBeVoidProperty( PROPERTY_##prop, PROPERTY_ID_##prop, PropertyAttribute::MAYBEVOID | PropertyAttribute::attrib1 | PropertyAttribute::attrib2, \
&memberAny, cppu::UnoType<type>::get() );
2000-09-18 15:33:13 +00:00
}
//... namespace frm .......................................................
#endif // INCLUDED_FORMS_SOURCE_INC_PROPERTY_HXX
2000-09-18 15:33:13 +00:00
2010-10-27 12:45:03 +01:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */