1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_INC_FMTPDSC_HXX
20 #define INCLUDED_SW_INC_FMTPDSC_HXX
22 #include <svl/poolitem.hxx>
24 #include "hintids.hxx"
27 #include <boost/optional.hpp>
28 #include "pagedesc.hxx"
33 Client of SwPageDesc that is "described" by the attribute. */
35 class SW_DLLPUBLIC SwFormatPageDesc
: public SfxPoolItem
, public SwClient
37 ::boost::optional
<sal_uInt16
> m_oNumOffset
; ///< Offset page number.
38 SwModify
* m_pDefinedIn
; /**< Points to the object in which the
39 attribute was set (ContentNode/Format). */
41 virtual void Modify( const SfxPoolItem
* pOld
, const SfxPoolItem
*pNew
) override
;
42 virtual void SwClientNotify( const SwModify
&, const SfxHint
& rHint
) override
;
45 SwFormatPageDesc( const SwPageDesc
*pDesc
= nullptr );
46 SwFormatPageDesc( const SwFormatPageDesc
&rCpy
);
47 SwFormatPageDesc
&operator=( const SwFormatPageDesc
&rCpy
);
48 virtual ~SwFormatPageDesc() override
;
51 /// "Pure virtual methods" of SfxPoolItem.
52 virtual bool operator==( const SfxPoolItem
& ) const override
;
53 virtual SfxPoolItem
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
54 virtual bool GetPresentation( SfxItemPresentation ePres
,
58 const IntlWrapper
& rIntl
) const override
;
59 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
60 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
62 SwPageDesc
*GetPageDesc() { return static_cast<SwPageDesc
*>(GetRegisteredIn()); }
63 const SwPageDesc
*GetPageDesc() const { return static_cast<const SwPageDesc
*>(GetRegisteredIn()); }
65 const ::boost::optional
<sal_uInt16
>& GetNumOffset() const { return m_oNumOffset
; }
66 void SetNumOffset( const ::boost::optional
<sal_uInt16
>& oNum
) { m_oNumOffset
= oNum
; }
68 /// Query / set where attribute is anchored.
69 const SwModify
* GetDefinedIn() const { return m_pDefinedIn
; }
70 void ChgDefinedIn( const SwModify
* pNew
) { m_pDefinedIn
= const_cast<SwModify
*>(pNew
); }
71 void RegisterToPageDesc( SwPageDesc
& );
72 bool KnowsPageDesc() const;
73 void dumpAsXml(xmlTextWriterPtr pWriter
) const override
;
76 inline const SwFormatPageDesc
&SwAttrSet::GetPageDesc(bool bInP
) const
77 { return Get( RES_PAGEDESC
,bInP
); }
79 inline const SwFormatPageDesc
&SwFormat::GetPageDesc(bool bInP
) const
80 { return m_aSet
.GetPageDesc(bInP
); }
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */