xref: /trunk/main/sw/source/core/text/possiz.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _POSSIZ_HXX
28 #define _POSSIZ_HXX
29 
30 
31 #include <tools/gen.hxx>
32 #include "txttypes.hxx"
33 
34 // Im Gegensazt zu den SV-Sizes ist die SwPosSize immer positiv
35 class SwPosSize
36 {
37     KSHORT nWidth;
38     KSHORT nHeight;
39 public:
40     inline SwPosSize( const KSHORT nW = 0, const KSHORT nH = 0 )
41         : nWidth(nW), nHeight(nH) { }
42     inline SwPosSize( const Size &rSize )
43         : nWidth(KSHORT(rSize.Width())), nHeight(KSHORT(rSize.Height())){ }
44     inline KSHORT Height() const { return nHeight; }
45     inline void Height( const KSHORT nNew ) { nHeight = nNew; }
46     inline KSHORT Width() const { return nWidth; }
47     inline void Width( const KSHORT nNew ) { nWidth = nNew; }
48 
49     inline Size SvLSize() const { return Size( nWidth, nHeight ); }
50     inline void SvLSize( const Size &rSize );
51     inline void SvXSize( const Size &rSize );
52     inline SwPosSize &operator=( const SwPosSize &rSize );
53     inline SwPosSize &operator=( const Size &rSize );
54 };
55 
56 inline SwPosSize &SwPosSize::operator=(const SwPosSize &rSize )
57 {
58     nWidth  = rSize.Width();
59     nHeight = rSize.Height();
60     return *this;
61 }
62 
63 inline void SwPosSize::SvLSize( const Size &rSize )
64 {
65     nWidth  = KSHORT(rSize.Width());
66     nHeight = KSHORT(rSize.Height());
67 }
68 
69 inline void SwPosSize::SvXSize( const Size &rSize )
70 {
71     nHeight = KSHORT(rSize.Width());
72     nWidth = KSHORT(rSize.Height());
73 }
74 
75 inline SwPosSize &SwPosSize::operator=( const Size &rSize )
76 {
77     nWidth  = KSHORT(rSize.Width());
78     nHeight = KSHORT(rSize.Height());
79     return *this;
80 }
81 
82 
83 #endif
84 
85