lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / reportdesign / source / ui / inc / AddField.hxx
blob0b532e51c63b1760fb8a4e159fa8a7a8bdaae3af
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX
21 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX
23 #include <com/sun/star/container/XNameAccess.hpp>
24 #include <com/sun/star/sdbc/XConnection.hpp>
25 #include <vcl/transfer.hxx>
26 #include <vcl/treelistbox.hxx>
27 #include <vcl/floatwin.hxx>
28 #include <comphelper/propmultiplex.hxx>
29 #include <comphelper/containermultiplexer.hxx>
30 #include <vcl/button.hxx>
32 #include <svx/dataaccessdescriptor.hxx>
33 #include <cppuhelper/basemutex.hxx>
34 #include <dbaccess/ToolBoxHelper.hxx>
35 #include <vcl/toolbox.hxx>
36 #include <vcl/fixed.hxx>
38 #include <rtl/ref.hxx>
40 namespace rptui
43 class OAddFieldWindow;
44 class OAddFieldWindowListBox;
46 class OAddFieldWindow :public FloatingWindow
47 , public ::cppu::BaseMutex
48 , public ::comphelper::OPropertyChangeListener
49 , public ::comphelper::OContainerListener
50 , public dbaui::OToolBoxHelper
52 css::uno::Reference< css::lang::XComponent> m_xHoldAlive;
53 css::uno::Reference< css::container::XNameAccess> m_xColumns;
54 css::uno::Reference< css::beans::XPropertySet > m_xRowSet;
56 VclPtr<ToolBox> m_aActions;
58 VclPtr<OAddFieldWindowListBox> m_pListBox;
59 VclPtr<FixedText> m_aHelpText;
61 Link<OAddFieldWindow&,void> m_aCreateLink;
62 OUString m_aCommandName;
63 OUString m_sFilter;
64 sal_uInt16 m_nSortUpId;
65 sal_uInt16 m_nSortDownId;
66 sal_uInt16 m_nRemoveSortId;
67 sal_uInt16 m_nInsertId;
68 sal_Int32 m_nCommandType;
69 bool m_bEscapeProcessing;
70 ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pChangeListener;
71 ::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener;
73 DECL_LINK( OnDoubleClickHdl, SvTreeListBox*, bool );
74 DECL_LINK( OnSelectHdl, SvTreeListBox*, void );
75 DECL_LINK( OnSortAction, ToolBox*, void );
77 OAddFieldWindow(const OAddFieldWindow&) = delete;
78 void operator =(const OAddFieldWindow&) = delete;
79 public:
80 OAddFieldWindow(vcl::Window* pParent
81 , const css::uno::Reference< css::beans::XPropertySet >& _xRowSet);
83 virtual ~OAddFieldWindow() override;
84 virtual void dispose() override;
85 virtual void GetFocus() override;
86 virtual bool PreNotify( NotifyEvent& _rNEvt ) override;
88 const OUString& GetCommand() const { return m_aCommandName; }
89 sal_Int32 GetCommandType() const { return m_nCommandType; }
90 bool GetEscapeProcessing() const { return m_bEscapeProcessing; }
91 void SetCreateHdl(const Link<OAddFieldWindow&,void>& _aCreateLink) { m_aCreateLink = _aCreateLink; }
93 css::uno::Reference< css::sdbc::XConnection> getConnection() const;
95 css::uno::Sequence< css::beans::PropertyValue > getSelectedFieldDescriptors();
97 /** will be called when the id of the image list needs to change.
98 @param _eBitmapSet
99 <svtools/imgdef.hxx>
101 virtual void setImageList(sal_Int16) override
103 //to-do, remove
106 /** will be called when the controls need to be resized.
108 virtual void resizeControls(const Size& _rDiff) override;
110 /// Updates the current field list
111 void Update();
113 /** fills the descriptor with the column name, column object, command and command type
115 * \param _pSelected the currently selected
116 * \param _rDescriptor the descriptor will be filled
118 void fillDescriptor(SvTreeListEntry const * _pSelected,svx::ODataAccessDescriptor& _rDescriptor);
120 private:
121 // FmXChangeListener
122 virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override;
123 // OContainerListener
124 virtual void _elementInserted( const css::container::ContainerEvent& _rEvent ) override;
125 virtual void _elementRemoved( const css::container::ContainerEvent& _rEvent ) override;
126 virtual void _elementReplaced( const css::container::ContainerEvent& _rEvent ) override;
129 } // rptui
131 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */