[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - 3 commits - sfx2/source

Rafael Dominguez venccsralph at gmail.com
Wed Apr 10 01:31:07 PDT 2013


 sfx2/source/control/templatelocalview.cxx |    4 +-
 sfx2/source/control/thumbnailview.cxx     |   42 ++++++++++++++++++++----------
 sfx2/source/control/thumbnailviewacc.cxx  |    2 -
 3 files changed, 31 insertions(+), 17 deletions(-)

New commits:
commit c5a8e0f1dc87ebba5a4ae79fdcdfbdd4aaebce87
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sun Apr 7 21:17:51 2013 -0430

    Fetch thumbnails position and id from filter array instead."
    
    Change-Id: I35bd8b47eeba3e2f8e2ea74afbf1fe8e48390bab
    Reviewed-on: https://gerrit.libreoffice.org/3299
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

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 @@ void ThumbnailView::RemoveItem( sal_uInt16 nItemId )
     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 @@ void ThumbnailView::RemoveItem( sal_uInt16 nItemId )
         }
 
         delete *it;
-        mItemList.erase( it );
+        mFilteredItemList.erase( it );
+        mpStartSelRange = mFilteredItemList.end();
     }
 
     // reset variables
@@ -1026,8 +1039,8 @@ void ThumbnailView::updateItems (const std::vector<ThumbnailViewItem*> &items)
 
 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 @@ size_t ThumbnailView::GetItemPos( sal_uInt16 nItemId ) const
 
 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 @@ void ThumbnailView::SelectItem( sal_uInt16 nItemId )
     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 @@ void ThumbnailView::DeselectItem( sal_uInt16 nItemId )
     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 @@ bool ThumbnailView::IsItemSelected( sal_uInt16 nItemId ) const
     if ( nItemPos == THUMBNAILVIEW_ITEM_NOTFOUND )
         return false;
 
-    ThumbnailViewItem* pItem = mItemList[nItemPos];
+    ThumbnailViewItem* pItem = mFilteredItemList[nItemPos];
     return pItem->isSelected();
 }
 
@@ -1201,7 +1214,7 @@ OUString ThumbnailView::GetItemText( sal_uInt16 nItemId ) const
     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 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewAcc::getAcces
 
         if( THUMBNAILVIEW_ITEM_NONEITEM != nItemPos )
         {
-            ThumbnailViewItem *const pItem = mpParent->mItemList[nItemPos];
+            ThumbnailViewItem *const pItem = mpParent->mFilteredItemList[nItemPos];
             xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
         }
     }
commit 15bef20d72eec275a238084994634a5cc262a354
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sun Apr 7 21:16:55 2013 -0430

    Update template item path when moving it to another folder.
    
    Change-Id: I4de701e32dfe1244ba29704633d7d15f829a9e7a
    Reviewed-on: https://gerrit.libreoffice.org/3298
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 6dd82df..a4437c3 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -398,7 +398,7 @@ bool TemplateLocalView::moveTemplate (const ThumbnailViewItem *pItem, const sal_
         aTemplateItem.nDocId = nTargetIdx;
         aTemplateItem.nRegionId = nTargetRegion;
         aTemplateItem.aName = pViewItem->maTitle;
-        aTemplateItem.aPath = pViewItem->getPath();
+        aTemplateItem.aPath = mpDocTemplates->GetPath(nTargetRegion,nTargetIdx);
         aTemplateItem.aThumbnail = pViewItem->maPreview1;
 
         pTarget->maTemplates.push_back(aTemplateItem);
@@ -495,7 +495,7 @@ bool TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
             aTemplateItem.nDocId = nTargetIdx;
             aTemplateItem.nRegionId = nTargetRegion;
             aTemplateItem.aName = pViewItem->maTitle;
-            aTemplateItem.aPath = pViewItem->getPath();
+            aTemplateItem.aPath = mpDocTemplates->GetPath(nTargetRegion,nTargetIdx);
             aTemplateItem.aThumbnail = pViewItem->maPreview1;
 
             pTarget->maTemplates.push_back(aTemplateItem);
commit 35dc1e6bdcd912c074ef99d695618a5317d8b0be
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sun Apr 7 18:08:24 2013 -0430

    Mark thumbnailview item as unselected when updating filter.
    
    Change-Id: Ifc98603045364419a6f76316fea96c2e668c333e
    Reviewed-on: https://gerrit.libreoffice.org/3297
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 8d03d5a..a122080 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -1253,6 +1253,7 @@ void ThumbnailView::filterItems (const boost::function<bool (const ThumbnailView
                 }
 
                 pItem->show(false);
+                pItem->setSelection(false);
 
                 maItemStateHdl.Call(pItem);
             }


More information about the Libreoffice-commits mailing list