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 :
10 : #include "WpgContext.hxx"
11 : #include <oox/drawingml/shapepropertiescontext.hxx>
12 : #include <oox/drawingml/shapegroupcontext.hxx>
13 : #include <oox/drawingml/graphicshapecontext.hxx>
14 :
15 : using namespace com::sun::star;
16 :
17 : namespace oox
18 : {
19 : namespace shape
20 : {
21 :
22 50 : WpgContext::WpgContext(ContextHandler2Helper& rParent)
23 50 : : ContextHandler2(rParent)
24 : {
25 50 : mpShape.reset(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape"));
26 50 : mpShape->setWps(true);
27 50 : }
28 :
29 100 : WpgContext::~WpgContext()
30 : {
31 100 : }
32 :
33 50 : oox::drawingml::ShapePtr WpgContext::getShape()
34 : {
35 50 : return mpShape;
36 : }
37 :
38 381 : oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken, const oox::AttributeList& /*rAttribs*/)
39 : {
40 381 : switch (getBaseToken(nElementToken))
41 : {
42 : case XML_wgp:
43 50 : break;
44 : case XML_cNvGrpSpPr:
45 50 : break;
46 : case XML_grpSpPr:
47 50 : return new oox::drawingml::ShapePropertiesContext(*this, *mpShape);
48 : break;
49 : case XML_wsp:
50 : {
51 : // Don't set default character height, Writer has its own way to set
52 : // the default, and if we don't set it here, editeng properly inherits
53 : // it.
54 221 : oox::drawingml::ShapePtr pShape(new oox::drawingml::Shape("com.sun.star.drawing.CustomShape", /*bDefaultHeight=*/false));
55 221 : return new oox::drawingml::ShapeContext(*this, mpShape, pShape);
56 : }
57 : break;
58 : case XML_pic:
59 2 : return new oox::drawingml::GraphicShapeContext(*this, mpShape, oox::drawingml::ShapePtr(new oox::drawingml::Shape("com.sun.star.drawing.GraphicObjectShape")));
60 : break;
61 : case XML_grpSp:
62 : {
63 8 : return new oox::drawingml::ShapeGroupContext(*this, mpShape, oox::drawingml::ShapePtr(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape")));
64 : }
65 : break;
66 : default:
67 : SAL_WARN("oox", "WpgContext::createFastChildContext: unhandled element: " << getBaseToken(nElementToken));
68 0 : break;
69 : }
70 100 : return 0;
71 : }
72 :
73 : }
74 177 : }
75 :
76 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|