Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/starmath/inc/ElementsDockingWindow.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
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#pragma once
21
22
#include <sfx2/dockwin.hxx>
23
#include <vcl/customweld.hxx>
24
#include <vcl/weld.hxx>
25
#include <unotools/resmgr.hxx>
26
27
#include "node.hxx"
28
#include "parsebase.hxx"
29
30
#include <memory>
31
#include <vector>
32
33
class SmDocShell;
34
struct ElementData;
35
36
class SmElementsControl
37
{
38
    std::unique_ptr<AbstractSmParser> maParser;
39
40
    SmDocShell*   mpDocShell;
41
    SmFormat      maFormat;
42
    int           mnCurrentSetIndex;
43
    sal_Int16     m_nSmSyntaxVersion;
44
    bool          m_bAllowDelete;
45
    OUString      m_sHoveredItem;
46
47
    std::vector<std::unique_ptr<ElementData>> maItemDatas;
48
    std::unique_ptr<weld::IconView> mpIconView;
49
    std::unique_ptr<weld::Menu> mxPopup;
50
51
    Link<const OUString&, void> maSelectHdlLink;
52
53
    void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText);
54
    void addElements(int nCategory);
55
56
    void build();
57
58
    DECL_LINK(QueryTooltipHandler, const weld::TreeIter&, OUString);
59
    DECL_LINK(ElementActivatedHandler, weld::IconView&, bool);
60
    DECL_LINK(MousePressHdl, const MouseEvent&, bool);
61
62
    static OUString GetElementSource(const OUString& itemId);
63
    static OUString GetElementHelpText(const OUString& itemId);
64
    static int GetElementPos(const OUString& itemId);
65
66
public:
67
68
    explicit SmElementsControl(std::unique_ptr<weld::IconView> pIconView,
69
                               std::unique_ptr<weld::Menu> pMenu);
70
    ~SmElementsControl();
71
72
    static const std::vector<TranslateId>& categories();
73
    void setElementSetIndex(int nSetIndex, bool bForceBuild = false);
74
75
    void setSmSyntaxVersion(sal_Int16 nSmSyntaxVersion);
76
77
0
    void SetSelectHdl(const Link<const OUString&, void>& rLink) { maSelectHdlLink = rLink; }
78
79
0
    void SetAllowDelete(bool bAllow) { m_bAllowDelete = bAllow; }
80
81
    static Color GetTextColor();
82
    static Color GetControlBackground();
83
};
84
85
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */