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 :
20 : #ifndef INCLUDED_BASCTL_SOURCE_BASICIDE_LAYOUT_HXX
21 : #define INCLUDED_BASCTL_SOURCE_BASICIDE_LAYOUT_HXX
22 :
23 : #include <vcl/split.hxx>
24 : #include <vcl/vclptr.hxx>
25 :
26 :
27 : class DockingWindow;
28 : class SfxRequest;
29 : class SfxItemSet;
30 :
31 : namespace basctl
32 : {
33 :
34 : class DockingWindow;
35 : class BaseWindow;
36 :
37 :
38 : // Layout -- the common base of ModulLayout and DialogLayout.
39 : // Handles the splitting lines and the dockable windows.
40 :
41 : class Layout: public vcl::Window
42 : {
43 : public:
44 : void DockaWindow (DockingWindow*);
45 : void ArrangeWindows ();
46 :
47 : virtual void Activating (BaseWindow&);
48 : virtual void Deactivating ();
49 0 : virtual void ExecuteGlobal (SfxRequest&) { }
50 : virtual void GetState (SfxItemSet&, unsigned nWhich) = 0;
51 : virtual void UpdateDebug (bool bBasicStopped ) = 0;
52 :
53 : virtual ~Layout();
54 : virtual void dispose() SAL_OVERRIDE;
55 :
56 : protected:
57 : explicit Layout(vcl::Window* pParent);
58 :
59 0 : void AddToLeft (DockingWindow* pWin, Size const& rSize) { aLeftSide.Add(pWin, rSize); }
60 0 : void AddToBottom (DockingWindow* pWin, Size const& rSize) { aBottomSide.Add(pWin, rSize); }
61 : void Remove (DockingWindow*);
62 0 : bool HasSize () const { return !bFirstSize; }
63 :
64 : // Window:
65 : virtual void Resize () SAL_OVERRIDE;
66 : virtual void DataChanged (DataChangedEvent const& rDCEvt) SAL_OVERRIDE;
67 : // new:
68 : virtual void OnFirstSize (long nWidth, long nHeight) = 0;
69 :
70 : private:
71 : // the main child window (either ModulWindow or DialogWindow)
72 : VclPtr<BaseWindow> pChild;
73 :
74 : // when this window has at first (nonempty) size
75 : bool bFirstSize;
76 :
77 : // horizontal or vertical splitted strip
78 0 : class SplittedSide
79 : {
80 : public:
81 : enum Side {Right, Top, 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 (Rectangle const&);
88 : void dispose();
89 :
90 : private:
91 : // the layout window
92 : Layout& rLayout;
93 : // horizontal or vertical strip?
94 : bool bVertical;
95 : // lower (top or left) or higher (bottom or right) strip?
96 : bool bLower;
97 : // rectangle to move in
98 : Rectangle aRect;
99 : // size (width or height)
100 : long nSize;
101 : // the main splitting line
102 : VclPtr<Splitter> aSplitter;
103 : // the dockable windows (and some data)
104 0 : struct Item
105 : {
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;
117 : };
118 : std::vector<Item> vItems;
119 :
120 : Point MakePoint (long, long) const;
121 : Size MakeSize (long, long) const;
122 : static bool IsDocking (DockingWindow const&);
123 : DECL_LINK(SplitHdl, Splitter*);
124 : void CheckMarginsFor (Splitter*);
125 : void InitSplitter (Splitter&);
126 : } aLeftSide, aBottomSide;
127 : };
128 :
129 : } // namespace basctl
130 :
131 : #endif // INCLUDED_BASCTL_SOURCE_BASICIDE_LAYOUT_HXX
132 :
133 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|