Avoid potential negative array index access to cached text.
[LibreOffice.git] / vcl / inc / salgeom.hxx
blob418b1cf37549462bfdb74ca9192468458a49727f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_INC_SALGEOM_HXX
21 #define INCLUDED_VCL_INC_SALGEOM_HXX
23 #include <iostream>
25 #include <vcl/dllapi.h>
26 #include <vcl/WindowPosSize.hxx>
27 #include <tools/long.hxx>
29 // There are some unused functions, which I would keep to ease understanding.
30 class SalFrameGeometry : public vcl::WindowPosSize
32 // non-drawable area / margins / frame / decorations around the client area
33 sal_uInt32 m_nLeftDecoration, m_nTopDecoration, m_nRightDecoration, m_nBottomDecoration;
34 unsigned int m_nDisplayScreenNumber;
36 public:
37 SalFrameGeometry()
38 : m_nLeftDecoration(0)
39 , m_nTopDecoration(0)
40 , m_nRightDecoration(0)
41 , m_nBottomDecoration(0)
42 , m_nDisplayScreenNumber(0)
46 constexpr sal_uInt32 leftDecoration() const { return m_nLeftDecoration; }
47 void setLeftDecoration(sal_uInt32 nLeftDecoration) { m_nLeftDecoration = nLeftDecoration; }
48 constexpr sal_uInt32 topDecoration() const { return m_nTopDecoration; }
49 void setTopDecoration(sal_uInt32 nTopDecoration) { m_nTopDecoration = nTopDecoration; }
50 constexpr sal_uInt32 rightDecoration() const { return m_nRightDecoration; }
51 void setRightDecoration(sal_uInt32 nRightDecoration) { m_nRightDecoration = nRightDecoration; }
52 constexpr sal_uInt32 bottomDecoration() const { return m_nBottomDecoration; }
53 void setBottomDecoration(sal_uInt32 nBottomDecoration)
55 m_nBottomDecoration = nBottomDecoration;
57 void setDecorations(sal_uInt32 nLeft, sal_uInt32 nTop, sal_uInt32 nRight, sal_uInt32 nBottom)
59 m_nLeftDecoration = nLeft;
60 m_nTopDecoration = nTop;
61 m_nRightDecoration = nRight;
62 m_nBottomDecoration = nBottom;
65 unsigned int screen() const { return m_nDisplayScreenNumber; }
66 void setScreen(unsigned int nScreen) { m_nDisplayScreenNumber = nScreen; }
69 inline std::ostream& operator<<(std::ostream& s, const SalFrameGeometry& rGeom)
71 s << *static_cast<const vcl::WindowPosSize*>(&rGeom) << ":{" << rGeom.leftDecoration() << ","
72 << rGeom.topDecoration() << "," << rGeom.rightDecoration() << "," << rGeom.bottomDecoration()
73 << "}s" << rGeom.screen();
74 return s;
77 /// Interface used to share logic on sizing between
78 /// SalVirtualDevices and SalFrames
79 class VCL_PLUGIN_PUBLIC SalGeometryProvider
81 public:
82 virtual ~SalGeometryProvider() {}
83 virtual tools::Long GetWidth() const = 0;
84 virtual tools::Long GetHeight() const = 0;
85 virtual bool IsOffScreen() const = 0;
88 #endif // INCLUDED_VCL_INC_SALGEOM_HXX
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */