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