Line data Source code
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 _FMTORNT_HXX
20 : #define _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 :
32 : class IntlWrapper;
33 :
34 44751 : class SW_DLLPUBLIC SwFmtVertOrient: public SfxPoolItem
35 : {
36 : SwTwips nYPos; ///< Contains *always* the current RelPos.
37 : sal_Int16 eOrient;
38 : sal_Int16 eRelation;
39 : public:
40 : TYPEINFO();
41 : SwFmtVertOrient( SwTwips nY = 0, sal_Int16 eVert = com::sun::star::text::VertOrientation::NONE,
42 : sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA );
43 : inline SwFmtVertOrient &operator=( const SwFmtVertOrient &rCpy );
44 :
45 : /// "Pure virtual methods" of SfxPoolItem.
46 : virtual int operator==( const SfxPoolItem& ) const;
47 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
48 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
49 : SfxMapUnit eCoreMetric,
50 : SfxMapUnit ePresMetric,
51 : String &rText,
52 : const IntlWrapper* pIntl = 0 ) const;
53 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
54 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
55 :
56 : SvStream& Store(SvStream &rStream, sal_uInt16 itemVersion) const;
57 : SfxPoolItem* Create(SvStream &rStream, sal_uInt16 itemVersion) const;
58 :
59 1733 : sal_Int16 GetVertOrient() const { return eOrient; }
60 235 : sal_Int16 GetRelationOrient() const { return eRelation; }
61 19405 : void SetVertOrient( sal_Int16 eNew ) { eOrient = eNew; }
62 0 : void SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
63 :
64 931 : SwTwips GetPos() const { return nYPos; }
65 349 : void SetPos( SwTwips nNew ) { nYPos = nNew; }
66 : };
67 :
68 :
69 1368 : class SW_DLLPUBLIC SwFmtHoriOrient: public SfxPoolItem
70 : {
71 : SwTwips nXPos; ///< Contains *always* the current RelPos.
72 : sal_Int16 eOrient;
73 : sal_Int16 eRelation;
74 : sal_Bool bPosToggle : 1; ///< Flip position on even pages.
75 : public:
76 : TYPEINFO();
77 : SwFmtHoriOrient( SwTwips nX = 0, sal_Int16 eHori = com::sun::star::text::HoriOrientation::NONE,
78 : sal_Int16 eRel = com::sun::star::text::RelOrientation::PRINT_AREA, sal_Bool bPos = sal_False );
79 : inline SwFmtHoriOrient &operator=( const SwFmtHoriOrient &rCpy );
80 :
81 : /// "Pure virtual methods" of SfxPoolItem.
82 : virtual int operator==( const SfxPoolItem& ) const;
83 : virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
84 : virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
85 : SfxMapUnit eCoreMetric,
86 : SfxMapUnit ePresMetric,
87 : String &rText,
88 : const IntlWrapper* pIntl = 0 ) const;
89 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
90 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
91 :
92 580 : sal_Int16 GetHoriOrient() const { return eOrient; }
93 106 : sal_Int16 GetRelationOrient() const { return eRelation; }
94 1 : void SetHoriOrient( sal_Int16 eNew ) { eOrient = eNew; }
95 0 : void SetRelationOrient( sal_Int16 eNew ) { eRelation = eNew; }
96 :
97 340 : SwTwips GetPos() const { return nXPos; }
98 142 : void SetPos( SwTwips nNew ) { nXPos = nNew; }
99 :
100 118 : sal_Bool IsPosToggle() const { return bPosToggle; }
101 14 : void SetPosToggle( sal_Bool bNew ) { bPosToggle = bNew; }
102 : };
103 :
104 0 : inline SwFmtVertOrient &SwFmtVertOrient::operator=( const SwFmtVertOrient &rCpy )
105 : {
106 0 : nYPos = rCpy.GetPos();
107 0 : eOrient = rCpy.GetVertOrient();
108 0 : eRelation = rCpy.GetRelationOrient();
109 0 : return *this;
110 : }
111 0 : inline SwFmtHoriOrient &SwFmtHoriOrient::operator=( const SwFmtHoriOrient &rCpy )
112 : {
113 0 : nXPos = rCpy.GetPos();
114 0 : eOrient = rCpy.GetHoriOrient();
115 0 : eRelation = rCpy.GetRelationOrient();
116 0 : bPosToggle = rCpy.IsPosToggle();
117 0 : return *this;
118 : }
119 :
120 2197 : inline const SwFmtVertOrient &SwAttrSet::GetVertOrient(sal_Bool bInP) const
121 2197 : { return (const SwFmtVertOrient&)Get( RES_VERT_ORIENT,bInP); }
122 441 : inline const SwFmtHoriOrient &SwAttrSet::GetHoriOrient(sal_Bool bInP) const
123 441 : { return (const SwFmtHoriOrient&)Get( RES_HORI_ORIENT,bInP); }
124 :
125 1730 : inline const SwFmtVertOrient &SwFmt::GetVertOrient(sal_Bool bInP) const
126 1730 : { return aSet.GetVertOrient(bInP); }
127 441 : inline const SwFmtHoriOrient &SwFmt::GetHoriOrient(sal_Bool bInP) const
128 441 : { return aSet.GetHoriOrient(bInP); }
129 :
130 : #endif
131 :
132 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|