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 BASCTL_LAYOUT_HXX
21 #define BASCTL_LAYOUT_HXX
23 #include <vcl/window.hxx>
24 #include <vcl/split.hxx>
25 #include <unotools/options.hxx>
28 #include <boost/shared_ptr.hpp>
41 // Layout -- the common base of ModulLayout and DialogLayout.
42 // Handles the splitting lines and the dockable windows.
44 class Layout
: public Window
47 void DockaWindow (DockingWindow
*);
48 void ArrangeWindows ();
50 virtual void Activating (BaseWindow
&);
51 virtual void Deactivating ();
52 virtual void ExecuteGlobal (SfxRequest
&) { }
53 virtual void GetState (SfxItemSet
&, unsigned nWhich
) = 0;
54 virtual void UpdateDebug (bool bBasicStopped
) = 0;
57 Layout (Window
* pParent
);
60 void AddToLeft (DockingWindow
* pWin
, Size
const& rSize
) { aLeftSide
.Add(pWin
, rSize
); }
61 void AddToBottom (DockingWindow
* pWin
, Size
const& rSize
) { aBottomSide
.Add(pWin
, rSize
); }
62 void Remove (DockingWindow
*);
63 bool HasSize () const { return !bFirstSize
; }
67 virtual void Resize ();
68 virtual void DataChanged (DataChangedEvent
const& rDCEvt
);
70 virtual void OnFirstSize (long nWidth
, long nHeight
) = 0;
73 // the main child window (either ModulWindow or DialogWindow)
76 // when this window has at first (nonempty) size
79 // horizontal or vertical splitted strip
83 enum Side
{Right
, Top
, Left
, Bottom
};
84 SplittedSide (Layout
*, Side
);
85 void Add (DockingWindow
*, Size
const&);
86 void Remove (DockingWindow
*);
87 bool IsEmpty () const;
88 long GetSize () const;
89 void ArrangeIn (Rectangle
const&);
94 // horizontal or vertical strip?
96 // lower (top or left) or higher (bottom or right) strip?
98 // rectangle to move in
100 // size (width or height)
102 // the main splitting line
104 // the dockable windows (and some data)
107 // pointer to the dockable window
109 // starting and ending position in the strip
110 // They may be different from the actual window position, because
111 // the window may fill the space of the adjacent currently
112 // non-docking windows, but this change is not stored in these
113 // variables. These change only when the splitter lines are moved.
114 long nStartPos
, nEndPos
;
115 // splitter line window before the window
116 // (the first one is always nullptr)
117 boost::shared_ptr
<Splitter
> pSplit
;
119 std::vector
<Item
> vItems
;
121 Point
MakePoint (long, long) const;
122 Size
MakeSize (long, long) const;
124 static bool IsDocking (DockingWindow
const&);
126 DECL_LINK(SplitHdl
, Splitter
*);
127 void CheckMarginsFor (Splitter
*);
128 void InitSplitter (Splitter
&);
129 } aLeftSide
, aBottomSide
;
132 } // namespace basctl
134 #endif // BASCTL_LAYOUT_HXX
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */