Bump version to 5.0-14
[LibreOffice.git] / svtools / source / toolpanel / tabbargeometry.hxx
blobff535759af7a45de52624d147f224146a5cc4d8a
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_SVTOOLS_SOURCE_TOOLPANEL_TABBARGEOMETRY_HXX
21 #define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TABBARGEOMETRY_HXX
23 #include <svtools/toolpanel/tabalignment.hxx>
25 #include "tabitemdescriptor.hxx"
27 #include <tools/gen.hxx>
28 #include <tools/svborder.hxx>
31 namespace svt
36 //= NormalizedArea
38 /** a rectangle which automatically translates between unrotated and rotated geometry.
40 It can be operated as if it were an unrotated area, but is able to provide corrdinates of rotated objects,
41 relative to its playground.
43 class NormalizedArea
45 public:
46 NormalizedArea();
47 NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical );
49 /** transforms a rectangle, relative to our playground, into a coordinate system defined by the given alignment
50 @param i_rArea
51 the area which is to be transformed.
53 Rectangle getTransformed(
54 const Rectangle& i_rArea,
55 const TabAlignment i_eTargetAlignment
56 ) const;
58 /** normalizes an already transformed rectangle
59 @param i_rArea
60 the area which is to be normalized.
62 Rectangle getNormalized(
63 const Rectangle& i_rArea,
64 const TabAlignment i_eTargetAlignment
65 ) const;
68 Size getReferenceSize() const { return m_aReference.GetSize(); }
69 const Rectangle&
70 getReference() const { return m_aReference; }
72 private:
73 // the normalized reference area
74 Rectangle m_aReference;
78 //= TabBarGeometry
80 class TabBarGeometry
82 public:
83 TabBarGeometry( const TabItemContent i_eItemContent );
84 ~TabBarGeometry();
86 // retrieves the rectangle to be occupied by the button for scrolling backward through the items
87 const Rectangle& getButtonBackRect() const { return m_aButtonBackRect; }
88 // retrieves the rectangle to be occupied by the items
89 const Rectangle& getItemsRect() const { return m_aItemsRect; }
90 // retrieves the rectangle to be occupied by the button for scrolling forward through the items
91 const Rectangle& getButtonForwardRect() const { return m_aButtonForwardRect; }
93 inline TabItemContent
94 getItemContent() const { return m_eTabItemContent; }
95 inline void setItemContent( const TabItemContent i_eItemContent ) { m_eTabItemContent = i_eItemContent; }
97 /** adjusts the sizes of the buttons and the item's playground, plus the sizes of the items
99 void relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems );
101 /** calculates the optimal size of the tab bar, depending on the item's sizes
103 Size getOptimalSize(ItemDescriptors& io_rItems) const;
105 /** retrieves the position where the first item should start, relative to the item rect
107 Point getFirstItemPosition() const;
109 private:
110 bool impl_fitItems( ItemDescriptors& io_rItems ) const;
112 private:
113 /// specifies the content to be displayed in the tab items
114 TabItemContent m_eTabItemContent;
115 /// specifies the inset to be used in the items area, depends on the actual alignment
116 SvBorder m_aItemsInset;
117 // the (logical) rectangle to be used for the "back" button, empty if the button is not needed
118 Rectangle m_aButtonBackRect;
119 // the (logical) rectangle to be used for the items
120 Rectangle m_aItemsRect;
121 // the (logical) rectangle to be used for the "forward" button, empty if the button is not needed
122 Rectangle m_aButtonForwardRect;
126 } // namespace svt
129 #endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TABBARGEOMETRY_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */