xref: /AOO41X/main/sw/inc/fmtanchr.hxx (revision 54628ca40d27d15cc98fe861da7fff7e60c2f7d6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _FMTANCHR_HXX
24 #define _FMTANCHR_HXX
25 
26 #include "swdllapi.h"
27 #include <hintids.hxx>
28 #include <swtypes.hxx>
29 #include <format.hxx>
30 #include <svl/poolitem.hxx>
31 
32 struct SwPosition;
33 class IntlWrapper;
34 #define IVER_FMTANCHOR_LONGIDX ((sal_uInt16)1)
35 
36 //FlyAnchor, Anker des Freifliegenden Rahmen ----
37 
38 class SW_DLLPUBLIC SwFmtAnchor: public SfxPoolItem
39 {
40     SwPosition *pCntntAnchor;   //0 Fuer Seitengebundene Rahmen.
41                                 //Index fuer Absatzgebundene Rahmen.
42                                 //Position fuer Zeichengebundene Rahmen
43     RndStdIds  nAnchorId;
44     sal_uInt16     nPageNum;        //Seitennummer bei Seitengeb. Rahmen.
45 
46     // OD 2004-05-05 #i28701# - getting anchor positions ordered
47     sal_uInt32 mnOrder;
48     static sal_uInt32 mnOrderCounter;
49 
50 public:
51     SwFmtAnchor( RndStdIds eRnd = FLY_AT_PAGE, sal_uInt16 nPageNum = 0 );
52     SwFmtAnchor( const SwFmtAnchor &rCpy );
53     ~SwFmtAnchor();
54 
55     //  Zuweisungsoperator
56     SwFmtAnchor &operator=( const SwFmtAnchor& );
57 
58     // "pure virtual Methoden" vom SfxPoolItem
59     virtual int             operator==( const SfxPoolItem& ) const;
60     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = 0 ) const;
61     virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
62                                     SfxMapUnit eCoreMetric,
63                                     SfxMapUnit ePresMetric,
64                                     String &rText,
65                                     const IntlWrapper*    pIntl = 0 ) const;
66 
67     virtual sal_Bool             QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
68     virtual sal_Bool             PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
69 
70     RndStdIds GetAnchorId() const { return nAnchorId; }
71     sal_uInt16 GetPageNum() const { return nPageNum; }
72     const SwPosition *GetCntntAnchor() const { return pCntntAnchor; }
73     // OD 2004-05-05 #i28701#
74     sal_uInt32 GetOrder() const;
75 
76     void SetType( RndStdIds nRndId ) { nAnchorId = nRndId; }
77     void SetPageNum( sal_uInt16 nNew ) { nPageNum = nNew; }
78     void SetAnchor( const SwPosition *pPos );
79 };
80 
81 inline const SwFmtAnchor &SwAttrSet::GetAnchor(sal_Bool bInP) const
82     { return static_cast<const SwFmtAnchor&>(Get(RES_ANCHOR, bInP)); }
83 
84  inline const SwFmtAnchor &SwFmt::GetAnchor(sal_Bool bInP) const
85     { return aSet.GetAnchor(bInP); }
86 
87 #endif
88 
89