1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmloff.hxx"
26 #include "xmloff/XMLEmbeddedObjectExportFilter.hxx"
27 
28 using ::rtl::OUString;
29 
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::xml::sax;
32 
33 
XMLEmbeddedObjectExportFilter()34 XMLEmbeddedObjectExportFilter::XMLEmbeddedObjectExportFilter() throw()
35 {
36 }
37 
XMLEmbeddedObjectExportFilter(const Reference<XDocumentHandler> & rHandler)38 XMLEmbeddedObjectExportFilter::XMLEmbeddedObjectExportFilter(
39 		const Reference< XDocumentHandler > & rHandler ) throw() :
40 	xHandler( rHandler ),
41 	xExtHandler( rHandler, UNO_QUERY )
42 {
43 }
44 
~XMLEmbeddedObjectExportFilter()45 XMLEmbeddedObjectExportFilter::~XMLEmbeddedObjectExportFilter () throw()
46 {
47 }
48 
49 
startDocument(void)50 void SAL_CALL XMLEmbeddedObjectExportFilter::startDocument( void )
51 	throw( SAXException, RuntimeException )
52 {
53 	// do nothing, filter this
54 }
55 
endDocument(void)56 void SAL_CALL XMLEmbeddedObjectExportFilter::endDocument( void )
57 	throw( SAXException, RuntimeException)
58 {
59 	// do nothing, filter this
60 }
61 
startElement(const OUString & rName,const Reference<XAttributeList> & xAttrList)62 void SAL_CALL XMLEmbeddedObjectExportFilter::startElement(
63 		const OUString& rName,
64 		const Reference< XAttributeList >& xAttrList )
65 	throw(SAXException, RuntimeException)
66 {
67 	xHandler->startElement( rName, xAttrList );
68 }
69 
endElement(const OUString & rName)70 void SAL_CALL XMLEmbeddedObjectExportFilter::endElement( const OUString& rName )
71 	throw(SAXException, RuntimeException)
72 {
73 	xHandler->endElement( rName );
74 }
75 
characters(const OUString & rChars)76 void SAL_CALL XMLEmbeddedObjectExportFilter::characters( const OUString& rChars )
77 	throw(SAXException, RuntimeException)
78 {
79 	xHandler->characters( rChars );
80 }
81 
ignorableWhitespace(const OUString & rWhitespaces)82 void SAL_CALL XMLEmbeddedObjectExportFilter::ignorableWhitespace(
83 		const OUString& rWhitespaces )
84 	throw(SAXException, RuntimeException)
85 {
86 	xHandler->ignorableWhitespace( rWhitespaces );
87 }
88 
processingInstruction(const OUString & rTarget,const OUString & rData)89 void SAL_CALL XMLEmbeddedObjectExportFilter::processingInstruction(
90 		const OUString& rTarget,
91 	    const OUString& rData )
92 	throw(SAXException, RuntimeException)
93 {
94 	xHandler->processingInstruction( rTarget, rData );
95 }
96 
setDocumentLocator(const Reference<XLocator> & rLocator)97 void SAL_CALL XMLEmbeddedObjectExportFilter::setDocumentLocator(
98 		const Reference< XLocator >& rLocator )
99 	throw(SAXException, RuntimeException)
100 {
101 	xHandler->setDocumentLocator( rLocator );
102 }
103 
104 // XExtendedDocumentHandler
startCDATA(void)105 void SAL_CALL XMLEmbeddedObjectExportFilter::startCDATA( void )
106 	throw(SAXException, RuntimeException)
107 {
108 	if( xExtHandler.is() )
109 		xExtHandler->startCDATA();
110 }
111 
endCDATA(void)112 void SAL_CALL XMLEmbeddedObjectExportFilter::endCDATA( void )
113 	throw(RuntimeException)
114 {
115 	if( xExtHandler.is() )
116 		xExtHandler->endCDATA();
117 }
118 
comment(const OUString & rComment)119 void SAL_CALL XMLEmbeddedObjectExportFilter::comment( const OUString& rComment )
120 	throw(SAXException, RuntimeException)
121 {
122 	if( xExtHandler.is() )
123 		xExtHandler->comment( rComment );
124 }
125 
allowLineBreak(void)126 void SAL_CALL XMLEmbeddedObjectExportFilter::allowLineBreak( void )
127 	throw(SAXException, RuntimeException)
128 {
129 	if( xExtHandler.is() )
130 		xExtHandler->allowLineBreak();
131 }
132 
unknown(const OUString & rString)133 void SAL_CALL XMLEmbeddedObjectExportFilter::unknown( const OUString& rString )
134 	throw(SAXException, RuntimeException)
135 {
136 	if( xExtHandler.is() )
137 		xExtHandler->unknown( rString );
138 }
139 
140 // XInitialize
initialize(const Sequence<Any> & aArguments)141 void SAL_CALL XMLEmbeddedObjectExportFilter::initialize(
142 		const Sequence< Any >& aArguments )
143 	throw(Exception, RuntimeException)
144 {
145 	const sal_Int32 nAnyCount = aArguments.getLength();
146 	const Any* pAny = aArguments.getConstArray();
147 
148 	for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ )
149 	{
150 		if( pAny->getValueType() ==
151 				::getCppuType((const Reference< XDocumentHandler >*)0))
152 		{
153 			*pAny >>= xHandler;
154 			*pAny >>= xExtHandler;
155 		}
156 	}
157 }
158 
159 // XServiceInfo
getImplementationName()160 OUString SAL_CALL XMLEmbeddedObjectExportFilter::getImplementationName()
161 	throw(RuntimeException)
162 {
163 	OUString aStr;
164 	return aStr;
165 }
166 
supportsService(const OUString &)167 sal_Bool SAL_CALL XMLEmbeddedObjectExportFilter::supportsService( const OUString& )
168 	throw(RuntimeException)
169 {
170 	return sal_False;
171 }
172 
getSupportedServiceNames()173 Sequence< OUString > SAL_CALL XMLEmbeddedObjectExportFilter::getSupportedServiceNames(  )
174 	throw(RuntimeException)
175 {
176 	Sequence< OUString > aSeq;
177 	return aSeq;
178 }
179