diff options
22 files changed, 56 insertions, 294 deletions
diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx index 0ab599ecc43b..4eb7e6f6c687 100644 --- a/sfx2/inc/sfx2/templateabstractview.hxx +++ b/sfx2/inc/sfx2/templateabstractview.hxx @@ -106,7 +106,7 @@ public: void setOverlayItemStateHdl (const Link &aLink) { maOverlayItemStateHdl = aLink; } - void setOverlayClickHdl (const Link &rLink); + void setOverlayDblClickHdl (const Link &rLink); void setOverlayCloseHdl (const Link &rLink); @@ -122,15 +122,11 @@ protected: virtual void DrawItem (ThumbnailViewItem *pItem); - virtual void OnSelectionMode (bool bMode); - DECL_LINK(OverlayItemStateHdl, const ThumbnailViewItem*); - DECL_LINK(OverlaySelectionModeHdl, bool*); protected: TemplateView *mpItemView; - bool mbInSelectionModeHdl; Link maOverlayItemStateHdl; }; diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx index 58debca6b941..9a101f271e99 100644 --- a/sfx2/inc/sfx2/templatelocalview.hxx +++ b/sfx2/inc/sfx2/templatelocalview.hxx @@ -75,7 +75,7 @@ public: private: - virtual void OnItemClicked (ThumbnailViewItem *pRegionItem); + virtual void OnItemDblClicked (ThumbnailViewItem *pRegionItem); DECL_LINK(ChangeNameHdl, TemplateView*); diff --git a/sfx2/inc/sfx2/templatelocalviewitem.hxx b/sfx2/inc/sfx2/templatelocalviewitem.hxx index 80330b25889d..739f70ed46af 100644 --- a/sfx2/inc/sfx2/templatelocalviewitem.hxx +++ b/sfx2/inc/sfx2/templatelocalviewitem.hxx @@ -22,7 +22,7 @@ public: BitmapEx maPreview2; std::vector<TemplateItemProperties> maTemplates; - TemplateLocalViewItem (ThumbnailView &rView, Window *pParent); + TemplateLocalViewItem (ThumbnailView &rView); virtual ~TemplateLocalViewItem (); diff --git a/sfx2/inc/sfx2/templateremoteviewitem.hxx b/sfx2/inc/sfx2/templateremoteviewitem.hxx index 396b9652e4ee..63f2c7d8ce20 100644 --- a/sfx2/inc/sfx2/templateremoteviewitem.hxx +++ b/sfx2/inc/sfx2/templateremoteviewitem.hxx @@ -17,7 +17,7 @@ class TemplateRemoteViewItem : public ThumbnailViewItem { public: - TemplateRemoteViewItem (ThumbnailView &rView, Window *pParent); + TemplateRemoteViewItem (ThumbnailView &rView); virtual ~TemplateRemoteViewItem (); diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx index fee955b52301..881c68dc3514 100644 --- a/sfx2/inc/sfx2/templateview.hxx +++ b/sfx2/inc/sfx2/templateview.hxx @@ -37,7 +37,7 @@ public: void InsertItems (const std::vector<TemplateItemProperties> &rTemplates); - void setClickHdl (const Link &rLink) { maClickHdl = rLink; } + void setDblClickHdl (const Link &rLink) { maDblClickHdl = rLink; } void setChangeNameHdl (const Link &rLink) { maChangeNameHdl = rLink; } @@ -49,7 +49,7 @@ protected: virtual void MouseButtonDown (const MouseEvent &rMEvt); - virtual void OnItemClicked (ThumbnailViewItem *pItem); + virtual void OnItemDblClicked (ThumbnailViewItem *pItem); DECL_LINK (ChangeNameHdl, void*); @@ -59,7 +59,7 @@ private: bool mbRenderTitle; sal_uInt16 mnId; OUString maName; - Link maClickHdl; + Link maDblClickHdl; Link maChangeNameHdl; Link maCloseHdl; diff --git a/sfx2/inc/sfx2/templateviewitem.hxx b/sfx2/inc/sfx2/templateviewitem.hxx index 992af40f1dea..9a7d35850c1b 100644 --- a/sfx2/inc/sfx2/templateviewitem.hxx +++ b/sfx2/inc/sfx2/templateviewitem.hxx @@ -16,7 +16,7 @@ class TemplateViewItem : public ThumbnailViewItem { public: - TemplateViewItem (ThumbnailView &rView, Window *pParent); + TemplateViewItem (ThumbnailView &rView); virtual ~TemplateViewItem (); diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx index 023c56965e70..6ebe23f2ddec 100644 --- a/sfx2/inc/sfx2/thumbnailview.hxx +++ b/sfx2/inc/sfx2/thumbnailview.hxx @@ -233,15 +233,12 @@ public: long GetScrollWidth() const; - void setSelectionMode (bool mode); - void filterItems (const boost::function<bool (const ThumbnailViewItem*) > &func); void sortItems (const boost::function<bool (const ThumbnailViewItem*, const ThumbnailViewItem*) > &func); void setItemStateHdl (const Link &aLink) { maItemStateHdl = aLink; } - void setSelectionModeHdl (const Link &aLink) { maSelectionModeHdl = aLink; } protected: @@ -249,8 +246,6 @@ protected: virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void Command( const CommandEvent& rCEvt ); virtual void Paint( const Rectangle& rRect ); @@ -275,9 +270,7 @@ protected: virtual void DrawItem (ThumbnailViewItem *pItem); - virtual void OnSelectionMode (bool bMode); - - virtual void OnItemClicked (ThumbnailViewItem *pItem); + virtual void OnItemDblClicked (ThumbnailViewItem *pItem); protected: @@ -327,11 +320,9 @@ protected: bool mbScroll : 1; bool mbIsTransientChildrenDisabled : 1; bool mbHasVisibleItems : 1; - bool mbSelectionMode; Color maColor; Link maItemStateHdl; - Link maSelectionModeHdl; ThumbnailItemAttributes *mpItemAttrs; drawinglayer::processor2d::BaseProcessor2D *mpProcessor; boost::function<bool (const ThumbnailViewItem*) > maFilterFunc; diff --git a/sfx2/inc/sfx2/thumbnailviewitem.hxx b/sfx2/inc/sfx2/thumbnailviewitem.hxx index 96cdc5ce790c..0a7f08acd5ec 100644 --- a/sfx2/inc/sfx2/thumbnailviewitem.hxx +++ b/sfx2/inc/sfx2/thumbnailviewitem.hxx @@ -71,7 +71,7 @@ public: rtl::OUString maTitle; ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >* mpxAcc; - ThumbnailViewItem (ThumbnailView &rView, Window *pParent); + ThumbnailViewItem (ThumbnailView &rView); virtual ~ThumbnailViewItem (); @@ -102,8 +102,6 @@ public: const Point& getPrev1Pos () const { return maPrev1Pos; } - void setSelectionMode (bool mode); - void setSelectClickHdl (const Link &link); virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor, @@ -112,18 +110,12 @@ public: static drawinglayer::primitive2d::BorderLinePrimitive2D* createBorderLine (const basegfx::B2DPoint &rStart, const basegfx::B2DPoint &rEnd); -private: - - DECL_LINK (OnClick, CheckBox *); - protected: - bool mbMode; Point maTextPos; Point maPrev1Pos; Rectangle maDrawArea; Link maClickHdl; - CheckBox *mpSelectBox; }; #endif // THUMBNAILVIEWITEM_HXX diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index 8e70039d14c1..c0d1284249c5 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -57,9 +57,6 @@ private: DECL_LINK(CloseOverlayHdl, void*); - DECL_LINK(OnClickSelectionMode, ImageButton*); - DECL_LINK(SelectionModeHdl, bool*); - DECL_LINK(TBXViewHdl, void*); DECL_LINK(TBXActionHdl, void*); DECL_LINK(TBXTemplateHdl, void*); @@ -124,7 +121,6 @@ private: PushButton aButtonPresents; PushButton aButtonSheets; PushButton aButtonDraws; - ImageButton maButtonSelMode; Control *mpToolbars; Edit *mpSearchEdit; @@ -143,7 +139,6 @@ private: std::set<const ThumbnailViewItem*> maSelFolders; bool mbIsSaveMode; ///< Flag that indicates if we are in save mode or not. - bool mbInSelectionModeHdl; ///< Flag avoiding selection mode handler loop com::sun::star::uno::Reference< com::sun::star::frame::XModel > m_xModel; com::sun::star::uno::Reference< com::sun::star::frame::XComponentLoader > mxDesktop; }; diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx index dd004490659a..5d5cd3ea1970 100644 --- a/sfx2/source/control/templateabstractview.cxx +++ b/sfx2/source/control/templateabstractview.cxx @@ -59,20 +59,16 @@ bool ViewFilter_Keyword::operator ()(const ThumbnailViewItem *pItem) TemplateAbstractView::TemplateAbstractView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren) : ThumbnailView(pParent,nWinStyle,bDisableTransientChildren), - mpItemView(new TemplateView(this)), - mbInSelectionModeHdl(false) + mpItemView(new TemplateView(this)) { mpItemView->setItemStateHdl(LINK(this,TemplateAbstractView,OverlayItemStateHdl)); - mpItemView->setSelectionModeHdl(LINK(this,TemplateAbstractView,OverlaySelectionModeHdl)); } TemplateAbstractView::TemplateAbstractView(Window *pParent, const ResId &rResId, bool bDisableTransientChildren) : ThumbnailView(pParent,rResId,bDisableTransientChildren), - mpItemView(new TemplateView(this)), - mbInSelectionModeHdl(false) + mpItemView(new TemplateView(this)) { mpItemView->setItemStateHdl(LINK(this,TemplateAbstractView,OverlayItemStateHdl)); - mpItemView->setSelectionModeHdl(LINK(this,TemplateAbstractView,OverlaySelectionModeHdl)); } TemplateAbstractView::~TemplateAbstractView () @@ -124,9 +120,9 @@ void TemplateAbstractView::filterTemplatesByKeyword(const OUString &rKeyword) mpItemView->filterItems(ViewFilter_Keyword(rKeyword)); } -void TemplateAbstractView::setOverlayClickHdl(const Link &rLink) +void TemplateAbstractView::setOverlayDblClickHdl(const Link &rLink) { - mpItemView->setClickHdl(rLink); + mpItemView->setDblClickHdl(rLink); } void TemplateAbstractView::setOverlayCloseHdl(const Link &rLink) @@ -287,36 +283,10 @@ void TemplateAbstractView::DrawItem(ThumbnailViewItem *pItem) ThumbnailView::DrawItem(pItem); } -void TemplateAbstractView::OnSelectionMode (bool bMode) -{ - if (!mbInSelectionModeHdl) - { - if (mpItemView->IsVisible()) - { - mbSelectionMode = bMode; - mpItemView->setSelectionMode(bMode); - } - else - ThumbnailView::OnSelectionMode(bMode); - } -} - IMPL_LINK(TemplateAbstractView, OverlayItemStateHdl, const ThumbnailViewItem*, pItem) { maOverlayItemStateHdl.Call((void*)pItem); return 0; } -IMPL_LINK(TemplateAbstractView, OverlaySelectionModeHdl, bool*, pMode) -{ - mbInSelectionModeHdl = true; - setSelectionMode(*pMode); - if (!*pMode) - { - deselectOverlayItems(); - } - mbInSelectionModeHdl = false; - return 0; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index 15e3b8dfa99d..b261e34aceb4 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -128,7 +128,7 @@ void TemplateLocalView::Populate () aRegionName += "..."; } - TemplateLocalViewItem* pItem = new TemplateLocalViewItem( *this, this ); + TemplateLocalViewItem* pItem = new TemplateLocalViewItem( *this ); pItem->mnId = i+1; pItem->maTitle = aRegionName; pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected)); @@ -224,8 +224,6 @@ void TemplateLocalView::showOverlay (bool bVisible) } mpItemView->Clear(); - - setSelectionMode(mbSelectionMode); } } @@ -278,7 +276,7 @@ sal_uInt16 TemplateLocalView::createRegion(const OUString &rName) aRegionName += "..."; } - TemplateLocalViewItem* pItem = new TemplateLocalViewItem( *this, this ); + TemplateLocalViewItem* pItem = new TemplateLocalViewItem( *this ); pItem->mnId = nRegionId+1; pItem->maTitle = aRegionName; pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected)); @@ -702,7 +700,7 @@ bool TemplateLocalView::isTemplateNameUnique(const sal_uInt16 nRegionItemId, con return true; } -void TemplateLocalView::OnItemClicked (ThumbnailViewItem *pRegionItem) +void TemplateLocalView::OnItemDblClicked (ThumbnailViewItem *pRegionItem) { // Fill templates sal_uInt16 nRegionId = pRegionItem->mnId-1; @@ -711,9 +709,6 @@ void TemplateLocalView::OnItemClicked (ThumbnailViewItem *pRegionItem) mpItemView->setName(mpDocTemplates->GetRegionName(nRegionId)); mpItemView->InsertItems(static_cast<TemplateLocalViewItem*>(pRegionItem)->maTemplates); - if (mbSelectionMode) - mpItemView->setSelectionMode(true); - mpItemView->filterItems(ViewFilter_Application(meFilterOption)); showOverlay(true); diff --git a/sfx2/source/control/templatelocalviewitem.cxx b/sfx2/source/control/templatelocalviewitem.cxx index 7ba11837de06..544b86a4a81c 100644 --- a/sfx2/source/control/templatelocalviewitem.cxx +++ b/sfx2/source/control/templatelocalviewitem.cxx @@ -26,8 +26,8 @@ using namespace basegfx::tools; using namespace drawinglayer::attribute; using namespace drawinglayer::primitive2d; -TemplateLocalViewItem::TemplateLocalViewItem (ThumbnailView &rView, Window *pParent) - : ThumbnailViewItem(rView,pParent) +TemplateLocalViewItem::TemplateLocalViewItem (ThumbnailView &rView) + : ThumbnailViewItem(rView) { } @@ -137,9 +137,6 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p Color(COL_BLACK).getBColor() ) ); pProcessor->process(aSeq); - - if (mbMode || mbHover || mbSelected) - mpSelectBox->Paint(maDrawArea); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx index 776bab1513e2..24ee41d36542 100644 --- a/sfx2/source/control/templateremoteview.cxx +++ b/sfx2/source/control/templateremoteview.cxx @@ -78,7 +78,7 @@ void TemplateRemoteView::Populate() for (sal_Int32 i = 0; i < aUrls.getLength() && i < aNames.getLength(); ++i) { - TemplateRemoteViewItem *pItem = new TemplateRemoteViewItem(*this,this); + TemplateRemoteViewItem *pItem = new TemplateRemoteViewItem(*this); pItem->mnId = i+1; pItem->maTitle = aNames[i]; @@ -107,8 +107,6 @@ void TemplateRemoteView::showOverlay (bool bVisible) if (!bVisible) { mpItemView->Clear(); - - setSelectionMode(mbSelectionMode); } } @@ -261,7 +259,7 @@ bool TemplateRemoteView::insertRepository(const OUString &rName, const OUString return false; } - TemplateRemoteViewItem *pItem = new TemplateRemoteViewItem(*this,this); + TemplateRemoteViewItem *pItem = new TemplateRemoteViewItem(*this); pItem->mnId = maRepositories.size()+1; pItem->maTitle = rName; diff --git a/sfx2/source/control/templateremoteviewitem.cxx b/sfx2/source/control/templateremoteviewitem.cxx index cb6de5e7c029..626786f84794 100644 --- a/sfx2/source/control/templateremoteviewitem.cxx +++ b/sfx2/source/control/templateremoteviewitem.cxx @@ -9,8 +9,8 @@ #include <sfx2/templateremoteviewitem.hxx> -TemplateRemoteViewItem::TemplateRemoteViewItem (ThumbnailView &rView, Window *pParent) - : ThumbnailViewItem(rView,pParent) +TemplateRemoteViewItem::TemplateRemoteViewItem (ThumbnailView &rView) + : ThumbnailViewItem(rView) { } diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx index 24554fb00905..775abbc09d4b 100644 --- a/sfx2/source/control/templatesearchview.cxx +++ b/sfx2/source/control/templatesearchview.cxx @@ -25,7 +25,7 @@ void TemplateSearchView::AppendItem(sal_uInt16 nItemId, sal_uInt16 nRegionId, sa const OUString &rPath, const BitmapEx &rImage) { - TemplateSearchViewItem *pItem = new TemplateSearchViewItem(*this,this); + TemplateSearchViewItem *pItem = new TemplateSearchViewItem(*this); pItem->mnId = nItemId; pItem->mnIdx = nIdx; pItem->mnRegionId = nRegionId; diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx index 1156fa82b79e..0892a158e0bc 100644 --- a/sfx2/source/control/templateview.cxx +++ b/sfx2/source/control/templateview.cxx @@ -108,7 +108,7 @@ void TemplateView::InsertItems (const std::vector<TemplateItemProperties> &rTemp { for (size_t i = 0, n = rTemplates.size(); i < n; ++i ) { - TemplateViewItem *pItem = new TemplateViewItem(*this,this); + TemplateViewItem *pItem = new TemplateViewItem(*this); const TemplateItemProperties *pCur = &rTemplates[i]; pItem->mnId = pCur->nId; @@ -208,9 +208,9 @@ void TemplateView::MouseButtonDown (const MouseEvent &rMEvt) ThumbnailView::MouseButtonDown(rMEvt); } -void TemplateView::OnItemClicked(ThumbnailViewItem *pItem) +void TemplateView::OnItemDblClicked(ThumbnailViewItem *pItem) { - maClickHdl.Call(pItem); + maDblClickHdl.Call(pItem); } IMPL_LINK_NOARG(TemplateView, ChangeNameHdl) diff --git a/sfx2/source/control/templateviewitem.cxx b/sfx2/source/control/templateviewitem.cxx index 2c27e5f7b16b..e2abf71a8ca2 100644 --- a/sfx2/source/control/templateviewitem.cxx +++ b/sfx2/source/control/templateviewitem.cxx @@ -27,8 +27,8 @@ using namespace basegfx::tools; using namespace drawinglayer::attribute; using namespace drawinglayer::primitive2d; -TemplateViewItem::TemplateViewItem (ThumbnailView &rView, Window *pParent) - : ThumbnailViewItem(rView,pParent) +TemplateViewItem::TemplateViewItem (ThumbnailView &rView) + : ThumbnailViewItem(rView) { } @@ -136,9 +136,6 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces } pProcessor->process(aSeq); - - if (mbMode || mbHover || mbSelected) - mpSelectBox->Paint(maDrawArea); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index 32571b78d07a..db8d6261da8f 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -98,7 +98,6 @@ void ThumbnailView::ImplInit() mnSpacing = 0; mbScroll = false; mbHasVisibleItems = false; - mbSelectionMode = false; maFilterFunc = ViewFilterAll(); maColor = GetSettings().GetStyleSettings().GetFieldColor(); @@ -197,21 +196,7 @@ void ThumbnailView::DrawItem (ThumbnailViewItem *pItem) } } -void ThumbnailView::OnSelectionMode (bool bMode) -{ - if ( !bMode ) - deselectItems(); - - for (size_t i = 0, n = mItemList.size(); i < n; ++i) - { - mItemList[i]->setSelectionMode(bMode); - - if (mItemList[i]->isVisible()) - DrawItem(mItemList[i]); - } -} - -void ThumbnailView::OnItemClicked (ThumbnailViewItem*) +void ThumbnailView::OnItemDblClicked (ThumbnailViewItem*) { } @@ -508,51 +493,40 @@ IMPL_LINK (ThumbnailView, OnItemSelected, ThumbnailViewItem*, pItem) void ThumbnailView::MouseButtonDown( const MouseEvent& rMEvt ) { - bool bProcessClick = rMEvt.IsLeft(); - - if ( rMEvt.IsRight( ) ) - { - // Set selection mode with right click - if (!mbSelectionMode) - { - setSelectionMode( true ); - bProcessClick = true; - } - } - - if ( bProcessClick ) + if ( rMEvt.IsLeft() ) { ThumbnailViewItem* pItem = ImplGetItem( ImplGetItem( rMEvt.GetPosPixel() ) ); if (pItem && pItem->isVisible()) { - if ( !rMEvt.IsMod2() ) + if ( rMEvt.GetClicks() == 1 ) { - if ( rMEvt.GetClicks() == 1 ) - { - if (mbSelectionMode) - { - pItem->setSelection(!pItem->isSelected()); + if (!pItem->isSelected() && !rMEvt.IsMod1()) + deselectItems( ); + pItem->setSelection(!pItem->isSelected()); - if (!pItem->isHighlighted()) - DrawItem(pItem); + if (!pItem->isHighlighted()) + DrawItem(pItem); - maItemStateHdl.Call(pItem); - } - else - { - Rectangle aRect(pItem->getDrawArea()); - aRect.SetSize(Size(mnItemWidth,mnThumbnailHeight)); + maItemStateHdl.Call(pItem); + } + else if ( rMEvt.GetClicks() == 2 ) + { + // The mouse button down event 1 click right before is pointless + pItem->setSelection(!pItem->isSelected()); + maItemStateHdl.Call(pItem); - if (!mbSelectionMode && aRect.IsInside(rMEvt.GetPosPixel())) - OnItemClicked(pItem); - } - } + Rectangle aRect(pItem->getDrawArea()); + aRect.SetSize(Size(mnItemWidth,mnThumbnailHeight)); + + if (aRect.IsInside(rMEvt.GetPosPixel())) + OnItemDblClicked(pItem); } return; } } + Control::MouseButtonDown( rMEvt ); } @@ -561,56 +535,6 @@ void ThumbnailView::MouseButtonUp( const MouseEvent& rMEvt ) Control::MouseButtonUp( rMEvt ); } -void ThumbnailView::MouseMove( const MouseEvent& rMEvt ) -{ - ThumbnailViewItem* pItem = ImplGetItem( ImplGetItem( rMEvt.GetPosPixel() ) ); - - if (pItem) - { - if (mnHighItemId != pItem->mnId && pItem->isVisible()) - { - size_t nPos = GetItemPos(mnHighItemId); - - if (nPos != THUMBNAILVIEW_ITEM_NOTFOUND) - { - ThumbnailViewItem *pOld = mItemList[nPos]; - - pOld->setHighlight(false); - - if (!pOld->isSelected()) - DrawItem(pOld); - } - - mnHighItemId = pItem->mnId; - pItem->setHighlight(true); - - if (!pItem->isSelected()) - DrawItem(pItem); - } - } - else - { - if (mnHighItemId) - { - size_t nPos = GetItemPos(mnHighItemId); - - if (nPos != THUMBNAILVIEW_ITEM_NOTFOUND) - { - ThumbnailViewItem *pOld = mItemList[nPos]; - - pOld->setHighlight(false); - - if (!pOld->isSelected()) - DrawItem(pOld); - } - - mnHighItemId = 0; - } - } - - Control::MouseMove( rMEvt ); -} - void ThumbnailView::Command( const CommandEvent& rCEvt ) { if ( (rCEvt.GetCommand() == COMMAND_WHEEL) || @@ -1049,13 +973,6 @@ long ThumbnailView::GetScrollWidth() const return 0; } -void ThumbnailView::setSelectionMode (bool mode) -{ - mbSelectionMode = mode; - OnSelectionMode(mode); - maSelectionModeHdl.Call(&mode); -} - void ThumbnailView::filterItems (const boost::function<bool (const ThumbnailViewItem*) > &func) { mnFirstLine = 0; // start at the top of the list instead of the current position diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx index 57041ce59970..2410922b5f4d 100644 --- a/sfx2/source/control/thumbnailviewitem.cxx +++ b/sfx2/source/control/thumbnailviewitem.cxx @@ -41,18 +41,14 @@ using namespace ::com::sun::star; using namespace drawinglayer::attribute; using namespace drawinglayer::primitive2d; -ThumbnailViewItem::ThumbnailViewItem(ThumbnailView &rView, Window *pParent) +ThumbnailViewItem::ThumbnailViewItem(ThumbnailView &rView) : mrParent(rView) , mnId(0) , mbVisible(true) , mbSelected(false) , mbHover(false) , mpxAcc(NULL) - , mbMode(false) - , mpSelectBox(new CheckBox(pParent,WB_HIDE | WB_NOPOINTERFOCUS)) { - mpSelectBox->SetSizePixel(Size(20,20)); - mpSelectBox->SetClickHdl(LINK(this,ThumbnailViewItem,OnClick)); } ThumbnailViewItem::~ThumbnailViewItem() @@ -62,37 +58,21 @@ ThumbnailViewItem::~ThumbnailViewItem() static_cast< ThumbnailViewItemAcc* >( mpxAcc->get() )->ParentDestroyed(); delete mpxAcc; } - - delete mpSelectBox; } void ThumbnailViewItem::show (bool bVisible) { mbVisible = bVisible; - - if (mbMode) - mpSelectBox->Show(bVisible); - else if (!bVisible) - mpSelectBox->Show(bVisible); - else if (mbSelected) - mpSelectBox->Show(bVisible); } void ThumbnailViewItem::setSelection (bool state) { mbSelected = state; - mpSelectBox->SetState(state ? STATE_CHECK : STATE_NOCHECK); - - if (!isHighlighted()) - mpSelectBox->Show(state); } void ThumbnailViewItem::setHighlight (bool state) { mbHover = state; - - if (!isSelected()) - mpSelectBox->Show(state); } uno::Reference< accessibility::XAccessible > ThumbnailViewItem::GetAccessible( bool bIsTransientChildrenDisabled ) @@ -131,20 +111,6 @@ void ThumbnailViewItem::calculateItemsPosition (const long nThumbnailHeight, con aPos.Y() = aPos.Y() + aTextDev.getTextHeight() + (nDisplayHeight - aTextDev.getTextHeight())/2; aPos.X() = maDrawArea.Left() + (aRectSize.Width() - aTextDev.getTextWidth(maTitle,0,nMaxTextLenght))/2; maTextPos = aPos; - - // Calculate checkbox position - aPos.Y() -= aTextDev.getTextHeight(); - aPos.X() = maDrawArea.Left() + 15; - - mpSelectBox->SetPosPixel(aPos); -} - -void ThumbnailViewItem::setSelectionMode (bool mode) -{ - mbMode = mode; - - if (!mbHover && !mbSelected && mbVisible) - mpSelectBox->Show(mode); } void ThumbnailViewItem::setSelectClickHdl (const Link &link) @@ -210,9 +176,6 @@ void ThumbnailViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *pProc Color(COL_BLACK).getBColor() ) ); pProcessor->process(aSeq); - - if (mbMode || mbHover || mbSelected) - mpSelectBox->Paint(maDrawArea); } drawinglayer::primitive2d::BorderLinePrimitive2D* @@ -223,14 +186,6 @@ ThumbnailViewItem::createBorderLine (const basegfx::B2DPoint &rStart, const base false,STYLE_SOLID); } -IMPL_LINK (ThumbnailViewItem, OnClick, CheckBox*, ) -{ - mbSelected = mpSelectBox->GetState() == STATE_CHECK; - mpSelectBox->Invalidate(); - maClickHdl.Call(this); - return 0; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 29904409964f..e0ea98c92b23 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -104,7 +104,6 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) aButtonPresents(this,SfxResId(BTN_SELECT_PRESENTATIONS)), aButtonSheets(this,SfxResId(BTN_SELECT_SHEETS)), aButtonDraws(this,SfxResId(BTN_SELECT_DRAWS)), - maButtonSelMode(this,SfxResId(BTN_SELECTION_MODE)), mpToolbars( new Control(this,SfxResId(TOOLBARS))), mpSearchEdit(new Edit(this,WB_HIDE | WB_BORDER)), mpViewBar( new ToolBox(mpToolbars, SfxResId(TBX_ACTION_VIEW))), @@ -114,11 +113,8 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) maView(new TemplateLocalView(this,SfxResId(TEMPLATE_VIEW))), mpOnlineView(new TemplateRemoteView(this, WB_VSCROLL,false)), mbIsSaveMode(false), - mbInSelectionModeHdl(false), mxDesktop(comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.frame.Desktop" ),uno::UNO_QUERY ) { - maButtonSelMode.SetStyle(maButtonSelMode.GetStyle() | WB_TOGGLE); - // Create popup menus mpActionMenu = new PopupMenu; mpActionMenu->InsertItem(MNI_ACTION_SORT_NAME,SfxResId(STR_ACTION_SORT_NAME).toString(),SfxResId(IMG_ACTION_SORT)); @@ -197,9 +193,8 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) maView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVFolderStateHdl)); maView->setOverlayItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl)); - maView->setOverlayClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); + maView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); maView->setOverlayCloseHdl(LINK(this,SfxTemplateManagerDlg,CloseOverlayHdl)); - maView->setSelectionModeHdl(LINK(this,SfxTemplateManagerDlg,SelectionModeHdl)); // Set online view position and dimensions mpOnlineView->SetPosSizePixel(aViewPos,aThumbSize); @@ -210,10 +205,9 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) TEMPLATE_ITEM_PADDING); mpOnlineView->setOverlayItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl)); - mpOnlineView->setOverlayClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); + mpOnlineView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); mpOnlineView->setOverlayCloseHdl(LINK(this,SfxTemplateManagerDlg,CloseOverlayHdl)); mpOnlineView->setOverlayChangeNameHdl(LINK(this,SfxTemplateManagerDlg,RepositoryChangeNameHdl)); - mpOnlineView->setSelectionModeHdl(LINK(this,SfxTemplateManagerDlg,SelectionModeHdl)); mpSearchView->SetSizePixel(aThumbSize); mpSearchView->setItemMaxTextLength(TEMPLATE_ITEM_MAX_TEXT_LENGTH); @@ -223,14 +217,12 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) TEMPLATE_ITEM_PADDING); mpSearchView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl)); - mpSearchView->setSelectionModeHdl(LINK(this,SfxTemplateManagerDlg,SelectionModeHdl)); aButtonAll.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewAllHdl)); aButtonDocs.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewDocsHdl)); aButtonPresents.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewPresentsHdl)); aButtonSheets.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewSheetsHdl)); aButtonDraws.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewDrawsHdl)); - maButtonSelMode.SetClickHdl(LINK(this,SfxTemplateManagerDlg,OnClickSelectionMode)); // Set dialog to correct dimensions SetSizePixel(aWinSize); @@ -350,21 +342,6 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, CloseOverlayHdl) return 0; } -IMPL_LINK (SfxTemplateManagerDlg, OnClickSelectionMode, ImageButton*, pButton) -{ - if (!mbInSelectionModeHdl) - maView->setSelectionMode(pButton->GetState() == STATE_CHECK); - return 0; -} - -IMPL_LINK (SfxTemplateManagerDlg, SelectionModeHdl, bool*, pMode) -{ - mbInSelectionModeHdl = true; - maButtonSelMode.SetState( *pMode ? STATE_CHECK : STATE_NOCHECK ); - mbInSelectionModeHdl = false; - return 0; -} - IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXViewHdl) { switch(mpViewBar->GetCurItemId()) @@ -1221,11 +1198,10 @@ void SfxTemplateManagerDlg::centerTopButtons() { Point aFirstBtnPos = aButtonAll.GetPosPixel(); - Size aSelBtnSize = maButtonSelMode.GetOutputSize(); // Last button in the list Size aBtnSize = aButtonAll.GetOutputSize(); Size aWinSize = GetOutputSize(); - long nTotalWidth = aSelBtnSize.getWidth() + aBtnSize.getWidth()*5; + long nTotalWidth = aBtnSize.getWidth()*5; long nSpace = (aWinSize.getWidth() - nTotalWidth)/2; Point aBtnPos(nSpace,aFirstBtnPos.getY()); @@ -1242,9 +1218,6 @@ void SfxTemplateManagerDlg::centerTopButtons() aBtnPos.setX(aBtnPos.getX() + aBtnSize.getWidth()); aButtonDraws.SetPosPixel(aBtnPos); - - aBtnPos.setX(aBtnPos.getX() + aBtnSize.getWidth()); - maButtonSelMode.SetPosPixel(aBtnPos); } void SfxTemplateManagerDlg::createRepositoryMenu() diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src index 61fe2b8336b0..c0687fd015b0 100644 --- a/sfx2/source/doc/templatedlg.src +++ b/sfx2/source/doc/templatedlg.src @@ -152,20 +152,6 @@ ModelessDialog DLG_TEMPLATE_MANAGER Text [en-US] = "Drawings"; }; - ImageButton BTN_SELECTION_MODE - { - Pos = MAP_APPFONT(260,5); - Size = MAP_APPFONT(20,14); - TabStop = TRUE; - - ButtonImage = Image - { - ImageBitmap = Bitmap { File = "select.png" ; }; - }; - - QuickHelpText [en-US] = "Enables selecting items by just clicking in the thumbnail or title."; - }; - Control TEMPLATE_VIEW { Pos = MAP_APPFONT(5,30); diff --git a/sfx2/source/inc/templatesearchviewitem.hxx b/sfx2/source/inc/templatesearchviewitem.hxx index 185560a890c9..27e393d24571 100644 --- a/sfx2/source/inc/templatesearchviewitem.hxx +++ b/sfx2/source/inc/templatesearchviewitem.hxx @@ -14,8 +14,8 @@ struct TemplateSearchViewItem : public TemplateViewItem { - TemplateSearchViewItem (ThumbnailView &rView, Window *pParent) - : TemplateViewItem(rView,pParent) + TemplateSearchViewItem (ThumbnailView &rView) + : TemplateViewItem(rView) {} virtual ~TemplateSearchViewItem () |