Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef RPTUI_GROUPS_SORTING_HXX
20 : #define RPTUI_GROUPS_SORTING_HXX
21 :
22 : #include <vcl/floatwin.hxx>
23 : #include <vcl/fixed.hxx>
24 : #include <vcl/lstbox.hxx>
25 : #include <vcl/edit.hxx>
26 : #include <vcl/field.hxx>
27 : #include <vcl/button.hxx>
28 : #include <vcl/toolbox.hxx>
29 : #include <com/sun/star/report/XGroups.hpp>
30 : #include <com/sun/star/report/XGroup.hpp>
31 : #include <com/sun/star/container/XNameAccess.hpp>
32 : #include "GroupProperties.hxx"
33 : #include <comphelper/propmultiplex.hxx>
34 : #include "cppuhelper/basemutex.hxx"
35 : #include <svtools/svmedit.hxx>
36 : #include <rtl/ref.hxx>
37 :
38 : #include <vector>
39 :
40 : #include <dbaccess/ToolBoxHelper.hxx>
41 :
42 : #include <vcl/ImageListProvider.hxx>
43 :
44 : namespace comphelper
45 : {
46 : class OPropertyChangeMultiplexer;
47 : }
48 : namespace rptui
49 : {
50 : class OFieldExpressionControl;
51 : class OReportController;
52 : /*************************************************************************
53 : |*
54 : |* Groups and Sorting dialog
55 : |*
56 : \************************************************************************/
57 :
58 : class OGroupsSortingDialog : public FloatingWindow
59 : , public ::cppu::BaseMutex
60 : , public ::comphelper::OPropertyChangeListener
61 : , public dbaui::OToolBoxHelper
62 : , public vcl::IImageListProvider
63 : {
64 : friend class OFieldExpressionControl;
65 :
66 : FixedLine m_aFL2;
67 : FixedText m_aMove;
68 : ToolBox m_aToolBox;
69 :
70 : FixedLine m_aFL3;
71 : FixedText m_aOrder;
72 : ListBox m_aOrderLst;
73 : FixedText m_aHeader;
74 : ListBox m_aHeaderLst;
75 : FixedText m_aFooter;
76 : ListBox m_aFooterLst;
77 : FixedText m_aGroupOn;
78 : ListBox m_aGroupOnLst;
79 : FixedText m_aGroupInterval;
80 : NumericField m_aGroupIntervalEd;
81 : FixedText m_aKeepTogether;
82 : ListBox m_aKeepTogetherLst;
83 : FixedLine m_aFL;
84 : FixedText m_aHelpWindow;
85 :
86 : OFieldExpressionControl* m_pFieldExpression;
87 : ::rptui::OReportController* m_pController;
88 : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pCurrentGroupListener;
89 : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
90 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups> m_xGroups;
91 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns;
92 : sal_Bool m_bReadOnly;
93 : private:
94 : DECL_LINK( OnControlFocusLost, Control* );
95 : DECL_LINK( OnControlFocusGot, Control* );
96 : DECL_LINK( LBChangeHdl, ListBox* );
97 : DECL_LINK( OnFormatAction, ToolBox* );
98 :
99 : /** returns the groups
100 : @return the groups which now have to check which one changes
101 : */
102 0 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups>& getGroups() { return m_xGroups; }
103 :
104 0 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup> getGroup(sal_Int32 _nPos)
105 : {
106 : OSL_ENSURE(_nPos >= 0 && _nPos < m_xGroups->getCount(),"Invalid count!");
107 0 : return ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>(m_xGroups->getByIndex(_nPos),::com::sun::star::uno::UNO_QUERY);
108 : }
109 :
110 : /** updates the listboxes with the new group properties
111 : @param _nRow the new group pos
112 : */
113 : void DisplayData( sal_Int32 _nRow );
114 :
115 : /** saves the values from the listboxes into the group at position _nRow
116 : @param _nRow the group pos to store in
117 : */
118 : void SaveData( sal_Int32 _nRow );
119 :
120 : /** returns <TRUE/> when the dialog should be read only
121 : */
122 : sal_Bool isReadOnly( ) const;
123 :
124 : /** returns the data type for the given column name
125 : @param _sColumnName
126 : */
127 : sal_Int32 getColumnDataType(const OUString& _sColumnName);
128 :
129 : /** shows the text given by the id in the multiline edit
130 : @param _nResId the string id
131 : */
132 : void showHelpText(sal_uInt16 _nResId);
133 : /** display the group props
134 : @param _xGroup the group to display
135 : */
136 : void displayGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup);
137 :
138 : /** enables or diables the up and down button
139 : @param _nRow the row which will be active
140 : */
141 : void checkButtons(sal_Int32 _nRow);
142 :
143 : /** clears the m_xColumns member and reset the fields
144 : *
145 : */
146 : void fillColumns();
147 : OGroupsSortingDialog(OGroupsSortingDialog&);
148 : void operator =(OGroupsSortingDialog&);
149 : protected:
150 : // window
151 : virtual void Resize() SAL_OVERRIDE;
152 : // OPropertyChangeListener
153 : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
154 : public:
155 : OGroupsSortingDialog( Window* pParent
156 : ,sal_Bool _bReadOnly
157 : ,::rptui::OReportController* _pController);
158 : virtual ~OGroupsSortingDialog();
159 :
160 : /** sets the newe columns at the groups dialog.
161 : @param _xColumns the new columns
162 : */
163 : void setColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xColumns);
164 :
165 : /* updates the current view
166 : */
167 : void UpdateData( );
168 :
169 : /** will be called when the controls need to be resized.
170 : @param _rDiff
171 : Contains the difference of the old and new toolbox size.
172 : */
173 : virtual void resizeControls(const Size& _rDiff) SAL_OVERRIDE;
174 :
175 : /** will be called when the image list is needed.
176 : @param _eSymbolsSize
177 : <svtools/imgdef.hxx>
178 : */
179 : virtual ImageList getImageList(sal_Int16 _eSymbolsSize) const SAL_OVERRIDE;
180 :
181 : // ImageListProvider interface
182 : virtual ImageList getImageList(vcl::ImageListType) SAL_THROW ((com::sun::star::lang::IllegalArgumentException )) SAL_OVERRIDE;
183 :
184 : };
185 :
186 : } // namespace rptui
187 :
188 : #endif // RPTUI_GROUPS_SORTING_HXX
189 :
190 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|