1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
25 #include <vcl/vclptr.hxx>
26 #include <tools/solar.h>
27 #include "SidebarWindowsTypes.hxx"
34 class IDocumentRedlineAccess
;
35 namespace sw
{ namespace annotation
{
36 class SwAnnotationWin
;
38 namespace sw::mark
{ class IMark
; }
44 const SwFrame
* mpAnchorFrame
;
47 // optional start of the annotation
48 sal_uLong mnStartNodeIdx
;
49 sal_Int32 mnStartContent
;
53 unsigned long mnPageNumber
;
55 sw::sidebarwindows::SidebarPosition meSidebarPosition
;
57 std::size_t mRedlineAuthor
;
60 * If true, the overlay arrow points to the comment anchor, otherwise it points to the commented
63 bool mPositionFromCommentAnchor
;
66 : mpAnchorFrame(nullptr)
69 , mnStartContent( -1 )
73 , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE
)
75 , mPositionFromCommentAnchor(true)
79 namespace SwPostItHelper
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
& );
99 VclPtr
<sw::annotation::SwAnnotationWin
> pPostIt
;
104 SwPostItHelper::SwLayoutStatus mLayoutStatus
;
105 SwLayoutInfo maLayoutInfo
;
107 SwSidebarItem( const bool aFocus
)
111 , bPendingLayout(false)
112 , mLayoutStatus( SwPostItHelper::INVISIBLE
)
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
138 SwFormatField
& rFormatField
,
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(
157 SwPostItMgr
& aMgr
) override
;
160 SwFormatField
& mrFormatField
;
163 #endif // INCLUDED_SW_INC_POSTITHELPER_HXX
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */