[PATCH] Remove InvalidSlot svArray stuff in FmXFormShell

Nigel Hawkins n.hawkins at gmx.com
Wed Feb 9 06:32:28 PST 2011


---
 svx/source/form/fmshimp.cxx |   19 ++++++-------------
 svx/source/inc/fmshimp.hxx  |    8 ++++++--
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index aa36fa5..32a3c9d 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -116,6 +116,7 @@
 
 #include <algorithm>
 #include <functional>
+#include <vector>
 
 // wird fuer Invalidate verwendet -> mitpflegen
 sal_uInt16 DatabaseSlotMap[] =
@@ -1050,9 +1051,8 @@ void FmXFormShell::InvalidateSlot( sal_Int16 nId, sal_Bool bWithId )
     ::osl::MutexGuard aGuard(m_aInvalidationSafety);
     if (m_nLockSlotInvalidation)
     {
-        m_arrInvalidSlots.Insert(nId, m_arrInvalidSlots.Count());
         BYTE nFlags = ( bWithId ? 0x01 : 0 );
-        m_arrInvalidSlots_Flags.Insert(nFlags, m_arrInvalidSlots_Flags.Count());
+        m_arrInvalidSlots.push_back( InvalidSlotInfo(nId, nFlags) );
     }
     else
         if (nId)
@@ -1090,21 +1090,14 @@ IMPL_LINK(FmXFormShell, OnInvalidateSlots, void*, EMPTYARG)
     ::osl::MutexGuard aGuard(m_aInvalidationSafety);
     m_nInvalidationEvent = 0;
 
-    DBG_ASSERT(m_arrInvalidSlots.Count() == m_arrInvalidSlots_Flags.Count(),
-        "FmXFormShell::OnInvalidateSlots : inconsistent slot arrays !");
-    BYTE nFlags;
-    for (sal_Int16 i=0; i<m_arrInvalidSlots.Count(); ++i)
+    for (std::vector<InvalidSlotInfo>::const_iterator i = m_arrInvalidSlots.begin(); i < m_arrInvalidSlots.end(); ++i)
     {
-        nFlags = m_arrInvalidSlots_Flags[i];
-
-        if (m_arrInvalidSlots[i])
-            m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(m_arrInvalidSlots[i], sal_True, (nFlags & 0x01));
+        if (i->id)
+            m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(i->id, sal_True, (i->flags & 0x01));
         else
             m_pShell->GetViewShell()->GetViewFrame()->GetBindings().InvalidateShell(*m_pShell);
     }
-
-    m_arrInvalidSlots.Remove(0, m_arrInvalidSlots.Count());
-    m_arrInvalidSlots_Flags.Remove(0, m_arrInvalidSlots_Flags.Count());
+    m_arrInvalidSlots.clear();
     return 0L;
 }
 
diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx
index c085544..8ae5b1b 100644
--- a/svx/source/inc/fmshimp.hxx
+++ b/svx/source/inc/fmshimp.hxx
@@ -180,8 +180,12 @@ class SAL_DLLPRIVATE FmXFormShell   :public FmXFormShell_BASE
         // We enable a permanent cursor for the grid we found a searched text, it's disabled in the next "found" event.
     FmFormArray			m_aSearchForms;
 
-    SvUShorts	m_arrInvalidSlots;
-    SvBytes		m_arrInvalidSlots_Flags;
+    struct InvalidSlotInfo {
+        USHORT id;
+        BYTE   flags;
+        inline InvalidSlotInfo(USHORT slotId, BYTE flgs) : id(slotId), flags(flgs) {};
+    };
+    std::vector<InvalidSlotInfo> m_arrInvalidSlots;
         // we explicitly switch off the propbrw before leaving the design mode
         // this flag tells us if we have to switch it on again when reentering
 
-- 
1.7.0.4


--=-3gvhF3EAUfv3ax8v6tF4
Content-Disposition: attachment; filename="0001-Remove-SvBytes-completely.patch"
Content-Type: text/x-patch; name="0001-Remove-SvBytes-completely.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit



More information about the LibreOffice mailing list