diff options
author | Kurt Zenker <kz@openoffice.org> | 2009-06-03 11:26:39 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2009-06-03 11:26:39 +0000 |
commit | a8da772c4a21e7c9883823e3ae4dbee03c8c77fa (patch) | |
tree | d78ff4dbe4ab2916be487f8f921333877ae331a4 /sfx2/source | |
parent | a55914808cc66c14c4fb139f229ee84c8284bb74 (diff) |
CWS-TOOLING: integrate CWS os128
2009-04-22 12:58:26 +0200 b_michaelsen r271093 : #i101084# using the frames enumeration for other SwXFrames-queries; also added a complex test to ensure the behavior to be the same
2009-04-20 14:53:03 +0200 mav r270987 : #i101219# adjust the testcases to test memory cache and temporary file cache
2009-04-20 14:52:09 +0200 mav r270986 : #i101219#,#i99077# use memory to cache data; no precopying on commit
2009-04-20 14:39:21 +0200 mav r270984 : #i101219# use memory to cache data
2009-04-20 14:39:08 +0200 mav r270983 : #i101219# use memory to cache data
2009-04-20 14:38:45 +0200 mav r270982 : #i101219# use memory to cache data
2009-04-17 07:37:52 +0200 os r270912 : CWS-TOOLING: rebase CWS os128 to trunk@270723 (milestone: DEV300:m46)
2009-04-15 14:54:18 +0200 b_michaelsen r270845 : #i101084# using frame enumerations for paragraph export for better performance
2009-04-15 14:52:54 +0200 b_michaelsen r270843 : #i101084# implemented XEnumerationAccess interface on framesets
2009-04-03 17:08:10 +0200 mav r270504 : #i100722# do not compress streams of known compressed types per default
2009-04-03 13:49:50 +0200 os r270484 : resync error fixed
2009-04-03 12:55:32 +0200 mav r270470 : #i100722# do not compress streams of known compressed types per default
2009-04-03 10:00:58 +0200 os r270463 : resync error fixed
2009-04-03 09:52:53 +0200 os r270462 : resync error fixed
2009-04-03 09:10:14 +0200 os r270449 : #i99568# string compare operator of hash_map changed
2009-04-03 09:03:49 +0200 os r270446 : #i100683# normalize file URLs
2009-04-02 11:09:27 +0200 os r270381 : #i100683# making URLs relative without file access
2009-04-02 09:04:42 +0200 os r270366 : CWS-TOOLING: rebase CWS os128 to trunk@270033 (milestone: DEV300:m45)
2009-03-31 08:08:37 +0200 os r270258 : #i100683# reducing calls to URIHelper::simpleNormalizeMakeRelative()
2009-03-19 17:06:22 +0100 os r269756 : #i99568# XTolerantMultiPropertySet activated
2009-03-16 11:46:14 +0100 os r269517 : wrong commit to #i97471# removed
2009-03-16 11:36:50 +0100 os r269514 : #i97471# SwDrawTextShell::Init(): mouse double click and key input in group objects at the same time: prevent crash
2009-03-13 11:08:54 +0100 os r269464 : #i99568# static SfxItemPropertySet
2009-03-13 11:03:22 +0100 os r269463 : #i99568# static SfxItemPropertySet
2009-03-11 12:59:27 +0100 os r269320 : #i99568# WhichId of properties handled from ScDocOptionsObj added
2009-03-06 09:09:58 +0100 os r268972 : #i99568# SfxItemPropertySet improvements
2009-03-05 20:54:43 +0100 os r268942 : #i99568# Sfx/SvxItemPropertySet improvements
2009-03-05 20:19:52 +0100 os r268941 : #i99568# SfxItemPropertySet improvements
2009-03-05 20:05:03 +0100 os r268940 : #i99568# SfxItemPropertySet improvements
2009-03-05 18:54:47 +0100 os r268936 : #i99568# Sfx/SvxItemPropertySet improvements
2009-03-05 17:51:38 +0100 os r268931 : #i99568# Sfx/SvxItemPropertySet improvements
2009-03-05 17:33:03 +0100 os r268930 : #i99568# Sfx/SvxItemPropertySet improvements
2009-03-05 15:53:00 +0100 os r268920 : #i99568# Sfx/SvxItemPropertySet improvements
2009-03-05 15:52:50 +0100 os r268919 : #i99568# Sfx/SvxItemPropertySet improvements
2009-03-05 15:50:41 +0100 os r268918 : #i99568# Sfx/SvxItemPropertySet improvements
2009-03-05 15:41:04 +0100 os r268916 : #i99568# Sfx/SvxItemPropertySet improvements
2009-03-05 15:40:40 +0100 os r268915 : #i99568# Sfx/SvxItemPropertySet improvements
2009-03-05 10:16:20 +0100 os r268881 : #i99568# Sfx/SvxItemPropertySet improvements
2009-03-05 10:15:55 +0100 os r268880 : #i99568# Sfx/SvxItemPropertySet improvements
2009-03-03 08:40:09 +0100 os r268704 : ScTableSheetObj::GetItemPropertyMap fixed
2009-03-03 07:50:00 +0100 os r268703 : SfxItemProperty set as pointer
2009-03-03 07:49:46 +0100 os r268702 : SfxItemProperty set as pointer
2009-03-02 08:15:37 +0100 os r268631 : minor fix
2009-03-02 07:58:38 +0100 os r268630 : minor fix
2009-02-27 13:03:25 +0100 os r268584 : exports
2009-02-27 11:17:04 +0100 os r268567 : debug code removed
2009-02-27 11:04:07 +0100 os r268565 : duplicate return removed
2009-02-27 10:17:37 +0100 os r268558 : syntax fixed
2009-02-27 09:56:14 +0100 os r268554 : #i99568# type mix fixed
2009-02-27 09:40:56 +0100 os r268553 : #i99568# exports changes reverted
2009-02-25 12:50:54 +0100 os r268433 : #i99568# SfxItemPropertySet rework
2009-02-25 12:13:39 +0100 os r268432 : #i99568# SfxItemPropertySet rework
2009-02-25 12:12:47 +0100 os r268431 : #i99568# SfxItemPropertySet rework
2009-02-25 12:10:27 +0100 os r268430 : #i99568# SfxItemPropertySet rework
2009-02-25 12:09:36 +0100 os r268429 : #i99568# SfxItemPropertySet rework
2009-02-25 12:07:39 +0100 os r268428 : #i99568# SfxItemPropertySet rework
2009-02-25 11:59:35 +0100 os r268427 : #i99568# SfxItemPropertySet rework
2009-02-25 11:52:52 +0100 os r268425 : #i99568# SfxItemPropertySet rework
2009-02-25 11:49:17 +0100 os r268424 : #i99568# SfxItemPropertySet rework
2009-02-25 11:45:17 +0100 os r268423 : #i99568# SfxItemPropertySet rework
2009-02-11 11:39:04 +0100 os r267587 : #i57008# use registration of index marks at SwUnoCallback
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/doc/applet.cxx | 149 | ||||
-rw-r--r-- | sfx2/source/doc/iframe.cxx | 105 | ||||
-rw-r--r-- | sfx2/source/doc/objuno.cxx | 128 | ||||
-rw-r--r-- | sfx2/source/doc/plugin.cxx | 24 | ||||
-rw-r--r-- | sfx2/source/inc/applet.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/inc/iframe.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/inc/plugin.hxx | 2 |
7 files changed, 233 insertions, 179 deletions
diff --git a/sfx2/source/doc/applet.cxx b/sfx2/source/doc/applet.cxx index fa5ab7f449..a1354d2b0f 100644 --- a/sfx2/source/doc/applet.cxx +++ b/sfx2/source/doc/applet.cxx @@ -45,8 +45,10 @@ #include <toolkit/helper/vclunohelper.hxx> #include <svtools/javaoptions.hxx> #include <svtools/miscopt.hxx> +#include <comphelper/TypeGeneration.hxx> using namespace ::com::sun::star; +using namespace ::comphelper; namespace sfx2 { @@ -83,16 +85,26 @@ void AppletWrapper_Impl::showStatus( const XubString & ) {} #define PROPERTY_UNBOUND 0 #define PROPERTY_MAYBEVOID ::com::sun::star::beans::PropertyAttribute::MAYBEVOID -SfxItemPropertyMap aAppletPropertyMap_Impl[] = +#define WID_APPLET_CODE 1 +#define WID_APPLET_CODEBASE 2 +#define WID_APPLET_COMMANDS 3 +#define WID_APPLET_DOCBASE 4 +#define WID_APPLET_ISSCRIPT 5 +#define WID_APPLET_NAME 6 +const SfxItemPropertyMapEntry* lcl_GetAppletPropertyMap_Impl() { - { "AppletCode" , 10, 1, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "AppletCodeBase", 14, 2, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "AppletCommands", 14, 3, &::getCppuType((::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >*)0), PROPERTY_UNBOUND, 0 }, - { "AppletDocBase", 13, 4, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "AppletIsScript", 14, 5, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, - { "AppletName" , 10, 6, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - {0,0,0,0,0,0} -}; + static SfxItemPropertyMapEntry aAppletPropertyMap_Impl[] = + { + { MAP_CHAR_LEN("AppletCode") , WID_APPLET_CODE , CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("AppletCodeBase"), WID_APPLET_CODEBASE , CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("AppletCommands"), WID_APPLET_COMMANDS , CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("AppletDocBase"), WID_APPLET_DOCBASE , CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("AppletIsScript"), WID_APPLET_ISSCRIPT , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("AppletName") , WID_APPLET_NAME , CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_UNBOUND, 0 }, + {0,0,0,0,0,0} + }; +return aAppletPropertyMap_Impl; +} ::rtl::OUString AppletObject::getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) @@ -161,7 +173,7 @@ AppletObject::impl_createFactory() AppletObject::AppletObject( const uno::Reference < uno::XComponentContext >& rContext ) : mxContext( rContext ) - , maPropSet( aAppletPropertyMap_Impl ) + , maPropMap( lcl_GetAppletPropertyMap_Impl() ) , mpApplet( NULL ) , mbMayScript( FALSE ) { @@ -259,76 +271,85 @@ void SAL_CALL AppletObject::disposing( const com::sun::star::lang::EventObject& uno::Reference< beans::XPropertySetInfo > SAL_CALL AppletObject::getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException ) { - return maPropSet.getPropertySetInfo(); + static uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo( &maPropMap ); + return xInfo; } void SAL_CALL AppletObject::setPropertyValue(const ::rtl::OUString& aPropertyName, const uno::Any& aAny) throw ( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - if ( aPropertyName.equalsAscii("AppletCode") ) - { - aAny >>= maClass; - } - else if ( aPropertyName.equalsAscii("AppletCodeBase") ) - { - //pImpl->aCodeBase = rURL.GetMainURL( INetURLObject::NO_DECODE ); - //if( rURL.GetProtocol() == INET_PROT_FILE - // && pImpl->aCodeBase.GetChar( 9 ) == INET_ENC_DELIM_TOKEN ) - // // Laufwerksbuchstabe auf ':' patchen - // pImpl->aCodeBase.SetChar( 9, INET_DELIM_TOKEN ); - - aAny >>= maCodeBase; - } - else if ( aPropertyName.equalsAscii("AppletCommands") ) - { - maCmdList.Clear(); - uno::Sequence < beans::PropertyValue > aCommandSequence; - if( aAny >>= aCommandSequence ) - maCmdList.FillFromSequence( aCommandSequence ); - } - else if ( aPropertyName.equalsAscii("AppletIsScript") ) - { - aAny >>= mbMayScript; - } - else if ( aPropertyName.equalsAscii("AppletName") ) - { - aAny >>= maName; - } - else if ( aPropertyName.equalsAscii("AppletDocBase") ) + + const SfxItemPropertySimpleEntry* pEntry = maPropMap.getByName( aPropertyName ); + if( !pEntry ) + throw beans::UnknownPropertyException(); + switch( pEntry->nWID ) { - aAny >>= maDocBase; + case WID_APPLET_CODE : + aAny >>= maClass; + break; + case WID_APPLET_CODEBASE : + //pImpl->aCodeBase = rURL.GetMainURL( INetURLObject::NO_DECODE ); + //if( rURL.GetProtocol() == INET_PROT_FILE + // && pImpl->aCodeBase.GetChar( 9 ) == INET_ENC_DELIM_TOKEN ) + // // Laufwerksbuchstabe auf ':' patchen + // pImpl->aCodeBase.SetChar( 9, INET_DELIM_TOKEN ); + + aAny >>= maCodeBase; + break; + case WID_APPLET_COMMANDS : + { + maCmdList.Clear(); + uno::Sequence < beans::PropertyValue > aCommandSequence; + if( aAny >>= aCommandSequence ) + maCmdList.FillFromSequence( aCommandSequence ); + } + break; + case WID_APPLET_DOCBASE : + aAny >>= maDocBase; + break; + case WID_APPLET_ISSCRIPT : + aAny >>= mbMayScript; + break; + case WID_APPLET_NAME : + aAny >>= maName; + break; + default:; + } - else - throw beans::UnknownPropertyException(); } uno::Any SAL_CALL AppletObject::getPropertyValue(const ::rtl::OUString& aPropertyName) throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { uno::Any aAny; - if ( aPropertyName.equalsAscii("AppletCode") ) + const SfxItemPropertySimpleEntry* pEntry = maPropMap.getByName( aPropertyName ); + if( !pEntry ) + throw beans::UnknownPropertyException(); + switch( pEntry->nWID ) { + case WID_APPLET_CODE : aAny <<= maClass; - } - else if ( aPropertyName.equalsAscii("AppletCodeBase") ) - { + break; + case WID_APPLET_CODEBASE : aAny <<= maCodeBase; + break; + case WID_APPLET_COMMANDS : + { + uno::Sequence< beans::PropertyValue > aCommandSequence; + maCmdList.FillSequence( aCommandSequence ); + aAny <<= aCommandSequence; + } + break; + case WID_APPLET_DOCBASE : + break; + case WID_APPLET_ISSCRIPT : + aAny <<= mbMayScript; + break; + case WID_APPLET_NAME : + aAny <<= maName; + break; + default:; + } - else if ( aPropertyName.equalsAscii("AppletCommands") ) - { - uno::Sequence< beans::PropertyValue > aCommandSequence; - maCmdList.FillSequence( aCommandSequence ); - aAny <<= aCommandSequence; - } - else if ( aPropertyName.equalsAscii("AppletIsScript") ) - { - aAny <<= mbMayScript; - } - else if ( aPropertyName.equalsAscii("AppletName") ) - { - aAny <<= maName; - } - else - throw beans::UnknownPropertyException(); return aAny; } diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index 9fa66d4464..071c69a77b 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -96,25 +96,38 @@ void IFrameWindow_Impl::SetBorder( sal_Bool bNewBorder ) #define PROPERTY_UNBOUND 0 -SfxItemPropertyMap aIFramePropertyMap_Impl[] = +#define WID_FRAME_URL 1 +#define WID_FRAME_NAME 2 +#define WID_FRAME_IS_AUTO_SCROLL 3 +#define WID_FRAME_IS_SCROLLING_MODE 4 +#define WID_FRAME_IS_BORDER 5 +#define WID_FRAME_IS_AUTO_BORDER 6 +#define WID_FRAME_MARGIN_WIDTH 7 +#define WID_FRAME_MARGIN_HEIGHT 8 + +const SfxItemPropertyMapEntry* lcl_GetIFramePropertyMap_Impl() { - { "FrameIsAutoBorder", 17, 1, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, - { "FrameIsAutoScroll", 17, 2, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, - { "FrameIsBorder", 13, 3, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, - { "FrameIsScrollingMode", 20, 4, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, - { "FrameMarginHeight", 17, 5, &::getCppuType( (sal_Int32*)0 ), PROPERTY_UNBOUND, 0 }, - { "FrameMarginWidth", 16, 6, &::getCppuType( (sal_Int32*)0 ), PROPERTY_UNBOUND, 0 }, - { "FrameName", 9, 7, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "FrameURL", 8, 8, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - {0,0,0,0,0,0} -}; + static SfxItemPropertyMapEntry aIFramePropertyMap_Impl[] = + { + { MAP_CHAR_LEN("FrameIsAutoBorder"), WID_FRAME_IS_AUTO_BORDER, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("FrameIsAutoScroll"), WID_FRAME_IS_AUTO_SCROLL, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("FrameIsBorder"), WID_FRAME_IS_BORDER, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("FrameIsScrollingMode"), WID_FRAME_IS_SCROLLING_MODE, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("FrameMarginHeight"), WID_FRAME_MARGIN_HEIGHT, &::getCppuType( (sal_Int32*)0 ), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("FrameMarginWidth"), WID_FRAME_MARGIN_WIDTH, &::getCppuType( (sal_Int32*)0 ), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("FrameName"), WID_FRAME_NAME, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("FrameURL"), WID_FRAME_URL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + {0,0,0,0,0,0} + }; + return aIFramePropertyMap_Impl; +} SFX_IMPL_XSERVICEINFO( IFrameObject, "com.sun.star.embed.SpecialEmbeddedObject", "com.sun.star.comp.sfx2.IFrameObject" ) SFX_IMPL_SINGLEFACTORY( IFrameObject ); IFrameObject::IFrameObject( const uno::Reference < lang::XMultiServiceFactory >& rFact ) : mxFact( rFact ) - , maPropSet( aIFramePropertyMap_Impl ) + , maPropMap( lcl_GetIFramePropertyMap_Impl() ) { } @@ -213,43 +226,54 @@ void SAL_CALL IFrameObject::disposing( const com::sun::star::lang::EventObject& uno::Reference< beans::XPropertySetInfo > SAL_CALL IFrameObject::getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException ) { - return maPropSet.getPropertySetInfo(); + static uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo( &maPropMap ); + return xInfo; } void SAL_CALL IFrameObject::setPropertyValue(const ::rtl::OUString& aPropertyName, const uno::Any& aAny) throw ( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - if ( aPropertyName.equalsAscii("FrameURL") ) + const SfxItemPropertySimpleEntry* pEntry = maPropMap.getByName( aPropertyName ); + if( !pEntry ) + throw beans::UnknownPropertyException(); + switch( pEntry->nWID ) + { + case WID_FRAME_URL: { ::rtl::OUString aURL; aAny >>= aURL; maFrmDescr.SetURL( String(aURL) ); } - else if ( aPropertyName.equalsAscii("FrameName") ) + break; + case WID_FRAME_NAME: { ::rtl::OUString aName; if ( aAny >>= aName ) maFrmDescr.SetName( aName ); } - else if ( aPropertyName.equalsAscii("FrameIsAutoScroll") ) + break; + case WID_FRAME_IS_AUTO_SCROLL: { sal_Bool bIsAutoScroll = sal_Bool(); if ( (aAny >>= bIsAutoScroll) && bIsAutoScroll ) maFrmDescr.SetScrollingMode( ScrollingAuto ); } - else if ( aPropertyName.equalsAscii("FrameIsScrollingMode") ) + break; + case WID_FRAME_IS_SCROLLING_MODE: { sal_Bool bIsScroll = sal_Bool(); if ( aAny >>= bIsScroll ) maFrmDescr.SetScrollingMode( bIsScroll ? ScrollingYes : ScrollingNo ); } - else if ( aPropertyName.equalsAscii("FrameIsBorder") ) + break; + case WID_FRAME_IS_BORDER: { sal_Bool bIsBorder = sal_Bool(); if ( aAny >>= bIsBorder ) maFrmDescr.SetFrameBorder( bIsBorder ); } - else if ( aPropertyName.equalsAscii("FrameIsAutoBorder") ) + break; + case WID_FRAME_IS_AUTO_BORDER: { sal_Bool bIsAutoBorder = sal_Bool(); if ( (aAny >>= bIsAutoBorder) ) @@ -260,7 +284,8 @@ void SAL_CALL IFrameObject::setPropertyValue(const ::rtl::OUString& aPropertyNam maFrmDescr.SetFrameBorder( bBorder ); } } - else if ( aPropertyName.equalsAscii("FrameMarginWidth") ) + break; + case WID_FRAME_MARGIN_WIDTH: { sal_Int32 nMargin = 0; Size aSize = maFrmDescr.GetMargin(); @@ -270,7 +295,8 @@ void SAL_CALL IFrameObject::setPropertyValue(const ::rtl::OUString& aPropertyNam maFrmDescr.SetMargin( aSize ); } } - else if ( aPropertyName.equalsAscii("FrameMarginHeight") ) + break; + case WID_FRAME_MARGIN_HEIGHT: { sal_Int32 nMargin = 0; Size aSize = maFrmDescr.GetMargin(); @@ -280,52 +306,65 @@ void SAL_CALL IFrameObject::setPropertyValue(const ::rtl::OUString& aPropertyNam maFrmDescr.SetMargin( aSize ); } } - else - throw beans::UnknownPropertyException(); + break; + default: ; + } } uno::Any SAL_CALL IFrameObject::getPropertyValue(const ::rtl::OUString& aPropertyName) throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { + const SfxItemPropertySimpleEntry* pEntry = maPropMap.getByName( aPropertyName ); + if( !pEntry ) + throw beans::UnknownPropertyException(); uno::Any aAny; - if ( aPropertyName.equalsAscii("FrameURL") ) + switch( pEntry->nWID ) + { + case WID_FRAME_URL: { aAny <<= ::rtl::OUString( maFrmDescr.GetURL().GetMainURL( INetURLObject::NO_DECODE ) ); } - else if ( aPropertyName.equalsAscii("FrameName") ) + break; + case WID_FRAME_NAME: { aAny <<= ::rtl::OUString( maFrmDescr.GetName() ); } - else if ( aPropertyName.equalsAscii("FrameIsAutoScroll") ) + break; + case WID_FRAME_IS_AUTO_SCROLL: { sal_Bool bIsAutoScroll = ( maFrmDescr.GetScrollingMode() == ScrollingAuto ); aAny <<= bIsAutoScroll; } - else if ( aPropertyName.equalsAscii("FrameIsScrollingMode") ) + break; + case WID_FRAME_IS_SCROLLING_MODE: { sal_Bool bIsScroll = ( maFrmDescr.GetScrollingMode() == ScrollingYes ); aAny <<= bIsScroll; } - else if ( aPropertyName.equalsAscii("FrameIsBorder") ) + break; + case WID_FRAME_IS_BORDER: { sal_Bool bIsBorder = maFrmDescr.IsFrameBorderOn(); aAny <<= bIsBorder; } - else if ( aPropertyName.equalsAscii("FrameIsAutoBorder") ) + break; + case WID_FRAME_IS_AUTO_BORDER: { sal_Bool bIsAutoBorder = !maFrmDescr.IsFrameBorderSet(); aAny <<= bIsAutoBorder; } - else if ( aPropertyName.equalsAscii("FrameMarginWidth") ) + break; + case WID_FRAME_MARGIN_WIDTH: { aAny <<= (sal_Int32 ) maFrmDescr.GetMargin().Width(); } - else if ( aPropertyName.equalsAscii("FrameMarginHeight") ) + break; + case WID_FRAME_MARGIN_HEIGHT: { aAny <<= (sal_Int32 ) maFrmDescr.GetMargin().Height(); } - else - throw beans::UnknownPropertyException(); + default: ; + } return aAny; } diff --git a/sfx2/source/doc/objuno.cxx b/sfx2/source/doc/objuno.cxx index e3dcc286f9..e9e37a44c5 100644 --- a/sfx2/source/doc/objuno.cxx +++ b/sfx2/source/doc/objuno.cxx @@ -99,33 +99,37 @@ using namespace ::com::sun::star; #define PROPERTY_UNBOUND 0 #define PROPERTY_MAYBEVOID ::com::sun::star::beans::PropertyAttribute::MAYBEVOID -SfxItemPropertyMap aDocInfoPropertyMap_Impl[] = +const SfxItemPropertyMapEntry* lcl_GetDocInfoPropertyMap() { - { "Author" , 6 , WID_FROM, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "AutoloadEnabled" , 15, MID_DOCINFO_AUTOLOADENABLED, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, - { "AutoloadSecs" , 12, MID_DOCINFO_AUTOLOADSECS, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 }, - { "AutoloadURL" , 11, MID_DOCINFO_AUTOLOADURL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "CreationDate" , 12, WID_DATE_CREATED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, - { "DefaultTarget" , 13, MID_DOCINFO_DEFAULTTARGET, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "Description" , 11, MID_DOCINFO_DESCRIPTION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "DocumentStatistic", 17 , MID_DOCINFO_STATISTIC, &::getCppuType((const uno::Sequence< beans::NamedValue >*)0), PROPERTY_UNBOUND, 0 }, - { "EditingCycles" , 13, MID_DOCINFO_REVISION, &::getCppuType((const sal_Int16*)0), PROPERTY_UNBOUND, 0 }, - { "EditingDuration" , 15, MID_DOCINFO_EDITTIME, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 }, - { "Generator" , 9, SID_APPLICATION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "Keywords" , 8 , WID_KEYWORDS, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "Language" , 8, MID_DOCINFO_CHARLOCALE, &::getCppuType((const lang::Locale*)0), PROPERTY_UNBOUND, 0 }, - { "MIMEType" , 8 , WID_CONTENT_TYPE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND | ::com::sun::star::beans::PropertyAttribute::READONLY, 0 }, - { "ModifiedBy" , 10, MID_DOCINFO_MODIFICATIONAUTHOR, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "ModifyDate" , 10, WID_DATE_MODIFIED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, - { "PrintDate" , 9 , MID_DOCINFO_PRINTDATE, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, - { "PrintedBy" , 9 , MID_DOCINFO_PRINTEDBY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "Subject" , 7 , MID_DOCINFO_SUBJECT, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "Template" , 8 , MID_DOCINFO_TEMPLATE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "TemplateFileName", 16, SID_TEMPLATE_NAME, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "TemplateDate" , 12, MID_DOCINFO_TEMPLATEDATE, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, - { "Title" , 5 , WID_TITLE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - {0,0,0,0,0,0} -}; + static SfxItemPropertyMapEntry aDocInfoPropertyMap_Impl[] = + { + { "Author" , 6 , WID_FROM, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "AutoloadEnabled" , 15, MID_DOCINFO_AUTOLOADENABLED, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 }, + { "AutoloadSecs" , 12, MID_DOCINFO_AUTOLOADSECS, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 }, + { "AutoloadURL" , 11, MID_DOCINFO_AUTOLOADURL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "CreationDate" , 12, WID_DATE_CREATED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, + { "DefaultTarget" , 13, MID_DOCINFO_DEFAULTTARGET, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "Description" , 11, MID_DOCINFO_DESCRIPTION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "DocumentStatistic", 17 , MID_DOCINFO_STATISTIC, &::getCppuType((const uno::Sequence< beans::NamedValue >*)0), PROPERTY_UNBOUND, 0 }, + { "EditingCycles" , 13, MID_DOCINFO_REVISION, &::getCppuType((const sal_Int16*)0), PROPERTY_UNBOUND, 0 }, + { "EditingDuration" , 15, MID_DOCINFO_EDITTIME, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 }, + { "Generator" , 9, SID_APPLICATION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "Keywords" , 8 , WID_KEYWORDS, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "Language" , 8, MID_DOCINFO_CHARLOCALE, &::getCppuType((const lang::Locale*)0), PROPERTY_UNBOUND, 0 }, + { "MIMEType" , 8 , WID_CONTENT_TYPE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND | ::com::sun::star::beans::PropertyAttribute::READONLY, 0 }, + { "ModifiedBy" , 10, MID_DOCINFO_MODIFICATIONAUTHOR, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "ModifyDate" , 10, WID_DATE_MODIFIED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, + { "PrintDate" , 9 , MID_DOCINFO_PRINTDATE, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, + { "PrintedBy" , 9 , MID_DOCINFO_PRINTEDBY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "Subject" , 7 , MID_DOCINFO_SUBJECT, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "Template" , 8 , MID_DOCINFO_TEMPLATE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "TemplateFileName", 16, SID_TEMPLATE_NAME, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { "TemplateDate" , 12, MID_DOCINFO_TEMPLATEDATE, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 }, + { "Title" , 5 , WID_TITLE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + {0,0,0,0,0,0} + }; + return aDocInfoPropertyMap_Impl; +} static USHORT aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; @@ -171,7 +175,7 @@ struct OUStringHashCode } }; -struct SfxExtendedItemPropertyMap : public SfxItemPropertyMap +struct SfxExtendedItemPropertyMap : public SfxItemPropertyMapEntry { ::com::sun::star::uno::Any aValue; }; @@ -219,13 +223,13 @@ class MixedPropertySetInfo : public ::cppu::WeakImplHelper1< ::com::sun::star::b { private: - SfxItemPropertyMap* _pFixProps; + SfxItemPropertyMap _aPropertyMap; ::rtl::OUString* _pUserKeys; uno::Reference<beans::XPropertySet> _xUDProps; public: - MixedPropertySetInfo(SfxItemPropertyMap* pFixProps, + MixedPropertySetInfo( const SfxItemPropertyMapEntry* pFixProps, ::rtl::OUString* pUserKeys, uno::Reference<beans::XPropertySet> xUDProps); @@ -238,10 +242,10 @@ class MixedPropertySetInfo : public ::cppu::WeakImplHelper1< ::com::sun::star::b //----------------------------------------------------------------------------- -MixedPropertySetInfo::MixedPropertySetInfo(SfxItemPropertyMap* pFixProps , +MixedPropertySetInfo::MixedPropertySetInfo(const SfxItemPropertyMapEntry* pFixProps, ::rtl::OUString* pUserKeys, uno::Reference<beans::XPropertySet> xUDProps) - : _pFixProps (pFixProps ) + : _aPropertyMap( pFixProps ) , _pUserKeys(pUserKeys) , _xUDProps(xUDProps) { @@ -261,7 +265,9 @@ MixedPropertySetInfo::~MixedPropertySetInfo() ::comphelper::SequenceAsVector< ::com::sun::star::beans::Property > lProps; // copy "fix" props - SfxItemPropertyMap* pFixProp = _pFixProps; + //todo: os: this ugly thing should be replaced + const SfxItemPropertyMapEntry* pFixProp = lcl_GetDocInfoPropertyMap(); + while(pFixProp && pFixProp->pName) { ::com::sun::star::beans::Property aProp; @@ -300,27 +306,17 @@ MixedPropertySetInfo::~MixedPropertySetInfo() //----------------------------------------------------------------------------- -::com::sun::star::beans::Property SAL_CALL MixedPropertySetInfo::getPropertyByName( const ::rtl::OUString& sName ) +::com::sun::star::beans::Property SAL_CALL MixedPropertySetInfo::getPropertyByName( + const ::rtl::OUString& sName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException ) { ::com::sun::star::beans::Property aProp; // search it as "fix" prop - SfxItemPropertyMap* pFixProp = _pFixProps; - while(pFixProp && pFixProp->pName) - { - if (sName.equalsAscii(pFixProp->pName)) - { - aProp.Name = sName; - aProp.Handle = pFixProp->nWID; - aProp.Type = *(pFixProp->pType); - aProp.Attributes = (sal_Int16)(pFixProp->nFlags); - return aProp; - } - ++pFixProp; - } - + if( _aPropertyMap.hasPropertyByName( sName ) ) + return _aPropertyMap.getPropertyByName( sName ); + else // search it as "dynamic" prop return _xUDProps->getPropertySetInfo()->getPropertyByName(sName); } @@ -330,17 +326,9 @@ MixedPropertySetInfo::~MixedPropertySetInfo() ::sal_Bool SAL_CALL MixedPropertySetInfo::hasPropertyByName(const ::rtl::OUString& sName) throw(::com::sun::star::uno::RuntimeException) { - // "fix" prop? - SfxItemPropertyMap* pFixProp = _pFixProps; - while(pFixProp && pFixProp->pName) - { - if (sName.equalsAscii(pFixProp->pName)) - return sal_True; - ++pFixProp; - } - - // "dynamic" prop? - return _xUDProps->getPropertySetInfo()->hasPropertyByName(sName); + return _aPropertyMap.hasPropertyByName( sName ) ? // "fix" prop? + sal_True : + _xUDProps->getPropertySetInfo()->hasPropertyByName(sName); // "dynamic" prop? } //----------------------------------------------------------------------------- @@ -358,11 +346,13 @@ struct SfxDocumentInfoObject_Impl // the actual contents uno::Reference<document::XDocumentProperties> m_xDocProps; + SfxItemPropertyMap m_aPropertyMap; SfxDocumentInfoObject_Impl() : _aDisposeContainer( _aMutex ) , bDisposed(sal_False) , m_xDocProps() + , m_aPropertyMap( lcl_GetDocInfoPropertyMap() ) { // the number of user fields is not changeable from the outside // we can't set it too high because every name/value pair will be written to the file (even if empty) @@ -529,7 +519,7 @@ void SAL_CALL SfxDocumentInfoObject::removeEventListener(const ::com::sun::star uno::Reference<beans::XPropertySet> xPropSet( _pImp->m_xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); - MixedPropertySetInfo* pInfo = new MixedPropertySetInfo( aDocInfoPropertyMap_Impl, _pImp->m_UserDefined, xPropSet); + MixedPropertySetInfo* pInfo = new MixedPropertySetInfo( lcl_GetDocInfoPropertyMap(), _pImp->m_UserDefined, xPropSet); uno::Reference< beans::XPropertySetInfo > xInfo( static_cast< beans::XPropertySetInfo* >(pInfo), uno::UNO_QUERY_THROW); return xInfo; @@ -542,12 +532,10 @@ void SAL_CALL SfxDocumentInfoObject::setPropertyValue(const ::rtl::OUString& aP beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aDocInfoPropertyMap_Impl, - aPropertyName ); + const SfxItemPropertySimpleEntry* pEntry = _pImp->m_aPropertyMap.getByName( aPropertyName ); // fix prop! - if ( pMap ) - setFastPropertyValue( pMap->nWID, aValue ); + if ( pEntry ) + setFastPropertyValue( pEntry->nWID, aValue ); else // dynamic prop! { @@ -563,11 +551,10 @@ uno::Any SAL_CALL SfxDocumentInfoObject::getPropertyValue(const ::rtl::OUStrin uno::RuntimeException, beans::UnknownPropertyException, lang::WrappedTargetException) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( aDocInfoPropertyMap_Impl, - aPropertyName ); + const SfxItemPropertySimpleEntry* pEntry = _pImp->m_aPropertyMap.getByName( aPropertyName ); // fix prop! - if ( pMap ) - return getFastPropertyValue( pMap->nWID ); + if ( pEntry ) + return getFastPropertyValue( pEntry->nWID ); else // dynamic prop! { @@ -680,8 +667,7 @@ void SAL_CALL SfxDocumentInfoObject::addProperty(const ::rtl::OUString& ::com::sun::star::uno::RuntimeException ) { // clash with "fix" properties ? - sal_Bool bFixProp = (SfxItemPropertyMap::GetByName( aDocInfoPropertyMap_Impl, sName ) != 0); - + sal_Bool bFixProp = _pImp->m_aPropertyMap.getByName( sName ) != 0; if ( bFixProp ) { ::rtl::OUStringBuffer sMsg(256); @@ -707,7 +693,7 @@ void SAL_CALL SfxDocumentInfoObject::removeProperty(const ::rtl::OUString& sName ::com::sun::star::uno::RuntimeException ) { // clash with "fix" properties ? - sal_Bool bFixProp = (SfxItemPropertyMap::GetByName( aDocInfoPropertyMap_Impl, sName ) != 0); + sal_Bool bFixProp = _pImp->m_aPropertyMap.getByName( sName ) != 0; if ( bFixProp ) { ::rtl::OUStringBuffer sMsg(256); diff --git a/sfx2/source/doc/plugin.cxx b/sfx2/source/doc/plugin.cxx index c83070089d..6c98c6d197 100644 --- a/sfx2/source/doc/plugin.cxx +++ b/sfx2/source/doc/plugin.cxx @@ -67,20 +67,27 @@ void PluginWindow_Impl::Resize() #define PROPERTY_UNBOUND 0 -SfxItemPropertyMap aPluginPropertyMap_Impl[] = +#define WID_COMMANDS 1 +#define WID_MIMETYPE 2 +#define WID_URL 3 +const SfxItemPropertyMapEntry* lcl_GetPluginPropertyMap_Impl() { - { "PluginCommands", 14, 1, &::getCppuType((::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >*)0), PROPERTY_UNBOUND, 0}, - { "PluginMimeType", 14, 2, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - { "PluginURL", 9, 3, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, - {0,0,0,0,0,0} -}; + static SfxItemPropertyMapEntry aPluginPropertyMap_Impl[] = + { + { MAP_CHAR_LEN("PluginCommands"), WID_COMMANDS, &::getCppuType((::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >*)0), PROPERTY_UNBOUND, 0}, + { MAP_CHAR_LEN("PluginMimeType"), WID_MIMETYPE, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + { MAP_CHAR_LEN("PluginURL"), WID_URL , &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 }, + {0,0,0,0,0,0} + }; + return aPluginPropertyMap_Impl; +} SFX_IMPL_XSERVICEINFO( PluginObject, "com.sun.star.embed.SpecialEmbeddedObject", "com.sun.star.comp.sfx2.PluginObject" ) SFX_IMPL_SINGLEFACTORY( PluginObject ); PluginObject::PluginObject( const uno::Reference < lang::XMultiServiceFactory >& rFact ) : mxFact( rFact ) - , maPropSet( aPluginPropertyMap_Impl ) + , maPropMap( lcl_GetPluginPropertyMap_Impl() ) { } @@ -194,7 +201,8 @@ void SAL_CALL PluginObject::disposing( const com::sun::star::lang::EventObject& uno::Reference< beans::XPropertySetInfo > SAL_CALL PluginObject::getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException ) { - return maPropSet.getPropertySetInfo(); + static uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo( &maPropMap ); + return xInfo; } void SAL_CALL PluginObject::setPropertyValue(const ::rtl::OUString& aPropertyName, const uno::Any& aAny) diff --git a/sfx2/source/inc/applet.hxx b/sfx2/source/inc/applet.hxx index 6af259b0a0..ee53c7dd66 100644 --- a/sfx2/source/inc/applet.hxx +++ b/sfx2/source/inc/applet.hxx @@ -66,7 +66,7 @@ class AppletObject : public ::cppu::WeakImplHelper6 < com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > mxContext; com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > mxObj; - SfxItemPropertySet maPropSet; + SfxItemPropertyMap maPropMap; SvCommandList maCmdList; ::rtl::OUString maClass; ::rtl::OUString maName; diff --git a/sfx2/source/inc/iframe.hxx b/sfx2/source/inc/iframe.hxx index 561f315fd9..332aaa171f 100644 --- a/sfx2/source/inc/iframe.hxx +++ b/sfx2/source/inc/iframe.hxx @@ -65,7 +65,7 @@ class IFrameObject : public ::cppu::WeakImplHelper6 < com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > mxFact; com::sun::star::uno::Reference < com::sun::star::frame::XFrame > mxFrame; com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > mxObj; - SfxItemPropertySet maPropSet; + SfxItemPropertyMap maPropMap; SfxFrameDescriptor maFrmDescr; IFrameObject( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rFact ); diff --git a/sfx2/source/inc/plugin.hxx b/sfx2/source/inc/plugin.hxx index 6b9835edd9..6c545e2fb2 100644 --- a/sfx2/source/inc/plugin.hxx +++ b/sfx2/source/inc/plugin.hxx @@ -63,7 +63,7 @@ class PluginObject : public ::cppu::WeakImplHelper5 < com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > mxFact; com::sun::star::uno::Reference< com::sun::star::plugin::XPlugin > mxPlugin; com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > mxObj; - SfxItemPropertySet maPropSet; + SfxItemPropertyMap maPropMap; SvCommandList maCmdList; ::rtl::OUString maURL; ::rtl::OUString maMimeType; |