LibreOffice Module sw (master)  1
possiz.hxx
Go to the documentation of this file.
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  SwPosSize( const sal_uInt16 nW = 0, const sal_uInt16 nH = 0 )
32  : nWidth(nW)
33  , nHeight(nH)
34  {
35  }
36  explicit SwPosSize( const Size &rSize )
37  : nWidth(sal_uInt16(rSize.Width()))
38  ,nHeight(sal_uInt16(rSize.Height()))
39  {
40  }
41 #if defined(__COVERITY__)
42  ~SwPosSize() COVERITY_NOEXCEPT_FALSE {}
43 #endif
44  sal_uInt16 Height() const { return nHeight; }
45  void Height( const sal_uInt16 nNew ) { nHeight = nNew; }
46  sal_uInt16 Width() const { return nWidth; }
47  void Width( const sal_uInt16 nNew ) { nWidth = nNew; }
48  Size SvLSize() const { return Size( nWidth, nHeight ); }
49  void SvLSize( const Size &rSize )
50  {
51  nWidth = sal_uInt16(rSize.Width());
52  nHeight = sal_uInt16(rSize.Height());
53  }
54  void SvXSize( const Size &rSize )
55  {
56  nHeight = sal_uInt16(rSize.Width());
57  nWidth = sal_uInt16(rSize.Height());
58  }
59  SwPosSize& operator=( const Size &rSize )
60  {
61  nWidth = sal_uInt16(rSize.Width());
62  nHeight = sal_uInt16(rSize.Height());
63  return *this;
64  }
65 };
66 
67 #endif
68 
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long Width() const
void Height(const sal_uInt16 nNew)
Definition: possiz.hxx:45
sal_uInt16 Height() const
Definition: possiz.hxx:44
long Height() const
Size SvLSize() const
Definition: possiz.hxx:48
void SvLSize(const Size &rSize)
Definition: possiz.hxx:49
SwPosSize & operator=(const Size &rSize)
Definition: possiz.hxx:59
sal_uInt16 nWidth
Definition: possiz.hxx:28
SwPosSize(const sal_uInt16 nW=0, const sal_uInt16 nH=0)
Definition: possiz.hxx:31
SwPosSize(const Size &rSize)
Definition: possiz.hxx:36
void SvXSize(const Size &rSize)
Definition: possiz.hxx:54
sal_uInt16 nHeight
Definition: possiz.hxx:29
void Width(const sal_uInt16 nNew)
Definition: possiz.hxx:47
sal_uInt16 Width() const
Definition: possiz.hxx:46