LibreOffice Module sw (master) 1
anchoreddrawobject.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_ANCHOREDDRAWOBJECT_HXX
20#define INCLUDED_SW_INC_ANCHOREDDRAWOBJECT_HXX
21
22#include "anchoredobject.hxx"
23#include <optional>
24
25namespace tools { class Rectangle; }
26
29{
30 private:
31 // boolean, indicating that the object position has been invalidated
32 // and that a positioning has to be performed.
34
35 // rectangle, keeping the last object rectangle after the positioning
36 std::optional<tools::Rectangle> maLastObjRect;
37
38 // boolean, indicating that anchored drawing object hasn't been attached
39 // to an anchor frame yet. Once, it is attached to an anchor frame the
40 // boolean changes its state.
42
43 // boolean, indicating that anchored
44 // drawing object hasn't been positioned yet. Once, it's positioned the
45 // boolean changes its state.
47
48 // boolean, indicating that after change of layout direction the
49 // anchored drawing object has to be captured on the page, if it exceeds
50 // the left or right page margin.
51 // Needed for compatibility option <DoNotCaptureDrawObjsOnPage>
53
59
65
73 void SetPositioningAttr();
74
86 void SetDrawObjAnchor();
87
89 void InvalidatePage_( SwPageFrame* _pPageFrame );
90
91 virtual void ObjectAttachedToAnchorFrame() override;
92
96 virtual void RegisterAtCorrectPage() override;
97
98 virtual bool SetObjTop_( const SwTwips _nTop) override;
99 virtual bool SetObjLeft_( const SwTwips _nLeft) override;
100
101 virtual SwRect GetObjBoundRect() const override;
102
103 public:
104
106 virtual ~SwAnchoredDrawObject() override;
107
108 // declaration of pure virtual methods of base class <SwAnchoredObject>
109 virtual void MakeObjPos() override;
110 virtual void InvalidateObjPos() override;
111 virtual void RegisterAtPage(SwPageFrame&) override;
112 bool IsValidPos() const
113 {
114 return mbValidPos;
115 }
116
117 // accessors to the format
118 virtual SwFrameFormat& GetFrameFormat() override;
119 virtual const SwFrameFormat& GetFrameFormat() const override;
120
121 // accessors to the object area and its position
122 virtual SwRect GetObjRect() const override;
123
124 std::optional<tools::Rectangle> const & GetLastObjRect() const { return maLastObjRect;}
125 void SetLastObjRect( const tools::Rectangle& _rNewObjRect );
126
142 void AdjustPositioningAttr( const SwFrame* _pNewAnchorFrame,
143 const SwRect* _pNewObjRect = nullptr );
144
146 virtual void NotifyBackground( SwPageFrame* _pPageFrame,
147 const SwRect& _rRect,
148 PrepareHint _eHint ) override;
149
150 bool NotYetPositioned() const
151 {
152 return mbNotYetPositioned;
153 }
154
155 // change of layout direction needs to be tracked
156 // for setting <mbCaptureAfterLayoutDirChange>.
157 virtual void UpdateLayoutDir() override;
158 bool IsOutsidePage() const;
159
160 // new Loop control
161 void ValidateThis() { mbValidPos = true; }
162
164 virtual const char* getElementName( ) const override { return "SwAnchoredDrawObject"; }
165};
166
167#endif
168
169/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
class for the positioning of drawing objects
void MakeObjPosAnchoredAtLayout()
method for the intrinsic positioning of an at-page|at-frame anchored drawing object
virtual const char * getElementName() const override
The element name to show in the XML dump.
virtual SwFrameFormat & GetFrameFormat() override
virtual bool SetObjTop_(const SwTwips _nTop) override
virtual void NotifyBackground(SwPageFrame *_pPageFrame, const SwRect &_rRect, PrepareHint _eHint) override
method to notify background of drawing object
virtual ~SwAnchoredDrawObject() override
virtual void UpdateLayoutDir() override
method update layout direction the layout direction, the anchored object is assigned to
virtual void MakeObjPos() override
method to determine position for the object and set the position at the object
std::optional< tools::Rectangle > const & GetLastObjRect() const
virtual bool SetObjLeft_(const SwTwips _nLeft) override
std::optional< tools::Rectangle > maLastObjRect
void SetLastObjRect(const tools::Rectangle &_rNewObjRect)
void SetDrawObjAnchor()
method to set internal anchor position of <SdrObject> instance of the drawing object
virtual SwRect GetObjRect() const override
void SetPositioningAttr()
method to set positioning attributes (not for as-character anchored)
virtual void InvalidateObjPos() override
method to invalidate position of the anchored object
void AdjustPositioningAttr(const SwFrame *_pNewAnchorFrame, const SwRect *_pNewObjRect=nullptr)
adjust positioning and alignment attributes for new anchor frame
void MakeObjPosAnchoredAtPara()
method for the intrinsic positioning of an at-paragraph|at-character anchored drawing object
virtual void RegisterAtCorrectPage() override
method to assure that anchored object is registered at the correct page frame
virtual void RegisterAtPage(SwPageFrame &) override
virtual void ObjectAttachedToAnchorFrame() override
method to indicate, that anchored object is attached to an anchor frame
virtual SwRect GetObjBoundRect() const override
void InvalidatePage_(SwPageFrame *_pPageFrame)
method to invalidate the given page frame
wrapper class for the positioning of Writer fly frames and drawing objects
Style of a layout element.
Definition: frmfmt.hxx:72
Base class of the Writer layout elements.
Definition: frame.hxx:315
A page of the document layout.
Definition: pagefrm.hxx:60
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
tools::Long SwTwips
Definition: swtypes.hxx:51
PrepareHint
Definition: swtypes.hxx:206