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 INCLUDED_VCL_FLOATWIN_HXX
21 : #define INCLUDED_VCL_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 : #define FLOATWIN_POPUPMODE_NOHORZPLACEMENT ((sal_uLong)0x00040000)
52 :
53 : #define FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0001)
54 : #define FLOATWIN_POPUPMODEEND_TEAROFF ((sal_uInt16)0x0002)
55 : #define FLOATWIN_POPUPMODEEND_DONTCALLHDL ((sal_uInt16)0x0004)
56 : #define FLOATWIN_POPUPMODEEND_CLOSEALL ((sal_uInt16)0x0008)
57 :
58 : #define FLOATWIN_TITLE_NORMAL ((sal_uInt16)0x0001)
59 : #define FLOATWIN_TITLE_TEAROFF ((sal_uInt16)0x0002)
60 : #define FLOATWIN_TITLE_POPUP ((sal_uInt16)0x0004)
61 : #define FLOATWIN_TITLE_NONE ((sal_uInt16)0x0008)
62 :
63 :
64 : enum HitTest
65 : {
66 : HITTEST_OUTSIDE,
67 : HITTEST_WINDOW,
68 : HITTEST_RECT
69 : };
70 :
71 : // - FloatingWindow -
72 :
73 : class VCL_DLLPUBLIC FloatingWindow : public SystemWindow
74 : {
75 : class ImplData;
76 : private:
77 : FloatingWindow* mpNextFloat;
78 : vcl::Window* mpFirstPopupModeWin;
79 : ImplData* mpImplData;
80 : Rectangle maFloatRect;
81 : ImplSVEvent * mnPostId;
82 : sal_uLong mnPopupModeFlags;
83 : sal_uInt16 mnTitle;
84 : sal_uInt16 mnOldTitle;
85 : bool mbInPopupMode;
86 : bool mbPopupMode;
87 : bool mbPopupModeCanceled;
88 : bool mbPopupModeTearOff;
89 : bool mbMouseDown;
90 : bool mbOldSaveBackMode;
91 : bool mbGrabFocus; // act as key input window, although focus is not set
92 : bool mbInCleanUp;
93 : Link maPopupModeEndHdl;
94 :
95 : SAL_DLLPRIVATE void ImplCallPopupModeEnd();
96 : DECL_DLLPRIVATE_LINK( ImplEndPopupModeHdl, void* );
97 :
98 : // Copy assignment is forbidden and not implemented.
99 : SAL_DLLPRIVATE FloatingWindow (const FloatingWindow &);
100 : SAL_DLLPRIVATE FloatingWindow & operator= (const FloatingWindow &);
101 :
102 : protected:
103 : using Window::ImplInit;
104 : SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
105 : SAL_DLLPRIVATE void ImplInitSettings();
106 :
107 : public:
108 : SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( vcl::Window* pReference, const Point& rPos, HitTest& rHitTest );
109 : SAL_DLLPRIVATE FloatingWindow* ImplFindLastLevelFloat();
110 : SAL_DLLPRIVATE bool ImplIsFloatPopupModeWindow( const vcl::Window* pWindow );
111 0 : SAL_DLLPRIVATE void ImplSetMouseDown() { mbMouseDown = true; }
112 0 : SAL_DLLPRIVATE bool ImplIsMouseDown() const { return mbMouseDown; }
113 : SAL_DLLPRIVATE static Point ImplCalcPos( vcl::Window* pWindow,
114 : const Rectangle& rRect, sal_uLong nFlags,
115 : sal_uInt16& rArrangeIndex );
116 : SAL_DLLPRIVATE void ImplEndPopupMode( sal_uInt16 nFlags = 0, sal_uLong nFocusId = 0 );
117 : SAL_DLLPRIVATE Rectangle& ImplGetItemEdgeClipRect();
118 0 : SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
119 : virtual void doDeferredInit(WinBits nBits) SAL_OVERRIDE;
120 :
121 : public:
122 : explicit FloatingWindow(vcl::Window* pParent, WinBits nStyle = WB_STDFLOATWIN);
123 : explicit FloatingWindow(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
124 : const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
125 : virtual ~FloatingWindow();
126 :
127 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
128 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
129 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
130 :
131 : virtual void PopupModeEnd();
132 :
133 : void SetTitleType( sal_uInt16 nTitle );
134 282 : sal_uInt16 GetTitleType() const { return mnTitle; }
135 :
136 : void StartPopupMode( const Rectangle& rRect, sal_uLong nFlags = 0 );
137 : void StartPopupMode( ToolBox* pBox, sal_uLong nFlags = 0 );
138 : void EndPopupMode( sal_uInt16 nFlags = 0 );
139 : void AddPopupModeWindow( vcl::Window* pWindow );
140 0 : sal_uLong GetPopupModeFlags() const { return mnPopupModeFlags; }
141 0 : void SetPopupModeFlags( sal_uLong nFlags ) { mnPopupModeFlags = nFlags; }
142 6378 : bool IsInPopupMode() const { return mbPopupMode; }
143 16 : bool IsInCleanUp() const { return mbInCleanUp; }
144 4 : bool IsPopupModeCanceled() const { return mbPopupModeCanceled; }
145 0 : bool IsPopupModeTearOff() const { return mbPopupModeTearOff; }
146 :
147 6274 : void SetPopupModeEndHdl( const Link& rLink ) { maPopupModeEndHdl = rLink; }
148 : const Link& GetPopupModeEndHdl() const { return maPopupModeEndHdl; }
149 :
150 0 : bool GrabsFocus() const { return mbGrabFocus; }
151 :
152 : static Point CalcFloatingPosition( vcl::Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex );
153 : };
154 :
155 : #endif // INCLUDED_VCL_FLOATWIN_HXX
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|