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#pragma once
21
23#include <editeng/outlobj.hxx>
24#include <tools/date.hxx>
25#include <tools/time.hxx>
27#include <vcl/customweld.hxx>
28
29#include "postithelper.hxx"
30#include "swrect.hxx"
32#include <optional>
33
34class EditView;
35class PopupMenu;
37class SwPostItMgr;
38class SwPostItField;
39class OutlinerView;
40class Outliner;
41class ScrollBar;
42class SwEditWin;
43class SwView;
44class FixedText;
45class MenuButton;
46class SwFrame;
47class SvxLanguageItem;
48namespace sw::overlay { class OverlayRanges; }
49namespace sw::sidebarwindows {
50 class SidebarTextControl;
51 class AnchorOverlayObject;
52 class ShadowOverlayObject;
53 class SidebarWinAccessible;
54}
55
56
57namespace sw::annotation {
58
59class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public InterimItemWindow
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() const { return mpField; }
74 void UpdateText(const OUString& aText);
75
76 OUString GetAuthor() const;
77 Date GetDate() const;
78 tools::Time GetTime() const;
79
80 sal_uInt32 MoveCaret();
81
83 sal_uInt32 CalcParent();
84 void InitAnswer(OutlinerParaObject const & rText);
85
86 bool IsReadOnlyOrProtected() const;
87
88 void SetSize( const Size& rNewSize );
89 void SetPosSizePixelRect( tools::Long nX,
90 tools::Long nY,
91 tools::Long nWidth,
92 tools::Long nHeight,
93 const SwRect& aAnchorRect,
94 const tools::Long PageBorder);
95 void SetPosAndSize();
96 void TranslateTopPosition(const tools::Long aAmount);
97 void CheckMetaText();
98
99 Point const & GetAnchorPos() { return mAnchorRect.Pos(); }
100 const SwRect& GetAnchorRect() const { return mAnchorRect; }
101 bool IsAnchorRectChanged() const { return mbAnchorRectChanged; }
102 void ResetAnchorRectChanged() { mbAnchorRectChanged = false; }
103 const std::vector<basegfx::B2DRange>& GetAnnotationTextRanges() const { return maAnnotationTextRanges; }
104 SwEditWin& EditWin();
105 SwSidebarItem& GetSidebarItem() { return mrSidebarItem; }
106
107 OutlinerView* GetOutlinerView() { return mpOutlinerView.get();}
108 Outliner* GetOutliner() { return mpOutliner.get();}
109 bool HasScrollbar() const;
110 bool IsScrollbarVisible() const;
113 ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay.get();}
114
115 tools::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(tools::Long aOldHeight, tools::Long aNewHeight);
124 void SetScrollbar();
125 void LockView(bool bLock);
126
127 void SetVirtualPosSize( const Point& aPoint, const Size& aSize);
128 Point VirtualPos() { return mPosSize.TopLeft(); }
129 Size VirtualSize() { return mPosSize.GetSize(); }
130
131 void ShowAnchorOnly(const Point &aPoint);
132 void ShowNote();
133 void HideNote();
134
135 void ResetAttributes();
136
137 void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
138 void SetReadonly(bool bSet);
139 bool IsReadOnly() const
140 {
141 return mbReadonly;
142 }
143
144 void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
145 const Color& ColorDark() { return mColorDark; }
146 const Color& ColorLight() { return mColorLight; }
147 void Rescale();
148
149 void SetViewState(::sw::sidebarwindows::ViewState bViewState);
150
151 bool IsFollow() const { return mbIsFollow; }
152 void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
153
154 sal_Int32 GetMetaHeight() const;
155 sal_Int32 GetMinimumSizeWithMeta() const;
156 sal_Int32 GetMinimumSizeWithoutMeta() const;
157 int GetPrefScrollbarWidth() const;
158 sal_Int32 GetNumFields() const;
159
160 void SetSpellChecking();
161
162 void ToggleInsMode();
163
164 void ActivatePostIt();
165 void DeactivatePostIt();
166
167 void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
168 const Color& aColor);
169 SwPostItHelper::SwLayoutStatus GetLayoutStatus() const { return mLayoutStatus; }
170 const Color& GetChangeColor() const { return mChangeColor; }
171
172 bool IsMouseOverSidebarWin() const { return mbMouseOver; }
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 // Get annotation paraId or generate one if it doesn't exist
194 sal_uInt32 GetParaId();
195 // Used to generate a unique paraId
196 static sal_uInt32 CreateUniqueParaId();
197
198 // Set this SwAnnotationWin as the currently active one
199 // return false if it was already active
200 bool SetActiveSidebarWin();
201 // Unset this SwAnnotationWin as the currently active one
202 void UnsetActiveSidebarWin();
203
206 SwAnnotationWin* GetTopReplyNote();
207
208 virtual FactoryFunction GetUITestFactory() const override;
209
210 private:
211
212 virtual void LoseFocus() override;
213 virtual void GetFocus() override;
214 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
215
216 void SetSizePixel( const Size& rNewSize ) override;
217
220 DECL_DLLPRIVATE_LINK(DeleteHdl, void*, void);
222 DECL_DLLPRIVATE_LINK(SelectHdl, const OUString&, void);
223 DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool);
224 DECL_DLLPRIVATE_LINK(MouseMoveHdl, const MouseEvent&, bool);
225
226 sal_uInt32 CountFollowing();
227
228 void SetMenuButtonColors();
229
232
234
235 std::unique_ptr<OutlinerView> mpOutlinerView;
236 std::unique_ptr<Outliner> mpOutliner;
237
238 std::unique_ptr<weld::ScrolledWindow> mxVScrollbar;
239 std::unique_ptr<sw::sidebarwindows::SidebarTextControl> mxSidebarTextControl;
240 std::unique_ptr<weld::CustomWeld> mxSidebarTextControlWin;
242 std::unique_ptr<weld::Label> mxMetadataAuthor;
243 std::unique_ptr<weld::Label> mxMetadataDate;
244 std::unique_ptr<weld::Label> mxMetadataResolved;
245 std::unique_ptr<weld::MenuButton> mxMenuButton;
246
247 std::unique_ptr<sw::sidebarwindows::AnchorOverlayObject> mpAnchor;
248 std::unique_ptr<sw::sidebarwindows::ShadowOverlayObject> mpShadow;
249 std::unique_ptr<sw::overlay::OverlayRanges> mpTextRangeOverlay;
250
255
257
262
264
265 std::vector<basegfx::B2DRange> maAnnotationTextRanges;
266
269
272
275
278
280 mutable std::optional<sal_Int32> moMetaHeight;
281};
282
283} // end of namespace sw::annotation
284
285/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
Base class of the Writer layout elements.
Definition: frame.hxx:315
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
Definition: view.hxx:146
const SwRect & GetAnchorRect() const
SwPostItHelper::SwLayoutStatus mLayoutStatus
SwPostItHelper::SwLayoutStatus GetLayoutStatus() const
sw::sidebarwindows::SidebarPosition meSidebarPosition
std::unique_ptr< sw::overlay::OverlayRanges > mpTextRangeOverlay
DECL_DLLPRIVATE_LINK(MouseMoveHdl, const MouseEvent &, bool)
const std::vector< basegfx::B2DRange > & GetAnnotationTextRanges() const
std::unique_ptr< weld::Label > mxMetadataResolved
DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent &, bool)
std::unique_ptr< Outliner > mpOutliner
::sw::sidebarwindows::AnchorOverlayObject * Anchor()
const Color & GetChangeColor() const
std::unique_ptr< sw::sidebarwindows::AnchorOverlayObject > mpAnchor
std::unique_ptr< OutlinerView > mpOutlinerView
DECL_DLLPRIVATE_LINK(ModifyHdl, LinkParamNone *, void)
std::unique_ptr< weld::CustomWeld > mxSidebarTextControlWin
DECL_DLLPRIVATE_LINK(SelectHdl, const OUString &, void)
void SetFollow(bool bIsFollow)
DECL_DLLPRIVATE_LINK(ToggleHdl, weld::Toggleable &, void)
std::unique_ptr< weld::MenuButton > mxMenuButton
rtl::Reference< sw::sidebarwindows::SidebarWinAccessible > mxSidebarWinAccessible
std::vector< basegfx::B2DRange > maAnnotationTextRanges
std::unique_ptr< sw::sidebarwindows::ShadowOverlayObject > mpShadow
DECL_DLLPRIVATE_LINK(DeleteHdl, void *, void)
::sw::sidebarwindows::ShadowOverlayObject * Shadow()
DECL_DLLPRIVATE_LINK(ScrollHdl, weld::ScrolledWindow &, void)
std::unique_ptr< weld::ScrolledWindow > mxVScrollbar
::sw::overlay::OverlayRanges * TextRange()
std::optional< sal_Int32 > moMetaHeight
std::unique_ptr< weld::Label > mxMetadataDate
std::unique_ptr< sw::sidebarwindows::SidebarTextControl > mxSidebarTextControl
std::unique_ptr< weld::Label > mxMetadataAuthor
const SwPostItField * GetPostItField() const
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
Any GetTime(const OUString &val)
long Long