a11y: Simplify OCommonAccessibleComponent::getAccessibleIndexInParent
[LibreOffice.git] / sw / inc / postithelper.hxx
blob174e103231bdf96ce4e39dfc6341acd5231d76f7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_POSTITHELPER_HXX
20 #define INCLUDED_SW_INC_POSTITHELPER_HXX
22 #include "swrect.hxx"
23 #include "fmtfld.hxx"
24 #include <cstddef>
25 #include <vcl/vclptr.hxx>
26 #include "SidebarWindowsTypes.hxx"
27 #include "nodeoffset.hxx"
29 class Outliner;
30 class SfxBroadcaster;
31 class SwRootFrame;
32 class SwPostItMgr;
33 class SwEditWin;
34 class SwFrame;
35 class IDocumentRedlineAccess;
36 namespace sw::annotation { class SwAnnotationWin; }
37 namespace sw::mark { class MarkBase; }
39 struct SwPosition;
41 struct SwLayoutInfo
43 const SwFrame* mpAnchorFrame;
44 SwRect mPosition;
46 // optional start of the annotation
47 SwNodeOffset mnStartNodeIdx;
48 sal_Int32 mnStartContent;
50 SwRect mPageFrame;
51 SwRect mPagePrtArea;
52 tools::ULong mnPageNumber;
54 sw::sidebarwindows::SidebarPosition meSidebarPosition;
56 std::size_t mRedlineAuthor;
58 /**
59 * If true, the overlay arrow points to the comment anchor, otherwise it points to the commented
60 * frame.
62 bool mPositionFromCommentAnchor;
64 SwLayoutInfo()
65 : mpAnchorFrame(nullptr)
66 , mPosition()
67 , mnStartNodeIdx( 0 )
68 , mnStartContent( -1 )
69 , mPageFrame()
70 , mPagePrtArea()
71 , mnPageNumber(1)
72 , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE)
73 , mRedlineAuthor(0)
74 , mPositionFromCommentAnchor(true)
78 namespace SwPostItHelper
80 enum SwLayoutStatus
82 INVISIBLE, VISIBLE, INSERTED, DELETED, NONE, HIDDEN
85 SwLayoutStatus getLayoutInfos(
86 SwLayoutInfo& o_rInfo,
87 const SwPosition& rAnchorPos,
88 const sw::mark::MarkBase* pAnnotationMark = nullptr );
90 tools::Long getLayoutHeight( const SwRootFrame* pRoot );
91 void setSidebarChanged( SwRootFrame* pRoot, bool bBrowseMode );
92 tools::ULong getPageInfo( SwRect& rPageFrame, const SwRootFrame* , const Point& );
94 void ImportHTML(Outliner& rOutliner, const OUString& rHtml);
97 class SAL_DLLPUBLIC_RTTI SwSidebarItem
99 public:
100 VclPtr<sw::annotation::SwAnnotationWin> mpPostIt;
101 bool mbShow;
102 bool mbFocus;
103 bool mbPendingLayout;
105 SwPostItHelper::SwLayoutStatus mLayoutStatus;
106 SwLayoutInfo maLayoutInfo;
108 SwSidebarItem( const bool aFocus);
110 virtual ~SwSidebarItem();
112 SwSidebarItem(SwSidebarItem const &) = default;
113 SwSidebarItem(SwSidebarItem &&) = default;
114 SwSidebarItem & operator =(SwSidebarItem const &) = default;
115 SwSidebarItem & operator =(SwSidebarItem &&) = default;
117 virtual SwPosition GetAnchorPosition() const = 0;
118 virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) = 0;
119 virtual const SwFormatField& GetFormatField() const = 0;
120 virtual SwFormatField& GetFormatField() = 0;
121 virtual const SfxBroadcaster* GetBroadcaster() const = 0;
122 virtual VclPtr<sw::annotation::SwAnnotationWin> GetSidebarWindow( SwEditWin& rEditWin,
123 SwPostItMgr& aMgr) = 0;
126 class SwAnnotationItem final : public SwSidebarItem
128 public:
129 SwAnnotationItem(
130 SwFormatField& rFormatField,
131 const bool aFocus)
132 : SwSidebarItem( aFocus )
133 , mrFormatField( rFormatField )
137 virtual SwPosition GetAnchorPosition() const override;
138 virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) override;
139 virtual const SwFormatField& GetFormatField() const override
141 return mrFormatField;
143 SwFormatField& GetFormatField() override
145 return mrFormatField;
147 virtual const SfxBroadcaster* GetBroadcaster() const override
149 return &mrFormatField;
151 virtual VclPtr<sw::annotation::SwAnnotationWin> GetSidebarWindow(
152 SwEditWin& rEditWin,
153 SwPostItMgr& aMgr ) override;
155 private:
156 SwFormatField& mrFormatField;
159 #endif // INCLUDED_SW_INC_POSTITHELPER_HXX
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */