[Libreoffice-commits] .: xmloff/source
Joseph Powers
jpowers at kemper.freedesktop.org
Sun Dec 26 08:12:13 PST 2010
xmloff/source/draw/sdxmlexp.cxx | 133 ++++++++++++++---------------------
xmloff/source/draw/sdxmlexp_impl.hxx | 10 +-
2 files changed, 60 insertions(+), 83 deletions(-)
New commits:
commit 7b3fa424f751894fa623af133e57150581db33af
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sun Dec 26 08:08:17 2010 -0800
Remove DECLARE_LIST(ImpXMLEXPPageMasterList, ImpXMLEXPPageMasterInfo*)
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index efdb134..9a94dd4 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -204,8 +204,6 @@ void ImpXMLEXPPageMasterInfo::SetName(const OUString& rStr)
msName = rStr;
}
-DECLARE_LIST(ImpXMLEXPPageMasterList, ImpXMLEXPPageMasterInfo*)
-
//////////////////////////////////////////////////////////////////////////////
#define IMP_AUTOLAYOUT_INFO_MAX (35L)
@@ -410,7 +408,7 @@ 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 ),
@@ -418,9 +416,9 @@ 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)),
mpSdPropHdlFactory(0L),
@@ -627,29 +625,29 @@ 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(
GetXMLToken(XML_NP_DRAW_EXT),
- GetXMLToken(XML_N_DRAW_EXT),
+ GetXMLToken(XML_N_DRAW_EXT),
XML_NAMESPACE_DRAW_EXT);
}
@@ -715,24 +713,29 @@ 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)
{
@@ -742,7 +745,7 @@ SdXMLExport::~SdXMLExport()
mpAutoLayoutInfoList = 0L;
}
-// #82003# status indicator stop is called exclusively
+// #82003# status indicator stop is called exclusively
// from SdXMLFilter::Export() now.
//
// stop progress view
@@ -805,35 +808,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())
@@ -1288,19 +1262,19 @@ void SdXMLExport::ImpWriteAutoLayoutInfos()
{
Rectangle aTopLeft(pInfo->GetPresRectangle());
aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
- aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.322));
+ aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.322));
Rectangle aTopCenter(aTopLeft);
aTopCenter.Left() = long(aTopCenter.Left() + aTopCenter.GetWidth() * 1.05);
Rectangle aTopRight(aTopLeft);
aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 2 * 1.05);
-
+
Rectangle aBottomLeft(aTopLeft);
aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
Rectangle aBottomCenter(aTopCenter);
aBottomCenter.Top() = long(aBottomCenter.Top() + aBottomCenter.GetHeight() * 1.095);
Rectangle aBottomRight(aTopRight);
aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
-
+
ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter);
@@ -1379,19 +1353,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;
}
@@ -1423,7 +1398,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())
@@ -1438,7 +1413,7 @@ void SdXMLExport::ImpPrepPageMasterInfos()
pNewInfo = ImpGetOrCreatePageMasterInfo(xNotesPage);
}
}
- mpNotesPageMasterUsageList->Insert( pNewInfo, LIST_APPEND );
+ mpNotesPageMasterUsageList->push_back( pNewInfo );
}
}
}
@@ -1449,9 +1424,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
@@ -1510,11 +1485,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()))
@@ -1618,7 +1593,7 @@ HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( cons
HeaderFooterPageSettingsImpl aSettings;
if( xDrawPage.is() ) try
- {
+ {
Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
@@ -1721,7 +1696,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 ) );
@@ -1824,7 +1799,7 @@ void SdXMLExport::ImpPrepMasterPageInfos()
{
Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
if( xHandoutSupp.is() )
- {
+ {
Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
if( xHandoutPage.is() )
{
@@ -1920,7 +1895,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
@@ -1933,7 +1908,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()) );
}
}
@@ -2563,15 +2538,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();
@@ -2580,7 +2555,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
@@ -2606,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();
@@ -2625,7 +2600,7 @@ void SdXMLExport::_ExportMasterStyles()
}
}
}
- exportAnnotations( xMasterPage );
+ exportAnnotations( xMasterPage );
}
}
}
@@ -2651,7 +2626,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)
{
@@ -2760,7 +2735,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()) )
{
@@ -2814,7 +2789,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
{
@@ -2982,7 +2957,7 @@ OUString SAL_CALL SdXMLExport::getImplementationName() throw( uno::RuntimeExcept
return XMLImpressMetaExportOasis_getImplementationName();
case EXPORT_OASIS|EXPORT_SETTINGS:
return XMLImpressSettingsExportOasis_getImplementationName();
-
+
default:
return XMLImpressExportOOO_getImplementationName();
}
diff --git a/xmloff/source/draw/sdxmlexp_impl.hxx b/xmloff/source/draw/sdxmlexp_impl.hxx
index 05db01c..621b184 100644
--- a/xmloff/source/draw/sdxmlexp_impl.hxx
+++ b/xmloff/source/draw/sdxmlexp_impl.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* 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
@@ -31,13 +31,14 @@
#include <xmloff/xmlexp.hxx>
-
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <comphelper/stl_types.hxx>
+#include <vector>
+
//////////////////////////////////////////////////////////////////////////////
class SvXMLUnitConverter;
@@ -49,7 +50,6 @@ class OUStringsSort_Impl;
class Rectangle;
class ImpPresPageDrawStylePropMapper;
-class ImpXMLEXPPageMasterList;
class ImpXMLEXPPageMasterInfo;
class ImpXMLDrawPageInfoList;
class ImpXMLAutoLayoutInfoList;
@@ -59,6 +59,8 @@ class ImpXMLShapeStyleInfo;
class XMLShapeExportPropertyMapper;
class XMLPageExportPropertyMapper;
+typedef ::std::vector< ImpXMLEXPPageMasterInfo* > ImpXMLEXPPageMasterList;
+
//////////////////////////////////////////////////////////////////////////////
enum XmlPlaceholder
@@ -193,7 +195,7 @@ protected:
public:
// #110680#
- SdXMLExport(
+ SdXMLExport(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
sal_Bool bIsDraw, sal_uInt16 nExportFlags = EXPORT_ALL );
virtual ~SdXMLExport();
More information about the Libreoffice-commits
mailing list