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 OOX_XLS_WORKSHEETFRAGMENT_HXX 25 #define OOX_XLS_WORKSHEETFRAGMENT_HXX 26 27 #include "oox/xls/excelhandlers.hxx" 28 29 namespace oox { 30 namespace xls { 31 32 // ============================================================================ 33 34 class DataValidationsContext : public WorksheetContextBase 35 { 36 public: 37 explicit DataValidationsContext( WorksheetFragmentBase& rFragment ); 38 39 protected: 40 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 41 virtual void onCharacters( const ::rtl::OUString& rChars ); 42 virtual void onEndElement(); 43 44 virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); 45 46 private: 47 /** Imports the dataValidation element containing data validation settings. */ 48 void importDataValidation( const AttributeList& rAttribs ); 49 /** Imports the DATAVALIDATION record containing data validation settings. */ 50 void importDataValidation( SequenceInputStream& rStrm ); 51 52 private: 53 ::std::auto_ptr< ValidationModel > mxValModel; 54 }; 55 56 // ============================================================================ 57 58 class WorksheetFragment : public WorksheetFragmentBase 59 { 60 public: 61 explicit WorksheetFragment( 62 const WorksheetHelper& rHelper, 63 const ::rtl::OUString& rFragmentPath ); 64 65 protected: 66 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 67 virtual void onCharacters( const ::rtl::OUString& rChars ); 68 69 virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); 70 71 virtual const ::oox::core::RecordInfo* getRecordInfos() const; 72 virtual void initializeImport(); 73 virtual void finalizeImport(); 74 75 private: 76 /** Imports page settings from a pageSetUpPr element. */ 77 void importPageSetUpPr( const AttributeList& rAttribs ); 78 /** Imports the dimension element containing the used area of the sheet. */ 79 void importDimension( const AttributeList& rAttribs ); 80 /** Imports sheet format properties from a sheetFormatPr element. */ 81 void importSheetFormatPr( const AttributeList& rAttribs ); 82 /** Imports column settings from a col element. */ 83 void importCol( const AttributeList& rAttribs ); 84 /** Imports a merged cell range from a mergeCell element. */ 85 void importMergeCell( const AttributeList& rAttribs ); 86 /** Imports the hyperlink element containing a hyperlink for a cell range. */ 87 void importHyperlink( const AttributeList& rAttribs ); 88 /** Imports individual break that is either within row or column break context. */ 89 void importBrk( const AttributeList& rAttribs, bool bRowBreak ); 90 /** Imports the relation identifier for the DrawingML part. */ 91 void importDrawing( const AttributeList& rAttribs ); 92 /** Imports the relation identifier for the legacy VML drawing part. */ 93 void importLegacyDrawing( const AttributeList& rAttribs ); 94 /** Imports additional data for an OLE object. */ 95 void importOleObject( const AttributeList& rAttribs ); 96 /** Imports additional data for an OCX form control. */ 97 void importControl( const AttributeList& rAttribs ); 98 99 /** Imports the DIMENSION record containing the used area of the sheet. */ 100 void importDimension( SequenceInputStream& rStrm ); 101 /** Imports sheet format properties from a SHEETFORMATPR record. */ 102 void importSheetFormatPr( SequenceInputStream& rStrm ); 103 /** Imports column settings from a COL record. */ 104 void importCol( SequenceInputStream& rStrm ); 105 /** Imports a merged cell range from a MERGECELL record. */ 106 void importMergeCell( SequenceInputStream& rStrm ); 107 /** Imports a hyperlink for a cell range from a HYPERLINK record. */ 108 void importHyperlink( SequenceInputStream& rStrm ); 109 /** Imports the BRK record for an individual row or column page break. */ 110 void importBrk( SequenceInputStream& rStrm, bool bRowBreak ); 111 /** Imports the DRAWING record containing the relation identifier for the DrawingML part. */ 112 void importDrawing( SequenceInputStream& rStrm ); 113 /** Imports the LEGACYDRAWING record containing the relation identifier for the VML drawing part. */ 114 void importLegacyDrawing( SequenceInputStream& rStrm ); 115 /** Imports additional data for an OLE object. */ 116 void importOleObject( SequenceInputStream& rStrm ); 117 /** Imports additional data for an OCX form control. */ 118 void importControl( SequenceInputStream& rStrm ); 119 120 /** Imports the binary data of an embedded OLE object from the fragment with the passed ID. */ 121 void importEmbeddedOleData( StreamDataSequence& orEmbeddedData, const ::rtl::OUString& rRelId ); 122 }; 123 124 // ============================================================================ 125 126 class BiffWorksheetFragment : public BiffWorksheetFragmentBase 127 { 128 public: 129 explicit BiffWorksheetFragment( 130 const WorksheetHelper& rHelper, 131 const BiffWorkbookFragmentBase& rParent ); 132 virtual ~BiffWorksheetFragment(); 133 134 /** Imports the entire worksheet fragment, returns true, if EOF record has been reached. */ 135 virtual bool importFragment(); 136 137 private: 138 /** Imports the AUTOFILTER and following records with auto filter settings. */ 139 void importAutoFilter( BiffInputStream& rStrm ); 140 /** Imports the COLINFO record and sets column properties and formatting. */ 141 void importColInfo( BiffInputStream& rStrm ); 142 /** Imports the BIFF2 COLUMNDEFAULT record and sets column default formatting. */ 143 void importColumnDefault( BiffInputStream& rStrm ); 144 /** Imports the BIFF2 COLWIDTH record and sets column width. */ 145 void importColWidth( BiffInputStream& rStrm ); 146 /** Imports the DATAVALIDATION record containing cell ranges with data validation settings. */ 147 void importDataValidation( BiffInputStream& rStrm ); 148 /** Imports the DATAVALIDATIONS record containing global data validation settings. */ 149 void importDataValidations( BiffInputStream& rStrm ); 150 /** Imports the DEFCOLWIDTH record and sets default column width. */ 151 void importDefColWidth( BiffInputStream& rStrm ); 152 /** Imports the DEFROWHEIGHT record and sets default row height and properties. */ 153 void importDefRowHeight( BiffInputStream& rStrm ); 154 /** Imports the DIMENSION record containing the used area of the sheet. */ 155 void importDimension( BiffInputStream& rStrm ); 156 /** Imports the HYPERLINK record and sets a cell hyperlink. */ 157 void importHyperlink( BiffInputStream& rStrm ); 158 /** Imports the LABELRANGES record and sets the imported label ranges. */ 159 void importLabelRanges( BiffInputStream& rStrm ); 160 /** Imports the MEREDCELLS record and merges all cells in the document. */ 161 void importMergedCells( BiffInputStream& rStrm ); 162 /** Imports the NOTE record containing a cell note. */ 163 void importNote( BiffInputStream& rStrm ); 164 /** Imports the HORPAGEBREAKS or VERPAGEBREAKS record and inserts page breaks. */ 165 void importPageBreaks( BiffInputStream& rStrm, bool bRowBreak ); 166 /** Imports a pivot table. */ 167 void importPTDefinition( BiffInputStream& rStrm ); 168 /** Imports the QUERYTABLE and following records and inserts a web query. */ 169 void importQueryTable( BiffInputStream& rStrm ); 170 /** Imports the SCENARIOS record and the following scenarios. */ 171 void importScenarios( BiffInputStream& rStrm ); 172 /** Imports the SHAREDFEATHEAD record. */ 173 void importSharedFeatHead( BiffInputStream& rStrm ); 174 /** Imports the STANDARDWIDTH record and sets standard column width. */ 175 void importStandardWidth( BiffInputStream& rStrm ); 176 177 private: 178 ::boost::shared_ptr< BiffWorksheetContextBase > mxContext; 179 }; 180 181 // ============================================================================ 182 183 } // namespace xls 184 } // namespace oox 185 186 #endif 187