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



Author: noelpwer
Date: Fri Sep 12 08:46:38 2008
New Revision: 13881
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13881&view=rev

Log:

2008-09-12  Noel Power  <noel power novell com>

        * patches/dev300/apply: added fix for userform geometry
        * patches/vba/vba-userform-geometry-tweak.diff: make sure 
        css.awt.DialogControl ( and basic IDE ) uses MAP_100TH_MM )
        when dealing with imported Userforms



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

Added: trunk/patches/vba/vba-userform-geometry-tweak.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/vba-userform-geometry-tweak.diff	Fri Sep 12 08:46:38 2008
@@ -0,0 +1,314 @@
+diff --git basctl/source/basicide/baside3.cxx basctl/source/basicide/baside3.cxx
+index 12c8e0c..ad68518 100644
+--- basctl/source/basicide/baside3.cxx
++++ basctl/source/basicide/baside3.cxx
+@@ -82,6 +82,7 @@
+ #include <com/sun/star/resource/XStringResourceResolver.hpp>
+ #include <com/sun/star/resource/StringResourceWithLocation.hpp>
+ #include <com/sun/star/task/XInteractionHandler.hpp>
++#include <com/sun/star/script/XVBACompat.hpp>
+ 
+ using namespace comphelper;
+ using namespace	::com::sun::star;
+@@ -114,6 +115,14 @@ DialogWindow::DialogWindow( Window* pPar
+ 
+ 	pEditor = new DlgEditor( rDocument.getDocument() );
+ 	pEditor->SetWindow( this );
++	// set vba mode on DialogModel ( allows it to work in 100thmm instead of MAP_APPFONT )
++	if ( rDocument.getDocument().is() )
++	{
++		uno::Reference< script::XVBACompat > xDocVBAMode( rDocument.getLibraryContainer( E_SCRIPTS ), uno::UNO_QUERY );
++		uno::Reference< script::XVBACompat > xDialogModelVBAMode( xDialogModel, uno::UNO_QUERY );
++		if ( xDocVBAMode.is()  &&  xDialogModelVBAMode.is() )
++			xDialogModelVBAMode->setVBACompatModeOn( xDocVBAMode->getVBACompatModeOn() );
++	}
+ 	pEditor->SetDialog( xDialogModel );
+ 
+ 	// Undo einrichten
+diff --git basctl/source/dlged/dlgedobj.cxx basctl/source/dlged/dlgedobj.cxx
+index bed7bc3..9a521a3 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/container/XContainer.hpp>
+ #include <com/sun/star/lang/XServiceInfo.hpp>
+ #include <comphelper/processfactory.hxx>
+@@ -77,6 +78,14 @@ 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 );
++	return aMode;
++}
+ 
+ DlgEdObj::DlgEdObj()
+ 		  :SdrUnoObj(String(), sal_False)
+@@ -207,8 +216,9 @@ bool DlgEdObj::TransformSdrToControlCoor
+ 	}
+     
+     // convert pixel to logic units
+-    aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
+-    aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
++    MapMode aConvMode = lcl_getMapModeForForm( pForm );
++    aPos = pDevice->PixelToLogic( aPos, aConvMode );
++    aSize = pDevice->PixelToLogic( aSize, aConvMode );
+ 
+     // set out parameters
+     nXOut = aPos.Width();
+@@ -255,10 +265,10 @@ bool DlgEdObj::TransformSdrToFormCoordin
+ 		aSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
+ 		aSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
+ 	}
+-
++    MapMode aConvMode = lcl_getMapModeForForm( pForm );
+     // convert pixel to logic units
+-    aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
+-    aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
++    aPos = pDevice->PixelToLogic( aPos, aConvMode );
++    aSize = pDevice->PixelToLogic( aSize, aConvMode );
+ 
+     // set out parameters
+     nXOut = aPos.Width();
+@@ -300,9 +310,10 @@ bool DlgEdObj::TransformControlToSdrCoor
+     DBG_ASSERT( pDevice, "DlgEdObj::TransformControlToSdrCoordinates: missing default device!" );
+     if ( !pDevice )
+         return false;
+-    aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
+-    aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
+-    aFormPos = pDevice->LogicToPixel( aFormPos, MapMode( MAP_APPFONT ) );
++    MapMode aConvMode = lcl_getMapModeForForm( pForm );
++    aPos = pDevice->LogicToPixel( aPos, aConvMode );
++    aSize = pDevice->LogicToPixel( aSize, aConvMode );
++    aFormPos = pDevice->LogicToPixel( aFormPos, aConvMode );
+ 
+     // add form position
+     aPos.Width() += aFormPos.Width();
+@@ -346,14 +357,16 @@ bool DlgEdObj::TransformFormToSdrCoordin
+     DBG_ASSERT( pDevice, "DlgEdObj::TransformFormToSdrCoordinates: missing default device!" );
+     if ( !pDevice )
+         return false;
+-    aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
+-    aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
+ 
+     // take window borders into account
+     DlgEdForm* pForm = NULL;
+     if ( !lcl_getDlgEdForm( this, pForm ) )
+         return false;
+ 
++    MapMode aConvMode = lcl_getMapModeForForm( pForm );
++    aPos = pDevice->LogicToPixel( aPos, aConvMode );
++    aSize = pDevice->LogicToPixel( aSize, aConvMode );
++
+     // 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/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx
+index 0ba055d..b43042f 100644
+--- svx/source/msfilter/msocximex.cxx
++++ svx/source/msfilter/msocximex.cxx
+@@ -1107,15 +1107,24 @@ sal_Bool OCX_Control::Import(uno::Refere
+ 
+     if (!Import(xPropSet))
+         return sal_False;
+-
++    
+     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);
+-    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);
+-    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);
+-    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);
+     if ( msToolTip.Len() > 0 )
+     {
+@@ -4330,10 +4339,12 @@ 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_Int32 nFactor( 3528 );
++    //aTmp <<= sal_Int32(( ( nWidth + 160 ) * 100 / 3528 )); // points
++    aTmp <<= sal_Int32( nWidth + 160 ); // 100thmm
+     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);
+ 
+     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 )
+ 
+@@ -191,6 +198,7 @@ private:
+             ModelGroup*& rpCurrentGroup );
+     void AddRadioButtonGroup (
+             ::std::map< ::rtl::OUString, ModelGroup >& pNamedGroups );
++    sal_Bool mbVBAMode;
+ };
+ 
+ //	----------------------------------------------------
+diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
+index 7e717ae..6205d0a 100644
+--- toolkit/source/controls/dialogcontrol.cxx
++++ toolkit/source/controls/dialogcontrol.cxx
+@@ -80,6 +80,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" ))
+@@ -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 ));
+ }
+ 
++::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
+ 	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 );
++	Reference< script::XVBACompat > xVBA( getModel(), UNO_QUERY );
++	if ( xVBA.is() && xVBA->getVBACompatModeOn() )
++		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();
+ 	}
+diff --git xmlscript/source/xmldlg_imexp/xmldlg_import.cxx xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+index 9abe014..5548016 100644
+--- xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
++++ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+@@ -61,6 +61,7 @@
+ #include <com/sun/star/view/SelectionType.hpp>
+ #include <com/sun/star/document/XStorageBasedDocument.hpp>
+ #include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
++#include <com/sun/star/script/XVBACompat.hpp>
+ 
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+@@ -1906,9 +1907,14 @@ Reference< xml::sax::XDocumentHandler > 
+     Reference< XModel > const & xDocument )
+     SAL_THROW( (Exception) )
+ {
++    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() );
+     return ::xmlscript::createDocumentHandler(
+-        static_cast< xml::input::XRoot * >(
+-            new DialogImport( xContext, xDialogModel, xDocument ) ) );
++        static_cast< xml::input::XRoot * >( pImport ) );
+ }
+ 
+ }



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