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  class SidebarWinAccessible;
53 }
54 
55 
56 namespace sw::annotation {
57 
58 class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public InterimItemWindow
59 {
60  public:
61  SwAnnotationWin( SwEditWin& rEditWin,
62  SwPostItMgr& aMgr,
63  SwSidebarItem& rSidebarItem,
64  SwFormatField* aField );
65  virtual ~SwAnnotationWin() override;
66  virtual void dispose() override;
67 
68  void UpdateData();
69  void SetPostItText();
70  void Delete();
71  void GotoPos();
72  const SwPostItField* GetPostItField() const { return mpField; }
73  void UpdateText(const OUString& aText);
74 
75  OUString GetAuthor() const;
76  Date GetDate() const;
77  tools::Time GetTime() const;
78 
79  sal_uInt32 MoveCaret();
80 
82  sal_uInt32 CalcParent();
83  void InitAnswer(OutlinerParaObject const * pText);
84 
85  bool IsProtected() const;
86 
87  void SetSize( const Size& rNewSize );
88  void SetPosSizePixelRect( tools::Long nX,
89  tools::Long nY,
90  tools::Long nWidth,
91  tools::Long nHeight,
92  const SwRect& aAnchorRect,
93  const tools::Long PageBorder);
94  void SetPosAndSize();
95  void TranslateTopPosition(const tools::Long aAmount);
96  void CheckMetaText();
97 
98  Point const & GetAnchorPos() { return mAnchorRect.Pos(); }
99  const SwRect& GetAnchorRect() const { return mAnchorRect; }
100  bool IsAnchorRectChanged() const { return mbAnchorRectChanged; }
101  void ResetAnchorRectChanged() { mbAnchorRectChanged = false; }
102  const std::vector<basegfx::B2DRange>& GetAnnotationTextRanges() const { return maAnnotationTextRanges; }
103  SwEditWin& EditWin();
104  SwSidebarItem& GetSidebarItem() { return mrSidebarItem; }
105 
106  OutlinerView* GetOutlinerView() { return mpOutlinerView.get();}
107  Outliner* GetOutliner() { return mpOutliner.get();}
108  bool HasScrollbar() const;
109  bool IsScrollbarVisible() const;
112  ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay.get();}
113 
114  tools::Long GetPostItTextHeight();
115 
116  void SwitchToPostIt(sal_uInt16 aDirection);
117  void SwitchToFieldPos();
118 
119  void ExecuteCommand(sal_uInt16 nSlot);
120  void InitControls();
121  void DoResize();
122  void ResizeIfNecessary(tools::Long aOldHeight, tools::Long aNewHeight);
123  void SetScrollbar();
124 
125  void SetVirtualPosSize( const Point& aPoint, const Size& aSize);
126  Point VirtualPos() { return mPosSize.TopLeft(); }
127  Size VirtualSize() { return mPosSize.GetSize(); }
128 
129  void ShowAnchorOnly(const Point &aPoint);
130  void ShowNote();
131  void HideNote();
132 
133  void ResetAttributes();
134 
135  void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
136  void SetReadonly(bool bSet);
137  bool IsReadOnly() const
138  {
139  return mbReadonly;
140  }
141 
142  void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
143  const Color& ColorDark() { return mColorDark; }
144  const Color& ColorLight() { return mColorLight; }
145  void Rescale();
146 
147  void SetViewState(::sw::sidebarwindows::ViewState bViewState);
148 
149  bool IsFollow() const { return mbIsFollow; }
150  void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
151 
152  sal_Int32 GetMetaHeight() const;
153  sal_Int32 GetMinimumSizeWithMeta() const;
154  sal_Int32 GetMinimumSizeWithoutMeta() const;
155  int GetPrefScrollbarWidth() const;
156  sal_Int32 GetNumFields() const;
157 
158  void SetSpellChecking();
159 
160  void ToggleInsMode();
161 
162  void ActivatePostIt();
163  void DeactivatePostIt();
164 
165  void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
166  const Color& aColor);
167  SwPostItHelper::SwLayoutStatus GetLayoutStatus() const { return mLayoutStatus; }
168  const Color& GetChangeColor() const { return mChangeColor; }
169 
170  bool IsMouseOverSidebarWin() const { return mbMouseOver; }
171 
172  void SetLanguage(const SvxLanguageItem& rNewItem);
173 
174  void ChangeSidebarItem( SwSidebarItem const & rSidebarItem );
175  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
176 
177  void DrawForPage(OutputDevice* pDev, const Point& rPos);
178 
179  void PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
181  bool IsHitWindow(const Point& rPointLogic);
183  void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark);
184 
185  // Various access functions for 'resolved' status
186  void SetResolved(bool resolved);
187  void ToggleResolved();
188  void ToggleResolvedForThread();
189  void DeleteThread();
190  bool IsResolved() const;
191  bool IsThreadResolved();
192 
193  //┬áSet this SwAnnotationWin as the currently active one
194  // return false if it was already active
195  bool SetActiveSidebarWin();
196  // Unset this SwAnnotationWin as the currently active one
197  void UnsetActiveSidebarWin();
198 
201  SwAnnotationWin* GetTopReplyNote();
202 
203  virtual FactoryFunction GetUITestFactory() const override;
204 
205  private:
206 
207  virtual void LoseFocus() 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, weld::ScrolledWindow&, void);
215  DECL_LINK(DeleteHdl, void*, void);
216  DECL_LINK(ToggleHdl, weld::Toggleable&, void);
217  DECL_LINK(SelectHdl, const OString&, void);
218  DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
219  DECL_LINK(MouseMoveHdl, const MouseEvent&, bool);
220 
221  sal_uInt32 CountFollowing();
222 
224 
225  void SetMenuButtonColors();
226 
229 
231 
232  std::unique_ptr<OutlinerView> mpOutlinerView;
233  std::unique_ptr<Outliner> mpOutliner;
234 
235  std::unique_ptr<weld::ScrolledWindow> mxVScrollbar;
236  std::unique_ptr<sw::sidebarwindows::SidebarTextControl> mxSidebarTextControl;
237  std::unique_ptr<weld::CustomWeld> mxSidebarTextControlWin;
239  std::unique_ptr<weld::Label> mxMetadataAuthor;
240  std::unique_ptr<weld::Label> mxMetadataDate;
241  std::unique_ptr<weld::Label> mxMetadataResolved;
242  std::unique_ptr<weld::MenuButton> mxMenuButton;
243 
244  std::unique_ptr<sw::sidebarwindows::AnchorOverlayObject> mpAnchor;
245  std::unique_ptr<sw::sidebarwindows::ShadowOverlayObject> mpShadow;
246  std::unique_ptr<sw::overlay::OverlayRanges> mpTextRangeOverlay;
247 
252 
254 
259 
261 
262  std::vector<basegfx::B2DRange> maAnnotationTextRanges;
263 
266 
269 
272 
275 
277 };
278 
279 } // end of namespace sw::annotation
280 
281 #endif
282 
283 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Label > mxMetadataDate
Base class of the Writer layout elements.
Definition: frame.hxx:313
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:390
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
rtl::Reference< sw::sidebarwindows::SidebarWinAccessible > mxSidebarWinAccessible
::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:214
std::unique_ptr< sw::sidebarwindows::SidebarTextControl > mxSidebarTextControl
std::unique_ptr< weld::Label > mxMetadataAuthor
Definition: view.hxx:144