Line data Source code
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 : #ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_DECKLAYOUTER_HXX
20 : #define INCLUDED_SFX2_SOURCE_SIDEBAR_DECKLAYOUTER_HXX
21 :
22 : #include "Panel.hxx"
23 :
24 : #include <tools/gen.hxx>
25 :
26 : #include <com/sun/star/ui/LayoutSize.hpp>
27 :
28 : #include <vector>
29 :
30 : class ScrollBar;
31 : class Window;
32 :
33 : namespace sfx2 { namespace sidebar {
34 :
35 : class Panel;
36 :
37 :
38 : /** Helper class for layouting the direct and indirect children of a
39 : deck like title bars, panels, and scroll bars.
40 : */
41 : class DeckLayouter
42 : {
43 : public:
44 : static void LayoutDeck (
45 : const Rectangle aContentArea,
46 : sal_Int32& rMinimalWidth,
47 : SharedPanelContainer& rPanels,
48 : Window& pDeckTitleBar,
49 : Window& pScrollClipWindow,
50 : Window& pScrollContainer,
51 : Window& pFiller,
52 : ScrollBar& pVerticalScrollBar);
53 :
54 : private:
55 : // Do not use constructor or destructor.
56 : DeckLayouter (void);
57 : ~DeckLayouter (void);
58 :
59 : enum LayoutMode
60 : {
61 : MinimumOrLarger,
62 : PreferredOrLarger,
63 : Preferred
64 : };
65 0 : class LayoutItem
66 : {
67 : public:
68 : SharedPanel mpPanel;
69 : css::ui::LayoutSize maLayoutSize;
70 : sal_Int32 mnDistributedHeight;
71 : sal_Int32 mnWeight;
72 : sal_Int32 mnPanelIndex;
73 : bool mbShowTitleBar;
74 :
75 0 : LayoutItem (void)
76 0 : : mpPanel(),maLayoutSize(0,0,0),mnDistributedHeight(0),mnWeight(0),mnPanelIndex(0),mbShowTitleBar(true)
77 0 : {}
78 : };
79 : static Rectangle LayoutPanels (
80 : const Rectangle aContentArea,
81 : sal_Int32& rMinimalWidth,
82 : ::std::vector<LayoutItem>& rLayoutItems,
83 : Window& rScrollClipWindow,
84 : Window& rScrollContainer,
85 : ScrollBar& pVerticalScrollBar,
86 : const bool bShowVerticalScrollBar);
87 : static void GetRequestedSizes (
88 : ::std::vector<LayoutItem>& rLayoutItem,
89 : sal_Int32& rAvailableHeight,
90 : sal_Int32& rMinimalWidth,
91 : const Rectangle& rContentBox);
92 : static void DistributeHeights (
93 : ::std::vector<LayoutItem>& rLayoutItems,
94 : const sal_Int32 nHeightToDistribute,
95 : const sal_Int32 nContainerHeight,
96 : const bool bMinimumHeightIsBase);
97 : static sal_Int32 PlacePanels (
98 : ::std::vector<LayoutItem>& rLayoutItems,
99 : const sal_Int32 nWidth,
100 : const LayoutMode eMode,
101 : Window& rScrollContainer);
102 : static Rectangle PlaceDeckTitle (
103 : Window& rTittleBar,
104 : const Rectangle& rAvailableSpace);
105 : static Rectangle PlaceVerticalScrollBar (
106 : ScrollBar& rVerticalScrollBar,
107 : const Rectangle& rAvailableSpace,
108 : const bool bShowVerticalScrollBar);
109 : static void SetupVerticalScrollBar(
110 : ScrollBar& rVerticalScrollBar,
111 : const sal_Int32 nContentHeight,
112 : const sal_Int32 nVisibleHeight);
113 : static void UpdateFiller (
114 : Window& rFiller,
115 : const Rectangle& rBox);
116 : };
117 :
118 :
119 : } } // end of namespace sfx2::sidebar
120 :
121 : #endif
122 :
123 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|