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 _SV_FLOATWIN_HXX
21 : #define _SV_FLOATWIN_HXX
22 :
23 : #include <tools/solar.h>
24 : #include <vcl/dllapi.h>
25 : #include <vcl/syswin.hxx>
26 :
27 : class ToolBox;
28 :
29 : // ------------------------
30 : // - FloatingWindow-Types -
31 : // ------------------------
32 :
33 : #define FLOATWIN_POPUPMODE_ALLOWTEAROFF ((sal_uLong)0x00000001)
34 : #define FLOATWIN_POPUPMODE_ANIMATIONSLIDE ((sal_uLong)0x00000002)
35 : #define FLOATWIN_POPUPMODE_NOAUTOARRANGE ((sal_uLong)0x00000004)
36 : #define FLOATWIN_POPUPMODE_NOANIMATION ((sal_uLong)0x00000008)
37 : #define FLOATWIN_POPUPMODE_DOWN ((sal_uLong)0x00000010)
38 : #define FLOATWIN_POPUPMODE_UP ((sal_uLong)0x00000020)
39 : #define FLOATWIN_POPUPMODE_LEFT ((sal_uLong)0x00000040)
40 : #define FLOATWIN_POPUPMODE_RIGHT ((sal_uLong)0x00000080)
41 : #define FLOATWIN_POPUPMODE_NOFOCUSCLOSE ((sal_uLong)0x00000100)
42 : #define FLOATWIN_POPUPMODE_NOKEYCLOSE ((sal_uLong)0x00000200)
43 : #define FLOATWIN_POPUPMODE_NOMOUSECLOSE ((sal_uLong)0x00000400)
44 : #define FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE ((sal_uLong)0x00000800)
45 : #define FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE ((sal_uLong)0x00001000)
46 : #define FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ((sal_uLong)0x00002000)
47 : #define FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK ((sal_uLong)0x00004000)
48 : #define FLOATWIN_POPUPMODE_NEWLEVEL ((sal_uLong)0x00008000)
49 : #define FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE ((sal_uLong)0x00010000)
50 : #define FLOATWIN_POPUPMODE_GRABFOCUS ((sal_uLong)0x00020000)
51 :
52 : #define FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0001)
53 : #define FLOATWIN_POPUPMODEEND_TEAROFF ((sal_uInt16)0x0002)
54 : #define FLOATWIN_POPUPMODEEND_DONTCALLHDL ((sal_uInt16)0x0004)
55 : #define FLOATWIN_POPUPMODEEND_CLOSEALL ((sal_uInt16)0x0008)
56 :
57 : #define FLOATWIN_TITLE_NORMAL ((sal_uInt16)0x0001)
58 : #define FLOATWIN_TITLE_TEAROFF ((sal_uInt16)0x0002)
59 : #define FLOATWIN_TITLE_POPUP ((sal_uInt16)0x0004)
60 : #define FLOATWIN_TITLE_NONE ((sal_uInt16)0x0008)
61 :
62 : // ------------------
63 : // - FloatingWindow -
64 : // ------------------
65 :
66 : class VCL_DLLPUBLIC FloatingWindow : public SystemWindow
67 : {
68 : class ImplData;
69 : private:
70 : FloatingWindow* mpNextFloat;
71 : Window* mpFirstPopupModeWin;
72 : ImplData* mpImplData;
73 : Rectangle maFloatRect;
74 : sal_uLong mnPostId;
75 : sal_uLong mnPopupModeFlags;
76 : sal_uInt16 mnTitle;
77 : sal_uInt16 mnOldTitle;
78 : sal_Bool mbInPopupMode;
79 : sal_Bool mbPopupMode;
80 : sal_Bool mbPopupModeCanceled;
81 : sal_Bool mbPopupModeTearOff;
82 : sal_Bool mbMouseDown;
83 : sal_Bool mbOldSaveBackMode;
84 : sal_Bool mbGrabFocus; // act as key input window, although focus is not set
85 : sal_Bool mbInCleanUp;
86 : Link maPopupModeEndHdl;
87 :
88 : SAL_DLLPRIVATE void ImplCallPopupModeEnd();
89 : DECL_DLLPRIVATE_LINK( ImplEndPopupModeHdl, void* );
90 :
91 : // Copy assignment is forbidden and not implemented.
92 : SAL_DLLPRIVATE FloatingWindow (const FloatingWindow &);
93 : SAL_DLLPRIVATE FloatingWindow & operator= (const FloatingWindow &);
94 :
95 : protected:
96 : using Window::ImplInit;
97 : SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
98 : SAL_DLLPRIVATE void ImplInitSettings();
99 : SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
100 :
101 : public:
102 : #define IMPL_FLOATWIN_HITTEST_OUTSIDE ((sal_uInt16)0x0001)
103 : #define IMPL_FLOATWIN_HITTEST_WINDOW ((sal_uInt16)0x0002)
104 : #define IMPL_FLOATWIN_HITTEST_RECT ((sal_uInt16)0x0004)
105 : SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( Window* pReference, const Point& rPos, sal_uInt16& rHitTest );
106 : SAL_DLLPRIVATE FloatingWindow* ImplFindLastLevelFloat();
107 : SAL_DLLPRIVATE sal_Bool ImplIsFloatPopupModeWindow( const Window* pWindow );
108 0 : SAL_DLLPRIVATE void ImplSetMouseDown() { mbMouseDown = sal_True; }
109 0 : SAL_DLLPRIVATE sal_Bool ImplIsMouseDown() const { return mbMouseDown; }
110 : SAL_DLLPRIVATE static Point ImplCalcPos( Window* pWindow,
111 : const Rectangle& rRect, sal_uLong nFlags,
112 : sal_uInt16& rArrangeIndex );
113 : SAL_DLLPRIVATE void ImplEndPopupMode( sal_uInt16 nFlags = 0, sal_uLong nFocusId = 0 );
114 : SAL_DLLPRIVATE Rectangle& ImplGetItemEdgeClipRect();
115 0 : SAL_DLLPRIVATE sal_Bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
116 :
117 : public:
118 : FloatingWindow( Window* pParent, WinBits nStyle = WB_STDFLOATWIN );
119 : FloatingWindow( Window* pParent, const ResId& rResId );
120 : ~FloatingWindow();
121 :
122 : virtual long Notify( NotifyEvent& rNEvt );
123 : virtual void StateChanged( StateChangedType nType );
124 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
125 :
126 : virtual void PopupModeEnd();
127 :
128 : void SetTitleType( sal_uInt16 nTitle );
129 0 : sal_uInt16 GetTitleType() const { return mnTitle; }
130 :
131 : void StartPopupMode( const Rectangle& rRect, sal_uLong nFlags = 0 );
132 : void StartPopupMode( ToolBox* pBox, sal_uLong nFlags = 0 );
133 : void EndPopupMode( sal_uInt16 nFlags = 0 );
134 : void AddPopupModeWindow( Window* pWindow );
135 0 : sal_uLong GetPopupModeFlags() const { return mnPopupModeFlags; }
136 0 : void SetPopupModeFlags( sal_uLong nFlags ) { mnPopupModeFlags = nFlags; }
137 0 : sal_Bool IsInPopupMode() const { return mbPopupMode; }
138 0 : sal_Bool IsInCleanUp() const { return mbInCleanUp; }
139 0 : sal_Bool IsPopupModeCanceled() const { return mbPopupModeCanceled; }
140 0 : sal_Bool IsPopupModeTearOff() const { return mbPopupModeTearOff; }
141 :
142 0 : void SetPopupModeEndHdl( const Link& rLink ) { maPopupModeEndHdl = rLink; }
143 : const Link& GetPopupModeEndHdl() const { return maPopupModeEndHdl; }
144 :
145 0 : sal_Bool GrabsFocus() const { return mbGrabFocus; }
146 :
147 : static Point CalcFloatingPosition( Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex );
148 : };
149 :
150 : #endif // _SV_FLOATWIN_HXX
151 :
152 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|