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