bump product version to 6.3.0.0.beta1
[LibreOffice.git] / oox / source / vml / vmldrawingfragment.cxx
blobed47e1446b4db344f8570239afd0be2f8bb937e2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <oox/vml/vmldrawingfragment.hxx>
22 #include <oox/core/xmlfilterbase.hxx>
23 #include <oox/token/namespaces.hxx>
24 #include <oox/token/tokens.hxx>
25 #include <oox/vml/vmldrawing.hxx>
26 #include <oox/vml/vmlinputstream.hxx>
27 #include <oox/vml/vmlshapecontext.hxx>
29 namespace oox {
30 namespace vml {
32 using namespace ::com::sun::star::io;
33 using namespace ::com::sun::star::uno;
34 using namespace ::oox::core;
36 DrawingFragment::DrawingFragment( XmlFilterBase& rFilter, const OUString& rFragmentPath, Drawing& rDrawing ) :
37 FragmentHandler2( rFilter, rFragmentPath, false ), // do not trim whitespace, has been preprocessed by the input stream
38 mrDrawing( rDrawing )
42 Reference< XInputStream > DrawingFragment::openFragmentStream() const
44 // #i104719# create an input stream that preprocesses the VML data
45 return new InputStream( getFilter().getComponentContext(), FragmentHandler2::openFragmentStream() );
48 ContextHandlerRef DrawingFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
50 switch( mrDrawing.getType() )
52 // DOCX filter handles plain shape elements with this fragment handler
53 case VMLDRAWING_WORD:
54 if ( getNamespace( nElement ) == NMSP_vml
55 || nElement == W_TOKEN(control) ) // Control shape also defined as a vml shape
56 return ShapeContextBase::createShapeContext( *this, mrDrawing.getShapes(), nElement, rAttribs );
57 break;
59 // XLSX and PPTX filters load the entire VML fragment
60 case VMLDRAWING_EXCEL:
61 case VMLDRAWING_POWERPOINT:
62 switch( getCurrentElement() )
64 case XML_ROOT_CONTEXT:
65 if( nElement == XML_xml ) return this;
66 break;
67 case XML_xml:
68 return ShapeContextBase::createShapeContext( *this, mrDrawing.getShapes(), nElement, rAttribs );
70 break;
72 return nullptr;
75 void DrawingFragment::finalizeImport()
77 // resolve shape template references for all shapes
78 mrDrawing.finalizeFragmentImport();
81 } // namespace vml
82 } // namespace oox
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */