1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #ifndef INCLUDED_SFX2_SOURCE_INC_TEMPLATESEARCHVIEW_HXX
11 #define INCLUDED_SFX2_SOURCE_INC_TEMPLATESEARCHVIEW_HXX
13 #include <sfx2/thumbnailview.hxx>
14 #include <sfx2/listview.hxx>
16 class TemplateViewItem
;
20 class TemplateSearchView final
: public ThumbnailView
, public ListView
24 TemplateSearchView(std::unique_ptr
<weld::ScrolledWindow
> xWindow
,
25 std::unique_ptr
<weld::Menu
> xMenu
,
26 std::unique_ptr
<weld::TreeView
> xTreeView
);
28 void setOpenTemplateHdl (const Link
<ThumbnailViewItem
*, void> &rLink
);
30 void ContextMenuSelectHdl(std::string_view rIdent
);
32 void setCreateContextMenuHdl(const Link
<ThumbnailViewItem
*,void> &rLink
);
34 void setEditTemplateHdl(const Link
<ThumbnailViewItem
*,void> &rLink
);
36 void setDeleteTemplateHdl(const Link
<ThumbnailViewItem
*,void> &rLink
);
38 void setDefaultTemplateHdl(const Link
<ThumbnailViewItem
*,void> &rLink
);
40 void createContextMenu(const bool bIsDefault
, const bool bIsBuiltIn
);
42 void AppendItem(sal_uInt16 nAssocItemId
, sal_uInt16 nRegionId
, sal_uInt16 nIdx
,
43 const OUString
&rTitle
, const OUString
&rSubtitle
,
44 const OUString
&rPath
, const BitmapEx
&rImage
);
46 void setTemplateViewMode ( TemplateViewMode eMode
);
52 void Clear() override
;
54 bool IsVisible() const;
58 void updateSelection();
60 void connect_focus_rect(const Link
<weld::Widget
&, tools::Rectangle
>& rLink
) { GetDrawingArea()->connect_focus_rect(rLink
);}
62 void MakeItemVisible( sal_uInt16 nId
) { ThumbnailView::MakeItemVisible(nId
);}
64 DECL_LINK(RowActivatedHdl
, weld::TreeView
&, bool);
66 DECL_LINK(ListViewChangedHdl
, weld::TreeView
&, void);
68 DECL_LINK(PopupMenuHdl
, const CommandEvent
&, bool);
70 static BitmapEx
getDefaultThumbnail( const OUString
& rPath
);
72 void RemoveDefaultTemplateIcon(std::u16string_view rPath
);
75 virtual void OnItemDblClicked(ThumbnailViewItem
*pItem
) override
;
77 virtual bool MouseButtonDown( const MouseEvent
& rMEvt
) override
;
79 virtual bool Command(const CommandEvent
& rPos
) override
;
81 virtual bool KeyInput( const KeyEvent
& rKEvt
) override
;
83 DECL_LINK(KeyPressHdl
, const KeyEvent
&, bool);
85 TemplateViewItem
*maSelectedItem
;
89 Link
<ThumbnailViewItem
*, void> maOpenTemplateHdl
;
90 Link
<ThumbnailViewItem
*, void> maCreateContextMenuHdl
;
91 Link
<ThumbnailViewItem
*,void> maEditTemplateHdl
;
92 Link
<ThumbnailViewItem
*,void> maDeleteTemplateHdl
;
93 Link
<ThumbnailViewItem
*,void> maDefaultTemplateHdl
;
94 TemplateViewMode mViewMode
;
97 #endif // INCLUDED_SFX2_SOURCE_INC_TEMPLATESEARCHVIEW_HXX
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */