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 <svl/poolitem.hxx>
26 #include <svx/swframetypes.hxx>
27 
28 #include <memory>
29 
30 struct SwPosition;
31 class IntlWrapper;
32 
35 {
36  std::unique_ptr<SwPosition> m_pContentAnchor;
40  sal_uInt16 m_nPageNumber;
41 
43  sal_uInt32 m_nOrder;
44  static sal_uInt32 m_nOrderCounter;
45 
46 public:
47  SwFormatAnchor( RndStdIds eRnd = RndStdIds::FLY_AT_PAGE, sal_uInt16 nPageNum = 0 );
48  SwFormatAnchor( const SwFormatAnchor &rCpy );
49  virtual ~SwFormatAnchor() override;
50 
52 
54  virtual bool operator==( const SfxPoolItem& ) const override;
55  virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
56  virtual bool GetPresentation( SfxItemPresentation ePres,
57  MapUnit eCoreMetric,
58  MapUnit ePresMetric,
59  OUString &rText,
60  const IntlWrapper& rIntl ) const override;
61 
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;
64 
65  RndStdIds GetAnchorId() const { return m_eAnchorId; }
66  sal_uInt16 GetPageNum() const { return m_nPageNumber; }
67  const SwPosition *GetContentAnchor() const { return m_pContentAnchor.get(); }
68  // #i28701#
69  sal_uInt32 GetOrder() const { return m_nOrder;}
70 
71  void SetType( RndStdIds nRndId ) { m_eAnchorId = nRndId; }
72  void SetPageNum( sal_uInt16 nNew ) { m_nPageNumber = nNew; }
73  void SetAnchor( const SwPosition *pPos );
74 
75  void dumpAsXml(xmlTextWriterPtr pWriter) const override;
76 };
77 
78 inline const SwFormatAnchor &SwAttrSet::GetAnchor(bool bInP) const
79  { return Get(RES_ANCHOR, bInP); }
80 
81  inline const SwFormatAnchor &SwFormat::GetAnchor(bool bInP) const
82  { return m_aSet.GetAnchor(bInP); }
83 
84 #endif
85 
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< SwPosition > m_pContentAnchor
0 for page-bound frames.
Definition: fmtanchr.hxx:36
Marks a position in the document model.
Definition: pam.hxx:35
virtual bool operator==(const SfxPoolItem &) const =0
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
sal_uInt16 GetPageNum() const
Definition: fmtanchr.hxx:66
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:78
SfxPoolItem & operator=(const SfxPoolItem &)=delete
SwAttrSet m_aSet
Definition: format.hxx:48
void SetPageNum(sal_uInt16 nNew)
Definition: fmtanchr.hxx:72
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
sal_uInt32 m_nOrder
#i28701# - getting anchor positions ordered
Definition: fmtanchr.hxx:43
struct _xmlTextWriter * xmlTextWriterPtr
SfxItemPresentation
#define RES_ANCHOR
Definition: hintids.hxx:211
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
FlyAnchors.
Definition: fmtanchr.hxx:34
sal_uInt16 m_nPageNumber
Page number for page-bound frames.
Definition: fmtanchr.hxx:40
static sal_uInt32 m_nOrderCounter
Definition: fmtanchr.hxx:44
RndStdIds m_eAnchorId
Definition: fmtanchr.hxx:39
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
unsigned char sal_uInt8
sal_uInt32 GetOrder() const
Definition: fmtanchr.hxx:69
void SetType(RndStdIds nRndId)
Definition: fmtanchr.hxx:71
MapUnit
RndStdIds
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const