xref: /trunk/main/sw/inc/fmtanchr.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
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 _FMTANCHR_HXX
28 #define _FMTANCHR_HXX
29 
30 #include "swdllapi.h"
31 #include <hintids.hxx>
32 #include <swtypes.hxx>
33 #include <format.hxx>
34 #include <svl/poolitem.hxx>
35 
36 struct SwPosition;
37 class IntlWrapper;
38 #define IVER_FMTANCHOR_LONGIDX ((sal_uInt16)1)
39 
40 //FlyAnchor, Anker des Freifliegenden Rahmen ----
41 
42 class SW_DLLPUBLIC SwFmtAnchor: public SfxPoolItem
43 {
44     SwPosition *pCntntAnchor;   //0 Fuer Seitengebundene Rahmen.
45                                 //Index fuer Absatzgebundene Rahmen.
46                                 //Position fuer Zeichengebundene Rahmen
47     RndStdIds  nAnchorId;
48     sal_uInt16     nPageNum;        //Seitennummer bei Seitengeb. Rahmen.
49 
50     // OD 2004-05-05 #i28701# - getting anchor positions ordered
51     sal_uInt32 mnOrder;
52     static sal_uInt32 mnOrderCounter;
53 
54 public:
55     SwFmtAnchor( RndStdIds eRnd = FLY_AT_PAGE, sal_uInt16 nPageNum = 0 );
56     SwFmtAnchor( const SwFmtAnchor &rCpy );
57     ~SwFmtAnchor();
58 
59     //  Zuweisungsoperator
60     SwFmtAnchor &operator=( const SwFmtAnchor& );
61 
62     // "pure virtual Methoden" vom SfxPoolItem
63     virtual int             operator==( const SfxPoolItem& ) const;
64     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
65     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
66                                     SfxMapUnit eCoreMetric,
67                                     SfxMapUnit ePresMetric,
68                                     String &rText,
69                                     const IntlWrapper*    pIntl = 0 ) const;
70 
71     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
72     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
73 
74     RndStdIds GetAnchorId() const { return nAnchorId; }
75     sal_uInt16 GetPageNum() const { return nPageNum; }
76     const SwPosition *GetCntntAnchor() const { return pCntntAnchor; }
77     // OD 2004-05-05 #i28701#
78     sal_uInt32 GetOrder() const;
79 
80     void SetType( RndStdIds nRndId ) { nAnchorId = nRndId; }
81     void SetPageNum( sal_uInt16 nNew ) { nPageNum = nNew; }
82     void SetAnchor( const SwPosition *pPos );
83 };
84 
85 inline const SwFmtAnchor &SwAttrSet::GetAnchor(sal_Bool bInP) const
86     { return static_cast<const SwFmtAnchor&>(Get(RES_ANCHOR, bInP)); }
87 
88  inline const SwFmtAnchor &SwFmt::GetAnchor(sal_Bool bInP) const
89     { return aSet.GetAnchor(bInP); }
90 
91 #endif
92 
93