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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <vcl/weld.hxx>
23 #include <tools/long.hxx>
24 #include <svx/weldeditview.hxx>
25 #include <svx/annotation/Annotation.hxx>
30 class SvxLanguageItem
;
33 namespace sdr::annotation
{ class TextApiObject
; }
38 class AnnotationManagerImpl
;
40 class AnnotationWindow
;
42 class AnnotationTextWindow
: public WeldEditView
45 AnnotationWindow
& mrContents
;
48 AnnotationTextWindow(AnnotationWindow
& rContents
);
50 virtual EditView
* GetEditView() const override
;
52 virtual EditEngine
* GetEditEngine() const override
;
54 virtual void EditViewScrollStateChange() override
;
56 void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
58 virtual void Paint(vcl::RenderContext
& rRenderContext
, const ::tools::Rectangle
& rRect
) override
;
59 virtual bool KeyInput(const KeyEvent
& rKeyEvt
) override
;
60 virtual bool Command(const CommandEvent
& rCEvt
) override
;
63 class AnnotationWindow final
66 std::unique_ptr
<weld::Builder
> mxBuilder
;
67 std::unique_ptr
<weld::Popover
> mxPopover
;
68 std::unique_ptr
<weld::Widget
> mxContainer
;
70 DrawDocShell
* mpDocShell
;
71 SdDrawDocument
* mpDoc
;
76 rtl::Reference
<sdr::annotation::Annotation
> mxAnnotation
;
84 vcl::Font maLabelFont
;
86 std::unique_ptr
<OutlinerView
> mpOutlinerView
;
87 std::unique_ptr
<::Outliner
> mpOutliner
;
89 std::unique_ptr
<weld::ScrolledWindow
> mxVScrollbar
;
90 std::unique_ptr
<WeldEditView
> mxTextControl
;
91 std::unique_ptr
<weld::CustomWeld
> mxTextControlWin
;
92 std::unique_ptr
<weld::Label
> mxMeta
;
93 std::unique_ptr
<weld::MenuButton
> mxMenuButton
;
95 DECL_LINK(ScrollHdl
, weld::ScrolledWindow
&, void);
96 DECL_LINK(MenuItemSelectedHdl
, const OUString
&, void);
98 void FillMenuButton();
101 void SetMapMode(const MapMode
& rNewMapMode
);
102 void setAnnotation(rtl::Reference
<sdr::annotation::Annotation
> const& xAnnotation
);
104 static sal_Int32
GetPrefScrollbarWidth() { return 16; }
106 AnnotationWindow(weld::Window
* pParent
, const ::tools::Rectangle
& rRect
, DrawDocShell
* pDocShell
,
107 const rtl::Reference
<sdr::annotation::Annotation
>& xAnnotation
);
109 void connect_closed(const Link
<weld::Popover
&, void>& rLink
) { mxPopover
->connect_closed(rLink
); }
112 void ResizeIfNecessary(::tools::Long aOldHeight
, ::tools::Long aNewHeight
);
116 const rtl::Reference
<sdr::annotation::Annotation
>& getAnnotation() const { return mxAnnotation
; }
118 void SaveToDocument();
120 ::tools::Long
GetPostItTextHeight();
122 DrawDocShell
* DocShell() { return mpDocShell
; }
124 void SetLanguage(const SvxLanguageItem
&aNewItem
);
128 void ToggleInsMode();
130 bool IsProtected() const { return mbProtected
; }
132 OutlinerView
* GetOutlinerView() { return mpOutlinerView
.get();}
133 ::Outliner
* GetOutliner() { return mpOutliner
.get();}
139 sdr::annotation::TextApiObject
* getTextApiObject( const css::uno::Reference
< css::office::XAnnotation
>& xAnnotation
);
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */