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