Line data Source code
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_SOURCE_CORE_INC_TOCNTNTANCHOREDOBJECTPOSITION_HXX
20 : #define INCLUDED_SW_SOURCE_CORE_INC_TOCNTNTANCHOREDOBJECTPOSITION_HXX
21 : #include <anchoredobjectposition.hxx>
22 :
23 : class SwFrm;
24 : class SwTextFrm;
25 : class SwLayoutFrm;
26 : class SwRect;
27 :
28 : namespace objectpositioning
29 : {
30 : class SwToContentAnchoredObjectPosition : public SwAnchoredObjectPosition
31 : {
32 : private:
33 : // calculated data for object position
34 : const SwLayoutFrm* mpVertPosOrientFrm;
35 : // #i26791#
36 : // determine offset to frame anchor position according to the
37 : // positioning alignments
38 : Point maOffsetToFrmAnchorPos;
39 :
40 : // data for calculation of position
41 : bool mbAnchorToChar;
42 : const SwFrm* mpToCharOrientFrm;
43 : const SwRect* mpToCharRect;
44 : SwTwips mnToCharTopOfLine;
45 :
46 : virtual bool IsAnchoredToChar() const SAL_OVERRIDE;
47 : virtual const SwFrm* ToCharOrientFrm() const SAL_OVERRIDE;
48 : virtual const SwRect* ToCharRect() const SAL_OVERRIDE;
49 : // #i22341#
50 : virtual SwTwips ToCharTopOfLine() const SAL_OVERRIDE;
51 :
52 : // method to cast <SwAnchoredObjectPosition::GetAnchorFrm()> to
53 : // the needed type
54 : SwTextFrm& GetAnchorTextFrm() const;
55 :
56 : /** determine frame for horizontal position
57 :
58 : if the given proposed frame is a content frame, the proposed
59 : frame is returned.
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.
64 :
65 : @param _pProposedFrm
66 : input parameter - proposed frame for horizontal position
67 :
68 : @return constant reference to <SwFrm> object, at which the
69 : horizontal position is determined.
70 : */
71 : const SwFrm& _GetHoriVirtualAnchor( const SwLayoutFrm& _pProposedFrm ) const;
72 :
73 : public:
74 : SwToContentAnchoredObjectPosition( SdrObject& _rDrawObj );
75 : virtual ~SwToContentAnchoredObjectPosition();
76 :
77 : /** calculate position of object
78 : */
79 : virtual void CalcPosition() SAL_OVERRIDE;
80 :
81 : /** frame, at which the vertical position is oriented at
82 : */
83 4587 : const SwLayoutFrm& GetVertPosOrientFrm() const { return *mpVertPosOrientFrm;}
84 : };
85 : } // namespace objectpositioning
86 :
87 : #endif
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|