android: Update app-specific/MIME type icons
[LibreOffice.git] / sd / source / ui / annotations / annotationwindow.hxx
bloba150ebf1c8cde4e0a55021b79b54f52929177540
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>
26 namespace com::sun::star::office { class XAnnotation; }
28 class OutlinerView;
29 class Outliner;
30 class SvxLanguageItem;
31 class SdDrawDocument;
33 namespace sd {
35 class AnnotationManagerImpl;
36 class DrawDocShell;
37 class TextApiObject;
39 class AnnotationWindow;
41 class AnnotationTextWindow : public WeldEditView
43 private:
44 AnnotationWindow& mrContents;
46 public:
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
64 private:
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;
72 bool mbReadonly;
73 bool mbProtected;
75 css::uno::Reference< css::office::XAnnotation > mxAnnotation;
77 public:
78 Color maColor;
79 Color maColorDark;
80 Color maColorLight;
82 private:
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();
98 void InitControls();
100 void SetMapMode(const MapMode& rNewMapMode);
101 void setAnnotation(const css::uno::Reference<css::office::XAnnotation>& xAnnotation);
103 static sal_Int32 GetPrefScrollbarWidth() { return 16; }
104 public:
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); }
110 void DoResize();
111 void ResizeIfNecessary(::tools::Long aOldHeight, ::tools::Long aNewHeight);
112 void SetScrollbar();
113 void StartEdit();
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);
125 void Rescale();
127 void ToggleInsMode();
129 bool IsProtected() const { return mbProtected; }
131 OutlinerView* GetOutlinerView() { return mpOutlinerView.get();}
132 ::Outliner* GetOutliner() { return mpOutliner.get();}
133 ~AnnotationWindow();
135 void SetColor();
138 TextApiObject* getTextApiObject( const css::uno::Reference< css::office::XAnnotation >& xAnnotation );
141 } // namespace sd
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */