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