ooo-build r14301 - in trunk: . patches/vba



Author: noelpwer
Date: Mon Oct 13 19:18:22 2008
New Revision: 14301
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14301&view=rev

Log:
2008-10-13  Noel Power  <noel power novell com>

        * patches/vba/vba-userform-geometry-tweak.diff: default imported
        userforms use 100th mm as units of measure, but this is not useable
        when saving to openoffice formats ( which display in MAP_APPFONT).
        Making the import aware of the VBA mode and setting the imported
        units as appropriate.


Modified:
   trunk/ChangeLog
   trunk/patches/vba/vba-userform-geometry-tweak.diff

Modified: trunk/patches/vba/vba-userform-geometry-tweak.diff
==============================================================================
--- trunk/patches/vba/vba-userform-geometry-tweak.diff	(original)
+++ trunk/patches/vba/vba-userform-geometry-tweak.diff	Mon Oct 13 19:18:22 2008
@@ -1,5 +1,5 @@
 diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
-index 12c8e0c..ad68518 100644
+index e89c22f..8d11a16 100644
 --- basctl/source/basicide/baside3.cxx
 +++ basctl/source/basicide/baside3.cxx
 @@ -82,6 +82,7 @@
@@ -26,33 +26,41 @@
  
  	// Undo einrichten
 diff --git basctl/source/dlged/dlgedobj.cxx basctl/source/dlged/dlgedobj.cxx
-index bed7bc3..9a521a3 100644
+index bed7bc3..ae7df5c 100644
 --- basctl/source/dlged/dlgedobj.cxx
 +++ basctl/source/dlged/dlgedobj.cxx
 @@ -56,6 +56,7 @@
  #include <com/sun/star/beans/XPropertySet.hpp>
  #include <com/sun/star/beans/PropertyAttribute.hpp>
  #include <com/sun/star/script/XScriptEventsSupplier.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
++#include <com/sun/star/script/XBasicLibraryInfo.hpp>
  #include <com/sun/star/container/XContainer.hpp>
  #include <com/sun/star/lang/XServiceInfo.hpp>
  #include <comphelper/processfactory.hxx>
-@@ -77,6 +78,14 @@ TYPEINIT1(DlgEdObj, SdrUnoObj);
+@@ -77,6 +78,22 @@ TYPEINIT1(DlgEdObj, SdrUnoObj);
  DBG_NAME(DlgEdObj);
  
  //----------------------------------------------------------------------------
 +MapMode lcl_getMapModeForForm( DlgEdForm* pForm )
 +{
 +	MapMode aMode( MAP_APPFONT ); //Default
-+	uno::Reference< script::XVBACompat > xVBA( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY );
-+	if ( xVBA.is() && xVBA->getVBACompatModeOn() )
-+		aMode = MapMode( MAP_100TH_MM );
++	try
++	{
++		uno::Reference< beans::XPropertySet > xProps( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY_THROW );
++		sal_Bool bVBAForm = sal_False;
++		xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBAForm;	
++		if ( bVBAForm )
++			aMode = MapMode( MAP_100TH_MM );
++	}
++	catch ( Exception& )
++	{
++	}
 +	return aMode;
 +}
  
  DlgEdObj::DlgEdObj()
  		  :SdrUnoObj(String(), sal_False)
-@@ -207,8 +216,9 @@ bool DlgEdObj::TransformSdrToControlCoor
+@@ -207,8 +224,9 @@ bool DlgEdObj::TransformSdrToControlCoor
  	}
      
      // convert pixel to logic units
@@ -64,7 +72,7 @@
  
      // set out parameters
      nXOut = aPos.Width();
-@@ -255,10 +265,10 @@ bool DlgEdObj::TransformSdrToFormCoordin
+@@ -255,10 +273,10 @@ bool DlgEdObj::TransformSdrToFormCoordin
  		aSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
  		aSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
  	}
@@ -78,7 +86,7 @@
  
      // set out parameters
      nXOut = aPos.Width();
-@@ -300,9 +310,10 @@ bool DlgEdObj::TransformControlToSdrCoor
+@@ -300,9 +318,10 @@ bool DlgEdObj::TransformControlToSdrCoor
      DBG_ASSERT( pDevice, "DlgEdObj::TransformControlToSdrCoordinates: missing default device!" );
      if ( !pDevice )
          return false;
@@ -92,7 +100,7 @@
  
      // add form position
      aPos.Width() += aFormPos.Width();
-@@ -346,14 +357,16 @@ bool DlgEdObj::TransformFormToSdrCoordin
+@@ -346,14 +365,16 @@ bool DlgEdObj::TransformFormToSdrCoordin
      DBG_ASSERT( pDevice, "DlgEdObj::TransformFormToSdrCoordinates: missing default device!" );
      if ( !pDevice )
          return false;
@@ -111,11 +119,50 @@
      // take window borders into account
      Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY );
      DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" );
+diff --git svx/inc/svxmsbas.hxx svx/inc/svxmsbas.hxx
+index f99247b..5e87fe6 100644
+--- svx/inc/svxmsbas.hxx
++++ svx/inc/svxmsbas.hxx
+@@ -99,7 +99,7 @@ private:
+ 						  const String &rSubStorageName,
+ 						  BOOL bAsComment, BOOL bStripped );
+ 	SVX_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName, 
+-		const String &rSubStorageName);
++		const String &rSubStorageName, BOOL bVBAMode );
+ 	SVX_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName,
+ 						   const String &rSubStorageName);
+ };
 diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
-index 0ba055d..b43042f 100644
+index 1075424..46986eb 100644
 --- svx/source/msfilter/msocximex.cxx
 +++ svx/source/msfilter/msocximex.cxx
-@@ -1107,15 +1107,24 @@ sal_Bool OCX_Control::Import(uno::Refere
+@@ -1075,6 +1075,9 @@ sal_Bool OCX_Control::Import(
+ sal_Bool OCX_Control::Import(uno::Reference<container::XNameContainer> &rDialog
+     )
+ {
++    uno::Reference<beans::XPropertySet > xDlgProps( rDialog, uno::UNO_QUERY);
++
++    
+     uno::Reference<lang::XMultiServiceFactory>
+         xFactory(rDialog, uno::UNO_QUERY);
+ 
+@@ -1087,11 +1090,15 @@ sal_Bool OCX_Control::Import(uno::Refere
+ 	if (!xModel.is())
+ 		return sal_False;
+ 
++    sal_Bool bVBA = sal_False;
+     /*  #147900# sometimes insertion of a control fails due to existing name,
+         do not break entire form import then... */
+     try
+     {
+         rDialog->insertByName(sName, uno::makeAny(xModel));
++        if ( xDlgProps.is() )
++            xDlgProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBA;
++
+     }
+     catch( uno::Exception& )
+     {
+@@ -1107,16 +1114,32 @@ sal_Bool OCX_Control::Import(uno::Refere
  
      if (!Import(xPropSet))
          return sal_False;
@@ -123,93 +170,141 @@
 +    
      uno::Any aTmp;
 -    aTmp <<= sal_Int32((mnLeft * 2) / 100);
-+    sal_Int32 nFactor = 3528; 
-+    //aTmp <<= sal_Int32(mnLeft * 100 / 3528 ); // points
-+    aTmp <<= sal_Int32(mnLeft); // 100thmm
-+    OSL_TRACE("%s raw %d Left points %d", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr(), mnLeft, sal_Int32(mnLeft * 100 / 3528 ) );
-     xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
+-    xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
 -    aTmp <<= sal_Int32((mnTop * 2) / 100);
-+    //aTmp <<= sal_Int32(mnTop * 100  / 3528 ); // points
-+    aTmp <<= sal_Int32(mnTop); //100th mm
-+    OSL_TRACE("%s raw %d Top points %d", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr(), mnTop, sal_Int32(mnTop * 100 / 3528 ) );
-     xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
+-    xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
 -    aTmp <<= sal_Int32((nWidth * 2) / 100);
-+    //aTmp <<= sal_Int32(nWidth * 100 / 3528 ); // points
-+    aTmp <<= sal_Int32(nWidth); // 100thmm
-+    OSL_TRACE("%s raw %d Width points %d", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr(), nWidth, sal_Int32(nWidth * 100 / 3528 ) );
-     xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
+-    xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
 -    aTmp <<= sal_Int32((nHeight * 2) / 100);
-+    //aTmp <<= sal_Int32(nHeight * 100 / 3528 ); // points
-+    aTmp <<= sal_Int32(nHeight); //100th mm
-+    OSL_TRACE("%s raw %d Height points %d", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr(), nHeight, sal_Int32(nHeight * 100 / 3528 ) );
-     xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
+-    xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
++    sal_Int32 nFactor = 3528; 
++
++    if ( !bVBA  )
++    {
++        aTmp <<= sal_Int32((mnLeft * 2) / 100);
++        xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
++        aTmp <<= sal_Int32((mnTop * 2) / 100);
++        xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
++        aTmp <<= sal_Int32((nWidth * 2) / 100);
++        xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
++        aTmp <<= sal_Int32((nHeight * 2) / 100);
++        xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
++    }
++    else
++    {
++        aTmp <<= sal_Int32(mnLeft); // 100thmm
++        xPropSet->setPropertyValue(WW8_ASCII2STR("PositionX"), aTmp);
++        aTmp <<= sal_Int32(mnTop); //100th mm
++        xPropSet->setPropertyValue(WW8_ASCII2STR("PositionY"), aTmp);
++        aTmp <<= sal_Int32(nWidth); // 100thmm
++        xPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
++        aTmp <<= sal_Int32(nHeight); //100th mm
++        xPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
++    }
      if ( msToolTip.Len() > 0 )
      {
-@@ -4330,10 +4339,12 @@ sal_Bool OCX_UserForm::Import(
+ 	uno::Any aTmp(&msToolTip,getCppuType((OUString *)0));
+@@ -4321,6 +4344,8 @@ sal_Bool OCX_UserForm::Import(
+ {
+     uno::Reference<beans::XPropertySet>
+         xDialogPropSet(mxParent, uno::UNO_QUERY);
++    if ( !xDialogPropSet.is() )
++        return sal_False;
+     uno::Any aTmp(&sName,getCppuType((OUString *)0));
+     xDialogPropSet->setPropertyValue(
+         OUString(RTL_CONSTASCII_USTRINGPARAM("Name")), aTmp);
+@@ -4328,11 +4353,32 @@ sal_Bool OCX_UserForm::Import(
          OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), aTmp);
      aTmp <<= ImportColor(mnBackColor);
  	xDialogPropSet->setPropertyValue( WW8_ASCII2STR("BackgroundColor"), aTmp);
--
--    aTmp <<= sal_Int32((nWidth * 2) / 100);
++    sal_Bool bVBA = sal_False;
++    // Ok we are importing xls but maybe we aren't in VBA mode
++    // if we are not in VBA mode then we should import sizes etc. ( as before )
++    try
++    {
++        xDialogPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBA;
++    }
++    catch( uno::Exception& e )
++    {
++    }
 +    sal_Int32 nFactor( 3528 );
-+    //aTmp <<= sal_Int32(( ( nWidth + 160 ) * 100 / 3528 )); // points
-+    aTmp <<= sal_Int32( nWidth + 160 ); // 100thmm
-     xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
++    if ( !bVBA )
++    {
++        aTmp <<= sal_Int32((nWidth * 2) / 100); 
++        xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
++        aTmp <<= sal_Int32((nHeight * 2) / 100); 
++        xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
++    }
++    else
++    {
++        aTmp <<= sal_Int32( nWidth + 160 ); // 100thmm
++        xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
++        aTmp <<= sal_Int32(nHeight + 662 - 714); //100th mm
++        xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
++    }
+ 
+-    aTmp <<= sal_Int32((nWidth * 2) / 100);
+-    xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Width"), aTmp);
 -    aTmp <<= sal_Int32((nHeight * 2) / 100);
-+    //aTmp <<= sal_Int32(((nHeight + 662 - 714) * 100 / 3528 ) ); // points
-+    aTmp <<= sal_Int32(nHeight + 662 - 714); //100th mm
-     xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
+-    xDialogPropSet->setPropertyValue(WW8_ASCII2STR("Height"), aTmp);
  
      uno::Reference<beans::XPropertySet> xPropSet( mxParent, uno::UNO_QUERY );
-diff --git toolkit/inc/toolkit/controls/dialogcontrol.hxx toolkit/inc/toolkit/controls/dialogcontrol.hxx
-index 1301975..f3aed44 100644
---- toolkit/inc/toolkit/controls/dialogcontrol.hxx
-+++ toolkit/inc/toolkit/controls/dialogcontrol.hxx
-@@ -41,6 +41,8 @@
- #include <com/sun/star/beans/XPropertyChangeListener.hpp>
- #include <com/sun/star/awt/XDialog.hpp>
- #include <com/sun/star/resource/XStringResourceResolver.hpp>
-+#include <com/sun/star/script/XVBACompat.hpp>
-+#include <cppuhelper/implbase7.hxx>
- #include <cppuhelper/implbase6.hxx>
- #include <cppuhelper/implbase5.hxx>
- #include <toolkit/helper/listenermultiplexer.hxx>
-@@ -57,12 +59,13 @@
- //	class UnoControlDialogModel
- //	----------------------------------------------------
- typedef UnoControlModel		UnoControlDialogModel_Base;
--typedef ::cppu::ImplHelper6	<	::com::sun::star::lang::XMultiServiceFactory
-+typedef ::cppu::ImplHelper7	<	::com::sun::star::lang::XMultiServiceFactory
- 							,	::com::sun::star::container::XContainer
- 							,	::com::sun::star::container::XNameContainer
- 							,	::com::sun::star::awt::XTabControllerModel
- 							,	::com::sun::star::util::XChangesNotifier
- 							,	::com::sun::star::beans::XPropertyChangeListener
-+							,	::com::sun::star::script::XVBACompat
- 							>	UnoControlDialogModel_IBase;
- 
- class UnoControlDialogModel :	public UnoControlDialogModel_IBase
-@@ -173,6 +176,10 @@ public:
-     using cppu::OPropertySetHelper::disposing;
-     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& evt ) throw (::com::sun::star::uno::RuntimeException);
- 
-+	// XVBACompat
-+    virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
-+    virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
-+
- 	// XServiceInfo
- 	DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel,UnoControlDialogModel_Base, szServiceName2_UnoControlDialogModel )
+     OCX_ContainerControl::Import( xPropSet );
+diff --git svx/source/msfilter/svxmsbas.cxx svx/source/msfilter/svxmsbas.cxx
+index b00e19c..3b2feb0 100644
+--- svx/source/msfilter/svxmsbas.cxx
++++ svx/source/msfilter/svxmsbas.cxx
+@@ -89,7 +89,7 @@ int SvxImportMSVBasic::Import( const Str
+ 		nRet |= 1;
+ 
+     if (bImport)
+-        ImportForms_Impl(rStorageName, rSubStorageName);
++        ImportForms_Impl(rStorageName, rSubStorageName, !bAsComment);
+ 
+ 	if( bCopy && CopyStorage_Impl( rStorageName, rSubStorageName ))
+ 		nRet |= 2;
+@@ -98,7 +98,7 @@ int SvxImportMSVBasic::Import( const Str
+ }
  
-@@ -191,6 +198,7 @@ private:
-             ModelGroup*& rpCurrentGroup );
-     void AddRadioButtonGroup (
-             ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups );
-+    sal_Bool mbVBAMode;
- };
+ bool SvxImportMSVBasic::ImportForms_Impl(const String& rStorageName,
+-    const String& rSubStorageName)
++    const String& rSubStorageName, BOOL bVBAMode )
+ {
+     SvStorageRef xVBAStg(xRoot->OpenSotStorage(rStorageName,
+         STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYALL));
+@@ -182,7 +182,17 @@ bool SvxImportMSVBasic::ImportForms_Impl
+                     xSF->createInstance(
+                        OUString(RTL_CONSTASCII_USTRINGPARAM(
+                            "com.sun.star.awt.UnoControlDialogModel"))), uno::UNO_QUERY);
+-
++                // #FIXME HACK - mark the Model with the VBA mode
++                // In vba mode the imported userform uses 100th mm as units
++                // or geometry 
++                // In non vba mode MAP_APPFONT is used ( same as normal basic
++                // dialogs
++                if ( bVBAMode )
++                {
++                    Reference<XPropertySet> xDlgProps(xDialog, UNO_QUERY); 
++                    if ( xDlgProps.is() )
++                        xDlgProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ), uno::makeAny( sal_True ) );
++                }
+                 OCX_UserForm aForm(xVBAStg, *aIter, *aIter, xDialog, xSF );
+                 aForm.pDocSh = &rDocSh;
+                 sal_Bool bOk = aForm.Read(xTypes);
+diff --git toolkit/inc/toolkit/helper/property.hxx toolkit/inc/toolkit/helper/property.hxx
+index db61c94..1abcda6 100644
+--- toolkit/inc/toolkit/helper/property.hxx
++++ toolkit/inc/toolkit/helper/property.hxx
+@@ -190,6 +190,7 @@ namespace rtl {
+ #define BASEPROPERTY_CUSTOMUNITTEXT                 136  // ::rtl::OUString
+ #define BASEPROPERTY_ENABLEVISIBLE                  137  // sal_Bool
+ #define BASEPROPERTY_GROUPNAME                      138  // ::rtl::OUString
++#define BASEPROPERTY_VBAFORM                      139  // sal_Bool
  
- //	----------------------------------------------------
+ // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
+ #define BASEPROPERTY_FONTDESCRIPTORPART_START			1000
 diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
-index 7e717ae..6205d0a 100644
+index be06bbb..f976562 100644
 --- toolkit/source/controls/dialogcontrol.cxx
 +++ toolkit/source/controls/dialogcontrol.cxx
 @@ -80,6 +80,7 @@ using namespace ::com::sun::star::lang;
@@ -220,44 +315,16 @@
  using namespace toolkit;
  
  #define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
-@@ -265,7 +266,7 @@ static const ::rtl::OUString& getStepPro
- UnoControlDialogModel::UnoControlDialogModel()
- 	:maContainerListeners( *this )
- 	,maChangeListeners ( GetMutex() )
--	,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
-+	,mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false ), mbVBAMode( sal_False )
- {
- 	ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
- //	ImplRegisterProperty( BASEPROPERTY_BORDER );
-@@ -294,7 +295,7 @@ UnoControlDialogModel::UnoControlDialogM
-     , UnoControlDialogModel_Base( rModel )
- 	, maContainerListeners( *this )
- 	, maChangeListeners ( GetMutex() )
--	, mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false )
-+	, mbGroupsUpToDate( sal_False ), mbAdjustingGraphic( false ), mbVBAMode( rModel.mbVBAMode )
- {
- }
- 
-@@ -310,6 +311,18 @@ Any UnoControlDialogModel::queryAggregat
- 	return (aRet.hasValue() ? aRet : UnoControlDialogModel_Base::queryAggregation( rType ));
+@@ -289,6 +290,8 @@ UnoControlDialogModel::UnoControlDialogM
+ 	aBool <<= (sal_Bool) sal_True;
+ 	ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
+ 	ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
++	aBool <<= (sal_Bool) sal_False;
++	ImplRegisterProperty( BASEPROPERTY_VBAFORM, aBool );
  }
  
-+::sal_Bool SAL_CALL 
-+UnoControlDialogModel::getVBACompatModeOn() throw (RuntimeException)
-+{
-+	return mbVBAMode;
-+}
-+
-+void SAL_CALL 
-+UnoControlDialogModel::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException) 
-+{
-+	mbVBAMode = _vbacompatmodeon;
-+}
-+
- // XTypeProvider
- IMPL_IMPLEMENTATION_ID( UnoControlDialogModel )
- Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
-@@ -1439,17 +1452,21 @@ void UnoDialogControl::ImplSetPosSize( R
+ UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
+@@ -1475,17 +1478,32 @@ void UnoDialogControl::ImplSetPosSize( R
  	xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
  	xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
  
@@ -265,8 +332,19 @@
 +	// Currentley we are simply using MAP_APPFONT ( for normal Dialogs )
 +	// and MAP_100TH_MM for imported Userforms
 +	MapMode aMode( MAP_APPFONT );
-+	Reference< script::XVBACompat > xVBA( getModel(), UNO_QUERY );
-+	if ( xVBA.is() && xVBA->getVBACompatModeOn() )
++	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!" );
@@ -283,8 +361,22 @@
  		nWidth = aTmp.Width();
  		nHeight = aTmp.Height();
  	}
+diff --git toolkit/source/helper/property.cxx toolkit/source/helper/property.cxx
+index a7fc25b..8d1ee74 100644
+--- toolkit/source/helper/property.cxx
++++ toolkit/source/helper/property.cxx
+@@ -271,7 +271,8 @@ ImplPropertyInfo* ImplGetPropertyInfos( 
+ 			DECL_PROP_2		( "InvokesStopNodeEditing",	TREE_INVOKESSTOPNODEEDITING, sal_Bool,		BOUND, MAYBEDEFAULT ),
+             DECL_PROP_2     ( "DialogSourceURL",        DIALOGSOURCEURL,        ::rtl::OUString,    BOUND, MAYBEDEFAULT ),
+             DECL_PROP_2     ( "URL",                    URL,                    ::rtl::OUString,    BOUND, MAYBEDEFAULT ),
+-            DECL_PROP_2     ( "EnableVisible",          ENABLEVISIBLE,          sal_Bool,    BOUND, MAYBEDEFAULT )
++            DECL_PROP_2     ( "EnableVisible",          ENABLEVISIBLE,          sal_Bool,    BOUND, MAYBEDEFAULT ),
++            DECL_PROP_2     ( "VBAForm",          VBAFORM,          sal_Bool,    BOUND, MAYBEDEFAULT ),
+             };
+ 			pPropertyInfos = aImplPropertyInfos;
+ 			nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
 diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
-index 9abe014..5548016 100644
+index 9abe014..816731a 100644
 --- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
 +++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
 @@ -61,6 +61,7 @@
@@ -302,9 +394,9 @@
 +    DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument );
 +    uno::Reference< script::XVBACompat > xVBAModeSource( pImport->getScriptLibraryContainer(), uno::UNO_QUERY );
 +    
-+    uno::Reference< script::XVBACompat > xVBAModeDest( xDialogModel, uno::UNO_QUERY );
-+    if ( xVBAModeSource.is() && xVBAModeDest.is() )
-+        xVBAModeDest->setVBACompatModeOn( xVBAModeSource->getVBACompatModeOn() );
++    uno::Reference< beans::XPropertySet > xDlgProps( xDialogModel, uno::UNO_QUERY );
++    if ( xVBAModeSource.is() && xDlgProps.is() && xVBAModeSource->getVBACompatModeOn() )
++        xDlgProps->setPropertyValue( OUSTR("VBAForm"), uno::makeAny( sal_True ) );
      return ::xmlscript::createDocumentHandler(
 -        static_cast< xml::input::XRoot * >(
 -            new DialogImport( xContext, xDialogModel, xDocument ) ) );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]