[Libreoffice-commits] .: 20 commits - comphelper/source cppuhelper/inc cppuhelper/source eventattacher/source forms/source offapi/com oox/source sc/source sw/source udkapi/com udkapi/UnoApi_udkapi.mk

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Aug 16 18:32:42 PDT 2011


 comphelper/source/eventattachermgr/eventattachermgr.cxx |   51 ++-
 cppuhelper/inc/cppuhelper/propshlp.hxx                  |   11 
 cppuhelper/source/gcc3.map                              |    5 
 cppuhelper/source/makefile.mk                           |    3 
 cppuhelper/source/msvc_win32_intel.map                  |    5 
 cppuhelper/source/propshlp.cxx                          |   20 +
 eventattacher/source/eventattacher.cxx                  |  229 +++++++++++-----
 forms/source/component/FormComponent.cxx                |   20 +
 forms/source/inc/FormComponent.hxx                      |    1 
 forms/source/inc/frm_strings.hxx                        |    1 
 forms/source/inc/property.hrc                           |    1 
 forms/source/misc/InterfaceContainer.cxx                |   17 +
 forms/source/misc/property.cxx                          |    1 
 offapi/com/sun/star/document/XCodeNameQuery.idl         |    2 
 oox/source/ole/axcontrol.cxx                            |    7 
 oox/source/token/properties.txt                         |    1 
 sc/source/filter/excel/xiescher.cxx                     |   16 -
 sc/source/filter/ftools/fapihelper.cxx                  |   11 
 sc/source/filter/inc/fapihelper.hxx                     |    2 
 sc/source/filter/inc/xiescher.hxx                       |    8 
 sc/source/ui/unoobj/servuno.cxx                         |   83 +++--
 sw/source/core/unocore/unocoll.cxx                      |    7 
 udkapi/UnoApi_udkapi.mk                                 |    5 
 udkapi/com/sun/star/beans/XPropertySetOption.idl        |   48 +++
 udkapi/com/sun/star/script/EventListener.idl            |   46 +++
 udkapi/com/sun/star/script/XEventAttacher2.idl          |   51 +++
 udkapi/com/sun/star/script/makefile.mk                  |    2 
 27 files changed, 513 insertions(+), 141 deletions(-)

New commits:
commit 9571e828da50ad15fcee91670952461c52244abd
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Tue Aug 16 21:32:51 2011 -0400

    I should add license header to these guys too.

diff --git a/udkapi/com/sun/star/script/EventListener.idl b/udkapi/com/sun/star/script/EventListener.idl
index 5fd0b3d..cb3c8d4 100644
--- a/udkapi/com/sun/star/script/EventListener.idl
+++ b/udkapi/com/sun/star/script/EventListener.idl
@@ -1,3 +1,29 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *       Kohei Yoshida <kohei.yoshida at suse.com> (SUSE, Inc.)
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
 
 #ifndef __com_sun_star_script_EventListener_idl__
 #define __com_sun_star_script_EventListener_idl__
diff --git a/udkapi/com/sun/star/script/XEventAttacher2.idl b/udkapi/com/sun/star/script/XEventAttacher2.idl
index 541ce00..1f2846c 100644
--- a/udkapi/com/sun/star/script/XEventAttacher2.idl
+++ b/udkapi/com/sun/star/script/XEventAttacher2.idl
@@ -1,3 +1,30 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *       Kohei Yoshida <kohei.yoshida at suse.com> (SUSE, Inc.)
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
 #ifndef __com_sun_star_script_XEventAttacher2_idl__
 #define __com_sun_star_script_XEventAttacher2_idl__
 
commit 5a58d75616d8bf00d8dd283e282325bee7cd7c50
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Tue Aug 16 21:20:05 2011 -0400

    Added license header to the new file, and other misc changes.

diff --git a/udkapi/com/sun/star/beans/XPropertySetOption.idl b/udkapi/com/sun/star/beans/XPropertySetOption.idl
index 032a040..db1bac1 100644
--- a/udkapi/com/sun/star/beans/XPropertySetOption.idl
+++ b/udkapi/com/sun/star/beans/XPropertySetOption.idl
@@ -1,6 +1,32 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *       Kohei Yoshida <kohei.yoshida at suse.com> (SUSE, Inc.)
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
 
-#ifndef __com_sun_star_beans_XPropertySet2_idl__
-#define __com_sun_star_beans_XPropertySet2_idl__
+#ifndef __com_sun_star_beans_XPropertySetOption_idl__
+#define __com_sun_star_beans_XPropertySetOption_idl__
 
 #include <com/sun/star/uno/XInterface.idl>
 
@@ -9,8 +35,8 @@ module com {  module sun {  module star {  module beans {
 interface XPropertySetOption: com::sun::star::uno::XInterface
 {
     /**
-     * Turn on or off notifying change listeners on property value change.  It
-     * notifies registered change listeners by default.
+     * Turn on or off notifying change listeners on property value change.
+     * This option is turned on by default.
      */
     void enableChangeListenerNotification( [in] boolean bEnable );
 };
commit 60d60caf99a40ca0c3891bf230c5a1fdbae5f49c
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Tue Aug 16 01:18:21 2011 -0400

    Renamed XPropertySet2 to XPropertySetOption.
    
    To avoid making it appear to be a derived interface of XPropertySet
    when it's not.

diff --git a/cppuhelper/inc/cppuhelper/propshlp.hxx b/cppuhelper/inc/cppuhelper/propshlp.hxx
index 335fc60..670ce03 100644
--- a/cppuhelper/inc/cppuhelper/propshlp.hxx
+++ b/cppuhelper/inc/cppuhelper/propshlp.hxx
@@ -34,7 +34,7 @@
 #include <cppuhelper/interfacecontainer.hxx>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/XPropertySet2.hpp>
+#include <com/sun/star/beans/XPropertySetOption.hpp>
 #include <com/sun/star/beans/XMultiPropertySet.hpp>
 #include <com/sun/star/beans/XFastPropertySet.hpp>
 
@@ -352,7 +352,7 @@ public:
 class OPropertySetHelper : public ::com::sun::star::beans::XMultiPropertySet,
                            public ::com::sun::star::beans::XFastPropertySet,
                            public ::com::sun::star::beans::XPropertySet,
-                           public ::com::sun::star::beans::XPropertySet2
+                           public ::com::sun::star::beans::XPropertySetOption
 {
 public:
     /**
@@ -506,7 +506,7 @@ public:
         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > & Listener )
         throw(::com::sun::star::uno::RuntimeException);
 
-    // XPropertySet2
+    // XPropertySetOption
     virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
         throw(::com::sun::star::uno::RuntimeException);
 
diff --git a/cppuhelper/source/makefile.mk b/cppuhelper/source/makefile.mk
index a12a537..f312354 100755
--- a/cppuhelper/source/makefile.mk
+++ b/cppuhelper/source/makefile.mk
@@ -61,7 +61,7 @@ UNOTYPES= \
         com.sun.star.beans.XMultiPropertySet \
         com.sun.star.beans.XPropertyAccess \
         com.sun.star.beans.XPropertySet \
-        com.sun.star.beans.XPropertySet2 \
+        com.sun.star.beans.XPropertySetOption \
         com.sun.star.bridge.UnoUrlResolver \
         com.sun.star.bridge.XUnoUrlResolver \
         com.sun.star.connection.SocketPermission \
diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map
index 1d397bf..bd30b1b 100644
--- a/cppuhelper/source/msvc_win32_intel.map
+++ b/cppuhelper/source/msvc_win32_intel.map
@@ -288,5 +288,5 @@ UDK_3.7 { # OOo 3.4
 UDK_3.8 { # LibO 3.5
     global:
         ?enableChangeListenerNotification at OPropertySetHelper@cppu@@UAAXE at Z;
-        ??_7OPropertySetHelper at cppu@@6BXPropertySet2 at beans@star at sun@com@@@;
+        ??_7OPropertySetHelper at cppu@@6BXPropertySetOption at beans@star at sun@com@@@;
 } UDK_3.7;
diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx
index 426c7c9..7878062 100644
--- a/cppuhelper/source/propshlp.cxx
+++ b/cppuhelper/source/propshlp.cxx
@@ -218,7 +218,7 @@ Any OPropertySetHelper::queryInterface( const ::com::sun::star::uno::Type & rTyp
     return ::cppu::queryInterface(
         rType,
         static_cast< XPropertySet * >( this ),
-        static_cast< XPropertySet2 * >( this ),
+        static_cast< XPropertySetOption * >( this ),
         static_cast< XMultiPropertySet * >( this ),
         static_cast< XFastPropertySet * >( this ) );
 }
@@ -231,7 +231,7 @@ Any OPropertySetHelper::queryInterface( const ::com::sun::star::uno::Type & rTyp
 {
     Sequence< ::com::sun::star::uno::Type > aTypes( 4 );
     aTypes[ 0 ] = XPropertySet::static_type();
-    aTypes[ 1 ] = XPropertySet2::static_type();
+    aTypes[ 1 ] = XPropertySetOption::static_type();
     aTypes[ 2 ] = XMultiPropertySet::static_type();
     aTypes[ 3 ] = XFastPropertySet::static_type();
     return aTypes;
diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx
index 23caa36..dba3480 100644
--- a/sc/source/filter/ftools/fapihelper.cxx
+++ b/sc/source/filter/ftools/fapihelper.cxx
@@ -34,7 +34,7 @@
 #include <com/sun/star/lang/XServiceName.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/beans/XPropertyState.hpp>
-#include <com/sun/star/beans/XPropertySet2.hpp>
+#include <com/sun/star/beans/XPropertySetOption.hpp>
 #include <comphelper/docpasswordhelper.hxx>
 #include <comphelper/processfactory.hxx>
 #include <tools/urlobj.hxx>
@@ -169,18 +169,18 @@ uno::Sequence< beans::NamedValue > ScfApiHelper::QueryEncryptionDataForMedium( S
 
 ScfPropertySet::~ScfPropertySet()
 {
-    Reference<beans::XPropertySet2> xPropSet2(mxPropSet, UNO_QUERY);
-    if (xPropSet2.is())
-        xPropSet2->enableChangeListenerNotification(true);
+    Reference<beans::XPropertySetOption> xPropSetOpt(mxPropSet, UNO_QUERY);
+    if (xPropSetOpt.is())
+        xPropSetOpt->enableChangeListenerNotification(true);
 }
 
 void ScfPropertySet::Set( Reference< XPropertySet > xPropSet )
 {
     mxPropSet = xPropSet;
     mxMultiPropSet.set( mxPropSet, UNO_QUERY );
-    Reference<beans::XPropertySet2> xPropSet2(mxPropSet, UNO_QUERY);
-    if (xPropSet2.is())
-        xPropSet2->enableChangeListenerNotification(false);
+    Reference<beans::XPropertySetOption> xPropSetOpt(mxPropSet, UNO_QUERY);
+    if (xPropSetOpt.is())
+        xPropSetOpt->enableChangeListenerNotification(false);
 }
 
 OUString ScfPropertySet::GetServiceName() const
diff --git a/udkapi/UnoApi_udkapi.mk b/udkapi/UnoApi_udkapi.mk
index 8a57118..9fab456 100644
--- a/udkapi/UnoApi_udkapi.mk
+++ b/udkapi/UnoApi_udkapi.mk
@@ -159,10 +159,10 @@ $(eval $(call gb_UnoApiTarget_add_idlfiles,udkapi,\
 	udkapi/com/sun/star/beans/XPropertyChangeListener \
 	udkapi/com/sun/star/beans/XPropertyContainer \
 	udkapi/com/sun/star/beans/XPropertySet \
-	udkapi/com/sun/star/beans/XPropertySet2 \
 	udkapi/com/sun/star/beans/XPropertySetInfo \
 	udkapi/com/sun/star/beans/XPropertySetInfoChangeListener \
 	udkapi/com/sun/star/beans/XPropertySetInfoChangeNotifier \
+	udkapi/com/sun/star/beans/XPropertySetOption \
 	udkapi/com/sun/star/beans/XPropertyState \
 	udkapi/com/sun/star/beans/XPropertyStateChangeListener \
 	udkapi/com/sun/star/beans/XPropertyWithState \
diff --git a/udkapi/com/sun/star/beans/XPropertySet2.idl b/udkapi/com/sun/star/beans/XPropertySet2.idl
deleted file mode 100644
index 61f3dfe..0000000
--- a/udkapi/com/sun/star/beans/XPropertySet2.idl
+++ /dev/null
@@ -1,28 +0,0 @@
-
-#ifndef __com_sun_star_beans_XPropertySet2_idl__
-#define __com_sun_star_beans_XPropertySet2_idl__
-
-#include <com/sun/star/beans/XPropertySet.idl>
-
-module com {  module sun {  module star {  module beans {
-
-/**
- * This interface should be conceptually derived from XPropertySet but isn't
- * due to ABI compatibility on Windows; cppu::OPrpertySetHelper exports
- * XPropertySet's vtable symbol in the UDK_3_0_0 section which must stay
- * there.  Once we hit LibreOffice 4 we should clean this mess up.
- */
-interface XPropertySet2: com::sun::star::uno::XInterface
-{
-    /**
-     * Turn on or off notifying change listeners on property value change.  It
-     * notifies registered change listeners by default.
-     */
-    void enableChangeListenerNotification( [in] boolean bEnable );
-};
-
-//=============================================================================
-
-}; }; }; };
-
-#endif
diff --git a/udkapi/com/sun/star/beans/XPropertySetOption.idl b/udkapi/com/sun/star/beans/XPropertySetOption.idl
new file mode 100644
index 0000000..032a040
--- /dev/null
+++ b/udkapi/com/sun/star/beans/XPropertySetOption.idl
@@ -0,0 +1,22 @@
+
+#ifndef __com_sun_star_beans_XPropertySet2_idl__
+#define __com_sun_star_beans_XPropertySet2_idl__
+
+#include <com/sun/star/uno/XInterface.idl>
+
+module com {  module sun {  module star {  module beans {
+
+interface XPropertySetOption: com::sun::star::uno::XInterface
+{
+    /**
+     * Turn on or off notifying change listeners on property value change.  It
+     * notifies registered change listeners by default.
+     */
+    void enableChangeListenerNotification( [in] boolean bEnable );
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
commit 11207ae93191fb966676423e6d377c8292a8cf0b
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Aug 15 23:56:37 2011 -0400

    Make XPropertSet2 not a child interface of XPropertySet.
    
    This is to preserve ABI backward compatibility with cppu::OPropertySetHelper.

diff --git a/cppuhelper/inc/cppuhelper/propshlp.hxx b/cppuhelper/inc/cppuhelper/propshlp.hxx
index 779eda2..335fc60 100644
--- a/cppuhelper/inc/cppuhelper/propshlp.hxx
+++ b/cppuhelper/inc/cppuhelper/propshlp.hxx
@@ -33,6 +33,7 @@
 
 #include <cppuhelper/interfacecontainer.hxx>
 
+#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/XPropertySet2.hpp>
 #include <com/sun/star/beans/XMultiPropertySet.hpp>
 #include <com/sun/star/beans/XFastPropertySet.hpp>
@@ -350,6 +351,7 @@ public:
  */
 class OPropertySetHelper : public ::com::sun::star::beans::XMultiPropertySet,
                            public ::com::sun::star::beans::XFastPropertySet,
+                           public ::com::sun::star::beans::XPropertySet,
                            public ::com::sun::star::beans::XPropertySet2
 {
 public:
diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map
index 39a1469..1d397bf 100644
--- a/cppuhelper/source/msvc_win32_intel.map
+++ b/cppuhelper/source/msvc_win32_intel.map
@@ -64,7 +64,7 @@ GetVersionInfo;
 ??_7OPropertyArrayHelper at cppu@@6B@;
 ??_7OPropertySetHelper at cppu@@6BXFastPropertySet at beans@star at sun@com@@@;
 ??_7OPropertySetHelper at cppu@@6BXMultiPropertySet at beans@star at sun@com@@@;
-??_7OPropertySetHelper at cppu@@6BXPropertySet2 at beans@star at sun@com@@@;
+??_7OPropertySetHelper at cppu@@6BXPropertySet at beans@star at sun@com@@@;
 ??_GIPropertyArrayHelper at cppu@@UAEPAXI at Z;
 ??_GOPropertyArrayHelper at cppu@@UAEPAXI at Z;
 ?addPropertiesChangeListener at OPropertySetHelper@cppu@@UAAXABV?$Sequence at VOUString@rtl@@@uno at star@sun at com@@ABV?$Reference at VXPropertiesChangeListener@beans at star@sun at com@@@4567@@Z;
@@ -288,4 +288,5 @@ UDK_3.7 { # OOo 3.4
 UDK_3.8 { # LibO 3.5
     global:
         ?enableChangeListenerNotification at OPropertySetHelper@cppu@@UAAXE at Z;
+        ??_7OPropertySetHelper at cppu@@6BXPropertySet2 at beans@star at sun@com@@@;
 } UDK_3.7;
diff --git a/udkapi/com/sun/star/beans/XPropertySet2.idl b/udkapi/com/sun/star/beans/XPropertySet2.idl
index e4868bf..61f3dfe 100644
--- a/udkapi/com/sun/star/beans/XPropertySet2.idl
+++ b/udkapi/com/sun/star/beans/XPropertySet2.idl
@@ -6,8 +6,18 @@
 
 module com {  module sun {  module star {  module beans {
 
-interface XPropertySet2: com::sun::star::beans::XPropertySet
+/**
+ * This interface should be conceptually derived from XPropertySet but isn't
+ * due to ABI compatibility on Windows; cppu::OPrpertySetHelper exports
+ * XPropertySet's vtable symbol in the UDK_3_0_0 section which must stay
+ * there.  Once we hit LibreOffice 4 we should clean this mess up.
+ */
+interface XPropertySet2: com::sun::star::uno::XInterface
 {
+    /**
+     * Turn on or off notifying change listeners on property value change.  It
+     * notifies registered change listeners by default.
+     */
     void enableChangeListenerNotification( [in] boolean bEnable );
 };
 
commit 8657e723d0853a868599a2c20a353fba0d03d8e6
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Aug 15 21:04:07 2011 -0400

    Changing the vtable symbol from XPropertySet to XPropertySet2.
    
    NOTE: This needs to be double-checked by an expert.  I'm modifying
    a symbol that's defined in the UDK_3_0_0 section.  I'm not really
    sure if this will cause any ABI breakages for either the core code
    or extensions.

diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map
index bf20bb6..39a1469 100644
--- a/cppuhelper/source/msvc_win32_intel.map
+++ b/cppuhelper/source/msvc_win32_intel.map
@@ -64,7 +64,7 @@ GetVersionInfo;
 ??_7OPropertyArrayHelper at cppu@@6B@;
 ??_7OPropertySetHelper at cppu@@6BXFastPropertySet at beans@star at sun@com@@@;
 ??_7OPropertySetHelper at cppu@@6BXMultiPropertySet at beans@star at sun@com@@@;
-??_7OPropertySetHelper at cppu@@6BXPropertySet at beans@star at sun@com@@@;
+??_7OPropertySetHelper at cppu@@6BXPropertySet2 at beans@star at sun@com@@@;
 ??_GIPropertyArrayHelper at cppu@@UAEPAXI at Z;
 ??_GOPropertyArrayHelper at cppu@@UAEPAXI at Z;
 ?addPropertiesChangeListener at OPropertySetHelper@cppu@@UAAXABV?$Sequence at VOUString@rtl@@@uno at star@sun at com@@ABV?$Reference at VXPropertiesChangeListener@beans at star@sun at com@@@4567@@Z;
commit a3e7f4b932c82bf399a3530d8059b7097b389de9
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Aug 15 20:52:22 2011 -0400

    Added symbol for MSVC.

diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map
index fef204f..bf20bb6 100644
--- a/cppuhelper/source/msvc_win32_intel.map
+++ b/cppuhelper/source/msvc_win32_intel.map
@@ -285,3 +285,7 @@ UDK_3.7 { # OOo 3.4
         ?setDependentFastPropertyValue at OPropertySetHelper@cppu@@IAEXJABVAny at uno@star at sun@com@@@Z;
 } UDK_3.6;
 
+UDK_3.8 { # LibO 3.5
+    global:
+        ?enableChangeListenerNotification at OPropertySetHelper@cppu@@UAAXE at Z;
+} UDK_3.7;
diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx
index 7cb2597..426c7c9 100644
--- a/cppuhelper/source/propshlp.cxx
+++ b/cppuhelper/source/propshlp.cxx
@@ -229,10 +229,11 @@ Any OPropertySetHelper::queryInterface( const ::com::sun::star::uno::Type & rTyp
 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > OPropertySetHelper::getTypes()
     throw (RuntimeException)
 {
-    Sequence< ::com::sun::star::uno::Type > aTypes( 3 );
+    Sequence< ::com::sun::star::uno::Type > aTypes( 4 );
     aTypes[ 0 ] = XPropertySet::static_type();
-    aTypes[ 1 ] = XMultiPropertySet::static_type();
-    aTypes[ 2 ] = XFastPropertySet::static_type();
+    aTypes[ 1 ] = XPropertySet2::static_type();
+    aTypes[ 2 ] = XMultiPropertySet::static_type();
+    aTypes[ 3 ] = XFastPropertySet::static_type();
     return aTypes;
 }
 
commit 825ea8f4ae2fcdc43b1e0d5b7d8c25ba842593b9
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Sat Aug 13 01:37:11 2011 -0400

    Removed irrelevant changes.

diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index c6aa20a..fe269ab 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -1855,6 +1855,7 @@ void XclImpControlHelper::ProcessControl( const XclImpDrawObjBase& rDrawObj ) co
     aPropSet.SetBoolProperty( CREATE_OUSTRING( "EnableVisible" ), rDrawObj.IsVisible() );
     aPropSet.SetBoolProperty( CREATE_OUSTRING( "Printable" ), rDrawObj.IsPrintable() );
 
+
     // virtual call for type specific processing
     DoProcessControl( aPropSet );
 }
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 6099bb3..87c0f8f 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -150,48 +150,6 @@ using ::rtl::OUStringBuffer;
 using ::boost::shared_ptr;
 using ::std::vector;
 
-#include <stdio.h>
-#include <string>
-#include <sys/time.h>
-
-namespace {
-
-class StackPrinter
-{
-public:
-    explicit StackPrinter(const char* msg) :
-        msMsg(msg)
-    {
-        fprintf(stdout, "%s: --begin\n", msMsg.c_str());
-        mfStartTime = getTime();
-    }
-
-    ~StackPrinter()
-    {
-        double fEndTime = getTime();
-        fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime-mfStartTime));
-    }
-
-    void printTime(int line) const
-    {
-        double fEndTime = getTime();
-        fprintf(stdout, "%s: --(%d) (duration: %g sec)\n", msMsg.c_str(), line, (fEndTime-mfStartTime));
-    }
-
-private:
-    double getTime() const
-    {
-        timeval tv;
-        gettimeofday(&tv, NULL);
-        return tv.tv_sec + tv.tv_usec / 1000000.0;
-    }
-
-    ::std::string msMsg;
-    double mfStartTime;
-};
-
-}
-
 // STATIC DATA -----------------------------------------------------------
 
 //  Stream-Namen im Storage
@@ -1056,7 +1014,6 @@ static void lcl_parseHtmlFilterOption(const OUString& rOption, LanguageType& rLa
 
 sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
 {
-    StackPrinter __stack_printer__("ScDocShell::ConvertFrom");
     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ConvertFrom" );
 
     LoadMediumGuard aLoadGuard(&aDocument);
commit c8f40655eac948bb8b7c9387e7333160c0088f4f
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Sat Aug 13 01:20:31 2011 -0400

    Keep the container and object separate methods.
    
    ScVbaControl doesn't have any container instance to pass to the
    old method.

diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index e908d75..af24414 100644
--- a/forms/source/misc/InterfaceContainer.cxx
+++ b/forms/source/misc/InterfaceContainer.cxx
@@ -148,9 +148,12 @@ void OInterfaceContainer::impl_addVbEvents_nolck_nothrow(  const sal_Int32 i_nIn
             if ( xElementAsForm.is() )
                 break;
 
-            rtl::OUString sCodeName;
+            // Try getting the code name from the container first (faster),
+            // then from the element if that fails (slower).
             Reference<XInterface> xThis = static_cast<XContainer*>(this);
-            sCodeName = xNameQuery->getCodeNameForObject(xThis, xElement);
+            rtl::OUString sCodeName = xNameQuery->getCodeNameForContainer(xThis);
+            if (sCodeName.isEmpty())
+                sCodeName = xNameQuery->getCodeNameForObject(xElement);
 
             Reference< XPropertySet > xProps( xElement, UNO_QUERY_THROW );
             ::rtl::OUString sServiceName;
diff --git a/offapi/com/sun/star/document/XCodeNameQuery.idl b/offapi/com/sun/star/document/XCodeNameQuery.idl
index 47908f0..35e7b7f 100644
--- a/offapi/com/sun/star/document/XCodeNameQuery.idl
+++ b/offapi/com/sun/star/document/XCodeNameQuery.idl
@@ -38,7 +38,9 @@ module com {   module sun {   module star {   module document {
 interface XCodeNameQuery
 {
     //-------------------------------------------------------------------------
-    string getCodeNameForObject( [in] com::sun::star::uno::XInterface aContainer, [in] com::sun::star::uno::XInterface aObj );
+    string getCodeNameForObject( [in] com::sun::star::uno::XInterface aObj );
+
+    string getCodeNameForContainer( [in] com::sun::star::uno::XInterface aObj );
 };
 
 //=============================================================================
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index 9be7c61..ba27fc8 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -196,8 +196,47 @@ class ScVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNam
 public:
     ScVbaCodeNameProvider( ScDocShell& rDocShell ) : mrDocShell(rDocShell) {}
     // XCodeNameQuery
-    rtl::OUString SAL_CALL getCodeNameForObject(
-        const uno::Reference<uno::XInterface>& xContainer, const uno::Reference<uno::XInterface>& /*xIf*/ )
+    rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
+    {
+        SolarMutexGuard aGuard;
+        rtl::OUString sCodeName;
+
+        // need to find the page ( and index )  for this control
+        uno::Reference< drawing::XDrawPagesSupplier > xSupplier( mrDocShell.GetModel(), uno::UNO_QUERY_THROW );
+        uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
+        sal_Int32 nLen = xIndex->getCount();
+        bool bMatched = false;
+        uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
+        for ( sal_Int32 index = 0; index < nLen; ++index )
+        {
+            try
+            {
+                uno::Reference< form::XFormsSupplier >  xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
+                uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
+                // get the www-standard container
+                uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
+                sal_Int32 nCntrls = xFormControls->getCount();
+                for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
+                {
+                    uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
+                    bMatched = ( xControl == xIf );
+                    if ( bMatched )
+                    {
+                        String sName;
+                        mrDocShell.GetDocument()->GetCodeName( static_cast<SCTAB>( index ), sName );
+                        sCodeName = sName;
+                    }
+                }
+            }
+            catch( uno::Exception& ) {}
+            if ( bMatched )
+                break;
+        }
+        // Probably should throw here ( if !bMatched )
+         return sCodeName;
+    }
+
+    rtl::OUString SAL_CALL getCodeNameForContainer( const uno::Reference<uno::XInterface>& xContainer )
             throw( uno::RuntimeException )
     {
         SolarMutexGuard aGuard;
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 735dc6b..a2e0dbc 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -106,8 +106,14 @@ class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNam
 public:
     SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
         // XCodeNameQuery
-    rtl::OUString SAL_CALL getCodeNameForObject(
-        const uno::Reference< uno::XInterface >& /*xContainer*/, const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
+
+    rtl::OUString SAL_CALL getCodeNameForContainer( const uno::Reference< uno::XInterface >& /*xIf*/ ) throw( uno::RuntimeException )
+    {
+        // not implemented...
+        return rtl::OUString();
+    }
+
+    rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
     {
         // Initialise the code name
         if ( msThisDocumentCodeName.getLength() == 0 )
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index c7e2c6e..8bebe60 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -449,7 +449,7 @@ void ScVbaControl::fireEvent( script::ScriptEvent& evt )
             uno::Reference< lang::XMultiServiceFactory > xDocFac(  m_xModel, uno::UNO_QUERY_THROW );
             uno::Reference< document::XCodeNameQuery > xNameQuery(  xDocFac->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VBACodeNameProvider")) ), uno::UNO_QUERY_THROW );
             uno::Reference< uno::XInterface > xIf( xControlShape->getControl(), uno::UNO_QUERY_THROW );
-            evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf, xIf ); // TODO : FIX THIS!!!
+            evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf );
             evt.Arguments[ 0 ] = uno::makeAny( aEvt );
             xScriptListener->firing( evt );
         }
commit 80b1e662777100a7dfd80176a2b528880a838167
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Sat Aug 13 01:04:26 2011 -0400

    Added XPropertySet2 to allow disabling of change event notifications.
    
    Sometimes broadcasting changes to the property set on every new
    value insertion makes no sense especially during import.  Turning
    that off also improves performance especially when inserting millions
    of property values.

diff --git a/cppuhelper/inc/cppuhelper/propshlp.hxx b/cppuhelper/inc/cppuhelper/propshlp.hxx
index 89a2fa7..779eda2 100644
--- a/cppuhelper/inc/cppuhelper/propshlp.hxx
+++ b/cppuhelper/inc/cppuhelper/propshlp.hxx
@@ -33,7 +33,7 @@
 
 #include <cppuhelper/interfacecontainer.hxx>
 
-#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySet2.hpp>
 #include <com/sun/star/beans/XMultiPropertySet.hpp>
 #include <com/sun/star/beans/XFastPropertySet.hpp>
 
@@ -350,7 +350,7 @@ public:
  */
 class OPropertySetHelper : public ::com::sun::star::beans::XMultiPropertySet,
                            public ::com::sun::star::beans::XFastPropertySet,
-                           public ::com::sun::star::beans::XPropertySet
+                           public ::com::sun::star::beans::XPropertySet2
 {
 public:
     /**
@@ -503,6 +503,11 @@ public:
         const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > & Listener )
         throw(::com::sun::star::uno::RuntimeException);
+
+    // XPropertySet2
+    virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
+        throw(::com::sun::star::uno::RuntimeException);
+
     /**
        The property sequence is created in the call. The interface isn't used after the call.
      */
@@ -630,6 +635,8 @@ protected:
      */
     OMultiTypeInterfaceContainerHelperInt32 aVetoableLC;
 
+    bool m_bFireEvent;
+
     class Impl;
 
     /** reserved for future use. finally, the future has arrived...
diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map
index 24f4efe..fd5877b 100644
--- a/cppuhelper/source/gcc3.map
+++ b/cppuhelper/source/gcc3.map
@@ -390,3 +390,8 @@ UDK_3.7 { # OOo 3.4
         _ZN4cppu18OPropertySetHelper29setDependentFastPropertyValueE?RKN3com3sun4star3uno3AnyE;
 } UDK_3.6;
 
+UDK_3.8 { # LibO 3.5
+global:
+        _ZN4cppu18OPropertySetHelper32enableChangeListenerNotificationEh;
+        _ZThn*_N4cppu18OPropertySetHelper32enableChangeListenerNotificationEh;
+} UDK_3.7;
diff --git a/cppuhelper/source/makefile.mk b/cppuhelper/source/makefile.mk
index f105482..a12a537 100755
--- a/cppuhelper/source/makefile.mk
+++ b/cppuhelper/source/makefile.mk
@@ -1,7 +1,7 @@
 #*************************************************************************
 #
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
+#
 # Copyright 2000, 2010 Oracle and/or its affiliates.
 #
 # OpenOffice.org - a multi-platform office productivity suite
@@ -61,6 +61,7 @@ UNOTYPES= \
         com.sun.star.beans.XMultiPropertySet \
         com.sun.star.beans.XPropertyAccess \
         com.sun.star.beans.XPropertySet \
+        com.sun.star.beans.XPropertySet2 \
         com.sun.star.bridge.UnoUrlResolver \
         com.sun.star.bridge.XUnoUrlResolver \
         com.sun.star.connection.SocketPermission \
diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx
index 27d18ad..7cb2597 100644
--- a/cppuhelper/source/propshlp.cxx
+++ b/cppuhelper/source/propshlp.cxx
@@ -173,6 +173,7 @@ OPropertySetHelper::OPropertySetHelper(
     : rBHelper( rBHelper_ ),
       aBoundLC( rBHelper_.rMutex ),
       aVetoableLC( rBHelper_.rMutex ),
+      m_bFireEvent(true),
       m_pReserved( new Impl(false, 0) )
 {
 }
@@ -182,6 +183,7 @@ OPropertySetHelper::OPropertySetHelper(
     : rBHelper( rBHelper_ ),
       aBoundLC( rBHelper_.rMutex ),
       aVetoableLC( rBHelper_.rMutex ),
+      m_bFireEvent(true),
       m_pReserved( new Impl( bIgnoreRuntimeExceptionsWhileFiring, 0 ) )
 {
 }
@@ -192,6 +194,7 @@ OPropertySetHelper::OPropertySetHelper(
     : rBHelper( rBHelper_ ),
       aBoundLC( rBHelper_.rMutex ),
       aVetoableLC( rBHelper_.rMutex ),
+      m_bFireEvent(true),
       m_pReserved(
         new Impl( bIgnoreRuntimeExceptionsWhileFiring, i_pFireEvents) )
 {
@@ -215,6 +218,7 @@ Any OPropertySetHelper::queryInterface( const ::com::sun::star::uno::Type & rTyp
     return ::cppu::queryInterface(
         rType,
         static_cast< XPropertySet * >( this ),
+        static_cast< XPropertySet2 * >( this ),
         static_cast< XMultiPropertySet * >( this ),
         static_cast< XFastPropertySet * >( this ) );
 }
@@ -626,6 +630,9 @@ void OPropertySetHelper::fire
     sal_Bool bVetoable
 )
 {
+    if (!m_bFireEvent)
+        return;
+
     OSL_ENSURE( m_pReserved.get(), "No OPropertySetHelper::Impl" );
     if (m_pReserved->m_pFireEvents) {
         m_pReserved->m_pFireEvents->fireEvents(
@@ -1029,6 +1036,12 @@ void OPropertySetHelper::firePropertiesChangeEvent(
     delete [] pHandles;
 }
 
+void OPropertySetHelper::enableChangeListenerNotification( sal_Bool bEnable )
+    throw(::com::sun::star::uno::RuntimeException)
+{
+    m_bFireEvent = bEnable;
+}
+
 #ifdef xdvnsdfln
 // XPropertyState
 PropertyState OPropertySetHelper::getPropertyState( const OUString& PropertyName )
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 9123142..c6aa20a 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -402,13 +402,13 @@ void XclImpDrawObjBase::SetDffData( const DffObjData& rDffObjData, const String&
     mbAutoMargin = bAutoMargin;
 }
 
-String XclImpDrawObjBase::GetObjName() const
+OUString XclImpDrawObjBase::GetObjName() const
 {
     /*  #i51348# Always return a non-empty name. Create English
         default names depending on the object type. This is not implemented as
         virtual functions in derived classes, as class type and object type may
         not match. */
-    return (maObjName.Len() > 0) ? maObjName : GetObjectManager().GetDefaultObjName( *this );
+    return maObjName.isEmpty() ? GetObjectManager().GetDefaultObjName(*this) : maObjName;
 }
 
 const XclObjAnchor* XclImpDrawObjBase::GetAnchor() const
@@ -507,7 +507,7 @@ void XclImpDrawObjBase::PostProcessSdrObject( XclImpDffConverter& rDffConv, SdrO
 
 void XclImpDrawObjBase::ReadName5( XclImpStream& rStrm, sal_uInt16 nNameLen )
 {
-    maObjName.Erase();
+    maObjName = rtl::OUString();
     if( nNameLen > 0 )
     {
         // name length field is repeated before the name
@@ -1855,7 +1855,6 @@ void XclImpControlHelper::ProcessControl( const XclImpDrawObjBase& rDrawObj ) co
     aPropSet.SetBoolProperty( CREATE_OUSTRING( "EnableVisible" ), rDrawObj.IsVisible() );
     aPropSet.SetBoolProperty( CREATE_OUSTRING( "Printable" ), rDrawObj.IsPrintable() );
 
-
     // virtual call for type specific processing
     DoProcessControl( aPropSet );
 }
@@ -2829,7 +2828,7 @@ void XclImpPictureObj::DoReadObj5( XclImpStream& rStrm, sal_uInt16 nNameLen, sal
     if( (rStrm.GetNextRecId() == EXC_ID3_IMGDATA) && rStrm.StartNextRecord() )
     {
         // page background is stored as hidden picture with name "__BkgndObj"
-        if( IsHidden() && (GetObjName() == CREATE_STRING( "__BkgndObj" )) )
+        if (IsHidden() && (GetObjName().equalsAscii("__BkgndObj")))
             GetPageSettings().ReadImgData( rStrm );
         else
             maGraphic = XclImpDrawing::ReadImgData( GetRoot(), rStrm );
@@ -2880,12 +2879,12 @@ SdrObject* XclImpPictureObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const
     return xSdrObj.release();
 }
 
-String XclImpPictureObj::GetObjName() const
+OUString XclImpPictureObj::GetObjName() const
 {
     if( IsOcxControl() )
     {
-        String sName( GetObjectManager().GetOleNameOverride( GetTab(), GetObjId() ) );
-        if ( sName.Len() > 0 )
+        OUString sName( GetObjectManager().GetOleNameOverride( GetTab(), GetObjId() ) );
+        if (!sName.isEmpty())
             return sName;
     }
     return XclImpDrawObjBase::GetObjName();
@@ -4167,7 +4166,7 @@ void XclImpObjectManager::ConvertObjects()
     // instead use InterpretDirtyCells in ScDocument::CalcAfterLoad.
 }
 
-String XclImpObjectManager::GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const
+OUString XclImpObjectManager::GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const
 {
     String aDefName;
     DefObjNameMap::const_iterator aIt = maDefObjNames.find( rDrawObj.GetObjType() );
diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx
index 7aa04dc..23caa36 100644
--- a/sc/source/filter/ftools/fapihelper.cxx
+++ b/sc/source/filter/ftools/fapihelper.cxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/lang/XServiceName.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XPropertySet2.hpp>
 #include <comphelper/docpasswordhelper.hxx>
 #include <comphelper/processfactory.hxx>
 #include <tools/urlobj.hxx>
@@ -166,10 +167,20 @@ uno::Sequence< beans::NamedValue > ScfApiHelper::QueryEncryptionDataForMedium( S
 
 // Property sets ==============================================================
 
+ScfPropertySet::~ScfPropertySet()
+{
+    Reference<beans::XPropertySet2> xPropSet2(mxPropSet, UNO_QUERY);
+    if (xPropSet2.is())
+        xPropSet2->enableChangeListenerNotification(true);
+}
+
 void ScfPropertySet::Set( Reference< XPropertySet > xPropSet )
 {
     mxPropSet = xPropSet;
     mxMultiPropSet.set( mxPropSet, UNO_QUERY );
+    Reference<beans::XPropertySet2> xPropSet2(mxPropSet, UNO_QUERY);
+    if (xPropSet2.is())
+        xPropSet2->enableChangeListenerNotification(false);
 }
 
 OUString ScfPropertySet::GetServiceName() const
diff --git a/sc/source/filter/inc/fapihelper.hxx b/sc/source/filter/inc/fapihelper.hxx
index a33d411..f8a338f 100644
--- a/sc/source/filter/inc/fapihelper.hxx
+++ b/sc/source/filter/inc/fapihelper.hxx
@@ -152,6 +152,8 @@ public:
     template< typename InterfaceType >
     inline explicit     ScfPropertySet( ::com::sun::star::uno::Reference< InterfaceType > xInterface ) { Set( xInterface ); }
 
+                        ~ScfPropertySet();
+
     /** Sets the passed UNO property set and releases the old UNO property set. */
     void                Set( XPropertySetRef xPropSet );
     /** Queries the passed interface for an XPropertySet and releases the old UNO property set. */
diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx
index c187e64..f1a9d2b 100644
--- a/sc/source/filter/inc/xiescher.hxx
+++ b/sc/source/filter/inc/xiescher.hxx
@@ -94,7 +94,7 @@ public:
     /** Returns the Excel object type from OBJ record. */
     inline sal_uInt16   GetObjType() const { return mnObjType; }
     /** Returns the name of this object, may generate a default name. */
-    virtual String              GetObjName() const;
+    virtual rtl::OUString GetObjName() const;
     /** Returns associated macro name, if set, otherwise zero length string. */
     inline const String& GetMacroName() const { return maMacroName; }
 
@@ -192,7 +192,7 @@ private:
     sal_uInt16          mnObjType;      /// The Excel object type from OBJ record.
     sal_uInt32          mnDffShapeId;   /// Shape ID from DFF stream.
     sal_uInt32          mnDffFlags;     /// Shape flags from DFF stream.
-    String              maObjName;      /// Name of the object.
+    rtl::OUString       maObjName;      /// Name of the object.
     String              maMacroName;    /// Name of an attached macro.
     String              maHyperlink;    /// On-click hyperlink URL.
     bool                mbHasAnchor;    /// true = maAnchor is initialized.
@@ -868,7 +868,7 @@ class XclImpPictureObj : public XclImpRectObj, public XclImpControlHelper
 public:
     explicit            XclImpPictureObj( const XclImpRoot& rRoot );
     /** Returns the ObjectName - can use non-obvious lookup for override in the associated vba document module stream**/
-    virtual String              GetObjName() const;
+    virtual rtl::OUString GetObjName() const;
     /** Returns the graphic imported from the IMGDATA record. */
     inline const Graphic& GetGraphic() const { return maGraphic; }
 
@@ -1224,7 +1224,7 @@ public:
     void                ConvertObjects();
 
     /** Returns the default name for the passed object. */
-    String              GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
+    rtl::OUString       GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
     /** Returns the used area in the sheet with the passed index. */
     ScRange             GetUsedArea( SCTAB nScTab ) const;
     /** Sets the container to receive overridden shape/ctrl names from
diff --git a/udkapi/UnoApi_udkapi.mk b/udkapi/UnoApi_udkapi.mk
index 733e20c..8a57118 100644
--- a/udkapi/UnoApi_udkapi.mk
+++ b/udkapi/UnoApi_udkapi.mk
@@ -2,7 +2,7 @@
 #*************************************************************************
 #
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
+#
 # Copyright 2000, 2010 Oracle and/or its affiliates.
 #
 # OpenOffice.org - a multi-platform office productivity suite
@@ -159,6 +159,7 @@ $(eval $(call gb_UnoApiTarget_add_idlfiles,udkapi,\
 	udkapi/com/sun/star/beans/XPropertyChangeListener \
 	udkapi/com/sun/star/beans/XPropertyContainer \
 	udkapi/com/sun/star/beans/XPropertySet \
+	udkapi/com/sun/star/beans/XPropertySet2 \
 	udkapi/com/sun/star/beans/XPropertySetInfo \
 	udkapi/com/sun/star/beans/XPropertySetInfoChangeListener \
 	udkapi/com/sun/star/beans/XPropertySetInfoChangeNotifier \
diff --git a/udkapi/com/sun/star/beans/XPropertySet2.idl b/udkapi/com/sun/star/beans/XPropertySet2.idl
new file mode 100644
index 0000000..e4868bf
--- /dev/null
+++ b/udkapi/com/sun/star/beans/XPropertySet2.idl
@@ -0,0 +1,18 @@
+
+#ifndef __com_sun_star_beans_XPropertySet2_idl__
+#define __com_sun_star_beans_XPropertySet2_idl__
+
+#include <com/sun/star/beans/XPropertySet.idl>
+
+module com {  module sun {  module star {  module beans {
+
+interface XPropertySet2: com::sun::star::beans::XPropertySet
+{
+    void enableChangeListenerNotification( [in] boolean bEnable );
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 8bebe60..c7e2c6e 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -449,7 +449,7 @@ void ScVbaControl::fireEvent( script::ScriptEvent& evt )
             uno::Reference< lang::XMultiServiceFactory > xDocFac(  m_xModel, uno::UNO_QUERY_THROW );
             uno::Reference< document::XCodeNameQuery > xNameQuery(  xDocFac->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooo.vba.VBACodeNameProvider")) ), uno::UNO_QUERY_THROW );
             uno::Reference< uno::XInterface > xIf( xControlShape->getControl(), uno::UNO_QUERY_THROW );
-            evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf );
+            evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf, xIf ); // TODO : FIX THIS!!!
             evt.Arguments[ 0 ] = uno::makeAny( aEvt );
             xScriptListener->firing( evt );
         }
commit d2e538a63507aa3310a854d5c1414565efa3a361
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Aug 12 10:34:03 2011 -0400

    Slightly changed the API.

diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index 1301c08..e908d75 100644
--- a/forms/source/misc/InterfaceContainer.cxx
+++ b/forms/source/misc/InterfaceContainer.cxx
@@ -149,12 +149,8 @@ void OInterfaceContainer::impl_addVbEvents_nolck_nothrow(  const sal_Int32 i_nIn
                 break;
 
             rtl::OUString sCodeName;
-            {
-                Reference<XInterface> xThis = static_cast<XContainer*>(this);
-                sal_Int32 nPageIndex = xNameQuery->getPageIndexForObject(xThis);
-                if (nPageIndex >= 0)
-                    sCodeName = xNameQuery->getCodeNameByIndex(nPageIndex);
-            }
+            Reference<XInterface> xThis = static_cast<XContainer*>(this);
+            sCodeName = xNameQuery->getCodeNameForObject(xThis, xElement);
 
             Reference< XPropertySet > xProps( xElement, UNO_QUERY_THROW );
             ::rtl::OUString sServiceName;
diff --git a/offapi/com/sun/star/document/XCodeNameQuery.idl b/offapi/com/sun/star/document/XCodeNameQuery.idl
index 4cddafe..47908f0 100644
--- a/offapi/com/sun/star/document/XCodeNameQuery.idl
+++ b/offapi/com/sun/star/document/XCodeNameQuery.idl
@@ -38,11 +38,7 @@ module com {   module sun {   module star {   module document {
 interface XCodeNameQuery
 {
     //-------------------------------------------------------------------------
-    string getCodeNameForObject( [in] com::sun::star::uno::XInterface aObj );
-
-    string getCodeNameByIndex( [in] long nIndex );
-
-    long getPageIndexForObject( [in] com::sun::star::uno::XInterface aObj );
+    string getCodeNameForObject( [in] com::sun::star::uno::XInterface aContainer, [in] com::sun::star::uno::XInterface aObj );
 };
 
 //=============================================================================
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index f53fd9d..9be7c61 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -192,70 +192,16 @@ public:
 
 class ScVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNameQuery >
 {
-ScDocShell* mpDocShell;
+    ScDocShell& mrDocShell;
 public:
-    ScVbaCodeNameProvider( ScDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
+    ScVbaCodeNameProvider( ScDocShell& rDocShell ) : mrDocShell(rDocShell) {}
     // XCodeNameQuery
-    rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
+    rtl::OUString SAL_CALL getCodeNameForObject(
+        const uno::Reference<uno::XInterface>& xContainer, const uno::Reference<uno::XInterface>& /*xIf*/ )
+            throw( uno::RuntimeException )
     {
         SolarMutexGuard aGuard;
-        rtl::OUString sCodeName;
-        if ( mpDocShell )
-        {
-            OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
-            // need to find the page ( and index )  for this control
-            uno::Reference< drawing::XDrawPagesSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW );
-            uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW );
-            sal_Int32 nLen = xIndex->getCount();
-            bool bMatched = false;
-            uno::Sequence< script::ScriptEventDescriptor > aFakeEvents;
-            for ( sal_Int32 index = 0; index < nLen; ++index )
-            {
-                try
-                {
-                    uno::Reference< form::XFormsSupplier >  xFormSupplier( xIndex->getByIndex( index ), uno::UNO_QUERY_THROW );
-                    uno::Reference< container::XIndexAccess > xFormIndex( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
-                    // get the www-standard container
-                    uno::Reference< container::XIndexAccess > xFormControls( xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW );
-                    sal_Int32 nCntrls = xFormControls->getCount();
-                    for( sal_Int32 cIndex = 0; cIndex < nCntrls; ++cIndex )
-                    {
-                        uno::Reference< uno::XInterface > xControl( xFormControls->getByIndex( cIndex ), uno::UNO_QUERY_THROW );
-                        bMatched = ( xControl == xIf );
-                        if ( bMatched )
-                        {
-                            String sName;
-                            mpDocShell->GetDocument()->GetCodeName( static_cast<SCTAB>( index ), sName );
-                            sCodeName = sName;
-                        }
-                    }
-                }
-                catch( uno::Exception& ) {}
-                if ( bMatched )
-                    break;
-            }
-        }
-        // Probably should throw here ( if !bMatched )
-         return sCodeName;
-    }
-
-    rtl::OUString SAL_CALL getCodeNameByIndex( sal_Int32 nIndex ) throw (uno::RuntimeException)
-    {
-        if (!mpDocShell)
-            return rtl::OUString();
-
-        String aName;
-        if (!mpDocShell->GetDocument()->GetCodeName(static_cast<SCTAB>(nIndex), aName))
-            return rtl::OUString();
-        return aName;
-    }
-
-    sal_Int32 SAL_CALL getPageIndexForObject( const uno::Reference<uno::XInterface>& xIf ) throw(uno::RuntimeException)
-    {
-        if (!mpDocShell)
-            return -1;
-
-        uno::Reference<drawing::XDrawPagesSupplier> xSupplier(mpDocShell->GetModel(), uno::UNO_QUERY_THROW);
+        uno::Reference<drawing::XDrawPagesSupplier> xSupplier(mrDocShell.GetModel(), uno::UNO_QUERY_THROW);
         uno::Reference<container::XIndexAccess> xIndex(xSupplier->getDrawPages(), uno::UNO_QUERY_THROW);
 
         for (sal_Int32 i = 0, n = xIndex->getCount(); i < n; ++i)
@@ -266,12 +212,16 @@ public:
                 uno::Reference<container::XIndexAccess> xFormIndex(xFormSupplier->getForms(), uno::UNO_QUERY_THROW);
                 // get the www-standard container
                 uno::Reference<container::XIndexAccess> xFormControls(xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW);
-                if (xFormControls == xIf)
-                    return i;
+                if (xFormControls == xContainer)
+                {
+                    String aName;
+                    if (mrDocShell.GetDocument()->GetCodeName(static_cast<SCTAB>(i), aName))
+                        return aName;
+                }
             }
             catch( uno::Exception& ) {}
         }
-        return -1;
+        return rtl::OUString();
     }
 };
 
@@ -608,7 +558,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
             if ( pDocShell && ooo::vba::isAlienExcelDoc( *pDocShell ) && isInVBAMode( *pDocShell ) )
             {
                 OSL_TRACE("**** creating VBA Object provider");
-                xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));
+                xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider(*pDocShell)));
             }
             break;
         case SC_SERVICE_VBAGLOBALS:
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index ab4950b..735dc6b 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -106,7 +106,8 @@ class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper1< document::XCodeNam
 public:
     SwVbaCodeNameProvider( SwDocShell* pDocShell ) : mpDocShell( pDocShell ) {}
         // XCodeNameQuery
-    rtl::OUString SAL_CALL getCodeNameForObject( const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
+    rtl::OUString SAL_CALL getCodeNameForObject(
+        const uno::Reference< uno::XInterface >& /*xContainer*/, const uno::Reference< uno::XInterface >& xIf ) throw( uno::RuntimeException )
     {
         // Initialise the code name
         if ( msThisDocumentCodeName.getLength() == 0 )
commit 4fae740db79d4e7cc97440e2bab8d1ef612d9b51
Author: Noel Power <nopower at novell.com>
Date:   Fri Aug 12 00:36:51 2011 -0400

    Disable fake VBA events for the old-style form controls.

diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index 14c9f4f..6fb056e 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -597,6 +597,7 @@ OControlModel::OControlModel(
     ,m_nTabIndex(FRM_DEFAULT_TABINDEX)
     ,m_nClassId(FormComponentType::CONTROL)
     ,m_bNativeLook( sal_False )
+    ,m_bGenerateVbEvents( sal_False )
         // form controls are usually embedded into documents, not dialogs, and in documents
         // the native look is ugly ....
         // #i37342#
@@ -630,6 +631,7 @@ OControlModel::OControlModel(
         // Refcount wieder bei NULL
         decrement(m_refCount);
     }
+
 }
 
 //------------------------------------------------------------------
@@ -651,6 +653,7 @@ OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference<
     m_nTabIndex = _pOriginal->m_nTabIndex;
     m_nClassId = _pOriginal->m_nClassId;
     m_bNativeLook = _pOriginal->m_bNativeLook;
+    m_bGenerateVbEvents = _pOriginal->m_bGenerateVbEvents;
 
     if ( _bCloneAggregate )
     {
@@ -672,6 +675,7 @@ OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference<
         // decrement ref count
         decrement( m_refCount );
     }
+
 }
 
 //------------------------------------------------------------------
@@ -988,6 +992,11 @@ Any OControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const
             aReturn <<= (sal_Bool)sal_True;
             break;
 
+        case PROPERTY_ID_GENERATEVBAEVENTS:
+            aReturn <<= (sal_Bool)sal_False;
+            break;
+
+
         default:
             if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) )
                 m_aPropertyBagHelper.getDynamicPropertyDefaultByHandle( _nHandle, aReturn );
@@ -1017,6 +1026,8 @@ void OControlModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) con
         case PROPERTY_ID_NATIVE_LOOK:
             _rValue <<= (sal_Bool)m_bNativeLook;
             break;
+        case PROPERTY_ID_GENERATEVBAEVENTS:
+            _rValue <<= (sal_Bool)m_bGenerateVbEvents;
         default:
             if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) )
                 m_aPropertyBagHelper.getDynamicFastPropertyValue( _nHandle, _rValue );
@@ -1046,6 +1057,9 @@ sal_Bool OControlModel::convertFastPropertyValue(
         case PROPERTY_ID_NATIVE_LOOK:
             bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_bNativeLook);
             break;
+        case PROPERTY_ID_GENERATEVBAEVENTS:
+            bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_bGenerateVbEvents);
+            break;
         default:
             if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) )
                 bModified = m_aPropertyBagHelper.convertDynamicFastPropertyValue( _nHandle, _rValue, _rConvertedValue, _rOldValue );
@@ -1080,6 +1094,9 @@ void OControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const A
         case PROPERTY_ID_NATIVE_LOOK:
             OSL_VERIFY( _rValue >>= m_bNativeLook );
             break;
+        case PROPERTY_ID_GENERATEVBAEVENTS:
+            OSL_VERIFY( _rValue >>= m_bGenerateVbEvents );
+            break;
         default:
             if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) )
                 m_aPropertyBagHelper.setDynamicFastPropertyValue( _nHandle, _rValue );
@@ -1092,11 +1109,12 @@ void OControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const A
 //------------------------------------------------------------------------------
 void OControlModel::describeFixedProperties( Sequence< Property >& _rProps ) const
 {
-    BEGIN_DESCRIBE_BASE_PROPERTIES( 4 )
+    BEGIN_DESCRIBE_BASE_PROPERTIES( 5 )
         DECL_PROP2      (CLASSID,     sal_Int16,        READONLY, TRANSIENT);
         DECL_PROP1      (NAME,        ::rtl::OUString,  BOUND);
         DECL_BOOL_PROP2 (NATIVE_LOOK,                   BOUND, TRANSIENT);
         DECL_PROP1      (TAG,         ::rtl::OUString,  BOUND);
+        DECL_PROP1      (GENERATEVBAEVENTS,         sal_Bool,  TRANSIENT);
     END_DESCRIBE_PROPERTIES()
 }
 
diff --git a/forms/source/inc/FormComponent.hxx b/forms/source/inc/FormComponent.hxx
index 40a4a07..1041178 100644
--- a/forms/source/inc/FormComponent.hxx
+++ b/forms/source/inc/FormComponent.hxx
@@ -376,6 +376,7 @@ protected:
     sal_Int16                       m_nTabIndex;                // index within the taborder
     sal_Int16                       m_nClassId;                 // type of the control
     sal_Bool                        m_bNativeLook;              // should the control use the native platform look?
+    sal_Bool                        m_bGenerateVbEvents;        // should the control generate fake vba events
 // </properties>
 
 
diff --git a/forms/source/inc/frm_strings.hxx b/forms/source/inc/frm_strings.hxx
index 57d4ff9..b6c3e8f 100644
--- a/forms/source/inc/frm_strings.hxx
+++ b/forms/source/inc/frm_strings.hxx
@@ -327,6 +327,7 @@ namespace frm
     FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_FOCUS,  "ControlBorderColorOnFocus"   );
     FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_MOUSE,  "ControlBorderColorOnHover"   );
     FORMS_CONSTASCII_STRING( PROPERTY_CONTROL_BORDER_COLOR_INVALID,"ControlBorderColorOnInvalid" );
+    FORMS_CONSTASCII_STRING( PROPERTY_GENERATEVBAEVENTS,  "GenerateVbaEvents" );
 
     //--------------------------------------------------------------------------
     //- URLs
diff --git a/forms/source/inc/property.hrc b/forms/source/inc/property.hrc
index b0216f4..39b2f96 100644
--- a/forms/source/inc/property.hrc
+++ b/forms/source/inc/property.hrc
@@ -305,6 +305,7 @@ namespace frm
 #define PROPERTY_ID_XSD_TYPE_CLASS              ( PROPERTY_ID_START + 258 )
 
 #define PROPERTY_ID_LINEEND_FORMAT              ( PROPERTY_ID_START + 259 ) // css.awt.LineEndFormat
+#define PROPERTY_ID_GENERATEVBAEVENTS           ( PROPERTY_ID_START + 260 )
 
 // start ID fuer aggregierte Properties
 #define PROPERTY_ID_AGGREGATE_ID        (PROPERTY_ID_START + 10000)
diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index de178b8..1301c08 100644
--- a/forms/source/misc/InterfaceContainer.cxx
+++ b/forms/source/misc/InterfaceContainer.cxx
@@ -828,6 +828,14 @@ void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XProper
     sal_Bool _bEvents, ElementDescription* _pApprovalResult, sal_Bool _bFire ) throw( IllegalArgumentException )
 {
     const bool bHandleEvents = _bEvents && m_xEventAttacher.is();
+    bool bHandleVbaEvents = false;
+    try
+    {
+        _rxElement->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("GenerateVbaEvents") ) ) >>= bHandleVbaEvents;
+    }
+    catch( const Exception& )
+    {
+    }
 
     // SYNCHRONIZED ----->
     ::osl::ClearableMutexGuard aGuard( m_rMutex );
@@ -883,7 +891,7 @@ void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XProper
     // <----- SYNCHRONIZED
 
     // insert faked VBA events?
-    if ( bHandleEvents )
+    if ( bHandleVbaEvents )
     {
         Reference< XEventAttacherManager > xMgr ( pElementMetaData->xInterface, UNO_QUERY );
         if ( xMgr.is() )
diff --git a/forms/source/misc/property.cxx b/forms/source/misc/property.cxx
index 0d97609..5474c4d 100644
--- a/forms/source/misc/property.cxx
+++ b/forms/source/misc/property.cxx
@@ -241,6 +241,7 @@ void PropertyInfoService::initialize()
     ADD_PROP_ASSIGNMENT(DEFAULT_SPIN_VALUE);
     ADD_PROP_ASSIGNMENT( WRITING_MODE );
     ADD_PROP_ASSIGNMENT( CONTEXT_WRITING_MODE );
+    ADD_PROP_ASSIGNMENT( GENERATEVBAEVENTS );
 
     // now sort the array by name
 
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 0eef022..c69cc1f 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -1892,6 +1892,13 @@ bool EmbeddedControl::convertProperties( const Reference< XControlModel >& rxCtr
     {
         PropertyMap aPropMap;
         aPropMap.setProperty( PROP_Name, maName );
+        try
+        {
+            aPropMap.setProperty( PROP_GenerateVbaEvents, true);
+        }
+        catch( Exception& )
+        {
+        }
         mxModel->convertProperties( aPropMap, rConv );
         PropertySet aPropSet( rxCtrlModel );
         aPropSet.setProperties( aPropMap );
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index a4b270a..fa5b1ee 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -179,6 +179,7 @@ FormulaConvention
 Function
 GapwidthSequence
 Geometry3D
+GenerateVbaEvents
 GradientName
 Graphic
 GraphicColorMode
commit aadd74040761186497d705ce47cc956c2a3c0d77
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Aug 12 00:17:58 2011 -0400

    Let's not even fall back to the old method.

diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index e1608ec..de178b8 100644
--- a/forms/source/misc/InterfaceContainer.cxx
+++ b/forms/source/misc/InterfaceContainer.cxx
@@ -154,8 +154,6 @@ void OInterfaceContainer::impl_addVbEvents_nolck_nothrow(  const sal_Int32 i_nIn
                 sal_Int32 nPageIndex = xNameQuery->getPageIndexForObject(xThis);
                 if (nPageIndex >= 0)
                     sCodeName = xNameQuery->getCodeNameByIndex(nPageIndex);
-                else
-                    sCodeName = xNameQuery->getCodeNameForObject(xElement);
             }
 
             Reference< XPropertySet > xProps( xElement, UNO_QUERY_THROW );
commit 39b2de7545780d8897c9f28cbedfefd672cd53d7
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Aug 12 00:08:26 2011 -0400

    Code page should be the same for the same drawing page.
    
    This removes O(n^2) from the process of querying the code pages for
    form elements.

diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index 9c25049..e1608ec 100644
--- a/forms/source/misc/InterfaceContainer.cxx
+++ b/forms/source/misc/InterfaceContainer.cxx
@@ -148,7 +148,15 @@ void OInterfaceContainer::impl_addVbEvents_nolck_nothrow(  const sal_Int32 i_nIn
             if ( xElementAsForm.is() )
                 break;
 
-            ::rtl::OUString sCodeName( xNameQuery->getCodeNameForObject( xElement ) );
+            rtl::OUString sCodeName;
+            {
+                Reference<XInterface> xThis = static_cast<XContainer*>(this);
+                sal_Int32 nPageIndex = xNameQuery->getPageIndexForObject(xThis);
+                if (nPageIndex >= 0)
+                    sCodeName = xNameQuery->getCodeNameByIndex(nPageIndex);
+                else
+                    sCodeName = xNameQuery->getCodeNameForObject(xElement);
+            }
 
             Reference< XPropertySet > xProps( xElement, UNO_QUERY_THROW );
             ::rtl::OUString sServiceName;
diff --git a/offapi/com/sun/star/document/XCodeNameQuery.idl b/offapi/com/sun/star/document/XCodeNameQuery.idl
index 6c3c992..4cddafe 100644
--- a/offapi/com/sun/star/document/XCodeNameQuery.idl
+++ b/offapi/com/sun/star/document/XCodeNameQuery.idl
@@ -39,6 +39,10 @@ interface XCodeNameQuery
 {
     //-------------------------------------------------------------------------
     string getCodeNameForObject( [in] com::sun::star::uno::XInterface aObj );
+
+    string getCodeNameByIndex( [in] long nIndex );
+
+    long getPageIndexForObject( [in] com::sun::star::uno::XInterface aObj );
 };
 
 //=============================================================================
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index e83c194..f53fd9d 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -239,6 +239,40 @@ public:
          return sCodeName;
     }
 
+    rtl::OUString SAL_CALL getCodeNameByIndex( sal_Int32 nIndex ) throw (uno::RuntimeException)
+    {
+        if (!mpDocShell)
+            return rtl::OUString();
+
+        String aName;
+        if (!mpDocShell->GetDocument()->GetCodeName(static_cast<SCTAB>(nIndex), aName))
+            return rtl::OUString();
+        return aName;
+    }
+
+    sal_Int32 SAL_CALL getPageIndexForObject( const uno::Reference<uno::XInterface>& xIf ) throw(uno::RuntimeException)
+    {
+        if (!mpDocShell)
+            return -1;
+
+        uno::Reference<drawing::XDrawPagesSupplier> xSupplier(mpDocShell->GetModel(), uno::UNO_QUERY_THROW);
+        uno::Reference<container::XIndexAccess> xIndex(xSupplier->getDrawPages(), uno::UNO_QUERY_THROW);
+
+        for (sal_Int32 i = 0, n = xIndex->getCount(); i < n; ++i)
+        {
+            try
+            {
+                uno::Reference<form::XFormsSupplier>  xFormSupplier(xIndex->getByIndex(i), uno::UNO_QUERY_THROW);
+                uno::Reference<container::XIndexAccess> xFormIndex(xFormSupplier->getForms(), uno::UNO_QUERY_THROW);
+                // get the www-standard container
+                uno::Reference<container::XIndexAccess> xFormControls(xFormIndex->getByIndex(0), uno::UNO_QUERY_THROW);
+                if (xFormControls == xIf)
+                    return i;
+            }
+            catch( uno::Exception& ) {}
+        }
+        return -1;
+    }
 };
 
 //------------------------------------------------------------------------
commit bc01bc636d104b435ea5ad1dcc7cab85d6dc4b9a
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 11 14:37:19 2011 -0400

    Less indent level.

diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index e9d5229..4db4e60 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -693,32 +693,34 @@ void SAL_CALL ImplEventAttacherManager::attach(sal_Int32 nIndex, const Reference
     AttachedObject_Impl & rCurObj = aCurrentPosition->aObjList.back();
     rCurObj.aAttachedListenerSeq = Sequence< Reference< XEventListener > >( aCurrentPosition->aEventList.size() );
 
-    if (!aCurrentPosition->aEventList.empty())
+    if (aCurrentPosition->aEventList.empty())
+        return;
+
+    Sequence<com::sun::star::script::EventListener> aEvents(aCurrentPosition->aEventList.size());
+    std::deque<ScriptEventDescriptor>::iterator itr = aCurrentPosition->aEventList.begin();
+    std::deque<ScriptEventDescriptor>::iterator itrEnd = aCurrentPosition->aEventList.end();
+    ::com::sun::star::script::EventListener* p = aEvents.getArray();
+    size_t i = 0;
+    for (; itr != itrEnd; ++itr)
     {
-        Sequence<com::sun::star::script::EventListener> aEvents(aCurrentPosition->aEventList.size());
-        std::deque<ScriptEventDescriptor>::iterator itr = aCurrentPosition->aEventList.begin();
-        std::deque<ScriptEventDescriptor>::iterator itrEnd = aCurrentPosition->aEventList.end();
-        ::com::sun::star::script::EventListener* p = aEvents.getArray();
-        size_t i = 0;
-        for (; itr != itrEnd; ++itr)
-        {
-            com::sun::star::script::EventListener aListener;
-            aListener.AllListener =
-                new AttacherAllListener_Impl(this, itr->ScriptType, itr->ScriptCode);
-            aListener.Helper = rCurObj.aHelper;
-            aListener.ListenerType = itr->ListenerType;
-            aListener.EventMethod = itr->EventMethod;
-            aListener.AddListenerParam = itr->AddListenerParam;
-            p[i++] = aListener;
-        }
+        com::sun::star::script::EventListener aListener;
+        aListener.AllListener =
+            new AttacherAllListener_Impl(this, itr->ScriptType, itr->ScriptCode);
+        aListener.Helper = rCurObj.aHelper;
+        aListener.ListenerType = itr->ListenerType;
+        aListener.EventMethod = itr->EventMethod;
+        aListener.AddListenerParam = itr->AddListenerParam;
+        p[i++] = aListener;
+    }
 
-        try
-        {
-            rCurObj.aAttachedListenerSeq = xAttacher->attachMultipleEventListeners(rCurObj.xTarget, aEvents);
-        }
-        catch (const Exception&)
-        {
-        }
+    try
+    {
+        rCurObj.aAttachedListenerSeq =
+            xAttacher->attachMultipleEventListeners(rCurObj.xTarget, aEvents);
+    }
+    catch (const Exception&)
+    {
+        // Fail gracefully.
     }
 }
 
commit 0bacaf4ef5574b87d2c6020fa057f7e89de6eb76
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 11 11:55:46 2011 -0400

    Reduce indentation level.

diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index 06d4834..29954d9 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -654,70 +654,70 @@ Reference<XEventListener> EventAttacherImpl::attachListenerForTarget(
         // Is it the correct method?
         OUString aMethName = rxMethod->getName();
 
-        if( aAddListenerName == aMethName )
-        {
-            Sequence< Reference< XIdlClass > > params = rxMethod->getParameterTypes();
-            sal_uInt32 nParamCount = params.getLength();
+        if (aAddListenerName != aMethName)
+            continue;
 
-            Reference< XIdlClass > xListenerType;
-            if( nParamCount == 1 )
-                xListenerType = params.getConstArray()[0];
-            else if( nParamCount == 2 )
-                xListenerType = params.getConstArray()[1];
+        Sequence< Reference< XIdlClass > > params = rxMethod->getParameterTypes();
+        sal_uInt32 nParamCount = params.getLength();
 
-            // Request Adapter for the actual Listener type
-            Reference< XInterface > xAdapter = createAllListenerAdapter(
-                xInvocationAdapterFactory, xListenerType, xAllListener, aHelper );
+        Reference< XIdlClass > xListenerType;
+        if( nParamCount == 1 )
+            xListenerType = params.getConstArray()[0];
+        else if( nParamCount == 2 )
+            xListenerType = params.getConstArray()[1];
 
-            if( !xAdapter.is() )
-                throw CannotCreateAdapterException();
-            xRet = Reference< XEventListener >( xAdapter, UNO_QUERY );
+        // Request Adapter for the actual Listener type
+        Reference< XInterface > xAdapter = createAllListenerAdapter(
+            xInvocationAdapterFactory, xListenerType, xAllListener, aHelper );
 
-            // Just the Listener as parameter?
-            if( nParamCount == 1 )
+        if( !xAdapter.is() )
+            throw CannotCreateAdapterException();
+        xRet = Reference< XEventListener >( xAdapter, UNO_QUERY );
+
+        // Just the Listener as parameter?
+        if( nParamCount == 1 )
+        {
+            Sequence< Any > args( 1 );
+            args.getArray()[0] <<= xAdapter;
+            try
             {
-                Sequence< Any > args( 1 );
-                args.getArray()[0] <<= xAdapter;
-                try
-                {
-                    rxMethod->invoke( aObject, args );
-                }
-                catch( InvocationTargetException& )
-                {
-                    throw IntrospectionException();
-                }
+                rxMethod->invoke( aObject, args );
             }
-            // Else, pass the other parameter now
-            else if( nParamCount == 2 )
+            catch( InvocationTargetException& )
             {
-                Sequence< Any > args( 2 );
-                Any* pAnys = args.getArray();
+                throw IntrospectionException();
+            }
+        }
+        // Else, pass the other parameter now
+        else if( nParamCount == 2 )
+        {
+            Sequence< Any > args( 2 );
+            Any* pAnys = args.getArray();
 
-                // Check the type of the 1st parameter
-                Reference< XIdlClass > xParamClass = params.getConstArray()[0];
-                if( xParamClass->getTypeClass() == TypeClass_STRING )
-                {
-                    pAnys[0] <<= aAddListenerParam;
-                }
+            // Check the type of the 1st parameter
+            Reference< XIdlClass > xParamClass = params.getConstArray()[0];
+            if( xParamClass->getTypeClass() == TypeClass_STRING )
+            {
+                pAnys[0] <<= aAddListenerParam;
+            }
 
-                // 2nd Parameter == Listener? TODO: Test!
-                pAnys[1] <<= xAdapter;
+            // 2nd Parameter == Listener? TODO: Test!
+            pAnys[1] <<= xAdapter;
 
-                // TODO: Convert String -> ?
-                // else
-                try
-                {
-                    rxMethod->invoke( aObject, args );
-                }
-                catch( InvocationTargetException& )
-                {
-                    throw IntrospectionException();
-                }
+            // TODO: Convert String -> ?
+            // else
+            try
+            {
+                rxMethod->invoke( aObject, args );
+            }
+            catch( InvocationTargetException& )
+            {
+                throw IntrospectionException();
             }
-            break;
-            // else...
-            // Anything else is not supported
         }
+        break;
+        // else...
+        // Anything else is not supported
     }
 
     return xRet;
commit 23e922056586ee96b54d1e0540a54bce845b091b
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 11 11:54:13 2011 -0400

    Some micro-optimization with the string objects.

diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index 8aaaace..06d4834 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -633,26 +633,21 @@ Reference<XEventListener> EventAttacherImpl::attachListenerForTarget(
     Reference< XEventListener > xRet = NULL;
 
     // Construct the name of the addListener-Method.
-    OUString aAddListenerName;
-    OUString aListenerName( aListenerType );
-    sal_Int32 nIndex = aListenerName.lastIndexOf( '.' );
+    sal_Int32 nIndex = aListenerType.lastIndexOf('.');
     // set index to the interface name without package name
     if( nIndex == -1 )
         // not found
         nIndex = 0;
     else
         nIndex++;
-    if( aListenerName[nIndex] == 'X' )
-        // erase X from the interface name
-        aListenerName = aListenerName.copy( nIndex +1 );
-    aAddListenerName = OUString( RTL_CONSTASCII_USTRINGPARAM( "add" ) ) + aListenerName;
+
+    OUString aListenerName = (aListenerType[nIndex] == 'X') ? aListenerType.copy(nIndex+1) : aListenerType;
+    OUString aAddListenerName = OUString(RTL_CONSTASCII_USTRINGPARAM("add")) + aListenerName;
 
     // Send Methods to the correct addListener-Method
     Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER );
-    sal_uInt32 i, nLen = aMethodSeq.getLength();
     const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray();
-
-    for( i = 0 ; i < nLen ; i++ )
+    for (sal_Int32 i = 0, n = aMethodSeq.getLength(); i < n ; ++i)
     {
         const Reference< XIdlMethod >& rxMethod = pMethods[i];
 
@@ -678,7 +673,6 @@ Reference<XEventListener> EventAttacherImpl::attachListenerForTarget(
                 throw CannotCreateAdapterException();
             xRet = Reference< XEventListener >( xAdapter, UNO_QUERY );
 
-
             // Just the Listener as parameter?
             if( nParamCount == 1 )
             {
commit 5b55512e9ed418f8d22c800e58da0101ef243a12
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 11 11:45:59 2011 -0400

    And use it from the multi-listener regstration code.

diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index 7c2bdf5..8aaaace 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -770,107 +770,9 @@ Sequence< Reference<XEventListener> > EventAttacherImpl::attachListeners(
 
     for (sal_Int32 i = 0; i < nCount; ++i)
     {
-        Reference<XEventListener> xRet = NULL;
-
-        const Reference<XAllListener>& AllListener = aListeners[i].AllListener;
-        const Any& Helper = aListeners[i].Helper;
-        const OUString& ListenerType = aListeners[i].ListenerType;
-        const OUString& AddListenerParam = aListeners[i].AddListenerParam;
-
-        // Construct the name of the addListener-Method.
-        OUString aAddListenerName;
-        OUString aListenerName( ListenerType );
-        sal_Int32 nIndex = aListenerName.lastIndexOf( '.' );
-        // set index to the interface name without package name
-        if( nIndex == -1 )
-            // not found
-            nIndex = 0;
-        else
-            nIndex++;
-        if( aListenerName[nIndex] == 'X' )
-            // erase X from the interface name
-            aListenerName = aListenerName.copy( nIndex +1 );
-        aAddListenerName = OUString( RTL_CONSTASCII_USTRINGPARAM( "add" ) ) + aListenerName;
-
-        // Send Methods to the correct addListener-Method
-        Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER );
-        sal_uInt32 j, nLen = aMethodSeq.getLength();
-        const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray();
-
-        for( j = 0 ; j < nLen ; j++ )
-        {
-            const Reference< XIdlMethod >& rxMethod = pMethods[j];
-
-            // Is it the correct method?
-            OUString aMethName = rxMethod->getName();
-
-            if( aAddListenerName == aMethName )
-            {
-                Sequence< Reference< XIdlClass > > params = rxMethod->getParameterTypes();
-                sal_uInt32 nParamCount = params.getLength();
-
-                Reference< XIdlClass > xListenerType;
-                if( nParamCount == 1 )
-                    xListenerType = params.getConstArray()[0];
-                else if( nParamCount == 2 )
-                    xListenerType = params.getConstArray()[1];
-
-                // Request Adapter for the actual Listener type
-                Reference< XInterface > xAdapter = createAllListenerAdapter
-                    ( xInvocationAdapterFactory, xListenerType, AllListener, Helper );
-
-                if( !xAdapter.is() )
-                    throw CannotCreateAdapterException();
-                xRet = Reference< XEventListener >( xAdapter, UNO_QUERY );
-
-
-                // Just the Listener as parameter?
-                if( nParamCount == 1 )
-                {
-                    Sequence< Any > args( 1 );
-                    args.getArray()[0] <<= xAdapter;
-                    try
-                    {
-                        rxMethod->invoke( aObjAny, args );
-                    }
-                    catch( InvocationTargetException& )
-                    {
-                        throw IntrospectionException();
-                    }
-                }
-                // Else, pass the other parameter now
-                else if( nParamCount == 2 )
-                {
-                    Sequence< Any > args( 2 );
-                    Any* pAnys = args.getArray();
-
-                    // Check the type of the 1st parameter
-                    Reference< XIdlClass > xParamClass = params.getConstArray()[0];
-                    if( xParamClass->getTypeClass() == TypeClass_STRING )
-                    {
-                        pAnys[0] <<= AddListenerParam;
-                    }
-
-                    // 2nd Parameter == Listener? TODO: Test!
-                    pAnys[1] <<= xAdapter;
-
-                    // TODO: Convert String -> ?
-                    // else
-                    try
-                    {
-                        rxMethod->invoke( aObjAny, args );
-                    }
-                    catch( InvocationTargetException& )
-                    {
-                        throw IntrospectionException();
-                    }
-                }
-                break;
-                // else...
-                // Anything else is not supported
-            }
-        }
-        pArray[i] = xRet;
+        pArray[i] = attachListenerForTarget(
+            xAccess, xInvocationAdapterFactory, aListeners[i].AllListener,
+            aObjAny, aListeners[i].Helper, aListeners[i].ListenerType, aListeners[i].AddListenerParam);
     }
 
     return aRet;
commit 9cf2d46b29f278e42c38b56bd3b6ac5b4adf9b42
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 11 11:41:11 2011 -0400

    Extracted a method that will be called from another method.

diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index 7987968..7c2bdf5 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -257,6 +257,15 @@ public:
     friend class FilterAllListenerImpl;
 
 private:
+    Reference<XEventListener> attachListenerForTarget(
+        const Reference<XIntrospectionAccess>& xAccess,
+        const Reference<XInvocationAdapterFactory>& xInvocationAdapterFactory,
+        const Reference<XAllListener>& xAllListener,
+        const Any& aObject,
+        const Any& aHelper,
+        const OUString& aListenerType,
+        const OUString& aAddListenerParam );
+
     Sequence< Reference<XEventListener> > attachListeners(
         const Reference<XInterface>& xObject,
         const Sequence< Reference<XAllListener> >& AllListeners,
@@ -584,8 +593,6 @@ Reference< XEventListener > EventAttacherImpl::attachListener
     if( !xObject.is() || !AllListener.is() )
         throw IllegalArgumentException();
 
-    Reference< XEventListener > xRet = NULL;
-
     Reference< XInvocationAdapterFactory > xInvocationAdapterFactory = getInvocationAdapterService();
     if( !xInvocationAdapterFactory.is() )
         throw ServiceNotRegisteredException();
@@ -600,18 +607,34 @@ Reference< XEventListener > EventAttacherImpl::attachListener
     // of the Introspection configurable for this purpose.
     Reference< XIntrospection > xIntrospection = getIntrospection();
     if( !xIntrospection.is() )
-        return xRet;
+        return Reference<XEventListener>();
 
     // Inspect Introspection
     Any aObjAny( &xObject, ::getCppuType( (const Reference< XInterface > *)0) );
 
     Reference< XIntrospectionAccess > xAccess = xIntrospection->inspect( aObjAny );
     if( !xAccess.is() )
-        return xRet;
+        return Reference<XEventListener>();
+
+    return attachListenerForTarget(
+        xAccess, xInvocationAdapterFactory, AllListener, aObjAny, Helper,
+        ListenerType, AddListenerParam);
+}
+
+Reference<XEventListener> EventAttacherImpl::attachListenerForTarget(
+    const Reference<XIntrospectionAccess>& xAccess,
+    const Reference<XInvocationAdapterFactory>& xInvocationAdapterFactory,
+    const Reference<XAllListener>& xAllListener,
+    const Any& aObject,
+    const Any& aHelper,
+    const OUString& aListenerType,
+    const OUString& aAddListenerParam)
+{
+    Reference< XEventListener > xRet = NULL;
 
     // Construct the name of the addListener-Method.
     OUString aAddListenerName;
-    OUString aListenerName( ListenerType );
+    OUString aListenerName( aListenerType );
     sal_Int32 nIndex = aListenerName.lastIndexOf( '.' );
     // set index to the interface name without package name
     if( nIndex == -1 )
@@ -648,8 +671,8 @@ Reference< XEventListener > EventAttacherImpl::attachListener
                 xListenerType = params.getConstArray()[1];
 
             // Request Adapter for the actual Listener type
-            Reference< XInterface > xAdapter = createAllListenerAdapter
-                ( xInvocationAdapterFactory, xListenerType, AllListener, Helper );
+            Reference< XInterface > xAdapter = createAllListenerAdapter(
+                xInvocationAdapterFactory, xListenerType, xAllListener, aHelper );
 
             if( !xAdapter.is() )
                 throw CannotCreateAdapterException();
@@ -663,7 +686,7 @@ Reference< XEventListener > EventAttacherImpl::attachListener
                 args.getArray()[0] <<= xAdapter;
                 try
                 {
-                    rxMethod->invoke( aObjAny, args );
+                    rxMethod->invoke( aObject, args );
                 }
                 catch( InvocationTargetException& )
                 {
@@ -680,7 +703,7 @@ Reference< XEventListener > EventAttacherImpl::attachListener
                 Reference< XIdlClass > xParamClass = params.getConstArray()[0];
                 if( xParamClass->getTypeClass() == TypeClass_STRING )
                 {
-                    pAnys[0] <<= AddListenerParam;
+                    pAnys[0] <<= aAddListenerParam;
                 }
 
                 // 2nd Parameter == Listener? TODO: Test!
@@ -690,7 +713,7 @@ Reference< XEventListener > EventAttacherImpl::attachListener
                 // else
                 try
                 {
-                    rxMethod->invoke( aObjAny, args );
+                    rxMethod->invoke( aObject, args );
                 }
                 catch( InvocationTargetException& )
                 {
commit 85696df0b13e18f3782d196f50baa06bf099e0ef
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Thu Aug 11 00:46:42 2011 -0400

    Fixed a crash due to invalid index for Sequence.
    
    With this, 3.81 sec -> 1.2 sec.

diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index f7a7d76..e9d5229 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -47,7 +47,7 @@
 #include <com/sun/star/reflection/XIdlMethod.hpp>
 #include <com/sun/star/script/XTypeConverter.hpp>
 #include <com/sun/star/script/XEngineListener.hpp>
-#include <com/sun/star/script/XEventAttacher.hpp>
+#include <com/sun/star/script/XEventAttacher2.hpp>
 #include <com/sun/star/script/XEventAttacherManager.hpp>
 #include <com/sun/star/script/XScriptListener.hpp>
 #include <cppuhelper/weak.hxx>
@@ -103,7 +103,7 @@ class ImplEventAttacherManager
     // Container fuer die ScriptListener
     OInterfaceContainerHelper           aScriptListeners;
     // EventAttacher-Instanz
-    Reference< XEventAttacher >         xAttacher;
+    Reference< XEventAttacher2 >        xAttacher;
     Reference< XMultiServiceFactory >   mxSMgr;
     Reference< XIdlReflection >         mxCoreReflection;
     Reference< XIntrospection >         mxIntrospection;
@@ -403,7 +403,7 @@ ImplEventAttacherManager::ImplEventAttacherManager( const Reference< XIntrospect
         Reference< XInterface > xIFace( rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.EventAttacher" )) ) );
         if ( xIFace.is() )
         {
-            xAttacher = Reference< XEventAttacher >::query( xIFace );
+            xAttacher = Reference< XEventAttacher2 >::query( xIFace );
         }
         xIFace = rSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.Converter" )) );
         if ( xIFace.is() )
@@ -692,28 +692,33 @@ void SAL_CALL ImplEventAttacherManager::attach(sal_Int32 nIndex, const Reference
     //::std::deque< AttachedObject_Impl >::iterator aObjIt = (*aIt).aObjList.back();
     AttachedObject_Impl & rCurObj = aCurrentPosition->aObjList.back();
     rCurObj.aAttachedListenerSeq = Sequence< Reference< XEventListener > >( aCurrentPosition->aEventList.size() );
-    Reference< XEventListener > * pArray = rCurObj.aAttachedListenerSeq.getArray();
 
-    ::std::deque< ScriptEventDescriptor >::iterator aEvtIt =    aCurrentPosition->aEventList.begin();
-    ::std::deque< ScriptEventDescriptor >::iterator aEvtEnd =   aCurrentPosition->aEventList.end();
-    sal_Int32 i = 0;
-    while( aEvtIt != aEvtEnd )
+    if (!aCurrentPosition->aEventList.empty())
     {
-        Reference< XAllListener > xAll =
-            new AttacherAllListener_Impl( this, (*aEvtIt).ScriptType, (*aEvtIt).ScriptCode );
-        Reference< XEventListener > xAdapter;
-           try
+        Sequence<com::sun::star::script::EventListener> aEvents(aCurrentPosition->aEventList.size());
+        std::deque<ScriptEventDescriptor>::iterator itr = aCurrentPosition->aEventList.begin();
+        std::deque<ScriptEventDescriptor>::iterator itrEnd = aCurrentPosition->aEventList.end();
+        ::com::sun::star::script::EventListener* p = aEvents.getArray();
+        size_t i = 0;
+        for (; itr != itrEnd; ++itr)
         {
-        xAdapter = xAttacher->attachSingleEventListener( rCurObj.xTarget, xAll,
-                        rCurObj.aHelper, (*aEvtIt).ListenerType,
-                        (*aEvtIt).AddListenerParam, (*aEvtIt).EventMethod );
+            com::sun::star::script::EventListener aListener;
+            aListener.AllListener =
+                new AttacherAllListener_Impl(this, itr->ScriptType, itr->ScriptCode);
+            aListener.Helper = rCurObj.aHelper;
+            aListener.ListenerType = itr->ListenerType;
+            aListener.EventMethod = itr->EventMethod;
+            aListener.AddListenerParam = itr->AddListenerParam;
+            p[i++] = aListener;
         }
-        catch( Exception& )
+
+        try
+        {
+            rCurObj.aAttachedListenerSeq = xAttacher->attachMultipleEventListeners(rCurObj.xTarget, aEvents);
+        }
+        catch (const Exception&)
         {
         }
-
-        pArray[i++] = xAdapter;
-        ++aEvtIt;
     }
 }
 
diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index 7deb811..7987968 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -743,6 +743,7 @@ Sequence< Reference<XEventListener> > EventAttacherImpl::attachListeners(
         return Sequence< Reference<XEventListener> >();
 
     Sequence< Reference<XEventListener> > aRet(nCount);
+    Reference<XEventListener>* pArray = aRet.getArray();
 
     for (sal_Int32 i = 0; i < nCount; ++i)
     {
@@ -846,7 +847,7 @@ Sequence< Reference<XEventListener> > EventAttacherImpl::attachListeners(
                 // Anything else is not supported
             }
         }
-        aRet[nCount] = xRet;
+        pArray[i] = xRet;
     }
 
     return aRet;
commit 98dc4bb8a1d029ba8b01504b74ed5397e1e7164b
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Aug 10 23:00:18 2011 -0400

    Extended UNO's script API to allow adding of multiple listeners at once.

diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index 95d352f..7deb811 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -33,7 +33,7 @@
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <com/sun/star/beans/XIntrospection.hpp>
 #include <com/sun/star/beans/MethodConcept.hpp>
-#include <com/sun/star/script/XEventAttacher.hpp>
+#include <com/sun/star/script/XEventAttacher2.hpp>
 #include <com/sun/star/script/XTypeConverter.hpp>
 #include <com/sun/star/script/XAllListener.hpp>
 #include <com/sun/star/script/XInvocationAdapterFactory.hpp>
@@ -214,7 +214,7 @@ sal_Bool SAL_CALL InvocationToAllListenerMapper::hasProperty(const OUString& Nam
 //  class EventAttacherImpl
 //  represents an implementation of the EventAttacher service
 //*************************************************************************
-class EventAttacherImpl : public WeakImplHelper3 < XEventAttacher, XInitialization, XServiceInfo >
+class EventAttacherImpl : public WeakImplHelper3 < XEventAttacher2, XInitialization, XServiceInfo >
 {
 public:
     EventAttacherImpl( const Reference< XMultiServiceFactory >& );
@@ -246,10 +246,22 @@ public:
             const Reference< XEventListener >& aToRemoveListener)
         throw( IllegalArgumentException, IntrospectionException, RuntimeException );
 
+    // XEventAttacher2
+    virtual Sequence< Reference<XEventListener> > SAL_CALL attachMultipleEventListeners(
+        const Reference<XInterface>& xObject, const Sequence<com::sun::star::script::EventListener>& aListeners )
+            throw( IllegalArgumentException, ServiceNotRegisteredException, CannotCreateAdapterException, IntrospectionException, RuntimeException );
+
     // used by FilterAllListener_Impl
     Reference< XTypeConverter > getConverter() throw( Exception );
 
     friend class FilterAllListenerImpl;
+
+private:
+    Sequence< Reference<XEventListener> > attachListeners(
+        const Reference<XInterface>& xObject,
+        const Sequence< Reference<XAllListener> >& AllListeners,
+        const Sequence<com::sun::star::script::EventListener>& aListeners );
+
 private:
     Mutex                               m_aMutex;
     Reference< XMultiServiceFactory >   m_xSMgr;
@@ -694,6 +706,152 @@ Reference< XEventListener > EventAttacherImpl::attachListener
     return xRet;
 }
 
+Sequence< Reference<XEventListener> > EventAttacherImpl::attachListeners(
+    const Reference<XInterface>& xObject,
+    const Sequence< Reference<XAllListener> >& AllListeners,
+    const Sequence<com::sun::star::script::EventListener>& aListeners )
+{
+    sal_Int32 nCount = aListeners.getLength();
+    if (nCount != AllListeners.getLength())
+        // This is a prerequisite!
+        throw RuntimeException();
+
+    if (!xObject.is())
+        throw IllegalArgumentException();
+
+    Reference< XInvocationAdapterFactory > xInvocationAdapterFactory = getInvocationAdapterService();
+    if( !xInvocationAdapterFactory.is() )
+        throw ServiceNotRegisteredException();
+
+    Reference< XIdlReflection > xReflection = getReflection();
+    if( !xReflection.is() )
+        throw ServiceNotRegisteredException();
+
+    // Sign in, Call the fitting addListener method
+    // First Introspection, as the Methods can be analyzed in the same way
+    // For better perfomance it is implemented here again or make the Impl-Method
+    // of the Introspection configurable for this purpose.
+    Reference< XIntrospection > xIntrospection = getIntrospection();
+    if( !xIntrospection.is() )
+        return Sequence< Reference<XEventListener> >();
+
+    // Inspect Introspection
+    Any aObjAny( &xObject, ::getCppuType(static_cast<const Reference<XInterface>*>(0)) );
+
+    Reference<XIntrospectionAccess> xAccess = xIntrospection->inspect(aObjAny);
+    if (!xAccess.is())
+        return Sequence< Reference<XEventListener> >();
+
+    Sequence< Reference<XEventListener> > aRet(nCount);
+
+    for (sal_Int32 i = 0; i < nCount; ++i)
+    {
+        Reference<XEventListener> xRet = NULL;
+
+        const Reference<XAllListener>& AllListener = aListeners[i].AllListener;
+        const Any& Helper = aListeners[i].Helper;
+        const OUString& ListenerType = aListeners[i].ListenerType;
+        const OUString& AddListenerParam = aListeners[i].AddListenerParam;
+
+        // Construct the name of the addListener-Method.
+        OUString aAddListenerName;
+        OUString aListenerName( ListenerType );
+        sal_Int32 nIndex = aListenerName.lastIndexOf( '.' );
+        // set index to the interface name without package name
+        if( nIndex == -1 )
+            // not found
+            nIndex = 0;
+        else
+            nIndex++;
+        if( aListenerName[nIndex] == 'X' )
+            // erase X from the interface name
+            aListenerName = aListenerName.copy( nIndex +1 );
+        aAddListenerName = OUString( RTL_CONSTASCII_USTRINGPARAM( "add" ) ) + aListenerName;
+
+        // Send Methods to the correct addListener-Method
+        Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER );
+        sal_uInt32 j, nLen = aMethodSeq.getLength();
+        const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray();
+
+        for( j = 0 ; j < nLen ; j++ )
+        {
+            const Reference< XIdlMethod >& rxMethod = pMethods[j];
+
+            // Is it the correct method?
+            OUString aMethName = rxMethod->getName();
+
+            if( aAddListenerName == aMethName )
+            {
+                Sequence< Reference< XIdlClass > > params = rxMethod->getParameterTypes();
+                sal_uInt32 nParamCount = params.getLength();
+
+                Reference< XIdlClass > xListenerType;
+                if( nParamCount == 1 )
+                    xListenerType = params.getConstArray()[0];
+                else if( nParamCount == 2 )
+                    xListenerType = params.getConstArray()[1];
+
+                // Request Adapter for the actual Listener type
+                Reference< XInterface > xAdapter = createAllListenerAdapter
+                    ( xInvocationAdapterFactory, xListenerType, AllListener, Helper );
+
+                if( !xAdapter.is() )
+                    throw CannotCreateAdapterException();
+                xRet = Reference< XEventListener >( xAdapter, UNO_QUERY );
+
+
+                // Just the Listener as parameter?
+                if( nParamCount == 1 )
+                {
+                    Sequence< Any > args( 1 );
+                    args.getArray()[0] <<= xAdapter;
+                    try
+                    {
+                        rxMethod->invoke( aObjAny, args );
+                    }
+                    catch( InvocationTargetException& )
+                    {
+                        throw IntrospectionException();
+                    }
+                }
+                // Else, pass the other parameter now
+                else if( nParamCount == 2 )
+                {
+                    Sequence< Any > args( 2 );
+                    Any* pAnys = args.getArray();
+
+                    // Check the type of the 1st parameter
+                    Reference< XIdlClass > xParamClass = params.getConstArray()[0];
+                    if( xParamClass->getTypeClass() == TypeClass_STRING )
+                    {
+                        pAnys[0] <<= AddListenerParam;
+                    }
+
+                    // 2nd Parameter == Listener? TODO: Test!
+                    pAnys[1] <<= xAdapter;
+
+                    // TODO: Convert String -> ?
+                    // else
+                    try
+                    {
+                        rxMethod->invoke( aObjAny, args );
+                    }
+                    catch( InvocationTargetException& )
+                    {
+                        throw IntrospectionException();
+                    }
+                }
+                break;
+                // else...
+                // Anything else is not supported
+            }
+        }
+        aRet[nCount] = xRet;
+    }
+
+    return aRet;
+}
+
 // XEventAttacher
 Reference< XEventListener > EventAttacherImpl::attachSingleEventListener
 (
@@ -817,6 +975,21 @@ void EventAttacherImpl::removeListener
     }
 }
 
+Sequence< Reference<XEventListener> > EventAttacherImpl::attachMultipleEventListeners(
+    const Reference<XInterface>& xObject, const Sequence<com::sun::star::script::EventListener>& aListeners )

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list