bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / annotations / annotationwindow.hxx
blobef4d3763f6a2223fd903501751e756eb1bf7aac7
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 _ANNOTATIONWINDOW_HXX
21 #define _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 View;
48 class AnnotationTextWindow : public Control
50 private:
51 OutlinerView* mpOutlinerView;
52 AnnotationWindow* mpAnnotationWindow;
54 protected:
55 virtual void Paint( const Rectangle& rRect);
56 virtual void KeyInput( const KeyEvent& rKeyEvt );
57 virtual void MouseMove( const MouseEvent& rMEvt );
58 virtual void MouseButtonDown( const MouseEvent& rMEvt );
59 virtual void MouseButtonUp( const MouseEvent& rMEvt );
60 virtual void Command( const CommandEvent& rCEvt );
61 virtual void LoseFocus();
63 public:
64 AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits );
65 ~AnnotationTextWindow();
67 void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; }
69 virtual OUString GetSurroundingText() const;
70 virtual Selection GetSurroundingTextSelection() const;
72 virtual void GetFocus();
76 class AnnotationWindow : public FloatingWindow
78 private:
79 AnnotationManagerImpl& mrManager;
80 DrawDocShell* mpDocShell;
81 View* mpView;
82 SdDrawDocument* mpDoc;
84 OutlinerView* mpOutlinerView;
85 Outliner* mpOutliner;
86 ScrollBar* mpVScrollbar;
87 ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation;
88 bool mbReadonly;
89 bool mbProtected;
90 bool mbMouseOverButton;
91 AnnotationTextWindow* mpTextWindow;
92 MultiLineEdit* mpMeta;
93 Rectangle maRectMetaButton;
94 basegfx::B2DPolygon maPopupTriangle;
96 protected:
97 void SetSizePixel( const Size& rNewSize );
99 DECL_LINK(ModifyHdl, void*);
100 DECL_LINK(ScrollHdl, ScrollBar*);
102 public:
103 AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, ::Window* pParent );
104 virtual ~AnnotationWindow();
106 void StartEdit();
108 virtual SvxLanguageItem GetLanguage(void);
110 void setAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, bool bGrabFocus = false );
111 const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& getAnnotation() const { return mxAnnotation; }
113 void ExecuteSlot( sal_uInt16 nSID );
115 ScrollBar* Scrollbar() { return mpVScrollbar;}
117 DrawDocShell* DocShell() { return mpDocShell; }
118 OutlinerView* getView() { return mpOutlinerView; }
119 sd::View* DocView() { return mpView; }
120 Outliner* Engine() { return mpOutliner; }
121 SdDrawDocument* Doc() { return mpDoc; }
123 long GetPostItTextHeight();
125 void InitControls();
126 void HidePostIt();
127 void DoResize();
128 void ResizeIfNeccessary(long aOldHeight, long aNewHeight);
129 void SetScrollbar();
131 void Rescale();
133 bool IsReadOnly() { return mbReadonly;}
135 bool IsProtected() { return mbProtected; }
137 void SetLanguage(const SvxLanguageItem &aNewItem);
139 sal_Int32 GetScrollbarWidth();
141 void ToggleInsMode();
143 DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
145 virtual void Deactivate();
146 virtual void Paint( const Rectangle& rRect);
147 virtual void MouseMove( const MouseEvent& rMEvt );
148 virtual void MouseButtonDown( const MouseEvent& rMEvt );
149 virtual void Command( const CommandEvent& rCEvt );
150 virtual void GetFocus();
152 void SetColor();
154 Color maColor;
155 Color maColorDark;
156 Color maColorLight;
159 } // namespace sd
161 #endif
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */