Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3299

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/99/3299/1

Fetch thumbnails position and id from filter array instead."

Change-Id: I35bd8b47eeba3e2f8e2ea74afbf1fe8e48390bab
---
M sfx2/source/control/thumbnailview.cxx
M sfx2/source/control/thumbnailviewacc.cxx
2 files changed, 28 insertions(+), 15 deletions(-)



diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index a122080..d08173c 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -971,8 +971,20 @@
     if ( nPos == THUMBNAILVIEW_ITEM_NOTFOUND )
         return;
 
-    if ( nPos < mItemList.size() ) {
-        ValueItemList::iterator it = mItemList.begin();
+    if ( nPos < mFilteredItemList.size() ) {
+
+        // delete item from the thumbnail list
+        for (size_t i = 0, n = mItemList.size(); i < n; ++i)
+        {
+            if (mItemList[i]->mnId == nItemId)
+            {
+                mItemList.erase(mItemList.begin()+i);
+                break;
+            }
+        }
+
+        // delete item from the filter item list
+        ValueItemList::iterator it = mFilteredItemList.begin();
         ::std::advance( it, nPos );
 
         if ((*it)->isSelected())
@@ -982,7 +994,8 @@
         }
 
         delete *it;
-        mItemList.erase( it );
+        mFilteredItemList.erase( it );
+        mpStartSelRange = mFilteredItemList.end();
     }
 
     // reset variables
@@ -1026,8 +1039,8 @@
 
 size_t ThumbnailView::GetItemPos( sal_uInt16 nItemId ) const
 {
-    for ( size_t i = 0, n = mItemList.size(); i < n; ++i ) {
-        if ( mItemList[i]->mnId == nItemId ) {
+    for ( size_t i = 0, n = mFilteredItemList.size(); i < n; ++i ) {
+        if ( mFilteredItemList[i]->mnId == nItemId ) {
             return i;
         }
     }
@@ -1036,7 +1049,7 @@
 
 sal_uInt16 ThumbnailView::GetItemId( size_t nPos ) const
 {
-    return ( nPos < mItemList.size() ) ? mItemList[nPos]->mnId : 0 ;
+    return ( nPos < mFilteredItemList.size() ) ? mFilteredItemList[nPos]->mnId : 0 ;
 }
 
 sal_uInt16 ThumbnailView::GetItemId( const Point& rPos ) const
@@ -1073,11 +1086,11 @@
     if ( nItemPos == THUMBNAILVIEW_ITEM_NOTFOUND )
         return;
 
-    ThumbnailViewItem* pItem = mItemList[nItemPos];
+    ThumbnailViewItem* pItem = mFilteredItemList[nItemPos];
     if (!pItem->isSelected())
     {
-        mItemList[nItemPos]->setSelection(true);
-        maItemStateHdl.Call(mItemList[nItemPos]);
+        pItem->setSelection(true);
+        maItemStateHdl.Call(pItem);
 
         if (IsReallyVisible() && IsUpdateMode())
             Invalidate();
@@ -1156,11 +1169,11 @@
     if ( nItemPos == THUMBNAILVIEW_ITEM_NOTFOUND )
         return;
 
-    ThumbnailViewItem* pItem = mItemList[nItemPos];
+    ThumbnailViewItem* pItem = mFilteredItemList[nItemPos];
     if (pItem->isSelected())
     {
-        mItemList[nItemPos]->setSelection(false);
-        maItemStateHdl.Call(mItemList[nItemPos]);
+        pItem->setSelection(false);
+        maItemStateHdl.Call(pItem);
 
         if (IsReallyVisible() && IsUpdateMode())
             Invalidate();
@@ -1175,7 +1188,7 @@
     if ( nItemPos == THUMBNAILVIEW_ITEM_NOTFOUND )
         return false;
 
-    ThumbnailViewItem* pItem = mItemList[nItemPos];
+    ThumbnailViewItem* pItem = mFilteredItemList[nItemPos];
     return pItem->isSelected();
 }
 
@@ -1201,7 +1214,7 @@
     size_t nPos = GetItemPos( nItemId );
 
     if ( nPos != THUMBNAILVIEW_ITEM_NOTFOUND )
-        return mItemList[nPos]->maTitle;
+        return mFilteredItemList[nPos]->maTitle;
 
     return OUString();
 }
diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx
index 393bd9e..c89f1b0 100644
--- a/sfx2/source/control/thumbnailviewacc.cxx
+++ b/sfx2/source/control/thumbnailviewacc.cxx
@@ -350,7 +350,7 @@
 
         if( THUMBNAILVIEW_ITEM_NONEITEM != nItemPos )
         {
-            ThumbnailViewItem *const pItem = mpParent->mItemList[nItemPos];
+            ThumbnailViewItem *const pItem = mpParent->mFilteredItemList[nItemPos];
             xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
         }
     }

-- 
To view, visit https://gerrit.libreoffice.org/3299
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I35bd8b47eeba3e2f8e2ea74afbf1fe8e48390bab
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Rafael Dominguez <venccsralph@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.