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 <comphelper/propmultiplex.hxx>
27 #include <comphelper/containermultiplexer.hxx>
29 #include <svx/dataaccessdescriptor.hxx>
30 #include <svx/dbaexchange.hxx>
31 #include <cppuhelper/basemutex.hxx>
33 #include <vcl/weld.hxx>
35 #include <rtl/ref.hxx>
37 #include "ColumnInfo.hxx"
42 class OAddFieldWindow
;
44 class OAddFieldWindow
: public weld::GenericDialogController
45 , public ::cppu::BaseMutex
46 , public ::comphelper::OPropertyChangeListener
47 , public ::comphelper::OContainerListener
49 css::uno::Reference
< css::lang::XComponent
> m_xHoldAlive
;
50 css::uno::Reference
< css::container::XNameAccess
> m_xColumns
;
51 css::uno::Reference
< css::beans::XPropertySet
> m_xRowSet
;
53 std::unique_ptr
<weld::Toolbar
> m_xActions
;
54 std::unique_ptr
<weld::TreeView
> m_xListBox
;
55 std::unique_ptr
<weld::Label
> m_xHelpText
;
57 Link
<OAddFieldWindow
&,void> m_aCreateLink
;
58 OUString m_aCommandName
;
60 sal_Int32 m_nCommandType
;
61 bool m_bEscapeProcessing
;
62 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> m_pChangeListener
;
63 ::rtl::Reference
< comphelper::OContainerListenerAdapter
> m_pContainerListener
;
64 ::rtl::Reference
< svx::OMultiColumnTransferable
> m_xHelper
;
66 std::vector
<std::unique_ptr
<ColumnInfo
>> m_aListBoxData
;
68 DECL_LINK( OnDoubleClickHdl
, weld::TreeView
&, bool );
69 DECL_LINK( OnSelectHdl
, weld::TreeView
&, void );
70 DECL_LINK( DragBeginHdl
, bool&, bool );
71 DECL_LINK( OnSortAction
, const OString
&, void );
72 DECL_LINK( FocusChangeHdl
, weld::Container
&, void );
74 void addToList(const css::uno::Sequence
<OUString
>& rEntries
);
75 void addToList(const css::uno::Reference
<css::container::XNameAccess
>& i_xColumns
);
77 OAddFieldWindow(const OAddFieldWindow
&) = delete;
78 void operator =(const OAddFieldWindow
&) = delete;
80 OAddFieldWindow(weld::Window
* pParent
,
81 const css::uno::Reference
< css::beans::XPropertySet
>& xRowSet
);
83 virtual ~OAddFieldWindow() override
;
85 const OUString
& GetCommand() const { return m_aCommandName
; }
86 sal_Int32
GetCommandType() const { return m_nCommandType
; }
87 void SetCreateHdl(const Link
<OAddFieldWindow
&,void>& _aCreateLink
) { m_aCreateLink
= _aCreateLink
; }
89 css::uno::Reference
< css::sdbc::XConnection
> getConnection() const;
91 css::uno::Sequence
< css::beans::PropertyValue
> getSelectedFieldDescriptors();
93 /// Updates the current field list
96 /** fills the descriptor with the column name, column object, command and command type
98 * \param rSelected the currently selected
99 * \param rDescriptor the descriptor will be filled
101 void fillDescriptor(const weld::TreeIter
& rSelected
, svx::ODataAccessDescriptor
& rDescriptor
);
105 virtual void _propertyChanged(const css::beans::PropertyChangeEvent
& evt
) override
;
106 // OContainerListener
107 virtual void _elementInserted( const css::container::ContainerEvent
& _rEvent
) override
;
108 virtual void _elementRemoved( const css::container::ContainerEvent
& _rEvent
) override
;
109 virtual void _elementReplaced( const css::container::ContainerEvent
& _rEvent
) override
;
114 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */