bump product version to 4.1.6.2
[LibreOffice.git] / basctl / source / basicide / layout.hxx
blob1092aeb67e30fc0ff49b26474486976aa1d2977a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
27 #include <vector>
28 #include <boost/shared_ptr.hpp>
30 class DockingWindow;
31 class SfxRequest;
32 class SfxItemSet;
34 namespace basctl
37 class DockingWindow;
38 class BaseWindow;
41 // Layout -- the common base of ModulLayout and DialogLayout.
42 // Handles the splitting lines and the dockable windows.
44 class Layout: public Window
46 public:
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;
56 protected:
57 Layout (Window* pParent);
58 virtual ~Layout ();
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; }
65 protected:
66 // Window:
67 virtual void Resize ();
68 virtual void DataChanged (DataChangedEvent const& rDCEvt);
69 // new:
70 virtual void OnFirstSize (long nWidth, long nHeight) = 0;
72 private:
73 // the main child window (either ModulWindow or DialogWindow)
74 BaseWindow* pChild;
76 // when this window has at first (nonempty) size
77 bool bFirstSize;
79 // horizontal or vertical splitted strip
80 class SplittedSide
82 public:
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&);
91 private:
92 // the layout window
93 Layout& rLayout;
94 // horizontal or vertical strip?
95 bool bVertical;
96 // lower (top or left) or higher (bottom or right) strip?
97 bool bLower;
98 // rectangle to move in
99 Rectangle aRect;
100 // size (width or height)
101 long nSize;
102 // the main splitting line
103 Splitter aSplitter;
104 // the dockable windows (and some data)
105 struct Item
107 // pointer to the dockable window
108 DockingWindow* pWin;
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;
120 private:
121 Point MakePoint (long, long) const;
122 Size MakeSize (long, long) const;
123 private:
124 static bool IsDocking (DockingWindow const&);
125 private:
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: */