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_SOURCE_CORE_INC_TOCNTNTANCHOREDOBJECTPOSITION_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_TOCNTNTANCHOREDOBJECTPOSITION_HXX
21 #include "anchoredobjectposition.hxx"
28 namespace objectpositioning
30 class SwToContentAnchoredObjectPosition final
: public SwAnchoredObjectPosition
33 // calculated data for object position
34 const SwLayoutFrame
* mpVertPosOrientFrame
;
36 // determine offset to frame anchor position according to the
37 // positioning alignments
38 Point maOffsetToFrameAnchorPos
;
40 // data for calculation of position
42 const SwFrame
* mpToCharOrientFrame
;
43 const SwRect
* mpToCharRect
;
44 SwTwips mnToCharTopOfLine
;
46 virtual bool IsAnchoredToChar() const override
;
47 virtual const SwFrame
* ToCharOrientFrame() const override
;
48 virtual const SwRect
* ToCharRect() const override
;
50 virtual SwTwips
ToCharTopOfLine() const override
;
52 // method to cast <SwAnchoredObjectPosition::GetAnchorFrame()> to
54 SwTextFrame
& GetAnchorTextFrame() const;
56 /** determine frame for horizontal position
58 if the given proposed frame is a content frame, the proposed
60 otherwise (given proposed frame is a layout frame),
61 the lower content frames of the proposed frame are checked
62 for the first, that the anchor or a follow of the anchor.
63 If none is found, the proposed frame is returned.
65 @param _pProposedFrame
66 input parameter - proposed frame for horizontal position
68 @return constant reference to <SwFrame> object, at which the
69 horizontal position is determined.
71 const SwFrame
& GetHoriVirtualAnchor( const SwLayoutFrame
& _pProposedFrame
) const;
74 SwToContentAnchoredObjectPosition( SdrObject
& _rDrawObj
);
75 virtual ~SwToContentAnchoredObjectPosition() override
;
77 /** calculate position of object
79 virtual void CalcPosition() override
;
81 /** frame, at which the vertical position is oriented at
83 const SwLayoutFrame
& GetVertPosOrientFrame() const { return *mpVertPosOrientFrame
;}
85 /// In case overlap is not allowed, re-position the current object.
86 void CalcOverlap(const SwTextFrame
* pAnchorFrameForVertPos
, Point
& rRelPos
,
87 const SwTwips nTopOfAnch
);
89 } // namespace objectpositioning
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */