Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef RPTUI_ADDFIELDWINDOW_HXX
30 : : #define RPTUI_ADDFIELDWINDOW_HXX
31 : :
32 : : #include <com/sun/star/frame/XDispatch.hpp>
33 : : #include <com/sun/star/container/XNameAccess.hpp>
34 : : #include <com/sun/star/sdbc/XConnection.hpp>
35 : : #include <com/sun/star/frame/XDispatch.hpp>
36 : : #include <svtools/transfer.hxx>
37 : : #include <com/sun/star/container/XNameAccess.hpp>
38 : : #include <com/sun/star/sdbc/XConnection.hpp>
39 : : #include <svtools/svtreebx.hxx>
40 : : #include <svtools/transfer.hxx>
41 : : #include <vcl/floatwin.hxx>
42 : : #include <comphelper/propmultiplex.hxx>
43 : : #include <comphelper/containermultiplexer.hxx>
44 : : #include <vcl/button.hxx>
45 : :
46 : : #include <svx/dataaccessdescriptor.hxx>
47 : : #include "cppuhelper/basemutex.hxx"
48 : : #include <dbaccess/ToolBoxHelper.hxx>
49 : : #include <vcl/toolbox.hxx>
50 : : #include <vcl/fixed.hxx>
51 : :
52 : : #include <rtl/ref.hxx>
53 : :
54 : : namespace rptui
55 : : {
56 : : //==================================================================
57 : : class OAddFieldWindow;
58 : : class OAddFieldWindowListBox;
59 : : //========================================================================
60 : : class OAddFieldWindow :public FloatingWindow
61 : : , public ::cppu::BaseMutex
62 : : , public ::comphelper::OPropertyChangeListener
63 : : , public ::comphelper::OContainerListener
64 : : , public dbaui::OToolBoxHelper
65 : : {
66 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> m_xHoldAlive;
67 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns;
68 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xRowSet;
69 : :
70 : : ToolBox m_aActions;
71 : :
72 : : ::std::auto_ptr<OAddFieldWindowListBox> m_pListBox;
73 : : FixedLine m_aFixedLine;
74 : : FixedText m_aHelpText;
75 : :
76 : : PushButton m_aInsertButton;
77 : : Link m_aCreateLink;
78 : : ::rtl::OUString m_aCommandName;
79 : : ::rtl::OUString m_sFilter;
80 : : sal_Int32 m_nCommandType;
81 : : sal_Bool m_bEscapeProcessing;
82 : : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pChangeListener;
83 : : ::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener;
84 : :
85 : : DECL_LINK( OnDoubleClickHdl, void* );
86 : : DECL_LINK( OnSelectHdl, void* );
87 : : DECL_LINK( OnSortAction, ToolBox* );
88 : :
89 : : OAddFieldWindow(const OAddFieldWindow&);
90 : : void operator =(const OAddFieldWindow&);
91 : : public:
92 : : OAddFieldWindow(Window* pParent
93 : : , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xRowSet);
94 : :
95 : : virtual ~OAddFieldWindow();
96 : : virtual void Resize();
97 : : virtual void GetFocus();
98 : : virtual long PreNotify( NotifyEvent& _rNEvt );
99 : :
100 : 0 : inline const ::rtl::OUString& GetCommand() const { return m_aCommandName; }
101 : 0 : inline sal_Int32 GetCommandType() const { return m_nCommandType; }
102 : 0 : inline sal_Bool GetEscapeProcessing() const { return m_bEscapeProcessing; }
103 : 0 : inline void SetCreateHdl(const Link& _aCreateLink) { m_aCreateLink = _aCreateLink; }
104 : :
105 : : inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getColumns() const { return m_xColumns; }
106 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const;
107 : :
108 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors();
109 : :
110 : : /** will be called when the id of the image list is needed.
111 : : @param _eBitmapSet
112 : : <svtools/imgdef.hxx>
113 : : */
114 : : virtual ImageList getImageList(sal_Int16 _eBitmapSet) const;
115 : :
116 : : /** will be called when the controls need to be resized.
117 : : */
118 : : virtual void resizeControls(const Size& _rDiff);
119 : :
120 : : /// Updates the current field list
121 : : void Update();
122 : :
123 : : /** fills the descriptor with the column name, column object, command and command type
124 : : *
125 : : * \param _pSelected the currently selected
126 : : * \param _rDescriptor the descriptor will be filled
127 : : */
128 : : void fillDescriptor(SvLBoxEntry* _pSelected,::svx::ODataAccessDescriptor& _rDescriptor);
129 : :
130 : : private:
131 : : // FmXChangeListener
132 : : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException );
133 : : // OContainerListener
134 : : virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
135 : : virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
136 : : virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
137 : : };
138 : : //==============================================================================
139 : : } // rptui
140 : : //==============================================================================
141 : : #endif // RPTUI_ADDFIELDWINDOW_HXX
142 : :
143 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|