[Libreoffice-commits] .: 2 commits - sfx2/inc sfx2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Dec 5 06:25:44 PST 2012
sfx2/inc/sfx2/templateabstractview.hxx | 4 +-
sfx2/inc/sfx2/templatelocalview.hxx | 2 -
sfx2/inc/sfx2/templateview.hxx | 6 +--
sfx2/inc/sfx2/thumbnailview.hxx | 4 +-
sfx2/inc/templatedlg.hxx | 2 +
sfx2/source/control/templateabstractview.cxx | 37 ++++++++++++++++-----
sfx2/source/control/templatelocalview.cxx | 2 -
sfx2/source/control/templateview.cxx | 4 +-
sfx2/source/control/thumbnailview.cxx | 46 ++++++++++++--------------
sfx2/source/doc/templatedlg.cxx | 19 +++++++++-
sfx2/source/doc/templatedlg.src | 47 ++++++++++++++++++++++++++-
11 files changed, 126 insertions(+), 47 deletions(-)
New commits:
commit 9bcd98fd13c12698633ca0dee3656689678b84b4
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Wed Dec 5 15:20:13 2012 +0100
Template Manager: ban double-click and right click to start selection mode
Change-Id: I49383a884b5806679ec6f79d49b8bc194d28d557
diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx
index 89de530..0ab599e 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 setOverlayDblClickHdl (const Link &rLink);
+ void setOverlayClickHdl (const Link &rLink);
void setOverlayCloseHdl (const Link &rLink);
@@ -125,10 +125,12 @@ protected:
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 9a101f2..58debca 100644
--- a/sfx2/inc/sfx2/templatelocalview.hxx
+++ b/sfx2/inc/sfx2/templatelocalview.hxx
@@ -75,7 +75,7 @@ public:
private:
- virtual void OnItemDblClicked (ThumbnailViewItem *pRegionItem);
+ virtual void OnItemClicked (ThumbnailViewItem *pRegionItem);
DECL_LINK(ChangeNameHdl, TemplateView*);
diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx
index 881c68d..fee955b 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 setDblClickHdl (const Link &rLink) { maDblClickHdl = rLink; }
+ void setClickHdl (const Link &rLink) { maClickHdl = rLink; }
void setChangeNameHdl (const Link &rLink) { maChangeNameHdl = rLink; }
@@ -49,7 +49,7 @@ protected:
virtual void MouseButtonDown (const MouseEvent &rMEvt);
- virtual void OnItemDblClicked (ThumbnailViewItem *pItem);
+ virtual void OnItemClicked (ThumbnailViewItem *pItem);
DECL_LINK (ChangeNameHdl, void*);
@@ -59,7 +59,7 @@ private:
bool mbRenderTitle;
sal_uInt16 mnId;
OUString maName;
- Link maDblClickHdl;
+ Link maClickHdl;
Link maChangeNameHdl;
Link maCloseHdl;
diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx
index 084b3d1..023c569 100644
--- a/sfx2/inc/sfx2/thumbnailview.hxx
+++ b/sfx2/inc/sfx2/thumbnailview.hxx
@@ -241,6 +241,7 @@ public:
const ThumbnailViewItem*) > &func);
void setItemStateHdl (const Link &aLink) { maItemStateHdl = aLink; }
+ void setSelectionModeHdl (const Link &aLink) { maSelectionModeHdl = aLink; }
protected:
@@ -276,7 +277,7 @@ protected:
virtual void OnSelectionMode (bool bMode);
- virtual void OnItemDblClicked (ThumbnailViewItem *pItem);
+ virtual void OnItemClicked (ThumbnailViewItem *pItem);
protected:
@@ -330,6 +331,7 @@ protected:
Color maColor;
Link maItemStateHdl;
+ Link maSelectionModeHdl;
ThumbnailItemAttributes *mpItemAttrs;
drawinglayer::processor2d::BaseProcessor2D *mpProcessor;
boost::function<bool (const ThumbnailViewItem*) > maFilterFunc;
diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index 5ba2a87..8ce829e 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -58,6 +58,7 @@ private:
DECL_LINK(CloseOverlayHdl, void*);
DECL_LINK(OnClickSelectionMode, ImageButton*);
+ DECL_LINK(SelectionModeHdl, bool*);
DECL_LINK(TBXViewHdl, void*);
DECL_LINK(TBXActionHdl, void*);
@@ -141,6 +142,7 @@ 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 22e8121..8cbf60f 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -58,16 +58,20 @@ bool ViewFilter_Keyword::operator ()(const ThumbnailViewItem *pItem)
TemplateAbstractView::TemplateAbstractView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren)
: ThumbnailView(pParent,nWinStyle,bDisableTransientChildren),
- mpItemView(new TemplateView(this))
+ mpItemView(new TemplateView(this)),
+ mbInSelectionModeHdl(false)
{
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))
+ mpItemView(new TemplateView(this)),
+ mbInSelectionModeHdl(false)
{
mpItemView->setItemStateHdl(LINK(this,TemplateAbstractView,OverlayItemStateHdl));
+ mpItemView->setSelectionModeHdl(LINK(this,TemplateAbstractView,OverlaySelectionModeHdl));
}
TemplateAbstractView::~TemplateAbstractView ()
@@ -119,9 +123,9 @@ void TemplateAbstractView::filterTemplatesByKeyword(const OUString &rKeyword)
mpItemView->filterItems(ViewFilter_Keyword(rKeyword));
}
-void TemplateAbstractView::setOverlayDblClickHdl(const Link &rLink)
+void TemplateAbstractView::setOverlayClickHdl(const Link &rLink)
{
- mpItemView->setDblClickHdl(rLink);
+ mpItemView->setClickHdl(rLink);
}
void TemplateAbstractView::setOverlayCloseHdl(const Link &rLink)
@@ -269,13 +273,16 @@ void TemplateAbstractView::DrawItem(ThumbnailViewItem *pItem)
void TemplateAbstractView::OnSelectionMode (bool bMode)
{
- if (mpItemView->IsVisible())
+ if (!mbInSelectionModeHdl)
{
- mbSelectionMode = bMode;
- mpItemView->setSelectionMode(bMode);
+ if (mpItemView->IsVisible())
+ {
+ mbSelectionMode = bMode;
+ mpItemView->setSelectionMode(bMode);
+ }
+ else
+ ThumbnailView::OnSelectionMode(bMode);
}
- else
- ThumbnailView::OnSelectionMode(bMode);
}
IMPL_LINK(TemplateAbstractView, OverlayItemStateHdl, const ThumbnailViewItem*, pItem)
@@ -284,4 +291,16 @@ IMPL_LINK(TemplateAbstractView, OverlayItemStateHdl, const ThumbnailViewItem*, p
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 820ec14..26d9f3c 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -702,7 +702,7 @@ bool TemplateLocalView::isTemplateNameUnique(const sal_uInt16 nRegionItemId, con
return true;
}
-void TemplateLocalView::OnItemDblClicked (ThumbnailViewItem *pRegionItem)
+void TemplateLocalView::OnItemClicked (ThumbnailViewItem *pRegionItem)
{
// Fill templates
sal_uInt16 nRegionId = pRegionItem->mnId-1;
diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index 7173268..1156fa8 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -208,9 +208,9 @@ void TemplateView::MouseButtonDown (const MouseEvent &rMEvt)
ThumbnailView::MouseButtonDown(rMEvt);
}
-void TemplateView::OnItemDblClicked(ThumbnailViewItem *pItem)
+void TemplateView::OnItemClicked(ThumbnailViewItem *pItem)
{
- maDblClickHdl.Call(pItem);
+ maClickHdl.Call(pItem);
}
IMPL_LINK_NOARG(TemplateView, ChangeNameHdl)
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index fd2d215..e51385a 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -202,6 +202,9 @@ 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);
@@ -211,7 +214,7 @@ void ThumbnailView::OnSelectionMode (bool bMode)
}
}
-void ThumbnailView::OnItemDblClicked (ThumbnailViewItem*)
+void ThumbnailView::OnItemClicked (ThumbnailViewItem*)
{
}
@@ -508,7 +511,19 @@ IMPL_LINK (ThumbnailView, OnItemSelected, ThumbnailViewItem*, pItem)
void ThumbnailView::MouseButtonDown( const MouseEvent& rMEvt )
{
- if ( rMEvt.IsLeft() )
+ bool bProcessClick = rMEvt.IsLeft();
+
+ if ( rMEvt.IsRight( ) )
+ {
+ // Set selection mode with right click
+ if (!mbSelectionMode)
+ {
+ setSelectionMode( true );
+ bProcessClick = true;
+ }
+ }
+
+ if ( bProcessClick )
{
ThumbnailViewItem* pItem = ImplGetItem( ImplGetItem( rMEvt.GetPosPixel() ) );
@@ -530,36 +545,17 @@ void ThumbnailView::MouseButtonDown( const MouseEvent& rMEvt )
else
{
Rectangle aRect(pItem->getDrawArea());
- aRect.setY(aRect.getY()+mnItemPadding+mnThumbnailHeight);
- aRect.SetSize(Size(mnItemWidth,mnDisplayHeight+mnItemPadding));
-
- if (aRect.IsInside(rMEvt.GetPosPixel()))
- {
- pItem->setSelection(!pItem->isSelected());
+ aRect.SetSize(Size(mnItemWidth,mnThumbnailHeight));
- if (!pItem->isHighlighted())
- DrawItem(pItem);
-
- maItemStateHdl.Call(pItem);
- }
-
- //StartTracking( STARTTRACK_SCROLLREPEAT );
+ if (!mbSelectionMode && aRect.IsInside(rMEvt.GetPosPixel()))
+ OnItemClicked(pItem);
}
}
- else if ( rMEvt.GetClicks() == 2 )
- {
- Rectangle aRect(pItem->getDrawArea());
- aRect.SetSize(Size(mnItemWidth,mnThumbnailHeight));
-
- if (!mbSelectionMode && aRect.IsInside(rMEvt.GetPosPixel()))
- OnItemDblClicked(pItem);
- }
}
return;
}
}
-
Control::MouseButtonDown( rMEvt );
}
@@ -1059,8 +1055,8 @@ long ThumbnailView::GetScrollWidth() const
void ThumbnailView::setSelectionMode (bool mode)
{
mbSelectionMode = mode;
-
OnSelectionMode(mode);
+ maSelectionModeHdl.Call(&mode);
}
void ThumbnailView::filterItems (const boost::function<bool (const ThumbnailViewItem*) > &func)
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 57597c7..371f873 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -114,6 +114,7 @@ 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);
@@ -202,8 +203,9 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
maView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVFolderStateHdl));
maView->setOverlayItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl));
- maView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl));
+ maView->setOverlayClickHdl(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);
@@ -214,9 +216,10 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
TEMPLATE_ITEM_PADDING);
mpOnlineView->setOverlayItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl));
- mpOnlineView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl));
+ mpOnlineView->setOverlayClickHdl(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);
@@ -226,6 +229,7 @@ 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));
@@ -353,7 +357,16 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, CloseOverlayHdl)
IMPL_LINK (SfxTemplateManagerDlg, OnClickSelectionMode, ImageButton*, pButton)
{
- maView->setSelectionMode(pButton->GetState() == STATE_CHECK);
+ 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;
}
commit 3eaa0cb7552381c7924722619b237a4d5ca21ff7
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Tue Dec 4 18:11:38 2012 +0100
Template manager: use icons in the toolbar
Change-Id: I4f1e199c9c678f5443cc736ffa8f74d9748b6f0f
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index 1d45bd9..9bafd2b 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -202,6 +202,11 @@ ModelessDialog DLG_TEMPLATE_MANAGER
{
Identifier = TBI_TEMPLATE_REPOSITORY;
Text [ en-US ] = "Repository";
+
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap { File = "actionview026.png" ; };
+ };
};
ToolBoxItem
@@ -212,7 +217,7 @@ ModelessDialog DLG_TEMPLATE_MANAGER
ItemImage = Image
{
- ImageBitmap = Bitmap { File = "import.png" ; };
+ ImageBitmap = Bitmap { File = "actionview010.png" ; };
};
};
@@ -221,6 +226,11 @@ ModelessDialog DLG_TEMPLATE_MANAGER
Identifier = TBI_TEMPLATE_FOLDER_DEL;
Hide = TRUE;
Text [ en-US ] = "Delete";
+
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap { File = "actionview025.png" ; };
+ };
};
ToolBoxItem
@@ -228,6 +238,11 @@ ModelessDialog DLG_TEMPLATE_MANAGER
Identifier = TBI_TEMPLATE_SAVE;
Hide = TRUE;
Text [ en-US ] = "Save";
+
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap { File = "actionview028.png" ; };
+ };
};
};
};
@@ -277,36 +292,66 @@ ModelessDialog DLG_TEMPLATE_MANAGER
{
Identifier = TBI_TEMPLATE_EDIT;
Text [ en-US ] = "Edit";
+
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap { File = "actiontemplates019.png" ; };
+ };
};
ToolBoxItem
{
Identifier = TBI_TEMPLATE_PROPERTIES;
Text [ en-US ] = "Properties";
+
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap { File = "actiontemplates016.png" ; };
+ };
};
ToolBoxItem
{
Identifier = TBI_TEMPLATE_DEFAULT;
Text [ en-US ] = "Set as default";
+
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap { File = "actiontemplates015.png" ; };
+ };
};
ToolBoxItem
{
Identifier = TBI_TEMPLATE_MOVE;
Text [ en-US ] = "Move to folder" ;
+
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap { File = "actiontemplates017.png" ; };
+ };
};
ToolBoxItem
{
Identifier = TBI_TEMPLATE_EXPORT;
Text [ en-US ] = "Export";
+
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap { File = "actiontemplates020.png" ; };
+ };
};
ToolBoxItem
{
Identifier = TBI_TEMPLATE_DELETE;
Text [ en-US ] = "Delete";
+
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap { File = "actiontemplates018.png" ; };
+ };
};
};
};
More information about the Libreoffice-commits
mailing list