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 INCLUDED_REPORTDESIGN_SOURCE_UI_INC_GROUPSSORTING_HXX
20 : #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_GROUPSSORTING_HXX
21 :
22 : #include <vcl/floatwin.hxx>
23 : #include <vcl/fixed.hxx>
24 : #include <vcl/layout.hxx>
25 : #include <vcl/lstbox.hxx>
26 : #include <vcl/edit.hxx>
27 : #include <vcl/field.hxx>
28 : #include <vcl/button.hxx>
29 : #include <vcl/toolbox.hxx>
30 : #include <com/sun/star/report/XGroups.hpp>
31 : #include <com/sun/star/report/XGroup.hpp>
32 : #include <com/sun/star/container/XNameAccess.hpp>
33 : #include "GroupProperties.hxx"
34 : #include <comphelper/propmultiplex.hxx>
35 : #include <cppuhelper/basemutex.hxx>
36 : #include <svtools/svmedit.hxx>
37 : #include <rtl/ref.hxx>
38 :
39 : #include <vector>
40 :
41 : #include <dbaccess/ToolBoxHelper.hxx>
42 :
43 : #include <vcl/ImageListProvider.hxx>
44 :
45 : namespace comphelper
46 : {
47 : class OPropertyChangeMultiplexer;
48 : }
49 : namespace rptui
50 : {
51 : class OFieldExpressionControl;
52 : class OReportController;
53 : /*************************************************************************
54 : |*
55 : |* Groups and Sorting dialog
56 : |*
57 : \************************************************************************/
58 :
59 : class OGroupsSortingDialog : public FloatingWindow
60 : , public ::cppu::BaseMutex
61 : , public ::comphelper::OPropertyChangeListener
62 : {
63 : friend class OFieldExpressionControl;
64 :
65 : ToolBox* m_pToolBox;
66 : sal_uInt16 m_nMoveUpId;
67 : sal_uInt16 m_nMoveDownId;
68 : sal_uInt16 m_nDeleteId;
69 :
70 : VclContainer* m_pProperties;
71 : ListBox* m_pOrderLst;
72 : ListBox* m_pHeaderLst;
73 : ListBox* m_pFooterLst;
74 : ListBox* m_pGroupOnLst;
75 : NumericField* m_pGroupIntervalEd;
76 : ListBox* m_pKeepTogetherLst;
77 : FixedText* m_pHelpWindow;
78 :
79 : OFieldExpressionControl* m_pFieldExpression;
80 : ::rptui::OReportController* m_pController;
81 : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pCurrentGroupListener;
82 : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
83 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups> m_xGroups;
84 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns;
85 : bool m_bReadOnly;
86 : private:
87 : DECL_LINK( OnControlFocusLost, Control* );
88 : DECL_LINK( OnControlFocusGot, Control* );
89 : DECL_LINK( LBChangeHdl, ListBox* );
90 : DECL_LINK( OnFormatAction, ToolBox* );
91 :
92 : /** returns the groups
93 : @return the groups which now have to check which one changes
94 : */
95 0 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups>& getGroups() { return m_xGroups; }
96 :
97 0 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup> getGroup(sal_Int32 _nPos)
98 : {
99 : OSL_ENSURE(_nPos >= 0 && _nPos < m_xGroups->getCount(),"Invalid count!");
100 0 : return ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>(m_xGroups->getByIndex(_nPos),::com::sun::star::uno::UNO_QUERY);
101 : }
102 :
103 : /** updates the listboxes with the new group properties
104 : @param _nRow the new group pos
105 : */
106 : void DisplayData( sal_Int32 _nRow );
107 :
108 : /** saves the values from the listboxes into the group at position _nRow
109 : @param _nRow the group pos to store in
110 : */
111 : void SaveData( sal_Int32 _nRow );
112 :
113 : /** returns <TRUE/> when the dialog should be read only
114 : */
115 0 : bool isReadOnly( ) const { return m_bReadOnly;}
116 :
117 : /** returns the data type for the given column name
118 : @param _sColumnName
119 : */
120 : sal_Int32 getColumnDataType(const OUString& _sColumnName);
121 :
122 : /** shows the text given by the id in the multiline edit
123 : @param _nResId the string id
124 : */
125 : void showHelpText(sal_uInt16 _nResId);
126 : /** display the group props
127 : @param _xGroup the group to display
128 : */
129 : void displayGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup);
130 :
131 : /** enables or diables the up and down button
132 : @param _nRow the row which will be active
133 : */
134 : void checkButtons(sal_Int32 _nRow);
135 :
136 : /** clears the m_xColumns member and reset the fields
137 : *
138 : */
139 : void fillColumns();
140 : OGroupsSortingDialog(OGroupsSortingDialog&);
141 : void operator =(OGroupsSortingDialog&);
142 : protected:
143 : // OPropertyChangeListener
144 : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
145 : public:
146 : OGroupsSortingDialog( vcl::Window* pParent
147 : ,bool _bReadOnly
148 : ,::rptui::OReportController* _pController);
149 : virtual ~OGroupsSortingDialog();
150 :
151 : /** sets the newe columns at the groups dialog.
152 : @param _xColumns the new columns
153 : */
154 : void setColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xColumns);
155 :
156 : /* updates the current view
157 : */
158 : void UpdateData( );
159 : };
160 :
161 : } // namespace rptui
162 :
163 : #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_GROUPSSORTING_HXX
164 :
165 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|