1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PaneDockingWindow.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_PANE_DOCKING_WINDOW_HXX
32 #define SD_PANE_DOCKING_WINDOW_HXX
34 #include <sfx2/dockwin.hxx>
35 #include <sfx2/viewfrm.hxx>
37 #include <boost/scoped_ptr.hpp>
38 #include <boost/shared_ptr.hpp>
44 class PaneDockingWindow
45 : public SfxDockingWindow
48 /** Create a new docking window that will be displayed in the specified
50 The constructor will determine the ViewShellBase via the given
51 bindings and tell its PaneManager about the new window. It will ask
52 the PaneManager for a window title.
54 Used, among others, to determine the ViewShellBase and
55 PaneManager that manage the new docking window.
57 This child window is the logical container for the new docking
60 The parent window of the new docking window.
62 The resource is used to determine initial size and attributes.
64 The pane in which to show the docking window.
67 SfxBindings
*pBindings
,
68 SfxChildWindow
*pChildWindow
,
71 const ::rtl::OUString
& rsPaneURL
,
72 const ::rtl::OUString
& rsTitle
);
74 virtual ~PaneDockingWindow (void);
76 virtual void Paint (const Rectangle
& rRectangle
);
77 virtual void Resize (void);
79 virtual long Notify( NotifyEvent
& rNEvt
);
80 virtual void StateChanged( StateChangedType nType
);
81 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
83 /** Initializing the title tool box either creates a new title tool box
84 or clears all items from an existing one. A closer is added as only
87 void InitializeTitleToolBox (void);
89 /** Add a top down menu to the title bar or rather the top-level menu
90 entry. The given callback is called when the menu is clicked and it
91 is the task of the callback to show the menu.
93 The id of the new menu is returned. It can be compared by the
94 callback to the value of GetCurItemId() when called at the given
97 USHORT
AddMenu (const String
& rsMenuName
, ULONG nHelpId
, const Link
& rCallback
);
99 /** Set the title of the docking window to the given string. Use this
100 method when the title is not yet known at the time of construction
101 or can not be passed to the constructor.
103 void SetTitle (const String
& rsTitle
);
105 ::Window
* GetContentWindow (void);
107 ::boost::shared_ptr
<ToolBox
> GetTitleToolBox (void) const;
110 /** The pane which is represented by the docking window.
112 ::rtl::OUString msPaneURL
;
114 /** Title that is shown at the top of the docking window.
116 ::rtl::OUString msTitle
;
118 /** The tool box that is displayed in the window title area contains
119 menus and the closer button.
121 ::boost::shared_ptr
<ToolBox
> mpTitleToolBox
;
123 /** The border that is painted arround the inner window. The bevel
124 shadow lines are part of the border, so where the border is 0 no
125 such line is painted.
129 sal_uInt16 mnChildWindowId
;
131 ::boost::scoped_ptr
< ::Window
> mpContentWindow
;
133 /** Remember that a layout is pending, i.e. Resize() has been called
134 since the last Paint().
136 bool mbIsLayoutPending
;
138 DECL_LINK(ToolboxSelectHandler
, ToolBox
*);
140 /** This does the actual placing and sizing of the title bar and the
141 content window after the size of the docking window has changed.
142 This method is called from withing the Paint() method when since its
143 last invocation the size of the docking window has changed.
148 } // end of namespace ::sd