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 
60  : mpAnchorFrame(nullptr)
61  , mPosition()
62  , mnStartNodeIdx( 0 )
63  , mnStartContent( -1 )
64  , mPageFrame()
65  , mPagePrtArea()
66  , mnPageNumber(1)
67  , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE)
68  , mRedlineAuthor(0)
69  {}
70 };
71 
72 namespace SwPostItHelper
73 {
75  {
77  };
78 
80  SwLayoutInfo& o_rInfo,
81  const SwPosition& rAnchorPos,
82  const sw::mark::IMark* pAnnotationMark = nullptr );
83 
84  long getLayoutHeight( const SwRootFrame* pRoot );
85  void setSidebarChanged( SwRootFrame* pRoot, bool bBrowseMode );
86  unsigned long getPageInfo( SwRect& rPageFrame, const SwRootFrame* , const Point& );
87 }
88 
90 {
91 public:
93  bool bShow;
94  bool bFocus;
96 
99 
100  SwSidebarItem( const bool aFocus)
101  : pPostIt(nullptr)
102  , bShow(true)
103  , bFocus(aFocus)
104  , bPendingLayout(false)
105  , mLayoutStatus( SwPostItHelper::INVISIBLE )
106  , maLayoutInfo()
107  {
108  }
109 
110  virtual ~SwSidebarItem()
111  {
112  }
113 
114  SwSidebarItem(SwSidebarItem const &) = default;
115  SwSidebarItem(SwSidebarItem &&) = default;
116  SwSidebarItem & operator =(SwSidebarItem const &) = default;
117  SwSidebarItem & operator =(SwSidebarItem &&) = default;
118 
119  virtual SwPosition GetAnchorPosition() const = 0;
120  virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) = 0;
121  virtual const SwFormatField& GetFormatField() const = 0;
122  virtual const SfxBroadcaster* GetBroadcaster() const = 0;
124  SwPostItMgr& aMgr) = 0;
125 };
126 
128 {
129 public:
131  SwFormatField& rFormatField,
132  const bool aFocus)
133  : SwSidebarItem( aFocus )
134  , mrFormatField( rFormatField )
135  {
136  }
137 
138  virtual SwPosition GetAnchorPosition() const override;
139  virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) override;
140  virtual const SwFormatField& GetFormatField() const override
141  {
142  return mrFormatField;
143  }
144  virtual const SfxBroadcaster* GetBroadcaster() const override
145  {
146  return dynamic_cast<const SfxBroadcaster *> (&mrFormatField);
147  }
149  SwEditWin& rEditWin,
150  SwPostItMgr& aMgr ) override;
151 
152 private:
154 };
155 
156 #endif // INCLUDED_SW_INC_POSTITHELPER_HXX
157 
158 /* 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
Dialog to specify the properties of drop-down form field.
Definition: accfrmobj.cxx:40
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:59
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