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 _FMTANCHR_HXX
20 : #define _FMTANCHR_HXX
21 :
22 : #include "swdllapi.h"
23 : #include <hintids.hxx>
24 : #include <swtypes.hxx>
25 : #include <format.hxx>
26 : #include <svl/poolitem.hxx>
27 :
28 : #include <boost/scoped_ptr.hpp>
29 :
30 :
31 : struct SwPosition;
32 : class IntlWrapper;
33 :
34 : /// FlyAnchors
35 : class SW_DLLPUBLIC SwFmtAnchor: public SfxPoolItem
36 : {
37 : ::boost::scoped_ptr<SwPosition> m_pCntntAnchor; /**< 0 for page-bound frames.
38 : Index for paragraph-bound frames.
39 : Position for character-bound frames. */
40 : RndStdIds nAnchorId;
41 : sal_uInt16 nPageNum; ///< Page number for page-bound frames.
42 :
43 : /// #i28701# - getting anchor positions ordered
44 : sal_uInt32 mnOrder;
45 : static sal_uInt32 mnOrderCounter;
46 :
47 : public:
48 : SwFmtAnchor( RndStdIds eRnd = FLY_AT_PAGE, sal_uInt16 nPageNum = 0 );
49 : SwFmtAnchor( const SwFmtAnchor &rCpy );
50 : ~SwFmtAnchor();
51 :
52 : SwFmtAnchor &operator=( const SwFmtAnchor& );
53 :
54 : /// "pure virtual methods" of SfxPoolItem
55 : virtual int operator==( const SfxPoolItem& ) const;
56 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
57 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
58 : SfxMapUnit eCoreMetric,
59 : SfxMapUnit ePresMetric,
60 : String &rText,
61 : const IntlWrapper* pIntl = 0 ) const;
62 :
63 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
64 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
65 :
66 19887 : RndStdIds GetAnchorId() const { return nAnchorId; }
67 3691 : sal_uInt16 GetPageNum() const { return nPageNum; }
68 14365 : const SwPosition *GetCntntAnchor() const { return m_pCntntAnchor.get(); }
69 : // #i28701#
70 : sal_uInt32 GetOrder() const;
71 :
72 480 : void SetType( RndStdIds nRndId ) { nAnchorId = nRndId; }
73 0 : void SetPageNum( sal_uInt16 nNew ) { nPageNum = nNew; }
74 : void SetAnchor( const SwPosition *pPos );
75 : };
76 :
77 12101 : inline const SwFmtAnchor &SwAttrSet::GetAnchor(sal_Bool bInP) const
78 12101 : { return static_cast<const SwFmtAnchor&>(Get(RES_ANCHOR, bInP)); }
79 :
80 12101 : inline const SwFmtAnchor &SwFmt::GetAnchor(sal_Bool bInP) const
81 12101 : { return aSet.GetAnchor(bInP); }
82 :
83 : #endif
84 :
85 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|