Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/sfx2/templatedlglocalview.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
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/.
8
 */
9
#pragma once
10
11
#include <sfx2/templatelocalview.hxx>
12
#include <sfx2/listview.hxx>
13
14
enum class TemplateViewMode
15
{
16
    ListView,
17
    ThumbnailView
18
};
19
20
class TemplateDlgLocalView final : public TemplateLocalView, public ListView
21
{
22
    friend class TemplateDlgLocalViewUIObject;
23
24
public:
25
    TemplateDlgLocalView(std::unique_ptr<weld::ScrolledWindow> xWindow,
26
                         std::unique_ptr<weld::Menu> xMenu,
27
                         std::unique_ptr<weld::TreeView> xTreeView);
28
29
    void setTemplateViewMode(TemplateViewMode eMode);
30
    TemplateViewMode getTemplateViewMode() const;
31
32
    virtual void showAllTemplates() override;
33
34
    void showRegion(TemplateContainerItem const* pItem);
35
36
    void showRegion(std::u16string_view rName);
37
38
    void reload();
39
40
    virtual bool KeyInput(const KeyEvent& rKEvt) override;
41
42
    void createContextMenu(const bool bIsDefault, const bool bIsBuiltIn, const bool bIsSingleSel,
43
                           const OUString& rDefaultImg);
44
45
    virtual void Show() override;
46
47
    virtual void Hide() override;
48
49
    bool IsVisible() const;
50
51
    void GrabFocus();
52
53
    void connect_focus_rect(const Link<weld::Widget&, tools::Rectangle>& rLink)
54
0
    {
55
0
        GetDrawingArea()->connect_focus_rect(rLink);
56
0
    }
57
58
0
    void MakeItemVisible(sal_uInt16 nId) { ThumbnailView::MakeItemVisible(nId); }
59
60
    void insertItems(const std::vector<TemplateItemProperties>& rTemplates, bool isRegionSelected,
61
                     bool bShowCategoryInTooltip);
62
63
    virtual FactoryFunction GetUITestFactory() const override;
64
65
private:
66
    void ContextMenuSelectHdl(std::u16string_view rIdent);
67
68
    void insertFilteredItems();
69
70
    void syncCursor();
71
72
    void updateSelection();
73
74
    DECL_LINK(RowActivatedHdl, const weld::TreeIter&, bool);
75
76
    DECL_LINK(ListViewChangedHdl, weld::ItemView&, void);
77
78
    DECL_LINK(PopupMenuHdl, const CommandEvent&, bool);
79
80
    DECL_LINK(KeyPressHdl, const KeyEvent&, bool);
81
82
    TemplateViewMode mViewMode;
83
};
84
85
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */