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"
28 #include "pagedesc.hxx"
33 SwFormatPageDesc ("use this page style with xyz parameters") is the wrapper
34 around SwPageDesc ("page style"),
35 multiple SwFormatPageDesc can refer to the same SwPageDesc.
37 class SW_DLLPUBLIC SwFormatPageDesc final
: public SfxPoolItem
, public SwClient
39 ::std::optional
<sal_uInt16
> m_oNumOffset
; ///< Offset page number.
40 sw::BroadcastingModify
* m_pDefinedIn
; /**< Points to the object in which the
41 attribute was set (ContentNode/Format). */
43 virtual void SwClientNotify( const SwModify
&, const SfxHint
& rHint
) override
;
46 explicit SwFormatPageDesc( const SwPageDesc
*pDesc
= nullptr );
47 SwFormatPageDesc( const SwFormatPageDesc
&rCpy
);
48 SwFormatPageDesc
&operator=( const SwFormatPageDesc
&rCpy
);
49 virtual ~SwFormatPageDesc() override
;
52 /// "Pure virtual methods" of SfxPoolItem.
53 virtual bool operator==( const SfxPoolItem
& ) const override
;
54 virtual bool supportsHashCode() const override
{ return true; }
55 virtual size_t hashCode() const override
;
56 virtual SwFormatPageDesc
* Clone( SfxItemPool
* pPool
= nullptr ) const override
;
57 virtual bool GetPresentation( SfxItemPresentation ePres
,
61 const IntlWrapper
& rIntl
) const override
;
62 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
63 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
65 SwPageDesc
*GetPageDesc() { return static_cast<SwPageDesc
*>(GetRegisteredIn()); }
66 const SwPageDesc
*GetPageDesc() const { return static_cast<const SwPageDesc
*>(GetRegisteredIn()); }
68 const ::std::optional
<sal_uInt16
>& GetNumOffset() const { return m_oNumOffset
; }
69 void SetNumOffset( const ::std::optional
<sal_uInt16
>& oNum
) { ASSERT_CHANGE_REFCOUNTED_ITEM
; m_oNumOffset
= oNum
; }
71 /// Query / set where attribute is anchored.
72 const sw::BroadcastingModify
* GetDefinedIn() const { return m_pDefinedIn
; }
73 void ChgDefinedIn( const sw::BroadcastingModify
* pNew
) { m_pDefinedIn
= const_cast<sw::BroadcastingModify
*>(pNew
); }
74 void RegisterToPageDesc( SwPageDesc
& );
75 bool KnowsPageDesc() const;
76 void dumpAsXml(xmlTextWriterPtr pWriter
) const override
;
79 inline const SwFormatPageDesc
&SwAttrSet::GetPageDesc(bool bInP
) const
80 { return Get( RES_PAGEDESC
,bInP
); }
82 inline const SwFormatPageDesc
&SwFormat::GetPageDesc(bool bInP
) const
83 { return m_aSet
.GetPageDesc(bInP
); }
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */