From d98ac11f3962f39efb1418588c609d03fb7cc37c Mon Sep 17 00:00:00 2001
From: Matus Kukan <matus.kukan@gmail.com>
Date: Sun, 3 Jul 2011 13:59:22 +0200
Subject: Remove component_getImplementationEnvironment

---
 forms/source/misc/services.cxx | 6 ------
 1 file changed, 6 deletions(-)

(limited to 'forms/source')

diff --git a/forms/source/misc/services.cxx b/forms/source/misc/services.cxx
index 25cb3f797e39..988d5efde488 100644
--- a/forms/source/misc/services.cxx
+++ b/forms/source/misc/services.cxx
@@ -320,12 +320,6 @@ void SAL_CALL createRegistryInfo_FORMS()
     }
 }
 
-//---------------------------------------------------------------------------------------
-SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char** _ppEnvTypeName, uno_Environment** /*_ppEnv*/)
-{
-    *_ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
 //---------------------------------------------------------------------------------------
 SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* _pImplName, XMultiServiceFactory* _pServiceManager, void* /*_pRegistryKey*/)
 {
-- 
cgit 


From 27f16c19cdf0bc835d83fa3fec720495c5f91605 Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei.yoshida@suse.com>
Date: Thu, 4 Aug 2011 20:53:44 -0400
Subject: Use rtl::OUStringHash.

---
 forms/source/inc/InterfaceContainer.hxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'forms/source')

diff --git a/forms/source/inc/InterfaceContainer.hxx b/forms/source/inc/InterfaceContainer.hxx
index 88c25d99259b..ae22dbe452e7 100644
--- a/forms/source/inc/InterfaceContainer.hxx
+++ b/forms/source/inc/InterfaceContainer.hxx
@@ -83,7 +83,7 @@ namespace frm
     };
 
 typedef ::std::vector<InterfaceRef> OInterfaceArray;
-typedef ::boost::unordered_multimap< ::rtl::OUString, InterfaceRef, ::comphelper::UStringHash, ::comphelper::UStringEqual> OInterfaceMap;
+typedef ::boost::unordered_multimap< ::rtl::OUString, InterfaceRef, ::rtl::OUStringHash, ::comphelper::UStringEqual> OInterfaceMap;
 
 //==================================================================
 // OInterfaceContainer
-- 
cgit 


From da41ba97d3ac0eb751dfc4b716bd594d1670c77e Mon Sep 17 00:00:00 2001
From: Julien Nabet <serval2412@yahoo.fr>
Date: Tue, 9 Aug 2011 00:17:54 +0200
Subject: Some cppcheck cleaning

---
 forms/source/xforms/binding.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'forms/source')

diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx
index 7389eabb4409..26287236f3a5 100644
--- a/forms/source/xforms/binding.cxx
+++ b/forms/source/xforms/binding.cxx
@@ -661,7 +661,7 @@ void Binding::bind( bool bForceRebind )
     ::std::vector<EvaluationContext> aMIPContexts = _getMIPEvaluationContexts();
     for( ::std::vector<EvaluationContext>::iterator aIter = aMIPContexts.begin();
          aIter != aMIPContexts.end();
-         aIter++ )
+         ++aIter )
     {
         EvaluationContext& rContext = *aIter;
 
-- 
cgit 


From 58ee09b87b11a6a6b56a06f772214e8835810bd3 Mon Sep 17 00:00:00 2001
From: Caolán McNamara <caolanm@redhat.com>
Date: Fri, 12 Aug 2011 10:17:16 +0100
Subject: ByteString, shrink api

---
 forms/source/component/DatabaseForm.cxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'forms/source')

diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index 9ac10191d04d..c09e9f6cf3b9 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -2189,9 +2189,9 @@ void lcl_dispatch(const Reference< XFrame >& xFrame,const Reference<XURLTransfor
         aArgs.getArray()[0].Value <<= aReferer;
 
         // build a sequence from the to-be-submitted string
-        ByteString a8BitData(aData.getStr(), (sal_uInt16)aData.getLength(), _eEncoding);
+        rtl::OString a8BitData(rtl::OUStringToOString(aData, _eEncoding));
             // always ANSI #58641
-        Sequence< sal_Int8 > aPostData((sal_Int8*)a8BitData.GetBuffer(), a8BitData.Len());
+        Sequence< sal_Int8 > aPostData((const sal_Int8*)a8BitData.getStr(), a8BitData.getLength());
         Reference< XInputStream > xPostData = new SequenceInputStream(aPostData);
 
         aArgs.getArray()[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PostData") );
-- 
cgit 


From 39b2de7545780d8897c9f28cbedfefd672cd53d7 Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei.yoshida@suse.com>
Date: Fri, 12 Aug 2011 00:08:26 -0400
Subject: 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.
---
 forms/source/misc/InterfaceContainer.cxx | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'forms/source')

diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index 9c25049affb8..e1608ec1d4d2 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;
-- 
cgit 


From aadd74040761186497d705ce47cc956c2a3c0d77 Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei.yoshida@suse.com>
Date: Fri, 12 Aug 2011 00:17:58 -0400
Subject: Let's not even fall back to the old method.

---
 forms/source/misc/InterfaceContainer.cxx | 2 --
 1 file changed, 2 deletions(-)

(limited to 'forms/source')

diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index e1608ec1d4d2..de178b800dd3 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 );
-- 
cgit 


From 4fae740db79d4e7cc97440e2bab8d1ef612d9b51 Mon Sep 17 00:00:00 2001
From: Noel Power <nopower@novell.com>
Date: Fri, 12 Aug 2011 00:36:51 -0400
Subject: Disable fake VBA events for the old-style form controls.

---
 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 | 10 +++++++++-
 forms/source/misc/property.cxx           |  1 +
 6 files changed, 32 insertions(+), 2 deletions(-)

(limited to 'forms/source')

diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index 14c9f4fce067..6fb056ea9447 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 40a4a0705ca5..104117856f33 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 57d4ff9bccd5..b6c3e8fcce79 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 b0216f4f63b6..39b2f9694c26 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 de178b800dd3..1301c08c255d 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 0d97609f0eb7..5474c4d730dd 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
 
-- 
cgit 


From d2e538a63507aa3310a854d5c1414565efa3a361 Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei.yoshida@suse.com>
Date: Fri, 12 Aug 2011 10:34:03 -0400
Subject: Slightly changed the API.

---
 forms/source/misc/InterfaceContainer.cxx | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

(limited to 'forms/source')

diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index 1301c08c255d..e908d75472c1 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;
-- 
cgit 


From c8f40655eac948bb8b7c9387e7333160c0088f4f Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei.yoshida@suse.com>
Date: Sat, 13 Aug 2011 01:20:31 -0400
Subject: Keep the container and object separate methods.

ScVbaControl doesn't have any container instance to pass to the
old method.
---
 forms/source/misc/InterfaceContainer.cxx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'forms/source')

diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx
index e908d75472c1..af244143f69e 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;
-- 
cgit