diff options
Diffstat (limited to 'xmloff/source/draw/sdxmlexp.cxx')
-rw-r--r-- | xmloff/source/draw/sdxmlexp.cxx | 169 |
1 files changed, 72 insertions, 97 deletions
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 002a7a1368..fd368ef4ae 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -1,10 +1,11 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2000, 2010 Oracle and/or its affiliates. * - * OpenOffice.org - a multi-platform office productivity suite + * Copyright 2000, 2010 Oracle and/or its affiliates. * * This file is part of OpenOffice.org. * @@ -68,9 +69,7 @@ #include <com/sun/star/beans/XPropertyState.hpp> #include "xexptran.hxx" -#ifndef _CPPUHELPER_IMPLBASE1_HXX #include <cppuhelper/implbase1.hxx> -#endif #include <comphelper/extract.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include "PropertySetMerger.hxx" @@ -205,8 +204,6 @@ void ImpXMLEXPPageMasterInfo::SetName(const OUString& rStr) msName = rStr; } -DECLARE_LIST(ImpXMLEXPPageMasterList, ImpXMLEXPPageMasterInfo*) - ////////////////////////////////////////////////////////////////////////////// #define IMP_AUTOLAYOUT_INFO_MAX (35L) @@ -406,12 +403,10 @@ ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterI maPresRect.SetSize(aLayoutSize); } -DECLARE_LIST(ImpXMLAutoLayoutInfoList, ImpXMLAutoLayoutInfo*) - ////////////////////////////////////////////////////////////////////////////// // #110680# -SdXMLExport::SdXMLExport( +SdXMLExport::SdXMLExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, sal_Bool bIsDraw, sal_uInt16 nExportFlags ) : SvXMLExport( xServiceFactory, MAP_CM, bIsDraw ? XML_DRAWING : XML_PRESENTATION, nExportFlags ), @@ -419,11 +414,11 @@ SdXMLExport::SdXMLExport( mnDocDrawPageCount(0L), mnShapeStyleInfoIndex(0L), mnObjectCount(0L), - mpPageMasterInfoList(new ImpXMLEXPPageMasterList(1, 4, 4)), - mpPageMasterUsageList(new ImpXMLEXPPageMasterList(1, 4, 4)), - mpNotesPageMasterUsageList(new ImpXMLEXPPageMasterList(1, 4, 4)), + mpPageMasterInfoList(new ImpXMLEXPPageMasterList()), + mpPageMasterUsageList(new ImpXMLEXPPageMasterList()), + mpNotesPageMasterUsageList(new ImpXMLEXPPageMasterList()), mpHandoutPageMaster(NULL), - mpAutoLayoutInfoList(new ImpXMLAutoLayoutInfoList(1, 4, 4)), + mpAutoLayoutInfoList(new ImpXMLAutoLayoutInfoList()), mpSdPropHdlFactory(0L), mpPropertySetMapper(0L), mpPresPagePropsMapper(0L), @@ -628,24 +623,24 @@ void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent // add namespaces _GetNamespaceMap().Add( GetXMLToken(XML_NP_PRESENTATION), - GetXMLToken(XML_N_PRESENTATION), + GetXMLToken(XML_N_PRESENTATION), XML_NAMESPACE_PRESENTATION); _GetNamespaceMap().Add( GetXMLToken(XML_NP_SMIL), - GetXMLToken(XML_N_SMIL_COMPAT), + GetXMLToken(XML_N_SMIL_COMPAT), XML_NAMESPACE_SMIL); _GetNamespaceMap().Add( GetXMLToken(XML_NP_ANIMATION), - GetXMLToken(XML_N_ANIMATION), + GetXMLToken(XML_N_ANIMATION), XML_NAMESPACE_ANIMATION); if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) { _GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE_EXT), - GetXMLToken(XML_N_OFFICE_EXT), + GetXMLToken(XML_N_OFFICE_EXT), XML_NAMESPACE_OFFICE_EXT); _GetNamespaceMap().Add( @@ -692,7 +687,7 @@ sal_uInt32 SdXMLExport::ImpRecursiveObjectCount(Reference< drawing::XShapes > xS ////////////////////////////////////////////////////////////////////////////// -__EXPORT SdXMLExport::~SdXMLExport() +SdXMLExport::~SdXMLExport() { // cleanup factory, decrease refcount. Should lead to destruction. if(mpSdPropHdlFactory) @@ -716,34 +711,40 @@ __EXPORT SdXMLExport::~SdXMLExport() } // clear evtl. temporary page master infos - if(mpPageMasterInfoList) - { - while(mpPageMasterInfoList->Count()) - delete mpPageMasterInfoList->Remove(mpPageMasterInfoList->Count() - 1L); - delete mpPageMasterInfoList; - mpPageMasterInfoList = 0L; - } if(mpPageMasterUsageList) { + // note: all items in this list are also in mpPageMasterInfoList delete mpPageMasterUsageList; mpPageMasterUsageList = 0L; } + if(mpNotesPageMasterUsageList) { + // note: all items in this list are also in mpPageMasterInfoList delete mpNotesPageMasterUsageList; mpNotesPageMasterUsageList = 0L; } + if(mpPageMasterInfoList) + { + for ( size_t i = 0, n = mpPageMasterInfoList->size(); i < n; ++i ) + delete mpPageMasterInfoList->at( i ); + mpPageMasterInfoList->clear(); + delete mpPageMasterInfoList; + mpPageMasterInfoList = 0L; + } + // clear auto-layout infos if(mpAutoLayoutInfoList) { - while(mpAutoLayoutInfoList->Count()) - delete mpAutoLayoutInfoList->Remove(mpAutoLayoutInfoList->Count() - 1L); + for ( size_t i = 0, n = mpAutoLayoutInfoList->size(); i < n; ++i ) + delete mpAutoLayoutInfoList->at( i ); + mpAutoLayoutInfoList->clear(); delete mpAutoLayoutInfoList; mpAutoLayoutInfoList = 0L; } -// #82003# status indicator stop is called exclusively +// #82003# status indicator stop is called exclusively // from SdXMLFilter::Export() now. // // stop progress view @@ -806,35 +807,6 @@ void SAL_CALL ImpDefaultMapper::removeVetoableChangeListener( const OUString&, c ////////////////////////////////////////////////////////////////////////////// -/* moved to shapeexport.cxx -void SdXMLExport::ImpWriteObjGraphicStyleInfos() -{ - XMLStyleExport aStEx(*this, OUString(), GetAutoStylePool().get()); - const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPropertySetMapper() ); - - // write graphic family default style - Reference< lang::XMultiServiceFactory > xFact( GetModel(), UNO_QUERY ); - if( xFact.is() ) - { - try - { - Reference< beans::XPropertySet > xDefaults( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults") ) ), UNO_QUERY ); - if( xDefaults.is() ) - { - aStEx.exportDefaultStyle( xDefaults, OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), aMapperRef ); - - // write graphic family styles - aStEx.exportStyleFamily(XML_STYLE_FAMILY_SD_GRAPHICS_NAME, OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), aMapperRef, FALSE, XML_STYLE_FAMILY_SD_GRAPHICS_ID); - } - } - catch( lang::ServiceNotRegisteredException& ) - { - } - } -} -*/ -////////////////////////////////////////////////////////////////////////////// - void SdXMLExport::ImpPrepAutoLayoutInfos() { if(IsImpress()) @@ -905,21 +877,21 @@ BOOL SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUStr ImpXMLAutoLayoutInfo* pNew = new ImpXMLAutoLayoutInfo(nType, pInfo); BOOL bDidExist(FALSE); - for(sal_uInt32 nCnt = 0L; !bDidExist && nCnt < mpAutoLayoutInfoList->Count(); nCnt++) + for( size_t nCnt = 0; !bDidExist && nCnt < mpAutoLayoutInfoList->size(); nCnt++) { - if(*mpAutoLayoutInfoList->GetObject(nCnt) == *pNew) + if( *mpAutoLayoutInfoList->at( nCnt ) == *pNew) { delete pNew; - pNew = mpAutoLayoutInfoList->GetObject(nCnt); + pNew = mpAutoLayoutInfoList->at( nCnt ); bDidExist = TRUE; } } if(!bDidExist) { - mpAutoLayoutInfoList->Insert(pNew, LIST_APPEND); + mpAutoLayoutInfoList->push_back( pNew ); OUString sNewName = OUString(RTL_CONSTASCII_USTRINGPARAM("AL")); - sNewName += OUString::valueOf(sal_Int32(mpAutoLayoutInfoList->Count() - 1)); + sNewName += OUString::valueOf(sal_Int32( mpAutoLayoutInfoList->size() - 1 )); sNewName += OUString(RTL_CONSTASCII_USTRINGPARAM("T")); sNewName += OUString::valueOf(sal_Int32(nType)); pNew->SetLayoutName(sNewName); @@ -938,11 +910,11 @@ BOOL SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUStr void SdXMLExport::ImpWriteAutoLayoutInfos() { - if(mpAutoLayoutInfoList->Count()) + if( !mpAutoLayoutInfoList->empty() ) { - for(sal_uInt32 nCnt = 0L; nCnt < mpAutoLayoutInfoList->Count(); nCnt++) + for(size_t nCnt = 0; nCnt < mpAutoLayoutInfoList->size(); nCnt++) { - ImpXMLAutoLayoutInfo* pInfo = mpAutoLayoutInfoList->GetObject(nCnt); + ImpXMLAutoLayoutInfo* pInfo = mpAutoLayoutInfoList->at( nCnt ); if(pInfo) { // prepare presentation-page layout attributes, style-name @@ -1380,19 +1352,20 @@ ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetOrCreatePageMasterInfo( Reference< X ImpXMLEXPPageMasterInfo* pNewInfo = new ImpXMLEXPPageMasterInfo(*this, xMasterPage); // compare with prev page-master infos - for(sal_uInt32 a = 0; !bDoesExist && a < mpPageMasterInfoList->Count(); a++) + for( size_t a = 0; !bDoesExist && a < mpPageMasterInfoList->size(); a++) { - if(mpPageMasterInfoList->GetObject(a) - && *mpPageMasterInfoList->GetObject(a) == *pNewInfo) + if ( mpPageMasterInfoList->at(a) + && *mpPageMasterInfoList->at(a) == *pNewInfo + ) { delete pNewInfo; - pNewInfo = mpPageMasterInfoList->GetObject(a); + pNewInfo = mpPageMasterInfoList->at(a); bDoesExist = true; } } // add entry when not found same page-master infos if(!bDoesExist) - mpPageMasterInfoList->Insert(pNewInfo, LIST_APPEND); + mpPageMasterInfoList->push_back( pNewInfo ); return pNewInfo; } @@ -1424,7 +1397,7 @@ void SdXMLExport::ImpPrepPageMasterInfos() if(xMasterPage.is()) pNewInfo = ImpGetOrCreatePageMasterInfo(xMasterPage); - mpPageMasterUsageList->Insert(pNewInfo, LIST_APPEND); + mpPageMasterUsageList->push_back( pNewInfo ); // look for page master of handout page if(IsImpress()) @@ -1439,7 +1412,7 @@ void SdXMLExport::ImpPrepPageMasterInfos() pNewInfo = ImpGetOrCreatePageMasterInfo(xNotesPage); } } - mpNotesPageMasterUsageList->Insert( pNewInfo, LIST_APPEND ); + mpNotesPageMasterUsageList->push_back( pNewInfo ); } } } @@ -1450,9 +1423,9 @@ void SdXMLExport::ImpPrepPageMasterInfos() void SdXMLExport::ImpWritePageMasterInfos() { // write created page-masters, create names for these - for(sal_uInt32 nCnt = 0L; nCnt < mpPageMasterInfoList->Count(); nCnt++) + for( size_t nCnt = 0; nCnt < mpPageMasterInfoList->size(); nCnt++) { - ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->GetObject(nCnt); + ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->at(nCnt); if(pInfo) { // create name @@ -1511,11 +1484,11 @@ void SdXMLExport::ImpWritePageMasterInfos() ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetPageMasterInfoByName(const OUString& rName) { - if(rName.getLength() && mpPageMasterInfoList->Count()) + if(rName.getLength() && !mpPageMasterInfoList->empty()) { - for(sal_uInt32 nCnt = 0L; nCnt < mpPageMasterInfoList->Count(); nCnt++) + for( size_t nCnt = 0; nCnt < mpPageMasterInfoList->size(); nCnt++) { - ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->GetObject(nCnt); + ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->at(nCnt); if(pInfo) { if(pInfo->GetMasterPageName().getLength() && rName.equals(pInfo->GetMasterPageName())) @@ -1561,7 +1534,7 @@ static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUStri // search rVector if there is already a string that equals rText std::vector< OUString >::iterator aIter; sal_Int32 nIndex; - for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); aIter++, nIndex++ ) + for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); ++aIter, ++nIndex ) { if( (*aIter) == rText ) break; @@ -1583,7 +1556,7 @@ static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, cons // search rVector if there is already a DateTimeDeclImpl with rText,bFixed and nFormat std::vector< DateTimeDeclImpl >::iterator aIter; sal_Int32 nIndex; - for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); aIter++, nIndex++ ) + for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); ++aIter, ++nIndex ) { const DateTimeDeclImpl& rDecl = (*aIter); if( (rDecl.mbFixed == bFixed ) && @@ -1619,7 +1592,7 @@ HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( cons HeaderFooterPageSettingsImpl aSettings; if( xDrawPage.is() ) try - { + { Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW ); Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() ); @@ -1679,7 +1652,7 @@ void SdXMLExport::ImpWriteHeaderFooterDecls() const OUString aPrefix( OUString::createFromAscii( gpStrHeaderTextPrefix ) ); std::vector< OUString >::iterator aIter; sal_Int32 nIndex; - for( nIndex = 1, aIter = maHeaderDeclsVector.begin(); aIter != maHeaderDeclsVector.end(); aIter++, nIndex++ ) + for( nIndex = 1, aIter = maHeaderDeclsVector.begin(); aIter != maHeaderDeclsVector.end(); ++aIter, ++nIndex ) { sBuffer.append( aPrefix ); sBuffer.append( nIndex ); @@ -1696,7 +1669,7 @@ void SdXMLExport::ImpWriteHeaderFooterDecls() const OUString aPrefix( OUString::createFromAscii( gpStrFooterTextPrefix ) ); std::vector< OUString >::iterator aIter; sal_Int32 nIndex; - for( nIndex = 1, aIter = maFooterDeclsVector.begin(); aIter != maFooterDeclsVector.end(); aIter++, nIndex++ ) + for( nIndex = 1, aIter = maFooterDeclsVector.begin(); aIter != maFooterDeclsVector.end(); ++aIter, ++nIndex ) { sBuffer.append( aPrefix ); sBuffer.append( nIndex ); @@ -1713,7 +1686,7 @@ void SdXMLExport::ImpWriteHeaderFooterDecls() const OUString aPrefix( OUString::createFromAscii( gpStrDateTimeTextPrefix ) ); std::vector< DateTimeDeclImpl >::iterator aIter; sal_Int32 nIndex; - for( nIndex = 1, aIter = maDateTimeDeclsVector.begin(); aIter != maDateTimeDeclsVector.end(); aIter++, nIndex++ ) + for( nIndex = 1, aIter = maDateTimeDeclsVector.begin(); aIter != maDateTimeDeclsVector.end(); ++aIter, ++nIndex ) { const DateTimeDeclImpl& rDecl = (*aIter); @@ -1722,7 +1695,7 @@ void SdXMLExport::ImpWriteHeaderFooterDecls() AddAttribute( XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear()); AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SOURCE, rDecl.mbFixed ? XML_FIXED : XML_CURRENT_DATE ); - + if( !rDecl.mbFixed ) AddAttribute( XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, getDataStyleName( rDecl.mnFormat ) ); @@ -1825,7 +1798,7 @@ void SdXMLExport::ImpPrepMasterPageInfos() { Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY ); if( xHandoutSupp.is() ) - { + { Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() ); if( xHandoutPage.is() ) { @@ -1882,7 +1855,7 @@ void SdXMLExport::SetProgress(sal_Int32 nProg) void SdXMLExport::_ExportMeta() { uno::Sequence<beans::NamedValue> stats(1); - stats[0] = beans::NamedValue(::rtl::OUString::createFromAscii("ObjectCount"), + stats[0] = beans::NamedValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ObjectCount" )), uno::makeAny(mnObjectCount)); // update document statistics at the model @@ -1921,7 +1894,7 @@ void SdXMLExport::_ExportContent() // draw:style-name (presentation page attributes AND background attributes) if( maDrawPagesStyleNames[nPageInd].getLength() ) - AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, + AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maDrawPagesStyleNames[nPageInd]); // draw:master-page-name @@ -1934,7 +1907,7 @@ void SdXMLExport::_ExportContent() Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY); if(xMasterNamed.is()) { - AddAttribute(XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME, + AddAttribute(XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME, EncodeStyleName( xMasterNamed->getName()) ); } } @@ -2566,15 +2539,15 @@ void SdXMLExport::_ExportMasterStyles() { sal_Bool bEncoded = sal_False; sMasterPageName = xNamed->getName(); - AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, + AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, EncodeStyleName( sMasterPageName, &bEncoded )); if( bEncoded ) - AddAttribute( + AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY_NAME, sMasterPageName ); } - ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterUsageList->GetObject(nMPageId); + ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterUsageList->at( nMPageId ); if(pInfo) { OUString sString = pInfo->GetName(); @@ -2583,7 +2556,7 @@ void SdXMLExport::_ExportMasterStyles() // draw:style-name (background attributes) if( maMasterPagesStyleNames[nMPageId].getLength() ) - AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, + AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maMasterPagesStyleNames[nMPageId]); // write masterpage @@ -2609,7 +2582,7 @@ void SdXMLExport::_ExportMasterStyles() Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY); if(xShapes.is()) { - ImpXMLEXPPageMasterInfo* pMasterInfo = mpNotesPageMasterUsageList->GetObject(nMPageId); + ImpXMLEXPPageMasterInfo* pMasterInfo = mpNotesPageMasterUsageList->at( nMPageId ); if(pMasterInfo) { OUString sString = pMasterInfo->GetName(); @@ -2628,7 +2601,7 @@ void SdXMLExport::_ExportMasterStyles() } } } - exportAnnotations( xMasterPage ); + exportAnnotations( xMasterPage ); } } } @@ -2654,7 +2627,7 @@ void SdXMLExport::exportFormsElement( Reference< XDrawPage > xDrawPage ) void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps) { - rProps.realloc(4); + rProps.realloc(4); beans::PropertyValue* pProps = rProps.getArray(); if(pProps) { @@ -2763,7 +2736,7 @@ OUString SdXMLExport::getNavigationOrder( const Reference< XDrawPage >& xDrawPag Reference< XIndexAccess > xNavOrder( xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NavigationOrder" ) ) ), UNO_QUERY_THROW ); Reference< XIndexAccess > xZOrderAccess( xDrawPage, UNO_QUERY ); - + // only export navigation order if it is different from the z-order if( (xNavOrder.get() != xZOrderAccess.get()) && (xNavOrder->getCount() == xDrawPage->getCount()) ) { @@ -2817,7 +2790,7 @@ void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage ) // do not export in ODF 1.2 or older if( getDefaultVersion() <= SvtSaveOptions::ODFVER_012 ) return; - + Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY ); if( xAnnotationAccess.is() ) try { @@ -2985,9 +2958,11 @@ OUString SAL_CALL SdXMLExport::getImplementationName() throw( uno::RuntimeExcept return XMLImpressMetaExportOasis_getImplementationName(); case EXPORT_OASIS|EXPORT_SETTINGS: return XMLImpressSettingsExportOasis_getImplementationName(); - + default: return XMLImpressExportOOO_getImplementationName(); } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |