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::annotation
{ class SwAnnotationWin
; }
36 namespace sw::mark
{ class IMark
; }
42 const SwFrame
* mpAnchorFrame
;
45 // optional start of the annotation
46 sal_uLong mnStartNodeIdx
;
47 sal_Int32 mnStartContent
;
51 tools::ULong mnPageNumber
;
53 sw::sidebarwindows::SidebarPosition meSidebarPosition
;
55 std::size_t mRedlineAuthor
;
58 * If true, the overlay arrow points to the comment anchor, otherwise it points to the commented
61 bool mPositionFromCommentAnchor
;
64 : mpAnchorFrame(nullptr)
67 , mnStartContent( -1 )
71 , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE
)
73 , mPositionFromCommentAnchor(true)
77 namespace SwPostItHelper
81 INVISIBLE
, VISIBLE
, INSERTED
, DELETED
, NONE
, HIDDEN
84 SwLayoutStatus
getLayoutInfos(
85 SwLayoutInfo
& o_rInfo
,
86 const SwPosition
& rAnchorPos
,
87 const sw::mark::IMark
* pAnnotationMark
= nullptr );
89 tools::Long
getLayoutHeight( const SwRootFrame
* pRoot
);
90 void setSidebarChanged( SwRootFrame
* pRoot
, bool bBrowseMode
);
91 tools::ULong
getPageInfo( SwRect
& rPageFrame
, const SwRootFrame
* , const Point
& );
94 class SAL_DLLPUBLIC_RTTI SwSidebarItem
97 VclPtr
<sw::annotation::SwAnnotationWin
> mpPostIt
;
100 bool mbPendingLayout
;
102 SwPostItHelper::SwLayoutStatus mLayoutStatus
;
103 SwLayoutInfo maLayoutInfo
;
105 SwSidebarItem( const bool aFocus
);
107 virtual ~SwSidebarItem();
109 SwSidebarItem(SwSidebarItem
const &) = default;
110 SwSidebarItem(SwSidebarItem
&&) = default;
111 SwSidebarItem
& operator =(SwSidebarItem
const &) = default;
112 SwSidebarItem
& operator =(SwSidebarItem
&&) = default;
114 virtual SwPosition
GetAnchorPosition() const = 0;
115 virtual bool UseElement(SwRootFrame
const&, IDocumentRedlineAccess
const&) = 0;
116 virtual const SwFormatField
& GetFormatField() const = 0;
117 virtual const SfxBroadcaster
* GetBroadcaster() const = 0;
118 virtual VclPtr
<sw::annotation::SwAnnotationWin
> GetSidebarWindow( SwEditWin
& rEditWin
,
119 SwPostItMgr
& aMgr
) = 0;
122 class SwAnnotationItem final
: public SwSidebarItem
126 SwFormatField
& rFormatField
,
128 : SwSidebarItem( aFocus
)
129 , mrFormatField( rFormatField
)
133 virtual SwPosition
GetAnchorPosition() const override
;
134 virtual bool UseElement(SwRootFrame
const&, IDocumentRedlineAccess
const&) override
;
135 virtual const SwFormatField
& GetFormatField() const override
137 return mrFormatField
;
139 virtual const SfxBroadcaster
* GetBroadcaster() const override
141 return dynamic_cast<const SfxBroadcaster
*> (&mrFormatField
);
143 virtual VclPtr
<sw::annotation::SwAnnotationWin
> GetSidebarWindow(
145 SwPostItMgr
& aMgr
) override
;
148 SwFormatField
& mrFormatField
;
151 #endif // INCLUDED_SW_INC_POSTITHELPER_HXX
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */