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 24 #ifndef REPORTDESIGN_FORMATNORMALIZER_HXX 25 #define REPORTDESIGN_FORMATNORMALIZER_HXX 26 27 /** === begin UNO includes === **/ 28 #include <com/sun/star/report/XReportDefinition.hpp> 29 #include <com/sun/star/beans/PropertyChangeEvent.hpp> 30 #include <com/sun/star/report/XFormattedField.hpp> 31 /** === end UNO includes === **/ 32 33 #include <boost/noncopyable.hpp> 34 35 #include <vector> 36 37 //........................................................................ 38 namespace rptui 39 { 40 //........................................................................ 41 42 class OReportModel; 43 //==================================================================== 44 //= FormatNormalizer 45 //==================================================================== 46 class FormatNormalizer : public ::boost::noncopyable 47 { 48 public: 49 struct Field 50 { 51 ::rtl::OUString sName; 52 sal_Int32 nDataType; 53 sal_Int32 nScale; 54 sal_Bool bIsCurrency; 55 Fieldrptui::FormatNormalizer::Field56 Field() : sName(), nDataType( 0 ), nScale( 0 ), bIsCurrency( 0 ) { } 57 }; 58 typedef ::std::vector< Field > FieldList; 59 60 private: 61 const OReportModel& m_rModel; 62 ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > m_xReportDefinition; 63 64 /// is our field list dirty? 65 FieldList m_aFields; 66 bool m_bFieldListDirty; 67 68 public: 69 FormatNormalizer( const OReportModel& _rModel ); 70 ~FormatNormalizer(); 71 72 void notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ); 73 void notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ); 74 75 private: 76 bool impl_lateInit(); 77 78 void impl_onDefinitionPropertyChange( const ::rtl::OUString& _rChangedPropName ); 79 void impl_onFormattedProperttyChange( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFormattedField >& _rxFormatted, const ::rtl::OUString& _rChangedPropName ); 80 81 bool impl_ensureUpToDateFieldList_nothrow(); 82 83 void impl_adjustFormatToDataFieldType_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFormattedField >& _rxFormatted ); 84 }; 85 86 //........................................................................ 87 } // namespace rptui 88 //........................................................................ 89 90 #endif // REPORTDESIGN_FORMATNORMALIZER_HXX 91