Files
libreoffice/toolkit/source/controls/unocontrolmodel.cxx

1406 lines
62 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 16:07:07 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 16:07:07 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 16:07:07 +00:00
*
************************************************************************/
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/awt/FontWidth.hpp>
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/awt/FontSlant.hpp>
CWS-TOOLING: integrate CWS dba32c 2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion 2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time 2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths 2009-06-29 10:08:54 +0200 fs r273455 : #i103138# refactored the code for positioning/zooming the control Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to take an additional ViewTransformation parameter, describing the transformation to obtain the actual control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter. This has become necessary since during painting, the device which we created our control for might not necessarily have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size, this would lead to wrong results. Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken. Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ... I consider it broken, since: - we need the map mode to obtain the proper zoom level, which is to be forwarded to the control - there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears). It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand one has no possibility to obtain the current zoom by other means. Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used, which means the controls have a zoom of "1:1" set, which is wrong here. 2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties 2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning 2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed 2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc 2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux 2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux 2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar 2009-06-15 14:11:27 +0200 fs r272983 : added since tag 2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted 2009-06-15 11:08:53 +0200 fs r272969 : #i10000# 2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701# 2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src 2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50) 2009-06-02 09:53:10 +0200 fs r272483 : #i10000# 2009-05-29 15:55:03 +0200 fs r272465 : #i100818# 2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any 2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition 2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex 2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed 2009-05-27 14:53:36 +0200 fs r272347 : #i10000# 2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast 2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly 2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used 2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function 2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well 2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution 2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set 2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition 2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria 2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR 2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein 2009-05-25 15:49:57 +0200 fs r272254 : #i999704# 2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property 2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString 2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein 2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property 2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property) 2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default 2009-05-25 14:39:31 +0200 fs r272243 : removed dead import 2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns 2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent 2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel 2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event 2009-05-22 21:42:47 +0200 fs r272211 : #i102003# 2009-05-22 21:42:20 +0200 fs r272210 : grammar 2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously 2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear 2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG 2009-05-22 12:03:42 +0200 fs r272180 : #i88878# provided by noel.power@novell.com implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs 2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them 2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values 2009-05-15 15:08:31 +0200 fs r271937 : includes 2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint 2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity 2009-05-15 10:15:44 +0200 fs r271928 : #i10000# 2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:23:23 +0200 fs r271919 : #i101622# 2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids 2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b) 2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48 2009-05-07 14:43:19 +0200 fs r271670 : #i101477# 2009-05-07 14:37:30 +0200 fs r271668 : #i101477# 2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch 2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics 2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47) 2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control 2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
#include <com/sun/star/awt/MouseWheelBehavior.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
#include <com/sun/star/awt/XDevice.hpp>
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
#include <com/sun/star/text/WritingMode2.hpp>
2000-09-18 16:07:07 +00:00
#include <com/sun/star/io/XMarkableStream.hpp>
#include <toolkit/controls/unocontrolmodel.hxx>
#include <toolkit/helper/macros.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <rtl/uuid.h>
#include <tools/diagnose_ex.h>
2000-09-18 16:07:07 +00:00
#include <tools/date.hxx>
#include <tools/time.hxx>
#include <tools/debug.hxx>
#include <toolkit/helper/property.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <toolkit/helper/emptyfontdescriptor.hxx>
#include <com/sun/star/lang/Locale.hpp>
#include <unotools/localedatawrapper.hxx>
#include <unotools/configmgr.hxx>
#include <comphelper/processfactory.hxx>
2000-11-02 10:12:12 +00:00
#include <comphelper/sequence.hxx>
#include <comphelper/extract.hxx>
2000-09-18 16:07:07 +00:00
#include <vcl/svapp.hxx>
#include <uno/data.h>
#include <memory>
#include <set>
2001-01-24 14:00:58 +00:00
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::i18n;
using ::com::sun::star::awt::FontDescriptor;
2001-01-24 14:00:58 +00:00
2000-09-18 16:07:07 +00:00
#define UNOCONTROL_STREAMVERSION (short)2
static void lcl_ImplMergeFontProperty( FontDescriptor& rFD, sal_uInt16 nPropId, const Any& rValue )
2000-09-18 16:07:07 +00:00
{
// some props are defined with other types than the matching FontDescriptor members have
// (e.g. FontWidth, FontSlant)
// 78474 - 09/19/2000 - FS
float nExtractFloat = 0;
sal_Int16 nExtractShort = 0;
2000-09-18 16:07:07 +00:00
switch ( nPropId )
{
case BASEPROPERTY_FONTDESCRIPTORPART_NAME: rValue >>= rFD.Name;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: rValue >>= rFD.StyleName;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: rValue >>= rFD.Family;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: rValue >>= rFD.CharSet;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: rValue >>= nExtractFloat; rFD.Height = (sal_Int16)nExtractFloat;
2000-09-18 16:07:07 +00:00
break;
case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue >>= rFD.Weight;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: if ( rValue >>= nExtractShort )
rFD.Slant = (::com::sun::star::awt::FontSlant)nExtractShort;
else
rValue >>= rFD.Slant;
2000-09-18 16:07:07 +00:00
break;
case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: rValue >>= rFD.Underline;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: rValue >>= rFD.Strikeout;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: rValue >>= rFD.Width;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: rValue >>= rFD.Pitch;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: rValue >>= rFD.CharacterWidth;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: rValue >>= rFD.Orientation;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: rValue >>= rFD.Kerning;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: rValue >>= rFD.WordLineMode;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: rValue >>= rFD.Type;
break;
2011-03-01 19:08:19 +01:00
default: OSL_FAIL( "FontProperty?!" );
2000-09-18 16:07:07 +00:00
}
}
// ----------------------------------------------------
// class UnoControlModel
// ----------------------------------------------------
UnoControlModel::UnoControlModel( const Reference< XMultiServiceFactory >& i_factory )
:UnoControlModel_Base()
,MutexAndBroadcastHelper()
,OPropertySetHelper( BrdcstHelper )
,maDisposeListeners( *this )
,maContext( i_factory )
2000-09-18 16:07:07 +00:00
{
// Insert properties from Model into table,
// only existing properties are valid, even if they're VOID
2000-09-18 16:07:07 +00:00
}
2001-01-24 14:00:58 +00:00
UnoControlModel::UnoControlModel( const UnoControlModel& rModel )
: UnoControlModel_Base()
, MutexAndBroadcastHelper()
, OPropertySetHelper( BrdcstHelper )
, maData( rModel.maData )
, maDisposeListeners( *this )
, maContext( rModel.maContext )
2001-01-24 14:00:58 +00:00
{
2000-09-18 16:07:07 +00:00
}
::com::sun::star::uno::Sequence<sal_Int32> UnoControlModel::ImplGetPropertyIds() const
{
sal_uInt32 nIDs = maData.size();
2000-09-18 16:07:07 +00:00
::com::sun::star::uno::Sequence<sal_Int32> aIDs( nIDs );
sal_Int32* pIDs = aIDs.getArray();
sal_uInt32 n = 0;
for ( ImplPropertyTable::const_iterator it = maData.begin(); it != maData.end(); ++it )
pIDs[n++] = it->first;
2000-09-18 16:07:07 +00:00
return aIDs;
}
sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const
{
if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
nPropId = BASEPROPERTY_FONTDESCRIPTOR;
return maData.find( nPropId ) != maData.end() ? sal_True : sal_False;
2000-09-18 16:07:07 +00:00
}
::com::sun::star::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
::com::sun::star::uno::Any aDefault;
CWS-TOOLING: integrate CWS cmcfixes51 2008-12-08 10:12:55 +0100 cmc r264975 : #i96203# protect with ifdefs to avoid unused symbol on mac 2008-12-05 12:23:47 +0100 cmc r264898 : CWS-TOOLING: rebase CWS cmcfixes51 to trunk@264807 (milestone: DEV300:m37) 2008-12-01 14:45:17 +0100 cmc r264606 : #i76655# ehlos apparently required 2008-11-28 17:49:30 +0100 cmc r264567 : #i96655# remove newly unused method 2008-11-28 10:41:28 +0100 cmc r264531 : #i96647# better ppc-bridges flushCode impl 2008-11-27 12:58:40 +0100 cmc r264478 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 12:32:49 +0100 cmc r264476 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 12:26:02 +0100 cmc r264475 : #i96655# redundant old table export helpers 2008-11-27 11:49:06 +0100 cmc r264473 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 11:38:35 +0100 cmc r264471 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 11:14:21 +0100 cmc r264467 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 11:06:22 +0100 cmc r264464 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 10:58:18 +0100 cmc r264462 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 10:41:44 +0100 cmc r264461 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 10:19:24 +0100 cmc r264460 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 10:13:39 +0100 cmc r264459 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 10:06:14 +0100 cmc r264458 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:59:54 +0100 cmc r264457 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:52:51 +0100 cmc r264456 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:48:26 +0100 cmc r264454 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:40:20 +0100 cmc r264452 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:35:26 +0100 cmc r264451 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:31:00 +0100 cmc r264450 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:24:08 +0100 cmc r264449 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 00:26:15 +0100 cmc r264443 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 00:21:01 +0100 cmc r264442 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 00:09:40 +0100 cmc r264441 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 23:51:56 +0100 cmc r264440 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 23:49:09 +0100 cmc r264439 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 18:09:54 +0100 cmc r264432 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 18:07:40 +0100 cmc r264431 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 17:28:02 +0100 cmc r264429 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 17:27:39 +0100 cmc r264428 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 17:18:36 +0100 cmc r264426 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 16:22:16 +0100 cmc r264415 : #i96624# make implicit braces and brackets explicit to avoid warnings 2008-11-26 16:00:23 +0100 cmc r264409 : #i90426# remove warnings from svtools 2008-11-26 15:59:17 +0100 cmc r264408 : #i90426# remove warnings 2008-11-26 15:47:32 +0100 cmc r264404 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 14:46:57 +0100 cmc r264394 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 14:19:50 +0100 cmc r264387 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 14:15:26 +0100 cmc r264386 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 14:11:26 +0100 cmc r264384 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 13:44:23 +0100 cmc r264380 : #i96084# comfirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 13:12:24 +0100 cmc r264372 : #i96604# silence new warnings 2008-11-26 12:35:02 +0100 cmc r264369 : #i96203# make qstarter work in 3-layer land 2008-11-26 12:33:04 +0100 cmc r264368 : #i96170# ensure gtypes are up and running
2008-12-11 07:05:03 +00:00
if (
(nPropId == BASEPROPERTY_FONTDESCRIPTOR) ||
(
(nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START) &&
(nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END)
)
)
2000-09-18 16:07:07 +00:00
{
EmptyFontDescriptor aFD;
switch ( nPropId )
{
case BASEPROPERTY_FONTDESCRIPTOR: aDefault <<= aFD; break;
case BASEPROPERTY_FONTDESCRIPTORPART_NAME: aDefault <<= aFD.Name; break;
case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: aDefault <<= aFD.StyleName; break;
case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: aDefault <<= aFD.Family; break;
case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: aDefault <<= aFD.CharSet; break;
case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: aDefault <<= (float)aFD.Height; break;
case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: aDefault <<= aFD.Weight; break;
case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: aDefault <<= (sal_Int16)aFD.Slant; break;
case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: aDefault <<= aFD.Underline; break;
case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: aDefault <<= aFD.Strikeout; break;
case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: aDefault <<= aFD.Width; break;
case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: aDefault <<= aFD.Pitch; break;
case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: aDefault <<= aFD.CharacterWidth; break;
case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: aDefault <<= aFD.Orientation; break;
case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: aDefault <<= aFD.Kerning; break;
case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: aDefault <<= aFD.WordLineMode; break;
case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: aDefault <<= aFD.Type; break;
2011-03-01 19:08:19 +01:00
default: OSL_FAIL( "FontProperty?!" );
2000-09-18 16:07:07 +00:00
}
}
else
{
switch ( nPropId )
{
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
case BASEPROPERTY_GRAPHIC:
aDefault <<= Reference< graphic::XGraphic >();
break;
case BASEPROPERTY_REFERENCE_DEVICE:
aDefault <<= Reference< awt::XDevice >();
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
break;
case BASEPROPERTY_ITEM_SEPARATOR_POS:
case BASEPROPERTY_VERTICALALIGN:
case BASEPROPERTY_BORDERCOLOR:
case BASEPROPERTY_SYMBOL_COLOR:
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_TABSTOP:
case BASEPROPERTY_TEXTCOLOR:
case BASEPROPERTY_TEXTLINECOLOR:
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_DATE:
case BASEPROPERTY_DATESHOWCENTURY:
case BASEPROPERTY_TIME:
case BASEPROPERTY_VALUE_DOUBLE:
2001-04-26 08:09:16 +00:00
case BASEPROPERTY_PROGRESSVALUE:
2001-05-02 11:31:11 +00:00
case BASEPROPERTY_SCROLLVALUE:
case BASEPROPERTY_VISIBLESIZE:
2001-04-26 08:09:16 +00:00
case BASEPROPERTY_BACKGROUNDCOLOR:
case BASEPROPERTY_FILLCOLOR: break; // Void
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_FONTRELIEF:
case BASEPROPERTY_FONTEMPHASISMARK:
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_MAXTEXTLEN:
case BASEPROPERTY_STATE:
case BASEPROPERTY_EXTDATEFORMAT:
case BASEPROPERTY_EXTTIMEFORMAT:
2001-04-26 08:09:16 +00:00
case BASEPROPERTY_ECHOCHAR: aDefault <<= (sal_Int16) 0; break;
case BASEPROPERTY_BORDER: aDefault <<= (sal_Int16) 1; break;
case BASEPROPERTY_DECIMALACCURACY: aDefault <<= (sal_Int16) 2; break;
case BASEPROPERTY_LINECOUNT: aDefault <<= (sal_Int16) 5; break;
case BASEPROPERTY_ALIGN: aDefault <<= (sal_Int16) PROPERTY_ALIGN_LEFT; break;
2001-06-06 07:36:56 +00:00
case BASEPROPERTY_IMAGEALIGN: aDefault <<= (sal_Int16) 1 /*ImageAlign::TOP*/; break;
case BASEPROPERTY_IMAGEPOSITION: aDefault <<= (sal_Int16) 12 /*ImagePosition::Centered*/; break;
2001-10-17 07:47:10 +00:00
case BASEPROPERTY_PUSHBUTTONTYPE: aDefault <<= (sal_Int16) 0 /*PushButtonType::STANDARD*/; break;
CWS-TOOLING: integrate CWS dba32c 2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion 2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time 2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths 2009-06-29 10:08:54 +0200 fs r273455 : #i103138# refactored the code for positioning/zooming the control Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to take an additional ViewTransformation parameter, describing the transformation to obtain the actual control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter. This has become necessary since during painting, the device which we created our control for might not necessarily have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size, this would lead to wrong results. Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken. Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ... I consider it broken, since: - we need the map mode to obtain the proper zoom level, which is to be forwarded to the control - there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears). It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand one has no possibility to obtain the current zoom by other means. Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used, which means the controls have a zoom of "1:1" set, which is wrong here. 2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties 2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning 2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed 2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc 2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux 2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux 2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar 2009-06-15 14:11:27 +0200 fs r272983 : added since tag 2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted 2009-06-15 11:08:53 +0200 fs r272969 : #i10000# 2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701# 2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src 2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50) 2009-06-02 09:53:10 +0200 fs r272483 : #i10000# 2009-05-29 15:55:03 +0200 fs r272465 : #i100818# 2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any 2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition 2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex 2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed 2009-05-27 14:53:36 +0200 fs r272347 : #i10000# 2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast 2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly 2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used 2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function 2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well 2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution 2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set 2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition 2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria 2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR 2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein 2009-05-25 15:49:57 +0200 fs r272254 : #i999704# 2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property 2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString 2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein 2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property 2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property) 2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default 2009-05-25 14:39:31 +0200 fs r272243 : removed dead import 2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns 2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent 2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel 2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event 2009-05-22 21:42:47 +0200 fs r272211 : #i102003# 2009-05-22 21:42:20 +0200 fs r272210 : grammar 2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously 2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear 2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG 2009-05-22 12:03:42 +0200 fs r272180 : #i88878# provided by noel.power@novell.com implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs 2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them 2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values 2009-05-15 15:08:31 +0200 fs r271937 : includes 2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint 2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity 2009-05-15 10:15:44 +0200 fs r271928 : #i10000# 2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:23:23 +0200 fs r271919 : #i101622# 2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids 2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b) 2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48 2009-05-07 14:43:19 +0200 fs r271670 : #i101477# 2009-05-07 14:37:30 +0200 fs r271668 : #i101477# 2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch 2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics 2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47) 2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control 2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:aDefault <<= (sal_Int16) awt::MouseWheelBehavior::SCROLL_FOCUS_ONLY; break;
2001-04-26 08:09:16 +00:00
case BASEPROPERTY_DATEMAX: aDefault <<= (sal_Int32) Date( 31, 12, 2200 ).GetDate(); break;
case BASEPROPERTY_DATEMIN: aDefault <<= (sal_Int32) Date( 1, 1, 1900 ).GetDate(); break;
case BASEPROPERTY_TIMEMAX: aDefault <<= (sal_Int32) Time( 23, 59 ).GetTime(); break;
case BASEPROPERTY_TIMEMIN: aDefault <<= (sal_Int32) 0; break;
case BASEPROPERTY_VALUEMAX_DOUBLE: aDefault <<= (double) 1000000; break;
case BASEPROPERTY_VALUEMIN_DOUBLE: aDefault <<= (double) -1000000; break;
case BASEPROPERTY_VALUESTEP_DOUBLE: aDefault <<= (double ) 1; break;
2001-05-02 11:31:11 +00:00
case BASEPROPERTY_PROGRESSVALUE_MAX: aDefault <<= (sal_Int32) 100; break;
case BASEPROPERTY_PROGRESSVALUE_MIN: aDefault <<= (sal_Int32) 0; break;
case BASEPROPERTY_SCROLLVALUE_MAX: aDefault <<= (sal_Int32) 100; break;
case BASEPROPERTY_SCROLLVALUE_MIN: aDefault <<= (sal_Int32) 0; break;
2001-05-02 11:31:11 +00:00
case BASEPROPERTY_LINEINCREMENT: aDefault <<= (sal_Int32) 1; break;
case BASEPROPERTY_BLOCKINCREMENT: aDefault <<= (sal_Int32) 10; break;
2001-05-04 08:04:05 +00:00
case BASEPROPERTY_ORIENTATION: aDefault <<= (sal_Int32) 0; break;
case BASEPROPERTY_SPINVALUE: aDefault <<= (sal_Int32) 0; break;
case BASEPROPERTY_SPININCREMENT: aDefault <<= (sal_Int32) 1; break;
case BASEPROPERTY_SPINVALUE_MIN: aDefault <<= (sal_Int32) 0; break;
case BASEPROPERTY_SPINVALUE_MAX: aDefault <<= (sal_Int32) 100; break;
case BASEPROPERTY_REPEAT_DELAY: aDefault <<= (sal_Int32) 50; break; // 50 milliseconds
2001-04-26 08:09:16 +00:00
case BASEPROPERTY_DEFAULTCONTROL: aDefault <<= ((UnoControlModel*)this)->getServiceName(); break;
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_AUTOHSCROLL:
case BASEPROPERTY_AUTOVSCROLL:
2001-01-24 14:00:58 +00:00
case BASEPROPERTY_MOVEABLE:
case BASEPROPERTY_CLOSEABLE:
case BASEPROPERTY_SIZEABLE:
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_HSCROLL:
case BASEPROPERTY_DEFAULTBUTTON:
case BASEPROPERTY_MULTILINE:
case BASEPROPERTY_MULTISELECTION:
case BASEPROPERTY_TRISTATE:
case BASEPROPERTY_DROPDOWN:
case BASEPROPERTY_SPIN:
case BASEPROPERTY_READONLY:
case BASEPROPERTY_VSCROLL:
case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
case BASEPROPERTY_STRICTFORMAT:
case BASEPROPERTY_REPEAT:
case BASEPROPERTY_PAINTTRANSPARENT:
case BASEPROPERTY_DESKTOP_AS_PARENT:
case BASEPROPERTY_HARDLINEBREAKS:
case BASEPROPERTY_NOLABEL: aDefault <<= (sal_Bool) sal_False; break;
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
case BASEPROPERTY_HIDEINACTIVESELECTION:
case BASEPROPERTY_ENFORCE_FORMAT:
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_AUTOCOMPLETE:
2001-10-12 11:31:09 +00:00
case BASEPROPERTY_SCALEIMAGE:
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_ENABLED:
case BASEPROPERTY_PRINTABLE:
CWS-TOOLING: integrate CWS dba32c 2009-06-29 20:53:25 +0200 fs r273484 : #i103138# Rectangle conversion 2009-06-29 20:51:50 +0200 fs r273483 : #i103138# yet more refactoring, now also setting the proper zoom level at the proper point in time 2009-06-29 13:40:26 +0200 fs r273470 : added svn:ignore to ignore output paths 2009-06-29 10:08:54 +0200 fs r273455 : #i103138# refactored the code for positioning/zooming the control Basically, we now allow adjustControlGeometry_throw (formerly known as positionControl_throw and setControlZoom) to take an additional ViewTransformation parameter, describing the transformation to obtain the actual control position/size. Consequently, positionControl itself also allows for a ViewTransformation parameter. This has become necessary since during painting, the device which we created our control for might not necessarily have a proper MapMode set. In this case, if we would use this map mode for calculating the control's position/size, this would lead to wrong results. Note that this problem was introduced by the fix for #i101398#: During the fix, we postponed the control creation to a later time (when it is really needed). At this later time, the MapMode at the device is broken, at the earlier time where we formerly crearted the control (createPrimitive2DSequence), it is not yet broken. Whether or not the MapMode is defined as "broken" might depend on one's point of view, however ... I consider it broken, since: - we need the map mode to obtain the proper zoom level, which is to be forwarded to the control - there are scenarios where the MapMode is *not* set to MAP_PIXEL (in those scenarios, everything works fine), and there are scenarios where it *is* set to MAP_PIXEL (in those the bug 103138 appears). It somehow feels wrong that one cannot rely on the device's map mode this way, but on the other hand one has no possibility to obtain the current zoom by other means. Note that one issue (still to be submitted) is left: In the page pane of a Draw/Impress document, controls have a wrong text size. This is because in this pane, the above-mentioned "broken" map mode is used, which means the controls have a zoom of "1:1" set, which is wrong here. 2009-06-25 13:41:35 +0200 msc r273380 : #100000# the tabs changed die to new properties 2009-06-24 12:42:40 +0200 msc r273330 : #102082# remove issue warning 2009-06-22 10:43:14 +0200 fs r273201 : createPrimitive2DSequence: care for being disposed 2009-06-18 12:35:13 +0200 oj r273109 : #i102305# make nooptfiles for gcc 2009-06-17 12:14:37 +0200 oj r273056 : #i102305# fix for linux 2009-06-17 07:20:22 +0200 oj r273046 : #i102305# move ValueTransfer into the for loop to avoid a crash under Linux 2009-06-17 07:17:28 +0200 oj r273045 : #i102305# use varchar 2009-06-15 14:11:27 +0200 fs r272983 : added since tag 2009-06-15 12:11:39 +0200 oj r272973 : #i102305# SAL_DLLPUBLIC_EXPORT inserted 2009-06-15 11:08:53 +0200 fs r272969 : #i10000# 2009-06-15 09:25:13 +0200 fs r272963 : merging fix for P1 issue #i102701# 2009-06-11 11:31:24 +0200 fs r272858 : #i10000# copied the fix which before the rebase was done in ../dialog/macropg.src 2009-06-11 09:38:14 +0200 fs r272846 : CWS-TOOLING: rebase CWS dba32c to trunk@272827 (milestone: DEV300:m50) 2009-06-02 09:53:10 +0200 fs r272483 : #i10000# 2009-05-29 15:55:03 +0200 fs r272465 : #i100818# 2009-05-29 12:58:43 +0200 fs r272452 : don't apply comphelper::getString on possibly VOID any 2009-05-29 10:38:35 +0200 oj r272437 : #i101519# handle where condition 2009-05-29 09:53:39 +0200 fs r272434 : #i100818# call into releaseStubs /without/ locked GlobalMutex 2009-05-28 07:53:44 +0200 oj r272375 : #i101369# parse tree changed 2009-05-27 14:53:36 +0200 fs r272347 : #i10000# 2009-05-27 09:29:15 +0200 oj r272327 : #i101626# check for double before hard cast 2009-05-27 09:13:58 +0200 oj r272326 : #i101626# handle void correctly 2009-05-27 08:04:39 +0200 oj r272321 : #i102256# wrong method signature used 2009-05-27 07:55:52 +0200 oj r272320 : #i101519# look up parameter typ if used in function 2009-05-27 06:49:07 +0200 oj r272319 : #i101519# set parameter from rowset as well 2009-05-26 13:30:56 +0200 oj r272297 : #i101987# impl XBatchExecution 2009-05-26 12:44:34 +0200 oj r272293 : #i101700# check if group is not set 2009-05-26 12:16:53 +0200 oj r272290 : #i101369# resolved some reduce7reduce problems with boolean_term and search_condition 2009-05-26 12:12:42 +0200 oj r272289 : #i101369# fix for or on one line criteria 2009-05-25 16:02:25 +0200 fs r272257 : #i999704# +PROPERTY_MOUSE_WHEEL_BEHAVIOR 2009-05-25 16:01:55 +0200 fs r272256 : merging the changes from CWS dba32b herein 2009-05-25 15:49:57 +0200 fs r272254 : #i999704# 2009-05-25 15:32:57 +0200 fs r272252 : #i99704# grid columns also to respect the MouseWheelBehavior property 2009-05-25 15:23:43 +0200 fs r272251 : don't pass empty Anys to ::comphelper::getString 2009-05-25 14:48:43 +0200 fs r272248 : merged changes from CWS dba32b herein 2009-05-25 14:44:40 +0200 fs r272247 : #i99704# support new MouseWheelBehavior property 2009-05-25 14:43:18 +0200 fs r272246 : #i99704# WheelWithoutFocus (peer property) superseded by MouseWheelBehavior (model property) 2009-05-25 14:41:03 +0200 fs r272245 : #i99704# no need to set the mouse wheel behavior at the peer, this is now a model property, having the right default 2009-05-25 14:39:31 +0200 fs r272243 : removed dead import 2009-05-25 14:35:36 +0200 fs r272242 : the new EnableVisible doesn't make sense for grid columns 2009-05-25 14:34:33 +0200 fs r272241 : #i99704# +MouseWheelBehavior - allow to enable/disable the mouse wheel for the control, or make it focus-dependent 2009-05-25 14:26:11 +0200 fs r272240 : #i99704# change MouseSettings wheel flag (NoWheelActionWithoutFocus) to a three-state option, allowing to completely ignore the mouse wheel 2009-05-23 21:35:59 +0200 fs r272213 : localize 'sub component opened/closed' event 2009-05-22 21:42:47 +0200 fs r272211 : #i102003# 2009-05-22 21:42:20 +0200 fs r272210 : grammar 2009-05-22 21:36:10 +0200 fs r272209 : #i102140# load only once, not twice, and show error messages during loading (and during any form action, that is) asynchronously 2009-05-22 21:35:11 +0200 fs r272208 : #i102140# +clear 2009-05-22 14:50:30 +0200 fs r272194 : #i102139# for newly created DB docs, set the MacroExecutionMode to USE_CONFIG 2009-05-22 12:03:42 +0200 fs r272180 : #i88878# provided by noel.power@novell.com implement a visibility property (EnableVisible) for toolkit controls, and usage in forms and UNO dialogs 2009-05-15 15:37:31 +0200 fs r271942 : #i100671# corrected some @since tags, so autodoc has better chances of correctly reading them 2009-05-15 15:33:11 +0200 fs r271940 : don't call comphelper::getFOO for VOID values 2009-05-15 15:08:31 +0200 fs r271937 : includes 2009-05-15 13:39:22 +0200 fs r271934 : #i101398# createPrimitive2DSequence: when we already have a control, use the old code. In particular, call positionControlForPaint 2009-05-15 12:33:48 +0200 fs r271933 : make the geometry a part of the ControlPrimitive2D's identity 2009-05-15 10:15:44 +0200 fs r271928 : #i10000# 2009-05-14 20:55:38 +0200 fs r271921 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:55:31 +0200 fs r271920 : #i101398# don't reuse the name PRIMITIVE_ID_CONTROLPRIMITIVE2D, make the name of our own ControlPrimitive2D unique 2009-05-14 20:23:23 +0200 fs r271919 : #i101622# 2009-05-14 16:04:38 +0200 fs r271898 : don't use comphelper::getInt32 on voids 2009-05-14 16:04:12 +0200 fs r271897 : merge fix for issue whose number just slipped my memory ... (originally fixed in CWS dba32b) 2009-05-14 15:36:55 +0200 fs r271895 : merging changes from DEV300:m48 2009-05-07 14:43:19 +0200 fs r271670 : #i101477# 2009-05-07 14:37:30 +0200 fs r271668 : #i101477# 2009-05-07 09:27:30 +0200 oj r271628 : #i101343# remove pch 2009-05-06 09:36:02 +0200 fs r271568 : getFoo: diagnostics 2009-05-04 09:23:06 +0200 oj r271438 : CWS-TOOLING: rebase CWS dba32c to trunk@271427 (milestone: DEV300:m47) 2009-04-29 23:18:13 +0200 fs r271394 : #i101398# use a dedicated 2DPrimitive for UNO Controls, which is able to provide the B2DRange *without* actually creating the control 2009-04-29 13:52:25 +0200 fs r271366 : #i101308#
2009-07-03 14:21:50 +00:00
case BASEPROPERTY_ENABLEVISIBLE:
case BASEPROPERTY_DECORATION: aDefault <<= (sal_Bool) sal_True; break;
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_GROUPNAME:
case BASEPROPERTY_HELPTEXT:
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_HELPURL:
case BASEPROPERTY_IMAGEURL:
case BASEPROPERTY_DIALOGSOURCEURL:
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_EDITMASK:
case BASEPROPERTY_LITERALMASK:
case BASEPROPERTY_LABEL:
2001-01-24 14:00:58 +00:00
case BASEPROPERTY_TITLE:
2001-04-26 08:09:16 +00:00
case BASEPROPERTY_TEXT: aDefault <<= ::rtl::OUString(); break;
2000-09-18 16:07:07 +00:00
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
case BASEPROPERTY_WRITING_MODE:
case BASEPROPERTY_CONTEXT_WRITING_MODE:
aDefault <<= text::WritingMode2::CONTEXT;
break;
2000-09-18 16:07:07 +00:00
case BASEPROPERTY_STRINGITEMLIST:
{
::com::sun::star::uno::Sequence< ::rtl::OUString> aStringSeq;
aDefault <<= aStringSeq;
}
break;
case BASEPROPERTY_SELECTEDITEMS:
{
::com::sun::star::uno::Sequence<sal_Int16> aINT16Seq;
aDefault <<= aINT16Seq;
}
break;
case BASEPROPERTY_CURRENCYSYMBOL:
{
2011-11-11 22:48:37 +01:00
rtl::OUString sDefaultCurrency(
utl::ConfigManager::getDefaultCurrency() );
// extract the bank symbol
sal_Int32 nSepPos = sDefaultCurrency.indexOf( '-' );
::rtl::OUString sBankSymbol;
if ( nSepPos >= 0 )
{
sBankSymbol = sDefaultCurrency.copy( 0, nSepPos );
sDefaultCurrency = sDefaultCurrency.copy( nSepPos + 1 );
}
// the remaming is the locale
Locale aLocale;
nSepPos = sDefaultCurrency.indexOf( '-' );
if ( nSepPos >= 0 )
{
aLocale.Language = sDefaultCurrency.copy( 0, nSepPos );
aLocale.Country = sDefaultCurrency.copy( nSepPos + 1 );
}
LocaleDataWrapper aLocaleInfo( maContext.getLegacyServiceFactory(), aLocale );
if ( sBankSymbol.isEmpty() )
sBankSymbol = aLocaleInfo.getCurrBankSymbol();
// look for the currency entry (for this language) which has the given bank symbol
Sequence< Currency2 > aAllCurrencies = aLocaleInfo.getAllCurrencies();
const Currency2* pAllCurrencies = aAllCurrencies.getConstArray();
const Currency2* pAllCurrenciesEnd = pAllCurrencies + aAllCurrencies.getLength();
::rtl::OUString sCurrencySymbol = aLocaleInfo.getCurrSymbol();
if ( sBankSymbol.isEmpty() )
{
DBG_ASSERT( pAllCurrencies != pAllCurrenciesEnd, "UnoControlModel::ImplGetDefaultValue: no currencies at all!" );
if ( pAllCurrencies != pAllCurrenciesEnd )
{
sBankSymbol = pAllCurrencies->BankSymbol;
sCurrencySymbol = pAllCurrencies->Symbol;
}
}
if ( !sBankSymbol.isEmpty() )
{
bool bLegacy = false;
for ( ;pAllCurrencies != pAllCurrenciesEnd; ++pAllCurrencies )
if ( pAllCurrencies->BankSymbol == sBankSymbol )
{
sCurrencySymbol = pAllCurrencies->Symbol;
if ( pAllCurrencies->LegacyOnly )
bLegacy = true;
else
break;
}
DBG_ASSERT( bLegacy || pAllCurrencies != pAllCurrenciesEnd, "UnoControlModel::ImplGetDefaultValue: did not find the given bank symbol!" );
2011-01-25 10:23:14 +00:00
(void)bLegacy;
}
aDefault <<= sCurrencySymbol;
2000-09-18 16:07:07 +00:00
}
break;
2011-03-01 19:08:19 +01:00
default: OSL_FAIL( "ImplGetDefaultValue - unknown Property" );
2000-09-18 16:07:07 +00:00
}
}
return aDefault;
}
void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault )
{
maData[ nPropId ] = rDefault;
2000-09-18 16:07:07 +00:00
}
void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
{
ImplRegisterProperty( nPropId, ImplGetDefaultValue( nPropId ) );
if ( nPropId == BASEPROPERTY_FONTDESCRIPTOR )
{
// some properties are not included in the FontDescriptor, but everytime
// when we have a FontDescriptor we want to have these properties too.
// => Easier to register the here, istead everywhere where I register the FontDescriptor...
ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
ImplRegisterProperty( BASEPROPERTY_TEXTLINECOLOR );
ImplRegisterProperty( BASEPROPERTY_FONTRELIEF );
ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK );
}
2000-09-18 16:07:07 +00:00
}
void UnoControlModel::ImplRegisterProperties( const std::list< sal_uInt16 > &rIds )
{
std::list< sal_uInt16 >::const_iterator iter;
2010-11-27 16:51:34 +00:00
for( iter = rIds.begin(); iter != rIds.end(); ++iter)
{
if( !ImplHasProperty( *iter ) )
ImplRegisterProperty( *iter, ImplGetDefaultValue( *iter ) );
}
}
2000-09-18 16:07:07 +00:00
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any UnoControlModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
{
Any aRet = UnoControlModel_Base::queryAggregation( rType );
if ( !aRet.hasValue() )
aRet = ::cppu::OPropertySetHelper::queryInterface( rType );
return aRet;
2000-09-18 16:07:07 +00:00
}
// ::com::sun::star::lang::XUnoTunnel
IMPL_XUNOTUNNEL_MINIMAL( UnoControlModel )
2000-09-18 16:07:07 +00:00
// XInterface
IMPLEMENT_FORWARD_REFCOUNT( UnoControlModel, UnoControlModel_Base )
2000-09-18 16:07:07 +00:00
// ::com::sun::star::lang::XTypeProvider
IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoControlModel, UnoControlModel_Base, ::cppu::OPropertySetHelper )
2000-09-18 16:07:07 +00:00
2001-01-24 14:00:58 +00:00
uno::Reference< util::XCloneable > UnoControlModel::createClone() throw(::com::sun::star::uno::RuntimeException)
{
UnoControlModel* pClone = Clone();
uno::Reference< util::XCloneable > xClone( (::cppu::OWeakObject*) pClone, uno::UNO_QUERY );
return xClone;
}
2000-09-18 16:07:07 +00:00
// ::com::sun::star::lang::XComponent
void UnoControlModel::dispose( ) throw(::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::lang::EventObject aEvt;
aEvt.Source = (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this;
maDisposeListeners.disposeAndClear( aEvt );
BrdcstHelper.aLC.disposeAndClear( aEvt );
// let the property set helper notify our property listeners
OPropertySetHelper::disposing();
2000-09-18 16:07:07 +00:00
}
void UnoControlModel::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
maDisposeListeners.addInterface( rxListener );
}
void UnoControlModel::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
maDisposeListeners.removeInterface( rxListener );
}
// ::com::sun::star::beans::XPropertyState
::com::sun::star::beans::PropertyState UnoControlModel::getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
sal_uInt16 nPropId = GetPropertyId( PropertyName );
::com::sun::star::uno::Any aValue = getPropertyValue( PropertyName );
::com::sun::star::uno::Any aDefault = ImplGetDefaultValue( nPropId );
return CompareProperties( aValue, aDefault ) ? ::com::sun::star::beans::PropertyState_DEFAULT_VALUE : ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
}
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > UnoControlModel::getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
sal_uInt32 nNames = PropertyNames.getLength();
const ::rtl::OUString* pNames = PropertyNames.getConstArray();
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > aStates( nNames );
::com::sun::star::beans::PropertyState* pStates = aStates.getArray();
for ( sal_uInt32 n = 0; n < nNames; n++ )
pStates[n] = getPropertyState( pNames[n] );
return aStates;
}
void UnoControlModel::setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
{
Any aDefaultValue;
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
aDefaultValue = ImplGetDefaultValue( GetPropertyId( PropertyName ) );
}
setPropertyValue( PropertyName, aDefaultValue );
2000-09-18 16:07:07 +00:00
}
::com::sun::star::uno::Any UnoControlModel::getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return ImplGetDefaultValue( GetPropertyId( rPropertyName ) );
}
// ::com::sun::star::io::XPersistObjec
::rtl::OUString UnoControlModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
2011-03-01 19:08:19 +01:00
OSL_FAIL( "ServiceName von UnoControlModel ?!" );
2000-09-18 16:07:07 +00:00
return ::rtl::OUString();
}
void UnoControlModel::write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
DBG_ASSERT( xMark.is(), "write: no ::com::sun::star::io::XMarkableStream!" );
OutStream->writeShort( UNOCONTROL_STREAMVERSION );
std::set<sal_uInt16> aProps;
for (ImplPropertyTable::const_iterator it = maData.begin(); it != maData.end(); ++it )
2000-09-18 16:07:07 +00:00
{
if ( ( ( GetPropertyAttribs( it->first ) & ::com::sun::star::beans::PropertyAttribute::TRANSIENT ) == 0 )
&& ( getPropertyState( GetPropertyName( it->first ) ) != ::com::sun::star::beans::PropertyState_DEFAULT_VALUE ) )
2000-09-18 16:07:07 +00:00
{
aProps.insert( it->first );
2000-09-18 16:07:07 +00:00
}
}
sal_uInt32 nProps = aProps.size();
2000-09-18 16:07:07 +00:00
// Save FontProperty always in the old format (due to missing distinction
// between 5.0 and 5.1)
OutStream->writeLong( (long) ( aProps.find( BASEPROPERTY_FONTDESCRIPTOR ) != aProps.end() ) ? ( nProps + 3 ) : nProps );
for ( std::set<sal_uInt16>::const_iterator it = aProps.begin(); it != aProps.end(); ++it )
2000-09-18 16:07:07 +00:00
{
sal_Int32 nPropDataBeginMark = xMark->createMark();
OutStream->writeLong( 0L ); // DataLen
const ::com::sun::star::uno::Any* pProp = &(maData[*it]);
OutStream->writeShort( *it );
2000-09-18 16:07:07 +00:00
sal_Bool bVoid = pProp->getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
2000-09-18 16:07:07 +00:00
OutStream->writeBoolean( bVoid );
if ( !bVoid )
{
const ::com::sun::star::uno::Any& rValue = *pProp;
2000-09-18 16:07:07 +00:00
const ::com::sun::star::uno::Type& rType = rValue.getValueType();
if ( rType == ::getBooleanCppuType() )
{
sal_Bool b = false;
2000-09-18 16:07:07 +00:00
rValue >>= b;
OutStream->writeBoolean( b );
}
else if ( rType == ::getCppuType((const ::rtl::OUString*)0) )
{
::rtl::OUString aUString;
rValue >>= aUString;
OutStream->writeUTF( aUString );
}
else if ( rType == ::getCppuType((const sal_uInt16*)0) )
{
sal_uInt16 n = 0;
2000-09-18 16:07:07 +00:00
rValue >>= n;
OutStream->writeShort( n );
}
else if ( rType == ::getCppuType((const sal_Int16*)0) )
{
sal_Int16 n = 0;
2000-09-18 16:07:07 +00:00
rValue >>= n;
OutStream->writeShort( n );
}
else if ( rType == ::getCppuType((const sal_uInt32*)0) )
{
sal_uInt32 n = 0;
2000-09-18 16:07:07 +00:00
rValue >>= n;
OutStream->writeLong( n );
}
else if ( rType == ::getCppuType((const sal_Int32*)0) )
{
sal_Int32 n = 0;
2000-09-18 16:07:07 +00:00
rValue >>= n;
OutStream->writeLong( n );
}
else if ( rType == ::getCppuType((const double*)0) )
{
double n = 0;
2000-09-18 16:07:07 +00:00
rValue >>= n;
OutStream->writeDouble( n );
}
else if ( rType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) )
{
::com::sun::star::awt::FontDescriptor aFD;
rValue >>= aFD;
OutStream->writeUTF( aFD.Name );
OutStream->writeShort( aFD.Height );
OutStream->writeShort( aFD.Width );
OutStream->writeUTF( aFD.StyleName );
OutStream->writeShort( aFD.Family );
OutStream->writeShort( aFD.CharSet );
OutStream->writeShort( aFD.Pitch );
OutStream->writeDouble( aFD.CharacterWidth );
OutStream->writeDouble( aFD.Weight );
OutStream->writeShort(
sal::static_int_cast< sal_Int16 >(aFD.Slant) );
2000-09-18 16:07:07 +00:00
OutStream->writeShort( aFD.Underline );
OutStream->writeShort( aFD.Strikeout );
OutStream->writeDouble( aFD.Orientation );
OutStream->writeBoolean( aFD.Kerning );
OutStream->writeBoolean( aFD.WordLineMode );
OutStream->writeShort( aFD.Type );
}
else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) )
{
::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
rValue >>= aSeq;
long nEntries = aSeq.getLength();
OutStream->writeLong( nEntries );
for ( long n = 0; n < nEntries; n++ )
OutStream->writeUTF( aSeq.getConstArray()[n] );
}
else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) )
{
::com::sun::star::uno::Sequence<sal_uInt16> aSeq;
rValue >>= aSeq;
long nEntries = aSeq.getLength();
OutStream->writeLong( nEntries );
for ( long n = 0; n < nEntries; n++ )
OutStream->writeShort( aSeq.getConstArray()[n] );
}
else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) )
{
::com::sun::star::uno::Sequence<sal_Int16> aSeq;
rValue >>= aSeq;
long nEntries = aSeq.getLength();
OutStream->writeLong( nEntries );
for ( long n = 0; n < nEntries; n++ )
OutStream->writeShort( aSeq.getConstArray()[n] );
}
else if ( rType.getTypeClass() == TypeClass_ENUM )
2000-09-18 16:07:07 +00:00
{
sal_Int32 nAsInt = 0;
::cppu::enum2int( nAsInt, rValue );
OutStream->writeLong( nAsInt );
}
#if OSL_DEBUG_LEVEL > 0
else
{
::rtl::OString sMessage( "UnoControlModel::write: don't know how to handle a property of type '" );
::rtl::OUString sTypeName( rType.getTypeName() );
sMessage += ::rtl::OString( sTypeName.getStr(), sTypeName.getLength(), RTL_TEXTENCODING_ASCII_US );
sMessage += "'.\n(Currently handling property '";
2012-03-05 15:22:55 +00:00
::rtl::OUString sPropertyName( GetPropertyName( *it ) );
sMessage += ::rtl::OString( sPropertyName.getStr(), sPropertyName.getLength(), osl_getThreadTextEncoding() );
sMessage += "'.)";
OSL_FAIL( sMessage.getStr() );
2000-09-18 16:07:07 +00:00
}
#endif
2000-09-18 16:07:07 +00:00
}
sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
xMark->jumpToMark( nPropDataBeginMark );
OutStream->writeLong( nPropDataLen );
xMark->jumpToFurthest();
xMark->deleteMark(nPropDataBeginMark);
}
if ( aProps.find( BASEPROPERTY_FONTDESCRIPTOR ) != aProps.end() )
2000-09-18 16:07:07 +00:00
{
const ::com::sun::star::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ];
// Until 5.0 export arrives, write old format..
2000-09-18 16:07:07 +00:00
::com::sun::star::awt::FontDescriptor aFD;
(*pProp) >>= aFD;
2000-09-18 16:07:07 +00:00
for ( sal_uInt16 n = BASEPROPERTY_FONT_TYPE; n <= BASEPROPERTY_FONT_ATTRIBS; n++ )
{
sal_Int32 nPropDataBeginMark = xMark->createMark();
OutStream->writeLong( 0L ); // DataLen
OutStream->writeShort( n ); // PropId
OutStream->writeBoolean( sal_False ); // Void
if ( n == BASEPROPERTY_FONT_TYPE )
{
OutStream->writeUTF( aFD.Name );
OutStream->writeUTF( aFD.StyleName );
OutStream->writeShort( aFD.Family );
OutStream->writeShort( aFD.CharSet );
OutStream->writeShort( aFD.Pitch );
}
else if ( n == BASEPROPERTY_FONT_SIZE )
{
OutStream->writeLong( aFD.Width );
OutStream->writeLong( aFD.Height );
OutStream->writeShort(
sal::static_int_cast< sal_Int16 >(
VCLUnoHelper::ConvertFontWidth( aFD.CharacterWidth )) );
2000-09-18 16:07:07 +00:00
}
else if ( n == BASEPROPERTY_FONT_ATTRIBS )
{
OutStream->writeShort(
sal::static_int_cast< sal_Int16 >(
VCLUnoHelper::ConvertFontWeight( aFD.Weight )) );
OutStream->writeShort(
sal::static_int_cast< sal_Int16 >(aFD.Slant) );
2000-09-18 16:07:07 +00:00
OutStream->writeShort( aFD.Underline );
OutStream->writeShort( aFD.Strikeout );
OutStream->writeShort( (short)(aFD.Orientation * 10) );
2000-09-18 16:07:07 +00:00
OutStream->writeBoolean( aFD.Kerning );
OutStream->writeBoolean( aFD.WordLineMode );
}
else
{
2011-03-01 19:08:19 +01:00
OSL_FAIL( "Property?!" );
2000-09-18 16:07:07 +00:00
}
sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
xMark->jumpToMark( nPropDataBeginMark );
OutStream->writeLong( nPropDataLen );
xMark->jumpToFurthest();
xMark->deleteMark(nPropDataBeginMark);
}
}
}
void UnoControlModel::read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( InStream, ::com::sun::star::uno::UNO_QUERY );
DBG_ASSERT( xMark.is(), "read: no ::com::sun::star::io::XMarkableStream!" );
short nVersion = InStream->readShort();
sal_uInt32 nProps = (sal_uInt32)InStream->readLong();
::com::sun::star::uno::Sequence< ::rtl::OUString> aProps( nProps );
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> aValues( nProps );
sal_Bool bInvalidEntries = sal_False;
// Unfortunately, there's no mark for the whole block, thus only properties may be changed.
// No data for the model may be added following the properties
2000-09-18 16:07:07 +00:00
// Used for import of old parts in ::com::sun::star::awt::FontDescriptor
2000-09-18 16:07:07 +00:00
::com::sun::star::awt::FontDescriptor* pFD = NULL;
sal_uInt32 i;
for ( i = 0; i < nProps; i++ )
2000-09-18 16:07:07 +00:00
{
sal_Int32 nPropDataBeginMark = xMark->createMark();
sal_Int32 nPropDataLen = InStream->readLong();
sal_uInt16 nPropId = (sal_uInt16)InStream->readShort();
::com::sun::star::uno::Any aValue;
sal_Bool bIsVoid = InStream->readBoolean();
if ( !bIsVoid )
{
if ( maData.find( nPropId ) != maData.end() )
2000-09-18 16:07:07 +00:00
{
const ::com::sun::star::uno::Type* pType = GetPropertyType( nPropId );
2000-09-18 16:07:07 +00:00
if ( *pType == ::getBooleanCppuType() )
{
sal_Bool b = InStream->readBoolean();
aValue <<= b;
}
else if ( *pType == ::getCppuType((const ::rtl::OUString*)0) )
{
::rtl::OUString aUTF = InStream->readUTF();
aValue <<= aUTF;
}
else if ( *pType == ::getCppuType((const sal_uInt16*)0) )
{
sal_uInt16 n = InStream->readShort();
aValue <<= n;
}
else if ( *pType == ::getCppuType((const sal_Int16*)0) )
{
sal_Int16 n = InStream->readShort();
aValue <<= n;
}
else if ( *pType == ::getCppuType((const sal_uInt32*)0) )
{
sal_uInt32 n = InStream->readLong();
aValue <<= n;
}
else if ( *pType == ::getCppuType((const sal_Int32*)0) )
{
sal_Int32 n = InStream->readLong();
aValue <<= n;
}
2001-03-21 13:26:20 +00:00
else if ( *pType == ::getCppuType((const double*)0) )
2000-09-18 16:07:07 +00:00
{
double n = InStream->readDouble();
aValue <<= n;
}
else if ( *pType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) )
{
::com::sun::star::awt::FontDescriptor aFD;
aFD.Name = InStream->readUTF();
aFD.Height = InStream->readShort();
aFD.Width = InStream->readShort();
aFD.StyleName = InStream->readUTF();
aFD.Family = InStream->readShort();
aFD.CharSet = InStream->readShort();
aFD.Pitch = InStream->readShort();
aFD.CharacterWidth = (float)InStream->readDouble();
aFD.Weight = (float)InStream->readDouble();
2000-09-18 16:07:07 +00:00
aFD.Slant = (::com::sun::star::awt::FontSlant)InStream->readShort();
aFD.Underline = InStream->readShort();
aFD.Strikeout = InStream->readShort();
aFD.Orientation = (float)InStream->readDouble();
2000-09-18 16:07:07 +00:00
aFD.Kerning = InStream->readBoolean();
aFD.WordLineMode = InStream->readBoolean();
aFD.Type = InStream->readShort();
aValue <<= aFD;
}
else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) )
{
long nEntries = InStream->readLong();
::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nEntries );
for ( long n = 0; n < nEntries; n++ )
aSeq.getArray()[n] = InStream->readUTF();
aValue <<= aSeq;
}
else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) )
{
long nEntries = InStream->readLong();
::com::sun::star::uno::Sequence<sal_uInt16> aSeq( nEntries );
for ( long n = 0; n < nEntries; n++ )
aSeq.getArray()[n] = (sal_uInt16)InStream->readShort();
aValue <<= aSeq;
}
else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) )
{
long nEntries = InStream->readLong();
::com::sun::star::uno::Sequence<sal_Int16> aSeq( nEntries );
for ( long n = 0; n < nEntries; n++ )
aSeq.getArray()[n] = (sal_Int16)InStream->readShort();
aValue <<= aSeq;
}
else if ( pType->getTypeClass() == TypeClass_ENUM )
{
sal_Int32 nAsInt = InStream->readLong();
aValue = ::cppu::int2enum( nAsInt, *pType );
}
else
{
::rtl::OString sMessage( "UnoControlModel::read: don't know how to handle a property of type '" );
::rtl::OUString sTypeName( pType->getTypeName() );
sMessage += ::rtl::OString( sTypeName.getStr(), sTypeName.getLength(), RTL_TEXTENCODING_ASCII_US );
sMessage += "'.\n(Currently handling property '";
::rtl::OUString sPropertyName( GetPropertyName( nPropId ) );
sMessage += ::rtl::OString( sPropertyName.getStr(), sPropertyName.getLength(), osl_getThreadTextEncoding() );
sMessage += "'.)";
OSL_FAIL( sMessage.getStr() );
}
2000-09-18 16:07:07 +00:00
}
else
{
// Old trash from 5.0
2000-09-18 16:07:07 +00:00
if ( nPropId == BASEPROPERTY_FONT_TYPE )
{
// Redundant information for older versions
// is skipped by MarkableStream
2000-09-18 16:07:07 +00:00
if ( nVersion < 2 )
{
if ( !pFD )
{
pFD = new ::com::sun::star::awt::FontDescriptor;
if ( maData.find( BASEPROPERTY_FONTDESCRIPTOR ) != maData.end() ) // wegen den Defaults...
maData[ BASEPROPERTY_FONTDESCRIPTOR ] >>= *pFD;
2000-09-18 16:07:07 +00:00
}
pFD->Name = InStream->readUTF();
pFD->StyleName = InStream->readUTF();
pFD->Family = InStream->readShort();
pFD->CharSet = InStream->readShort();
pFD->Pitch = InStream->readShort();
}
}
else if ( nPropId == BASEPROPERTY_FONT_SIZE )
{
if ( nVersion < 2 )
{
if ( !pFD )
{
pFD = new ::com::sun::star::awt::FontDescriptor;
if ( maData.find(BASEPROPERTY_FONTDESCRIPTOR) != maData.end() ) // due to defaults...
maData[BASEPROPERTY_FONTDESCRIPTOR] >>= *pFD;
2000-09-18 16:07:07 +00:00
}
pFD->Width = (sal_Int16)InStream->readLong();
pFD->Height = (sal_Int16)InStream->readLong();
InStream->readShort(); // ignore ::com::sun::star::awt::FontWidth - it was
// misspelled and is no longer needed
2000-09-18 16:07:07 +00:00
pFD->CharacterWidth = ::com::sun::star::awt::FontWidth::DONTKNOW;
}
}
else if ( nPropId == BASEPROPERTY_FONT_ATTRIBS )
{
if ( nVersion < 2 )
{
if ( !pFD )
{
pFD = new ::com::sun::star::awt::FontDescriptor;
if ( maData.find(BASEPROPERTY_FONTDESCRIPTOR) != maData.end() ) // due to defaults...
maData[BASEPROPERTY_FONTDESCRIPTOR] >>= *pFD;
2000-09-18 16:07:07 +00:00
}
pFD->Weight = VCLUnoHelper::ConvertFontWeight( (FontWeight) InStream->readShort() );
pFD->Slant = (::com::sun::star::awt::FontSlant)InStream->readShort();
pFD->Underline = InStream->readShort();
pFD->Strikeout = InStream->readShort();
pFD->Orientation = ( (float)(double)InStream->readShort() ) / 10;
2000-09-18 16:07:07 +00:00
pFD->Kerning = InStream->readBoolean();
pFD->WordLineMode = InStream->readBoolean();
}
}
else
{
2011-03-01 19:08:19 +01:00
OSL_FAIL( "read: unknown Property!" );
2000-09-18 16:07:07 +00:00
}
}
}
else // bVoid
{
if ( nPropId == BASEPROPERTY_FONTDESCRIPTOR )
{
EmptyFontDescriptor aFD;
aValue <<= aFD;
}
}
if ( maData.find( nPropId ) != maData.end() )
2000-09-18 16:07:07 +00:00
{
aProps.getArray()[i] = GetPropertyName( nPropId );
aValues.getArray()[i] = aValue;
2000-09-18 16:07:07 +00:00
}
else
{
bInvalidEntries = sal_True;
}
// Skip rest of input if there is more data in stream than this version can handle
2000-09-18 16:07:07 +00:00
xMark->jumpToMark( nPropDataBeginMark );
InStream->skipBytes( nPropDataLen );
xMark->deleteMark(nPropDataBeginMark);
}
if ( bInvalidEntries )
{
for ( i = 0; i < (sal_uInt32)aProps.getLength(); i++ )
2000-09-18 16:07:07 +00:00
{
if ( aProps.getConstArray()[i].isEmpty() )
2000-09-18 16:07:07 +00:00
{
::comphelper::removeElementAt( aProps, i );
::comphelper::removeElementAt( aValues, i );
i--;
2000-09-18 16:07:07 +00:00
}
}
}
try
{
setPropertyValues( aProps, aValues );
}
catch ( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
2000-09-18 16:07:07 +00:00
if ( pFD )
{
::com::sun::star::uno::Any aValue;
aValue <<= *pFD;
setPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ), aValue );
delete pFD;
}
}
// ::com::sun::star::lang::XServiceInfo
::rtl::OUString UnoControlModel::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException)
{
2011-03-01 19:08:19 +01:00
OSL_FAIL( "This method should be overloaded!" );
2000-09-18 16:07:07 +00:00
return ::rtl::OUString();
}
sal_Bool UnoControlModel::supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
const ::rtl::OUString * pArray = aSNL.getConstArray();
for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
if( pArray[i] == rServiceName )
return sal_True;
return sal_False;
}
::com::sun::star::uno::Sequence< ::rtl::OUString > UnoControlModel::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
{
::rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlModel" ) );
return Sequence< ::rtl::OUString >( &sName, 1 );
2000-09-18 16:07:07 +00:00
}
// ------------------------------------------------------------------
template <class TYPE>
sal_Bool convertType(Any& _rConvertedValue, const Any& _rNewValueTest, const TYPE* /* _pTypeDisambiguation */)
{
TYPE tValue;
if (_rNewValueTest >>= tValue)
{
_rConvertedValue <<= tValue;
return sal_True;
}
}
// ..................................................................
sal_Bool UnoControlModel::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nPropId, const Any& rValue ) throw (IllegalArgumentException)
2000-09-18 16:07:07 +00:00
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
sal_Bool bVoid = rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
if ( bVoid )
{
rConvertedValue.clear();
}
else
{
const ::com::sun::star::uno::Type* pDestType = GetPropertyType( (sal_uInt16)nPropId );
if ( pDestType->getTypeClass() == TypeClass_ANY )
2000-09-18 16:07:07 +00:00
{
rConvertedValue = rValue;
}
else
{
if ( pDestType->equals( rValue.getValueType() ) )
{
rConvertedValue = rValue;
}
else
{
sal_Bool bConverted = sal_False;
// 13.03.2001 - 84923 - frank.schoenheit@germany.sun.com
switch (pDestType->getTypeClass())
{
case TypeClass_DOUBLE:
{
// try as double
double nAsDouble = 0;
bConverted = ( rValue >>= nAsDouble );
if ( bConverted )
rConvertedValue <<= nAsDouble;
else
{ // try as integer
sal_Int32 nAsInteger = 0;
bConverted = ( rValue >>= nAsInteger );
if ( bConverted )
rConvertedValue <<= (double)nAsInteger;
}
}
break;
case TypeClass_SHORT:
{
sal_Int16 n;
bConverted = ( rValue >>= n );
if ( bConverted )
rConvertedValue <<= n;
}
break;
case TypeClass_UNSIGNED_SHORT:
{
sal_uInt16 n;
bConverted = ( rValue >>= n );
if ( bConverted )
rConvertedValue <<= n;
}
break;
case TypeClass_LONG:
{
sal_Int32 n;
bConverted = ( rValue >>= n );
if ( bConverted )
rConvertedValue <<= n;
}
break;
case TypeClass_UNSIGNED_LONG:
{
sal_uInt32 n;
bConverted = ( rValue >>= n );
if ( bConverted )
rConvertedValue <<= n;
}
break;
case TypeClass_INTERFACE:
{
if ( rValue.getValueType().getTypeClass() == TypeClass_INTERFACE )
{
Reference< XInterface > xPure( rValue, UNO_QUERY );
if ( xPure.is() )
rConvertedValue = xPure->queryInterface( *pDestType );
else
rConvertedValue.setValue( NULL, *pDestType );
bConverted = sal_True;
}
}
break;
case TypeClass_ENUM:
{
sal_Int32 nValue = 0;
bConverted = ( rValue >>= nValue );
if ( bConverted )
rConvertedValue = ::cppu::int2enum( nValue, *pDestType );
}
break;
default: ; // avoid compiler warning
}
if (!bConverted)
{
::rtl::OUStringBuffer aErrorMessage;
aErrorMessage.appendAscii( "Unable to convert the given value for the property " );
aErrorMessage.append ( GetPropertyName( (sal_uInt16)nPropId ) );
aErrorMessage.appendAscii( ".\n" );
aErrorMessage.appendAscii( "Expected type: " );
aErrorMessage.append ( pDestType->getTypeName() );
aErrorMessage.appendAscii( "\n" );
aErrorMessage.appendAscii( "Found type: " );
aErrorMessage.append ( rValue.getValueType().getTypeName() );
throw ::com::sun::star::lang::IllegalArgumentException(
aErrorMessage.makeStringAndClear(),
static_cast< ::com::sun::star::beans::XPropertySet* >(this),
1);
}
}
2000-09-18 16:07:07 +00:00
}
}
// the current value
2000-09-18 16:07:07 +00:00
getFastPropertyValue( rOldValue, nPropId );
return !CompareProperties( rConvertedValue, rOldValue );
}
void UnoControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
{
// Missing: the fake solo properties of the FontDescriptor
2000-09-18 16:07:07 +00:00
ImplPropertyTable::const_iterator it = maData.find( nPropId );
const ::com::sun::star::uno::Any* pProp = it == maData.end() ? NULL : &(it->second);
ENSURE_OR_RETURN_VOID( pProp, "UnoControlModel::setFastPropertyValue_NoBroadcast: invalid property id!" );
DBG_ASSERT( ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID ) || ( GetPropertyAttribs( (sal_uInt16)nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" );
maData[ nPropId ] = rValue;
2000-09-18 16:07:07 +00:00
}
void UnoControlModel::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nPropId ) const
{
::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlModel*)this)->GetMutex() );
ImplPropertyTable::const_iterator it = maData.find( nPropId );
const ::com::sun::star::uno::Any* pProp = it == maData.end() ? NULL : &(it->second);
2000-09-18 16:07:07 +00:00
if ( pProp )
rValue = *pProp;
2000-09-18 16:07:07 +00:00
else if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
{
pProp = &( maData.find( BASEPROPERTY_FONTDESCRIPTOR )->second );
2000-09-18 16:07:07 +00:00
::com::sun::star::awt::FontDescriptor aFD;
(*pProp) >>= aFD;
2000-09-18 16:07:07 +00:00
switch ( nPropId )
{
case BASEPROPERTY_FONTDESCRIPTORPART_NAME: rValue <<= aFD.Name;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: rValue <<= aFD.StyleName;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: rValue <<= aFD.Family;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: rValue <<= aFD.CharSet;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: rValue <<= (float)aFD.Height;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue <<= aFD.Weight;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: rValue <<= (sal_Int16)aFD.Slant;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: rValue <<= aFD.Underline;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: rValue <<= aFD.Strikeout;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: rValue <<= aFD.Width;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: rValue <<= aFD.Pitch;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: rValue <<= aFD.CharacterWidth;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: rValue <<= aFD.Orientation;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: rValue <<= aFD.Kerning;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: rValue <<= aFD.WordLineMode;
break;
case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: rValue <<= aFD.Type;
break;
2011-03-01 19:08:19 +01:00
default: OSL_FAIL( "FontProperty?!" );
2000-09-18 16:07:07 +00:00
}
}
else
{
2011-03-01 19:08:19 +01:00
OSL_FAIL( "getFastPropertyValue - invalid Property!" );
2000-09-18 16:07:07 +00:00
}
}
// ::com::sun::star::beans::XPropertySet
void UnoControlModel::setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
{
sal_Int32 nPropId = 0;
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
nPropId = (sal_Int32) GetPropertyId( rPropertyName );
DBG_ASSERT( nPropId, "Invalid ID in UnoControlModel::setPropertyValue" );
}
if( nPropId )
setFastPropertyValue( nPropId, rValue );
else
throw ::com::sun::star::beans::UnknownPropertyException();
2000-09-18 16:07:07 +00:00
}
// ::com::sun::star::beans::XFastPropertySet
void UnoControlModel::setFastPropertyValue( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
{
if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
{
::osl::ClearableMutexGuard aGuard( GetMutex() );
Any aOldSingleValue;
getFastPropertyValue( aOldSingleValue, BASEPROPERTY_FONTDESCRIPTORPART_START );
2000-09-18 16:07:07 +00:00
::com::sun::star::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ];
FontDescriptor aOldFontDescriptor;
(*pProp) >>= aOldFontDescriptor;
FontDescriptor aNewFontDescriptor( aOldFontDescriptor );
lcl_ImplMergeFontProperty( aNewFontDescriptor, (sal_uInt16)nPropId, rValue );
Any aNewValue;
aNewValue <<= aNewFontDescriptor;
sal_Int32 nDescriptorId( BASEPROPERTY_FONTDESCRIPTOR );
nDescriptorId = BASEPROPERTY_FONTDESCRIPTOR;
// also, we need fire a propertyChange event for the single property, since with
// the above line, only an event for the FontDescriptor property will be fired
Any aNewSingleValue;
getFastPropertyValue( aNewSingleValue, BASEPROPERTY_FONTDESCRIPTORPART_START );
aGuard.clear();
setFastPropertyValues( 1, &nDescriptorId, &aNewValue, 1 );
fire( &nPropId, &aNewSingleValue, &aOldSingleValue, 1, sal_False );
2000-09-18 16:07:07 +00:00
}
else
setFastPropertyValues( 1, &nPropId, &rValue, 1 );
}
// ::com::sun::star::beans::XMultiPropertySet
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
{
2011-03-01 19:08:19 +01:00
OSL_FAIL( "UnoControlModel::getPropertySetInfo() not possible!" );
2000-09-18 16:07:07 +00:00
return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >();
}
void UnoControlModel::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
{
::osl::ClearableMutexGuard aGuard( GetMutex() );
2000-09-18 16:07:07 +00:00
sal_Int32 nProps = rPropertyNames.getLength();
// sal_Int32* pHandles = new sal_Int32[nProps];
// don't do this - it leaks in case of an exception
Sequence< sal_Int32 > aHandles( nProps );
sal_Int32* pHandles = aHandles.getArray();
// may need to change the order in the sequence, for this we need a non-const value sequence
uno::Sequence< uno::Any > aValues( Values );
uno::Any* pValues = aValues.getArray();
sal_Int32 nValidHandles = getInfoHelper().fillHandles( pHandles, rPropertyNames );
2000-09-18 16:07:07 +00:00
if ( nValidHandles )
{
// if somebody sets properties which are single aspects of a font descriptor,
// remove them, and build a font descriptor instead
::std::auto_ptr< awt::FontDescriptor > pFD;
for ( sal_uInt16 n = 0; n < nProps; ++n )
2000-09-18 16:07:07 +00:00
{
if ( ( pHandles[n] >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( pHandles[n] <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
{
if ( !pFD.get() )
2000-09-18 16:07:07 +00:00
{
::com::sun::star::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ];
pFD.reset( new awt::FontDescriptor );
(*pProp) >>= *pFD;
2000-09-18 16:07:07 +00:00
}
lcl_ImplMergeFontProperty( *pFD, (sal_uInt16)pHandles[n], pValues[n] );
2000-09-18 16:07:07 +00:00
pHandles[n] = -1;
nValidHandles--;
}
}
if ( nValidHandles )
{
ImplNormalizePropertySequence( nProps, pHandles, pValues, &nValidHandles );
aGuard.clear();
// clear our guard before calling into setFastPropertyValues - this method
// will implicitly call property listeners, and this should not happen with
// our mutex locked
// #i23451#
setFastPropertyValues( nProps, pHandles, pValues, nValidHandles );
}
else
aGuard.clear();
// same as a few lines above
2000-09-18 16:07:07 +00:00
// Don't merge FD property into array, as it is sorted
if ( pFD.get() )
2000-09-18 16:07:07 +00:00
{
::com::sun::star::uno::Any aValue;
aValue <<= *pFD;
sal_Int32 nHandle = BASEPROPERTY_FONTDESCRIPTOR;
setFastPropertyValues( 1, &nHandle, &aValue, 1 );
}
}
}
void UnoControlModel::ImplNormalizePropertySequence( const sal_Int32, sal_Int32*,
uno::Any*, sal_Int32* ) const SAL_THROW(())
{
// nothing to do here
}
void UnoControlModel::ImplEnsureHandleOrder( const sal_Int32 _nCount, sal_Int32* _pHandles,
uno::Any* _pValues, sal_Int32 _nFirstHandle, sal_Int32 _nSecondHandle ) const
{
for ( sal_Int32 i=0; i < _nCount; ++_pHandles, ++_pValues, ++i )
{
if ( _nSecondHandle == *_pHandles )
{
sal_Int32* pLaterHandles = _pHandles + 1;
uno::Any* pLaterValues = _pValues + 1;
for ( sal_Int32 j = i + 1; j < _nCount; ++j, ++pLaterHandles, ++pLaterValues )
{
if ( _nFirstHandle == *pLaterHandles )
{
// indeed it is -> exchange the both places in the sequences
sal_Int32 nHandle( *_pHandles );
*_pHandles = *pLaterHandles;
*pLaterHandles = nHandle;
uno::Any aValue( *_pValues );
*_pValues = *pLaterValues;
*pLaterValues = aValue;
break;
// this will leave the inner loop, and continue with the outer loop.
// Note that this means we will encounter the _nSecondHandle handle, again, once we reached
// (in the outer loop) the place where we just put it.
}
}
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */