Tag: cws_src680_rptchart01 User: oj Date: 2008-01-31 09:32:07+0000 Modified: dba/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
Log: export chart File Changes: Directory: /dba/reportdesign/source/filter/xml/ =============================================== File [changed]: xmlExportDocumentHandler.cxx Url: http://dba.openoffice.org/source/browse/dba/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx?r1=1.1.2.2&r2=1.1.2.3 Delta lines: +22 -20 --------------------- --- xmlExportDocumentHandler.cxx 2008-01-25 13:56:00+0000 1.1.2.2 +++ xmlExportDocumentHandler.cxx 2008-01-31 09:32:04+0000 1.1.2.3 @@ -4,9 +4,9 @@ * * $RCSfile: xmlExportDocumentHandler.cxx,v $ * - * $Revision: 1.1.2.2 $ + * $Revision: 1.1.2.3 $ * - * last change: $Author: oj $ $Date: 2008/01/25 13:56:00 $ + * last change: $Author: oj $ $Date: 2008/01/31 09:32:04 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -45,7 +45,7 @@ #include <xmloff/xmltoken.hxx> #include <xmloff/xmlement.hxx> #include <xmloff/xmluconv.hxx> - +#include <svtools/saveopt.hxx> #include <connectivity/dbtools.hxx> namespace rptxml @@ -53,6 +53,16 @@ using namespace ::com::sun::star; using namespace ::xmloff::token; +void lcl_exportPrettyPrinting(const uno::Reference< xml::sax::XDocumentHandler >& _xDelegatee) +{ + SvtSaveOptions aSaveOpt; + if ( aSaveOpt.IsPrettyPrinting() ) + { + static const ::rtl::OUString s_sWhitespaces(RTL_CONSTASCII_USTRINGPARAM(" ")); + _xDelegatee->ignorableWhitespace(s_sWhitespaces); + } +} + ::rtl::OUString lcl_createAttribute(const xmloff::token::XMLTokenEnum& _eNamespace,const xmloff::token::XMLTokenEnum& _eAttribute) { ::rtl::OUStringBuffer sQName; @@ -171,6 +181,7 @@ const uno::Sequence< ::rtl::OUString > aDetailFields = m_xDatabaseDataProvider->getDetailFields(); if ( aDetailFields.getLength() ) { + lcl_exportPrettyPrinting(m_xDelegatee); m_xDelegatee->startElement(lcl_createAttribute(XML_NP_RPT,XML_MASTER_DETAIL_FIELDS),NULL); const uno::Sequence< ::rtl::OUString > aMasterFields = m_xDatabaseDataProvider->getMasterFields(); OSL_ENSURE(aDetailFields.getLength() == aMasterFields.getLength(),"not equal length for master and detail fields!"); @@ -187,16 +198,20 @@ pList->AddAttribute( sMasterToken , *pIter ); if ( pDetailFieldsIter->getLength() ) pList->AddAttribute( sDetailToken , *pDetailFieldsIter ); + lcl_exportPrettyPrinting(m_xDelegatee); m_xDelegatee->startElement(sElementToken,xNewAttribs); + lcl_exportPrettyPrinting(m_xDelegatee); + m_xDelegatee->endElement(sElementToken); } + lcl_exportPrettyPrinting(m_xDelegatee); + m_xDelegatee->endElement(lcl_createAttribute(XML_NP_RPT,XML_MASTER_DETAIL_FIELDS)); } bExport = false; } else if ( _sName.equalsAscii("table:table") ) { m_xDelegatee->startElement(lcl_createAttribute(XML_NP_RPT,XML_DETAIL),NULL); - static const ::rtl::OUString s_sWhitespaces(RTL_CONSTASCII_USTRINGPARAM(" ")); - m_xDelegatee->ignorableWhitespace(s_sWhitespaces); + lcl_exportPrettyPrinting(m_xDelegatee); } else if ( _sName.equalsAscii("table:table-rows") ) m_bTableRowsStarted = true; @@ -226,32 +241,19 @@ if ( bExport ) m_xDelegatee->startElement(_sName,xAttribs); } - +// ----------------------------------------------------------------------------- void SAL_CALL ExportDocumentHandler::endElement(const ::rtl::OUString & _sName) throw (uno::RuntimeException, xml::sax::SAXException) { bool bExport = true; ::rtl::OUString sNewName = _sName; if ( _sName.equalsAscii("office:chart") ) { - const uno::Sequence< ::rtl::OUString > aDetailFields = m_xDatabaseDataProvider->getDetailFields(); - if ( aDetailFields.getLength() ) - { - const uno::Sequence< ::rtl::OUString > aMasterFields = m_xDatabaseDataProvider->getMasterFields(); - OSL_ENSURE(aDetailFields.getLength() == aMasterFields.getLength(),"not equal length for master and detail fields!"); - const ::rtl::OUString* pIter = aMasterFields.getConstArray(); - const ::rtl::OUString* pEnd = pIter + aMasterFields.getLength(); - for(;pIter != pEnd;++pIter) - m_xDelegatee->endElement(lcl_createAttribute(XML_NP_RPT,XML_MASTER_DETAIL_FIELD)); - m_xDelegatee->endElement(lcl_createAttribute(XML_NP_RPT,XML_MASTER_DETAIL_FIELDS)); - } - sNewName = lcl_createAttribute(XML_NP_OFFICE,XML_REPORT); } else if ( _sName.equalsAscii("table:table") ) { m_xDelegatee->endElement(_sName); - static const ::rtl::OUString s_sWhitespaces(RTL_CONSTASCII_USTRINGPARAM(" ")); - m_xDelegatee->ignorableWhitespace(s_sWhitespaces); + lcl_exportPrettyPrinting(m_xDelegatee); sNewName = lcl_createAttribute(XML_NP_RPT,XML_DETAIL); } else if ( _sName.equalsAscii("table:table-rows") ) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
