diff options
author | Noel Power <noel.power@novell.com> | 2010-10-06 10:16:39 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2010-10-06 10:16:39 +0100 |
commit | 6c84dc18062ec6aad71fd65a409373c274402991 (patch) | |
tree | 7fbc48b32eeff8902fdd80e4e276eb8b8b009a84 /toolkit/source | |
parent | c09acdcf0b9f2a1b9b224025dc909a14e7aad717 (diff) |
initial commit for vba blob ( not including container_control stuff )
Diffstat (limited to 'toolkit/source')
-rw-r--r-- | toolkit/source/awt/vclxmenu.cxx | 13 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 37 | ||||
-rw-r--r-- | toolkit/source/controls/dialogcontrol.cxx | 225 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrolmodel.cxx | 1 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrols.cxx | 77 | ||||
-rw-r--r-- | toolkit/source/helper/property.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/helper/registerservices.cxx | 6 | ||||
-rw-r--r-- | toolkit/source/helper/servicenames.cxx | 4 |
8 files changed, 293 insertions, 72 deletions
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index 5e44df58318e..838dc698c567 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -539,6 +539,14 @@ void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Ref break; } } + // it seems the popup menu is not insert into maPopupMenueRefs + // if the popup men is not created by stardiv.Toolkit.VCLXPopupMenu + if( !aRef.is() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pNewRef = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > ; + *pNewRef = new VCLXPopupMenu( (PopupMenu*)pMenu ); + aRef = *pNewRef; + } } return aRef; } @@ -1101,3 +1109,8 @@ VCLXPopupMenu::VCLXPopupMenu() DBG_CTOR( VCLXPopupMenu, 0 ); ImplCreateMenu( TRUE ); } + +VCLXPopupMenu::VCLXPopupMenu( PopupMenu* pPopMenu ) : VCLXMenu( (Menu *)pPopMenu ) +{ + DBG_CTOR( VCLXPopupMenu, 0 ); +} diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index db34c840f8eb..5f4beaea2631 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -1082,6 +1082,7 @@ void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, BASEPROPERTY_REFERENCE_DEVICE, + BASEPROPERTY_GROUPNAME, 0); VCLXGraphicControl::ImplGetPropertyIds( rIds ); } @@ -2303,6 +2304,7 @@ VCLXDialog::~VCLXDialog() ::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, + SAL_STATIC_CAST( ::com::sun::star::document::XVbaMethodParameter*, this ), //liuchen 2009-6-23 SAL_STATIC_CAST( ::com::sun::star::awt::XDialog2*, this ), SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) ); return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType )); @@ -2310,6 +2312,7 @@ VCLXDialog::~VCLXDialog() // ::com::sun::star::lang::XTypeProvider IMPL_XTYPEPROVIDER_START( VCLXDialog ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::document::XVbaMethodParameter>* ) NULL ), //liuchen 2009-6-23 getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog2>* ) NULL ), getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ), VCLXTopWindow::getTypes() @@ -2420,6 +2423,40 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s return aInfo; } +//liuchen 2009-7-22 +// ::com::sun::star::document::XVbaMethodParameter +void SAL_CALL VCLXDialog::setVbaMethodParameter( + const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Any& Value ) +throw(::com::sun::star::uno::RuntimeException) +{ + if (rtl::OUString::createFromAscii( "Cancel" ) == PropertyName) + { + ::vos::OGuard aGuard( GetMutex() ); + if ( GetWindow() ) + { + sal_Int8 nCancel; + Value >>= nCancel; + + Dialog* pDlg = (Dialog*) GetWindow(); + pDlg->SetCloseFlag(nCancel); + } + } +} + +::com::sun::star::uno::Any SAL_CALL VCLXDialog::getVbaMethodParameter( + const ::rtl::OUString& PropertyName ) +throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aRet; + return aRet; +} +//liuchen 2009-7-22 + + + void SAL_CALL VCLXDialog::setProperty( const ::rtl::OUString& PropertyName, diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index c54549baed5e..55d79f02fca3 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -81,6 +81,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::util; +using namespace ::com::sun::star::script; using namespace toolkit; #define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" )) @@ -91,6 +92,8 @@ using namespace toolkit; //HELPER ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl ); +uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL ); + struct LanguageDependentProp { const char* pPropName; @@ -143,6 +146,18 @@ namespace return xGraphic; } + static ::rtl::OUString lcl_GetStringProperty( const ::rtl::OUString& sProperty, const Reference< XPropertySet >& xSet ) + { + ::rtl::OUString sValue; + Reference< XPropertySetInfo > xPSI; + if (xSet.is() && (xPSI = xSet->getPropertySetInfo()).is() && + xPSI->hasPropertyByName( sProperty ) ) + { + xSet->getPropertyValue( sProperty ) >>= sValue; + } + return sValue; + } + } // ---------------------------------------------------------------------------- @@ -254,7 +269,7 @@ static const ::rtl::OUString& getStepPropertyName( ) UnoControlDialogModel::UnoControlDialogModel() :maContainerListeners( *this ) ,maChangeListeners ( GetMutex() ) - ,mbGroupsUpToDate( sal_False ) + ,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false ) { ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); // ImplRegisterProperty( BASEPROPERTY_BORDER ); @@ -276,6 +291,8 @@ UnoControlDialogModel::UnoControlDialogModel() aBool <<= (sal_Bool) sal_True; ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool ); ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool ); + aBool <<= (sal_Bool) sal_False; + ImplRegisterProperty( BASEPROPERTY_VBAFORM, aBool ); } UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel ) @@ -283,7 +300,7 @@ UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rMode , UnoControlDialogModel_Base( rModel ) , maContainerListeners( *this ) , maChangeListeners ( GetMutex() ) - , mbGroupsUpToDate( sal_False ) + , mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false ) { } @@ -314,6 +331,40 @@ Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException) return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel ); } +void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception) +{ + UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue ); + try + { + switch ( nHandle ) + { + case BASEPROPERTY_IMAGEURL: + if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) ) + { + mbAdjustingGraphic = true; + ::rtl::OUString sImageURL; + OSL_VERIFY( rValue >>= sImageURL ); + setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) ); + mbAdjustingGraphic = false; + } + break; + + case BASEPROPERTY_GRAPHIC: + if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) ) + { + mbAdjustingGraphic = true; + setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ), uno::makeAny( ::rtl::OUString() ) ); + mbAdjustingGraphic = false; + } + break; + } + } + catch( const ::com::sun::star::uno::Exception& ) + { + OSL_ENSURE( sal_False, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting Graphic/ImageURL properties!" ); + } +} + Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const { Any aAny; @@ -906,6 +957,63 @@ void UnoControlDialogModel::implNotifyTabModelChange( const ::rtl::OUString& _rA } } +// ---------------------------------------------------------------------------- +void UnoControlDialogModel::AddRadioButtonGroup ( + ::std::map< ::rtl::OUString, ModelGroup >& rNamedGroups ) +{ + if ( rNamedGroups.size() == 0 ) + return; + + size_t nGroups = maGroups.size(); + maGroups.reserve( nGroups + rNamedGroups.size() ); + ::std::map< ::rtl::OUString, ModelGroup >::const_iterator i = rNamedGroups.begin(), e = rNamedGroups.end(); + for( ; i != e; ++i) + { + maGroups.push_back( i->second ); + } + + rNamedGroups.clear(); +} + +void UnoControlDialogModel::AddRadioButtonToGroup ( + const Reference< XControlModel >& rControlModel, + const ::rtl::OUString& rPropertyName, + ::std::map< ::rtl::OUString, ModelGroup >& rNamedGroups, + ModelGroup*& rpCurrentGroup ) +{ + Reference< XPropertySet > xCurProps( rControlModel, UNO_QUERY ); + ::rtl::OUString sGroup = lcl_GetStringProperty( rPropertyName, xCurProps ); + const sal_Int32 nControlModelStep = lcl_getDialogStep( rControlModel ); + + if ( sGroup.getLength() == 0 ) + { + // Create a new group if: + if ( maGroups.size() == 0 || // no groups + rpCurrentGroup == NULL || // previous group was closed + (nControlModelStep != 0 && // control step matches current group + maGroups.back().size() > 0 && // (group 0 == display everywhere) + nControlModelStep != lcl_getDialogStep( maGroups.back().back() ) ) ) + { + size_t nGroups = maGroups.size(); + maGroups.resize( nGroups + 1 ); + } + rpCurrentGroup = &maGroups.back(); + } + else + { + // Different steps get different sets of named groups + if ( rNamedGroups.size() > 0 && + rNamedGroups.begin()->second.size() > 0 ) + { + const sal_Int32 nPrevStep = lcl_getDialogStep( rNamedGroups.begin()->second.front() ); + if ( nControlModelStep != nPrevStep ) + AddRadioButtonGroup( rNamedGroups ); + } + + rpCurrentGroup = &rNamedGroups[ sGroup ]; + } + rpCurrentGroup->push_back( rControlModel ); +} // ---------------------------------------------------------------------------- void UnoControlDialogModel::implUpdateGroupStructure() @@ -930,10 +1038,13 @@ void UnoControlDialogModel::implUpdateGroupStructure() GroupingMachineState eState = eLookingForGroup; // the current state of our machine Reference< XServiceInfo > xModelSI; // for checking for a radion button - AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building - sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to + ModelGroup* aCurrentGroup = NULL; // the group which we're currently building sal_Bool bIsRadioButton; // is it a radio button? + const ::rtl::OUString GROUP_NAME( RTL_CONSTASCII_USTRINGPARAM( "GroupName" ) ); + + ::std::map< ::rtl::OUString, ModelGroup > aNamedGroups; + #if OSL_DEBUG_LEVEL > 1 ::std::vector< ::rtl::OUString > aCurrentGroupLabels; #endif @@ -954,14 +1065,8 @@ void UnoControlDialogModel::implUpdateGroupStructure() // the current model is a radio button // -> we found the beginning of a new group // create the place for this group - size_t nGroups = maGroups.size(); - maGroups.resize( nGroups + 1 ); - aCurrentGroup = maGroups.begin() + nGroups; - // and add the (only, til now) member - aCurrentGroup->push_back( *pControlModels ); - - // get the step which all controls of this group now have to belong to - nCurrentGroupStep = lcl_getDialogStep( *pControlModels ); + AddRadioButtonToGroup( *pControlModels, GROUP_NAME, aNamedGroups, aCurrentGroup ); + // new state: looking for further members eState = eExpandingGroup; @@ -979,7 +1084,7 @@ void UnoControlDialogModel::implUpdateGroupStructure() { if ( !bIsRadioButton ) { // no radio button -> the group is done - aCurrentGroup = maGroups.end(); + aCurrentGroup = NULL; eState = eLookingForGroup; #if OSL_DEBUG_LEVEL > 1 aCurrentGroupLabels.clear(); @@ -987,48 +1092,9 @@ void UnoControlDialogModel::implUpdateGroupStructure() continue; } - // it is a radio button - is it on the proper page? - const sal_Int32 nThisModelStep = lcl_getDialogStep( *pControlModels ); - if ( ( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page - || ( 0 == nThisModelStep ) // the current button appears on all pages - ) - { - // -> it belongs to the same group - aCurrentGroup->push_back( *pControlModels ); - // state still is eExpandingGroup - we're looking for further elements - eState = eExpandingGroup; + AddRadioButtonToGroup( *pControlModels, GROUP_NAME, aNamedGroups, aCurrentGroup ); #if OSL_DEBUG_LEVEL > 1 - Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY ); - ::rtl::OUString sLabel; - if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) ) - xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel; - aCurrentGroupLabels.push_back( sLabel ); -#endif - continue; - } - - // it's a radio button, but on a different page - // -> we open a new group for it - - // close the old group - aCurrentGroup = maGroups.end(); -#if OSL_DEBUG_LEVEL > 1 - aCurrentGroupLabels.clear(); -#endif - - // open a new group - size_t nGroups = maGroups.size(); - maGroups.resize( nGroups + 1 ); - aCurrentGroup = maGroups.begin() + nGroups; - // and add the (only, til now) member - aCurrentGroup->push_back( *pControlModels ); - - nCurrentGroupStep = nThisModelStep; - - // state is the same: we still are looking for further elements of the current group - eState = eExpandingGroup; -#if OSL_DEBUG_LEVEL > 1 Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY ); ::rtl::OUString sLabel; if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) ) @@ -1040,6 +1106,7 @@ void UnoControlDialogModel::implUpdateGroupStructure() } } + AddRadioButtonGroup( aNamedGroups ); mbGroupsUpToDate = sal_True; } @@ -1420,17 +1487,32 @@ void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl ) xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth; xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight; - // Currentley we are simply using MAP_APPFONT + // Currentley we are simply using MAP_APPFONT ( for normal Dialogs ) + // and MAP_100TH_MM for imported Userforms + MapMode aMode( MAP_APPFONT ); + sal_Bool bVBAForm = sal_False; + Reference< XPropertySet > xDlgModelProps( getModel(), UNO_QUERY ); + if ( xDlgModelProps.is() ) + { + try + { + xDlgModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBAForm" ) ) ) >>= bVBAForm; + } + catch( Exception& ) + { + } + } + if ( bVBAForm ) + aMode = MapMode( MAP_100TH_MM ); OutputDevice*pOutDev = Application::GetDefaultDevice(); - DBG_ASSERT( pOutDev, "Missing Default Device!" ); if ( pOutDev ) { ::Size aTmp( nX, nY ); - aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT ); + aTmp = pOutDev->LogicToPixel( aTmp, aMode ); nX = aTmp.Width(); nY = aTmp.Height(); aTmp = ::Size( nWidth, nHeight ); - aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT ); + aTmp = pOutDev->LogicToPixel( aTmp, aMode ); nWidth = aTmp.Width(); nHeight = aTmp.Height(); } @@ -1649,17 +1731,16 @@ void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDes // can lead to overwrites we have to set the graphic property // before the propertiesChangeEvents are sent! ::rtl::OUString aImageURL; - Reference< graphic::XGraphic > xGraphic; if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) && ( aImageURL.getLength() > 0 )) { - ::rtl::OUString absoluteUrl = + aImageURL = getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ), ImplGetPropertyValue( PROPERTY_IMAGEURL )); - xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl ); - ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True ); } + if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 ) + ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True ); } void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException) @@ -1891,18 +1972,16 @@ void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChang if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 )) { ::rtl::OUString aImageURL; - Reference< graphic::XGraphic > xGraphic; if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) && ( aImageURL.getLength() > 0 )) { - ::rtl::OUString absoluteUrl = + aImageURL = getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ), ImplGetPropertyValue( PROPERTY_IMAGEURL )); - xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl ); } - ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True ); + ImplSetPropertyValue( PROPERTY_IMAGEURL, uno::makeAny( aImageURL ), sal_True ); break; } } @@ -2103,6 +2182,9 @@ throw (RuntimeException) ::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl ) { + + ::rtl::OUString ret; + ::rtl::OUString baseLocation; ::rtl::OUString url; @@ -2112,9 +2194,16 @@ throw (RuntimeException) ::rtl::OUString absoluteURL( url ); if ( url.getLength() > 0 ) { - INetURLObject urlObj(baseLocation); - urlObj.removeSegment(); - baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE ); + // Don't adjust GraphicObject url(s) + if ( url.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 ) + { + INetURLObject urlObj(baseLocation); + urlObj.removeSegment(); + baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE ); + ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret ); + } + else + ret = url; const INetURLObject protocolCheck( url ); const INetProtocol protocol = protocolCheck.GetProtocol(); diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 91d202409e86..331c91aa269c 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -349,6 +349,7 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const case BASEPROPERTY_ENABLEVISIBLE: case BASEPROPERTY_DECORATION: aDefault <<= (sal_Bool) sal_True; break; + case BASEPROPERTY_GROUPNAME: case BASEPROPERTY_HELPTEXT: case BASEPROPERTY_HELPURL: case BASEPROPERTY_IMAGEURL: diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index d0961188d06c..4aba1e16c615 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -538,7 +538,7 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const return UnoControlModel::ImplGetDefaultValue( nPropId ); } - uno::Reference< graphic::XGraphic > GraphicControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ) + uno::Reference< graphic::XGraphic > getGraphicFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& rxGrfObj, const ::rtl::OUString& _rURL ) { uno::Reference< graphic::XGraphic > xGraphic; @@ -548,10 +548,10 @@ uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ); // get the DefaultContext ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - mxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID ); + rxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID ); } else // linked - mxGrfObj = NULL; // release the GraphicObject + rxGrfObj = NULL; // release the GraphicObject if ( !_rURL.getLength() ) return xGraphic; @@ -592,7 +592,7 @@ void SAL_CALL GraphicControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 n mbAdjustingGraphic = true; ::rtl::OUString sImageURL; OSL_VERIFY( rValue >>= sImageURL ); - setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) ); + setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( mxGrfObj, sImageURL ) ) ); mbAdjustingGraphic = false; } break; @@ -1730,6 +1730,75 @@ sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException) return sal_True; } +// MultiPage + +UnoMultiPageModel::UnoMultiPageModel() +{ + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); + ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_LABEL ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE ); + ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX ); +} + +::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) +{ + return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel ); +} + +uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) + { + uno::Any aAny; + aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox ); + //aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl ); + return aAny; + } + return UnoControlModel::ImplGetDefaultValue( nPropId ); +} + +::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// beans::XMultiPropertySet +uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException) +{ + static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + +// ---------------------------------------------------- +// class MultiPageControl +// ---------------------------------------------------- +UnoMultiPageControl::UnoMultiPageControl() +{ + maComponentInfos.nWidth = 100; + maComponentInfos.nHeight = 100; +} + +::rtl::OUString UnoMultiPageControl::GetComponentServiceName() +{ + return ::rtl::OUString::createFromAscii( "multipage" ); +} + +sal_Bool UnoMultiPageControl::isTransparent() throw(uno::RuntimeException) +{ + return sal_True; +} + // ===================================================================================================================== // = UnoControlListBoxModel_Data // ===================================================================================================================== diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index 3a83465a3218..ab99b3b4624a 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -182,6 +182,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_3 ( "FormatsSupplier", FORMATSSUPPLIER, Reference< ::com::sun::star::util::XNumberFormatsSupplier >, BOUND, MAYBEVOID, TRANSIENT ), DECL_PROP_2 ( "Graphic", GRAPHIC, Reference< ::com::sun::star::graphic::XGraphic >, BOUND, TRANSIENT ), + DECL_PROP_2 ( "GroupName", GROUPNAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ), @@ -284,6 +285,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ), DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ), + DECL_PROP_2 ( "VBAForm", VBAFORM, sal_Bool, BOUND, MAYBEDEFAULT ), DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx index aedf4024f2b9..0faf33a06cd3 100644 --- a/toolkit/source/helper/registerservices.cxx +++ b/toolkit/source/helper/registerservices.cxx @@ -165,6 +165,7 @@ IMPL_CREATEINSTANCE( UnoControlTimeFieldModel ) IMPL_CREATEINSTANCE( UnoControlProgressBarModel ) IMPL_CREATEINSTANCE( UnoControlScrollBarModel ) IMPL_CREATEINSTANCE( UnoSpinButtonModel ) +IMPL_CREATEINSTANCE( UnoMultiPageModel ) IMPL_CREATEINSTANCE( UnoControlFixedLineModel ) IMPL_CREATEINSTANCE( UnoCurrencyFieldControl ) IMPL_CREATEINSTANCE( UnoDateFieldControl ) @@ -184,6 +185,7 @@ IMPL_CREATEINSTANCE( UnoTimeFieldControl ) IMPL_CREATEINSTANCE( UnoProgressBarControl ) IMPL_CREATEINSTANCE( UnoScrollBarControl ) IMPL_CREATEINSTANCE( UnoSpinButtonControl ) +IMPL_CREATEINSTANCE( UnoMultiPageControl ) IMPL_CREATEINSTANCE( UnoFixedLineControl ) IMPL_CREATEINSTANCE( VCLXMenuBar ) IMPL_CREATEINSTANCE( VCLXPointer ) @@ -276,6 +278,8 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager, registerServices( xRegistryKey, "UnoControlScrollBarModel", szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel ); registerServices( xRegistryKey, "UnoSpinButtonModel", szServiceName_UnoSpinButtonModel ); registerServices( xRegistryKey, "UnoSpinButtonControl", szServiceName_UnoSpinButtonControl ); + registerServices( xRegistryKey, "UnoMultiPageModel", szServiceName_UnoMultiPageModel ); + registerServices( xRegistryKey, "UnoMultiPageControl", szServiceName_UnoMultiPageControl ); registerServices( xRegistryKey, "UnoFixedLineControl", szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine ); registerServices( xRegistryKey, "UnoControlFixedLineModel", szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel ); registerServices( xRegistryKey, "VCLXPrinterServer", szServiceName_PrinterServer, szServiceName2_PrinterServer ); @@ -366,6 +370,8 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen CHECKANDCREATEFACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer ) CHECKANDCREATEFACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap ) CHECKANDCREATEFACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel ) + CHECKANDCREATEFACTORY( UnoMultiPageModel, szServiceName_UnoMultiPageModel, NULL ) + CHECKANDCREATEFACTORY( UnoMultiPageControl, szServiceName_UnoMultiPageControl, NULL ) CHECKANDCREATEFACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL ) CHECKANDCREATEFACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL ) CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL ) diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx index f57f52f13e57..151f45226c58 100644 --- a/toolkit/source/helper/servicenames.cxx +++ b/toolkit/source/helper/servicenames.cxx @@ -37,6 +37,8 @@ const sal_Char __FAR_DATA szServiceName_PopupMenu[] = "stardiv.vcl.PopupMenu", s const sal_Char __FAR_DATA szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar"; const sal_Char __FAR_DATA szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer"; const sal_Char __FAR_DATA szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer"; + + const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel"; const sal_Char __FAR_DATA szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController"; const sal_Char __FAR_DATA szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel"; @@ -88,6 +90,8 @@ const sal_Char __FAR_DATA szServiceName_UnoControlRoadmap[] = "stardiv.vcl.contr const sal_Char __FAR_DATA szServiceName_UnoControlRoadmapModel[] = "stardiv.vcl.controlmodel.Roadmap", szServiceName2_UnoControlRoadmapModel[] = "com.sun.star.awt.UnoControlRoadmapModel"; const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[] = "com.sun.star.awt.UnoControlSpinButton"; const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel"; +const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[] = "com.sun.star.awt.UnoControlMultiPage"; +const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[] = "com.sun.star.awt.UnoMultiPageModel"; const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl"; const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel"; const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel"; |