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 INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX
21 : #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_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 : VclPtr<ToolBox> m_aActions;
58 :
59 : VclPtr<OAddFieldWindowListBox> m_pListBox;
60 : VclPtr<FixedLine> m_aFixedLine;
61 : VclPtr<FixedText> m_aHelpText;
62 :
63 : VclPtr<PushButton> m_aInsertButton;
64 : Link<> m_aCreateLink;
65 : OUString m_aCommandName;
66 : OUString m_sFilter;
67 : sal_Int32 m_nCommandType;
68 : 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_TYPED( OnSortAction, ToolBox*, void );
75 :
76 : OAddFieldWindow(const OAddFieldWindow&) SAL_DELETED_FUNCTION;
77 : void operator =(const OAddFieldWindow&) SAL_DELETED_FUNCTION;
78 : public:
79 : OAddFieldWindow(vcl::Window* pParent
80 : , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xRowSet);
81 :
82 : virtual ~OAddFieldWindow();
83 : virtual void dispose() SAL_OVERRIDE;
84 : virtual void Resize() SAL_OVERRIDE;
85 : virtual void GetFocus() SAL_OVERRIDE;
86 : virtual bool PreNotify( NotifyEvent& _rNEvt ) SAL_OVERRIDE;
87 :
88 0 : inline const OUString& GetCommand() const { return m_aCommandName; }
89 0 : inline sal_Int32 GetCommandType() const { return m_nCommandType; }
90 0 : inline bool GetEscapeProcessing() const { return m_bEscapeProcessing; }
91 0 : inline void SetCreateHdl(const Link<>& _aCreateLink) { m_aCreateLink = _aCreateLink; }
92 :
93 : inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getColumns() const { return m_xColumns; }
94 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const;
95 :
96 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors();
97 :
98 : /** will be called when the id of the image list needs to change.
99 : @param _eBitmapSet
100 : <svtools/imgdef.hxx>
101 : */
102 : virtual void setImageList(sal_Int16 _eBitmapSet) SAL_OVERRIDE;
103 :
104 : /** will be called when the controls need to be resized.
105 : */
106 : virtual void resizeControls(const Size& _rDiff) SAL_OVERRIDE;
107 :
108 : /// Updates the current field list
109 : void Update();
110 :
111 : /** fills the descriptor with the column name, column object, command and command type
112 : *
113 : * \param _pSelected the currently selected
114 : * \param _rDescriptor the descriptor will be filled
115 : */
116 : void fillDescriptor(SvTreeListEntry* _pSelected,svx::ODataAccessDescriptor& _rDescriptor);
117 :
118 : private:
119 : // FmXChangeListener
120 : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
121 : // OContainerListener
122 : virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 : virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 : virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 : };
126 :
127 : } // rptui
128 :
129 : #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX
130 :
131 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|