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 INCLUDED_REPORTDESIGN_SOURCE_UI_INC_GROUPSSORTING_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_GROUPSSORTING_HXX
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 <rtl/ref.hxx>
37 #include <osl/diagnose.h>
41 #include <dbaccess/ToolBoxHelper.hxx>
45 class OPropertyChangeMultiplexer
;
49 class OFieldExpressionControl
;
50 class OReportController
;
51 /*************************************************************************
53 |* Groups and Sorting dialog
55 \************************************************************************/
57 class OGroupsSortingDialog
: public FloatingWindow
58 , public ::cppu::BaseMutex
59 , public ::comphelper::OPropertyChangeListener
61 friend class OFieldExpressionControl
;
63 VclPtr
<ToolBox
> m_pToolBox
;
64 sal_uInt16 m_nMoveUpId
;
65 sal_uInt16 m_nMoveDownId
;
66 sal_uInt16 m_nDeleteId
;
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
;
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 css::uno::Reference
< css::report::XGroups
> m_xGroups
;
82 css::uno::Reference
< css::container::XNameAccess
> m_xColumns
;
83 bool const m_bReadOnly
;
85 DECL_LINK( OnControlFocusLost
, Control
&, void );
86 DECL_LINK( OnControlFocusGot
, Control
&, void );
87 DECL_LINK( LBChangeHdl
, ListBox
&, void );
88 DECL_LINK( OnFormatAction
, ToolBox
*, void );
90 /** returns the groups
91 @return the groups which now have to check which one changes
93 css::uno::Reference
< css::report::XGroups
>& getGroups() { return m_xGroups
; }
95 css::uno::Reference
< css::report::XGroup
> getGroup(sal_Int32 _nPos
)
97 OSL_ENSURE(_nPos
>= 0 && _nPos
< m_xGroups
->getCount(),"Invalid count!");
98 return css::uno::Reference
< css::report::XGroup
>(m_xGroups
->getByIndex(_nPos
),css::uno::UNO_QUERY
);
101 /** updates the listboxes with the new group properties
102 @param _nRow the new group pos
104 void DisplayData( sal_Int32 _nRow
);
106 /** saves the values from the listboxes into the group at position _nRow
107 @param _nRow the group pos to store in
109 void SaveData( sal_Int32 _nRow
);
111 /** returns <TRUE/> when the dialog should be read only
113 bool isReadOnly( ) const { return m_bReadOnly
;}
115 /** returns the data type for the given column name
118 sal_Int32
getColumnDataType(const OUString
& _sColumnName
);
120 /** display the group props
121 @param _xGroup the group to display
123 void displayGroup(const css::uno::Reference
< css::report::XGroup
>& _xGroup
);
125 /** enables or disables the up and down button
126 @param _nRow the row which will be active
128 void checkButtons(sal_Int32 _nRow
);
130 /** clears the m_xColumns member and reset the fields
134 OGroupsSortingDialog(OGroupsSortingDialog
const &) = delete;
135 void operator =(OGroupsSortingDialog
const &) = delete;
137 // OPropertyChangeListener
138 virtual void _propertyChanged(const css::beans::PropertyChangeEvent
& _rEvent
) override
;
140 OGroupsSortingDialog( vcl::Window
* pParent
142 ,::rptui::OReportController
* _pController
);
143 virtual ~OGroupsSortingDialog() override
;
144 virtual void dispose() override
;
146 /* updates the current view
153 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_GROUPSSORTING_HXX
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */