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