diff options
Diffstat (limited to 'xmloff/source/core/xmlexp.cxx')
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 114 |
1 files changed, 28 insertions, 86 deletions
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index ae1a7f7001..614a2e57c5 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -78,7 +79,7 @@ #include "xmloff/XMLFilterServiceNames.h" #include "xmloff/XMLEmbeddedObjectExportFilter.hxx" #include "XMLBasicExportFilter.hxx" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <rtl/logfile.hxx> #include <cppuhelper/implbase1.hxx> #include <comphelper/extract.hxx> @@ -112,10 +113,8 @@ using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::io; using namespace ::xmloff::token; -sal_Char __READONLY_DATA sXML_1_1[] = "1.1"; -sal_Char __READONLY_DATA sXML_1_2[] = "1.2"; - -const sal_Char *sOpenOfficeOrgProject ="OpenOffice.org_project"; +sal_Char const sXML_1_1[] = "1.1"; +sal_Char const sXML_1_2[] = "1.2"; const sal_Char s_grddl_xsl[] = "http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl"; @@ -269,12 +268,9 @@ public: uno::Reference< uri::XUriReferenceFactory > mxUriReferenceFactory; rtl::OUString msPackageURI; rtl::OUString msPackageURIScheme; - // --> OD 2006-09-27 #i69627# + // Written OpenDocument file format doesn't fit to the created text document (#i69627#) sal_Bool mbOutlineStyleAsNormalListStyle; - // <-- - // --> PB 2007-07-06 #i146851# sal_Bool mbSaveBackwardCompatibleODF; - // <-- uno::Reference< embed::XStorage > mxTargetStorage; @@ -296,9 +292,7 @@ public: ::std::auto_ptr< ::xmloff::RDFaExportHelper> mpRDFaHelper; - // --> OD 2008-11-26 #158694# sal_Bool mbExportTextNumberElement; - // <-- sal_Bool mbNullDateInitialized; void SetSchemeOf( const ::rtl::OUString& rOrigFileName ) @@ -310,20 +304,15 @@ public: }; SvXMLExport_Impl::SvXMLExport_Impl() - // --> OD 2006-09-27 #i69627# + // Written OpenDocument file format doesn't fit to the created text document (#i69627#) : mbOutlineStyleAsNormalListStyle( false ) - // <-- - // --> PB 2007-07-06 #i146851# ,mbSaveBackwardCompatibleODF( sal_True ) - // <-- ,mxComponentContext( ::comphelper::getProcessComponentContext() ) ,mStreamName() ,mNamespaceMaps() ,mDepth(0) ,mpRDFaHelper() // lazy - // --> OD 2008-11-26 #158694# ,mbExportTextNumberElement( sal_False ) - // <-- ,mbNullDateInitialized( sal_False ) { OSL_ENSURE(mxComponentContext.is(), "SvXMLExport: no ComponentContext"); @@ -409,6 +398,7 @@ void SvXMLExport::_InitCtor() mpNamespaceMap->Add( GetXMLToken(XML_NP_XSD), GetXMLToken(XML_N_XSD), XML_NAMESPACE_XSD ); mpNamespaceMap->Add( GetXMLToken(XML_NP_XSI), GetXMLToken(XML_N_XSI), XML_NAMESPACE_XSI ); mpNamespaceMap->Add( GetXMLToken(XML_NP_FIELD), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD ); + mpNamespaceMap->Add( GetXMLToken(XML_NP_FORMX), GetXMLToken(XML_N_FORMX), XML_NAMESPACE_FORMX ); } // RDFa: needed for content and header/footer styles if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 ) @@ -422,6 +412,12 @@ void SvXMLExport::_InitCtor() mpNamespaceMap->Add( GetXMLToken(XML_NP_GRDDL), GetXMLToken(XML_N_GRDDL), XML_NAMESPACE_GRDDL ); } + // CSS Text Level 3 for distributed text justification. + if ( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES)) != 0 ) + { + mpNamespaceMap->Add( + GetXMLToken(XML_NP_CSS3TEXT), GetXMLToken(XML_N_CSS3TEXT), XML_NAMESPACE_CSS3TEXT ); + } mxAttrList = (xml::sax::XAttributeList*)mpAttrList; @@ -436,14 +432,11 @@ void SvXMLExport::_InitCtor() mxModel->addEventListener(mxEventListener); } - // --> OD 2006-03-10 #i51726# - determine model type + // Determine model type (#i51726#) _DetermineModelType(); - // <-- mbEnableExperimentalOdfExport = getenv("ENABLE_EXPERIMENTAL_ODF_EXPORT") != NULL; - // --> PB 2007-07-06 #146851# - load mbSaveBackwardCompatibleODF from configuration - // cl: but only if we do export to current oasis format, old openoffice format *must* always be compatible if( (getExportFlags() & EXPORT_OASIS) != 0 ) { @@ -459,7 +452,7 @@ void SvXMLExport::_InitCtor() // <-- } -// --> OD 2006-03-14 #i51726# +// Shapes in Writer cannot be named via context menu (#i51726#) void SvXMLExport::_DetermineModelType() { meModelType = SvtModuleOptions::E_UNKNOWN_FACTORY; @@ -469,18 +462,14 @@ void SvXMLExport::_DetermineModelType() meModelType = SvtModuleOptions::ClassifyFactoryByModel( mxModel ); } } -// <-- -// #110680# SvXMLExport::SvXMLExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, MapUnit eDfltUnit, const enum XMLTokenEnum eClass, sal_uInt16 nExportFlags ) : mpImpl( new SvXMLExport_Impl ), - // #110680# mxServiceFactory(xServiceFactory), mpAttrList( new SvXMLAttributeList ), mpNamespaceMap( new SvXMLNamespaceMap ), - // #110680# mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, eDfltUnit, getServiceFactory() ) ), mpNumExport(0L), mpProgressBarHelper( NULL ), @@ -498,21 +487,18 @@ SvXMLExport::SvXMLExport( _InitCtor(); } -// #110680# SvXMLExport::SvXMLExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, const OUString &rFileName, const uno::Reference< xml::sax::XDocumentHandler > & rHandler, MapUnit eDfltUnit ) : mpImpl( new SvXMLExport_Impl ), - // #110680# mxServiceFactory(xServiceFactory), mxHandler( rHandler ), mxExtHandler( rHandler, uno::UNO_QUERY ), mpAttrList( new SvXMLAttributeList ), msOrigFileName( rFileName ), mpNamespaceMap( new SvXMLNamespaceMap ), - // #110680# mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, eDfltUnit, getServiceFactory() ) ), mpNumExport(0L), mpProgressBarHelper( NULL ), @@ -534,7 +520,6 @@ SvXMLExport::SvXMLExport( mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier); } -// #110680# SvXMLExport::SvXMLExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, const OUString &rFileName, @@ -542,7 +527,6 @@ SvXMLExport::SvXMLExport( const Reference< XModel >& rModel, sal_Int16 eDfltUnit ) : mpImpl( new SvXMLExport_Impl ), - // #110680# mxServiceFactory(xServiceFactory), mxModel( rModel ), mxHandler( rHandler ), @@ -551,8 +535,6 @@ SvXMLExport::SvXMLExport( mpAttrList( new SvXMLAttributeList ), msOrigFileName( rFileName ), mpNamespaceMap( new SvXMLNamespaceMap ), - // #110680# - // pUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, SvXMLUnitConverter::GetMapUnit(eDfltUnit) ) ), mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, SvXMLUnitConverter::GetMapUnit(eDfltUnit), getServiceFactory() ) ), mpNumExport(0L), mpProgressBarHelper( NULL ), @@ -574,7 +556,6 @@ SvXMLExport::SvXMLExport( mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier); } -// #110680# SvXMLExport::SvXMLExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, const OUString &rFileName, @@ -583,7 +564,6 @@ SvXMLExport::SvXMLExport( const Reference< document::XGraphicObjectResolver >& rEmbeddedGraphicObjects, sal_Int16 eDfltUnit ) : mpImpl( new SvXMLExport_Impl ), - // #110680# mxServiceFactory(xServiceFactory), mxModel( rModel ), mxHandler( rHandler ), @@ -593,7 +573,6 @@ SvXMLExport::SvXMLExport( mpAttrList( new SvXMLAttributeList ), msOrigFileName( rFileName ), mpNamespaceMap( new SvXMLNamespaceMap ), - // #110680# mpUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, SvXMLUnitConverter::GetMapUnit(eDfltUnit), getServiceFactory() ) ), mpNumExport(0L), mpProgressBarHelper( NULL ), @@ -724,12 +703,10 @@ void SAL_CALL SvXMLExport::setSourceDocument( const uno::Reference< lang::XCompo } } - // --> PB 2007-07-06 #i146851# if ( mpImpl->mbSaveBackwardCompatibleODF ) mnExportFlags |= EXPORT_SAVEBACKWARDCOMPATIBLE; else mnExportFlags &= ~EXPORT_SAVEBACKWARDCOMPATIBLE; - // <-- // namespaces for user defined attributes Reference< XMultiServiceFactory > xFactory( mxModel, UNO_QUERY ); @@ -765,9 +742,8 @@ void SAL_CALL SvXMLExport::setSourceDocument( const uno::Reference< lang::XCompo } } - // --> OD 2006-03-10 #i51726# - determine model type + // Determine model type (#i51726#) _DetermineModelType(); - // <-- } // XInitialize @@ -857,7 +833,7 @@ void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArgumen } mpImpl->mStreamName = sName; // Note: may be empty (XSLT) - // --> OD 2006-09-26 #i69627# + // Written OpenDocument file format doesn't fit to the created text document (#i69627#) const ::rtl::OUString sOutlineStyleAsNormalListStyle( RTL_CONSTASCII_USTRINGPARAM("OutlineStyleAsNormalListStyle") ); if( xPropertySetInfo->hasPropertyByName( sOutlineStyleAsNormalListStyle ) ) @@ -865,13 +841,11 @@ void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArgumen uno::Any aAny = mxExportInfo->getPropertyValue( sOutlineStyleAsNormalListStyle ); aAny >>= (mpImpl->mbOutlineStyleAsNormalListStyle); } - // <-- OUString sTargetStorage( RTL_CONSTASCII_USTRINGPARAM("TargetStorage") ); if( xPropertySetInfo->hasPropertyByName( sTargetStorage ) ) mxExportInfo->getPropertyValue( sTargetStorage ) >>= mpImpl->mxTargetStorage; - // --> OD 2008-11-26 #158694# const ::rtl::OUString sExportTextNumberElement( RTL_CONSTASCII_USTRINGPARAM("ExportTextNumberElement") ); if( xPropertySetInfo->hasPropertyByName( sExportTextNumberElement ) ) @@ -879,7 +853,6 @@ void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArgumen uno::Any aAny = mxExportInfo->getPropertyValue( sExportTextNumberElement ); aAny >>= (mpImpl->mbExportTextNumberElement); } - // <-- } } @@ -950,8 +923,8 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue aSeq, e.Message, NULL ); } - // return true only if no error occured - return (GetErrorFlags() & (ERROR_DO_NOTHING|ERROR_ERROR_OCCURED)) == 0; + // return true only if no error occurred + return (GetErrorFlags() & (ERROR_DO_NOTHING|ERROR_ERROR_OCCURRED)) == 0; } void SAL_CALL SvXMLExport::cancel() throw(uno::RuntimeException) @@ -1240,19 +1213,6 @@ void SvXMLExport::ImplExportAutoStyles( sal_Bool ) SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_AUTOMATIC_STYLES, sal_True, sal_True ); -#if 0 - AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); - AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, XML_STYLES_HREF ); - AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); - AddAttribute( XML_NAMESPACE_XLINK, XML_ROLE, - pNamespaceMap->GetQNameByKey( XML_NAMESPACE_OFFICE, - GetXMLToken(XML_STYLESHEET)) ); - { - // <style:use-styles> - SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, - XML_USE_STYLES, sal_True, sal_True ); - } -#endif _ExportAutoStyles(); } } @@ -1267,19 +1227,6 @@ void SvXMLExport::ImplExportMasterStyles( sal_Bool ) _ExportMasterStyles(); } -#if 0 - AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); - AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, XML_AUTO_STYLES_HREF ); - AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); - AddAttribute( XML_NAMESPACE_XLINK, XML_ROLE, - pNamespaceMap->GetQNameByKey( XML_NAMESPACE_OFFICE, - GetXMLToken(XML_STYLESHEET) ) ); - { - // <style:use-styles> - SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, - XML_USE_STYLES, sal_True, sal_True ); - } -#endif } void SvXMLExport::ImplExportContent() @@ -1403,7 +1350,7 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) // get filter component Reference< xml::sax::XDocumentHandler > xTmpDocHandler( xFactory->createInstanceWithArguments( - OUString::createFromAscii("com.sun.star.comp.Oasis2OOoTransformer"), + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Oasis2OOoTransformer")), aArgs), UNO_QUERY); OSL_ENSURE( xTmpDocHandler.is(), "can't instantiate OASIS transformer component" ); @@ -2447,14 +2394,14 @@ void SvXMLExport::SetError( const Reference<XLocator>& rLocator ) { // allow multi-threaded access to the cancel() method - static ::vos::OMutex aMutex; - ::vos::OGuard aGuard(aMutex); + static osl::Mutex aMutex; + osl::MutexGuard aGuard(aMutex); // maintain error flags if ( ( nId & XMLERROR_FLAG_ERROR ) != 0 ) - mnErrorFlags |= ERROR_ERROR_OCCURED; + mnErrorFlags |= ERROR_ERROR_OCCURRED; if ( ( nId & XMLERROR_FLAG_WARNING ) != 0 ) - mnErrorFlags |= ERROR_WARNING_OCCURED; + mnErrorFlags |= ERROR_WARNING_OCCURRED; if ( ( nId & XMLERROR_FLAG_SEVERE ) != 0 ) mnErrorFlags |= ERROR_DO_NOTHING; @@ -2483,16 +2430,13 @@ XMLErrors* SvXMLExport::GetErrors() void SvXMLExport::DisposingModel() { mxModel.clear(); - // --> OD 2006-03-13 #i51726# + // Shapes in Writer cannot be named via context menu (#i51726#) meModelType = SvtModuleOptions::E_UNKNOWN_FACTORY;; - // <-- mxEventListener.clear(); } -// #110680# ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SvXMLExport::getServiceFactory() { - // #110680# return mxServiceFactory; } @@ -2507,12 +2451,11 @@ SvXMLExport::GetComponentContext() const return mpImpl->maInterfaceToIdentifierMapper; } -// --> OD 2006-09-27 #i69627# +// Written OpenDocument file format doesn't fit to the created text document (#i69627#) sal_Bool SvXMLExport::writeOutlineStyleAsNormalListStyle() const { return mpImpl->mbOutlineStyleAsNormalListStyle; } -// <-- uno::Reference< embed::XStorage > SvXMLExport::GetTargetStorage() { @@ -2589,7 +2532,7 @@ SvXMLExport::AddAttributeXmlId(uno::Reference<uno::XInterface> const & i_xIfc) // a) just omit styles.xml ids -- they are unlikely anyway... // b) somehow find out whether we are currently exporting styles // or content, and prefix "s" or "c" => unique - if ( mdref.First.equalsAscii("content.xml") ) + if ( mdref.First.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("content.xml")) ) { AddAttribute( XML_NAMESPACE_XML, XML_ID, mdref.Second ); } @@ -2628,12 +2571,10 @@ SvXMLExport::AddAttributesRDFa( mpImpl->mpRDFaHelper->AddRDFa(xMeta); } -// --> OD 2008-11-26 #158694# sal_Bool SvXMLExport::exportTextNumberElement() const { return mpImpl->mbExportTextNumberElement; } -// <-- sal_Bool SvXMLExport::SetNullDateOnUnitConverter() { @@ -2757,3 +2698,4 @@ SvXMLElementExport::~SvXMLElementExport() } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |