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 <sal/types.h>
24 :
25 : // Compared to the SV sizes SwPosSize is always positive
26 : class SwPosSize
27 : {
28 : sal_uInt16 nWidth;
29 : sal_uInt16 nHeight;
30 : public:
31 222564 : inline SwPosSize( const sal_uInt16 nW = 0, const sal_uInt16 nH = 0 )
32 222564 : : nWidth(nW), nHeight(nH) { }
33 163444 : inline SwPosSize( const Size &rSize )
34 163444 : : nWidth(sal_uInt16(rSize.Width())), nHeight(sal_uInt16(rSize.Height())){ }
35 3353498 : inline sal_uInt16 Height() const { return nHeight; }
36 987102 : inline void Height( const sal_uInt16 nNew ) { nHeight = nNew; }
37 2682835 : inline sal_uInt16 Width() const { return nWidth; }
38 616666 : inline void Width( const sal_uInt16 nNew ) { nWidth = nNew; }
39 :
40 24 : 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 2516 : inline SwPosSize &SwPosSize::operator=(const SwPosSize &rSize )
48 : {
49 2516 : nWidth = rSize.Width();
50 2516 : nHeight = rSize.Height();
51 2516 : return *this;
52 : }
53 :
54 13361 : inline void SwPosSize::SvLSize( const Size &rSize )
55 : {
56 13361 : nWidth = sal_uInt16(rSize.Width());
57 13361 : nHeight = sal_uInt16(rSize.Height());
58 13361 : }
59 :
60 0 : inline void SwPosSize::SvXSize( const Size &rSize )
61 : {
62 0 : nHeight = sal_uInt16(rSize.Width());
63 0 : nWidth = sal_uInt16(rSize.Height());
64 0 : }
65 :
66 : inline SwPosSize &SwPosSize::operator=( const Size &rSize )
67 : {
68 : nWidth = sal_uInt16(rSize.Width());
69 : nHeight = sal_uInt16(rSize.Height());
70 : return *this;
71 : }
72 :
73 : #endif
74 :
75 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|