Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_FLOATWIN_HXX
30 : : #define _SV_FLOATWIN_HXX
31 : :
32 : : #include <tools/solar.h>
33 : : #include <vcl/dllapi.h>
34 : : #include <vcl/syswin.hxx>
35 : :
36 : : class ToolBox;
37 : :
38 : : // ------------------------
39 : : // - FloatingWindow-Types -
40 : : // ------------------------
41 : :
42 : : #define FLOATWIN_POPUPMODE_ALLOWTEAROFF ((sal_uLong)0x00000001)
43 : : #define FLOATWIN_POPUPMODE_ANIMATIONSLIDE ((sal_uLong)0x00000002)
44 : : #define FLOATWIN_POPUPMODE_NOAUTOARRANGE ((sal_uLong)0x00000004)
45 : : #define FLOATWIN_POPUPMODE_NOANIMATION ((sal_uLong)0x00000008)
46 : : #define FLOATWIN_POPUPMODE_DOWN ((sal_uLong)0x00000010)
47 : : #define FLOATWIN_POPUPMODE_UP ((sal_uLong)0x00000020)
48 : : #define FLOATWIN_POPUPMODE_LEFT ((sal_uLong)0x00000040)
49 : : #define FLOATWIN_POPUPMODE_RIGHT ((sal_uLong)0x00000080)
50 : : #define FLOATWIN_POPUPMODE_NOFOCUSCLOSE ((sal_uLong)0x00000100)
51 : : #define FLOATWIN_POPUPMODE_NOKEYCLOSE ((sal_uLong)0x00000200)
52 : : #define FLOATWIN_POPUPMODE_NOMOUSECLOSE ((sal_uLong)0x00000400)
53 : : #define FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE ((sal_uLong)0x00000800)
54 : : #define FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE ((sal_uLong)0x00001000)
55 : : #define FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ((sal_uLong)0x00002000)
56 : : #define FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK ((sal_uLong)0x00004000)
57 : : #define FLOATWIN_POPUPMODE_NEWLEVEL ((sal_uLong)0x00008000)
58 : : #define FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ((sal_uLong)0x00010000)
59 : : #define FLOATWIN_POPUPMODE_GRABFOCUS ((sal_uLong)0x00020000)
60 : :
61 : : #define FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0001)
62 : : #define FLOATWIN_POPUPMODEEND_TEAROFF ((sal_uInt16)0x0002)
63 : : #define FLOATWIN_POPUPMODEEND_DONTCALLHDL ((sal_uInt16)0x0004)
64 : : #define FLOATWIN_POPUPMODEEND_CLOSEALL ((sal_uInt16)0x0008)
65 : :
66 : : #define FLOATWIN_TITLE_NORMAL ((sal_uInt16)0x0001)
67 : : #define FLOATWIN_TITLE_TEAROFF ((sal_uInt16)0x0002)
68 : : #define FLOATWIN_TITLE_POPUP ((sal_uInt16)0x0004)
69 : : #define FLOATWIN_TITLE_NONE ((sal_uInt16)0x0008)
70 : :
71 : : // ------------------
72 : : // - FloatingWindow -
73 : : // ------------------
74 : :
75 : : class VCL_DLLPUBLIC FloatingWindow : public SystemWindow
76 : : {
77 : : class ImplData;
78 : : private:
79 : : FloatingWindow* mpNextFloat;
80 : : Window* mpFirstPopupModeWin;
81 : : ImplData* mpImplData;
82 : : Rectangle maFloatRect;
83 : : sal_uLong mnPostId;
84 : : sal_uLong mnPopupModeFlags;
85 : : sal_uInt16 mnTitle;
86 : : sal_uInt16 mnOldTitle;
87 : : sal_Bool mbInPopupMode;
88 : : sal_Bool mbPopupMode;
89 : : sal_Bool mbPopupModeCanceled;
90 : : sal_Bool mbPopupModeTearOff;
91 : : sal_Bool mbMouseDown;
92 : : sal_Bool mbOldSaveBackMode;
93 : : sal_Bool mbGrabFocus; // act as key input window, although focus is not set
94 : : sal_Bool mbInCleanUp;
95 : : Link maPopupModeEndHdl;
96 : :
97 : : SAL_DLLPRIVATE void ImplCallPopupModeEnd();
98 : : DECL_DLLPRIVATE_LINK( ImplEndPopupModeHdl, void* );
99 : :
100 : : // Copy assignment is forbidden and not implemented.
101 : : SAL_DLLPRIVATE FloatingWindow (const FloatingWindow &);
102 : : SAL_DLLPRIVATE FloatingWindow & operator= (const FloatingWindow &);
103 : :
104 : : protected:
105 : : using Window::ImplInit;
106 : : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
107 : : SAL_DLLPRIVATE void ImplInitSettings();
108 : : SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
109 : :
110 : : public:
111 : : #define IMPL_FLOATWIN_HITTEST_OUTSIDE ((sal_uInt16)0x0001)
112 : : #define IMPL_FLOATWIN_HITTEST_WINDOW ((sal_uInt16)0x0002)
113 : : #define IMPL_FLOATWIN_HITTEST_RECT ((sal_uInt16)0x0004)
114 : : SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( Window* pReference, const Point& rPos, sal_uInt16& rHitTest );
115 : : SAL_DLLPRIVATE FloatingWindow* ImplFindLastLevelFloat();
116 : : SAL_DLLPRIVATE sal_Bool ImplIsFloatPopupModeWindow( const Window* pWindow );
117 : 0 : SAL_DLLPRIVATE void ImplSetMouseDown() { mbMouseDown = sal_True; }
118 : 0 : SAL_DLLPRIVATE sal_Bool ImplIsMouseDown() const { return mbMouseDown; }
119 : : SAL_DLLPRIVATE static Point ImplCalcPos( Window* pWindow,
120 : : const Rectangle& rRect, sal_uLong nFlags,
121 : : sal_uInt16& rArrangeIndex );
122 : : SAL_DLLPRIVATE void ImplEndPopupMode( sal_uInt16 nFlags = 0, sal_uLong nFocusId = 0 );
123 : : SAL_DLLPRIVATE Rectangle& ImplGetItemEdgeClipRect();
124 : 0 : SAL_DLLPRIVATE sal_Bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
125 : :
126 : : public:
127 : : FloatingWindow( Window* pParent, WinBits nStyle = WB_STDFLOATWIN );
128 : : FloatingWindow( Window* pParent, const ResId& rResId );
129 : : ~FloatingWindow();
130 : :
131 : : virtual long Notify( NotifyEvent& rNEvt );
132 : : virtual void StateChanged( StateChangedType nType );
133 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
134 : :
135 : : virtual void PopupModeEnd();
136 : :
137 : : void SetTitleType( sal_uInt16 nTitle );
138 : 138 : sal_uInt16 GetTitleType() const { return mnTitle; }
139 : :
140 : : void StartPopupMode( const Rectangle& rRect, sal_uLong nFlags = 0 );
141 : : void StartPopupMode( ToolBox* pBox, sal_uLong nFlags = 0 );
142 : : void EndPopupMode( sal_uInt16 nFlags = 0 );
143 : : void AddPopupModeWindow( Window* pWindow );
144 : 0 : sal_uLong GetPopupModeFlags() const { return mnPopupModeFlags; }
145 : 0 : void SetPopupModeFlags( sal_uLong nFlags ) { mnPopupModeFlags = nFlags; }
146 : 3904 : sal_Bool IsInPopupMode() const { return mbPopupMode; }
147 : 16 : sal_Bool IsInCleanUp() const { return mbInCleanUp; }
148 : 4 : sal_Bool IsPopupModeCanceled() const { return mbPopupModeCanceled; }
149 : 0 : sal_Bool IsPopupModeTearOff() const { return mbPopupModeTearOff; }
150 : :
151 : 3822 : void SetPopupModeEndHdl( const Link& rLink ) { maPopupModeEndHdl = rLink; }
152 : : const Link& GetPopupModeEndHdl() const { return maPopupModeEndHdl; }
153 : :
154 : 0 : sal_Bool GrabsFocus() const { return mbGrabFocus; }
155 : :
156 : : static Point CalcFloatingPosition( Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex );
157 : : };
158 : :
159 : : #endif // _SV_FLOATWIN_HXX
160 : :
161 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|