[ooo-build-commit] .: patches/vba

Noel Power noelp at kemper.freedesktop.org
Tue Jul 6 06:21:28 PDT 2010


 patches/vba/cws-vbasupportdev300_m83.diff         |   15 
 patches/vba/oox-projectname-oobuild-specifix.diff |  110 +++++
 patches/vba/vba-containercontrol-extra.diff       |  434 ----------------------
 3 files changed, 116 insertions(+), 443 deletions(-)

New commits:
commit da79dbb284215dcab255394b79ea50ca5ea38b9a
Author: Noel Power <noel.power at novell.com>
Date:   Tue Jul 6 14:20:21 2010 +0100

    correct commit of wrong file
    
    * patches/vba/cws-vbasupportdev300_m83.diff: clean up view logic
    * patches/vba/oox-projectname-oobuild-specifix.diff: add correct file
    * patches/vba/vba-containercontrol-extra.diff:  remove wrong file

diff --git a/patches/vba/cws-vbasupportdev300_m83.diff b/patches/vba/cws-vbasupportdev300_m83.diff
index c456c3e..2119a23 100644
--- a/patches/vba/cws-vbasupportdev300_m83.diff
+++ b/patches/vba/cws-vbasupportdev300_m83.diff
@@ -28597,7 +28597,7 @@ index 061e3e4..2b31aa4 100644
  
  namespace
  {
-@@ -1419,10 +1423,15 @@ void ScTabView::MarkRange( const ScRange& rRange, BOOL bSetCursor, BOOL bContinu
+@@ -1419,10 +1423,12 @@ void ScTabView::MarkRange( const ScRange& rRange, BOOL bSetCursor, BOOL bContinu
      {
          SCCOL nAlignX = rRange.aStart.Col();
          SCROW nAlignY = rRange.aStart.Row();
@@ -28605,15 +28605,12 @@ index 061e3e4..2b31aa4 100644
 -            nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
 -        if ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW )
 -            nAlignY = aViewData.GetPosY(WhichV(aViewData.GetActivePart()));
-+		bool bCol = ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL );
++		bool bCol = ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == MAXCOL ) && !aViewData.GetDocument()->IsInVBAMode();
 +		bool bRow = ( rRange.aStart.Row() == 0 && rRange.aEnd.Row() == MAXROW );
-+		if ( !bCol && !bRow )
-+		{
-+			if ( bCol ) 
-+				nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
-+			if ( bRow )
-+				nAlignY = aViewData.GetPosY(WhichV(aViewData.GetActivePart()));
-+		}
++		if ( bCol ) 
++			nAlignX = aViewData.GetPosX(WhichH(aViewData.GetActivePart()));
++		if ( bRow )
++			nAlignY = aViewData.GetPosY(WhichV(aViewData.GetActivePart()));
          AlignToCursor( nAlignX, nAlignY, SC_FOLLOW_JUMP );
      }
      InitBlockMode( rRange.aStart.Col(), rRange.aStart.Row(), nTab );
