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_STYLESFRAGMENT_HXX 25 #define OOX_XLS_STYLESFRAGMENT_HXX 26 27 #include "oox/xls/excelhandlers.hxx" 28 #include "oox/xls/stylesbuffer.hxx" 29 30 namespace oox { 31 namespace xls { 32 33 // ============================================================================ 34 35 class IndexedColorsContext : public WorkbookContextBase 36 { 37 public: 38 explicit IndexedColorsContext( WorkbookFragmentBase& rFragment ); 39 40 protected: 41 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 42 virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); 43 }; 44 45 // ============================================================================ 46 47 class FontContext : public WorkbookContextBase 48 { 49 public: 50 template< typename ParentType > FontContext(ParentType & rParent,const FontRef & rxFont)51 inline explicit FontContext( ParentType& rParent, const FontRef& rxFont ) : 52 WorkbookContextBase( rParent ), mxFont( rxFont ) {} 53 54 protected: 55 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 56 57 private: 58 FontRef mxFont; 59 }; 60 61 // ============================================================================ 62 63 class BorderContext : public WorkbookContextBase 64 { 65 public: 66 template< typename ParentType > BorderContext(ParentType & rParent,const BorderRef & rxBorder)67 inline explicit BorderContext( ParentType& rParent, const BorderRef& rxBorder ) : 68 WorkbookContextBase( rParent ), mxBorder( rxBorder ) {} 69 70 protected: 71 virtual void onStartElement( const AttributeList& rAttribs ); 72 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 73 74 private: 75 BorderRef mxBorder; 76 }; 77 78 // ============================================================================ 79 80 class FillContext : public WorkbookContextBase 81 { 82 public: 83 template< typename ParentType > FillContext(ParentType & rParent,const FillRef & rxFill)84 inline explicit FillContext( ParentType& rParent, const FillRef& rxFill ) : 85 WorkbookContextBase( rParent ), mxFill( rxFill ), mfGradPos( -1.0 ) {} 86 87 protected: 88 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 89 90 private: 91 FillRef mxFill; 92 double mfGradPos; /// Gradient color position. 93 }; 94 95 // ============================================================================ 96 97 class XfContext : public WorkbookContextBase 98 { 99 public: 100 template< typename ParentType > XfContext(ParentType & rParent,const XfRef & rxXf,bool bCellXf)101 inline explicit XfContext( ParentType& rParent, const XfRef& rxXf, bool bCellXf ) : 102 WorkbookContextBase( rParent ), mxXf( rxXf ), mbCellXf( bCellXf ) {} 103 104 protected: 105 virtual void onStartElement( const AttributeList& rAttribs ); 106 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 107 108 private: 109 XfRef mxXf; 110 bool mbCellXf; /// True = cell XF, false = style XF. 111 }; 112 113 // ============================================================================ 114 115 class DxfContext : public WorkbookContextBase 116 { 117 public: 118 template< typename ParentType > DxfContext(ParentType & rParent,const DxfRef & rxDxf)119 inline explicit DxfContext( ParentType& rParent, const DxfRef& rxDxf ) : 120 WorkbookContextBase( rParent ), mxDxf( rxDxf ) {} 121 122 protected: 123 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 124 125 private: 126 DxfRef mxDxf; 127 }; 128 129 // ============================================================================ 130 131 class StylesFragment : public WorkbookFragmentBase 132 { 133 public: 134 explicit StylesFragment( 135 const WorkbookHelper& rHelper, 136 const ::rtl::OUString& rFragmentPath ); 137 138 protected: 139 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 140 virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ); 141 142 virtual const ::oox::core::RecordInfo* getRecordInfos() const; 143 virtual void finalizeImport(); 144 }; 145 146 // ============================================================================ 147 148 } // namespace xls 149 } // namespace oox 150 151 #endif 152