Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _FMTANCHR_HXX
29 : : #define _FMTANCHR_HXX
30 : :
31 : : #include "swdllapi.h"
32 : : #include <hintids.hxx>
33 : : #include <swtypes.hxx>
34 : : #include <format.hxx>
35 : : #include <svl/poolitem.hxx>
36 : :
37 : : #include <boost/scoped_ptr.hpp>
38 : :
39 : :
40 : : struct SwPosition;
41 : : class IntlWrapper;
42 : :
43 : : // FlyAnchors
44 : : class SW_DLLPUBLIC SwFmtAnchor: public SfxPoolItem
45 : : {
46 : : ::boost::scoped_ptr<SwPosition> m_pCntntAnchor; // 0 for page-bound frames.
47 : : // Index for paragraph-bound frames.
48 : : // Position for character-bound frames.
49 : : RndStdIds nAnchorId;
50 : : sal_uInt16 nPageNum; // Page number for page-bound frames.
51 : :
52 : : // #i28701# - getting anchor positions ordered
53 : : sal_uInt32 mnOrder;
54 : : static sal_uInt32 mnOrderCounter;
55 : :
56 : : public:
57 : : SwFmtAnchor( RndStdIds eRnd = FLY_AT_PAGE, sal_uInt16 nPageNum = 0 );
58 : : SwFmtAnchor( const SwFmtAnchor &rCpy );
59 : : ~SwFmtAnchor();
60 : :
61 : : SwFmtAnchor &operator=( const SwFmtAnchor& );
62 : :
63 : : // "pure virtual methods" of SfxPoolItem
64 : : virtual int operator==( const SfxPoolItem& ) const;
65 : : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
66 : : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
67 : : SfxMapUnit eCoreMetric,
68 : : SfxMapUnit ePresMetric,
69 : : String &rText,
70 : : const IntlWrapper* pIntl = 0 ) const;
71 : :
72 : : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
73 : : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
74 : :
75 : 79697 : RndStdIds GetAnchorId() const { return nAnchorId; }
76 : 12011 : sal_uInt16 GetPageNum() const { return nPageNum; }
77 : 61891 : const SwPosition *GetCntntAnchor() const { return m_pCntntAnchor.get(); }
78 : : // #i28701#
79 : : sal_uInt32 GetOrder() const;
80 : :
81 : 1744 : void SetType( RndStdIds nRndId ) { nAnchorId = nRndId; }
82 : 32 : void SetPageNum( sal_uInt16 nNew ) { nPageNum = nNew; }
83 : : void SetAnchor( const SwPosition *pPos );
84 : : };
85 : :
86 : 53889 : inline const SwFmtAnchor &SwAttrSet::GetAnchor(sal_Bool bInP) const
87 : 53889 : { return static_cast<const SwFmtAnchor&>(Get(RES_ANCHOR, bInP)); }
88 : :
89 : 53889 : inline const SwFmtAnchor &SwFmt::GetAnchor(sal_Bool bInP) const
90 : 53889 : { return aSet.GetAnchor(bInP); }
91 : :
92 : : #endif
93 : :
94 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|