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 : : #ifndef RPTUI_GROUPS_SORTING_HXX
29 : : #define RPTUI_GROUPS_SORTING_HXX
30 : :
31 : : #include <vcl/floatwin.hxx>
32 : : #include <vcl/fixed.hxx>
33 : : #include <vcl/lstbox.hxx>
34 : : #include <vcl/edit.hxx>
35 : : #include <vcl/field.hxx>
36 : : #include <vcl/button.hxx>
37 : : #include <vcl/toolbox.hxx>
38 : : #include <com/sun/star/report/XGroups.hpp>
39 : : #include <com/sun/star/report/XGroup.hpp>
40 : : #include <com/sun/star/container/XNameAccess.hpp>
41 : : #include "GroupProperties.hxx"
42 : : #include <comphelper/propmultiplex.hxx>
43 : : #include "cppuhelper/basemutex.hxx"
44 : : #include <svtools/svmedit.hxx>
45 : : #include <rtl/ref.hxx>
46 : :
47 : : #include <vector>
48 : :
49 : : #include <dbaccess/ToolBoxHelper.hxx>
50 : :
51 : : #include <vcl/ImageListProvider.hxx>
52 : :
53 : : namespace comphelper
54 : : {
55 : : class OPropertyChangeMultiplexer;
56 : : }
57 : : namespace rptui
58 : : {
59 : : class OFieldExpressionControl;
60 : : class OReportController;
61 : : /*************************************************************************
62 : : |*
63 : : |* Groups and Sorting dialog
64 : : |*
65 : : \************************************************************************/
66 : :
67 : : class OGroupsSortingDialog : public FloatingWindow
68 : : , public ::cppu::BaseMutex
69 : : , public ::comphelper::OPropertyChangeListener
70 : : , public dbaui::OToolBoxHelper
71 : : , public vcl::IImageListProvider
72 : : {
73 : : friend class OFieldExpressionControl;
74 : :
75 : : FixedLine m_aFL2;
76 : : FixedText m_aMove;
77 : : ToolBox m_aToolBox;
78 : :
79 : : FixedLine m_aFL3;
80 : : FixedText m_aOrder;
81 : : ListBox m_aOrderLst;
82 : : FixedText m_aHeader;
83 : : ListBox m_aHeaderLst;
84 : : FixedText m_aFooter;
85 : : ListBox m_aFooterLst;
86 : : FixedText m_aGroupOn;
87 : : ListBox m_aGroupOnLst;
88 : : FixedText m_aGroupInterval;
89 : : NumericField m_aGroupIntervalEd;
90 : : FixedText m_aKeepTogether;
91 : : ListBox m_aKeepTogetherLst;
92 : : FixedLine m_aFL;
93 : : FixedText m_aHelpWindow;
94 : :
95 : : OFieldExpressionControl* m_pFieldExpression;
96 : : ::rptui::OReportController* m_pController;
97 : : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pCurrentGroupListener;
98 : : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
99 : : ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups> m_xGroups;
100 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns;
101 : : sal_Bool m_bReadOnly;
102 : : private:
103 : : DECL_LINK( OnControlFocusLost, Control* );
104 : : DECL_LINK( OnControlFocusGot, Control* );
105 : : DECL_LINK( LBChangeHdl, ListBox* );
106 : : DECL_LINK( OnFormatAction, ToolBox* );
107 : :
108 : : /** returns the groups
109 : : @return the groups which now have to check which one changes
110 : : */
111 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups>& getGroups() { return m_xGroups; }
112 : :
113 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup> getGroup(sal_Int32 _nPos)
114 : : {
115 : : OSL_ENSURE(_nPos >= 0 && _nPos < m_xGroups->getCount(),"Invalid count!");
116 : 0 : return ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>(m_xGroups->getByIndex(_nPos),::com::sun::star::uno::UNO_QUERY);
117 : : }
118 : :
119 : : /** updates the listboxes with the new group properties
120 : : @param _nRow the new group pos
121 : : */
122 : : void DisplayData( sal_Int32 _nRow );
123 : :
124 : : /** saves the values from the listboxes into the group at position _nRow
125 : : @param _nRow the group pos to store in
126 : : */
127 : : void SaveData( sal_Int32 _nRow );
128 : :
129 : : /** returns <TRUE/> when the dialog should be read only
130 : : */
131 : : sal_Bool isReadOnly( ) const;
132 : :
133 : : /** returns the data type for the given column name
134 : : @param _sColumnName
135 : : */
136 : : sal_Int32 getColumnDataType(const ::rtl::OUString& _sColumnName);
137 : :
138 : : /** shows the text given by the id in the multiline edit
139 : : @param _nResId the string id
140 : : */
141 : : void showHelpText(sal_uInt16 _nResId);
142 : : /** display the group props
143 : : @param _xGroup the group to display
144 : : */
145 : : void displayGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup);
146 : :
147 : : /** enables or diables the up and down button
148 : : @param _nRow the row which will be active
149 : : */
150 : : void checkButtons(sal_Int32 _nRow);
151 : :
152 : : /** clears the m_xColumns member and reset the fields
153 : : *
154 : : */
155 : : void fillColumns();
156 : : OGroupsSortingDialog(OGroupsSortingDialog&);
157 : : void operator =(OGroupsSortingDialog&);
158 : : protected:
159 : : // window
160 : : virtual void Resize();
161 : : // OPropertyChangeListener
162 : : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
163 : : public:
164 : : OGroupsSortingDialog( Window* pParent
165 : : ,sal_Bool _bReadOnly
166 : : ,::rptui::OReportController* _pController);
167 : : virtual ~OGroupsSortingDialog();
168 : :
169 : : /** sets the newe columns at the groups dialog.
170 : : @param _xColumns the new columns
171 : : */
172 : : void setColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xColumns);
173 : :
174 : : /* updates the current view
175 : : */
176 : : void UpdateData( );
177 : :
178 : : /** will be called when the controls need to be resized.
179 : : @param _rDiff
180 : : Contains the difference of the old and new toolbox size.
181 : : */
182 : : virtual void resizeControls(const Size& _rDiff);
183 : :
184 : : /** will be called when the image list is needed.
185 : : @param _eSymbolsSize
186 : : <svtools/imgdef.hxx>
187 : : */
188 : : virtual ImageList getImageList(sal_Int16 _eSymbolsSize) const;
189 : :
190 : : // ImageListProvider interface
191 : : virtual ImageList getImageList(vcl::ImageListType) SAL_THROW ((com::sun::star::lang::IllegalArgumentException ));
192 : :
193 : : };
194 : : // =============================================================================
195 : : } // namespace rptui
196 : : // =============================================================================
197 : : #endif // RPTUI_GROUPS_SORTING_HXX
198 : :
199 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|