diff options
Diffstat (limited to 'xmloff/source/draw/sdxmlexp.cxx')
-rw-r--r-- | xmloff/source/draw/sdxmlexp.cxx | 150 |
1 files changed, 59 insertions, 91 deletions
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 5accd0d2ba64..29db93ca8226 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.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. @@ -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" @@ -79,7 +78,6 @@ #include "xmloff/VisAreaExport.hxx" #include "XMLNumberStylesExport.hxx" -#include <tools/list.hxx> #include <tools/string.hxx> #include "animationexport.hxx" @@ -205,8 +203,6 @@ void ImpXMLEXPPageMasterInfo::SetName(const OUString& rStr) msName = rStr; } -DECLARE_LIST(ImpXMLEXPPageMasterList, ImpXMLEXPPageMasterInfo*) - ////////////////////////////////////////////////////////////////////////////// #define IMP_AUTOLAYOUT_INFO_MAX (35L) @@ -406,8 +402,6 @@ ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterI maPresRect.SetSize(aLayoutSize); } -DECLARE_LIST(ImpXMLAutoLayoutInfoList, ImpXMLAutoLayoutInfo*) - ////////////////////////////////////////////////////////////////////////////// // #110680# @@ -419,11 +413,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), @@ -692,7 +686,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,29 +710,35 @@ __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; } @@ -806,35 +806,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, sal_False, XML_STYLE_FAMILY_SD_GRAPHICS_ID); - } - } - catch( lang::ServiceNotRegisteredException& ) - { - } - } -} -*/ -////////////////////////////////////////////////////////////////////////////// - void SdXMLExport::ImpPrepAutoLayoutInfos() { if(IsImpress()) @@ -905,21 +876,21 @@ sal_Bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, O ImpXMLAutoLayoutInfo* pNew = new ImpXMLAutoLayoutInfo(nType, pInfo); sal_Bool bDidExist(sal_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 = sal_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 +909,11 @@ sal_Bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, O 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 @@ -1313,7 +1284,7 @@ void SdXMLExport::ImpWriteAutoLayoutInfos() } default: { - DBG_ERROR("XMLEXP: unknown autolayout export"); + OSL_FAIL("XMLEXP: unknown autolayout export"); break; } } @@ -1380,19 +1351,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 +1396,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 +1411,7 @@ void SdXMLExport::ImpPrepPageMasterInfos() pNewInfo = ImpGetOrCreatePageMasterInfo(xNotesPage); } } - mpNotesPageMasterUsageList->Insert( pNewInfo, LIST_APPEND ); + mpNotesPageMasterUsageList->push_back( pNewInfo ); } } } @@ -1450,9 +1422,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 +1483,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 +1533,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 +1555,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 ) && @@ -1661,7 +1633,7 @@ HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( cons catch( Exception& e ) { (void)e; - DBG_ERROR( "SdXMLExport::ImpPrepDrawPageHeaderFooterDecls(), unexpected exception cought!" ); + OSL_FAIL( "SdXMLExport::ImpPrepDrawPageHeaderFooterDecls(), unexpected exception cought!" ); } return aSettings; @@ -1679,7 +1651,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 +1668,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 +1685,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); @@ -1882,7 +1854,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 @@ -1975,7 +1947,7 @@ void SdXMLExport::_ExportContent() } catch( Exception& ) { - DBG_ERROR(" no \"BookmarkURL\" property at page?" ); + OSL_FAIL(" no \"BookmarkURL\" property at page?" ); } } @@ -2266,7 +2238,7 @@ void SdXMLExport::exportPresentationSettings() } catch( uno::Exception ) { - DBG_ERROR( "uno::Exception while exporting <presentation:settings>" ); + OSL_FAIL( "uno::Exception while exporting <presentation:settings>" ); } } @@ -2574,7 +2546,7 @@ void SdXMLExport::_ExportMasterStyles() sMasterPageName ); } - ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterUsageList->GetObject(nMPageId); + ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterUsageList->at( nMPageId ); if(pInfo) { OUString sString = pInfo->GetName(); @@ -2609,7 +2581,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(); @@ -2647,7 +2619,7 @@ void SdXMLExport::exportFormsElement( Reference< XDrawPage > xDrawPage ) if(! GetFormExport()->seekPage( xDrawPage ) ) { - DBG_ERROR( "OFormLayerXMLExport::seekPage failed!" ); + OSL_FAIL( "OFormLayerXMLExport::seekPage failed!" ); } } } @@ -2658,18 +2630,12 @@ void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps) beans::PropertyValue* pProps = rProps.getArray(); if(pProps) { -// SvXMLElementExport aViewSettingsElem(*this, XML_NAMESPACE_DRAW, XML_VIEW_SETTINGS, sal_True, sal_True); - Reference< beans::XPropertySet > xPropSet( GetModel(), UNO_QUERY ); if( !xPropSet.is() ) return; awt::Rectangle aVisArea; xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ) ) >>= aVisArea; -/* - sal_Int16 nMapUnit; - xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MapUnit" ) ) ) >>= nMapUnit; -*/ sal_uInt16 i = 0; pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaTop")); @@ -2808,7 +2774,7 @@ void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDraw } catch( Exception& ) { - DBG_ERROR("SdXMLExport::collectAnnotationAutoStyles(), exception caught during export of annotation auto styles"); + OSL_FAIL("SdXMLExport::collectAnnotationAutoStyles(), exception caught during export of annotation auto styles"); } } @@ -2875,7 +2841,7 @@ void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage ) } catch( Exception& ) { - DBG_ERROR("SdXMLExport::exportAnnotations(), exception caught during export of annotations"); + OSL_FAIL("SdXMLExport::exportAnnotations(), exception caught during export of annotations"); } } @@ -2991,3 +2957,5 @@ OUString SAL_CALL SdXMLExport::getImplementationName() throw( uno::RuntimeExcept } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |