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>
27 #include <vcl/customweld.hxx>
28 
29 #include "postithelper.hxx"
30 #include "swrect.hxx"
31 #include "SidebarWindowsTypes.hxx"
32 
33 class EditView;
34 class PopupMenu;
35 class OutlinerParaObject;
36 class SwPostItMgr;
37 class SwPostItField;
38 class OutlinerView;
39 class Outliner;
40 class ScrollBar;
41 class SwEditWin;
42 class SwView;
43 class FixedText;
44 class MenuButton;
45 class SwFrame;
46 class SvxLanguageItem;
47 namespace sw::overlay { class OverlayRanges; }
48 namespace sw::sidebarwindows {
49  class SidebarTextControl;
50  class AnchorOverlayObject;
51  class ShadowOverlayObject;
52 }
53 
54 
55 namespace sw::annotation {
56 
57 class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public InterimItemWindow
58 {
59  public:
60  SwAnnotationWin( SwEditWin& rEditWin,
61  SwPostItMgr& aMgr,
62  SwSidebarItem& rSidebarItem,
63  SwFormatField* aField );
64  virtual ~SwAnnotationWin() override;
65  virtual void dispose() override;
66 
67  void UpdateData();
68  void SetPostItText();
69  void Delete();
70  void GotoPos();
71  const SwPostItField* GetPostItField() const { return mpField; }
72  void UpdateText(const OUString& aText);
73 
74  OUString GetAuthor() const;
75  Date GetDate() const;
76  tools::Time GetTime() const;
77 
78  sal_uInt32 MoveCaret();
79 
81  sal_uInt32 CalcParent();
82  void InitAnswer(OutlinerParaObject const * pText);
83 
84  bool IsProtected() const;
85 
86  void SetSize( const Size& rNewSize );
87  void SetPosSizePixelRect( tools::Long nX,
88  tools::Long nY,
89  tools::Long nWidth,
90  tools::Long nHeight,
91  const SwRect& aAnchorRect,
92  const tools::Long PageBorder);
93  void SetPosAndSize();
94  void TranslateTopPosition(const tools::Long aAmount);
95  void CheckMetaText();
96 
97  Point const & GetAnchorPos() { return mAnchorRect.Pos(); }
98  const SwRect& GetAnchorRect() const { return mAnchorRect; }
99  bool IsAnchorRectChanged() const { return mbAnchorRectChanged; }
100  void ResetAnchorRectChanged() { mbAnchorRectChanged = false; }
101  const std::vector<basegfx::B2DRange>& GetAnnotationTextRanges() const { return maAnnotationTextRanges; }
102  SwEditWin& EditWin();
103  SwSidebarItem& GetSidebarItem() { return mrSidebarItem; }
104 
105  OutlinerView* GetOutlinerView() { return mpOutlinerView.get();}
106  Outliner* GetOutliner() { return mpOutliner.get();}
107  bool HasScrollbar() const;
108  bool IsScrollbarVisible() const;
111  ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay.get();}
112 
113  tools::Long GetPostItTextHeight();
114 
115  void SwitchToPostIt(sal_uInt16 aDirection);
116  void SwitchToFieldPos();
117 
118  void ExecuteCommand(sal_uInt16 nSlot);
119  void InitControls();
120  void DoResize();
121  void ResizeIfNecessary(tools::Long aOldHeight, tools::Long aNewHeight);
122  void SetScrollbar();
123 
124  void SetVirtualPosSize( const Point& aPoint, const Size& aSize);
125  Point VirtualPos() { return mPosSize.TopLeft(); }
126  Size VirtualSize() { return mPosSize.GetSize(); }
127 
128  void ShowAnchorOnly(const Point &aPoint);
129  void ShowNote();
130  void HideNote();
131 
132  void ResetAttributes();
133 
134  void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
135  void SetReadonly(bool bSet);
136  bool IsReadOnly() const
137  {
138  return mbReadonly;
139  }
140 
141  void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
142  const Color& ColorDark() { return mColorDark; }
143  const Color& ColorLight() { return mColorLight; }
144  void Rescale();
145 
146  void SetViewState(::sw::sidebarwindows::ViewState bViewState);
147 
148  bool IsFollow() const { return mbIsFollow; }
149  void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
150 
151  sal_Int32 GetMetaHeight() const;
152  sal_Int32 GetMinimumSizeWithMeta() const;
153  sal_Int32 GetMinimumSizeWithoutMeta() const;
154  int GetPrefScrollbarWidth() const;
155  sal_Int32 GetNumFields() const;
156 
157  void SetSpellChecking();
158 
159  void ToggleInsMode();
160 
161  void ActivatePostIt();
162  void DeactivatePostIt();
163 
164  void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
165  const Color& aColor);
166  SwPostItHelper::SwLayoutStatus GetLayoutStatus() const { return mLayoutStatus; }
167  const Color& GetChangeColor() const { return mChangeColor; }
168 
169  bool IsMouseOverSidebarWin() const { return mbMouseOver; }
170 
171  void SetLanguage(const SvxLanguageItem& rNewItem);
172 
173  void ChangeSidebarItem( SwSidebarItem const & rSidebarItem );
174  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
175 
176  void DrawForPage(OutputDevice* pDev, const Point& rPos);
177 
178  void PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
180  bool IsHitWindow(const Point& rPointLogic);
182  void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark);
183 
184  // Various access functions for 'resolved' status
185  void SetResolved(bool resolved);
186  void ToggleResolved();
187  void ToggleResolvedForThread();
188  void DeleteThread();
189  bool IsResolved() const;
190  bool IsThreadResolved();
191 
192  //┬áSet this SwAnnotationWin as the currently active one
193  // return false if it was already active
194  bool SetActiveSidebarWin();
195  // Unset this SwAnnotationWin as the currently active one
196  void UnsetActiveSidebarWin();
197 
200  SwAnnotationWin* GetTopReplyNote();
201 
202  virtual FactoryFunction GetUITestFactory() const override;
203 
204  private:
205 
206  virtual void LoseFocus() override;
207  virtual void GetFocus() override;
208 
209  void SetSizePixel( const Size& rNewSize ) override;
210  SfxItemSet DefaultItem();
211 
212  DECL_LINK(ModifyHdl, LinkParamNone*, void);
213  DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
214  DECL_LINK(DeleteHdl, void*, void);
215  DECL_LINK(ToggleHdl, weld::ToggleButton&, void);
216  DECL_LINK(SelectHdl, const OString&, void);
217  DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
218  DECL_LINK(MouseMoveHdl, const MouseEvent&, bool);
219 
220  sal_uInt32 CountFollowing();
221 
223 
226 
228 
229  std::unique_ptr<OutlinerView> mpOutlinerView;
230  std::unique_ptr<Outliner> mpOutliner;
231 
232  std::unique_ptr<weld::ScrolledWindow> mxVScrollbar;
233  std::unique_ptr<sw::sidebarwindows::SidebarTextControl> mxSidebarTextControl;
234  std::unique_ptr<weld::CustomWeld> mxSidebarTextControlWin;
236  std::unique_ptr<weld::Label> mxMetadataAuthor;
237  std::unique_ptr<weld::Label> mxMetadataDate;
238  std::unique_ptr<weld::Label> mxMetadataResolved;
239  std::unique_ptr<weld::MenuButton> mxMenuButton;
240 
241  std::unique_ptr<sw::sidebarwindows::AnchorOverlayObject> mpAnchor;
242  std::unique_ptr<sw::sidebarwindows::ShadowOverlayObject> mpShadow;
243  std::unique_ptr<sw::overlay::OverlayRanges> mpTextRangeOverlay;
244 
249 
251 
256 
258 
259  std::vector<basegfx::B2DRange> maAnnotationTextRanges;
260 
263 
266 
269 
272 };
273 
274 } // end of namespace sw::annotation
275 
276 #endif
277 
278 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Label > mxMetadataDate
Base class of the Writer layout elements.
Definition: frame.hxx:298
std::unique_ptr< weld::ScrolledWindow > mxVScrollbar
std::vector< basegfx::B2DRange > maAnnotationTextRanges
std::unique_ptr< weld::Label > mxMetadataResolved
SwPostItHelper::SwLayoutStatus GetLayoutStatus() const
const SwRect & GetAnchorRect() const
SwPostItHelper::SwLayoutStatus mLayoutStatus
::sw::overlay::OverlayRanges * TextRange()
long Long
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:395
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
Any GetTime(const OUString &val)
std::unique_ptr< sw::sidebarwindows::ShadowOverlayObject > mpShadow
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
const SwPostItField * GetPostItField() const
std::unique_ptr< weld::MenuButton > mxMenuButton
std::unique_ptr< sw::overlay::OverlayRanges > mpTextRangeOverlay
std::unique_ptr< Outliner > mpOutliner
std::unique_ptr< OutlinerView > mpOutlinerView
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
const Color & GetChangeColor() const
::sw::sidebarwindows::AnchorOverlayObject * Anchor()
void SetFollow(bool bIsFollow)
std::unique_ptr< weld::CustomWeld > mxSidebarTextControlWin
sw::sidebarwindows::SidebarPosition meSidebarPosition
const std::vector< basegfx::B2DRange > & GetAnnotationTextRanges() const
std::unique_ptr< sw::sidebarwindows::AnchorOverlayObject > mpAnchor
::sw::sidebarwindows::ShadowOverlayObject * Shadow()
void SetLanguage(SwWrtShell &rWrtSh, std::u16string_view rLangText, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:219
std::unique_ptr< sw::sidebarwindows::SidebarTextControl > mxSidebarTextControl
std::unique_ptr< weld::Label > mxMetadataAuthor
Definition: view.hxx:144