Coverage Report

Created: 2026-11-06 11:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sd/source/ui/annotations/annotationwindow.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 <vcl/weld/Builder.hxx>
23
#include <vcl/weld/Label.hxx>
24
#include <vcl/weld/MenuButton.hxx>
25
#include <vcl/weld/Popover.hxx>
26
#include <vcl/weld/ScrolledWindow.hxx>
27
#include <vcl/weld/Window.hxx>
28
#include <tools/long.hxx>
29
#include <svx/weldeditview.hxx>
30
#include <svx/annotation/Annotation.hxx>
31
32
33
class OutlinerView;
34
class Outliner;
35
class SvxLanguageItem;
36
class SdDrawDocument;
37
38
namespace sdr::annotation { class TextApiObject; }
39
40
namespace sd
41
{
42
43
class DrawDocShell;
44
class AnnotationWindow;
45
46
class AnnotationTextWindow : public WeldEditView
47
{
48
private:
49
    AnnotationWindow& mrContents;
50
51
public:
52
    AnnotationTextWindow(AnnotationWindow& rContents);
53
54
    virtual EditView* GetEditView() const override;
55
56
    virtual EditEngine* GetEditEngine() const override;
57
58
    virtual void EditViewScrollStateChange() override;
59
60
    void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
61
62
    virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect) override;
63
    virtual bool KeyInput(const KeyEvent& rKeyEvt) override;
64
    virtual bool Command(const CommandEvent& rCEvt) override;
65
};
66
67
class AnnotationWindow final
68
{
69
private:
70
    std::unique_ptr<weld::Builder> mxBuilder;
71
    std::unique_ptr<weld::Popover> mxPopover;
72
    std::unique_ptr<weld::Widget> mxContainer;
73
74
    DrawDocShell* mpDocShell;
75
    SdDrawDocument* mpDoc;
76
77
    bool mbReadonly;
78
    bool mbProtected;
79
80
    rtl::Reference<sdr::annotation::Annotation> mxAnnotation;
81
82
public:
83
    Color maColor;
84
    Color maColorDark;
85
    Color maColorLight;
86
87
private:
88
    vcl::Font maLabelFont;
89
90
    std::unique_ptr<OutlinerView> mpOutlinerView;
91
    std::unique_ptr<::Outliner>  mpOutliner;
92
93
    std::unique_ptr<weld::ScrolledWindow> mxVScrollbar;
94
    std::unique_ptr<WeldEditView> mxTextControl;
95
    std::unique_ptr<weld::CustomWeld> mxTextControlWin;
96
    std::unique_ptr<weld::Label> mxMeta;
97
    std::unique_ptr<weld::MenuButton> mxMenuButton;
98
99
    DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
100
    DECL_LINK(MenuItemSelectedHdl, const OUString&, void);
101
102
    void FillMenuButton();
103
    void InitControls();
104
105
    void SetMapMode(const MapMode& rNewMapMode);
106
    void setAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation);
107
108
0
    static sal_Int32 GetPrefScrollbarWidth() { return 16; }
109
public:
110
    AnnotationWindow(weld::Window* pParent, const ::tools::Rectangle& rRect, DrawDocShell* pDocShell,
111
                     const rtl::Reference<sdr::annotation::Annotation>& xAnnotation);
112
    ~AnnotationWindow();
113
114
0
    void connect_closed(const Link<weld::Popover&, void>& rLink) { mxPopover->connect_closed(rLink); }
115
116
    void DoResize();
117
    void ResizeIfNecessary(::tools::Long aOldHeight, ::tools::Long aNewHeight);
118
    void SetScrollbar();
119
    void StartEdit();
120
121
0
    const rtl::Reference<sdr::annotation::Annotation>& getAnnotation() const { return mxAnnotation; }
122
123
    void SaveToDocument();
124
125
    ::tools::Long GetPostItTextHeight();
126
127
0
    DrawDocShell* DocShell() { return mpDocShell; }
128
129
    void SetLanguage(const SvxLanguageItem &aNewItem);
130
131
    void Rescale();
132
133
    void ToggleInsMode();
134
135
0
    bool IsProtected() const { return mbProtected; }
136
137
0
    OutlinerView* GetOutlinerView() { return mpOutlinerView.get();}
138
0
    ::Outliner* GetOutliner() { return mpOutliner.get();}
139
140
    void SetColor();
141
};
142
143
sdr::annotation::TextApiObject* getTextApiObject( const css::uno::Reference< css::office::XAnnotation >& xAnnotation );
144
145
146
} // namespace sd
147
148
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */