LibreOffice Module sw (master) 1
fmtanchr.hxx
Go to the documentation of this file.
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 "format.hxx"
25#include "pam.hxx"
26#include <svl/poolitem.hxx>
27#include <svx/swframetypes.hxx>
28
29#include <memory>
30#include <optional>
31
32struct SwPosition;
33class IntlWrapper;
34
37{
38 std::optional<SwPosition> m_oContentAnchor;
42 sal_uInt16 m_nPageNumber;
43
45 sal_uInt32 m_nOrder;
46 static sal_uInt32 s_nOrderCounter;
47
48public:
49 SwFormatAnchor( RndStdIds eRnd = RndStdIds::FLY_AT_PAGE, sal_uInt16 nPageNum = 0 );
50 SwFormatAnchor( const SwFormatAnchor &rCpy );
51 virtual ~SwFormatAnchor() override;
52
54
56 virtual bool operator==( const SfxPoolItem& ) const override;
57 virtual SwFormatAnchor* Clone( SfxItemPool* pPool = nullptr ) const override;
58 virtual bool GetPresentation( SfxItemPresentation ePres,
59 MapUnit eCoreMetric,
60 MapUnit ePresMetric,
61 OUString &rText,
62 const IntlWrapper& rIntl ) const override;
63
64 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
65 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
66
67 RndStdIds GetAnchorId() const { return m_eAnchorId; }
68 void SetType( RndStdIds nRndId ) { m_eAnchorId = nRndId; }
69
70 sal_uInt16 GetPageNum() const { return m_nPageNumber; }
71 void SetPageNum( sal_uInt16 nNew ) { m_nPageNumber = nNew; }
72
73 SwNode* GetAnchorNode() const;
74 const SwPosition* GetContentAnchor() const { return m_oContentAnchor ? &*m_oContentAnchor : nullptr; }
75 SwContentNode* GetAnchorContentNode() const;
76 sal_Int32 GetAnchorContentOffset() const;
77 void SetAnchor( const SwPosition *pPos );
78
79 // #i28701#
80 sal_uInt32 GetOrder() const { return m_nOrder;}
81
82 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
83};
84
85inline const SwFormatAnchor &SwAttrSet::GetAnchor(bool bInP) const
86 { return Get(RES_ANCHOR, bInP); }
87
88 inline const SwFormatAnchor &SwFormat::GetAnchor(bool bInP) const
89 { return m_aSet.GetAnchor(bInP); }
90
91#endif
92
93/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
virtual bool operator==(const SfxPoolItem &) const=0
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
SfxPoolItem & operator=(const SfxPoolItem &)=delete
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:85
FlyAnchors.
Definition: fmtanchr.hxx:37
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:70
void SetPageNum(sal_uInt16 nNew)
Definition: fmtanchr.hxx:71
RndStdIds m_eAnchorId
Definition: fmtanchr.hxx:41
std::optional< SwPosition > m_oContentAnchor
0 for page-bound frames.
Definition: fmtanchr.hxx:38
sal_uInt16 m_nPageNumber
Page number for page-bound frames.
Definition: fmtanchr.hxx:42
sal_uInt32 GetOrder() const
Definition: fmtanchr.hxx:80
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
void SetType(RndStdIds nRndId)
Definition: fmtanchr.hxx:68
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:74
sal_uInt32 m_nOrder
#i28701# - getting anchor positions ordered
Definition: fmtanchr.hxx:45
static sal_uInt32 s_nOrderCounter
Definition: fmtanchr.hxx:46
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
SwAttrSet m_aSet
Definition: format.hxx:51
Base class of the Writer document model elements.
Definition: node.hxx:98
struct _xmlTextWriter * xmlTextWriterPtr
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
MapUnit
SfxItemPresentation
Marks a position in the document model.
Definition: pam.hxx:38
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
RndStdIds
unsigned char sal_uInt8