| 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 | |
| 20 | #pragma once |
| 21 | |
| 22 | #include <iostream> |
| 23 | |
| 24 | #include <vcl/dllapi.h> |
| 25 | #include <vcl/WindowPosSize.hxx> |
| 26 | #include <tools/long.hxx> |
| 27 | |
| 28 | // There are some unused functions, which I would keep to ease understanding. |
| 29 | class SalFrameGeometry : public vcl::WindowPosSize |
| 30 | { |
| 31 | // non-drawable area / margins / frame / decorations around the client area |
| 32 | sal_uInt32 m_nLeftDecoration, m_nTopDecoration, m_nRightDecoration, m_nBottomDecoration; |
| 33 | unsigned int m_nDisplayScreenNumber; |
| 34 | |
| 35 | public: |
| 36 | SalFrameGeometry() |
| 37 | : m_nLeftDecoration(0) |
| 38 | , m_nTopDecoration(0) |
| 39 | , m_nRightDecoration(0) |
| 40 | , m_nBottomDecoration(0) |
| 41 | , m_nDisplayScreenNumber(0) |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | constexpr sal_uInt32 leftDecoration() const { return m_nLeftDecoration; } |
| 46 | void setLeftDecoration(sal_uInt32 nLeftDecoration) { m_nLeftDecoration = nLeftDecoration; } |
| 47 | constexpr sal_uInt32 topDecoration() const { return m_nTopDecoration; } |
| 48 | void setTopDecoration(sal_uInt32 nTopDecoration) { m_nTopDecoration = nTopDecoration; } |
| 49 | constexpr sal_uInt32 rightDecoration() const { return m_nRightDecoration; } |
| 50 | void setRightDecoration(sal_uInt32 nRightDecoration) { m_nRightDecoration = nRightDecoration; } |
| 51 | constexpr sal_uInt32 bottomDecoration() const { return m_nBottomDecoration; } |
| 52 | void setBottomDecoration(sal_uInt32 nBottomDecoration) |
| 53 | { |
| 54 | m_nBottomDecoration = nBottomDecoration; |
| 55 | } |
| 56 | void setDecorations(sal_uInt32 nLeft, sal_uInt32 nTop, sal_uInt32 nRight, sal_uInt32 nBottom) |
| 57 | { |
| 58 | m_nLeftDecoration = nLeft; |
| 59 | m_nTopDecoration = nTop; |
| 60 | m_nRightDecoration = nRight; |
| 61 | m_nBottomDecoration = nBottom; |
| 62 | } |
| 63 | |
| 64 | unsigned int screen() const { return m_nDisplayScreenNumber; } |
| 65 | void setScreen(unsigned int nScreen) { m_nDisplayScreenNumber = nScreen; } |
| 66 | }; |
| 67 | |
| 68 | inline std::ostream& operator<<(std::ostream& s, const SalFrameGeometry& rGeom) |
| 69 | { |
| 70 | s << *static_cast<const vcl::WindowPosSize*>(&rGeom) << ":{" << rGeom.leftDecoration() << "," |
| 71 | << rGeom.topDecoration() << "," << rGeom.rightDecoration() << "," << rGeom.bottomDecoration() |
| 72 | << "}s" << rGeom.screen(); |
| 73 | return s; |
| 74 | } |
| 75 | |
| 76 | /// Interface used to share logic on sizing between |
| 77 | /// SalVirtualDevices and SalFrames |
| 78 | class VCL_PLUGIN_PUBLIC SalGeometryProvider |
| 79 | { |
| 80 | public: |
| 81 | virtual ~SalGeometryProvider() {} |
| 82 | virtual tools::Long GetWidth() const = 0; |
| 83 | virtual tools::Long GetHeight() const = 0; |
| 84 | virtual bool IsOffScreen() const = 0; |
| 85 | }; |
| 86 | |
| 87 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |