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>
26 namespace com::sun::star::office
{ class XAnnotation
; }
30 class SvxLanguageItem
;
35 class AnnotationManagerImpl
;
39 class AnnotationWindow
;
41 class AnnotationTextWindow
: public WeldEditView
44 AnnotationWindow
& mrContents
;
47 AnnotationTextWindow(AnnotationWindow
& rContents
);
49 virtual EditView
* GetEditView() const override
;
51 virtual EditEngine
* GetEditEngine() const override
;
53 virtual void EditViewScrollStateChange() override
;
55 void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
57 virtual void Paint(vcl::RenderContext
& rRenderContext
, const ::tools::Rectangle
& rRect
) override
;
58 virtual bool KeyInput(const KeyEvent
& rKeyEvt
) override
;
59 virtual bool Command(const CommandEvent
& rCEvt
) override
;
62 class AnnotationWindow final
65 std::unique_ptr
<weld::Builder
> mxBuilder
;
66 std::unique_ptr
<weld::Popover
> mxPopover
;
67 std::unique_ptr
<weld::Widget
> mxContainer
;
69 DrawDocShell
* mpDocShell
;
70 SdDrawDocument
* mpDoc
;
75 css::uno::Reference
< css::office::XAnnotation
> mxAnnotation
;
83 vcl::Font maLabelFont
;
85 std::unique_ptr
<OutlinerView
> mpOutlinerView
;
86 std::unique_ptr
<::Outliner
> mpOutliner
;
88 std::unique_ptr
<weld::ScrolledWindow
> mxVScrollbar
;
89 std::unique_ptr
<WeldEditView
> mxTextControl
;
90 std::unique_ptr
<weld::CustomWeld
> mxTextControlWin
;
91 std::unique_ptr
<weld::Label
> mxMeta
;
92 std::unique_ptr
<weld::MenuButton
> mxMenuButton
;
94 DECL_LINK(ScrollHdl
, weld::ScrolledWindow
&, void);
95 DECL_LINK(MenuItemSelectedHdl
, const OUString
&, void);
97 void FillMenuButton();
100 void SetMapMode(const MapMode
& rNewMapMode
);
101 void setAnnotation(const css::uno::Reference
<css::office::XAnnotation
>& xAnnotation
);
103 static sal_Int32
GetPrefScrollbarWidth() { return 16; }
105 AnnotationWindow(weld::Window
* pParent
, const ::tools::Rectangle
& rRect
, DrawDocShell
* pDocShell
,
106 const css::uno::Reference
<css::office::XAnnotation
>& xAnnotation
);
108 void connect_closed(const Link
<weld::Popover
&, void>& rLink
) { mxPopover
->connect_closed(rLink
); }
111 void ResizeIfNecessary(::tools::Long aOldHeight
, ::tools::Long aNewHeight
);
115 const css::uno::Reference
<css::office::XAnnotation
>& getAnnotation() const { return mxAnnotation
; }
117 void SaveToDocument();
119 ::tools::Long
GetPostItTextHeight();
121 DrawDocShell
* DocShell() { return mpDocShell
; }
123 void SetLanguage(const SvxLanguageItem
&aNewItem
);
127 void ToggleInsMode();
129 bool IsProtected() const { return mbProtected
; }
131 OutlinerView
* GetOutlinerView() { return mpOutlinerView
.get();}
132 ::Outliner
* GetOutliner() { return mpOutliner
.get();}
138 TextApiObject
* getTextApiObject( const css::uno::Reference
< css::office::XAnnotation
>& xAnnotation
);
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */