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 #pragma once
20 
21 #include <tools/gen.hxx>
22 #include <sal/types.h>
23 
24 // Compared to the SV sizes SwPosSize is always positive
25 class SwPosSize
26 {
27  sal_uInt32 m_nWidth;
28  sal_uInt32 m_nHeight;
29 public:
30  SwPosSize( const sal_uInt32 nW = 0, const sal_uInt32 nH = 0 )
31  : m_nWidth(nW)
32  , m_nHeight(nH)
33  {
34  }
35  explicit SwPosSize( const Size &rSize )
36  : m_nWidth(sal_uInt32(rSize.Width()))
37  ,m_nHeight(sal_uInt32(rSize.Height()))
38  {
39  }
40 #if defined(__COVERITY__)
41  virtual ~SwPosSize() COVERITY_NOEXCEPT_FALSE {}
42 #else
43  virtual ~SwPosSize() {}
44 #endif
45  SwPosSize(SwPosSize const &) = default;
46  SwPosSize(SwPosSize &&) = default;
47  SwPosSize & operator =(SwPosSize const &) = default;
48  SwPosSize & operator =(SwPosSize &&) = default;
49  sal_uInt32 Height() const { return m_nHeight; }
50  virtual void Height(const sal_uInt32 nNew, const bool = true) { m_nHeight = nNew; }
51  sal_uInt32 Width() const { return m_nWidth; }
52  void Width( const sal_uInt32 nNew ) { m_nWidth = nNew; }
53  Size SvLSize() const { return Size( m_nWidth, m_nHeight ); }
54  void SvLSize( const Size &rSize )
55  {
56  m_nWidth = sal_uInt32(rSize.Width());
57  m_nHeight = sal_uInt32(rSize.Height());
58  }
59  void SvXSize( const Size &rSize )
60  {
61  m_nHeight = sal_uInt32(rSize.Width());
62  m_nWidth = sal_uInt32(rSize.Height());
63  }
64  SwPosSize& operator=( const Size &rSize )
65  {
66  m_nWidth = sal_uInt32(rSize.Width());
67  m_nHeight = sal_uInt32(rSize.Height());
68  return *this;
69  }
70 };
71 
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt32 m_nWidth
Definition: possiz.hxx:27
Size SvLSize() const
Definition: possiz.hxx:53
void SvLSize(const Size &rSize)
Definition: possiz.hxx:54
constexpr tools::Long Width() const
SwPosSize & operator=(SwPosSize const &)=default
SwPosSize & operator=(const Size &rSize)
Definition: possiz.hxx:64
virtual ~SwPosSize()
Definition: possiz.hxx:43
SwPosSize(const Size &rSize)
Definition: possiz.hxx:35
void SvXSize(const Size &rSize)
Definition: possiz.hxx:59
SwPosSize(const sal_uInt32 nW=0, const sal_uInt32 nH=0)
Definition: possiz.hxx:30
void Width(const sal_uInt32 nNew)
Definition: possiz.hxx:52
sal_uInt32 Height() const
Definition: possiz.hxx:49
sal_uInt32 m_nHeight
Definition: possiz.hxx:28
constexpr tools::Long Height() const
virtual void Height(const sal_uInt32 nNew, const bool=true)
Definition: possiz.hxx:50
sal_uInt32 Width() const
Definition: possiz.hxx:51