Branch data 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 BASCTL_LAYOUT_HXX
21 : : #define BASCTL_LAYOUT_HXX
22 : :
23 : : #include <vcl/window.hxx>
24 : : #include <vcl/split.hxx>
25 : : #include <unotools/options.hxx>
26 : :
27 : : #include <vector>
28 : : #include <boost/shared_ptr.hpp>
29 : :
30 : : class DockingWindow;
31 : : class BasicDockingWindow;
32 : : class IDEBaseWindow;
33 : : class SfxRequest;
34 : : class SfxItemSet;
35 : :
36 : : namespace basctl
37 : : {
38 : :
39 : : //
40 : : // Layout -- the common base of ModulLayout and DialogLayout.
41 : : // Handles the splitting lines and the dockable windows.
42 : : //
43 : : class Layout: public Window
44 : : {
45 : : public:
46 : : void DockaWindow (DockingWindow*);
47 : : void ArrangeWindows ();
48 : :
49 : : virtual void Activating (IDEBaseWindow&);
50 : : virtual void Deactivating ();
51 : : virtual void GetState (SfxItemSet&, unsigned nWhich) = 0;
52 : : virtual void UpdateDebug (bool bBasicStopped ) = 0;
53 : :
54 : : protected:
55 : : Layout (Window* pParent);
56 : : virtual ~Layout ();
57 : :
58 : 0 : void AddToLeft (BasicDockingWindow* pWin, Size const& rSize) { aLeftSide.Add(pWin, rSize); }
59 : 0 : void AddToBottom (BasicDockingWindow* pWin, Size const& rSize) { aBottomSide.Add(pWin, rSize); }
60 : :
61 : : protected:
62 : : // Window:
63 : : virtual void Resize ();
64 : : virtual void DataChanged (DataChangedEvent const& rDCEvt);
65 : : // new:
66 : : virtual void OnFirstSize (int nWidth, int nHeight) = 0;
67 : :
68 : : private:
69 : : // the main child window (either ModulWindow or DialogWindow)
70 : : IDEBaseWindow* pChild;
71 : :
72 : : // when this window has at first (nonempty) size
73 : : bool bFirstSize;
74 : :
75 : : // horizontal or vertical splitted strip
76 : 0 : class SplittedSide
77 : : {
78 : : public:
79 : : enum Side {Right, Top, Left, Bottom};
80 : : SplittedSide (Layout*, Side);
81 : : void Add (BasicDockingWindow*, Size const&);
82 : : bool IsEmpty () const;
83 : : int GetSize () const;
84 : : void ArrangeIn (Rectangle const&);
85 : :
86 : : private:
87 : : // the layout window
88 : : Layout& rLayout;
89 : : // ArrangeIn() is called at first time?
90 : : bool bFirstArrange;
91 : : // horizontal or vertical strip?
92 : : bool bVertical;
93 : : // lower (top or left) or higher (bottom or right) strip?
94 : : bool bLower;
95 : : // rectangle to move in
96 : : Rectangle aRect;
97 : : // size (width or height)
98 : : int nSize;
99 : : // last position (between Add()s)
100 : : int nLastPos;
101 : : // the main splitting line
102 : : Splitter aSplitter;
103 : : // the dockable windows
104 : : std::vector<BasicDockingWindow*> vWindows;
105 : : // splitting lines between the docking windows (vWindows.size() - 1)
106 : : std::vector<boost::shared_ptr<Splitter> > vSplitters;
107 : :
108 : : private:
109 : : Point MakePoint (int, int) const;
110 : : Size MakeSize (int, int) const;
111 : : private:
112 : : DECL_LINK(SplitHdl, Splitter*);
113 : : void CheckMarginsFor (Splitter*);
114 : : void InitSplitter (Splitter&);
115 : : } aLeftSide, aBottomSide;
116 : : };
117 : :
118 : : } // namespace basctl
119 : :
120 : : #endif // BASCTL_LAYOUT_HXX
121 : :
122 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|