Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef OOX_XLS_STYLESFRAGMENT_HXX
21 : #define OOX_XLS_STYLESFRAGMENT_HXX
22 :
23 : #include "excelhandlers.hxx"
24 : #include "stylesbuffer.hxx"
25 :
26 : namespace oox {
27 : namespace xls {
28 :
29 : // ============================================================================
30 :
31 2 : class IndexedColorsContext : public WorkbookContextBase
32 : {
33 : public:
34 : explicit IndexedColorsContext( WorkbookFragmentBase& rFragment );
35 :
36 : protected:
37 : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
38 : virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
39 : };
40 :
41 : // ============================================================================
42 :
43 132 : class FontContext : public WorkbookContextBase
44 : {
45 : public:
46 : template< typename ParentType >
47 66 : inline explicit FontContext( ParentType& rParent, const FontRef& rxFont ) :
48 66 : WorkbookContextBase( rParent ), mxFont( rxFont ) {}
49 :
50 : protected:
51 : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
52 :
53 : private:
54 : FontRef mxFont;
55 : };
56 :
57 : // ============================================================================
58 :
59 22 : class BorderContext : public WorkbookContextBase
60 : {
61 : public:
62 : template< typename ParentType >
63 11 : inline explicit BorderContext( ParentType& rParent, const BorderRef& rxBorder ) :
64 11 : WorkbookContextBase( rParent ), mxBorder( rxBorder ) {}
65 :
66 : protected:
67 : virtual void onStartElement( const AttributeList& rAttribs );
68 : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
69 :
70 : private:
71 : BorderRef mxBorder;
72 : };
73 :
74 : // ============================================================================
75 :
76 88 : class FillContext : public WorkbookContextBase
77 : {
78 : public:
79 : template< typename ParentType >
80 44 : inline explicit FillContext( ParentType& rParent, const FillRef& rxFill ) :
81 44 : WorkbookContextBase( rParent ), mxFill( rxFill ), mfGradPos( -1.0 ) {}
82 :
83 : protected:
84 : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
85 :
86 : private:
87 : FillRef mxFill;
88 : double mfGradPos; /// Gradient color position.
89 : };
90 :
91 : // ============================================================================
92 :
93 372 : class XfContext : public WorkbookContextBase
94 : {
95 : public:
96 : template< typename ParentType >
97 186 : inline explicit XfContext( ParentType& rParent, const XfRef& rxXf, bool bCellXf ) :
98 186 : WorkbookContextBase( rParent ), mxXf( rxXf ), mbCellXf( bCellXf ) {}
99 :
100 : protected:
101 : virtual void onStartElement( const AttributeList& rAttribs );
102 : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
103 :
104 : private:
105 : XfRef mxXf;
106 : bool mbCellXf; /// True = cell XF, false = style XF.
107 : };
108 :
109 : // ============================================================================
110 :
111 140 : class DxfContext : public WorkbookContextBase
112 : {
113 : public:
114 : template< typename ParentType >
115 70 : inline explicit DxfContext( ParentType& rParent, const DxfRef& rxDxf ) :
116 70 : WorkbookContextBase( rParent ), mxDxf( rxDxf ) {}
117 :
118 : protected:
119 : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
120 :
121 : private:
122 : DxfRef mxDxf;
123 : };
124 :
125 : // ============================================================================
126 :
127 22 : class StylesFragment : public WorkbookFragmentBase
128 : {
129 : public:
130 : explicit StylesFragment(
131 : const WorkbookHelper& rHelper,
132 : const ::rtl::OUString& rFragmentPath );
133 :
134 : protected:
135 : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
136 : virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
137 :
138 : virtual const ::oox::core::RecordInfo* getRecordInfos() const;
139 : virtual void finalizeImport();
140 : };
141 :
142 : // ============================================================================
143 :
144 : } // namespace xls
145 : } // namespace oox
146 :
147 : #endif
148 :
149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|