LibreOffice Module xmloff (master)  1
XMLEmbeddedObjectExportFilter.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 
22 
23 using namespace ::com::sun::star::uno;
24 using namespace ::com::sun::star::xml::sax;
25 
26 
28  const Reference< XDocumentHandler > & rHandler ) throw() :
29  xHandler( rHandler ),
30  xExtHandler( rHandler, UNO_QUERY )
31 {
32 }
33 
35 {
36 }
37 
39 {
40  // do nothing, filter this
41 }
42 
44 {
45  // do nothing, filter this
46 }
47 
49  const OUString& rName,
50  const Reference< XAttributeList >& xAttrList )
51 {
52  xHandler->startElement( rName, xAttrList );
53 }
54 
55 void SAL_CALL XMLEmbeddedObjectExportFilter::endElement( const OUString& rName )
56 {
57  xHandler->endElement( rName );
58 }
59 
60 void SAL_CALL XMLEmbeddedObjectExportFilter::characters( const OUString& rChars )
61 {
62  xHandler->characters( rChars );
63 }
64 
66  const OUString& rWhitespaces )
67 {
68  xHandler->ignorableWhitespace( rWhitespaces );
69 }
70 
72  const OUString& rTarget,
73  const OUString& rData )
74 {
75  xHandler->processingInstruction( rTarget, rData );
76 }
77 
79  const Reference< XLocator >& rLocator )
80 {
81  xHandler->setDocumentLocator( rLocator );
82 }
83 
84 // XExtendedDocumentHandler
86 {
87  if( xExtHandler.is() )
88  xExtHandler->startCDATA();
89 }
90 
92 {
93  if( xExtHandler.is() )
94  xExtHandler->endCDATA();
95 }
96 
97 void SAL_CALL XMLEmbeddedObjectExportFilter::comment( const OUString& rComment )
98 {
99  if( xExtHandler.is() )
100  xExtHandler->comment( rComment );
101 }
102 
104 {
105  if( xExtHandler.is() )
106  xExtHandler->allowLineBreak();
107 }
108 
109 void SAL_CALL XMLEmbeddedObjectExportFilter::unknown( const OUString& rString )
110 {
111  if( xExtHandler.is() )
112  xExtHandler->unknown( rString );
113 }
114 
115 // XInitialize
117  const Sequence< Any >& aArguments )
118 {
119  for( const auto& rAny : aArguments )
120  {
121  if( rAny.getValueType() ==
123  {
124  rAny >>= xHandler;
125  rAny >>= xExtHandler;
126  }
127  }
128 }
129 
130 // XServiceInfo
132 {
133  return OUString();
134 }
135 
136 sal_Bool SAL_CALL XMLEmbeddedObjectExportFilter::supportsService( const OUString& ServiceName )
137 {
138  return cppu::supportsService(this, ServiceName);
139 }
140 
142 {
144  return aSeq;
145 }
146 
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL startDocument() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL allowLineBreak() override
virtual void SAL_CALL processingInstruction(const OUString &aTarget, const OUString &aData) override
virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > &xLocator) override
XMLEmbeddedObjectExportFilter(const css::uno::Reference< css::xml::sax::XDocumentHandler > &rHandler)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > xExtHandler
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL startCDATA() override
virtual void SAL_CALL endCDATA() override
virtual void SAL_CALL ignorableWhitespace(const OUString &aWhitespaces) override
unsigned char sal_Bool
css::uno::Type const & get()
virtual void SAL_CALL characters(const OUString &aChars) override
virtual void SAL_CALL startElement(const OUString &aName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs) override
virtual void SAL_CALL endDocument() override
virtual void SAL_CALL unknown(const OUString &sString) override
css::uno::Reference< css::xml::sax::XDocumentHandler > xHandler
Sequence< sal_Int8 > aSeq
virtual void SAL_CALL endElement(const OUString &aName) override
virtual void SAL_CALL comment(const OUString &sComment) override