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_VML_VMLSHAPECONTEXT_HXX 25 #define OOX_VML_VMLSHAPECONTEXT_HXX 26 27 #include "oox/core/contexthandler2.hxx" 28 29 namespace oox { 30 namespace vml { 31 32 class Drawing; 33 34 struct ShapeTypeModel; 35 class ShapeType; 36 37 struct ClientData; 38 struct ShapeModel; 39 class ShapeBase; 40 class GroupShape; 41 42 class ShapeContainer; 43 44 // ============================================================================ 45 46 class ShapeLayoutContext : public ::oox::core::ContextHandler2 47 { 48 public: 49 explicit ShapeLayoutContext( 50 ::oox::core::ContextHandler2Helper& rParent, 51 Drawing& rDrawing ); 52 53 virtual ::oox::core::ContextHandlerRef 54 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 55 56 private: 57 Drawing& mrDrawing; 58 }; 59 60 // ============================================================================ 61 62 class ClientDataContext : public ::oox::core::ContextHandler2 63 { 64 public: 65 explicit ClientDataContext( 66 ::oox::core::ContextHandler2Helper& rParent, 67 ClientData& rClientData, 68 const AttributeList& rAttribs ); 69 70 virtual ::oox::core::ContextHandlerRef 71 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 72 virtual void onCharacters( const ::rtl::OUString& rChars ); 73 virtual void onEndElement(); 74 75 private: 76 ClientData& mrClientData; 77 ::rtl::OUString maElementText; 78 }; 79 80 // ============================================================================ 81 82 class ShapeContextBase : public ::oox::core::ContextHandler2 83 { 84 public: 85 static ::oox::core::ContextHandlerRef 86 createShapeContext( 87 ::oox::core::ContextHandler2Helper& rParent, 88 ShapeContainer& rShapes, 89 sal_Int32 nElement, 90 const AttributeList& rAttribs ); 91 92 protected: 93 explicit ShapeContextBase( ::oox::core::ContextHandler2Helper& rParent ); 94 }; 95 96 // ============================================================================ 97 98 class ShapeTypeContext : public ShapeContextBase 99 { 100 public: 101 explicit ShapeTypeContext( 102 ::oox::core::ContextHandler2Helper& rParent, 103 ShapeType& rShapeType, 104 const AttributeList& rAttribs ); 105 106 virtual ::oox::core::ContextHandlerRef 107 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 108 109 private: 110 /** Processes the 'style' attribute. */ 111 void setStyle( const ::rtl::OUString& rStyle ); 112 113 /** Resolve a relation identifier to a fragment path. */ 114 OptValue< ::rtl::OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const; 115 116 private: 117 ShapeTypeModel& mrTypeModel; 118 }; 119 120 // ============================================================================ 121 122 class ShapeContext : public ShapeTypeContext 123 { 124 public: 125 explicit ShapeContext( 126 ::oox::core::ContextHandler2Helper& rParent, 127 ShapeBase& rShape, 128 const AttributeList& rAttribs ); 129 130 virtual ::oox::core::ContextHandlerRef 131 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 132 133 private: 134 /** Processes the 'points' attribute. */ 135 void setPoints( const ::rtl::OUString& rPoints ); 136 137 private: 138 ShapeModel& mrShapeModel; 139 }; 140 141 // ============================================================================ 142 143 class GroupShapeContext : public ShapeContext 144 { 145 public: 146 explicit GroupShapeContext( 147 ::oox::core::ContextHandler2Helper& rParent, 148 GroupShape& rShape, 149 const AttributeList& rAttribs ); 150 151 virtual ::oox::core::ContextHandlerRef 152 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); 153 154 private: 155 ShapeContainer& mrShapes; 156 }; 157 158 // ============================================================================ 159 160 } // namespace vml 161 } // namespace oox 162 163 #endif 164