1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef RPTUI_GROUPS_SORTING_HXX
20 #define RPTUI_GROUPS_SORTING_HXX
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>
40 #include <dbaccess/ToolBoxHelper.hxx>
42 #include <vcl/ImageListProvider.hxx>
46 class OPropertyChangeMultiplexer
;
50 class OFieldExpressionControl
;
51 class OReportController
;
52 /*************************************************************************
54 |* Groups and Sorting dialog
56 \************************************************************************/
58 class OGroupsSortingDialog
: public FloatingWindow
59 , public ::cppu::BaseMutex
60 , public ::comphelper::OPropertyChangeListener
61 , public dbaui::OToolBoxHelper
62 , public vcl::IImageListProvider
64 friend class OFieldExpressionControl
;
78 ListBox m_aGroupOnLst
;
79 FixedText m_aGroupInterval
;
80 NumericField m_aGroupIntervalEd
;
81 FixedText m_aKeepTogether
;
82 ListBox m_aKeepTogetherLst
;
84 FixedText m_aHelpWindow
;
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
;
94 DECL_LINK( OnControlFocusLost
, Control
* );
95 DECL_LINK( OnControlFocusGot
, Control
* );
96 DECL_LINK( LBChangeHdl
, ListBox
* );
97 DECL_LINK( OnFormatAction
, ToolBox
* );
99 /** returns the groups
100 @return the groups which now have to check which one changes
102 ::com::sun::star::uno::Reference
< ::com::sun::star::report::XGroups
>& getGroups() { return m_xGroups
; }
104 ::com::sun::star::uno::Reference
< ::com::sun::star::report::XGroup
> getGroup(sal_Int32 _nPos
)
106 OSL_ENSURE(_nPos
>= 0 && _nPos
< m_xGroups
->getCount(),"Invalid count!");
107 return ::com::sun::star::uno::Reference
< ::com::sun::star::report::XGroup
>(m_xGroups
->getByIndex(_nPos
),::com::sun::star::uno::UNO_QUERY
);
110 /** updates the listboxes with the new group properties
111 @param _nRow the new group pos
113 void DisplayData( sal_Int32 _nRow
);
115 /** saves the values from the listboxes into the group at position _nRow
116 @param _nRow the group pos to store in
118 void SaveData( sal_Int32 _nRow
);
120 /** returns <TRUE/> when the dialog should be read only
122 sal_Bool
isReadOnly( ) const;
124 /** returns the data type for the given column name
127 sal_Int32
getColumnDataType(const OUString
& _sColumnName
);
129 /** shows the text given by the id in the multiline edit
130 @param _nResId the string id
132 void showHelpText(sal_uInt16 _nResId
);
133 /** display the group props
134 @param _xGroup the group to display
136 void displayGroup(const ::com::sun::star::uno::Reference
< ::com::sun::star::report::XGroup
>& _xGroup
);
138 /** enables or diables the up and down button
139 @param _nRow the row which will be active
141 void checkButtons(sal_Int32 _nRow
);
143 /** clears the m_xColumns member and reset the fields
147 OGroupsSortingDialog(OGroupsSortingDialog
&);
148 void operator =(OGroupsSortingDialog
&);
151 virtual void Resize();
152 // OPropertyChangeListener
153 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent
& _rEvent
) throw( ::com::sun::star::uno::RuntimeException
);
155 OGroupsSortingDialog( Window
* pParent
157 ,::rptui::OReportController
* _pController
);
158 virtual ~OGroupsSortingDialog();
160 /** sets the newe columns at the groups dialog.
161 @param _xColumns the new columns
163 void setColumns(const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _xColumns
);
165 /* updates the current view
169 /** will be called when the controls need to be resized.
171 Contains the difference of the old and new toolbox size.
173 virtual void resizeControls(const Size
& _rDiff
);
175 /** will be called when the image list is needed.
179 virtual ImageList
getImageList(sal_Int16 _eSymbolsSize
) const;
181 // ImageListProvider interface
182 virtual ImageList
getImageList(vcl::ImageListType
) SAL_THROW ((com::sun::star::lang::IllegalArgumentException
));
185 // =============================================================================
187 // =============================================================================
188 #endif // RPTUI_GROUPS_SORTING_HXX
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */