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 RPT_XMLTABLE_HXX 24 #define RPT_XMLTABLE_HXX 25 26 #include <xmloff/xmlictxt.hxx> 27 #include <com/sun/star/report/XSection.hpp> 28 #include <vector> 29 30 namespace rptxml 31 { 32 class ORptFilter; 33 class OXMLTable : public SvXMLImportContext 34 { 35 public: 36 struct TCell 37 { 38 sal_Int32 nWidth; 39 sal_Int32 nHeight; 40 sal_Int32 nColSpan; 41 sal_Int32 nRowSpan; 42 ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> > xElements; TCellrptxml::OXMLTable::TCell43 TCell() : nWidth(0),nHeight(0),nColSpan(1),nRowSpan(1){} 44 }; 45 private: 46 ::std::vector< ::std::vector<TCell> > m_aGrid; 47 ::std::vector<sal_Int32> m_aHeight; 48 ::std::vector<sal_Int32> m_aWidth; 49 ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > m_xSection; 50 ::rtl::OUString m_sStyleName; 51 sal_Int32 m_nColSpan; 52 sal_Int32 m_nRowSpan; 53 sal_Int32 m_nRowIndex; 54 sal_Int32 m_nColumnIndex; 55 ORptFilter& GetOwnImport(); 56 57 OXMLTable(const OXMLTable&); 58 void operator =(const OXMLTable&); 59 public: 60 61 OXMLTable( ORptFilter& rImport 62 ,sal_uInt16 nPrfx 63 ,const ::rtl::OUString& rLName 64 ,const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList 65 ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection 66 ); 67 virtual ~OXMLTable(); 68 69 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 70 const ::rtl::OUString& rLocalName, 71 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); 72 73 virtual void EndElement(); 74 addHeight(sal_Int32 _nHeight)75 inline void addHeight(sal_Int32 _nHeight) { m_aHeight.push_back( _nHeight ); } addWidth(sal_Int32 _nWidth)76 inline void addWidth(sal_Int32 _nWidth) { m_aWidth.push_back( _nWidth ); } 77 setColumnSpanned(sal_Int32 _nColSpan)78 inline void setColumnSpanned(sal_Int32 _nColSpan) { m_nColSpan = _nColSpan; } setRowSpanned(sal_Int32 _nRowSpan)79 inline void setRowSpanned( sal_Int32 _nRowSpan) { m_nRowSpan = _nRowSpan; } 80 81 void incrementRowIndex(); incrementColumnIndex()82 inline void incrementColumnIndex() { ++m_nColumnIndex; } 83 getRowIndex() const84 inline sal_Int32 getRowIndex() const { return m_nRowIndex; } getColumnIndex() const85 inline sal_Int32 getColumnIndex() const { return m_nColumnIndex; } 86 87 void addCell(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xElement); 88 getSection() const89 inline ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > getSection() const { return m_xSection; } 90 }; 91 // ----------------------------------------------------------------------------- 92 } // namespace rptxml 93 // ----------------------------------------------------------------------------- 94 95 #endif // RPT_XMLTABLE_HXX 96