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_FMTPDSC_HXX
20 : #define INCLUDED_SW_INC_FMTPDSC_HXX
21 :
22 : #include <svl/poolitem.hxx>
23 : #include "swdllapi.h"
24 : #include <hintids.hxx>
25 : #include <format.hxx>
26 : #include <calbck.hxx>
27 : #include <boost/optional.hpp>
28 :
29 : class SwPageDesc;
30 : class SwHistory;
31 : class SwPaM;
32 : class IntlWrapper;
33 : class SwEndNoteInfo;
34 :
35 : /** Pagedescriptor
36 : Client of SwPageDesc that is "described" by the attribute. */
37 :
38 : class SW_DLLPUBLIC SwFmtPageDesc : public SfxPoolItem, public SwClient
39 : {
40 : /** This "Doc"-function is made friend in order to be able
41 : to set the auto-flag after copying!! */
42 : friend bool InsAttr( SwDoc*, const SwPaM &, const SfxItemSet&, sal_uInt16,
43 : SwHistory* );
44 : ::boost::optional<sal_uInt16> oNumOffset; ///< Offset page number.
45 : sal_uInt16 nDescNameIdx; ///< SW3-Reader: stringpool-index of style name.
46 : SwModify* pDefinedIn; /**< Points to the object in which the
47 : attribute was set (CntntNode/Format). */
48 : protected:
49 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) SAL_OVERRIDE;
50 : virtual void SwClientNotify( const SwModify&, const SfxHint& rHint ) SAL_OVERRIDE;
51 :
52 : public:
53 : SwFmtPageDesc( const SwPageDesc *pDesc = 0 );
54 : SwFmtPageDesc( const SwFmtPageDesc &rCpy );
55 : SwFmtPageDesc &operator=( const SwFmtPageDesc &rCpy );
56 : virtual ~SwFmtPageDesc();
57 :
58 : TYPEINFO_OVERRIDE();
59 :
60 : /// "Pure virtual methods" of SfxPoolItem.
61 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
62 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const SAL_OVERRIDE;
63 : virtual bool GetPresentation( SfxItemPresentation ePres,
64 : SfxMapUnit eCoreMetric,
65 : SfxMapUnit ePresMetric,
66 : OUString &rText,
67 : const IntlWrapper* pIntl = 0 ) const SAL_OVERRIDE;
68 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
69 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
70 :
71 498026 : SwPageDesc *GetPageDesc() { return (SwPageDesc*)GetRegisteredIn(); }
72 206284 : const SwPageDesc *GetPageDesc() const { return (SwPageDesc*)GetRegisteredIn(); }
73 :
74 13500 : ::boost::optional<sal_uInt16> GetNumOffset() const { return oNumOffset; }
75 406 : void SetNumOffset( ::boost::optional<sal_uInt16> oNum ) { oNumOffset = oNum; }
76 :
77 : /// Query / set where attribute is anchored.
78 209362 : inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
79 41540 : void ChgDefinedIn( const SwModify* pNew ) { pDefinedIn = (SwModify*)pNew; }
80 : void RegisterToEndNotInfo( SwEndNoteInfo& );
81 : void RegisterToPageDesc( SwPageDesc& );
82 : bool KnowsPageDesc() const;
83 : };
84 :
85 145331 : inline const SwFmtPageDesc &SwAttrSet::GetPageDesc(bool bInP) const
86 145331 : { return (const SwFmtPageDesc&)Get( RES_PAGEDESC,bInP); }
87 :
88 2274 : inline const SwFmtPageDesc &SwFmt::GetPageDesc(bool bInP) const
89 2274 : { return aSet.GetPageDesc(bInP); }
90 :
91 : #endif
92 :
93 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|