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_BASCTL_SOURCE_INC_LAYOUT_HXX
21 #define INCLUDED_BASCTL_SOURCE_INC_LAYOUT_HXX
23 #include <vcl/split.hxx>
24 #include <vcl/vclptr.hxx>
39 // Layout -- the common base of ModulLayout and DialogLayout.
40 // Handles the splitting lines and the dockable windows.
42 class Layout
: public vcl::Window
45 void ArrangeWindows ();
47 virtual void Activating (BaseWindow
&);
48 virtual void Deactivating ();
49 virtual void ExecuteGlobal (SfxRequest
&) { }
50 virtual void GetState (SfxItemSet
&, unsigned nWhich
) = 0;
51 virtual void UpdateDebug (bool bBasicStopped
) = 0;
53 virtual ~Layout() override
;
54 virtual void dispose() override
;
57 explicit Layout(vcl::Window
* pParent
);
59 void AddToLeft (DockingWindow
* pWin
, Size
const& rSize
) { aLeftSide
.Add(pWin
, rSize
); }
60 void AddToBottom (DockingWindow
* pWin
, Size
const& rSize
) { aBottomSide
.Add(pWin
, rSize
); }
61 void Remove (DockingWindow
*);
62 bool HasSize () const { return !bFirstSize
; }
65 virtual void Resize () override
;
66 virtual void DataChanged (DataChangedEvent
const& rDCEvt
) override
;
68 virtual void OnFirstSize (long nWidth
, long nHeight
) = 0;
71 // the main child window (either ModulWindow or DialogWindow)
72 VclPtr
<BaseWindow
> pChild
;
74 // when this window has at first (nonempty) size
77 // horizontal or vertical splitted strip
81 enum class Side
{Left
, Bottom
};
82 SplittedSide (Layout
*, Side
);
83 void Add (DockingWindow
*, Size
const&);
84 void Remove (DockingWindow
*);
85 bool IsEmpty () const;
86 long GetSize () const;
87 void ArrangeIn (tools::Rectangle
const&);
93 // horizontal or vertical strip?
95 // lower (top or left) or higher (bottom or right) strip?
97 // rectangle to move in
98 tools::Rectangle aRect
;
99 // size (width or height)
101 // the main splitting line
102 VclPtr
<Splitter
> aSplitter
;
103 // the dockable windows (and some data)
106 // pointer to the dockable window
107 VclPtr
<DockingWindow
> pWin
;
108 // starting and ending position in the strip
109 // They may be different from the actual window position, because
110 // the window may fill the space of the adjacent currently
111 // non-docking windows, but this change is not stored in these
112 // variables. These change only when the splitter lines are moved.
113 long nStartPos
, nEndPos
;
114 // splitter line window before the window
115 // (the first one is always nullptr)
116 VclPtr
<Splitter
> pSplit
;
118 std::vector
<Item
> vItems
;
120 Point
MakePoint (long, long) const;
121 Size
MakeSize (long, long) const;
122 static bool IsDocking (DockingWindow
const&);
123 DECL_LINK(SplitHdl
, Splitter
*, void);
124 void CheckMarginsFor (Splitter
*);
125 void InitSplitter (Splitter
&);
126 } aLeftSide
, aBottomSide
;
129 } // namespace basctl
131 #endif // INCLUDED_BASCTL_SOURCE_INC_LAYOUT_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */