LibreOffice Module sw (master)  1
postithelper.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_SW_INC_POSTITHELPER_HXX
20 #define INCLUDED_SW_INC_POSTITHELPER_HXX
21 
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"
28 
29 class SfxBroadcaster;
30 class SwRootFrame;
31 class SwPostItMgr;
32 class SwEditWin;
33 class SwFrame;
35 namespace sw::annotation { class SwAnnotationWin; }
36 namespace sw::mark { class IMark; }
37 
38 struct SwPosition;
39 
41 {
44 
45  // optional start of the annotation
47  sal_Int32 mnStartContent;
48 
51  unsigned long mnPageNumber;
52 
54 
55  std::size_t mRedlineAuthor;
56 
62 
64  : mpAnchorFrame(nullptr)
65  , mPosition()
66  , mnStartNodeIdx( 0 )
67  , mnStartContent( -1 )
68  , mPageFrame()
69  , mPagePrtArea()
70  , mnPageNumber(1)
71  , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE)
72  , mRedlineAuthor(0)
73  , mPositionFromCommentAnchor(true)
74  {}
75 };
76 
77 namespace SwPostItHelper
78 {
80  {
82  };
83 
85  SwLayoutInfo& o_rInfo,
86  const SwPosition& rAnchorPos,
87  const sw::mark::IMark* pAnnotationMark = nullptr );
88 
89  tools::Long getLayoutHeight( const SwRootFrame* pRoot );
90  void setSidebarChanged( SwRootFrame* pRoot, bool bBrowseMode );
91  unsigned long getPageInfo( SwRect& rPageFrame, const SwRootFrame* , const Point& );
92 }
93 
94 class SAL_DLLPUBLIC_RTTI SwSidebarItem
95 {
96 public:
98  bool mbShow;
99  bool mbFocus;
101 
104 
105  SwSidebarItem( const bool aFocus);
106 
107  virtual ~SwSidebarItem();
108 
109  SwSidebarItem(SwSidebarItem const &) = default;
110  SwSidebarItem(SwSidebarItem &&) = default;
111  SwSidebarItem & operator =(SwSidebarItem const &) = default;
112  SwSidebarItem & operator =(SwSidebarItem &&) = default;
113 
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;
120 };
121 
122 class SwAnnotationItem final : public SwSidebarItem
123 {
124 public:
126  SwFormatField& rFormatField,
127  const bool aFocus)
128  : SwSidebarItem( aFocus )
129  , mrFormatField( rFormatField )
130  {
131  }
132 
133  virtual SwPosition GetAnchorPosition() const override;
134  virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) override;
135  virtual const SwFormatField& GetFormatField() const override
136  {
137  return mrFormatField;
138  }
139  virtual const SfxBroadcaster* GetBroadcaster() const override
140  {
141  return dynamic_cast<const SfxBroadcaster *> (&mrFormatField);
142  }
144  SwEditWin& rEditWin,
145  SwPostItMgr& aMgr ) override;
146 
147 private:
149 };
150 
151 #endif // INCLUDED_SW_INC_POSTITHELPER_HXX
152 
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:297
Marks a position in the document model.
Definition: pam.hxx:35
const SwFrame * mpAnchorFrame
sal_uIntPtr sal_uLong
long Long
std::size_t mRedlineAuthor
tools::Long getLayoutHeight(const SwRootFrame *pRoot)
bool mPositionFromCommentAnchor
If true, the overlay arrow points to the comment anchor, otherwise it points to the commented frame...
Dialog to specify the properties of date form field.
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
The root element of a Writer document layout.
Definition: rootfrm.hxx:80
virtual SwPosition GetAnchorPosition() const override
SwFormatField & mrFormatField
NONE
VclPtr< sw::annotation::SwAnnotationWin > mpPostIt
virtual const SfxBroadcaster * GetBroadcaster() const override
virtual bool UseElement(SwRootFrame const &, IDocumentRedlineAccess const &) override
SwAnnotationItem(SwFormatField &rFormatField, const bool aFocus)
virtual const SwFormatField & GetFormatField() const override
SwRect mPageFrame
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
SwRect mPagePrtArea
sal_uLong mnStartNodeIdx
unsigned long mnPageNumber
SwLayoutInfo maLayoutInfo
SwPostItHelper::SwLayoutStatus mLayoutStatus
sw::sidebarwindows::SidebarPosition meSidebarPosition
virtual VclPtr< sw::annotation::SwAnnotationWin > GetSidebarWindow(SwEditWin &rEditWin, SwPostItMgr &aMgr) override
void setSidebarChanged(SwRootFrame *pRoot, bool bBrowseMode)
sal_Int32 mnStartContent
SwLayoutStatus getLayoutInfos(SwLayoutInfo &o_rInfo, const SwPosition &rAnchorPos, const sw::mark::IMark *pAnnotationMark=nullptr)
unsigned long getPageInfo(SwRect &rPageFrame, const SwRootFrame *, const Point &)
SwRect mPosition