Line data Source code
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 RPTUI_ADDFIELDWINDOW_HXX
21 : #define RPTUI_ADDFIELDWINDOW_HXX
22 :
23 : #include <com/sun/star/frame/XDispatch.hpp>
24 : #include <com/sun/star/container/XNameAccess.hpp>
25 : #include <com/sun/star/sdbc/XConnection.hpp>
26 : #include <svtools/transfer.hxx>
27 : #include <svtools/treelistbox.hxx>
28 : #include <vcl/floatwin.hxx>
29 : #include <comphelper/propmultiplex.hxx>
30 : #include <comphelper/containermultiplexer.hxx>
31 : #include <vcl/button.hxx>
32 :
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>
38 :
39 : #include <rtl/ref.hxx>
40 :
41 : namespace rptui
42 : {
43 :
44 : class OAddFieldWindow;
45 : class OAddFieldWindowListBox;
46 :
47 : class OAddFieldWindow :public FloatingWindow
48 : , public ::cppu::BaseMutex
49 : , public ::comphelper::OPropertyChangeListener
50 : , public ::comphelper::OContainerListener
51 : , public dbaui::OToolBoxHelper
52 : {
53 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> m_xHoldAlive;
54 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns;
55 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xRowSet;
56 :
57 : ToolBox m_aActions;
58 :
59 : ::std::auto_ptr<OAddFieldWindowListBox> m_pListBox;
60 : FixedLine m_aFixedLine;
61 : FixedText m_aHelpText;
62 :
63 : PushButton m_aInsertButton;
64 : Link m_aCreateLink;
65 : OUString m_aCommandName;
66 : OUString m_sFilter;
67 : sal_Int32 m_nCommandType;
68 : sal_Bool m_bEscapeProcessing;
69 : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pChangeListener;
70 : ::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener;
71 :
72 : DECL_LINK( OnDoubleClickHdl, void* );
73 : DECL_LINK( OnSelectHdl, void* );
74 : DECL_LINK( OnSortAction, ToolBox* );
75 :
76 : OAddFieldWindow(const OAddFieldWindow&);
77 : void operator =(const OAddFieldWindow&);
78 : public:
79 : OAddFieldWindow(Window* pParent
80 : , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xRowSet);
81 :
82 : virtual ~OAddFieldWindow();
83 : virtual void Resize() SAL_OVERRIDE;
84 : virtual void GetFocus() SAL_OVERRIDE;
85 : virtual bool PreNotify( NotifyEvent& _rNEvt ) SAL_OVERRIDE;
86 :
87 0 : inline const OUString& GetCommand() const { return m_aCommandName; }
88 0 : inline sal_Int32 GetCommandType() const { return m_nCommandType; }
89 0 : inline sal_Bool GetEscapeProcessing() const { return m_bEscapeProcessing; }
90 0 : inline void SetCreateHdl(const Link& _aCreateLink) { m_aCreateLink = _aCreateLink; }
91 :
92 : inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getColumns() const { return m_xColumns; }
93 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const;
94 :
95 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors();
96 :
97 : /** will be called when the id of the image list is needed.
98 : @param _eBitmapSet
99 : <svtools/imgdef.hxx>
100 : */
101 : virtual ImageList getImageList(sal_Int16 _eBitmapSet) const SAL_OVERRIDE;
102 :
103 : /** will be called when the controls need to be resized.
104 : */
105 : virtual void resizeControls(const Size& _rDiff) SAL_OVERRIDE;
106 :
107 : /// Updates the current field list
108 : void Update();
109 :
110 : /** fills the descriptor with the column name, column object, command and command type
111 : *
112 : * \param _pSelected the currently selected
113 : * \param _rDescriptor the descriptor will be filled
114 : */
115 : void fillDescriptor(SvTreeListEntry* _pSelected,::svx::ODataAccessDescriptor& _rDescriptor);
116 :
117 : private:
118 : // FmXChangeListener
119 : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
120 : // OContainerListener
121 : virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 : virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 : virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 : };
125 :
126 : } // rptui
127 :
128 : #endif // RPTUI_ADDFIELDWINDOW_HXX
129 :
130 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|