/src/libreoffice/sw/inc/fmtornt.hxx
Line | Count | Source |
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_FMTORNT_HXX |
20 | | #define INCLUDED_SW_INC_FMTORNT_HXX |
21 | | |
22 | | #include <com/sun/star/text/HoriOrientation.hpp> |
23 | | #include <com/sun/star/text/VertOrientation.hpp> |
24 | | #include <com/sun/star/text/RelOrientation.hpp> |
25 | | #include "swdllapi.h" |
26 | | #include "hintids.hxx" |
27 | | #include "swtypes.hxx" |
28 | | #include "format.hxx" |
29 | | #include <svl/poolitem.hxx> |
30 | | |
31 | | /// Defines the vertical position of a fly frame. |
32 | | /// |
33 | | /// For example: from top (orientation), by 1cm (relative position), to the entire page (relation). |
34 | | class SW_DLLPUBLIC SwFormatVertOrient final : public SfxPoolItem |
35 | | { |
36 | | SwTwips m_nYPos; ///< Contains *always* the current RelPos. |
37 | | sal_Int16 m_eOrient; |
38 | | sal_Int16 m_eRelation; |
39 | | public: |
40 | | DECLARE_ITEM_TYPE_FUNCTION(SwFormatVertOrient) |
41 | | SwFormatVertOrient( SwTwips nY = 0, sal_Int16 eVert = css::text::VertOrientation::NONE, |
42 | | sal_Int16 eRel = css::text::RelOrientation::PRINT_AREA ); |
43 | 181k | SwFormatVertOrient(SwFormatVertOrient const &) = default; // SfxPoolItem copy function dichotomy |
44 | | |
45 | | /// "Pure virtual methods" of SfxPoolItem. |
46 | | virtual bool operator==( const SfxPoolItem& ) const override; |
47 | | virtual size_t hashCode() const override; |
48 | | virtual SwFormatVertOrient* Clone( SfxItemPool* pPool = nullptr ) const override; |
49 | | virtual bool GetPresentation( SfxItemPresentation ePres, |
50 | | MapUnit eCoreMetric, |
51 | | MapUnit ePresMetric, |
52 | | OUString &rText, |
53 | | const IntlWrapper& rIntl ) const override; |
54 | | virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; |
55 | | virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; |
56 | | |
57 | 899k | sal_Int16 GetVertOrient() const { return m_eOrient; } |
58 | 978k | sal_Int16 GetRelationOrient() const { return m_eRelation; } |
59 | | void SetVertOrient( sal_Int16 eNew ) |
60 | 5.38M | { ASSERT_CHANGE_REFCOUNTED_ITEM; m_eOrient = eNew; } |
61 | | void SetRelationOrient( sal_Int16 eNew ) |
62 | 4.26k | { ASSERT_CHANGE_REFCOUNTED_ITEM; m_eRelation = eNew; } |
63 | | |
64 | 840k | SwTwips GetPos() const { return m_nYPos; } |
65 | | void SetPos( SwTwips nNew ) |
66 | 20.9k | { ASSERT_CHANGE_REFCOUNTED_ITEM; m_nYPos = nNew; } |
67 | | |
68 | | void dumpAsXml(xmlTextWriterPtr pWriter) const override; |
69 | | |
70 | | protected: |
71 | | virtual ItemInstanceManager* getItemInstanceManager() const override; |
72 | | }; |
73 | | |
74 | | /// Defines the horizontal position of a fly frame. |
75 | | /// |
76 | | /// For example: from left (orientation), by 1 cm (relative position), to the entire page |
77 | | /// (relation). |
78 | | class SW_DLLPUBLIC SwFormatHoriOrient final : public SfxPoolItem |
79 | | { |
80 | | SwTwips m_nXPos; ///< Contains *always* the current RelPos. |
81 | | sal_Int16 m_eOrient; |
82 | | sal_Int16 m_eRelation; |
83 | | bool m_bPosToggle : 1; ///< Flip position on even pages. |
84 | | public: |
85 | | DECLARE_ITEM_TYPE_FUNCTION(SwFormatHoriOrient) |
86 | | SwFormatHoriOrient( SwTwips nX = 0, sal_Int16 eHori = css::text::HoriOrientation::NONE, |
87 | | sal_Int16 eRel = css::text::RelOrientation::PRINT_AREA, bool bPos = false ); |
88 | 140k | SwFormatHoriOrient(SwFormatHoriOrient const &) = default; // SfxPoolItem copy function dichotomy |
89 | | |
90 | | /// "Pure virtual methods" of SfxPoolItem. |
91 | | virtual bool operator==( const SfxPoolItem& ) const override; |
92 | | virtual size_t hashCode() const override; |
93 | | virtual SwFormatHoriOrient* Clone( SfxItemPool* pPool = nullptr ) const override; |
94 | | virtual bool GetPresentation( SfxItemPresentation ePres, |
95 | | MapUnit eCoreMetric, |
96 | | MapUnit ePresMetric, |
97 | | OUString &rText, |
98 | | const IntlWrapper& rIntl ) const override; |
99 | | virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; |
100 | | virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; |
101 | | |
102 | 480k | sal_Int16 GetHoriOrient() const { return m_eOrient; } |
103 | 422k | sal_Int16 GetRelationOrient() const { return m_eRelation; } |
104 | 567 | void SetHoriOrient( sal_Int16 eNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_eOrient = eNew; } |
105 | 4.08k | void SetRelationOrient( sal_Int16 eNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_eRelation = eNew; } |
106 | | |
107 | 417k | SwTwips GetPos() const { return m_nXPos; } |
108 | 20.1k | void SetPos( SwTwips nNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_nXPos = nNew; } |
109 | | |
110 | 425k | bool IsPosToggle() const { return m_bPosToggle; } |
111 | 3.07k | void SetPosToggle( bool bNew ) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_bPosToggle = bNew; } |
112 | | |
113 | | void dumpAsXml(xmlTextWriterPtr pWriter) const override; |
114 | | |
115 | | protected: |
116 | | virtual ItemInstanceManager* getItemInstanceManager() const override; |
117 | | }; |
118 | | |
119 | | inline const SwFormatVertOrient &SwAttrSet::GetVertOrient(bool bInP) const |
120 | 143k | { return Get( RES_VERT_ORIENT,bInP); } |
121 | | inline const SwFormatHoriOrient &SwAttrSet::GetHoriOrient(bool bInP) const |
122 | 52.0k | { return Get( RES_HORI_ORIENT,bInP); } |
123 | | |
124 | | inline const SwFormatVertOrient &SwFormat::GetVertOrient(bool bInP) const |
125 | 130k | { return m_aSet.GetVertOrient(bInP); } |
126 | | inline const SwFormatHoriOrient &SwFormat::GetHoriOrient(bool bInP) const |
127 | 52.0k | { return m_aSet.GetHoriOrient(bInP); } |
128 | | |
129 | | namespace sw { |
130 | | |
131 | | bool GetAtPageRelOrientation(sal_Int16 & rOrientation, bool const isIgnorePrintArea); |
132 | | |
133 | | } |
134 | | |
135 | | #endif |
136 | | |
137 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |