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 "SidebarWindowsTypes.hxx"
27 #include "nodeoffset.hxx"
35 class IDocumentRedlineAccess
;
36 namespace sw::annotation
{ class SwAnnotationWin
; }
37 namespace sw::mark
{ class MarkBase
; }
43 const SwFrame
* mpAnchorFrame
;
46 // optional start of the annotation
47 SwNodeOffset mnStartNodeIdx
;
48 sal_Int32 mnStartContent
;
52 tools::ULong mnPageNumber
;
54 sw::sidebarwindows::SidebarPosition meSidebarPosition
;
56 std::size_t mRedlineAuthor
;
59 * If true, the overlay arrow points to the comment anchor, otherwise it points to the commented
62 bool mPositionFromCommentAnchor
;
65 : mpAnchorFrame(nullptr)
68 , mnStartContent( -1 )
72 , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE
)
74 , mPositionFromCommentAnchor(true)
78 namespace SwPostItHelper
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
100 VclPtr
<sw::annotation::SwAnnotationWin
> mpPostIt
;
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
130 SwFormatField
& rFormatField
,
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(
153 SwPostItMgr
& aMgr
) override
;
156 SwFormatField
& mrFormatField
;
159 #endif // INCLUDED_SW_INC_POSTITHELPER_HXX
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */