LibreOffice Module vcl (master) 1
floatwin.hxx
Go to the documentation of this file.
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#pragma once
21
22#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
23#error "don't use this in new code"
24#endif
25
26#include <vcl/dllapi.h>
27#include <vcl/syswin.hxx>
28#include <memory>
30
31class ToolBox;
32
34{
35 NONE = 0x00,
36 Cancel = 0x01,
37 TearOff = 0x02,
38 DontCallHdl = 0x04,
39 CloseAll = 0x08,
40 NoCloseChildren = 0x10,
41};
42namespace o3tl
43{
44 template<> struct typed_flags<FloatWinPopupEndFlags> : is_typed_flags<FloatWinPopupEndFlags, 0x1f> {};
45}
46
48{
49 Unknown = 0,
50 Normal = 1,
51 TearOff = 2,
52 Popup = 3,
53 NONE = 4,
54};
55
57{
58 class SAL_DLLPRIVATE ImplData;
59private:
63 std::unique_ptr<ImplData> mpImplData;
74 bool mbGrabFocus; // act as key input window, although focus is not set
77
78 SAL_DLLPRIVATE void ImplCallPopupModeEnd();
79 DECL_DLLPRIVATE_LINK( ImplEndPopupModeHdl, void*, void );
80
81 FloatingWindow (const FloatingWindow &) = delete;
83
84protected:
85 SAL_DLLPRIVATE void ImplInitFloating( vcl::Window* pParent, WinBits nStyle );
86 SAL_DLLPRIVATE void ImplInitSettings();
87
88 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
89
90public:
91 SAL_DLLPRIVATE FloatingWindow* ImplFloatHitTest( vcl::Window* pReference, const Point& rPos, bool& rbHitTestInsideRect );
92 SAL_DLLPRIVATE FloatingWindow* ImplFindLastLevelFloat();
93 SAL_DLLPRIVATE bool ImplIsFloatPopupModeWindow( const vcl::Window* pWindow );
94 SAL_DLLPRIVATE void ImplSetMouseDown() { mbMouseDown = true; }
95 SAL_DLLPRIVATE bool ImplIsMouseDown() const { return mbMouseDown; }
96 static Point ImplCalcPos(vcl::Window* pWindow,
97 const tools::Rectangle& rRect, FloatWinPopupFlags nFlags,
98 sal_uInt16& rArrangeIndex, Point* pLOKTwipsPos = nullptr);
99 static Point ImplConvertToAbsPos(vcl::Window* pReference, const Point& rPos);
100 static tools::Rectangle ImplConvertToAbsPos(vcl::Window* pReference, const tools::Rectangle& rRect);
101 static tools::Rectangle ImplConvertToRelPos(vcl::Window* pReference, const tools::Rectangle& rRect);
102 SAL_DLLPRIVATE void ImplEndPopupMode( FloatWinPopupEndFlags nFlags, const VclPtr<vcl::Window>& xFocusId );
103 SAL_DLLPRIVATE tools::Rectangle ImplGetItemEdgeClipRect() const;
104 SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
105 virtual void doDeferredInit(WinBits nBits) override;
106 void PixelInvalidate(const tools::Rectangle* pRectangle) override;
107
108public:
109 explicit FloatingWindow(vcl::Window* pParent, WinBits nStyle);
110 explicit FloatingWindow(vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription,
111 const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
112 virtual ~FloatingWindow() override;
113 virtual void dispose() override;
114
115 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
116 virtual void StateChanged( StateChangedType nType ) override;
117 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
118
119 virtual void PopupModeEnd();
120
121 void SetTitleType( FloatWinTitleType nTitle );
122 FloatWinTitleType GetTitleType() const { return mnTitle; }
123
124 void StartPopupMode( const tools::Rectangle& rRect, FloatWinPopupFlags nFlags );
125 void StartPopupMode( ToolBox* pBox, FloatWinPopupFlags nFlags );
126 void EndPopupMode( FloatWinPopupEndFlags nFlags = FloatWinPopupEndFlags::NONE );
127 void AddPopupModeWindow( vcl::Window* pWindow );
128 FloatWinPopupFlags GetPopupModeFlags() const { return mnPopupModeFlags; }
129 void SetPopupModeFlags( FloatWinPopupFlags nFlags ) { mnPopupModeFlags = nFlags; }
130 bool IsInPopupMode() const { return mbPopupMode; }
131 bool IsInCleanUp() const { return mbInCleanUp; }
132 bool IsPopupModeCanceled() const { return mbPopupModeCanceled; }
133 bool IsPopupModeTearOff() const { return mbPopupModeTearOff; }
134
135 void SetPopupModeEndHdl( const Link<FloatingWindow*,void>& rLink ) { maPopupModeEndHdl = rLink; }
136
137 bool GrabsFocus() const { return mbGrabFocus; }
138};
139
140/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool mbGrabFocus
Definition: floatwin.hxx:74
DECL_DLLPRIVATE_LINK(ImplEndPopupModeHdl, void *, void)
bool IsPopupModeTearOff() const
Definition: floatwin.hxx:133
bool mbPopupModeCanceled
Definition: floatwin.hxx:71
bool IsPopupModeCanceled() const
Definition: floatwin.hxx:132
SAL_DLLPRIVATE void ImplSetMouseDown()
Definition: floatwin.hxx:94
bool IsInPopupMode() const
Definition: floatwin.hxx:130
void SetPopupModeEndHdl(const Link< FloatingWindow *, void > &rLink)
Definition: floatwin.hxx:135
bool GrabsFocus() const
Definition: floatwin.hxx:137
bool mbMouseDown
Definition: floatwin.hxx:73
bool mbInPopupMode
Definition: floatwin.hxx:69
ImplSVEvent * mnPostId
Definition: floatwin.hxx:65
FloatWinPopupFlags GetPopupModeFlags() const
Definition: floatwin.hxx:128
FloatingWindow(const FloatingWindow &)=delete
tools::Rectangle maFloatRect
Definition: floatwin.hxx:64
bool mbPopupMode
Definition: floatwin.hxx:70
VclPtr< FloatingWindow > mpNextFloat
Definition: floatwin.hxx:60
Link< FloatingWindow *, void > maPopupModeEndHdl
Definition: floatwin.hxx:76
bool mbPopupModeTearOff
Definition: floatwin.hxx:72
VclPtr< vcl::Window > mpFirstPopupModeWin
Definition: floatwin.hxx:61
FloatWinTitleType mnOldTitle
Definition: floatwin.hxx:68
FloatWinPopupFlags mnPopupModeFlags
Definition: floatwin.hxx:66
SAL_DLLPRIVATE bool ImplIsMouseDown() const
Definition: floatwin.hxx:95
std::unique_ptr< ImplData > mpImplData
Definition: floatwin.hxx:63
FloatWinTitleType mnTitle
Definition: floatwin.hxx:67
SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const
Definition: floatwin.hxx:104
void SetPopupModeFlags(FloatWinPopupFlags nFlags)
Definition: floatwin.hxx:129
bool IsInCleanUp() const
Definition: floatwin.hxx:131
VclPtr< vcl::Window > mxPrevFocusWin
Definition: floatwin.hxx:62
bool mbInCleanUp
Definition: floatwin.hxx:75
FloatWinTitleType GetTitleType() const
Definition: floatwin.hxx:122
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: syswin.cxx:176
virtual void doDeferredInit(WinBits nBits)
Definition: syswin.cxx:1105
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: syswin.cxx:103
A toolbar: contains all those icons, typically below the menu bar.
Definition: toolbox.hxx:74
VclReferenceBase & operator=(const VclReferenceBase &)=delete
virtual void PixelInvalidate(const tools::Rectangle *pRectangle)
Notification about some rectangle of the output device got invalidated.
Definition: paint.cxx:1201
virtual void StateChanged(StateChangedType nStateChange)
Definition: window.cxx:1940
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
virtual void ApplySettings(vcl::RenderContext &rRenderContext)
Definition: window.cxx:3850
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
static Point ImplCalcPos(WinBits nStyle, const Point &rPos, const Size &rObjSize, const Size &rWinSize)
Definition: fixed.cxx:49
FloatWinPopupEndFlags
Definition: floatwin.hxx:34
FloatWinTitleType
Definition: floatwin.hxx:48
NONE
Unknown
FloatWinPopupFlags
Definition: vclenum.hxx:323
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109