bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / annotations / annotationwindow.hxx
blob4eb3525af5c9e042cbdc070705dcd649cafe6378
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 #ifndef INCLUDED_SD_SOURCE_UI_ANNOTATIONS_ANNOTATIONWINDOW_HXX
21 #define INCLUDED_SD_SOURCE_UI_ANNOTATIONS_ANNOTATIONWINDOW_HXX
23 #include <com/sun/star/office/XAnnotation.hpp>
25 #include <vcl/ctrl.hxx>
26 #include <vcl/lineinfo.hxx>
27 #include <vcl/floatwin.hxx>
29 #include <basegfx/polygon/b2dpolygon.hxx>
31 #include <svx/sdr/overlay/overlayobject.hxx>
32 #include <editeng/editstat.hxx>
34 class OutlinerView;
35 class Outliner;
36 class ScrollBar;
37 class MultiLineEdit;
38 class SvxLanguageItem;
39 class SdDrawDocument;
41 namespace sd {
43 class AnnotationManagerImpl;
44 class AnnotationWindow;
45 class DrawDocShell;
46 class TextApiObject;
47 class View;
49 class AnnotationTextWindow : public Control
51 private:
52 OutlinerView* mpOutlinerView;
53 VclPtr<AnnotationWindow> mpAnnotationWindow;
55 protected:
56 virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect) SAL_OVERRIDE;
57 virtual void KeyInput( const KeyEvent& rKeyEvt ) SAL_OVERRIDE;
58 virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
59 virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
60 virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
61 virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
62 virtual void LoseFocus() SAL_OVERRIDE;
64 public:
65 AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits );
66 virtual ~AnnotationTextWindow();
67 virtual void dispose() SAL_OVERRIDE;
69 void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; }
71 virtual OUString GetSurroundingText() const SAL_OVERRIDE;
72 virtual Selection GetSurroundingTextSelection() const SAL_OVERRIDE;
74 virtual void GetFocus() SAL_OVERRIDE;
77 class AnnotationWindow : public FloatingWindow
79 private:
80 AnnotationManagerImpl& mrManager;
81 DrawDocShell* mpDocShell;
82 View* mpView;
83 SdDrawDocument* mpDoc;
85 OutlinerView* mpOutlinerView;
86 Outliner* mpOutliner;
87 VclPtr<ScrollBar> mpVScrollbar;
88 ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation;
89 bool mbReadonly;
90 bool mbProtected;
91 bool mbMouseOverButton;
92 VclPtr<AnnotationTextWindow> mpTextWindow;
93 VclPtr<MultiLineEdit> mpMeta;
94 Rectangle maRectMetaButton;
95 basegfx::B2DPolygon maPopupTriangle;
97 protected:
98 void SetSizePixel( const Size& rNewSize ) SAL_OVERRIDE;
100 DECL_STATIC_LINK(AnnotationWindow, ModifyHdl, void*);
101 DECL_LINK(ScrollHdl, ScrollBar*);
103 public:
104 AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, vcl::Window* pParent );
105 virtual ~AnnotationWindow();
106 virtual void dispose() SAL_OVERRIDE;
108 void StartEdit();
110 SvxLanguageItem GetLanguage();
112 void setAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, bool bGrabFocus = false );
113 const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& getAnnotation() const { return mxAnnotation; }
115 void ExecuteSlot( sal_uInt16 nSID );
117 ScrollBar* Scrollbar() { return mpVScrollbar;}
119 DrawDocShell* DocShell() { return mpDocShell; }
120 OutlinerView* getView() { return mpOutlinerView; }
121 sd::View* DocView() { return mpView; }
122 Outliner* Engine() { return mpOutliner; }
123 SdDrawDocument* Doc() { return mpDoc; }
125 long GetPostItTextHeight();
127 void InitControls();
128 void HidePostIt();
129 void DoResize();
130 void ResizeIfNecessary(long aOldHeight, long aNewHeight);
131 void SetScrollbar();
133 void Rescale();
135 bool IsReadOnly() { return mbReadonly;}
137 bool IsProtected() { return mbProtected; }
139 void SetLanguage(const SvxLanguageItem &aNewItem);
141 static sal_Int32 GetScrollbarWidth() { return 16; }
143 void ToggleInsMode();
145 DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
147 virtual void Deactivate() SAL_OVERRIDE;
148 virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect) SAL_OVERRIDE;
149 virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
150 virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
151 virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
152 virtual void GetFocus() SAL_OVERRIDE;
154 void SetColor();
156 Color maColor;
157 Color maColorDark;
158 Color maColorLight;
161 TextApiObject* getTextApiObject( const css::uno::Reference< css::office::XAnnotation >& xAnnotation );
164 } // namespace sd
166 #endif
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */