summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-03-26 16:27:17 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-03-28 22:07:06 +0100
commit3e078e17ee2144fb976a7e6b9227152113cea0d4 (patch)
tree01faab7d3c82c5b027b42a6722700736b249a775 /include
parentBe consistent with namespaces and parameter order for UNO Api helpers (diff)
downloadcore-3e078e17ee2144fb976a7e6b9227152113cea0d4.tar.gz
core-3e078e17ee2144fb976a7e6b9227152113cea0d4.zip
weld SfxTemplateManagerDlg
like expert configuration change the gear menu not to display a down indicator and use CommandEvent to distinguish mouse/non-mouse context menus Change-Id: I64bb660a9c7dacb5b90b240d9d76d29324c5fd9f Reviewed-on: https://gerrit.libreoffice.org/69893 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/sfx2/emojiviewitem.hxx2
-rw-r--r--include/sfx2/inputdlg.hxx2
-rw-r--r--include/sfx2/recentdocsviewitem.hxx9
-rw-r--r--include/sfx2/templatedlg.hxx86
-rw-r--r--include/sfx2/templatelocalview.hxx121
-rw-r--r--include/sfx2/templateviewitem.hxx2
-rw-r--r--include/sfx2/thumbnailview.hxx184
-rw-r--r--include/sfx2/thumbnailviewitem.hxx6
-rw-r--r--include/svx/SvxPresetListBox.hxx2
-rw-r--r--include/svx/charmap.hxx4
-rw-r--r--include/vcl/customweld.hxx8
-rw-r--r--include/vcl/layout.hxx6
-rw-r--r--include/vcl/weld.hxx22
13 files changed, 383 insertions, 71 deletions
diff --git a/include/sfx2/emojiviewitem.hxx b/include/sfx2/emojiviewitem.hxx
index 0ca32e78238f..e0aa57675f9a 100644
--- a/include/sfx2/emojiviewitem.hxx
+++ b/include/sfx2/emojiviewitem.hxx
@@ -15,7 +15,7 @@
class EmojiViewItem : public ThumbnailViewItem
{
public:
- EmojiViewItem (ThumbnailView &rView, sal_uInt16 nId);
+ EmojiViewItem (ThumbnailViewBase &rView, sal_uInt16 nId);
virtual ~EmojiViewItem () override;
diff --git a/include/sfx2/inputdlg.hxx b/include/sfx2/inputdlg.hxx
index 6f50e012e997..bd54b6a5de02 100644
--- a/include/sfx2/inputdlg.hxx
+++ b/include/sfx2/inputdlg.hxx
@@ -21,7 +21,7 @@ private:
std::unique_ptr<weld::Button> m_xHelp;
public:
- InputDialog(weld::Window* pParent, const OUString &rLabelText);
+ InputDialog(weld::Widget* pParent, const OUString &rLabelText);
OUString GetEntryText() const;
void SetEntryText(const OUString& rStr);
void HideHelpBtn();
diff --git a/include/sfx2/recentdocsviewitem.hxx b/include/sfx2/recentdocsviewitem.hxx
index 8320d4710d81..2ee90de19f03 100644
--- a/include/sfx2/recentdocsviewitem.hxx
+++ b/include/sfx2/recentdocsviewitem.hxx
@@ -12,10 +12,15 @@
#include <sfx2/thumbnailview.hxx>
+namespace sfx2
+{
+ class RecentDocsView;
+}
+
class RecentDocsViewItem final : public ThumbnailViewItem
{
public:
- RecentDocsViewItem(ThumbnailView &rView, const OUString &rURL,
+ RecentDocsViewItem(sfx2::RecentDocsView &rView, const OUString &rURL,
const OUString &rTitle, const BitmapEx& rThumbnail, sal_uInt16 nId, long nThumbnailSize);
/** Updates own highlight status based on the aPoint position.
@@ -38,6 +43,8 @@ public:
void OpenDocument();
private:
+ sfx2::RecentDocsView& mrParentView;
+
/// Return area where is the icon to remove document from the recent documents.
tools::Rectangle getRemoveIconArea() const;
diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx
index 7f730c50161d..5e8a12853419 100644
--- a/include/sfx2/templatedlg.hxx
+++ b/include/sfx2/templatedlg.hxx
@@ -38,18 +38,16 @@ namespace com {
} } }
}
-class SFX2_DLLPUBLIC SfxTemplateManagerDlg : public ModalDialog
+class SFX2_DLLPUBLIC SfxTemplateManagerDlg : public weld::GenericDialogController
{
typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*);
public:
- SfxTemplateManagerDlg(vcl::Window *parent = nullptr);
+ SfxTemplateManagerDlg(weld::Window *parent);
virtual ~SfxTemplateManagerDlg() override;
- virtual void dispose() override;
- virtual short Execute() override;
- virtual bool EventNotify( NotifyEvent& rNEvt ) override;
+ virtual short run() override;
void setDocumentModel (const css::uno::Reference<css::frame::XModel> &rModel);
@@ -63,21 +61,19 @@ protected:
void fillFolderComboBox();
- DECL_LINK(TBXDropdownHdl, ToolBox*, void);
+ DECL_LINK(SelectApplicationHdl, weld::ComboBox&, void);
+ DECL_LINK(SelectRegionHdl, weld::ComboBox&, void);
- DECL_LINK(SelectApplicationHdl, ListBox&, void);
- DECL_LINK(SelectRegionHdl, ListBox&, void);
-
- DECL_LINK(OkClickHdl, Button*, void);
- DECL_LINK(MoveClickHdl, Button*, void);
- DECL_LINK(ExportClickHdl, Button*, void);
- DECL_LINK(ImportClickHdl, Button*, void);
- DECL_STATIC_LINK(SfxTemplateManagerDlg, LinkClickHdl, Button*, void);
+ DECL_LINK(OkClickHdl, weld::Button&, void);
+ DECL_LINK(MoveClickHdl, weld::Button&, void);
+ DECL_LINK(ExportClickHdl, weld::Button&, void);
+ DECL_LINK(ImportClickHdl, weld::Button&, void);
+ DECL_STATIC_LINK(SfxTemplateManagerDlg, LinkClickHdl, weld::Button&, void);
DECL_LINK(TVItemStateHdl, const ThumbnailViewItem*, void);
- DECL_LINK(MenuSelectHdl, Menu*, bool);
- DECL_LINK(DefaultTemplateMenuSelectHdl, Menu*, bool);
+ DECL_LINK(MenuSelectHdl, const OString&, void);
+ void DefaultTemplateMenuSelectHdl(const OString& rIdent);
DECL_LINK(OpenRegionHdl, void*, void);
DECL_LINK(CreateContextMenuHdl, ThumbnailViewItem*, void);
@@ -86,8 +82,13 @@ protected:
DECL_LINK(DeleteTemplateHdl, ThumbnailViewItem*, void);
DECL_LINK(DefaultTemplateHdl, ThumbnailViewItem*, void);
- DECL_LINK(SearchUpdateHdl, Edit&, void);
- DECL_LINK(GetFocusHdl, Control&, void);
+ void SearchUpdate();
+
+ DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
+ DECL_LINK(GetFocusHdl, weld::Widget&, void);
+ DECL_LINK(LoseFocusHdl, weld::Widget&, void);
+ DECL_LINK(ImplUpdateDataHdl, Timer*, void);
+ DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
void OnTemplateImportCategory(const OUString& sCategory);
static void OnTemplateLink ();
@@ -122,27 +123,28 @@ protected:
FILTER_APPLICATION getCurrentApplicationFilter();
protected:
-
- VclPtr<Edit> mpSearchFilter;
- VclPtr<ListBox> mpCBApp;
- VclPtr<ListBox> mpCBFolder;
-
- VclPtr<PushButton> mpOKButton;
- VclPtr<PushButton> mpMoveButton;
- VclPtr<PushButton> mpExportButton;
- VclPtr<PushButton> mpImportButton;
- VclPtr<PushButton> mpLinkButton;
- VclPtr<CheckBox> mpCBXHideDlg;
- VclPtr<ToolBox> mpActionBar;
- VclPtr<TemplateSearchView> mpSearchView;
- VclPtr<TemplateLocalView> mpLocalView;
- VclPtr<PopupMenu> mpActionMenu;
- VclPtr<PopupMenu> mpTemplateDefaultMenu;
-
std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelTemplates;
-
css::uno::Reference< css::frame::XModel > m_xModel;
css::uno::Reference< css::frame::XDesktop2 > mxDesktop;
+
+ Timer m_aUpdateDataTimer;
+
+ std::unique_ptr<weld::Entry> mxSearchFilter;
+ std::unique_ptr<weld::ComboBox> mxCBApp;
+ std::unique_ptr<weld::ComboBox> mxCBFolder;
+
+ std::unique_ptr<weld::Button> mxOKButton;
+ std::unique_ptr<weld::Button> mxMoveButton;
+ std::unique_ptr<weld::Button> mxExportButton;
+ std::unique_ptr<weld::Button> mxImportButton;
+ std::unique_ptr<weld::Button> mxLinkButton;
+ std::unique_ptr<weld::CheckButton> mxCBXHideDlg;
+ std::unique_ptr<weld::MenuButton> mxActionBar;
+ std::unique_ptr<TemplateSearchView> mxSearchView;
+ std::unique_ptr<SfxTemplateLocalView> mxLocalView;
+ std::unique_ptr<weld::Menu> mxTemplateDefaultMenu;
+ std::unique_ptr<weld::CustomWeld> mxSearchViewWeld;
+ std::unique_ptr<weld::CustomWeld> mxLocalViewWeld;
};
// class SfxTemplateCategoryDialog -------------------------------------------------------------------
@@ -192,23 +194,21 @@ public:
class SFX2_DLLPUBLIC SfxTemplateSelectionDlg : public SfxTemplateManagerDlg
{
public:
- SfxTemplateSelectionDlg(vcl::Window *parent);
+ SfxTemplateSelectionDlg(weld::Window *parent);
virtual ~SfxTemplateSelectionDlg() override;
- virtual void dispose() override;
- virtual short Execute() override;
+ virtual short run() override;
OUString const & getTemplatePath() const { return msTemplatePath; };
- bool IsStartWithTemplate() const { return mpCBXHideDlg->IsChecked(); };
+ bool IsStartWithTemplate() const { return mxCBXHideDlg->get_active(); };
private:
DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*, void);
- DECL_LINK(OkClickHdl, Button*, void);
+ DECL_LINK(OkClickHdl, weld::Button&, void);
- OUString msTemplatePath;
+ OUString msTemplatePath;
};
-
#endif // INCLUDED_SFX2_INC_TEMPLATEDLG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx
index b739549580a8..93282b9ae9d0 100644
--- a/include/sfx2/templatelocalview.hxx
+++ b/include/sfx2/templatelocalview.hxx
@@ -193,6 +193,127 @@ protected:
std::vector<TemplateItemProperties > maAllTemplates;
};
+class SFX2_DLLPUBLIC SfxTemplateLocalView : public SfxThumbnailView
+{
+ typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*);
+
+public:
+
+ SfxTemplateLocalView(std::unique_ptr<weld::ScrolledWindow> xWindow,
+ std::unique_ptr<weld::Menu> xMenu);
+
+ virtual ~SfxTemplateLocalView () override;
+
+ // Fill view with new item list
+ void insertItems (const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected = true, bool bShowCategoryInTooltip = false);
+
+ // Fill view with template folders thumbnails
+ void Populate ();
+
+ virtual void reload ();
+
+ virtual void showAllTemplates ();
+
+ void showRegion (TemplateContainerItem const *pItem);
+
+ void showRegion (const OUString &rName);
+
+ void createContextMenu(const bool bIsDefault );
+
+ void ContextMenuSelectHdl(const OString& rIdent);
+
+ TemplateContainerItem* getRegion(OUString const & sStr);
+
+ sal_uInt16 getRegionId (size_t pos) const;
+
+ sal_uInt16 getRegionId (OUString const & sRegionName) const;
+
+ OUString getRegionName(const sal_uInt16 nRegionId) const;
+
+ OUString getRegionItemName(const sal_uInt16 nItemId) const;
+
+ std::vector<OUString> getFolderNames ();
+
+ std::vector<TemplateItemProperties>
+ getFilteredItems (const std::function<bool (const TemplateItemProperties&) > &rFunc) const;
+
+ sal_uInt16 createRegion (const OUString &rName);
+
+ bool renameRegion(const OUString &rTitle, const OUString &rNewTitle);
+
+ bool removeRegion (const sal_uInt16 nItemId);
+
+ bool removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId);
+
+ bool moveTemplate (const ThumbnailViewItem* pItem, const sal_uInt16 nSrcItem,
+ const sal_uInt16 nTargetItem);
+
+ void moveTemplates (const std::set<const ThumbnailViewItem*,selection_cmp_fn> &rItems, const sal_uInt16 nTargetItem);
+
+ bool copyFrom(TemplateContainerItem *pItem, const OUString &rPath);
+
+ bool exportTo (const sal_uInt16 nItemId, const sal_uInt16 nRegionItemId, const OUString &rName);
+
+ virtual bool renameItem(ThumbnailViewItem* pItem, const OUString& sNewTitle) override;
+
+ virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
+
+ virtual bool ContextMenu(const CommandEvent& rPos) override;
+
+ virtual bool KeyInput( const KeyEvent& rKEvt ) override;
+
+ sal_uInt16 getCurRegionId () const { return mnCurRegionId;}
+
+ void setOpenRegionHdl(const Link<void*,void> &rLink);
+
+ void setCreateContextMenuHdl(const Link<ThumbnailViewItem*,void> &rLink);
+
+ void setOpenTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
+
+ void setEditTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
+
+ void setDeleteTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
+
+ void setDefaultTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
+
+ void updateThumbnailDimensions(long itemMaxSize);
+
+ void RemoveDefaultTemplateIcon( const OUString& rPath);
+
+ static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height);
+
+ static BitmapEx getDefaultThumbnail( const OUString& rPath );
+
+ static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height);
+
+ static bool IsDefaultTemplate(const OUString& rPath);
+
+protected:
+ virtual void OnItemDblClicked(ThumbnailViewItem *pItem) override;
+
+protected:
+ sal_uInt16 mnCurRegionId;
+
+ TemplateViewItem *maSelectedItem;
+
+ long mnThumbnailWidth;
+ long mnThumbnailHeight;
+
+ Point maPosition; //store the point of click event
+
+ Link<void*,void> maOpenRegionHdl;
+ Link<ThumbnailViewItem*,void> maCreateContextMenuHdl;
+ Link<ThumbnailViewItem*,void> maOpenTemplateHdl;
+ Link<ThumbnailViewItem*,void> maEditTemplateHdl;
+ Link<ThumbnailViewItem*,void> maDeleteTemplateHdl;
+ Link<ThumbnailViewItem*,void> maDefaultTemplateHdl;
+
+ std::unique_ptr<SfxDocumentTemplates> mpDocTemplates;
+ std::vector<std::unique_ptr<TemplateContainerItem> > maRegions;
+ std::vector<TemplateItemProperties > maAllTemplates;
+};
+
+
#endif // INCLUDED_SFX2_TEMPLATELOCALVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/templateviewitem.hxx b/include/sfx2/templateviewitem.hxx
index e64b82ec23a2..21433157f796 100644
--- a/include/sfx2/templateviewitem.hxx
+++ b/include/sfx2/templateviewitem.hxx
@@ -16,7 +16,7 @@ class TemplateViewItem : public ThumbnailViewItem
{
public:
- TemplateViewItem (ThumbnailView &rView, sal_uInt16 nId);
+ TemplateViewItem (ThumbnailViewBase &rView, sal_uInt16 nId);
virtual ~TemplateViewItem () override;
diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx
index 238004cdc67b..d1807f454583 100644
--- a/include/sfx2/thumbnailview.hxx
+++ b/include/sfx2/thumbnailview.hxx
@@ -18,6 +18,7 @@
#include <sfx2/thumbnailviewitem.hxx>
#include <vcl/ctrl.hxx>
+#include <vcl/customweld.hxx>
#include <vcl/timer.hxx>
#include <vcl/pngread.hxx>
@@ -174,7 +175,26 @@ public:
*
**/
-class SFX2_DLLPUBLIC ThumbnailView : public Control
+class SFX2_DLLPUBLIC ThumbnailViewBase
+{
+ friend class ThumbnailViewAcc;
+ friend class ThumbnailViewItemAcc;
+
+ SFX2_DLLPRIVATE virtual sal_uInt16 ImplGetVisibleItemCount() const = 0;
+ SFX2_DLLPRIVATE virtual ThumbnailViewItem* ImplGetVisibleItem(sal_uInt16 nVisiblePos) = 0;
+
+ virtual css::uno::Reference<css::accessibility::XAccessible> getAccessible() = 0;
+
+public:
+ /// Updates information in the view; used only in RecentDocsView ATM.
+ virtual void Reload() {}
+
+ virtual bool renameItem(ThumbnailViewItem* pItem, const OUString& sNewTitle);
+
+ virtual ~ThumbnailViewBase();
+};
+
+class SFX2_DLLPUBLIC ThumbnailView : public Control, public ThumbnailViewBase
{
public:
@@ -191,9 +211,6 @@ public:
virtual void Clear();
- /// Updates information in the view; used only in RecentDocsView ATM.
- virtual void Reload() {}
-
// Change current thumbnail item list with new one (invalidates all pointers to a thumbnail item)
void updateItems(std::vector<std::unique_ptr<ThumbnailViewItem>> items);
@@ -232,8 +249,6 @@ public:
virtual void Resize() override;
- virtual bool renameItem(ThumbnailViewItem* pItem, const OUString& sNewTitle);
-
static BitmapEx readThumbnail(const OUString &msURL);
protected:
@@ -256,6 +271,8 @@ protected:
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+ virtual css::uno::Reference<css::accessibility::XAccessible> getAccessible() override;
+
protected:
// Drawing item related functions, override them to make your own custom ones.
@@ -280,8 +297,8 @@ protected:
SFX2_DLLPRIVATE void ImplDeleteItems();
SFX2_DLLPRIVATE size_t ImplGetItem( const Point& rPoint ) const;
SFX2_DLLPRIVATE ThumbnailViewItem* ImplGetItem( size_t nPos );
- SFX2_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const;
- SFX2_DLLPRIVATE ThumbnailViewItem* ImplGetVisibleItem( sal_uInt16 nVisiblePos );
+ SFX2_DLLPRIVATE virtual sal_uInt16 ImplGetVisibleItemCount() const override;
+ SFX2_DLLPRIVATE virtual ThumbnailViewItem* ImplGetVisibleItem(sal_uInt16 nVisiblePos) override;
SFX2_DLLPRIVATE void ImplFireAccessibleEvent( short nEventId, const css::uno::Any& rOldValue, const css::uno::Any& rNewValue );
SFX2_DLLPRIVATE bool ImplHasAccessibleListeners();
DECL_DLLPRIVATE_LINK( ImplScrollHdl, ScrollBar*, void );
@@ -320,6 +337,157 @@ protected:
std::function<bool (const ThumbnailViewItem*)> maFilterFunc;
};
+class SFX2_DLLPUBLIC SfxThumbnailView : public weld::CustomWidgetController, public ThumbnailViewBase
+{
+public:
+ SfxThumbnailView(std::unique_ptr<weld::ScrolledWindow> xWindow, std::unique_ptr<weld::Menu> xMenu);
+
+ virtual ~SfxThumbnailView() override;
+
+ virtual bool MouseMove(const MouseEvent& rMEvt) override;
+
+ void AppendItem(std::unique_ptr<ThumbnailViewItem> pItem);
+
+ void RemoveItem(sal_uInt16 nItemId);
+
+ virtual void Clear();
+
+ // Change current thumbnail item list with new one (invalidates all pointers to a thumbnail item)
+ void updateItems(std::vector<std::unique_ptr<ThumbnailViewItem>> items);
+
+ size_t GetItemPos( sal_uInt16 nItemId ) const;
+
+ sal_uInt16 GetItemId( size_t nPos ) const;
+
+ sal_uInt16 GetItemId( const Point& rPos ) const;
+
+ sal_uInt16 getNextItemId () const;
+
+ void setItemMaxTextLength (sal_uInt32 nLength);
+
+ void setItemDimensions (long ItemWidth, long ThumbnailHeight,
+ long DisplayHeight, int itemPadding);
+
+ void SelectItem( sal_uInt16 nItemId );
+
+ bool IsItemSelected( sal_uInt16 nItemId ) const;
+
+ /**
+ *
+ * @brief deselect all current selected items.
+ *
+ **/
+
+ void deselectItems ();
+
+ void ShowTooltips( bool bShowTooltips );
+
+ void SetMultiSelectionEnabled( bool bIsMultiSelectionEnabled );
+
+ void filterItems (const std::function<bool (const ThumbnailViewItem*) > &func);
+
+ void setItemStateHdl (const Link<const ThumbnailViewItem*,void> &aLink) { maItemStateHdl = aLink; }
+
+ virtual void Resize() override;
+
+ static BitmapEx readThumbnail(const OUString &msURL);
+
+ virtual void Show() override
+ {
+ mxScrolledWindow->show();
+ CustomWidgetController::Show();
+ }
+
+ virtual void Hide() override
+ {
+ mxScrolledWindow->hide();
+ CustomWidgetController::Hide();
+ }
+
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+
+protected:
+
+ virtual bool KeyInput( const KeyEvent& rKEvt ) override;
+
+ virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
+
+ virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+
+ virtual void GetFocus() override;
+
+ virtual void LoseFocus() override;
+
+ virtual OUString RequestHelp(tools::Rectangle& rRect) override;
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+
+ virtual css::uno::Reference<css::accessibility::XAccessible> getAccessible() override;
+
+protected:
+
+ // Drawing item related functions, override them to make your own custom ones.
+
+ void DrawItem (ThumbnailViewItem const *pItem);
+
+ virtual void OnItemDblClicked (ThumbnailViewItem *pItem);
+
+protected:
+
+ friend class SfxThumbnailViewAcc;
+ friend class ThumbnailViewItemAcc;
+
+ void CalculateItemPositions (bool bScrollBarUsed = false);
+ void MakeItemVisible( sal_uInt16 nId );
+
+ SFX2_DLLPRIVATE void ImplInit();
+
+ SFX2_DLLPRIVATE void ImplDeleteItems();
+ SFX2_DLLPRIVATE size_t ImplGetItem( const Point& rPoint ) const;
+ SFX2_DLLPRIVATE ThumbnailViewItem* ImplGetItem( size_t nPos );
+ SFX2_DLLPRIVATE virtual sal_uInt16 ImplGetVisibleItemCount() const override;
+ SFX2_DLLPRIVATE virtual ThumbnailViewItem* ImplGetVisibleItem(sal_uInt16 nVisiblePos) override;
+ SFX2_DLLPRIVATE void ImplFireAccessibleEvent( short nEventId, const css::uno::Any& rOldValue, const css::uno::Any& rNewValue );
+ SFX2_DLLPRIVATE bool ImplHasAccessibleListeners();
+ DECL_DLLPRIVATE_LINK( ImplScrollHdl, weld::ScrolledWindow&, void );
+
+protected:
+
+ std::vector< std::unique_ptr<ThumbnailViewItem> > mItemList;
+ css::uno::Reference<css::accessibility::XAccessible> mxAccessible;
+ ThumbnailValueItemList mFilteredItemList; ///< Cache to store the filtered items
+ ThumbnailValueItemList::iterator mpStartSelRange;
+ long mnItemWidth;
+ long mnItemHeight;
+ long mnItemPadding;
+ long mnThumbnailHeight; // Maximum height of the thumbnail
+ long mnDisplayHeight; // Height of the data display box (name, etc)
+ long mnVisLines;
+ long mnLines;
+
+ sal_uInt16 mnCols;
+ sal_uInt16 mnFirstLine;
+ bool mbScroll : 1;
+ bool mbHasVisibleItems : 1;
+ bool mbShowTooltips : 1;
+ bool mbIsMultiSelectionEnabled: 1;
+ Color maFillColor; ///< Background color of the thumbnail view widget.
+ Color maTextColor; ///< Text color.
+ Color maHighlightColor; ///< Color of the highlight (background) of the hovered item.
+ Color maHighlightTextColor; ///< Color of the text for the highlighted item.
+ Color maSelectHighlightColor; ///< Color of the highlight (background) of the selected and hovered item.
+ Color maSelectHighlightTextColor; ///< Color of the text of the selected and hovered item.
+ double mfHighlightTransparence; ///< Transparence of the highlight.
+
+ Link<const ThumbnailViewItem*, void> maItemStateHdl;
+ std::unique_ptr<ThumbnailItemAttributes> mpItemAttrs;
+ std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow;
+ std::unique_ptr<weld::Menu> mxContextMenu;
+
+ std::function<bool (const ThumbnailViewItem*)> maFilterFunc;
+};
+
+
#endif // INCLUDED_SFX2_THUMBNAILVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/thumbnailviewitem.hxx b/include/sfx2/thumbnailviewitem.hxx
index 3568da70d31b..26cb96966967 100644
--- a/include/sfx2/thumbnailviewitem.hxx
+++ b/include/sfx2/thumbnailviewitem.hxx
@@ -32,7 +32,7 @@
const int THUMBNAILVIEW_ITEM_CORNER = 5;
-class ThumbnailView;
+class ThumbnailViewBase;
class MouseEvent;
namespace basegfx {
@@ -67,7 +67,7 @@ class SFX2_DLLPUBLIC ThumbnailViewItem
{
public:
- ThumbnailView &mrParent;
+ ThumbnailViewBase &mrParent;
sal_uInt16 const mnId;
bool mbVisible;
bool mbSelected;
@@ -77,7 +77,7 @@ public:
OUString maHelpText;
css::uno::Reference< css::accessibility::XAccessible > mxAcc;
- ThumbnailViewItem (ThumbnailView &rView, sal_uInt16 nId);
+ ThumbnailViewItem (ThumbnailViewBase &rView, sal_uInt16 nId);
virtual ~ThumbnailViewItem ();
diff --git a/include/svx/SvxPresetListBox.hxx b/include/svx/SvxPresetListBox.hxx
index e8809eca0f61..f580ebac04fb 100644
--- a/include/svx/SvxPresetListBox.hxx
+++ b/include/svx/SvxPresetListBox.hxx
@@ -44,7 +44,7 @@ public:
SvxPresetListBox(std::unique_ptr<weld::ScrolledWindow> pWindow);
virtual void Resize() override;
- virtual bool ContextMenu(const Point& rPos) override;
+ virtual bool ContextMenu(const CommandEvent& rEvent) override;
static sal_uInt32 getColumnCount() { return nColCount; }
Size const & GetIconSize() const { return aIconSize; }
diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
index 0551f2ad03c8..df6b29e1ef21 100644
--- a/include/svx/charmap.hxx
+++ b/include/svx/charmap.hxx
@@ -103,8 +103,8 @@ public:
virtual sal_Int32 getMaxCharCount() const;
- void Show() { mxScrollArea->show(); }
- void Hide() { mxScrollArea->hide(); }
+ virtual void Show() override { mxScrollArea->show(); }
+ virtual void Hide() override { mxScrollArea->hide(); }
uno::Reference<css::accessibility::XAccessible> getAccessibleParent() { return GetDrawingArea()->get_accessible_parent(); }
diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx
index db60521a195d..e8bbb2129912 100644
--- a/include/vcl/customweld.hxx
+++ b/include/vcl/customweld.hxx
@@ -33,7 +33,7 @@ public:
virtual void GetFocus() {}
virtual void LoseFocus() {}
virtual void StyleUpdated() { Invalidate(); }
- virtual bool ContextMenu(const Point&) { return false; }
+ virtual bool ContextMenu(const CommandEvent&) { return false; }
virtual bool KeyInput(const KeyEvent&) { return false; }
virtual tools::Rectangle GetFocusRect() { return tools::Rectangle(); }
virtual FactoryFunction GetUITestFactory() const { return nullptr; }
@@ -49,8 +49,8 @@ public:
m_pDrawingArea->queue_draw_area(rRect.Left(), rRect.Top(), rRect.GetWidth(),
rRect.GetHeight());
}
- void Show() { m_pDrawingArea->show(); }
- void Hide() { m_pDrawingArea->hide(); }
+ virtual void Show() { m_pDrawingArea->show(); }
+ virtual void Hide() { m_pDrawingArea->hide(); }
void GrabFocus() { m_pDrawingArea->grab_focus(); }
bool HasFocus() const { return m_pDrawingArea->has_focus(); }
bool IsVisible() const { return m_pDrawingArea->get_visible(); }
@@ -101,7 +101,7 @@ private:
DECL_LINK(DoLoseFocus, weld::Widget&, void);
DECL_LINK(DoKeyPress, const KeyEvent&, bool);
DECL_LINK(DoFocusRect, weld::Widget&, tools::Rectangle);
- DECL_LINK(DoPopupMenu, const Point&, bool);
+ DECL_LINK(DoPopupMenu, const CommandEvent&, bool);
DECL_LINK(DoStyleUpdated, weld::Widget&, void);
DECL_LINK(DoRequestHelp, tools::Rectangle&, OUString);
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 33a6db730a85..2ea881a31fd6 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -620,7 +620,7 @@ private:
Link<const KeyEvent&, bool> m_aKeyPressHdl;
Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
Link<VclDrawingArea&, void> m_aStyleUpdatedHdl;
- Link<const Point&, bool> m_aPopupMenuHdl;
+ Link<const CommandEvent&, bool> m_aPopupMenuHdl;
Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
@@ -677,7 +677,7 @@ private:
}
virtual void Command(const CommandEvent& rEvent) override
{
- if (rEvent.GetCommand() == CommandEventId::ContextMenu && m_aPopupMenuHdl.Call(rEvent.GetMousePosPixel()))
+ if (rEvent.GetCommand() == CommandEventId::ContextMenu && m_aPopupMenuHdl.Call(rEvent))
return;
Control::Command(rEvent);
}
@@ -755,7 +755,7 @@ public:
{
m_aStyleUpdatedHdl = rLink;
}
- void SetPopupMenuHdl(const Link<const Point&, bool>& rLink)
+ void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink)
{
m_aPopupMenuHdl = rLink;
}
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 91fc19f65a87..f258b83c2cd5 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -254,6 +254,8 @@ public:
virtual int hadjustment_get_upper() const = 0;
virtual void hadjustment_set_upper(int upper) = 0;
virtual int hadjustment_get_page_size() const = 0;
+ virtual void hadjustment_set_page_size(int size) = 0;
+ virtual void hadjustment_set_page_increment(int size) = 0;
virtual void set_hpolicy(VclPolicyType eHPolicy) = 0;
virtual VclPolicyType get_hpolicy() const = 0;
void connect_hadjustment_changed(const Link<ScrolledWindow&, void>& rLink)
@@ -270,6 +272,8 @@ public:
virtual int vadjustment_get_upper() const = 0;
virtual void vadjustment_set_upper(int upper) = 0;
virtual int vadjustment_get_page_size() const = 0;
+ virtual void vadjustment_set_page_size(int size) = 0;
+ virtual void vadjustment_set_page_increment(int size) = 0;
virtual int vadjustment_get_lower() const = 0;
virtual void vadjustment_set_lower(int upper) = 0;
virtual void set_vpolicy(VclPolicyType eVPolicy) = 0;
@@ -852,11 +856,14 @@ public:
{
insert_item(-1, rId, rStr, nullptr, &rImage, false);
}
+ virtual void insert_separator(int pos, const OUString& rId) = 0;
+ void append_separator(const OUString& rId) { insert_separator(-1, rId); }
virtual void remove_item(const OString& rId) = 0;
virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) = 0;
virtual void set_item_active(const OString& rIdent, bool bActive) = 0;
virtual void set_item_label(const OString& rIdent, const OUString& rLabel) = 0;
virtual void set_item_help_id(const OString& rIdent, const OString& rHelpId) = 0;
+ virtual void set_item_visible(const OString& rIdent, bool bVisible) = 0;
virtual OString get_item_help_id(const OString& rIdent) const = 0;
virtual void set_popover(weld::Widget* pPopover) = 0;
@@ -1474,7 +1481,7 @@ public:
protected:
Link<draw_args, void> m_aDrawHdl;
Link<Widget&, void> m_aStyleUpdatedHdl;
- Link<const Point&, bool> m_aPopupMenuHdl;
+ Link<const CommandEvent&, bool> m_aPopupMenuHdl;
Link<Widget&, tools::Rectangle> m_aGetFocusRectHdl;
Link<tools::Rectangle&, OUString> m_aQueryTooltipHdl;
@@ -1486,7 +1493,10 @@ protected:
public:
void connect_draw(const Link<draw_args, void>& rLink) { m_aDrawHdl = rLink; }
void connect_style_updated(const Link<Widget&, void>& rLink) { m_aStyleUpdatedHdl = rLink; }
- void connect_popup_menu(const Link<const Point&, bool>& rLink) { m_aPopupMenuHdl = rLink; }
+ void connect_popup_menu(const Link<const CommandEvent&, bool>& rLink)
+ {
+ m_aPopupMenuHdl = rLink;
+ }
void connect_focus_rect(const Link<Widget&, tools::Rectangle>& rLink)
{
m_aGetFocusRectHdl = rLink;
@@ -1512,11 +1522,17 @@ public:
virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) = 0;
virtual void set_sensitive(const OString& rIdent, bool bSensitive) = 0;
virtual void set_active(const OString& rIdent, bool bActive) = 0;
- virtual void show(const OString& rIdent, bool bShow) = 0;
+ virtual void set_visible(const OString& rIdent, bool bVisible) = 0;
virtual void insert(int pos, const OUString& rId, const OUString& rStr,
const OUString* pIconName, VirtualDevice* pImageSufface, bool bCheck)
= 0;
+
+ virtual void clear() = 0;
+
+ virtual void insert_separator(int pos, const OUString& rId) = 0;
+ void append_separator(const OUString& rId) { insert_separator(-1, rId); }
+
void append(const OUString& rId, const OUString& rStr)
{
insert(-1, rId, rStr, nullptr, nullptr, false);