LibreOffice Module sw (master)  1
AnnotationWin.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SW_INC_ANNOTATIONWIN_HXX
21 #define INCLUDED_SW_INC_ANNOTATIONWIN_HXX
22 
24 #include <tools/date.hxx>
25 #include <tools/time.hxx>
26 #include <vcl/builder.hxx>
27 #include <vcl/window.hxx>
28 
29 #include "postithelper.hxx"
30 #include "swrect.hxx"
31 #include "SidebarWindowsTypes.hxx"
32 
33 class PopupMenu;
34 class OutlinerParaObject;
35 class SwPostItMgr;
36 class SwPostItField;
37 class OutlinerView;
38 class Outliner;
39 class ScrollBar;
40 class SwEditWin;
41 class SwView;
42 class Edit;
43 class MenuButton;
44 class SwFrame;
45 class SvxLanguageItem;
46 
47 namespace sw { namespace overlay {
48  class OverlayRanges;
49 }}
50 
51 namespace sw { namespace sidebarwindows {
52  class SidebarTextControl;
53  class AnchorOverlayObject;
54  class ShadowOverlayObject;
55 }}
56 
57 namespace sw { namespace annotation {
58 
59 class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
60 {
61  public:
62  SwAnnotationWin( SwEditWin& rEditWin,
63  SwPostItMgr& aMgr,
64  SwSidebarItem& rSidebarItem,
65  SwFormatField* aField );
66  virtual ~SwAnnotationWin() override;
67  virtual void dispose() override;
68 
69  void UpdateData();
70  void SetPostItText();
71  void Delete();
72  void GotoPos();
73  const SwPostItField* GetPostItField() { return mpField; }
74  void UpdateText(const OUString& aText);
75 
76  OUString GetAuthor();
77  Date GetDate();
79 
80  sal_uInt32 MoveCaret();
81 
83  sal_uInt32 CalcParent();
84  void InitAnswer(OutlinerParaObject const * pText);
85 
86  bool IsProtected();
87 
88  void SetSize( const Size& rNewSize );
89  void SetPosSizePixelRect( long nX,
90  long nY,
91  long nWidth,
92  long nHeight,
93  const SwRect& aAnchorRect,
94  const long PageBorder);
95  void SetPosAndSize();
96  void TranslateTopPosition(const long aAmount);
97  void CheckMetaText();
98 
99  Point const & GetAnchorPos() { return mAnchorRect.Pos(); }
100  const SwRect& GetAnchorRect() { return mAnchorRect; }
101  bool IsAnchorRectChanged() { return mbAnchorRectChanged; }
102  void ResetAnchorRectChanged() { mbAnchorRectChanged = false; }
103  const std::vector<basegfx::B2DRange>& GetAnnotationTextRanges() { return maAnnotationTextRanges; }
104  SwEditWin& EditWin();
105  SwSidebarItem& GetSidebarItem() { return mrSidebarItem; }
106 
107  OutlinerView* GetOutlinerView() { return mpOutlinerView.get();}
108  bool HasScrollbar() const;
109  bool IsScrollbarVisible() const;
110  ScrollBar* Scrollbar() { return mpVScrollbar; }
113  ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay.get();}
114 
115  long GetPostItTextHeight();
116 
117  void SwitchToPostIt(sal_uInt16 aDirection);
118  void SwitchToFieldPos();
119 
120  void ExecuteCommand(sal_uInt16 nSlot);
121  void InitControls();
122  void DoResize();
123  void ResizeIfNecessary(long aOldHeight, long aNewHeight);
124  void SetScrollbar();
125 
126  void SetVirtualPosSize( const Point& aPoint, const Size& aSize);
127  const Point VirtualPos() { return mPosSize.TopLeft(); }
128  const Size VirtualSize() { return mPosSize.GetSize(); }
129 
130  void ShowAnchorOnly(const Point &aPoint);
131  void ShowNote();
132  void HideNote();
133  void InvalidateControl();
134 
135  void ResetAttributes();
136 
137  void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
138  void SetReadonly(bool bSet);
139  bool IsReadOnly()
140  {
141  return mbReadonly;
142  }
143 
144  void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
145  const Color& ColorAnchor() { return mColorAnchor; }
146  const Color& ColorDark() { return mColorDark; }
147  const Color& ColorLight() { return mColorLight; }
148  void Rescale();
149 
150  void SetViewState(::sw::sidebarwindows::ViewState bViewState);
151 
152  bool IsFollow() { return mbIsFollow; }
153  void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
154 
155  sal_Int32 GetMetaHeight();
156  sal_Int32 GetMinimumSizeWithMeta();
157  sal_Int32 GetMinimumSizeWithoutMeta();
158  sal_Int32 GetMetaButtonAreaWidth();
159  sal_Int32 GetScrollbarWidth();
160  sal_Int32 GetNumFields();
161 
162  void SetSpellChecking();
163 
164  void ToggleInsMode();
165 
166  void ActivatePostIt();
167  void DeactivatePostIt();
168 
169  void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
170  const Color& aColor);
172  const Color& GetChangeColor() { return mChangeColor; }
173 
174  DECL_LINK( WindowEventListener, VclWindowEvent&, void );
175  bool IsMouseOverSidebarWin() const { return mbMouseOver; }
176 
177  void SetLanguage(const SvxLanguageItem& rNewItem);
178 
179  void ChangeSidebarItem( SwSidebarItem const & rSidebarItem );
180  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
181 
182  virtual void Draw(OutputDevice* pDev, const Point&, const Size&, DrawFlags) override;
183  virtual void KeyInput(const KeyEvent& rKeyEvt) override;
184  virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override;
185  virtual void MouseButtonUp(const MouseEvent& rMouseEvent) override;
186  virtual void MouseMove(const MouseEvent& rMouseEvent) override;
187  void PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
189  bool IsHitWindow(const Point& rPointLogic);
191  void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark);
192 
193  // Various access functions for 'resolved' status
194  void SetResolved(bool resolved);
195  void ToggleResolved();
196  void ToggleResolvedForThread();
197  bool IsResolved() const;
198  bool IsThreadResolved();
199 
202  SwAnnotationWin* GetTopReplyNote();
203 
204  private:
205  VclPtr<MenuButton> CreateMenuButton();
206  virtual void LoseFocus() override;
207  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
208  virtual void GetFocus() override;
209 
210  void SetSizePixel( const Size& rNewSize ) override;
211  SfxItemSet DefaultItem();
212 
213  DECL_LINK(ModifyHdl, LinkParamNone*, void);
214  DECL_LINK(ScrollHdl, ScrollBar*, void);
215  DECL_LINK(DeleteHdl, void*, void);
216 
217  sal_uInt32 CountFollowing();
218 
220 
224 
226 
227  std::unique_ptr<OutlinerView> mpOutlinerView;
228  std::unique_ptr<Outliner> mpOutliner;
229 
236 
237  std::unique_ptr<sw::sidebarwindows::AnchorOverlayObject> mpAnchor;
238  std::unique_ptr<sw::sidebarwindows::ShadowOverlayObject> mpShadow;
239  std::unique_ptr<sw::overlay::OverlayRanges> mpTextRangeOverlay;
240 
245 
247 
252 
254 
255  std::vector<basegfx::B2DRange> maAnnotationTextRanges;
256 
259 
262 
265 
269 };
270 
271 } } // end of namespace sw::annotation
272 #endif
273 
274 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:295
std::vector< basegfx::B2DRange > maAnnotationTextRanges
VclPtr< MenuButton > mpMenuButton
SwPostItHelper::SwLayoutStatus mLayoutStatus
::sw::overlay::OverlayRanges * TextRange()
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:402
Any GetTime(const OUString &val)
std::unique_ptr< sw::sidebarwindows::ShadowOverlayObject > mpShadow
const std::vector< basegfx::B2DRange > & GetAnnotationTextRanges()
Dialog to specify the properties of date form field.
Definition: accfrmobj.cxx:40
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
SwPostItHelper::SwLayoutStatus GetLayoutStatus()
std::unique_ptr< sw::overlay::OverlayRanges > mpTextRangeOverlay
const SwPostItField * GetPostItField()
std::unique_ptr< Outliner > mpOutliner
std::unique_ptr< OutlinerView > mpOutlinerView
DrawFlags
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
::sw::sidebarwindows::AnchorOverlayObject * Anchor()
void SetFollow(bool bIsFollow)
sw::sidebarwindows::SidebarPosition meSidebarPosition
std::unique_ptr< sw::sidebarwindows::AnchorOverlayObject > mpAnchor
VclPtr< sw::sidebarwindows::SidebarTextControl > mpSidebarTextControl
void SetLanguage(SwWrtShell &rWrtSh, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:223
VclPtr< ScrollBar > mpVScrollbar
::sw::sidebarwindows::ShadowOverlayObject * Shadow()
VclPtr< PopupMenu > mpButtonPopup
Definition: view.hxx:146