LibreOffice Module xmloff (master) 1
ximpgrp.cxx
Go to the documentation of this file.
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 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
21#include "ximpgrp.hxx"
22#include <xmloff/xmltoken.hxx>
23#include "ximpshap.hxx"
24#include "eventimp.hxx"
25#include "descriptionimp.hxx"
26
27using namespace ::com::sun::star;
28using namespace ::xmloff::token;
29
30
32 SvXMLImport& rImport,
33 const uno::Reference< xml::sax::XFastAttributeList>& xAttrList,
34 uno::Reference< drawing::XShapes > const & rShapes,
35 bool bTemporaryShape)
36: SdXMLShapeContext( rImport, xAttrList, rShapes, bTemporaryShape )
37{
38}
39
41{
42}
43
44css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLGroupShapeContext::createFastChildContext(
45 sal_Int32 nElement,
46 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
47{
48 // #i68101#
49 if( nElement == XML_ELEMENT(SVG, XML_TITLE) ||
50 nElement == XML_ELEMENT(SVG, XML_DESC ) ||
51 nElement == XML_ELEMENT(SVG_COMPAT, XML_TITLE) ||
52 nElement == XML_ELEMENT(SVG_COMPAT, XML_DESC ) )
53 {
54 return new SdXMLDescriptionContext( GetImport(), nElement, mxShape );
55 }
56 else if( nElement == XML_ELEMENT(OFFICE, XML_EVENT_LISTENERS) )
57 {
58 return new SdXMLEventsContext( GetImport(), mxShape );
59 }
60 else if( nElement == XML_ELEMENT(DRAW, XML_GLUE_POINT) )
61 {
62 addGluePoint( xAttrList );
63 }
64 else
65 {
66 // call GroupChildContext function at common ShapeImport
68 GetImport(), nElement, xAttrList, mxChildren);
69 }
70 return nullptr;
71}
72
73void SdXMLGroupShapeContext::startFastElement (sal_Int32 /*nElement*/,
74 const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/)
75{
76 // create new group shape and add it to rShapes, use it
77 // as base for the new group import
78 AddShape( "com.sun.star.drawing.GroupShape" );
79
80 if(mxShape.is())
81 {
82 SetStyle( false );
83
84 mxChildren.set( mxShape, uno::UNO_QUERY );
85 if( mxChildren.is() )
86 GetImport().GetShapeImport()->pushGroupForPostProcessing( mxChildren );
87 }
88
89 GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
90}
91
93{
94 if( mxChildren.is() )
95 GetImport().GetShapeImport()->popGroupAndPostProcess();
96
98}
99
100/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximpgrp.cxx:44
SdXMLGroupShapeContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape)
Definition: ximpgrp.cxx:31
css::uno::Reference< css::drawing::XShapes > mxChildren
Definition: ximpgrp.hxx:31
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpgrp.cxx:73
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpgrp.cxx:92
virtual ~SdXMLGroupShapeContext() override
Definition: ximpgrp.cxx:40
void addGluePoint(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpshap.cxx:246
void AddShape(css::uno::Reference< css::drawing::XShape > &xShape)
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:60
css::uno::Reference< css::xml::sax::XFastAttributeList > mxAttrList
Definition: ximpshap.hxx:50
void SetStyle(bool bSupportsStyle=true)
if bSupportsStyle is false, auto styles will be set but not a style
Definition: ximpshap.cxx:600
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpshap.cxx:329
css::uno::Reference< css::drawing::XShapes > mxShapes
Definition: ximpshap.hxx:47
css::uno::Reference< css::drawing::XShape > mxShape
static SvXMLShapeContext * CreateGroupChildContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes, bool bTemporaryShape=false)
DRAW
Handling of tokens in XML:
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97