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