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 { namespace annotation {
36  class SwAnnotationWin;
37 } }
38 namespace sw::mark { class IMark; }
39 
40 struct SwPosition;
41 
43 {
46 
47  // optional start of the annotation
49  sal_Int32 mnStartContent;
50 
53  unsigned long mnPageNumber;
54 
56 
57  std::size_t mRedlineAuthor;
58 
64 
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)
76  {}
77 };
78 
79 namespace SwPostItHelper
80 {
82  {
84  };
85 
87  SwLayoutInfo& o_rInfo,
88  const SwPosition& rAnchorPos,
89  const sw::mark::IMark* pAnnotationMark = nullptr );
90 
91  long getLayoutHeight( const SwRootFrame* pRoot );
92  void setSidebarChanged( SwRootFrame* pRoot, bool bBrowseMode );
93  unsigned long getPageInfo( SwRect& rPageFrame, const SwRootFrame* , const Point& );
94 }
95 
97 {
98 public:
100  bool bShow;
101  bool bFocus;
103 
106 
107  SwSidebarItem( const bool aFocus)
108  : pPostIt(nullptr)
109  , bShow(true)
110  , bFocus(aFocus)
111  , bPendingLayout(false)
112  , mLayoutStatus( SwPostItHelper::INVISIBLE )
113  , maLayoutInfo()
114  {
115  }
116 
117  virtual ~SwSidebarItem()
118  {
119  }
120 
121  SwSidebarItem(SwSidebarItem const &) = default;
122  SwSidebarItem(SwSidebarItem &&) = default;
123  SwSidebarItem & operator =(SwSidebarItem const &) = default;
124  SwSidebarItem & operator =(SwSidebarItem &&) = default;
125 
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;
131  SwPostItMgr& aMgr) = 0;
132 };
133 
135 {
136 public:
138  SwFormatField& rFormatField,
139  const bool aFocus)
140  : SwSidebarItem( aFocus )
141  , mrFormatField( rFormatField )
142  {
143  }
144 
145  virtual SwPosition GetAnchorPosition() const override;
146  virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) override;
147  virtual const SwFormatField& GetFormatField() const override
148  {
149  return mrFormatField;
150  }
151  virtual const SfxBroadcaster* GetBroadcaster() const override
152  {
153  return dynamic_cast<const SfxBroadcaster *> (&mrFormatField);
154  }
156  SwEditWin& rEditWin,
157  SwPostItMgr& aMgr ) override;
158 
159 private:
161 };
162 
163 #endif // INCLUDED_SW_INC_POSTITHELPER_HXX
164 
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:295
Marks a position in the document model.
Definition: pam.hxx:35
const SwFrame * mpAnchorFrame
sal_uIntPtr sal_uLong
std::size_t mRedlineAuthor
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:34
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
virtual SwPosition GetAnchorPosition() const override
SwFormatField & mrFormatField
VclPtr< sw::annotation::SwAnnotationWin > pPostIt
NONE
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
long getLayoutHeight(const SwRootFrame *pRoot)
sal_uLong mnStartNodeIdx
unsigned long mnPageNumber
SwLayoutInfo maLayoutInfo
SwPostItHelper::SwLayoutStatus mLayoutStatus
SwSidebarItem(const bool aFocus)
virtual VclPtr< sw::annotation::SwAnnotationWin > GetSidebarWindow(SwEditWin &rEditWin, SwPostItMgr &aMgr)=0
virtual SwPosition GetAnchorPosition() const =0
sw::sidebarwindows::SidebarPosition meSidebarPosition
virtual const SfxBroadcaster * GetBroadcaster() const =0
virtual bool UseElement(SwRootFrame const &, IDocumentRedlineAccess const &)=0
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)
virtual const SwFormatField & GetFormatField() const =0
unsigned long getPageInfo(SwRect &rPageFrame, const SwRootFrame *, const Point &)
SwRect mPosition
virtual ~SwSidebarItem()
SwSidebarItem & operator=(SwSidebarItem const &)=default