1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/lang/XComponent.hpp>
24 #include <com/sun/star/container/XNameAccess.hpp>
25 #include <com/sun/star/sdbc/XConnection.hpp>
26 #include <vcl/transfer.hxx>
27 #include <vcl/treelistbox.hxx>
28 #include <vcl/floatwin.hxx>
29 #include <comphelper/propmultiplex.hxx>
30 #include <comphelper/containermultiplexer.hxx>
31 #include <vcl/button.hxx>
33 #include <svx/dataaccessdescriptor.hxx>
34 #include <cppuhelper/basemutex.hxx>
35 #include <dbaccess/ToolBoxHelper.hxx>
36 #include <vcl/toolbox.hxx>
37 #include <vcl/fixed.hxx>
39 #include <rtl/ref.hxx>
44 class OAddFieldWindow
;
45 class OAddFieldWindowListBox
;
47 class OAddFieldWindow
:public FloatingWindow
48 , public ::cppu::BaseMutex
49 , public ::comphelper::OPropertyChangeListener
50 , public ::comphelper::OContainerListener
51 , public dbaui::OToolBoxHelper
53 css::uno::Reference
< css::lang::XComponent
> m_xHoldAlive
;
54 css::uno::Reference
< css::container::XNameAccess
> m_xColumns
;
55 css::uno::Reference
< css::beans::XPropertySet
> m_xRowSet
;
57 VclPtr
<ToolBox
> m_aActions
;
59 VclPtr
<OAddFieldWindowListBox
> m_pListBox
;
60 VclPtr
<FixedText
> m_aHelpText
;
62 Link
<OAddFieldWindow
&,void> m_aCreateLink
;
63 OUString m_aCommandName
;
65 sal_uInt16 m_nSortUpId
;
66 sal_uInt16 m_nSortDownId
;
67 sal_uInt16 m_nRemoveSortId
;
68 sal_uInt16 m_nInsertId
;
69 sal_Int32 m_nCommandType
;
70 bool m_bEscapeProcessing
;
71 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> m_pChangeListener
;
72 ::rtl::Reference
< comphelper::OContainerListenerAdapter
> m_pContainerListener
;
74 DECL_LINK( OnDoubleClickHdl
, SvTreeListBox
*, bool );
75 DECL_LINK( OnSelectHdl
, SvTreeListBox
*, void );
76 DECL_LINK( OnSortAction
, ToolBox
*, void );
78 OAddFieldWindow(const OAddFieldWindow
&) = delete;
79 void operator =(const OAddFieldWindow
&) = delete;
81 OAddFieldWindow(vcl::Window
* pParent
82 , const css::uno::Reference
< css::beans::XPropertySet
>& _xRowSet
);
84 virtual ~OAddFieldWindow() override
;
85 virtual void dispose() override
;
86 virtual void GetFocus() override
;
87 virtual bool PreNotify( NotifyEvent
& _rNEvt
) override
;
89 const OUString
& GetCommand() const { return m_aCommandName
; }
90 sal_Int32
GetCommandType() const { return m_nCommandType
; }
91 bool GetEscapeProcessing() const { return m_bEscapeProcessing
; }
92 void SetCreateHdl(const Link
<OAddFieldWindow
&,void>& _aCreateLink
) { m_aCreateLink
= _aCreateLink
; }
94 css::uno::Reference
< css::sdbc::XConnection
> getConnection() const;
96 css::uno::Sequence
< css::beans::PropertyValue
> getSelectedFieldDescriptors();
98 /** will be called when the id of the image list needs to change.
102 virtual void setImageList(sal_Int16
) override
107 /** will be called when the controls need to be resized.
109 virtual void resizeControls(const Size
& _rDiff
) override
;
111 /// Updates the current field list
114 /** fills the descriptor with the column name, column object, command and command type
116 * \param _pSelected the currently selected
117 * \param _rDescriptor the descriptor will be filled
119 void fillDescriptor(SvTreeListEntry
const * _pSelected
,svx::ODataAccessDescriptor
& _rDescriptor
);
123 virtual void _propertyChanged(const css::beans::PropertyChangeEvent
& evt
) override
;
124 // OContainerListener
125 virtual void _elementInserted( const css::container::ContainerEvent
& _rEvent
) override
;
126 virtual void _elementRemoved( const css::container::ContainerEvent
& _rEvent
) override
;
127 virtual void _elementReplaced( const css::container::ContainerEvent
& _rEvent
) override
;
132 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */