1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _ANNOTATIONWINDOW_HXX 29 #define _ANNOTATIONWINDOW_HXX 30 31 #include <com/sun/star/office/XAnnotation.hpp> 32 33 #include <tools/datetime.hxx> 34 #include <tools/date.hxx> 35 36 #include <vcl/ctrl.hxx> 37 #include <vcl/lineinfo.hxx> 38 #include <vcl/floatwin.hxx> 39 40 #include <basegfx/polygon/b2dpolygon.hxx> 41 42 #include <svx/sdr/overlay/overlayobject.hxx> 43 #include <editeng/editstat.hxx> 44 45 class OutlinerView; 46 class Outliner; 47 class ScrollBar; 48 class Edit; 49 class MultiLineEdit; 50 class PopupMenu; 51 class SvxLanguageItem; 52 class OutlinerParaObject; 53 class SdDrawDocument; 54 55 namespace sd { 56 57 class AnnotationManagerImpl; 58 class AnnotationWindow; 59 class DrawDocShell; 60 class View; 61 62 class AnnotationTextWindow : public Control 63 { 64 private: 65 OutlinerView* mpOutlinerView; 66 AnnotationWindow* mpAnnotationWindow; 67 68 protected: 69 virtual void Paint( const Rectangle& rRect); 70 virtual void KeyInput( const KeyEvent& rKeyEvt ); 71 virtual void MouseMove( const MouseEvent& rMEvt ); 72 virtual void MouseButtonDown( const MouseEvent& rMEvt ); 73 virtual void MouseButtonUp( const MouseEvent& rMEvt ); 74 virtual void Command( const CommandEvent& rCEvt ); 75 virtual void LoseFocus(); 76 77 public: 78 AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits ); 79 ~AnnotationTextWindow(); 80 81 void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; } 82 83 virtual XubString GetSurroundingText() const; 84 virtual Selection GetSurroundingTextSelection() const; 85 86 virtual void GetFocus(); 87 }; 88 89 90 class AnnotationWindow : public FloatingWindow 91 { 92 private: 93 AnnotationManagerImpl& mrManager; 94 DrawDocShell* mpDocShell; 95 View* mpView; 96 SdDrawDocument* mpDoc; 97 98 OutlinerView* mpOutlinerView; 99 Outliner* mpOutliner; 100 ScrollBar* mpVScrollbar; 101 ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation; 102 bool mbReadonly; 103 bool mbProtected; 104 bool mbMouseOverButton; 105 AnnotationTextWindow* mpTextWindow; 106 MultiLineEdit* mpMeta; 107 Rectangle maRectMetaButton; 108 basegfx::B2DPolygon maPopupTriangle; 109 110 protected: 111 void SetSizePixel( const Size& rNewSize ); 112 113 DECL_LINK(ModifyHdl, void*); 114 DECL_LINK(ScrollHdl, ScrollBar*); 115 116 public: 117 AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, ::Window* pParent ); 118 virtual ~AnnotationWindow(); 119 120 void StartEdit(); 121 122 virtual SvxLanguageItem GetLanguage(void); 123 124 void setAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, bool bGrabFocus = false ); 125 const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& getAnnotation() const { return mxAnnotation; } 126 127 void ExecuteSlot( sal_uInt16 nSID ); 128 129 ScrollBar* Scrollbar() { return mpVScrollbar;} 130 131 DrawDocShell* DocShell() { return mpDocShell; } 132 OutlinerView* getView() { return mpOutlinerView; } 133 sd::View* DocView() { return mpView; } 134 Outliner* Engine() { return mpOutliner; } 135 SdDrawDocument* Doc() { return mpDoc; } 136 137 long GetPostItTextHeight(); 138 139 void InitControls(); 140 void HidePostIt(); 141 void DoResize(); 142 void ResizeIfNeccessary(long aOldHeight, long aNewHeight); 143 void SetScrollbar(); 144 145 void Rescale(); 146 147 bool IsReadOnly() { return mbReadonly;} 148 149 bool IsProtected() { return mbProtected; } 150 151 void SetLanguage(const SvxLanguageItem aNewItem); 152 153 sal_Int32 GetScrollbarWidth(); 154 155 void ToggleInsMode(); 156 157 DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*); 158 159 virtual void Deactivate(); 160 virtual void Paint( const Rectangle& rRect); 161 virtual void MouseMove( const MouseEvent& rMEvt ); 162 virtual void MouseButtonDown( const MouseEvent& rMEvt ); 163 virtual void Command( const CommandEvent& rCEvt ); 164 virtual void GetFocus(); 165 166 void SetColor(); 167 168 Color maColor; 169 Color maColorDark; 170 Color maColorLight; 171 }; 172 173 } // namespace sd 174 175 #endif 176