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