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