xref: /AOO41X/main/reportdesign/source/ui/inc/GroupsSorting.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef RPTUI_GROUPS_SORTING_HXX
28 #define RPTUI_GROUPS_SORTING_HXX
29 
30 #include <vcl/floatwin.hxx>
31 #ifndef _FIXED_HXX //autogen
32 #include <vcl/fixed.hxx>
33 #endif
34 #include <vcl/lstbox.hxx>
35 #include <vcl/edit.hxx>
36 #include <vcl/field.hxx>
37 #include <vcl/button.hxx>
38 #include <vcl/toolbox.hxx>
39 #include <com/sun/star/report/XGroups.hpp>
40 #include <com/sun/star/report/XGroup.hpp>
41 #include <com/sun/star/container/XNameAccess.hpp>
42 #include "GroupProperties.hxx"
43 #include <comphelper/propmultiplex.hxx>
44 #include "cppuhelper/basemutex.hxx"
45 #include <svtools/svmedit.hxx>
46 #include <rtl/ref.hxx>
47 
48 #include <vector>
49 
50 #include <dbaccess/ToolBoxHelper.hxx>
51 
52 #include <vcl/ImageListProvider.hxx>
53 
54 namespace comphelper
55 {
56 	class OPropertyChangeMultiplexer;
57 }
58 namespace rptui
59 {
60 class OFieldExpressionControl;
61 class OReportController;
62 /*************************************************************************
63 |*
64 |* Groups and Sorting dialog
65 |*
66 \************************************************************************/
67 
68 class OGroupsSortingDialog :	public FloatingWindow
69 							,	public ::cppu::BaseMutex
70                                 ,	public ::comphelper::OPropertyChangeListener
71                            ,public dbaui::OToolBoxHelper
72                            ,public vcl::IImageListProvider
73 {
74 	friend class OFieldExpressionControl;
75 
76 	FixedLine								m_aFL2;
77 	FixedText								m_aMove;
78 //BTN 	ImageButton								m_aPB_Up;
79 //BTN 	ImageButton								m_aPB_Down;
80 //BTN 	ImageButton								m_aPB_Delete;
81     ToolBox                                 m_aToolBox;
82 
83 	FixedLine								m_aFL3;
84 	FixedText								m_aOrder;
85 	ListBox									m_aOrderLst;
86 	FixedText								m_aHeader;
87 	ListBox									m_aHeaderLst;
88 	FixedText								m_aFooter;
89 	ListBox									m_aFooterLst;
90 	FixedText								m_aGroupOn;
91 	ListBox									m_aGroupOnLst;
92 	FixedText								m_aGroupInterval;
93 	NumericField							m_aGroupIntervalEd;
94 	FixedText								m_aKeepTogether;
95 	ListBox									m_aKeepTogetherLst;
96 	FixedLine								m_aFL;
97 	FixedText								m_aHelpWindow;
98 
99 	OFieldExpressionControl*				m_pFieldExpression;
100 	::rptui::OReportController*				m_pController;
101 	::rtl::Reference< comphelper::OPropertyChangeMultiplexer>	                    m_pCurrentGroupListener;
102     ::rtl::Reference< comphelper::OPropertyChangeMultiplexer>                   	m_pReportListener;
103 	::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups>			m_xGroups;
104 	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >	m_xColumns;
105 	sal_Bool								m_bReadOnly;
106 private:
107 	DECL_LINK( OnControlFocusLost, Control* );
108 	DECL_LINK( OnControlFocusGot, Control* );
109 	DECL_LINK( LBChangeHdl, ListBox* );
110 //BTN	DECL_LINK( ClickHdl, ImageButton* );
111     DECL_LINK( OnFormatAction,      ToolBox* );
112 
113 	/** returns the groups
114 		@return the groups which now have to check which one changes
115 	*/
116 	::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups>& getGroups() { return m_xGroups; }
117 
118 	::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup> getGroup(sal_Int32 _nPos)
119 	{
120 		OSL_ENSURE(_nPos >= 0 && _nPos < m_xGroups->getCount(),"Invalid count!");
121 		return ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>(m_xGroups->getByIndex(_nPos),::com::sun::star::uno::UNO_QUERY);
122 	}
123 
124 	/** updates the listboxes with the new group properties
125 		@param	_nRow	the new group pos
126 	*/
127 	void DisplayData( sal_Int32 _nRow );
128 
129 	/** saves the values from the listboxes into the group at position _nRow
130 		@param	_nRow	the group pos to store in
131 	*/
132 	void SaveData( sal_Int32 _nRow );
133 
134 	/** returns <TRUE/> when the dialog should be read only
135 	*/
136 	sal_Bool isReadOnly( ) const;
137 
138 	/** returns the data type for the given column name
139 		@param _sColumnName
140 	*/
141 	sal_Int32 getColumnDataType(const ::rtl::OUString& _sColumnName);
142 
143 	/** shows the text given by the id in the multiline edit
144 		@param	_nResId	the string id
145 	*/
146 	void showHelpText(sal_uInt16 _nResId);
147 	/** display the group props
148 		@param	_xGroup the group to display
149 	*/
150 	void displayGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup);
151 
152 	/** enables or diables the up and down button
153 		@param	_nRow	the row which will be active
154 	*/
155 	void checkButtons(sal_Int32 _nRow);
156 
157     /** clears the m_xColumns member and reset the fields
158     *
159     */
160     void fillColumns();
161     OGroupsSortingDialog(OGroupsSortingDialog&);
162     void operator =(OGroupsSortingDialog&);
163 protected:
164     // window
165 	virtual void	Resize();
166 	// OPropertyChangeListener
167 	virtual void	_propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
168 public:
169 	OGroupsSortingDialog( Window* pParent
170 						,sal_Bool _bReadOnly
171 						,::rptui::OReportController* _pController);
172 	virtual ~OGroupsSortingDialog();
173 
174 	/** sets the newe columns at the groups dialog.
175 		@param	_xColumns the new columns
176 	*/
177 	void setColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xColumns);
178 
179 	/* updates the current view
180 	*/
181 	void UpdateData( );
182 
183 		/** will be called when the controls need to be resized.
184 			@param	_rDiff
185 				Contains the difference of the old and new toolbox size.
186 		*/
187 		virtual void resizeControls(const Size& _rDiff);
188 
189 		/** will be called when the image list is needed.
190 			@param	_eSymbolsSize
191 				<svtools/imgdef.hxx>
192 			@param	_bHiContast
193 				<TRUE/> when in high contrast mode.
194 		*/
195     virtual ImageList getImageList(sal_Int16 _eSymbolsSize,sal_Bool _bHiContast) const;
196 
197     // ImageListProvider interface
198     virtual ImageList getImageList(vcl::ImageListType) SAL_THROW ((com::sun::star::lang::IllegalArgumentException ));
199 
200 };
201 // =============================================================================
202 } // namespace rptui
203 // =============================================================================
204 #endif // RPTUI_GROUPS_SORTING_HXX
205