diff --git a/patches/vba/oox-projectname-oobuild-specifix.diff b/patches/vba/oox-projectname-oobuild-specifix.diff
new file mode 100644
index 0000000..b22934c
--- /dev/null
+++ b/patches/vba/oox-projectname-oobuild-specifix.diff
@@ -0,0 +1,110 @@
+diff --git sc/source/core/tool/interpr4.cxx sc/source/core/tool/interpr4.cxx
+index 35177aa..ca045f0 100644
+--- sc/source/core/tool/interpr4.cxx
++++ sc/source/core/tool/interpr4.cxx
+@@ -50,6 +50,7 @@
+ 
+ #include <com/sun/star/table/XCellRange.hpp>
+ #include <com/sun/star/sheet/XSheetCellRange.hpp>
++#include <com/sun/star/script/XVBACompat.hpp>
+ #include <comphelper/processfactory.hxx>
+ 
+ #include "interpre.hxx"
+@@ -2706,8 +2707,14 @@ uno::Any lcl_getSheetModule( const uno::Reference<table::XCellRange>& xCellRange
+     if ( pBasMgr && pBasMgr->GetName().Len() )
+     {
+         String sProj = String( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+-        if ( pDok->GetDocumentShell()->GetBasicManager()->GetName().Len() )
+-            sProj = pDok->GetDocumentShell()->GetBasicManager()->GetName();
++        try
++        {
++            uno::Reference< beans::XPropertySet > xProps( pDok->GetDocumentShell()->GetModel(), uno::UNO_QUERY_THROW );
++            uno::Reference< script::XVBACompat > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
++            sProj = xVBAMode->getProjectName();
++        }
++        catch( uno::Exception& ){}
++
+         StarBASIC* pBasic = pDok->GetDocumentShell()->GetBasicManager()->GetLib( sProj );
+         if ( pBasic )
+         {
+diff --git sc/source/ui/docshell/macromgr.cxx sc/source/ui/docshell/macromgr.cxx
+index 97623f3..5eb823a 100644
+--- sc/source/ui/docshell/macromgr.cxx
++++ sc/source/ui/docshell/macromgr.cxx
+@@ -41,6 +41,7 @@
+ #include "sfx2/objsh.hxx"
+ #include "cell.hxx"
+ #include <com/sun/star/container/XContainer.hpp>
++#include <com/sun/star/script/XVBACompat.hpp>
+ 
+ #include <list>
+ 
+@@ -154,8 +155,16 @@ void ScMacroManager::InitUserFuncData()
+ 
+     Reference< container::XContainer > xModuleContainer;
+     SfxObjectShell* pShell = mpDoc->GetDocumentShell();
+-    if ( pShell && pShell->GetBasicManager()->GetName().Len() > 0 )
+-        sProjectName = pShell->GetBasicManager()->GetName();
++    if ( pShell )
++    { 
++        try
++        {
++            uno::Reference< beans::XPropertySet > xProps( pShell->GetModel(), uno::UNO_QUERY_THROW );
++            uno::Reference< script::XVBACompat > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
++            sProjectName = xVBAMode->getProjectName(); 
++        }
++        catch( uno::Exception& ) {}
++    }
+     try
+     { 
+         Reference< script::XLibraryContainer > xLibraries( pShell->GetBasicContainer(), uno::UNO_QUERY_THROW );
+diff --git sw/source/core/unocore/unocoll.cxx sw/source/core/unocore/unocoll.cxx
+index 07cb0f6..ae19ad0 100644
+--- sw/source/core/unocore/unocoll.cxx
++++ sw/source/core/unocore/unocoll.cxx
+@@ -86,6 +86,7 @@
+ #include <com/sun/star/script/ModuleType.hpp>
+ #include <com/sun/star/script/ScriptEventDescriptor.hpp>
+ #include <com/sun/star/script/XVBAModuleInfo.hpp>
++#include <com/sun/star/script/XVBACompat.hpp>
+ #include <vbahelper/vbaaccesshelper.hxx>
+ #include <basic/basmgr.hxx>
+ #include <comphelper/processfactory.hxx>
+@@ -115,8 +116,9 @@ public:
+                 uno::Reference< beans::XPropertySet > xProps( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
+                 uno::Reference< container::XNameAccess > xLibContainer( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
+ 		rtl::OUString sProjectName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ) );
+-                if ( mpDocShell->GetBasicManager()->GetName().Len() )
+-                    sProjectName =  mpDocShell->GetBasicManager()->GetName();
++                uno::Reference< script::XVBACompat > xVBAMode( xLibContainer, uno::UNO_QUERY );
++                if ( xVBAMode.is() ) 
++                    sProjectName =  xVBAMode->getProjectName();
+     
+                 uno::Reference< container::XNameAccess > xLib( xLibContainer->getByName( sProjectName ), uno::UNO_QUERY_THROW );
+                 uno::Sequence< rtl::OUString > sModuleNames = xLib->getElementNames();
+diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
+index c02569d..e9c6f23 100644
+--- vbahelper/source/vbahelper/vbahelper.cxx
++++ vbahelper/source/vbahelper/vbahelper.cxx
+@@ -33,6 +33,7 @@
+ #include <com/sun/star/frame/XController.hpp>
+ #include <com/sun/star/frame/XNotifyingDispatch.hpp>
+ #include <com/sun/star/script/XDefaultProperty.hpp>
++#include <com/sun/star/script/XVBACompat.hpp>
+ #include <com/sun/star/uno/XComponentContext.hpp>
+ #include <com/sun/star/lang/XMultiComponentFactory.hpp>
+ #include <com/sun/star/beans/XPropertySet.hpp>
+@@ -1271,6 +1272,13 @@ UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComp
+             if ( pShell )
+             {
+                 rtl::OUString sProj( RTL_CONSTASCII_USTRINGPARAM("Standard") );
++                try
++                {
++                    uno::Reference< beans::XPropertySet > xProps( pShell->GetModel(), uno::UNO_QUERY_THROW );
++                    uno::Reference< script::XVBACompat > xVBAMode( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY_THROW );
++                    sProj = xVBAMode->getProjectName();
++                }
++                catch( uno::Exception& ){}
+                 BasicManager* pBasMgr = pShell->GetBasicManager();
+                 if ( pBasMgr && pBasMgr->GetName().Len() )
+                     sProj = pShell->GetBasicManager()->GetName();
diff --git a/patches/vba/vba-containercontrol-extra.diff b/patches/vba/vba-containercontrol-extra.diff
deleted file mode 100644
index 0fff0cb..0000000
--- a/patches/vba/vba-containercontrol-extra.diff
+++ /dev/null
@@ -1,434 +0,0 @@
-diff --git scripting/source/dlgprov/dlgevtatt.cxx scripting/source/dlgprov/dlgevtatt.cxx
-index 29f815d..86c765a 100644
---- scripting/source/dlgprov/dlgevtatt.cxx
-+++ scripting/source/dlgprov/dlgevtatt.cxx
-@@ -41,6 +41,7 @@
- #include <vcl/msgbox.hxx>
- #endif 
- #include <com/sun/star/awt/XControl.hpp>
-+#include <com/sun/star/awt/XControlContainer.hpp>
- #include <com/sun/star/awt/XDialogEventHandler.hpp>
- #include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
- #include <com/sun/star/beans/XPropertySet.hpp>
-@@ -291,6 +292,49 @@ namespace dlgprov
-         }
-     }
- 
-+
-+    void DialogEventsAttacherImpl::nestedAttachEvents( const Sequence< Reference< XInterface > >& Objects, const Any& Helper, rtl::OUString& sDialogCodeName )
-+    {
-+        const Reference< XInterface >* pObjects = Objects.getConstArray();
-+        sal_Int32 nObjCount = Objects.getLength();
-+		
-+        for ( sal_Int32 i = 0; i < nObjCount; ++i )
-+        {
-+            // We know that we have to do with instances of XControl.
-+            // Otherwise this is not the right implementation for
-+            // XScriptEventsAttacher and we have to give up.
-+            Reference< XControl > xControl( pObjects[ i ], UNO_QUERY );
-+            Reference< XControlContainer > xControlContainer( xControl, UNO_QUERY );
-+            Reference< XDialog > xDialog( xControl, UNO_QUERY );
-+            if ( !xControl.is() )
-+                throw IllegalArgumentException();
-+
-+            // get XEventsSupplier from control model
-+            Reference< XControlModel > xControlModel = xControl->getModel();
-+            Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY );
-+            attachEventsToControl( xControl, xEventsSupplier, Helper );
-+#ifdef FAKE_VBA_EVENT_SUPPORT
-+            xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) );
-+            attachEventsToControl( xControl, xEventsSupplier, Helper );
-+#endif
-+            if ( xControlContainer.is() && !xDialog.is() )
-+            {
-+                Sequence< Reference< XControl > > aControls = xControlContainer->getControls();
-+                sal_Int32 nControlCount = aControls.getLength();
-+
-+                Sequence< Reference< XInterface > > aObjects( nControlCount );
-+                Reference< XInterface >* pObjects = aObjects.getArray();
-+                const Reference< XControl >* pControls = aControls.getConstArray();
-+
-+                for ( sal_Int32 i = 0; i < nControlCount; ++i )
-+                {
-+                    pObjects[i] = Reference< XInterface >( pControls[i], UNO_QUERY );
-+                }
-+                nestedAttachEvents( aObjects, Helper, sDialogCodeName );
-+            }
-+        }
-+    }
-+
-     // -----------------------------------------------------------------------------
-     // XScriptEventsAttacher
-     // -----------------------------------------------------------------------------
-@@ -340,25 +384,7 @@ namespace dlgprov
-             catch( Exception& ){}
-         }
- #endif
--	
--        for ( sal_Int32 i = 0; i < nObjCount; ++i )
--        {
--            // We know that we have to do with instances of XControl.
--            // Otherwise this is not the right implementation for
--            // XScriptEventsAttacher and we have to give up.
--            Reference< XControl > xControl( pObjects[ i ], UNO_QUERY );
--            if ( !xControl.is() )
--                throw IllegalArgumentException();
--
--            // get XEventsSupplier from control model
--            Reference< XControlModel > xControlModel = xControl->getModel();
--            Reference< XScriptEventsSupplier > xEventsSupplier( xControlModel, UNO_QUERY );
--            attachEventsToControl( xControl, xEventsSupplier, Helper );
--#ifdef FAKE_VBA_EVENT_SUPPORT
--            xEventsSupplier.set( getFakeVbaEventsSupplier( xControl, sDialogCodeName ) );
--            attachEventsToControl( xControl, xEventsSupplier, Helper );
--#endif
--        }
-+        nestedAttachEvents( Objects, Helper, sDialogCodeName );
-     }
- 
- 
-diff --git scripting/source/dlgprov/dlgevtatt.hxx scripting/source/dlgprov/dlgevtatt.hxx
-index 39285ce..eda71e7 100644
---- scripting/source/dlgprov/dlgevtatt.hxx
-+++ scripting/source/dlgprov/dlgevtatt.hxx
-@@ -76,6 +76,7 @@ namespace dlgprov
- #ifdef FAKE_VBA_EVENT_SUPPORT
-         ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier > getFakeVbaEventsSupplier( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, rtl::OUString& sCodeName );
- #endif
-+        void nestedAttachEvents( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& Objects, const ::com::sun::star::uno::Any& Helper, rtl::OUString& sDialogCodeName );
-         void  SAL_CALL attachEventsToControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& xControl, const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptEventsSupplier >& events, const ::com::sun::star::uno::Any& Helper  );
-     public:
-         DialogEventsAttacherImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, 
-diff --git toolkit/inc/toolkit/controls/dialogcontrol.hxx toolkit/inc/toolkit/controls/dialogcontrol.hxx
-index 9324df2..1f6e8d7 100644
---- toolkit/inc/toolkit/controls/dialogcontrol.hxx
-+++ toolkit/inc/toolkit/controls/dialogcontrol.hxx
-@@ -72,6 +72,7 @@ class UnoControlDialogModel :	public UnoControlDialogModel_IBase
-                             ,	public UnoControlDialogModel_Base
- {
- public:
-+    enum ChildOperation { Insert = 0, Remove };
-     // would like to make this typedef private, too, but the Forte 7 compiler does have
-     // problems with this .....
-     typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >, ::rtl::OUString >
-@@ -103,6 +104,7 @@ protected:
-     ::cppu::IPropertyArrayHelper&		SAL_CALL getInfoHelper();
- 
-     UnoControlModelHolderList::iterator			ImplFindElement( const ::rtl::OUString& rName );
-+    void updateUserFormChildren(  const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xAllChildren, const rtl::OUString& aName, ChildOperation Operation,  const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xTarget ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) ;
- 
- public:
-                         UnoControlDialogModel( bool bRegProps = true );
-@@ -142,7 +144,7 @@ public:
-     // ::com::sun::star::lang::XMultiServiceFactory
-     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
--    ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
-+    ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);;
-     
-     // ::com::sun::star::io::XPersistObject
-     ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
-diff --git toolkit/inc/toolkit/helper/property.hxx toolkit/inc/toolkit/helper/property.hxx
-index 90604f0..d991613 100644
---- toolkit/inc/toolkit/helper/property.hxx
-+++ toolkit/inc/toolkit/helper/property.hxx
-@@ -200,6 +200,7 @@ namespace rtl {
- #define BASEPROPERTY_GROUPNAME                      146  // ::rtl::OUString
- #define BASEPROPERTY_VBAFORM                        147  // sal_Boo
- #define BASEPROPERTY_MULTIPAGEVALUE                 148  // sal_Int32
-+#define BASEPROPERTY_USERFORMCONTAINEES             149  // css::container::XNameContainer
- 
- 
- 
-diff --git toolkit/source/controls/dialogcontrol.cxx toolkit/source/controls/dialogcontrol.cxx
-index 7da2092..86e58df 100644
---- toolkit/source/controls/dialogcontrol.cxx
-+++ toolkit/source/controls/dialogcontrol.cxx
-@@ -69,6 +69,7 @@
- #include "grid/gridcontrol.hxx"
- 
- #include <map>
-+#include <hash_map>
- #include <algorithm>
- #include <functional>
- #include "tools/urlobj.hxx"
-@@ -240,6 +241,81 @@ static const ::rtl::OUString& getStepPropertyName( )
-     return s_sStepProperty;
- }
- 
-+// we probably will need both a hash of control models and hash of controls
-+// => use some template magic 
-+
-+typedef ::cppu::WeakImplHelper1< container::XNameContainer > SimpleNameContainer_BASE;
-+
-+template< typename T > 
-+class SimpleNamedThingContainer : public SimpleNameContainer_BASE
-+{
-+    typedef std::hash_map< rtl::OUString, Reference< T >, ::rtl::OUStringHash,
-+       ::std::equal_to< ::rtl::OUString > > NamedThingsHash;
-+    NamedThingsHash things;
-+    ::osl::Mutex m_aMutex;
-+public:
-+    // ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
-+    virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
-+    {
-+        ::osl::MutexGuard aGuard( m_aMutex );
-+        if ( !hasByName( aName ) )
-+            throw NoSuchElementException(); 
-+        Reference< T > xElement;
-+        if ( ! ( aElement >>= xElement ) )
-+            throw IllegalArgumentException(); 
-+        things[ aName ] = xElement;
-+    }
-+    virtual Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-+    {
-+        ::osl::MutexGuard aGuard( m_aMutex );
-+        if ( !hasByName( aName ) )
-+            throw NoSuchElementException(); 
-+        return uno::makeAny( things[ aName ] );
-+    }
-+    virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw(RuntimeException)
-+    {
-+        ::osl::MutexGuard aGuard( m_aMutex );
-+        Sequence< ::rtl::OUString > aResult( things.size() );
-+        typename NamedThingsHash::iterator it = things.begin();
-+        typename NamedThingsHash::iterator it_end = things.end();
-+        rtl::OUString* pName = aResult.getArray();
-+        for (; it != it_end; ++it, ++pName )
-+            *pName = it->first; 
-+        return aResult; 
-+    }
-+    virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
-+    {
-+        ::osl::MutexGuard aGuard( m_aMutex );
-+        return ( things.find( aName ) != things.end() );
-+    }
-+    virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-+    {
-+        ::osl::MutexGuard aGuard( m_aMutex );
-+        if ( hasByName( aName ) )
-+            throw ElementExistException();
-+        Reference< T > xElement;
-+        if ( ! ( aElement >>= xElement ) )
-+            throw IllegalArgumentException(); 
-+        things[ aName ] = xElement;
-+    }
-+    virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
-+    {
-+        ::osl::MutexGuard aGuard( m_aMutex );
-+        if ( !hasByName( aName ) )
-+            throw NoSuchElementException(); 
-+        things.erase( things.find( aName ) );
-+    }
-+    virtual Type SAL_CALL getElementType(  ) throw (RuntimeException)
-+    {
-+        return T::static_type( NULL );
-+    }
-+    virtual ::sal_Bool SAL_CALL hasElements(  ) throw (RuntimeException)
-+    {
-+        ::osl::MutexGuard aGuard( m_aMutex );
-+        return ( things.size() > 0 );
-+    }
-+};
-+
- //	----------------------------------------------------
- //	class UnoControlDialogModel
- //	----------------------------------------------------
-@@ -273,6 +349,8 @@ UnoControlDialogModel::UnoControlDialogModel( bool regProps )
-         ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
-     	aBool <<= (sal_Bool) sal_False;
-     	ImplRegisterProperty( BASEPROPERTY_VBAFORM, aBool );
-+        uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
-+        ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) ); 
-     }
- }
- 
-@@ -581,6 +659,55 @@ Type UnoControlDialogModel::getElementType() throw(RuntimeException)
-     return aType;
- }
- 
-+void UnoControlDialogModel::updateUserFormChildren( const Reference< XNameContainer >& xAllChildren, const rtl::OUString& aName, ChildOperation Operation, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xTarget ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
-+{
-+    if ( Operation < Insert || Operation > Remove )
-+        throw IllegalArgumentException();
-+
-+    if ( xAllChildren.is() )
-+    {
-+        if ( Operation == Remove )
-+        {  
-+            Reference< XControlModel > xOldModel( xAllChildren->getByName( aName ), UNO_QUERY );
-+            xAllChildren->removeByName( aName );
-+
-+            Reference< XNameContainer > xChildContainer( xOldModel, UNO_QUERY );
-+            if ( xChildContainer.is() )
-+            { 
-+                Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY );
-+                // container control is being removed from this container, reset the 
-+                // global list of containees
-+                if ( xProps.is() )
-+                    xProps->setPropertyValue(  GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( uno::Reference< XNameContainer >() ) );   
-+                Sequence< rtl::OUString > aChildNames = xChildContainer->getElementNames();
-+                for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index )
-+                    updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation,  Reference< XControlModel > () );
-+            }
-+        }
-+        else if ( Operation == Insert )
-+        {
-+            xAllChildren->insertByName( aName, uno::makeAny( xTarget ) );
-+            Reference< XNameContainer > xChildContainer( xTarget, UNO_QUERY );
-+            if ( xChildContainer.is() )
-+            {
-+                // container control is being added from this container, reset the 
-+                // global list of containees to point to the correct global list
-+                Reference< XPropertySet > xProps( xChildContainer, UNO_QUERY );
-+                if ( xProps.is() )
-+                    xProps->setPropertyValue(  GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ), uno::makeAny( xAllChildren ) );   
-+                Sequence< rtl::OUString > aChildNames = xChildContainer->getElementNames();
-+                for ( sal_Int32 index=0; index< aChildNames.getLength(); ++index )
-+                {
-+                    Reference< XControlModel > xChildTarget( xChildContainer->getByName( aChildNames[ index ] ), UNO_QUERY );
-+                    updateUserFormChildren( xAllChildren, aChildNames[ index ], Operation, xChildTarget );
-+                }
-+            }
-+        }
-+    }
-+    else
-+        throw IllegalArgumentException();
-+}
-+
- sal_Bool UnoControlDialogModel::hasElements() throw(RuntimeException)
- {
-     return !maModels.empty();
-@@ -599,6 +726,21 @@ void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const A
-     UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
-     if ( maModels.end() == aElementPos )
-         lcl_throwNoSuchElementException();
-+    
-+    // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
-+    // With container controls you could have constructed an existing hierachy and are now
-+    // add this to an existing container, in this case a name nested in the containment 
-+    // hierachy of the added control could contain a name clash, if we have access to the
-+    // list of global names then recursively check for previously existing names ( we need 
-+    // to do this obviously before the 'this' objects container is updated 
-+    Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
-+    if ( xAllChildren.is() )
-+    {
-+        // remove old control ( and children ) from global list of containees
-+        updateUserFormChildren( xAllChildren, aName, Remove, uno::Reference< XControlModel >() );
-+        // Add new control ( and containees if they exist )
-+        updateUserFormChildren( xAllChildren, aName, Insert, xNewModel );
-+    }
- 
-     // stop listening at the old model
-     stopControlListening( aElementPos->first );
-@@ -607,6 +749,7 @@ void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const A
-     aElementPos->first = xNewModel;
-     startControlListening( xNewModel );
- 
-+
-     ContainerEvent aEvent;
-     aEvent.Source = *this;
-     aEvent.Element = aElement;
-@@ -663,7 +806,7 @@ void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const An
-                 Reference< beans::XPropertySetInfo > xPropInfo = xProps.get()->getPropertySetInfo();
- 
-                 ::rtl::OUString sImageSourceProperty = GetPropertyName( BASEPROPERTY_IMAGEURL );
--                if ( xPropInfo.get()->hasPropertyByName(  sImageSourceProperty ))
-+                if ( xPropInfo.get()->hasPropertyByName( sImageSourceProperty ))
-                 {
-                     Any aUrl = xProps.get()->getPropertyValue(  sImageSourceProperty );
-                      
-@@ -689,10 +832,24 @@ void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const An
-         lcl_throwIllegalArgumentException();
- 
-     UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
-+
-     if ( maModels.end() != aElementPos )
-         lcl_throwElementExistException();
- 
-+    // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
-+    // With container controls you could have constructed an existing hierachy and are now
-+    // add this to an existing container, in this case a name nested in the containment 
-+    // hierachy of the added control could contain a name clash, if we have access to the
-+    // list of global names then we need to recursively check for previously existing 
-+    // names ( we need to do this obviously before the 'this' objects container is updated 
-+    // remove old control ( and children ) from global list of containees
-+    Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
-+
-+    updateUserFormChildren( xAllChildren, aName, Insert, xM );
-+
-     maModels.push_back( UnoControlModelHolder( xM, aName ) );
-+
-+
-     mbGroupsUpToDate = sal_False;
-     startControlListening( xM );
- 
-@@ -714,6 +871,14 @@ void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(N
-     if ( maModels.end() == aElementPos )
-         lcl_throwNoSuchElementException();
- 
-+    // Dialog behaviour is to have all containee names unique ( MSO Userform is the same )
-+    // With container controls you could have constructed an existing hierachy and are now
-+    // removing this control from an existing container, in this case all nested names in 
-+    // the containment hierachy of the control to be removed need to be removed from the global 
-+    // names cache ( we need to do this obviously before the 'this' objects container is updated ) 
-+    Reference< XNameContainer > xAllChildren( getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES ) ), UNO_QUERY );
-+    updateUserFormChildren( xAllChildren, aName, Remove, uno::Reference< XControlModel >() );
-+
-     ContainerEvent aEvent;
-     aEvent.Source = *this;
-     aEvent.Element <<= aElementPos->first;
-@@ -723,6 +888,7 @@ void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(N
-     stopControlListening( aElementPos->first );
-     Reference< XPropertySet > xPS( aElementPos->first, UNO_QUERY );
-     maModels.erase( aElementPos );
-+
-     mbGroupsUpToDate = sal_False;
- 
-     if ( xPS.is() )
-@@ -1518,6 +1684,7 @@ UnoMultiPageModel::UnoMultiPageModel() : UnoControlDialogModel( false )
-     //ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
-     ImplRegisterProperty( BASEPROPERTY_MULTIPAGEVALUE );
-     ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-+    ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES ); 
- 
-     Any aBool;
-     aBool <<= (sal_Bool) sal_True;
-@@ -1641,6 +1808,7 @@ UnoPageModel::UnoPageModel() : UnoControlDialogModel( false )
-     ImplRegisterProperty( BASEPROPERTY_TITLE );
-     ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
-     ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
-+    ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES ); 
- //    ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
- 
-     Any aBool;
-@@ -1805,6 +1973,7 @@ UnoFrameModel::UnoFrameModel() : UnoControlDialogModel( false )
-     ImplRegisterProperty( BASEPROPERTY_LABEL );
-     ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
-     ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
-+    ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES ); 
- }
- 
- UnoFrameModel::UnoFrameModel( const UnoFrameModel& rModel )
-diff --git toolkit/source/helper/property.cxx toolkit/source/helper/property.cxx
-index c53c187..42f17c4 100644
---- toolkit/source/helper/property.cxx
-+++ toolkit/source/helper/property.cxx
-@@ -57,6 +57,7 @@
- #include <com/sun/star/beans/PropertyAttribute.hpp>
- #include <com/sun/star/graphic/XGraphic.hpp>
- #include <com/sun/star/resource/XStringResourceResolver.hpp>
-+#include <com/sun/star/container/XNameContainer.hpp>
- #include <comphelper/types.hxx>
- #include <functional>
- #include <algorithm>
-@@ -283,7 +284,8 @@ 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_DEP_PROP_3 ( "MultiPageValue",          MULTIPAGEVALUE,      sal_Int32,          BOUND, MAYBEDEFAULT, MAYBEVOID ),
--            DECL_PROP_2     ( "VBAForm",                VBAFORM,                sal_Bool,           BOUND, MAYBEDEFAULT )
-+            DECL_PROP_2     ( "VBAForm",                VBAFORM,                sal_Bool,           BOUND, MAYBEDEFAULT ),
-+            DECL_PROP_3     ( "VBAUserFormChildren",                USERFORMCONTAINEES,                Reference< ::com::sun::star::container::XNameContainer >,           BOUND, MAYBEDEFAULT, MAYBEVOID ),
-             };
-             pPropertyInfos = aImplPropertyInfos;
-             nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );


More information about the ooo-build-commit mailing list