LibreOffice Module reportdesign (master)  1
AddField.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 #ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX
21 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX
22 
23 #include <com/sun/star/lang/XComponent.hpp>
24 #include <com/sun/star/container/XNameAccess.hpp>
25 #include <com/sun/star/sdbc/XConnection.hpp>
28 
30 #include <svx/dbaexchange.hxx>
31 #include <cppuhelper/basemutex.hxx>
32 
33 #include <vcl/weld.hxx>
34 
35 #include <rtl/ref.hxx>
36 
37 #include "ColumnInfo.hxx"
38 
39 namespace rptui
40 {
41 
42 class OAddFieldWindow;
43 
45  , public ::cppu::BaseMutex
48 {
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;
52 
53  std::unique_ptr<weld::Toolbar> m_xActions;
54  std::unique_ptr<weld::TreeView> m_xListBox;
55  std::unique_ptr<weld::Label> m_xHelpText;
56 
58  OUString m_aCommandName;
59  OUString m_sFilter;
60  sal_Int32 m_nCommandType;
65 
66  std::vector<std::unique_ptr<ColumnInfo>> m_aListBoxData;
67 
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::Widget&, void );
73 
74  void addToList(const css::uno::Sequence<OUString>& rEntries);
75  void addToList(const css::uno::Reference<css::container::XNameAccess>& i_xColumns);
76 
77  OAddFieldWindow(const OAddFieldWindow&) = delete;
78  void operator =(const OAddFieldWindow&) = delete;
79 public:
81  const css::uno::Reference< css::beans::XPropertySet >& xRowSet);
82 
83  virtual ~OAddFieldWindow() override;
84 
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; }
88 
89  css::uno::Reference< css::sdbc::XConnection> getConnection() const;
90 
91  css::uno::Sequence< css::beans::PropertyValue > getSelectedFieldDescriptors();
92 
94  void Update();
95 
101  void fillDescriptor(const weld::TreeIter& rSelected, svx::ODataAccessDescriptor& rDescriptor);
102 
103 private:
104  // FmXChangeListener
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;
110 };
111 
112 } // rptui
113 
114 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX
115 
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Link< OAddFieldWindow &, void > m_aCreateLink
Definition: AddField.hxx:57
css::uno::Reference< css::beans::XPropertySet > m_xRowSet
Definition: AddField.hxx:51
virtual void _propertyChanged(const css::beans::PropertyChangeEvent &evt) override
Definition: AddField.cxx:143
void SetCreateHdl(const Link< OAddFieldWindow &, void > &_aCreateLink)
Definition: AddField.hxx:87
::rtl::Reference< comphelper::OContainerListenerAdapter > m_pContainerListener
Definition: AddField.hxx:63
css::uno::Reference< css::sdbc::XConnection > getConnection() const
Definition: AddField.cxx:248
const OUString & GetCommand() const
Definition: AddField.hxx:85
sal_Int32 m_nCommandType
Definition: AddField.hxx:60
sal_Int32 GetCommandType() const
Definition: AddField.hxx:86
void operator=(const OAddFieldWindow &)=delete
css::uno::Reference< css::container::XNameAccess > m_xColumns
Definition: AddField.hxx:50
virtual void _elementInserted(const css::container::ContainerEvent &_rEvent) override
Definition: AddField.cxx:281
std::vector< std::unique_ptr< ColumnInfo > > m_aListBoxData
Definition: AddField.hxx:66
void Update()
Updates the current field list.
Definition: AddField.cxx:177
std::unique_ptr< weld::TreeView > m_xListBox
Definition: AddField.hxx:54
DECL_LINK(OnDoubleClickHdl, weld::TreeView &, bool)
virtual ~OAddFieldWindow() override
Definition: AddField.cxx:111
virtual void _elementRemoved(const css::container::ContainerEvent &_rEvent) override
Definition: AddField.cxx:299
OAddFieldWindow(const OAddFieldWindow &)=delete
::rtl::Reference< svx::OMultiColumnTransferable > m_xHelper
Definition: AddField.hxx:64
css::uno::Reference< css::lang::XComponent > m_xHoldAlive
Definition: AddField.hxx:49
void addToList(const css::uno::Sequence< OUString > &rEntries)
virtual void _elementReplaced(const css::container::ContainerEvent &_rEvent) override
Definition: AddField.cxx:307
void fillDescriptor(const weld::TreeIter &rSelected, svx::ODataAccessDescriptor &rDescriptor)
fills the descriptor with the column name, column object, command and command type ...
Definition: AddField.cxx:253
::rtl::Reference< comphelper::OPropertyChangeMultiplexer > m_pChangeListener
Definition: AddField.hxx:62
css::uno::Sequence< css::beans::PropertyValue > getSelectedFieldDescriptors()
Definition: AddField.cxx:126
std::unique_ptr< weld::Label > m_xHelpText
Definition: AddField.hxx:55
std::unique_ptr< weld::Toolbar > m_xActions
Definition: AddField.hxx:53