1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _TOCNTNTANCHOREDOBJECTPOSITION_HXX 28 #define _TOCNTNTANCHOREDOBJECTPOSITION_HXX 29 #include <anchoredobjectposition.hxx> 30 31 class SwFrm; 32 class SwTxtFrm; 33 class SwLayoutFrm; 34 class SwRect; 35 36 namespace objectpositioning 37 { 38 class SwToCntntAnchoredObjectPosition : public SwAnchoredObjectPosition 39 { 40 private: 41 // calculated data for object position 42 const SwLayoutFrm* mpVertPosOrientFrm; 43 // --> OD 2004-06-17 #i26791# 44 // determine offset to frame anchor position according to the 45 // positioning alignments 46 Point maOffsetToFrmAnchorPos; 47 48 // data for calculation of position 49 bool mbAnchorToChar; 50 const SwFrm* mpToCharOrientFrm; 51 const SwRect* mpToCharRect; 52 SwTwips mnToCharTopOfLine; 53 54 virtual bool IsAnchoredToChar() const; 55 virtual const SwFrm* ToCharOrientFrm() const; 56 virtual const SwRect* ToCharRect() const; 57 // OD 12.11.2003 #i22341# 58 virtual SwTwips ToCharTopOfLine() const; 59 60 // method to cast <SwAnchoredObjectPosition::GetAnchorFrm()> to 61 // the needed type 62 SwTxtFrm& GetAnchorTxtFrm() const; 63 64 // ********************************************************************* 65 /** determine frame for horizontal position 66 67 OD 04.08.2003 68 if the given proposed frame is a content frame, the proposed 69 frame is returned. 70 otherwise (given proposed frame is a layout frame), 71 the lower content frames of the proposed frame are checked 72 for the first, that the anchor or a follow of the anchor. 73 If none is found, the proposed frame is returned. 74 75 @author OD 76 77 @param _pProposedFrm 78 input parameter - proposed frame for horizontal position 79 80 @return constant reference to <SwFrm> object, at which the 81 horizontal position is determined. 82 */ 83 const SwFrm& _GetHoriVirtualAnchor( const SwLayoutFrm& _pProposedFrm ) const; 84 85 public: 86 SwToCntntAnchoredObjectPosition( SdrObject& _rDrawObj ); 87 virtual ~SwToCntntAnchoredObjectPosition(); 88 89 /** calculate position of object 90 91 @author OD 92 */ 93 virtual void CalcPosition(); 94 95 /** frame, at which the vertical position is oriented at 96 97 @author OD 98 */ 99 const SwLayoutFrm& GetVertPosOrientFrm() const; 100 }; 101 } // namespace objectpositioning 102 103 #endif 104