| 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 |
|
| 20 |
#include "ControlOOoTContext.hxx" |
| 21 |
#include "IgnoreTContext.hxx" |
| 22 |
#include "MutableAttrList.hxx" |
| 23 |
#include "ActionMapTypesOOo.hxx" |
| 24 |
#include "TransformerBase.hxx" |
| 25 |
|
| 26 |
|
| 27 |
using namespace ::com::sun::star::uno; |
| 28 |
using namespace ::com::sun::star::xml::sax; |
| 29 |
|
| 30 |
XMLControlOOoTransformerContext::XMLControlOOoTransformerContext( |
| 31 |
XMLTransformerBase& rImp, |
| 32 |
const OUString& rQName ) : |
| 33 |
XMLTransformerContext( rImp, rQName ) |
| 34 |
{ |
| 35 |
} |
| 36 |
|
| 37 |
void XMLControlOOoTransformerContext::StartElement( |
| 38 |
const Reference< XAttributeList >& rAttrList ) |
| 39 |
{ |
| 40 |
m_xAttrList = new XMLMutableAttributeList( rAttrList, true ); |
| 41 |
} |
| 42 |
|
| 43 |
rtl::Reference<XMLTransformerContext> XMLControlOOoTransformerContext::CreateChildContext( |
| 44 |
sal_uInt16 /*nPrefix*/, |
| 45 |
const OUString& /*rLocalName*/, |
| 46 |
const OUString& rQName, |
| 47 |
const Reference< XAttributeList >& rAttrList ) |
| 48 |
{ |
| 49 |
rtl::Reference<XMLTransformerContext> pContext; |
| 50 |
|
| 51 |
if( m_aElemQName.isEmpty() ) |
| 52 |
{ |
| 53 |
pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), |
| 54 |
rQName, |
| 55 |
false, false )); |
| 56 |
m_aElemQName = rQName; |
| 57 |
static_cast< XMLMutableAttributeList * >( m_xAttrList.get() ) |
| 58 |
->AppendAttributeList( rAttrList ); |
| 59 |
GetTransformer().ProcessAttrList( m_xAttrList, |
| 60 |
OOO_FORM_CONTROL_ACTIONS, |
| 61 |
false ); |
| 62 |
GetTransformer().GetDocHandler()->startElement( m_aElemQName, |
| 63 |
m_xAttrList ); |
| 64 |
} |
| 65 |
else |
| 66 |
{ |
| 67 |
pContext.set(new XMLIgnoreTransformerContext( GetTransformer(), |
| 68 |
rQName, |
| 69 |
true, true )); |
| 70 |
} |
| 71 |
return pContext; |
| 72 |
} |
| 73 |
|
| 74 |
void XMLControlOOoTransformerContext::EndElement() |
| 75 |
{ |
| 76 |
GetTransformer().GetDocHandler()->endElement( m_aElemQName ); |
| 77 |
} |
| 78 |
|
| 79 |
void XMLControlOOoTransformerContext::Characters( const OUString& rChars ) |
| 80 |
{ |
| 81 |
// ignore |
| 82 |
if( !m_aElemQName.isEmpty() ) |
| 83 |
XMLTransformerContext::Characters( rChars ); |
| 84 |
} |
| 85 |
|
| 86 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |