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