Branch data 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 : 23429 : inline SwPosSize( const KSHORT nW = 0, const KSHORT nH = 0 )
33 : 23429 : : nWidth(nW), nHeight(nH) { }
34 : 54440 : inline SwPosSize( const Size &rSize )
35 : 54440 : : nWidth(KSHORT(rSize.Width())), nHeight(KSHORT(rSize.Height())){ }
36 : 844431 : inline KSHORT Height() const { return nHeight; }
37 : 185003 : inline void Height( const KSHORT nNew ) { nHeight = nNew; }
38 : 766963 : inline KSHORT Width() const { return nWidth; }
39 : 136398 : inline void Width( const KSHORT nNew ) { nWidth = nNew; }
40 : :
41 : 30 : 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 : 133 : inline SwPosSize &SwPosSize::operator=(const SwPosSize &rSize )
49 : : {
50 : 133 : nWidth = rSize.Width();
51 : 133 : nHeight = rSize.Height();
52 : 133 : return *this;
53 : : }
54 : :
55 : 4187 : inline void SwPosSize::SvLSize( const Size &rSize )
56 : : {
57 : 4187 : nWidth = KSHORT(rSize.Width());
58 : 4187 : nHeight = KSHORT(rSize.Height());
59 : 4187 : }
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: */
|