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 <com/sun/star/report/XGroups.hpp>
23 #include <com/sun/star/report/XGroup.hpp>
24 #include <com/sun/star/container/XNameAccess.hpp>
25 #include <comphelper/propmultiplex.hxx>
26 #include <cppuhelper/basemutex.hxx>
27 #include <rtl/ref.hxx>
28 #include <vcl/weld.hxx>
29 #include <osl/diagnose.h>
33 class OPropertyChangeMultiplexer
;
37 class OFieldExpressionControl
;
38 class OReportController
;
39 /*************************************************************************
41 |* Groups and Sorting dialog
43 \************************************************************************/
45 class OGroupsSortingDialog
: public weld::GenericDialogController
46 , public ::cppu::BaseMutex
47 , public ::comphelper::OPropertyChangeListener
49 friend class OFieldExpressionControl
;
51 ::rptui::OReportController
* m_pController
;
52 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> m_pCurrentGroupListener
;
53 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> m_pReportListener
;
54 css::uno::Reference
< css::report::XGroups
> m_xGroups
;
55 css::uno::Reference
< css::container::XNameAccess
> m_xColumns
;
58 std::unique_ptr
<weld::Toolbar
> m_xToolBox
;
59 std::unique_ptr
<weld::Widget
> m_xProperties
;
60 std::unique_ptr
<weld::ComboBox
> m_xOrderLst
;
61 std::unique_ptr
<weld::ComboBox
> m_xHeaderLst
;
62 std::unique_ptr
<weld::ComboBox
> m_xFooterLst
;
63 std::unique_ptr
<weld::ComboBox
> m_xGroupOnLst
;
64 std::unique_ptr
<weld::SpinButton
> m_xGroupIntervalEd
;
65 std::unique_ptr
<weld::ComboBox
> m_xKeepTogetherLst
;
66 std::unique_ptr
<weld::Label
> m_xHelpWindow
;
67 std::unique_ptr
<weld::Container
> m_xBox
;
68 css::uno::Reference
<css::awt::XWindow
> m_xTableCtrlParent
;
69 VclPtr
<OFieldExpressionControl
> m_xFieldExpression
;
72 DECL_LINK( OnWidgetFocusLost
, weld::Widget
&, void );
73 DECL_LINK( OnWidgetFocusGot
, weld::Widget
&, void );
75 DECL_LINK( OnControlFocusGot
, LinkParamNone
*, void );
77 DECL_LINK( LBChangeHdl
, weld::ComboBox
&, void );
78 DECL_LINK( OnFormatAction
, const OString
&, void );
80 /** returns the groups
81 @return the groups which now have to check which one changes
83 css::uno::Reference
< css::report::XGroups
>& getGroups() { return m_xGroups
; }
85 css::uno::Reference
< css::report::XGroup
> getGroup(sal_Int32 _nPos
)
87 OSL_ENSURE(_nPos
>= 0 && _nPos
< m_xGroups
->getCount(),"Invalid count!");
88 return css::uno::Reference
< css::report::XGroup
>(m_xGroups
->getByIndex(_nPos
),css::uno::UNO_QUERY
);
91 /** updates the listboxes with the new group properties
92 @param _nRow the new group pos
94 void DisplayData( sal_Int32 _nRow
);
96 /** saves the values from the listboxes into the group at position _nRow
97 @param _nRow the group pos to store in
99 void SaveData( sal_Int32 _nRow
);
101 /** returns <TRUE/> when the dialog should be read only
103 bool isReadOnly( ) const { return m_bReadOnly
;}
105 /** returns the data type for the given column name
108 sal_Int32
getColumnDataType(const OUString
& _sColumnName
);
110 /** display the group props
111 @param _xGroup the group to display
113 void displayGroup(const css::uno::Reference
< css::report::XGroup
>& _xGroup
);
115 /** enables or disables the up and down button
116 @param _nRow the row which will be active
118 void checkButtons(sal_Int32 _nRow
);
120 /** clears the m_xColumns member and reset the fields
124 OGroupsSortingDialog(OGroupsSortingDialog
const &) = delete;
125 void operator =(OGroupsSortingDialog
const &) = delete;
127 // OPropertyChangeListener
128 virtual void _propertyChanged(const css::beans::PropertyChangeEvent
& _rEvent
) override
;
130 OGroupsSortingDialog(weld::Window
* pParent
,
132 ::rptui::OReportController
* _pController
);
133 virtual ~OGroupsSortingDialog() override
;
135 /* updates the current view
142 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_GROUPSSORTING_HXX
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */