sync master with lastest vba changes
[ooovba.git] / reportdesign / source / ui / inc / GroupsSorting.hxx
blob5d2d055d88989871b7902ad46271b94431891761
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 <com/sun/star/report/XGroups.hpp>
42 #include <com/sun/star/report/XGroup.hpp>
43 #include <com/sun/star/container/XNameAccess.hpp>
44 #include "GroupProperties.hxx"
45 #include <comphelper/propmultiplex.hxx>
46 #include "cppuhelper/basemutex.hxx"
47 #include <svtools/svmedit.hxx>
48 #include <rtl/ref.hxx>
50 #include <vector>
52 namespace comphelper
54 class OPropertyChangeMultiplexer;
56 namespace rptui
58 class OFieldExpressionControl;
59 class OReportController;
60 /*************************************************************************
62 |* Groups and Sorting dialog
64 \************************************************************************/
65 class OGroupsSortingDialog : public FloatingWindow
66 , public ::cppu::BaseMutex
67 , public ::comphelper::OPropertyChangeListener
69 friend class OFieldExpressionControl;
71 FixedLine m_aFL2;
72 FixedText m_aMove;
73 ImageButton m_aUp;
74 ImageButton m_aDown;
75 FixedLine m_aFL3;
76 FixedText m_aOrder;
77 ListBox m_aOrderLst;
78 FixedText m_aHeader;
79 ListBox m_aHeaderLst;
80 FixedText m_aFooter;
81 ListBox m_aFooterLst;
82 FixedText m_aGroupOn;
83 ListBox m_aGroupOnLst;
84 FixedText m_aGroupInterval;
85 NumericField m_aGroupIntervalEd;
86 FixedText m_aKeepTogether;
87 ListBox m_aKeepTogetherLst;
88 FixedLine m_aFL;
89 FixedText m_aHelpWindow;
91 OFieldExpressionControl* m_pFieldExpression;
92 ::rptui::OReportController* m_pController;
93 ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pCurrentGroupListener;
94 ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
95 ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups> m_xGroups;
96 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns;
97 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xHoldAlive;
98 sal_Bool m_bReadOnly;
99 private:
100 DECL_LINK( OnControlFocusLost, Control* );
101 DECL_LINK( OnControlFocusGot, Control* );
102 DECL_LINK( LBChangeHdl, ListBox* );
103 DECL_LINK( ClickHdl, ImageButton* );
105 /** returns the groups
106 @return the groups which now have to check which one changes
108 ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups>& getGroups() { return m_xGroups; }
110 ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup> getGroup(sal_Int32 _nPos)
112 OSL_ENSURE(_nPos >= 0 && _nPos < m_xGroups->getCount(),"Invalid count!");
113 return ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>(m_xGroups->getByIndex(_nPos),::com::sun::star::uno::UNO_QUERY);
116 /** updates the listboxes with the new group properties
117 @param _nRow the new group pos
119 void DisplayData( sal_Int32 _nRow );
121 /** saves the values from the listboxes into the group at position _nRow
122 @param _nRow the group pos to store in
124 void SaveData( sal_Int32 _nRow );
126 /** returns <TRUE/> when the dialog should be read only
128 sal_Bool isReadOnly( ) const;
130 /** returns the data type for the given column name
131 @param _sColumnName
133 sal_Int32 getColumnDataType(const ::rtl::OUString& _sColumnName);
135 /** shows the text given by the id in the multiline edit
136 @param _nResId the string id
138 void showHelpText(USHORT _nResId);
139 /** display the group props
140 @param _xGroup the group to display
142 void displayGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup);
144 /** enables or diables the up and down button
145 @param _nRow the row which will be active
147 void checkButtons(sal_Int32 _nRow);
149 /** clears the m_xColumns member and reset the fields
152 void fillColumns();
153 OGroupsSortingDialog(OGroupsSortingDialog&);
154 void operator =(OGroupsSortingDialog&);
155 protected:
156 // window
157 virtual void Resize();
158 // OPropertyChangeListener
159 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
160 public:
161 OGroupsSortingDialog( Window* pParent
162 ,sal_Bool _bReadOnly
163 ,::rptui::OReportController* _pController);
164 virtual ~OGroupsSortingDialog();
166 /** sets the newe columns at the groups dialog.
167 @param _xColumns the new columns
169 void setColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xColumns);
171 /* updates the current view
173 void UpdateData( );
175 // =============================================================================
176 } // namespace rptui
177 // =============================================================================
178 #endif // RPTUI_GROUPS_SORTING_HXX