tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sd / source / ui / annotations / annotationwindow.hxx
blob31f82348b37109ba76509e30ae3dd43063196996
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #pragma once
22 #include <vcl/weld.hxx>
23 #include <tools/long.hxx>
24 #include <svx/weldeditview.hxx>
25 #include <svx/annotation/Annotation.hxx>
28 class OutlinerView;
29 class Outliner;
30 class SvxLanguageItem;
31 class SdDrawDocument;
33 namespace sdr::annotation { class TextApiObject; }
35 namespace sd
38 class AnnotationManagerImpl;
39 class DrawDocShell;
40 class AnnotationWindow;
42 class AnnotationTextWindow : public WeldEditView
44 private:
45 AnnotationWindow& mrContents;
47 public:
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
65 private:
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;
73 bool mbReadonly;
74 bool mbProtected;
76 rtl::Reference<sdr::annotation::Annotation> mxAnnotation;
78 public:
79 Color maColor;
80 Color maColorDark;
81 Color maColorLight;
83 private:
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();
99 void InitControls();
101 void SetMapMode(const MapMode& rNewMapMode);
102 void setAnnotation(rtl::Reference<sdr::annotation::Annotation> const& xAnnotation);
104 static sal_Int32 GetPrefScrollbarWidth() { return 16; }
105 public:
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); }
111 void DoResize();
112 void ResizeIfNecessary(::tools::Long aOldHeight, ::tools::Long aNewHeight);
113 void SetScrollbar();
114 void StartEdit();
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);
126 void Rescale();
128 void ToggleInsMode();
130 bool IsProtected() const { return mbProtected; }
132 OutlinerView* GetOutlinerView() { return mpOutlinerView.get();}
133 ::Outliner* GetOutliner() { return mpOutliner.get();}
134 ~AnnotationWindow();
136 void SetColor();
139 sdr::annotation::TextApiObject* getTextApiObject( const css::uno::Reference< css::office::XAnnotation >& xAnnotation );
142 } // namespace sd
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */