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