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
33class EditView;
34class PopupMenu;
36class SwPostItMgr;
37class SwPostItField;
38class OutlinerView;
39class Outliner;
40class ScrollBar;
41class SwEditWin;
42class SwView;
43class FixedText;
44class MenuButton;
45class SwFrame;
46class SvxLanguageItem;
47namespace sw::overlay { class OverlayRanges; }
48namespace sw::sidebarwindows {
49 class SidebarTextControl;
50 class AnchorOverlayObject;
51 class ShadowOverlayObject;
52 class SidebarWinAccessible;
53}
54
55
56namespace sw::annotation {
57
58class 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 & rText);
84
85 bool IsReadOnlyOrProtected() 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 void LockView(bool bLock);
125
126 void SetVirtualPosSize( const Point& aPoint, const Size& aSize);
127 Point VirtualPos() { return mPosSize.TopLeft(); }
128 Size VirtualSize() { return mPosSize.GetSize(); }
129
130 void ShowAnchorOnly(const Point &aPoint);
131 void ShowNote();
132 void HideNote();
133
134 void ResetAttributes();
135
136 void SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
137 void SetReadonly(bool bSet);
138 bool IsReadOnly() const
139 {
140 return mbReadonly;
141 }
142
143 void SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
144 const Color& ColorDark() { return mColorDark; }
145 const Color& ColorLight() { return mColorLight; }
146 void Rescale();
147
148 void SetViewState(::sw::sidebarwindows::ViewState bViewState);
149
150 bool IsFollow() const { return mbIsFollow; }
151 void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
152
153 sal_Int32 GetMetaHeight() const;
154 sal_Int32 GetMinimumSizeWithMeta() const;
155 sal_Int32 GetMinimumSizeWithoutMeta() const;
156 int GetPrefScrollbarWidth() const;
157 sal_Int32 GetNumFields() const;
158
159 void SetSpellChecking();
160
161 void ToggleInsMode();
162
163 void ActivatePostIt();
164 void DeactivatePostIt();
165
166 void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
167 const Color& aColor);
168 SwPostItHelper::SwLayoutStatus GetLayoutStatus() const { return mLayoutStatus; }
169 const Color& GetChangeColor() const { return mChangeColor; }
170
171 bool IsMouseOverSidebarWin() const { return mbMouseOver; }
172
173 void SetLanguage(const SvxLanguageItem& rNewItem);
174
175 void ChangeSidebarItem( SwSidebarItem const & rSidebarItem );
176 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
177
178 void DrawForPage(OutputDevice* pDev, const Point& rPos);
179
180 void PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
182 bool IsHitWindow(const Point& rPointLogic);
184 void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark);
185
186 // Various access functions for 'resolved' status
187 void SetResolved(bool resolved);
188 void ToggleResolved();
189 void ToggleResolvedForThread();
190 void DeleteThread();
191 bool IsResolved() const;
192 bool IsThreadResolved();
193
194 // Get annotation paraId or generate one if it doesn't exist
195 sal_uInt32 GetParaId();
196 // Used to generate a unique paraId
197 static sal_uInt32 CreateUniqueParaId();
198
199 // Set this SwAnnotationWin as the currently active one
200 // return false if it was already active
201 bool SetActiveSidebarWin();
202 // Unset this SwAnnotationWin as the currently active one
203 void UnsetActiveSidebarWin();
204
207 SwAnnotationWin* GetTopReplyNote();
208
209 virtual FactoryFunction GetUITestFactory() const override;
210
211 private:
212
213 virtual void LoseFocus() override;
214 virtual void GetFocus() override;
215
216 void SetSizePixel( const Size& rNewSize ) override;
217 SfxItemSet DefaultItem();
218
221 DECL_DLLPRIVATE_LINK(DeleteHdl, void*, void);
223 DECL_DLLPRIVATE_LINK(SelectHdl, const OUString&, void);
224 DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool);
225 DECL_DLLPRIVATE_LINK(MouseMoveHdl, const MouseEvent&, bool);
226
227 sal_uInt32 CountFollowing();
228
230
231 void SetMenuButtonColors();
232
235
237
238 std::unique_ptr<OutlinerView> mpOutlinerView;
239 std::unique_ptr<Outliner> mpOutliner;
240
241 std::unique_ptr<weld::ScrolledWindow> mxVScrollbar;
242 std::unique_ptr<sw::sidebarwindows::SidebarTextControl> mxSidebarTextControl;
243 std::unique_ptr<weld::CustomWeld> mxSidebarTextControlWin;
245 std::unique_ptr<weld::Label> mxMetadataAuthor;
246 std::unique_ptr<weld::Label> mxMetadataDate;
247 std::unique_ptr<weld::Label> mxMetadataResolved;
248 std::unique_ptr<weld::MenuButton> mxMenuButton;
249
250 std::unique_ptr<sw::sidebarwindows::AnchorOverlayObject> mpAnchor;
251 std::unique_ptr<sw::sidebarwindows::ShadowOverlayObject> mpShadow;
252 std::unique_ptr<sw::overlay::OverlayRanges> mpTextRangeOverlay;
253
258
260
265
267
268 std::vector<basegfx::B2DRange> maAnnotationTextRanges;
269
272
275
278
281
283};
284
285} // end of namespace sw::annotation
286
287/* 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::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
void SetLanguage(SwWrtShell &rWrtSh, std::u16string_view rLangText, bool bIsForSelection, SfxItemSet &rCoreSet)
Definition: langhelper.cxx:217
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:393
Any GetTime(const OUString &val)
long Long