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 _POSSIZ_HXX
20 : #define _POSSIZ_HXX
21 :
22 :
23 : #include <tools/gen.hxx>
24 : #include "txttypes.hxx"
25 :
26 : // Compared to the SV sizes SwPosSize is always positive
27 : class SwPosSize
28 : {
29 : KSHORT nWidth;
30 : KSHORT nHeight;
31 : public:
32 1382 : inline SwPosSize( const KSHORT nW = 0, const KSHORT nH = 0 )
33 1382 : : nWidth(nW), nHeight(nH) { }
34 682 : inline SwPosSize( const Size &rSize )
35 682 : : nWidth(KSHORT(rSize.Width())), nHeight(KSHORT(rSize.Height())){ }
36 23807 : inline KSHORT Height() const { return nHeight; }
37 3606 : inline void Height( const KSHORT nNew ) { nHeight = nNew; }
38 14525 : inline KSHORT Width() const { return nWidth; }
39 3142 : inline void Width( const KSHORT nNew ) { nWidth = nNew; }
40 :
41 0 : inline Size SvLSize() const { return Size( nWidth, nHeight ); }
42 : inline void SvLSize( const Size &rSize );
43 : inline void SvXSize( const Size &rSize );
44 : inline SwPosSize &operator=( const SwPosSize &rSize );
45 : inline SwPosSize &operator=( const Size &rSize );
46 : };
47 :
48 6 : inline SwPosSize &SwPosSize::operator=(const SwPosSize &rSize )
49 : {
50 6 : nWidth = rSize.Width();
51 6 : nHeight = rSize.Height();
52 6 : return *this;
53 : }
54 :
55 605 : inline void SwPosSize::SvLSize( const Size &rSize )
56 : {
57 605 : nWidth = KSHORT(rSize.Width());
58 605 : nHeight = KSHORT(rSize.Height());
59 605 : }
60 :
61 0 : inline void SwPosSize::SvXSize( const Size &rSize )
62 : {
63 0 : nHeight = KSHORT(rSize.Width());
64 0 : nWidth = KSHORT(rSize.Height());
65 0 : }
66 :
67 : inline SwPosSize &SwPosSize::operator=( const Size &rSize )
68 : {
69 : nWidth = KSHORT(rSize.Width());
70 : nHeight = KSHORT(rSize.Height());
71 : return *this;
72 : }
73 :
74 :
75 : #endif
76 :
77 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|