1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _ANNOTATIONWINDOW_HXX 25 #define _ANNOTATIONWINDOW_HXX 26 27 #include <com/sun/star/office/XAnnotation.hpp> 28 29 #include <tools/datetime.hxx> 30 #include <tools/date.hxx> 31 32 #include <vcl/ctrl.hxx> 33 #include <vcl/lineinfo.hxx> 34 #include <vcl/floatwin.hxx> 35 36 #include <basegfx/polygon/b2dpolygon.hxx> 37 38 #include <svx/sdr/overlay/overlayobject.hxx> 39 #include <editeng/editstat.hxx> 40 41 class OutlinerView; 42 class Outliner; 43 class ScrollBar; 44 class Edit; 45 class MultiLineEdit; 46 class PopupMenu; 47 class SvxLanguageItem; 48 class OutlinerParaObject; 49 class SdDrawDocument; 50 51 namespace sd { 52 53 class AnnotationManagerImpl; 54 class AnnotationWindow; 55 class DrawDocShell; 56 class View; 57 58 class AnnotationTextWindow : public Control 59 { 60 private: 61 OutlinerView* mpOutlinerView; 62 AnnotationWindow* mpAnnotationWindow; 63 64 protected: 65 virtual void Paint( const Rectangle& rRect); 66 virtual void KeyInput( const KeyEvent& rKeyEvt ); 67 virtual void MouseMove( const MouseEvent& rMEvt ); 68 virtual void MouseButtonDown( const MouseEvent& rMEvt ); 69 virtual void MouseButtonUp( const MouseEvent& rMEvt ); 70 virtual void Command( const CommandEvent& rCEvt ); 71 virtual void LoseFocus(); 72 73 public: 74 AnnotationTextWindow( AnnotationWindow* pParent, WinBits nBits ); 75 ~AnnotationTextWindow(); 76 SetOutlinerView(OutlinerView * pOutlinerView)77 void SetOutlinerView( OutlinerView* pOutlinerView ) { mpOutlinerView = pOutlinerView; } 78 79 virtual XubString GetSurroundingText() const; 80 virtual Selection GetSurroundingTextSelection() const; 81 82 virtual void GetFocus(); 83 }; 84 85 86 class AnnotationWindow : public FloatingWindow 87 { 88 private: 89 AnnotationManagerImpl& mrManager; 90 DrawDocShell* mpDocShell; 91 View* mpView; 92 SdDrawDocument* mpDoc; 93 94 OutlinerView* mpOutlinerView; 95 Outliner* mpOutliner; 96 ScrollBar* mpVScrollbar; 97 ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation > mxAnnotation; 98 bool mbReadonly; 99 bool mbProtected; 100 bool mbMouseOverButton; 101 AnnotationTextWindow* mpTextWindow; 102 MultiLineEdit* mpMeta; 103 Rectangle maRectMetaButton; 104 basegfx::B2DPolygon maPopupTriangle; 105 106 protected: 107 void SetSizePixel( const Size& rNewSize ); 108 109 DECL_LINK(ModifyHdl, void*); 110 DECL_LINK(ScrollHdl, ScrollBar*); 111 112 public: 113 AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, ::Window* pParent ); 114 virtual ~AnnotationWindow(); 115 116 void StartEdit(); 117 118 virtual SvxLanguageItem GetLanguage(void); 119 120 void setAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation, bool bGrabFocus = false ); getAnnotation() const121 const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& getAnnotation() const { return mxAnnotation; } 122 123 void ExecuteSlot( sal_uInt16 nSID ); 124 Scrollbar()125 ScrollBar* Scrollbar() { return mpVScrollbar;} 126 DocShell()127 DrawDocShell* DocShell() { return mpDocShell; } getView()128 OutlinerView* getView() { return mpOutlinerView; } DocView()129 sd::View* DocView() { return mpView; } Engine()130 Outliner* Engine() { return mpOutliner; } Doc()131 SdDrawDocument* Doc() { return mpDoc; } 132 133 long GetPostItTextHeight(); 134 135 void InitControls(); 136 void HidePostIt(); 137 void DoResize(); 138 void ResizeIfNeccessary(long aOldHeight, long aNewHeight); 139 void SetScrollbar(); 140 141 void Rescale(); 142 IsReadOnly()143 bool IsReadOnly() { return mbReadonly;} 144 IsProtected()145 bool IsProtected() { return mbProtected; } 146 147 void SetLanguage(const SvxLanguageItem aNewItem); 148 149 sal_Int32 GetScrollbarWidth(); 150 151 void ToggleInsMode(); 152 153 DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*); 154 155 virtual void Deactivate(); 156 virtual void Paint( const Rectangle& rRect); 157 virtual void MouseMove( const MouseEvent& rMEvt ); 158 virtual void MouseButtonDown( const MouseEvent& rMEvt ); 159 virtual void Command( const CommandEvent& rCEvt ); 160 virtual void GetFocus(); 161 162 void SetColor(); 163 164 Color maColor; 165 Color maColorDark; 166 Color maColorLight; 167 }; 168 169 } // namespace sd 170 171 #endif 172