[Libreoffice-commits] .: binfilter/bf_sfx2 binfilter/inc
Joseph Powers
jpowers at kemper.freedesktop.org
Mon Jan 17 06:28:48 PST 2011
binfilter/bf_sfx2/source/doc/sfx2_docfile.cxx | 50 +++++++++----------
binfilter/bf_sfx2/source/doc/sfx2_xmlversion.cxx | 58 +++++++++++------------
binfilter/inc/bf_sfx2/docfile.hxx | 31 +++++++-----
3 files changed, 71 insertions(+), 68 deletions(-)
New commits:
commit 2bdece8f2a19e85492194a57741fb26a268f3ffb
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sun Jan 16 21:45:40 2011 -0800
Remove DECLARE_LIST( _SfxVersionTable, SfxVersionInfo* )
diff --git a/binfilter/bf_sfx2/source/doc/sfx2_docfile.cxx b/binfilter/bf_sfx2/source/doc/sfx2_docfile.cxx
index f851992..375888a 100644
--- a/binfilter/bf_sfx2/source/doc/sfx2_docfile.cxx
+++ b/binfilter/bf_sfx2/source/doc/sfx2_docfile.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
@@ -1066,7 +1066,7 @@ namespace binfilter {
/*?*/ try
/*?*/ {
/*?*/ Any aAny = pImp->aContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsReadOnly" )) );
-/*?*/ BOOL bReadonly;
+/*?*/ BOOL bReadonly( false );
/*?*/ if ( ( aAny >>= bReadonly ) && bReadonly )
/*?*/ {
/*?*/ GetItemSet()->Put( SfxBoolItem(SID_DOC_READONLY, sal_True));
@@ -1811,7 +1811,7 @@ namespace binfilter {
/*N*/ BOOL bCopy = ( nStorOpenMode == nOpenMode && ! ( nOpenMode & STREAM_TRUNC ) );
/*N*/ nStorOpenMode = nOpenMode;
/*N*/ ResetError();
-/*N*/
+/*N*/
/*N*/ pImp->pTempFile = new ::utl::TempFile();
/*N*/ pImp->pTempFile->EnableKillingFile( sal_True );
/*N*/ aName = pImp->pTempFile->GetFileName();
@@ -1820,7 +1820,7 @@ namespace binfilter {
/*N*/ SetError( ERRCODE_IO_CANTWRITE );
/*N*/ return;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ if ( bCopy )
/*N*/ {
/*N*/ GetOutStream();
@@ -1828,17 +1828,17 @@ namespace binfilter {
/*N*/ {
/*N*/ char *pBuf = new char [8192];
/*N*/ sal_uInt32 nErr = ERRCODE_NONE;
-/*N*/
+/*N*/
/*N*/ pInStream->Seek(0);
/*N*/ pOutStream->Seek(0);
-/*N*/
+/*N*/
/*N*/ while( !pInStream->IsEof() && nErr == ERRCODE_NONE )
/*N*/ {
/*N*/ sal_uInt32 nRead = pInStream->Read( pBuf, 8192 );
/*N*/ nErr = pInStream->GetError();
/*N*/ pOutStream->Write( pBuf, nRead );
/*N*/ }
-/*N*/
+/*N*/
/*N*/ delete[] pBuf;
/*N*/ CloseInStream();
/*N*/ }
@@ -1846,7 +1846,7 @@ namespace binfilter {
/*N*/ }
/*N*/ else
/*?*/ CloseInStream();
-/*N*/
+/*N*/
/*N*/ CloseStorage();
/*N*/ }
@@ -1855,7 +1855,7 @@ namespace binfilter {
/*N*/ {
/*N*/ if ( pImp->pTempFile )
/*N*/ delete pImp->pTempFile;
-/*N*/
+/*N*/
/*N*/ pImp->pTempFile = new ::utl::TempFile();
/*N*/ pImp->pTempFile->EnableKillingFile( sal_True );
/*N*/ aName = pImp->pTempFile->GetFileName();
@@ -1864,7 +1864,7 @@ namespace binfilter {
/*?*/ SetError( ERRCODE_IO_CANTWRITE );
/*?*/ return;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ CloseOutStream_Impl();
/*N*/ CloseStorage();
/*N*/ }
@@ -1875,40 +1875,36 @@ namespace binfilter {
/*?*/ SvStream& SfxVersionTableDtor::Read( SvStream& rStrm )
/*?*/ {
/*?*/ sal_uInt16 nLclCount = 0, nVersion = 0;
-/*?*/
+/*?*/
/*?*/ rStrm >> nVersion;
/*?*/ rStrm >> nLclCount;
-/*?*/
+/*?*/
/*?*/ for( sal_uInt16 i=0; i<nLclCount; ++i )
/*?*/ {
/*?*/ SfxVersionInfo *pNew = new SfxVersionInfo;
/*?*/ rStrm.ReadByteString( pNew->aComment, RTL_TEXTENCODING_UTF8 );
/*?*/ rStrm.ReadByteString( pNew->aName, RTL_TEXTENCODING_UTF8 );
/*?*/ pNew->aCreateStamp.Load( rStrm );
-/*?*/ Insert( pNew, LIST_APPEND );
+/*?*/ maList.push_back( pNew );
/*?*/ }
-/*?*/
+/*?*/
/*?*/ return rStrm;
/*?*/ }
-/*N*/ void SfxVersionTableDtor::DelDtor()
-/*N*/ {
-/*N*/ SfxVersionInfo* pTmp = First();
-/*N*/ while( pTmp )
-/*N*/ {
-/*?*/ delete pTmp;
-/*?*/ pTmp = Next();
-/*N*/ }
-/*N*/ Clear();
-/*N*/ }
+void SfxVersionTableDtor::DelDtor()
+{
+ for ( size_t i = 0, n = maList.size(); i < n; ++i )
+ delete maList[ i ];
+ maList.clear();
+}
//----------------------------------------------------------------
//----------------------------------------------------------------
//----------------------------------------------------------------
-/*?*/ SfxVersionInfo::SfxVersionInfo()
-/*?*/ {
-/*?*/ }
+SfxVersionInfo::SfxVersionInfo()
+{
+}
}
diff --git a/binfilter/bf_sfx2/source/doc/sfx2_xmlversion.cxx b/binfilter/bf_sfx2/source/doc/sfx2_xmlversion.cxx
index 6c93462..192e9fa 100644
--- a/binfilter/bf_sfx2/source/doc/sfx2_xmlversion.cxx
+++ b/binfilter/bf_sfx2/source/doc/sfx2_xmlversion.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
@@ -48,7 +48,7 @@
#include <docfile.hxx>
-#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
#include <bf_xmloff/nmspmap.hxx>
@@ -69,7 +69,7 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
// ------------------------------------------------------------------------
// #110680#
-/*?*/ SfxXMLVersListImport_Impl::SfxXMLVersListImport_Impl(
+/*?*/ SfxXMLVersListImport_Impl::SfxXMLVersListImport_Impl(
/*?*/ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
/*?*/ SfxVersionTableDtor *pVersions )
/*?*/ : SvXMLImport(xServiceFactory),
@@ -90,7 +90,7 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*?*/ const Reference< XAttributeList > & xAttrList )
/*?*/ {
/*?*/ SvXMLImportContext *pContext = 0;
-/*?*/
+/*?*/
/*?*/ if ( XML_NAMESPACE_FRAMEWORK == nInPrefix &&
/*?*/ rLocalName.compareToAscii( sXML_version_list ) == 0 )
/*?*/ {
@@ -100,10 +100,10 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*?*/ {
/*?*/ pContext = SvXMLImport::CreateContext( nInPrefix, rLocalName, xAttrList );
/*?*/ }
-/*?*/
+/*?*/
/*?*/ return pContext;
/*?*/ }
-/*?*/
+/*?*/
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
@@ -127,7 +127,7 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*?*/ const Reference< XAttributeList > & xAttrList )
/*?*/ {
/*?*/ SvXMLImportContext *pContext = 0;
-/*?*/
+/*?*/
/*?*/ if ( nInPrefix == XML_NAMESPACE_FRAMEWORK &&
/*?*/ rLocalName.compareToAscii( sXML_version_entry ) == 0)
/*?*/ {
@@ -137,7 +137,7 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*?*/ {
/*?*/ pContext = new SvXMLImportContext( rLocalRef, nInPrefix, rLocalName );
/*?*/ }
-/*?*/
+/*?*/
/*?*/ return pContext;
/*?*/ }
@@ -152,18 +152,18 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*?*/ , rLocalRef( rInImport )
/*?*/ {
/*?*/ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-/*?*/
+/*?*/
/*?*/ if ( !nAttrCount )
/*?*/ return;
-/*?*/
+/*?*/
/*?*/ SfxVersionInfo *pInfo = new SfxVersionInfo;
-/*?*/
+/*?*/
/*?*/ for ( sal_Int16 i=0; i < nAttrCount; i++ )
/*?*/ {
/*?*/ OUString aLclLocalName;
/*?*/ const OUString& rAttrName = xAttrList->getNameByIndex( i );
/*?*/ sal_uInt16 nLclPrefix = rInImport.GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLclLocalName );
-/*?*/
+/*?*/
/*?*/ if ( XML_NAMESPACE_FRAMEWORK == nLclPrefix )
/*?*/ {
/*?*/ if ( aLclLocalName.compareToAscii( sXML_title ) == 0 )
@@ -191,9 +191,9 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*?*/ pInfo->aCreateStamp.SetTime( aTime );
/*?*/ }
/*?*/ }
-/*?*/
+/*?*/
/*?*/ SfxVersionTableDtor* pVersion = rLocalRef.GetList();
-/*?*/ pVersion->Insert( pInfo, LIST_APPEND );
+/*?*/ pVersion->push_back( pInfo );
/*?*/ }
@@ -208,7 +208,7 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*?*/ DateTime& rDateTime )
/*?*/ {
/*?*/ sal_Bool bSuccess = sal_True;
-/*?*/
+/*?*/
/*?*/ OUString aDateStr, aTimeStr;
/*?*/ sal_Int32 nPos = rString.indexOf( (sal_Unicode) 'T' );
/*?*/ if ( nPos >= 0 )
@@ -218,14 +218,14 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*?*/ }
/*?*/ else
/*?*/ aDateStr = rString; // no separator: only date part
-/*?*/
+/*?*/
/*?*/ sal_Int32 nYear = 0;
/*?*/ sal_Int32 nMonth = 1;
/*?*/ sal_Int32 nDay = 1;
/*?*/ sal_Int32 nHour = 0;
/*?*/ sal_Int32 nMin = 0;
/*?*/ sal_Int32 nSec = 0;
-/*?*/
+/*?*/
/*?*/ const sal_Unicode* pStr = aDateStr.getStr();
/*?*/ sal_Int32 nDateTokens = 1;
/*?*/ while ( *pStr )
@@ -255,7 +255,7 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*?*/ }
/*?*/ }
/*?*/ }
-/*?*/
+/*?*/
/*?*/ if ( bSuccess && aTimeStr.getLength() > 0 ) // time is optional
/*?*/ {
/*?*/ pStr = aTimeStr.getStr();
@@ -288,11 +288,11 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*?*/ }
/*?*/ }
/*?*/ }
-/*?*/
+/*?*/
/*?*/ if ( bSuccess )
/*?*/ rDateTime = DateTime( Date( (USHORT)nDay, (USHORT)nMonth, (USHORT)nYear ),
/*?*/ Time( nHour, nMin, nSec ) );
-/*?*/
+/*?*/
/*?*/ return bSuccess;
/*?*/ }
@@ -300,38 +300,38 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*N*/ sal_Bool SfxXMLVersList_Impl::ReadInfo( SvStorageRef xRoot, SfxVersionTableDtor *pList )
/*N*/ {
/*N*/ sal_Bool bRet = sal_False;
-/*N*/
+/*N*/
/*N*/ const OUString sDocName( RTL_CONSTASCII_USTRINGPARAM( XMLN_VERSIONSLIST ) );
-/*N*/
+/*N*/
/*N*/ if ( xRoot->IsContained ( sDocName ) )
/*N*/ {
/*?*/ Reference< lang::XMultiServiceFactory > xServiceFactory =
/*?*/ ::legacy_binfilters::getLegacyProcessServiceFactory();
/*?*/ DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" );
-/*?*/
+/*?*/
/*?*/ InputSource aParserInput;
/*?*/ aParserInput.sSystemId = xRoot->GetName();
-/*?*/
+/*?*/
/*?*/ SvStorageStreamRef xDocStream = xRoot->OpenStream( sDocName, STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE );
/*?*/ xDocStream->Seek( 0L );
/*?*/ xDocStream->SetBufferSize( 16*1024 );
/*?*/ aParserInput.aInputStream = new ::utl::OInputStreamWrapper( *xDocStream );
-/*?*/
+/*?*/
/*?*/ // get parser
/*?*/ Reference< XInterface > xXMLParser = xServiceFactory->createInstance(
/*?*/ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" )) );
/*?*/ DBG_ASSERT( xXMLParser.is(),
/*?*/ "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" );
-/*?*/
+/*?*/
/*?*/ // get filter
/*?*/ // #110680#
/*?*/ // Reference< XDocumentHandler > xFilter = new SfxXMLVersListImport_Impl( pList );
/*?*/ Reference< XDocumentHandler > xFilter = new SfxXMLVersListImport_Impl( xServiceFactory, pList );
-/*?*/
+/*?*/
/*?*/ // connect parser and filter
/*?*/ Reference< XParser > xParser( xXMLParser, UNO_QUERY );
/*?*/ xParser->setDocumentHandler( xFilter );
-/*?*/
+/*?*/
/*?*/ // parse
/*?*/ try
/*?*/ {
@@ -342,7 +342,7 @@ sal_Char XMLN_VERSIONSLIST[] = "VersionList.xml";
/*?*/ catch( SAXException& ) {}
/*?*/ catch( io::IOException& ) {}
/*?*/ }
-/*N*/
+/*N*/
/*N*/ return bRet;
/*N*/ }
diff --git a/binfilter/inc/bf_sfx2/docfile.hxx b/binfilter/inc/bf_sfx2/docfile.hxx
index 74acc4e..4998c21 100644
--- a/binfilter/inc/bf_sfx2/docfile.hxx
+++ b/binfilter/inc/bf_sfx2/docfile.hxx
@@ -46,6 +46,7 @@
#include <bf_sfx2/sfxuno.hxx>
#include <bf_sfx2/docinf.hxx>
+#include <vector>
class Timer;
class DateTime;
@@ -126,23 +127,29 @@ struct SfxVersionInfo
}
};
-DECLARE_LIST( _SfxVersionTable, SfxVersionInfo* )
-class SfxVersionTableDtor : public _SfxVersionTable
+typedef ::std::vector< SfxVersionInfo* > _SfxVersionTable;
+class SfxVersionTableDtor
{
+private:
+ _SfxVersionTable maList;
+
public:
- SfxVersionTableDtor( const sal_uInt16 nInitSz=0, const sal_uInt16 nReSz=1 )
- : _SfxVersionTable( nInitSz, nReSz )
- {}
+ SfxVersionTableDtor() {}
+
+ SfxVersionTableDtor( const SfxVersionTableDtor &rCpy )
+ { *this = rCpy; }
+
+ ~SfxVersionTableDtor()
+ { DelDtor(); }
- SfxVersionTableDtor( const SfxVersionTableDtor &rCpy )
- : _SfxVersionTable(0, 1)
- { *this = rCpy; }
+ void DelDtor();
+ SvStream& Read( SvStream & );
- ~SfxVersionTableDtor()
- { DelDtor(); }
+ size_t Count() const { return maList.size(); }
+ SfxVersionInfo* GetObject( size_t i )
+ { return ( maList.size() < i ) ? maList[ i ] : NULL; }
+ void push_back( SfxVersionInfo* item ) { maList.push_back( item ); }
- void DelDtor();
- SvStream& Read( SvStream & );
};
class SfxMedium : public SvRefBase
More information about the Libreoffice-commits
mailing list