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 0 : WpgContext::WpgContext(ContextHandler2Helper& rParent)
23 0 : : ContextHandler2(rParent)
24 : {
25 0 : mpShape.reset(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape"));
26 0 : mpShape->setWps(true);
27 0 : }
28 :
29 0 : WpgContext::~WpgContext()
30 : {
31 0 : }
32 :
33 0 : oox::drawingml::ShapePtr WpgContext::getShape()
34 : {
35 0 : return mpShape;
36 : }
37 :
38 0 : oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken, const oox::AttributeList& /*rAttribs*/)
39 : {
40 0 : switch (getBaseToken(nElementToken))
41 : {
42 : case XML_wgp:
43 0 : break;
44 : case XML_cNvGrpSpPr:
45 0 : break;
46 : case XML_grpSpPr:
47 0 : 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 0 : oox::drawingml::ShapePtr pShape(new oox::drawingml::Shape("com.sun.star.drawing.CustomShape", /*bDefaultHeight=*/false));
55 0 : return new oox::drawingml::ShapeContext(*this, mpShape, pShape);
56 : }
57 : break;
58 : case XML_pic:
59 0 : 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 0 : 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 0 : return 0;
71 : }
72 :
73 : }
74 0 : }
75 :
76 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|