1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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.
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
51 the area which is to be transformed.
53 Rectangle
getTransformed(
54 const Rectangle
& i_rArea
,
55 const TabAlignment i_eTargetAlignment
58 /** normalizes an already transformed rectangle
60 the area which is to be normalized.
62 Rectangle
getNormalized(
63 const Rectangle
& i_rArea
,
64 const TabAlignment i_eTargetAlignment
68 Size
getReferenceSize() const { return m_aReference
.GetSize(); }
70 getReference() const { return m_aReference
; }
73 // the normalized reference area
74 Rectangle m_aReference
;
83 TabBarGeometry( const TabItemContent i_eItemContent
);
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
; }
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;
110 bool impl_fitItems( ItemDescriptors
& io_rItems
) const;
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
;
129 #endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TABBARGEOMETRY_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */