| 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 |
#pragma once |
| 21 |
|
| 22 |
#include "TransformerContext.hxx" |
| 23 |
|
| 24 |
|
| 25 |
class XMLIgnoreTransformerContext : public XMLTransformerContext |
| 26 |
{ |
| 27 |
bool const m_bIgnoreCharacters; |
| 28 |
bool const m_bIgnoreElements; |
| 29 |
bool const m_bAllowCharactersRecursive; |
| 30 |
bool const m_bRecursiveUse; |
| 31 |
|
| 32 |
public: |
| 33 |
// A contexts constructor does anything that is required if an element |
| 34 |
// starts. Namespace processing has been done already. |
| 35 |
// Note that virtual methods cannot be used inside constructors. Use |
| 36 |
// StartElement instead if this is required. |
| 37 |
XMLIgnoreTransformerContext( XMLTransformerBase& rTransformer, |
| 38 |
const OUString& rQName, |
| 39 |
bool bIgnoreCharacters, |
| 40 |
bool bIgnoreElements ); |
| 41 |
// A contexts constructor does anything that is required if an element |
| 42 |
// starts. Namespace processing has been done already. |
| 43 |
// Note that virtual methods cannot be used inside constructors. Use |
| 44 |
// StartElement instead if this is required. |
| 45 |
XMLIgnoreTransformerContext( XMLTransformerBase& rTransformer, |
| 46 |
const OUString& rQName, |
| 47 |
bool bAllowCharactersRecursive ); |
| 48 |
|
| 49 |
// Create a children element context. By default, the import's |
| 50 |
// CreateContext method is called to create a new default context. |
| 51 |
virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix, |
| 52 |
const OUString& rLocalName, |
| 53 |
const OUString& rQName, |
| 54 |
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; |
| 55 |
|
| 56 |
// StartElement is called after a context has been constructed and |
| 57 |
// before an elements context is parsed. It may be used for actions that |
| 58 |
// require virtual methods. The default is to do nothing. |
| 59 |
virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; |
| 60 |
|
| 61 |
// EndElement is called before a context will be destructed, but |
| 62 |
// after an elements context has been parsed. It may be used for actions |
| 63 |
// that require virtual methods. The default is to do nothing. |
| 64 |
virtual void EndElement() override; |
| 65 |
|
| 66 |
// This method is called for all characters that are contained in the |
| 67 |
// current element. The default is to ignore them. |
| 68 |
virtual void Characters( const OUString& rChars ) override; |
| 69 |
}; |
| 70 |
|
| 71 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |