xref: /trunk/main/sw/source/core/text/possiz.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _POSSIZ_HXX
24 #define _POSSIZ_HXX
25 
26 
27 #include <tools/gen.hxx>
28 #include "txttypes.hxx"
29 
30 // Im Gegensazt zu den SV-Sizes ist die SwPosSize immer positiv
31 class SwPosSize
32 {
33 	KSHORT nWidth;
34 	KSHORT nHeight;
35 public:
SwPosSize(const KSHORT nW=0,const KSHORT nH=0)36     inline SwPosSize( const KSHORT nW = 0, const KSHORT nH = 0 )
37         : nWidth(nW), nHeight(nH) { }
SwPosSize(const Size & rSize)38 	inline SwPosSize( const Size &rSize )
39 		: nWidth(KSHORT(rSize.Width())), nHeight(KSHORT(rSize.Height())){ }
Height() const40 	inline KSHORT Height() const { return nHeight; }
Height(const KSHORT nNew)41 	inline void Height( const KSHORT nNew ) { nHeight = nNew; }
Width() const42 	inline KSHORT Width() const { return nWidth; }
Width(const KSHORT nNew)43 	inline void Width( const KSHORT nNew ) { nWidth = nNew; }
44 
SvLSize() const45 	inline Size SvLSize() const { return Size( nWidth, nHeight ); }
46 	inline void SvLSize( const Size &rSize );
47 	inline void SvXSize( const Size &rSize );
48 	inline SwPosSize &operator=( const SwPosSize &rSize );
49 	inline SwPosSize &operator=( const Size &rSize );
50 };
51 
operator =(const SwPosSize & rSize)52 inline SwPosSize &SwPosSize::operator=(const SwPosSize &rSize )
53 {
54 	nWidth	= rSize.Width();
55 	nHeight = rSize.Height();
56 	return *this;
57 }
58 
SvLSize(const Size & rSize)59 inline void SwPosSize::SvLSize( const Size &rSize )
60 {
61 	nWidth	= KSHORT(rSize.Width());
62 	nHeight = KSHORT(rSize.Height());
63 }
64 
SvXSize(const Size & rSize)65 inline void SwPosSize::SvXSize( const Size &rSize )
66 {
67 	nHeight	= KSHORT(rSize.Width());
68 	nWidth = KSHORT(rSize.Height());
69 }
70 
operator =(const Size & rSize)71 inline SwPosSize &SwPosSize::operator=( const Size &rSize )
72 {
73 	nWidth	= KSHORT(rSize.Width());
74 	nHeight = KSHORT(rSize.Height());
75 	return *this;
76 }
77 
78 
79 #endif
80 
81