diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-05-05 20:48:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-05-06 15:04:02 +0000 |
commit | 325f51e94639f1a9e0d0c60159bfcf3070409640 (patch) | |
tree | 0bbe2a3f894bb40c9e86d7578b62deba55e43fc0 | |
parent | e2f38ef8b6a5e30bee9e05fba7aec47287dddae4 (diff) |
fdo#76261 Get rid of unneeded and malfunctioning maItemListRect.
maItemListRect serves as a sort of bounding box for what items /could/
be visible on screen, however it is only used for determining the id
of an item we have just clicked on -- given that we already know that
we are clicking inside the visible area this is an unnecessary check.
In fact this check is erronous as we no longer limit ourselves to "whole"
rows as of 806919adf9c9bafbaba92c2d2ab35d2e2f9863f8 -- i.e. the previous
assumption was that a view large enough for n rows will show precisely
n (whole) rows, whereas we might be showing (n-1) complete rows, and a
fraction of a row at the top and bottom of the screen, i.e. a total of
n+1 rows, where maItemRect only encloses the top n rows, meaning we
were erronously ignoring clicks on the (partly visible) lowest n+1 row.
Change-Id: Ia52ed2e0d217a9f077cef86ee9c1847252844995
(cherry picked from commit fb0ca7eff0e16fa8dd1a4c8d75fef23830903a3f)
Reviewed-on: https://gerrit.libreoffice.org/9255
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/sfx2/thumbnailview.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/control/thumbnailview.cxx | 14 |
2 files changed, 3 insertions, 12 deletions
diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx index 851eba07060d..bac63c022667 100644 --- a/include/sfx2/thumbnailview.hxx +++ b/include/sfx2/thumbnailview.hxx @@ -316,7 +316,6 @@ protected: ThumbnailValueItemList mFilteredItemList; ///< Cache to store the filtered items ThumbnailValueItemList::iterator mpStartSelRange; ScrollBar* mpScrBar; - Rectangle maItemListRect; long mnHeaderHeight; long mnItemWidth; long mnItemHeight; diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 814a8d752368..c97ecd6acbe5 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -364,11 +364,6 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed) size_t nFirstItem = (bScrollBarUsed ? nHiddenLines : mnFirstLine) * mnCols; size_t nLastItem = nFirstItem + (mnVisLines + 1) * mnCols; - maItemListRect.Left() = x; - maItemListRect.Top() = y; - maItemListRect.Right() = x + mnCols*(mnItemWidth+nHItemSpace) - nHItemSpace - 1; - maItemListRect.Bottom() = y + mnVisLines*(mnItemHeight+nVItemSpace) - nVItemSpace - 1; - // If want also draw parts of items in the last line, // then we add one more line if parts of these line are // visible @@ -463,13 +458,10 @@ size_t ThumbnailView::ImplGetItem( const Point& rPos ) const return THUMBNAILVIEW_ITEM_NOTFOUND; } - if ( maItemListRect.IsInside( rPos ) ) + for (size_t i = 0; i < mFilteredItemList.size(); ++i) { - for (size_t i = 0; i < mFilteredItemList.size(); ++i) - { - if (mFilteredItemList[i]->isVisible() && mFilteredItemList[i]->getDrawArea().IsInside(rPos)) - return i; - } + if (mFilteredItemList[i]->isVisible() && mFilteredItemList[i]->getDrawArea().IsInside(rPos)) + return i; } return THUMBNAILVIEW_ITEM_NOTFOUND; |