Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/inc/salmenu.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 <utility>
23
#include <vcl/menu.hxx>
24
#include <vcl/image.hxx>
25
26
struct SystemMenuData;
27
class FloatingWindow;
28
class SalFrame;
29
30
struct SalItemParams
31
{
32
    Image           aImage;                 // Image
33
    VclPtr<Menu>    pMenu;                  // Pointer to Menu
34
    OUString        aText;                  // Menu-Text
35
    MenuItemType    eType;                  // MenuItem-Type
36
    sal_uInt16      nId;                    // item Id
37
    MenuItemBits    nBits;                  // MenuItem-Bits
38
};
39
40
struct SalMenuButtonItem
41
{
42
    sal_uInt16          mnId;
43
    Image               maImage;
44
    OUString            maToolTipText;
45
46
0
    SalMenuButtonItem() : mnId( 0 ) {}
47
    SalMenuButtonItem( sal_uInt16 i_nId, Image aImg, OUString  i_TTText )
48
0
    : mnId( i_nId ), maImage(std::move( aImg )), maToolTipText(std::move( i_TTText )) {}
49
};
50
51
class VCL_PLUGIN_PUBLIC SalMenuItem
52
{
53
public:
54
    virtual ~SalMenuItem();
55
};
56
57
class VCL_PLUGIN_PUBLIC SalMenu
58
{
59
public:
60
    virtual ~SalMenu();
61
62
    virtual bool VisibleMenuBar() = 0;  // must return true to actually DISPLAY native menu bars
63
                                            // otherwise only menu messages are processed (eg, OLE on Windows)
64
0
    virtual void ShowMenuBar( bool ) {}
65
    virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) = 0;
66
    virtual void RemoveItem( unsigned nPos ) = 0;
67
    virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) = 0;
68
    virtual void SetFrame( const SalFrame* pFrame ) = 0;
69
0
    virtual void SetItemBits( unsigned /*nPos*/, MenuItemBits /*nBits*/ ) {}
70
    virtual void CheckItem( unsigned nPos, bool bCheck ) = 0;
71
    virtual void EnableItem( unsigned nPos, bool bEnable ) = 0;
72
    virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText )= 0;
73
0
    virtual void SetItemTooltip(SalMenuItem* /*pSalMenuItem*/, const OUString& /*rTooltip*/) {};
74
    virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) = 0;
75
    virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) = 0;
76
    virtual void GetSystemMenuData(SystemMenuData& rData);
77
    virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags);
78
    virtual void ShowCloseButton(bool bShow);
79
    virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false if not implemented or failure
80
    virtual void RemoveMenuBarButton( sal_uInt16 nId );
81
0
    virtual void Update() {}
82
83
0
    virtual bool CanGetFocus() const { return false; }
84
0
    virtual bool TakeFocus() { return false; }
85
86
    // TODO: implement show/hide for the Win/Mac VCL native backends
87
0
    virtual void ShowItem( unsigned nPos, bool bShow ) { EnableItem( nPos, bShow ); }
88
89
    // return an empty rectangle if not implemented
90
    // return Rectangle( Point( -1, -1 ), Size( 1, 1 ) ) if menu bar buttons implemented
91
    // but rectangle cannot be determined
92
    virtual tools::Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame );
93
94
    virtual int GetMenuBarHeight() const;
95
};
96
97
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */