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 | |
parent | c09acdcf0b9f2a1b9b224025dc909a14e7aad717 (diff) |
initial commit for vba blob ( not including container_control stuff )
25 files changed, 528 insertions, 84 deletions
diff --git a/svtools/source/misc/makefile.mk b/svtools/source/misc/makefile.mk index 32781dbfefb1..cd14b3bf8c44 100755 --- a/svtools/source/misc/makefile.mk +++ b/svtools/source/misc/makefile.mk @@ -75,6 +75,8 @@ SLOFILES=\ $(SLO)$/transfer.obj \ $(SLO)$/transfer2.obj \ $(SLO)$/unitconv.obj \ + $(SLO)$/bindablecontrolhelper.obj \ + $(SLO)$/filterutils.obj \ $(SLO)$/wallitem.obj \ $(SLO)$/xwindowitem.obj diff --git a/toolkit/inc/toolkit/awt/vclxmenu.hxx b/toolkit/inc/toolkit/awt/vclxmenu.hxx index c675ad1d4bd9..b35331dc2a6f 100644 --- a/toolkit/inc/toolkit/awt/vclxmenu.hxx +++ b/toolkit/inc/toolkit/awt/vclxmenu.hxx @@ -45,6 +45,7 @@ class Menu; class MenuBar; class VclSimpleEvent; +class PopupMenu; DECLARE_LIST( PopupMenuRefList, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >* ) @@ -181,6 +182,7 @@ class TOOLKIT_DLLPUBLIC VCLXPopupMenu : public VCLXMenu { public: VCLXPopupMenu(); + VCLXPopupMenu( PopupMenu* pPopMenu ); }; #endif // _TOOLKIT_AWT_VCLXMENU_HXX_ diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx index fb110cb74391..c3e27123f8ed 100644 --- a/toolkit/inc/toolkit/awt/vclxwindows.hxx +++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx @@ -94,6 +94,7 @@ #include <vcl/pointr.hxx> #include <vcl/image.hxx> +#include <com/sun/star/document/XVbaMethodParameter.hpp> //liuchen 2009-6-22, add the support of input/output parameters to VBA Dialog_QueryClose event class Button; class CheckBox; class RadioButton; @@ -378,6 +379,7 @@ public: // class VCLXDialog // ---------------------------------------------------- class VCLXDialog : public ::com::sun::star::awt::XDialog2, + public ::com::sun::star::document::XVbaMethodParameter, //liuchen 2009-6-22, add the support of input/output parameters to VBA UserForm_QueryClose event public VCLXTopWindow { public: @@ -415,6 +417,10 @@ public: // ::com::sun::star::awt::XVclWindowPeer void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + //liuchen 2009-6-23, support Excel VBA UserForm_QueryClose event + // ::com::sun::star::document::XVBAMethodParameter + void SAL_CALL setVbaMethodParameter( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getVbaMethodParameter( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); }; // ---------------------------------------------------- diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx index 0c5731d3f923..4c89bcdec049 100644 --- a/toolkit/inc/toolkit/controls/dialogcontrol.hxx +++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx @@ -48,6 +48,8 @@ #include <cppuhelper/propshlp.hxx> #include <cppuhelper/basemutex.hxx> #include <list> +#include <map> +#include <com/sun/star/graphic/XGraphicObject.hpp> // ---------------------------------------------------- // class UnoControlDialogModel @@ -89,6 +91,8 @@ private: AllGroups maGroups; sal_Bool mbGroupsUpToDate; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj; + bool mbAdjustingGraphic; protected: ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); @@ -175,10 +179,20 @@ public: protected: void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel ); void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel ); + // ::cppu::OPropertySetHelper + void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor ); void implUpdateGroupStructure(); +private: + void AddRadioButtonToGroup ( + const ::com::sun::star::uno::Reference< XControlModel >& rControlModel, + const ::rtl::OUString& rPropertyName, + ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups, + ModelGroup*& rpCurrentGroup ); + void AddRadioButtonGroup ( + ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups ); }; // ---------------------------------------------------- diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx index 01ff047ee3de..fd3dbf87b093 100644 --- a/toolkit/inc/toolkit/controls/unocontrols.hxx +++ b/toolkit/inc/toolkit/controls/unocontrols.hxx @@ -223,7 +223,6 @@ private: bool mbAdjustingGraphic; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj; - ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ); protected: GraphicControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { } @@ -637,6 +636,44 @@ public: }; +class UnoMultiPageModel : public UnoControlModel +{ +protected: + ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoMultiPageModel(); + UnoMultiPageModel( const UnoMultiPageModel& rModel ) : UnoControlModel( rModel ) {;} + + UnoControlModel* Clone() const { return new UnoMultiPageModel( *this ); } + + // ::com::sun::star::io::XPersistObject + ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, UnoControlModel, szServiceName_UnoMultiPageModel ) + +}; +// ---------------------------------------------------- +// class UnoGroupBoxControl +// ---------------------------------------------------- +class UnoMultiPageControl : public UnoControlBase +{ +public: + UnoMultiPageControl(); + ::rtl::OUString GetComponentServiceName(); + + sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoControlBase, szServiceName_UnoMultiPageControl ) + +}; + // ---------------------------------------------------- // class UnoFixedTextControl // ---------------------------------------------------- diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index 837d283f4e8c..70f6c748942b 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -195,6 +195,7 @@ namespace rtl { #define BASEPROPERTY_GRID_SELECTIONMODE 144 #define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool #define BASEPROPERTY_REFERENCE_DEVICE 146 + #define BASEPROPERTY_HIGHCONTRASTMODE 147 #define BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND 148 #define BASEPROPERTY_GRID_HEADER_BACKGROUND 149 @@ -202,6 +203,8 @@ namespace rtl { #define BASEPROPERTY_GRID_ROW_BACKGROUND 151 #define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152 #define BASEPROPERTY_ITEM_SEPARATOR_POS 153 +#define BASEPROPERTY_GROUPNAME 154 // ::rtl::OUString +#define BASEPROPERTY_VBAFORM 155 // sal_Bool // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx index 2d1df79b733b..ee31fa729d05 100644 --- a/toolkit/inc/toolkit/helper/servicenames.hxx +++ b/toolkit/inc/toolkit/helper/servicenames.hxx @@ -37,6 +37,8 @@ extern const sal_Char __FAR_DATA szServiceName_PopupMenu[], szServiceName2_Popup extern const sal_Char __FAR_DATA szServiceName_MenuBar[], szServiceName2_MenuBar[]; extern const sal_Char __FAR_DATA szServiceName_Pointer[], szServiceName2_Pointer[]; extern const sal_Char __FAR_DATA szServiceName_UnoControlContainer[], szServiceName2_UnoControlContainer[]; +extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[], szServiceName2_UnoMultiPageControl[]; +extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[], szServiceName2_UnoMultiPageModel[]; extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[]; extern const sal_Char __FAR_DATA szServiceName_TabController[], szServiceName2_TabController[]; extern const sal_Char __FAR_DATA szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[]; 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"; diff --git a/unotools/inc/unotools/fltrcfg.hxx b/unotools/inc/unotools/fltrcfg.hxx index 890efebde071..02bd5f6cca79 100644 --- a/unotools/inc/unotools/fltrcfg.hxx +++ b/unotools/inc/unotools/fltrcfg.hxx @@ -48,6 +48,8 @@ public: void SetLoadWordBasicCode( sal_Bool bFlag ); sal_Bool IsLoadWordBasicCode() const; + void SetLoadWordBasicExecutable( sal_Bool bFlag ); + sal_Bool IsLoadWordBasicExecutable() const; void SetLoadWordBasicStorage( sal_Bool bFlag ); sal_Bool IsLoadWordBasicStorage() const; diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx index a93cc2d65687..2da1719b8db9 100644 --- a/unotools/source/config/fltrcfg.cxx +++ b/unotools/source/config/fltrcfg.cxx @@ -61,6 +61,7 @@ using namespace com::sun::star::uno; #define FILTERCFG_ENABLE_EXCEL_PREVIEW 0x40000 #define FILTERCFG_ENABLE_WORD_PREVIEW 0x80000 #define FILTERCFG_USE_ENHANCED_FIELDS 0x100000 +#define FILTERCFG_WORD_WBCTBL 0x200000 static SvtFilterOptions* pOptions=0; @@ -150,6 +151,52 @@ void SvtAppFilterOptions_Impl::Load() } // ----------------------------------------------------------------------- +class SvtWriterFilterOptions_Impl : public SvtAppFilterOptions_Impl +{ + sal_Bool bLoadExecutable; +public: + SvtWriterFilterOptions_Impl(const OUString& rRoot) : + SvtAppFilterOptions_Impl(rRoot), + bLoadExecutable(sal_False) + {} + virtual void Commit(); + void Load(); + + sal_Bool IsLoadExecutable() const {return bLoadExecutable;} + void SetLoadExecutable(sal_Bool bSet) + { + if(bSet != bLoadExecutable) + SetModified(); + bLoadExecutable = bSet; + } +}; + +void SvtWriterFilterOptions_Impl::Commit() +{ + SvtAppFilterOptions_Impl::Commit(); + + Sequence<OUString> aNames(1); + aNames[0] = C2U("Executable"); + Sequence<Any> aValues(1); + aValues[0] <<= bLoadExecutable; + + PutProperties(aNames, aValues); +} + +void SvtWriterFilterOptions_Impl::Load() +{ + SvtAppFilterOptions_Impl::Load(); + + Sequence<OUString> aNames(1); + aNames[0] = C2U("Executable"); + + Sequence<Any> aValues = GetProperties(aNames); + const Any* pValues = aValues.getConstArray(); + if(pValues[0].hasValue()) + bLoadExecutable = *(sal_Bool*)pValues[0].getValue(); +} + +// ----------------------------------------------------------------------- class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl { sal_Bool bLoadExecutable; @@ -201,7 +248,7 @@ void SvtCalcFilterOptions_Impl::Load() struct SvtFilterOptions_Impl { ULONG nFlags; - SvtAppFilterOptions_Impl aWriterCfg; + SvtWriterFilterOptions_Impl aWriterCfg; SvtCalcFilterOptions_Impl aCalcCfg; SvtAppFilterOptions_Impl aImpressCfg; @@ -246,6 +293,7 @@ void SvtFilterOptions_Impl::SetFlag( ULONG nFlag, BOOL bSet ) { case FILTERCFG_WORD_CODE: aWriterCfg.SetLoad(bSet);break; case FILTERCFG_WORD_STORAGE: aWriterCfg.SetSave(bSet);break; + case FILTERCFG_WORD_WBCTBL: aWriterCfg.SetLoadExecutable(bSet);break; case FILTERCFG_EXCEL_CODE: aCalcCfg.SetLoad(bSet);break; case FILTERCFG_EXCEL_STORAGE: aCalcCfg.SetSave(bSet);break; case FILTERCFG_EXCEL_EXECTBL: aCalcCfg.SetLoadExecutable(bSet);break; @@ -268,6 +316,7 @@ BOOL SvtFilterOptions_Impl::IsFlag( ULONG nFlag ) const { case FILTERCFG_WORD_CODE : bRet = aWriterCfg.IsLoad();break; case FILTERCFG_WORD_STORAGE : bRet = aWriterCfg.IsSave();break; + case FILTERCFG_WORD_WBCTBL : bRet = aWriterCfg.IsLoadExecutable();break; case FILTERCFG_EXCEL_CODE : bRet = aCalcCfg.IsLoad();break; case FILTERCFG_EXCEL_STORAGE : bRet = aCalcCfg.IsSave();break; case FILTERCFG_EXCEL_EXECTBL : bRet = aCalcCfg.IsLoadExecutable();break; @@ -410,6 +459,17 @@ BOOL SvtFilterOptions::IsLoadWordBasicCode() const return pImp->IsFlag( FILTERCFG_WORD_CODE ); } +void SvtFilterOptions::SetLoadWordBasicExecutable( BOOL bFlag ) +{ + pImp->SetFlag( FILTERCFG_WORD_WBCTBL, bFlag ); + SetModified(); +} + +BOOL SvtFilterOptions::IsLoadWordBasicExecutable() const +{ + return pImp->IsFlag( FILTERCFG_WORD_WBCTBL ); +} + void SvtFilterOptions::SetLoadWordBasicStorage( BOOL bFlag ) { pImp->SetFlag( FILTERCFG_WORD_STORAGE, bFlag ); diff --git a/vcl/inc/vcl/bitmap.hxx b/vcl/inc/vcl/bitmap.hxx index 7483f54014a4..5c167c7af77c 100644 --- a/vcl/inc/vcl/bitmap.hxx +++ b/vcl/inc/vcl/bitmap.hxx @@ -267,9 +267,9 @@ public: SAL_DLLPRIVATE void ImplSetImpBitmap( ImpBitmap* pImpBmp ); SAL_DLLPRIVATE void ImplAssignWithSize( const Bitmap& rBitmap ); - SAL_DLLPRIVATE static BOOL ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset ); + SAL_DLLPRIVATE static BOOL ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bMSOFormat=FALSE ); SAL_DLLPRIVATE static BOOL ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset ); - SAL_DLLPRIVATE static BOOL ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown ); + SAL_DLLPRIVATE static BOOL ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, BOOL bMSOFormat = FALSE ); SAL_DLLPRIVATE static BOOL ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, BOOL bQuad ); SAL_DLLPRIVATE static BOOL ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc, sal_Bool bTopDown ); SAL_DLLPRIVATE BOOL ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompressed ) const; @@ -764,7 +764,7 @@ public: public: - BOOL Read( SvStream& rIStm, BOOL bFileHeader = TRUE ); + BOOL Read( SvStream& rIStm, BOOL bFileHeader = TRUE, BOOL bMSOFormat = FALSE ); BOOL Write( SvStream& rOStm, BOOL bCompressed = TRUE, BOOL bFileHeader = TRUE ) const; friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Bitmap& rBitmap ); diff --git a/vcl/inc/vcl/bitmapex.hxx b/vcl/inc/vcl/bitmapex.hxx index c19e1a9cbc39..7ecb6310a203 100644 --- a/vcl/inc/vcl/bitmapex.hxx +++ b/vcl/inc/vcl/bitmapex.hxx @@ -395,6 +395,7 @@ public: friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ); friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx ); + static BitmapEx AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize); }; #endif // _SV_BITMAPEX_HXX diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx index 60fe97225b4b..9e7aa2f61cf9 100644 --- a/vcl/inc/vcl/dialog.hxx +++ b/vcl/inc/vcl/dialog.hxx @@ -53,6 +53,7 @@ private: BOOL mbOldSaveBack; BOOL mbInClose; BOOL mbModalMode; + sal_Int8 mnCancelClose; //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event SAL_DLLPRIVATE void ImplInitDialogData(); SAL_DLLPRIVATE void ImplInitSettings(); @@ -91,6 +92,9 @@ public: virtual short Execute(); BOOL IsInExecute() const { return mbInExecute; } + sal_Int8 GetCloseFlag() const { return mnCancelClose; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event + void SetCloseFlag( sal_Int8 nCancel ) { mnCancelClose = nCancel; } //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event + //////////////////////////////////////// // Dialog::Execute replacement API public: diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 5b2e8755e5c8..9a33885fde07 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -469,7 +469,10 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG ) mbSyntheticModify = TRUE; Modify(); mbSyntheticModify = FALSE; - Select(); + if (ImplGetWindowImpl() != NULL) //liuchen 2009-7-28, resolve the problem that soffice get crashed if in ComboBox_Change event a Worksheets("SheetX").Activate sentence needs to be executed + { + Select(); + } } return 0; diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx index 6da78c697525..1858150f2d41 100644 --- a/vcl/source/gdi/bitmap2.cxx +++ b/vcl/source/gdi/bitmap2.cxx @@ -46,6 +46,8 @@ #define DIBCOREHEADERSIZE ( 12UL ) #define DIBINFOHEADERSIZE ( sizeof( DIBInfoHeader ) ) +#define BITMAPINFOHEADER 0x28 + #define SETPIXEL4( pBuf, nX, cChar )( (pBuf)[ (nX) >> 1 ] |= ( (nX) & 1 ) ? ( cChar ): (cChar) << 4 ); // ---------------------- @@ -129,7 +131,7 @@ SvStream& operator<<( SvStream& rOStm, const Bitmap& rBitmap ) // ------------------------------------------------------------------ -BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader ) +BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader, BOOL bIsMSOFormat ) { const USHORT nOldFormat = rIStm.GetNumberFormatInt(); const ULONG nOldPos = rIStm.Tell(); @@ -144,7 +146,7 @@ BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader ) bRet = ImplReadDIB( rIStm, *this, nOffset ); } else - bRet = ImplReadDIB( rIStm, *this, nOffset ); + bRet = ImplReadDIB( rIStm, *this, nOffset, bIsMSOFormat ); if( !bRet ) { @@ -161,14 +163,14 @@ BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader ) // ------------------------------------------------------------------ -BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset ) +BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bIsMSOFormat ) { DIBInfoHeader aHeader; const ULONG nStmPos = rIStm.Tell(); BOOL bRet = FALSE; sal_Bool bTopDown = sal_False; - if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount ) + if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown, bIsMSOFormat ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount ) { const USHORT nBitCount( discretizeBitcount(aHeader.nBitCount) ); @@ -299,21 +301,37 @@ BOOL Bitmap::ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset ) // ------------------------------------------------------------------ -BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown ) +BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, sal_Bool bIsMSOFormat ) { // BITMAPINFOHEADER or BITMAPCOREHEADER rIStm >> rHeader.nSize; // BITMAPCOREHEADER + sal_Int16 nTmp16 = 0; + sal_uInt8 nTmp8 = 0; if ( rHeader.nSize == DIBCOREHEADERSIZE ) { - sal_Int16 nTmp16; rIStm >> nTmp16; rHeader.nWidth = nTmp16; rIStm >> nTmp16; rHeader.nHeight = nTmp16; rIStm >> rHeader.nPlanes; rIStm >> rHeader.nBitCount; } + else if ( bIsMSOFormat && ( rHeader.nSize == BITMAPINFOHEADER ) ) + { + rIStm >> nTmp16; rHeader.nWidth = nTmp16; + rIStm >> nTmp16; rHeader.nHeight = nTmp16; + rIStm >> nTmp8; rHeader.nPlanes = nTmp8; + rIStm >> nTmp8; rHeader.nBitCount = nTmp8; + rIStm >> nTmp16; rHeader.nSizeImage = nTmp16; + rIStm >> nTmp16; rHeader.nCompression = nTmp16; + if ( !rHeader.nSizeImage ) // uncompressed? + rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight; + rIStm >> rHeader.nXPelsPerMeter; + rIStm >> rHeader.nYPelsPerMeter; + rIStm >> rHeader.nColsUsed; + rIStm >> rHeader.nColsImportant; + } else { // unknown Header diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 38402af626c2..9ccf6d021d3a 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -45,6 +45,7 @@ #endif #include <vcl/svapp.hxx> #include <vcl/bmpacc.hxx> +#include <vcl/virdev.hxx> // ------------ // - BitmapEx - @@ -757,6 +758,61 @@ void BitmapEx::Draw( OutputDevice* pOutDev, pOutDev->DrawBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, *this ); } +BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize) +{ + Point aEmptyPoint(0,0); + sal_Int32 imgNewWidth = 0; + sal_Int32 imgNewHeight = 0; + double imgposX = 0; + double imgposY = 0; + BitmapEx aRet = aBitmap; + double imgOldWidth = aRet.GetSizePixel().Width(); + double imgOldHeight =aRet.GetSizePixel().Height(); + + Size aScaledSize; + if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize) + { + if (imgOldWidth >= imgOldHeight) + { + imgNewWidth = aStandardSize; + imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5); + imgposX = 0; + imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5; + } + else + { + imgNewHeight = aStandardSize; + imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5); + imgposY = 0; + imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5; + } + + aScaledSize = Size( imgNewWidth, imgNewHeight ); + aRet.Scale( aScaledSize, BMP_SCALE_INTERPOLATE ); + } + else + { + imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5; + imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5; + } + + Size aBmpSize = aRet.GetSizePixel(); + Size aStdSize( aStandardSize, aStandardSize ); + Rectangle aRect(aEmptyPoint, aStdSize ); + + VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 ); + aVirDevice.SetOutputSizePixel( aStdSize ); + aVirDevice.SetFillColor( COL_TRANSPARENT ); + aVirDevice.SetLineColor( COL_TRANSPARENT ); + + //draw a rect into virDevice + aVirDevice.DrawRect( aRect ); + Point aPointPixel( (long)imgposX, (long)imgposY ); + aVirDevice.DrawBitmapEx( aPointPixel, aRet ); + aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize ); + + return aRet; +} // ------------------------------------------------------------------ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 3b5585d3bc63..2518e2d63083 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -559,7 +559,18 @@ BOOL Dialog::Close() { ImplDelData aDelData; ImplAddDel( &aDelData ); + //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event + mnCancelClose = 0; ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE ); + // basic boolean ( and what the user might use in the event handler) can + // be ambiguous ( e.g. basic true = -1 ) + // test agains 0 ( false ) and assume anything else is true + // ( Note: ) this used to work ( something changes somewhere ) + if (mnCancelClose != 0) + { + return FALSE; + } + //liuchen 2009-7-22 if ( aDelData.IsDelete() ) return FALSE; ImplRemoveDel( &aDelData ); diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 334cdd2d0a64..902f9eec72b1 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -56,6 +56,8 @@ using namespace rtl; #define TB_SEP_SIZE 8 +ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType ); + // ----------------------------------------------------------------------- ImplToolBoxPrivateData::ImplToolBoxPrivateData() : |