lok: Hide file linking in section
[LibreOffice.git] / sw / inc / postithelper.hxx
blob50e0b737cb129a37da32394650be5b2173df73aa
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 <tools/solar.h>
27 #include "SidebarWindowsTypes.hxx"
29 class SfxBroadcaster;
30 class SwRootFrame;
31 class SwPostItMgr;
32 class SwEditWin;
33 class SwFrame;
34 class IDocumentRedlineAccess;
35 namespace sw { namespace annotation {
36 class SwAnnotationWin;
37 } }
38 namespace sw::mark { class IMark; }
40 struct SwPosition;
42 struct SwLayoutInfo
44 const SwFrame* mpAnchorFrame;
45 SwRect mPosition;
47 // optional start of the annotation
48 sal_uLong mnStartNodeIdx;
49 sal_Int32 mnStartContent;
51 SwRect mPageFrame;
52 SwRect mPagePrtArea;
53 unsigned long mnPageNumber;
55 sw::sidebarwindows::SidebarPosition meSidebarPosition;
57 std::size_t mRedlineAuthor;
59 /**
60 * If true, the overlay arrow points to the comment anchor, otherwise it points to the commented
61 * frame.
63 bool mPositionFromCommentAnchor;
65 SwLayoutInfo()
66 : mpAnchorFrame(nullptr)
67 , mPosition()
68 , mnStartNodeIdx( 0 )
69 , mnStartContent( -1 )
70 , mPageFrame()
71 , mPagePrtArea()
72 , mnPageNumber(1)
73 , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE)
74 , mRedlineAuthor(0)
75 , mPositionFromCommentAnchor(true)
79 namespace SwPostItHelper
81 enum SwLayoutStatus
83 INVISIBLE, VISIBLE, INSERTED, DELETED, NONE, HIDDEN
86 SwLayoutStatus getLayoutInfos(
87 SwLayoutInfo& o_rInfo,
88 const SwPosition& rAnchorPos,
89 const sw::mark::IMark* pAnnotationMark = nullptr );
91 long getLayoutHeight( const SwRootFrame* pRoot );
92 void setSidebarChanged( SwRootFrame* pRoot, bool bBrowseMode );
93 unsigned long getPageInfo( SwRect& rPageFrame, const SwRootFrame* , const Point& );
96 class SwSidebarItem
98 public:
99 VclPtr<sw::annotation::SwAnnotationWin> pPostIt;
100 bool bShow;
101 bool bFocus;
102 bool bPendingLayout;
104 SwPostItHelper::SwLayoutStatus mLayoutStatus;
105 SwLayoutInfo maLayoutInfo;
107 SwSidebarItem( const bool aFocus)
108 : pPostIt(nullptr)
109 , bShow(true)
110 , bFocus(aFocus)
111 , bPendingLayout(false)
112 , mLayoutStatus( SwPostItHelper::INVISIBLE )
113 , maLayoutInfo()
117 virtual ~SwSidebarItem()
121 SwSidebarItem(SwSidebarItem const &) = default;
122 SwSidebarItem(SwSidebarItem &&) = default;
123 SwSidebarItem & operator =(SwSidebarItem const &) = default;
124 SwSidebarItem & operator =(SwSidebarItem &&) = default;
126 virtual SwPosition GetAnchorPosition() const = 0;
127 virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) = 0;
128 virtual const SwFormatField& GetFormatField() const = 0;
129 virtual const SfxBroadcaster* GetBroadcaster() const = 0;
130 virtual VclPtr<sw::annotation::SwAnnotationWin> GetSidebarWindow( SwEditWin& rEditWin,
131 SwPostItMgr& aMgr) = 0;
134 class SwAnnotationItem final : public SwSidebarItem
136 public:
137 SwAnnotationItem(
138 SwFormatField& rFormatField,
139 const bool aFocus)
140 : SwSidebarItem( aFocus )
141 , mrFormatField( rFormatField )
145 virtual SwPosition GetAnchorPosition() const override;
146 virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) override;
147 virtual const SwFormatField& GetFormatField() const override
149 return mrFormatField;
151 virtual const SfxBroadcaster* GetBroadcaster() const override
153 return dynamic_cast<const SfxBroadcaster *> (&mrFormatField);
155 virtual VclPtr<sw::annotation::SwAnnotationWin> GetSidebarWindow(
156 SwEditWin& rEditWin,
157 SwPostItMgr& aMgr ) override;
159 private:
160 SwFormatField& mrFormatField;
163 #endif // INCLUDED_SW_INC_POSTITHELPER_HXX
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */