Commit db49eb82 authored by Alexey.Musinov's avatar Alexey.Musinov Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52704 954022d7-b5bf-4e40-9824-e11837661b57
parent 9ca27c6f
#pragma once #pragma once
#include <boost/shared_ptr.hpp> #include "..\..\Common\DocxFormat\Source\Base\SmartPtr.h"
#include <boost/utility.hpp>
template <class T, class I> class Aggregat: private boost::noncopyable template <class T, class I> class Aggregat
{ {
protected:
boost::shared_ptr<T> m_item;
public: public:
Aggregat() Aggregat()
{ {
} }
Aggregat( T* _item ): Aggregat(T* _item) : m_item(_item)
m_item(_item) {
}
T& operator* ()
{ {
*return m_item;
} }
T& operator * () const T* get()
{ {
*return this->m_item; return m_item.operator->();
}
const T* get() const
{
return m_item.operator->();
} }
T* get() const T* operator ->()
{ {
return this->m_item.get(); return m_item.operator->();
} }
T* operator -> () const const T* operator ->() const
{ {
return this->m_item.operator -> (); return m_item.operator->();
} }
template <class A> const bool is() const template <class A> const bool is() const
{ {
return ( typeid(*this->m_item) == typeid(A) ); return (typeid(*this->m_item) == typeid(A));
} }
template <class A> A& as() template <class A> A& as()
...@@ -62,4 +67,23 @@ public: ...@@ -62,4 +67,23 @@ public:
{ {
return static_cast<const I&>(*this); return static_cast<const I&>(*this);
} }
inline bool IsInit() const
{
return m_item.IsInit();
}
inline T* Get()
{
return m_item.operator->();
}
inline const T* Get() const
{
return m_item.operator->();
}
protected:
NSCommon::smart_ptr<T> m_item;
}; };
\ No newline at end of file
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <io.h> #include <io.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <share.h> #include <share.h>
#include <iosfwd>
#include <sstream>
#include <math.h> #include <math.h>
#include <list> #include <list>
...@@ -18,92 +20,10 @@ ...@@ -18,92 +20,10 @@
#include "utf8.h" #include "utf8.h"
#include <boost/shared_ptr.hpp> #include "AVSUtils.h"
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/bind.hpp>
using namespace std; using namespace std;
#define ADDREFINTERFACE(pinterface)\
{\
if (pinterface!=NULL)\
{\
pinterface->AddRef();\
}\
}
#define RELEASEINTERFACE(pinterface)\
{\
if (pinterface!=NULL)\
{\
pinterface->Release();\
pinterface=NULL;\
}\
}
#define QUERYINTERFACE(pinterface, pinterface_res, iid)\
{\
if (pinterface!=NULL)\
pinterface->QueryInterface(iid, (void**)&pinterface_res);\
else\
pinterface_res=NULL;\
}
#define RELEASEMEM(pobject)\
{\
if (pobject!=NULL)\
{\
free(pobject);\
pobject=NULL;\
}\
}
#define RELEASEOBJECT(pobject)\
{\
if (pobject!=NULL)\
{\
delete pobject;\
pobject=NULL;\
}\
}
#define RELEASEARRAYOBJECTS(pobject)\
{\
if (pobject!=NULL)\
{\
delete []pobject;\
pobject=NULL;\
}\
}
#define RELEASEHEAP(pmem)\
{\
if (pmem!=NULL)\
{\
HeapFree(GetProcessHeap(), 0, pmem);\
pmem=NULL;\
}\
}
#define RELEASEARRAY(parray)\
{\
if (parray!=NULL)\
{\
SafeArrayDestroy(parray);\
parray=NULL;\
}\
}
#define RELEASESYSSTRING(pstring)\
{\
if (pstring!=NULL)\
{\
SysFreeString(pstring);\
pstring=NULL;\
}\
}
#define RELEASEHANDLE(phandle)\
{\
if (phandle!=NULL)\
{\
CloseHandle(phandle);\
phandle=NULL;\
}\
}
namespace AVSDocFormatUtils namespace AVSDocFormatUtils
{ {
typedef byte Bool8; typedef byte Bool8;
...@@ -140,12 +60,12 @@ namespace AVSDocFormatUtils ...@@ -140,12 +60,12 @@ namespace AVSDocFormatUtils
{ {
switch(data[pos]) switch(data[pos])
{ {
case '&': buffer.append(_T("&amp;")); break; case '&': buffer.append(_T("&amp;")); break;
case '\"': buffer.append(_T("&quot;")); break; case '\"': buffer.append(_T("&quot;")); break;
case '\'': buffer.append(_T("&apos;")); break; case '\'': buffer.append(_T("&apos;")); break;
case '<': buffer.append(_T("&lt;")); break; case '<': buffer.append(_T("&lt;")); break;
case '>': buffer.append(_T("&gt;")); break; case '>': buffer.append(_T("&gt;")); break;
default: buffer.append(&data[pos], 1); break; default: buffer.append(&data[pos], 1); break;
} }
} }
return buffer; return buffer;
...@@ -654,48 +574,46 @@ namespace AVSDocFormatUtils ...@@ -654,48 +574,46 @@ namespace AVSDocFormatUtils
return bytes; return bytes;
} }
/*========================================================================================================*/ static inline wstring IntToWideString(int value, int radix = 10)
static inline wstring IntToWideString( int value, int radix = 10 )
{ {
const int size = 33; const int size = 33;
WCHAR strValue[size]; WCHAR strValue[size];
_itow_s( value, strValue, size, radix ); _itow_s(value, strValue, size, radix);
return wstring( strValue ); return wstring(strValue);
} }
/*========================================================================================================*/ static inline std::wstring DoubleToWideString(double value)
static inline wstring DoubleToWideString( double value )
{ {
return boost::lexical_cast<wstring>(value); std::wstringstream src;
src << value;
return std::wstring(src.str());
} }
/*========================================================================================================*/ static inline string IntToString(int value, int radix = 10)
static inline string IntToString( int value, int radix = 10 )
{ {
const int size = 33; const int size = 33;
char strValue[size]; char strValue[size];
_itoa_s( value, strValue, size, radix ); _itoa_s(value, strValue, size, radix);
return string( strValue ); return string(strValue);
} }
/*========================================================================================================*/ static inline string DoubleToString(double value)
static inline string DoubleToString( double value )
{ {
return boost::lexical_cast<string>(value); std::stringstream src;
src << value;
return std::string(src.str());
} }
/*========================================================================================================*/
static inline wstring MapValueToWideString( unsigned int value, const WCHAR* mapArray, unsigned int size1, unsigned int size2 ) static inline wstring MapValueToWideString( unsigned int value, const WCHAR* mapArray, unsigned int size1, unsigned int size2 )
{ {
if ( mapArray == NULL ) if ( mapArray == NULL )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
struct IVirtualConstructor struct IVirtualConstructor
{ {
virtual IVirtualConstructor* New() const = 0; virtual IVirtualConstructor* New() const = 0;
virtual IVirtualConstructor* Clone() const = 0; virtual IVirtualConstructor* Clone() const = 0;
virtual ~IVirtualConstructor() {} virtual ~IVirtualConstructor() {}
}; };
#pragma once #pragma once
#include "md4c.h"
#include <vector> #include <vector>
using namespace std;
#include "md4c.h"
#include "AVSUtils.h"
class MD4 class MD4
{ {
...@@ -10,9 +11,9 @@ public: ...@@ -10,9 +11,9 @@ public:
MD4(const void* _message = NULL, unsigned int _messageSize = 0) : message(NULL), messageSize(_messageSize) MD4(const void* _message = NULL, unsigned int _messageSize = 0) : message(NULL), messageSize(_messageSize)
{ {
this->SetMessage( _message, _messageSize ); SetMessage(_message, _messageSize);
memset( this->md4, 0, sizeof(this->md4) ); memset(md4, 0, sizeof(md4));
} }
MD4(const MD4& _md4) : message(NULL), messageSize(_md4.messageSize) MD4(const MD4& _md4) : message(NULL), messageSize(_md4.messageSize)
...@@ -28,7 +29,6 @@ public: ...@@ -28,7 +29,6 @@ public:
if ( this->message != NULL ) if ( this->message != NULL )
{ {
memset( this->message, 0, this->messageSize ); memset( this->message, 0, this->messageSize );
memcpy( this->message, _md4.message, this->messageSize ); memcpy( this->message, _md4.message, this->messageSize );
} }
} }
...@@ -58,9 +58,9 @@ public: ...@@ -58,9 +58,9 @@ public:
} }
} }
inline vector<unsigned char> GetMD4Bytes() const inline std::vector<unsigned char> GetMD4Bytes() const
{ {
vector<unsigned char> md4Bytes; std::vector<unsigned char> md4Bytes;
MD4_CTX context; MD4_CTX context;
......
...@@ -19,15 +19,20 @@ ...@@ -19,15 +19,20 @@
#else #else
/*#ifdef _DEBUG
#import "..\..\Redist\ASCOfficeUtils.dll" raw_interfaces_only #import "..\..\..\AVSOfficeUtils\AVSOfficeUtils\Debug\AVSOfficeUtils.dll" raw_interfaces_only
#else*/
#import "..\..\..\..\..\..\..\Redist\AVSOfficeStudio\AVSOfficeUtils.dll" raw_interfaces_only
//#endif // _DEBUG //#endif // _DEBUG
#define DOC_FILE_COMPONENT_NAME L"ASCOfficeDocFile.dll" #define DOC_FILE_COMPONENT_NAME L"AVSOfficeDocFile.dll"
#define DOC_FILE_TEMPLATE_FILE_NAME L"Template.doc" #define DOC_FILE_TEMPLATE_FILE_NAME L"Template.doc"
using namespace ASCOfficeUtils; using namespace AVSOfficeUtils;
// Disable warning message 4267. // Disable warning message 4267.
#pragma warning( disable : 4267 ) #pragma warning( disable : 4267 )
......
...@@ -11,7 +11,7 @@ namespace DocFileFormat ...@@ -11,7 +11,7 @@ namespace DocFileFormat
virtual ~ITableCellElement() {} virtual ~ITableCellElement() {}
}; };
typedef boost::shared_ptr<ITableCellElement> ITableCellElementPtr; typedef NSCommon::smart_ptr<ITableCellElement> ITableCellElementPtr;
class TableCell class TableCell
{ {
......
...@@ -14,7 +14,7 @@ namespace AVSDocFileFormat ...@@ -14,7 +14,7 @@ namespace AVSDocFileFormat
Chpx(const vector<Prl>& _grpprl) : cb(0) Chpx(const vector<Prl>& _grpprl) : cb(0)
{ {
for ( unsigned int i = 0; i < _grpprl.size(); i++ ) for (unsigned int i = 0; i < _grpprl.size(); ++i)
{ {
byte grpprlSize = (byte)_grpprl[i].Size(); byte grpprlSize = (byte)_grpprl[i].Size();
if( this->cb + grpprlSize >= 256 ) if( this->cb + grpprlSize >= 256 )
......
...@@ -1651,7 +1651,7 @@ namespace AVSDocFileFormat ...@@ -1651,7 +1651,7 @@ namespace AVSDocFileFormat
for (size_t i = 0; i < paragraphsItems.size(); ++i) for (size_t i = 0; i < paragraphsItems.size(); ++i)
{ {
Run* run = dynamic_cast<Run*>(paragraphsItems[i].get()); Run* run = dynamic_cast<Run*>(paragraphsItems[i].operator->());
if (run) if (run)
{ {
for (list<RunItem>::const_iterator runiter = run->begin(); runiter != run->end(); ++runiter) for (list<RunItem>::const_iterator runiter = run->begin(); runiter != run->end(); ++runiter)
...@@ -1704,7 +1704,7 @@ namespace AVSDocFileFormat ...@@ -1704,7 +1704,7 @@ namespace AVSDocFileFormat
for (size_t i = 0; i < paragraphsItems.size(); ++i) for (size_t i = 0; i < paragraphsItems.size(); ++i)
{ {
Run* run = dynamic_cast<Run*>(paragraphsItems[i].get()); Run* run = dynamic_cast<Run*>(paragraphsItems[i].operator->());
if (run) if (run)
{ {
for (list<RunItem>::const_iterator runiter = run->begin(); runiter != run->end(); ++runiter) for (list<RunItem>::const_iterator runiter = run->begin(); runiter != run->end(); ++runiter)
......
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
#include "Parse.h" #include "Parse.h"
#include "Unit.h" #include "Unit.h"
#include <boost/foreach.hpp>
#include <boost/scoped_ptr.hpp>
#include "InternalElements.h" #include "InternalElements.h"
#include "TableUtils.h" #include "TableUtils.h"
......
...@@ -10,7 +10,6 @@ namespace AVSDocFileFormat ...@@ -10,7 +10,6 @@ namespace AVSDocFileFormat
static const WCHAR* FldCharTypeSeparate = _T("separate"); static const WCHAR* FldCharTypeSeparate = _T("separate");
static const WCHAR* FldCharTypeEnd = _T("end"); static const WCHAR* FldCharTypeEnd = _T("end");
class FldChar : public IRunItem class FldChar : public IRunItem
{ {
public: public:
......
...@@ -4,42 +4,42 @@ ...@@ -4,42 +4,42 @@
namespace AVSDocFileFormat namespace AVSDocFileFormat
{ {
class Footer: public ITextItem class Footer: public ITextItem
{ {
struct FooterItemWithOffset struct FooterItemWithOffset
{ {
TextItemPtr footerItem; TextItemPtr footerItem;
unsigned int footerItemOffset; unsigned int footerItemOffset;
FooterItemWithOffset(): FooterItemWithOffset() : footerItem(), footerItemOffset(0)
footerItem(), footerItemOffset(0) {
{
} }
FooterItemWithOffset( const TextItemPtr& _footerItem, unsigned int _footerItemOffset ): FooterItemWithOffset(const TextItemPtr& _footerItem, unsigned int _footerItemOffset) : footerItem(_footerItem), footerItemOffset(_footerItemOffset)
footerItem(_footerItem), footerItemOffset(_footerItemOffset) {
{
} }
}; };
private: private:
list<FooterItemWithOffset> textItems; list<FooterItemWithOffset> textItems;
unsigned int footerItemsOffset; unsigned int footerItemsOffset;
public: public:
explicit Footer(); explicit Footer();
Footer( const Footer& _footer ); Footer( const Footer& _footer );
void AddTextItem( const ITextItem& _textItem ); void AddTextItem( const ITextItem& _textItem );
virtual ~Footer(); virtual ~Footer();
virtual wstring GetAllText() const; virtual wstring GetAllText() const;
virtual operator wstring() const; virtual operator wstring() const;
virtual vector<TextItemPtr> GetAllParagraphsCopy() const; virtual vector<TextItemPtr> GetAllParagraphsCopy() const;
virtual vector<ITextItem*> GetAllParagraphs(); virtual vector<ITextItem*> GetAllParagraphs();
virtual vector<PapxInFkp> GetAllParagraphsProperties( vector<unsigned int>* allParagraphsOffsets ) const; virtual vector<PapxInFkp> GetAllParagraphsProperties( vector<unsigned int>* allParagraphsOffsets ) const;
virtual vector<Chpx> GetAllRunProperties( vector<unsigned int>* allRunsOffsets ) const; virtual vector<Chpx> GetAllRunProperties( vector<unsigned int>* allRunsOffsets ) const;
virtual vector<IParagraphItemPtr> GetAllRunsCopy( vector<unsigned int>* allRunsOffsets ) const; virtual vector<IParagraphItemPtr> GetAllRunsCopy( vector<unsigned int>* allRunsOffsets ) const;
virtual vector<IParagraphItemPtr> GetAllParagraphItemsCopy( vector<unsigned int>* allParagraphItemsOffsets ) const; virtual vector<IParagraphItemPtr> GetAllParagraphItemsCopy( vector<unsigned int>* allParagraphItemsOffsets ) const;
virtual IVirtualConstructor* New() const; virtual IVirtualConstructor* New() const;
virtual IVirtualConstructor* Clone() const; virtual IVirtualConstructor* Clone() const;
}; };
} }
\ No newline at end of file
...@@ -113,7 +113,8 @@ namespace AVSDocFileFormat ...@@ -113,7 +113,8 @@ namespace AVSDocFileFormat
for ( list<HeaderItemWithOffset>::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) for ( list<HeaderItemWithOffset>::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ )
{ {
vector<ITextItem*> textItemParagraphs = iter->headerItem->GetAllParagraphs(); ITextItem* item = (ITextItem*)iter->headerItem.operator->();
vector<ITextItem*> textItemParagraphs = item->GetAllParagraphs();
for ( vector<ITextItem*>::iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ ) for ( vector<ITextItem*>::iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ )
{ {
......
...@@ -2,20 +2,22 @@ ...@@ -2,20 +2,22 @@
#include "Chpx.h" #include "Chpx.h"
#include "..\..\Common\DocxFormat\Source\Base\SmartPtr.h"
namespace AVSDocFileFormat namespace AVSDocFileFormat
{ {
struct IParagraphItem; struct IParagraphItem;
typedef boost::shared_ptr<IParagraphItem> IParagraphItemPtr; typedef NSCommon::smart_ptr<IParagraphItem> IParagraphItemPtr;
struct IParagraphItem: public IVirtualConstructor struct IParagraphItem : public IVirtualConstructor
{ {
virtual unsigned long GetTextSize() const = 0; virtual unsigned long GetTextSize() const = 0;
virtual std::wstring GetAllText() const = 0; virtual std::wstring GetAllText() const = 0;
virtual vector<Chpx> GetRunProperties( vector<unsigned int>* runOffsets ) const = 0; virtual vector<Chpx> GetRunProperties( vector<unsigned int>* runOffsets ) const = 0;
virtual unsigned int PrlSize () const = 0; virtual unsigned int PrlSize () const = 0;
virtual vector<IParagraphItemPtr> GetAllRunsCopy( vector<unsigned int>* runOffsets ) const = 0; virtual vector<IParagraphItemPtr> GetAllRunsCopy( vector<unsigned int>* runOffsets ) const = 0;
virtual ~IParagraphItem() {} virtual ~IParagraphItem() {}
}; };
} }
\ No newline at end of file
...@@ -7,7 +7,7 @@ namespace AVSDocFileFormat ...@@ -7,7 +7,7 @@ namespace AVSDocFileFormat
{ {
struct ITextItem; struct ITextItem;
typedef boost::shared_ptr<ITextItem> TextItemPtr; typedef NSCommon::smart_ptr<ITextItem> TextItemPtr;
struct ITextItem : public IVirtualConstructor struct ITextItem : public IVirtualConstructor
{ {
......
...@@ -157,7 +157,7 @@ namespace AVSDocFileFormat ...@@ -157,7 +157,7 @@ namespace AVSDocFileFormat
for ( list<ParagraphItem>::const_iterator iter = m_oTextRuns.begin(); iter != m_oTextRuns.end(); iter++ ) for ( list<ParagraphItem>::const_iterator iter = m_oTextRuns.begin(); iter != m_oTextRuns.end(); iter++ )
{ {
vector<unsigned int> runOffset; vector<unsigned int> runOffset;
vector<Chpx> runProperties = (*iter)->GetRunProperties( &runOffset ); vector<Chpx> runProperties = ((IParagraphItem*)iter.operator->())->GetRunProperties( &runOffset );
for ( unsigned int i = 0; i < runProperties.size(); i++ ) for ( unsigned int i = 0; i < runProperties.size(); i++ )
{ {
...@@ -165,7 +165,7 @@ namespace AVSDocFileFormat ...@@ -165,7 +165,7 @@ namespace AVSDocFileFormat
runOffsets->push_back( allRunsOffset + runOffset[i] ); runOffsets->push_back( allRunsOffset + runOffset[i] );
} }
allRunsOffset += ( sizeof(WCHAR) * (*iter)->GetTextSize() ); allRunsOffset += ( sizeof(WCHAR) * ((IParagraphItem*)iter.operator->())->GetTextSize() );
} }
vector<unsigned int> runOffset; vector<unsigned int> runOffset;
...@@ -210,9 +210,9 @@ namespace AVSDocFileFormat ...@@ -210,9 +210,9 @@ namespace AVSDocFileFormat
for (list<ParagraphItem>::const_iterator iter = m_oTextRuns.begin(); iter != m_oTextRuns.end(); ++iter) for (list<ParagraphItem>::const_iterator iter = m_oTextRuns.begin(); iter != m_oTextRuns.end(); ++iter)
{ {
allRunsCopy.push_back( IParagraphItemPtr( static_cast<IParagraphItem*>((*iter)->Clone()) ) ); allRunsCopy.push_back( IParagraphItemPtr( static_cast<IParagraphItem*>(((IParagraphItem*)iter.operator->())->Clone()) ) );
runOffsets->push_back( runOffset ); runOffsets->push_back( runOffset );
runOffset += ( sizeof(WCHAR) * (*iter)->GetTextSize() ); runOffset += ( sizeof(WCHAR) * ((IParagraphItem*)iter.operator->())->GetTextSize() );
} }
allRunsCopy.push_back( IParagraphItemPtr( static_cast<IParagraphItem*>(m_oSpecialRuns.back()->Clone()) ) ); allRunsCopy.push_back( IParagraphItemPtr( static_cast<IParagraphItem*>(m_oSpecialRuns.back()->Clone()) ) );
...@@ -256,7 +256,7 @@ namespace AVSDocFileFormat ...@@ -256,7 +256,7 @@ namespace AVSDocFileFormat
for (list<ParagraphItem>::const_iterator iter = m_oTextRuns.begin(); iter != m_oTextRuns.end(); ++iter) for (list<ParagraphItem>::const_iterator iter = m_oTextRuns.begin(); iter != m_oTextRuns.end(); ++iter)
{ {
strText += (*iter)->GetAllText(); strText += ((IParagraphItem*)iter.operator->())->GetAllText();
} }
return strText; return strText;
......
This diff is collapsed.
...@@ -175,7 +175,8 @@ namespace OfficeArt ...@@ -175,7 +175,8 @@ namespace OfficeArt
{ {
MD4 md4Code( (byte*)wmfData.data(), wmfData.size() ); MD4 md4Code( (byte*)wmfData.data(), wmfData.size() );
//!!!TODO!!! // TODO : need fix
officeArtBlip = new OfficeArtBlipWMF( OfficeArtMetafileHeader( wmfData.size(), RECT( 0, 0, 0, 0 ), POINT( 0, 0 ), comprLen, COMPRESSION_METHOD_DEFLATE ), buffer, md4Code.GetMD4Bytes() ); officeArtBlip = new OfficeArtBlipWMF( OfficeArtMetafileHeader( wmfData.size(), RECT( 0, 0, 0, 0 ), POINT( 0, 0 ), comprLen, COMPRESSION_METHOD_DEFLATE ), buffer, md4Code.GetMD4Bytes() );
RELEASEARRAYOBJECTS (buffer); RELEASEARRAYOBJECTS (buffer);
} }
......
#pragma once #pragma once
#include "..\..\..\Common\DocxFormat\Source\Base\SmartPtr.h"
namespace OfficeArt namespace OfficeArt
{ {
struct IOfficeArtRecord struct IOfficeArtRecord
...@@ -12,5 +14,5 @@ namespace OfficeArt ...@@ -12,5 +14,5 @@ namespace OfficeArt
virtual ~IOfficeArtRecord() {} virtual ~IOfficeArtRecord() {}
}; };
typedef boost::shared_ptr<IOfficeArtRecord> OfficeArtRecordPtr; typedef NSCommon::smart_ptr<IOfficeArtRecord> OfficeArtRecordPtr;
} }
\ No newline at end of file
...@@ -59,9 +59,9 @@ namespace OfficeArt ...@@ -59,9 +59,9 @@ namespace OfficeArt
return new OfficeArtBStoreContainer( *this ); return new OfficeArtBStoreContainer( *this );
} }
virtual void PushBack (const OfficeArtBStoreContainerFileBlock& fileBlock ) virtual void PushBack(const OfficeArtBStoreContainerFileBlock& fileBlock)
{ {
rgfb.push_back( OfficeArtBStoreContainerFileBlockPtr( static_cast<OfficeArtBStoreContainerFileBlock*>( fileBlock.Clone() ) ) ); rgfb.push_back( OfficeArtBStoreContainerFileBlockPtr(static_cast<OfficeArtBStoreContainerFileBlock*>(fileBlock.Clone())));
Initialize(); Initialize();
} }
...@@ -83,16 +83,16 @@ namespace OfficeArt ...@@ -83,16 +83,16 @@ namespace OfficeArt
private: private:
void Initialize() inline void Initialize()
{ {
size = 0; size = 0;
for (list<OfficeArtBStoreContainerFileBlockPtr>::const_iterator iter = rgfb.begin(); iter != rgfb.end(); ++iter) for (std::list<OfficeArtBStoreContainerFileBlockPtr>::const_iterator iter = rgfb.begin(); iter != rgfb.end(); ++iter)
{ {
size += (*iter)->Size(); size += (*iter)->Size();
} }
rh = OfficeArtRecordHeader ( 0xF, rgfb.size(), 0xF001, size ); rh = OfficeArtRecordHeader (0xF, rgfb.size(), 0xF001, size);
size += sizeof(rh); size += sizeof(rh);
RELEASEARRAYOBJECTS (bytes); RELEASEARRAYOBJECTS (bytes);
...@@ -100,23 +100,21 @@ namespace OfficeArt ...@@ -100,23 +100,21 @@ namespace OfficeArt
if (size) if (size)
{ {
bytes = new byte[size]; bytes = new byte[size];
if (bytes)
if ( this->bytes != NULL )
{ {
memset( bytes, 0, size ); memset(bytes, 0, size);
unsigned int offset = 0; unsigned int offset = 0;
memcpy( ( bytes + offset ), (byte*)(rh), sizeof(rh) ); memcpy((bytes + offset), (byte*)(rh), sizeof(rh));
offset += sizeof(rh); offset += sizeof(rh);
for (list<OfficeArtBStoreContainerFileBlockPtr>::const_iterator iter = rgfb.begin(); iter != rgfb.end(); ++iter) for (std::list<OfficeArtBStoreContainerFileBlockPtr>::const_iterator iter = rgfb.begin(); iter != rgfb.end(); ++iter)
{ {
OfficeArtBStoreContainerFileBlock* officeArtBStoreContainerFileBlock = iter->get(); const OfficeArtBStoreContainerFileBlock* officeArtBStoreContainerFileBlock = iter->operator->();
if (officeArtBStoreContainerFileBlock)
if ( officeArtBStoreContainerFileBlock != NULL )
{ {
memcpy( ( bytes + offset ), (byte*)(*officeArtBStoreContainerFileBlock), officeArtBStoreContainerFileBlock->Size() ); memcpy((bytes + offset), (byte*)(*officeArtBStoreContainerFileBlock), officeArtBStoreContainerFileBlock->Size());
offset += officeArtBStoreContainerFileBlock->Size(); offset += officeArtBStoreContainerFileBlock->Size();
} }
} }
...@@ -126,10 +124,10 @@ namespace OfficeArt ...@@ -126,10 +124,10 @@ namespace OfficeArt
private: private:
OfficeArtRecordHeader rh; OfficeArtRecordHeader rh;
list<OfficeArtBStoreContainerFileBlockPtr> rgfb; list<OfficeArtBStoreContainerFileBlockPtr> rgfb;
byte* bytes; byte* bytes;
unsigned int size; unsigned int size;
}; };
} }
\ No newline at end of file
...@@ -17,5 +17,5 @@ namespace OfficeArt ...@@ -17,5 +17,5 @@ namespace OfficeArt
OfficeArtRecordHeader rh; OfficeArtRecordHeader rh;
}; };
typedef boost::shared_ptr<OfficeArtBStoreContainerFileBlock> OfficeArtBStoreContainerFileBlockPtr; typedef NSCommon::smart_ptr<OfficeArtBStoreContainerFileBlock> OfficeArtBStoreContainerFileBlockPtr;
} }
\ No newline at end of file
...@@ -16,7 +16,6 @@ namespace OfficeArt ...@@ -16,7 +16,6 @@ namespace OfficeArt
if (size) if (size)
{ {
bytes = new byte[size]; bytes = new byte[size];
if (bytes) if (bytes)
{ {
memset(bytes, 0, size); memset(bytes, 0, size);
...@@ -37,7 +36,7 @@ namespace OfficeArt ...@@ -37,7 +36,7 @@ namespace OfficeArt
virtual unsigned int Size() const virtual unsigned int Size() const
{ {
return this->size; return size;
} }
virtual IOfficeArtRecord* New() const virtual IOfficeArtRecord* New() const
...@@ -74,7 +73,7 @@ namespace OfficeArt ...@@ -74,7 +73,7 @@ namespace OfficeArt
private: private:
void Initialize() inline void Initialize()
{ {
size = 0; size = 0;
...@@ -86,20 +85,18 @@ namespace OfficeArt ...@@ -86,20 +85,18 @@ namespace OfficeArt
if (size) if (size)
{ {
bytes = new byte[size]; bytes = new byte[size];
if (bytes)
if ( bytes != NULL )
{ {
memset( bytes, 0, size ); memset(bytes, 0, size);
unsigned int offset = 0; unsigned int offset = 0;
for (list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) for (list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter)
{ {
IOfficeArtRecord* officeArtRecord = iter->get(); const IOfficeArtRecord* officeArtRecord = iter->operator->();
if (officeArtRecord)
if ( officeArtRecord != NULL )
{ {
memcpy( ( bytes + offset ), (byte*)(*officeArtRecord), officeArtRecord->Size() ); memcpy((bytes + offset), (byte*)(*officeArtRecord), officeArtRecord->Size());
offset += officeArtRecord->Size(); offset += officeArtRecord->Size();
} }
} }
...@@ -108,9 +105,10 @@ namespace OfficeArt ...@@ -108,9 +105,10 @@ namespace OfficeArt
} }
protected: protected:
list<OfficeArtRecordPtr> officeArtRecords;
byte* bytes; list<OfficeArtRecordPtr> officeArtRecords;
unsigned int size;
byte* bytes;
unsigned int size;
}; };
} }
\ No newline at end of file
...@@ -12,33 +12,32 @@ namespace OfficeArt ...@@ -12,33 +12,32 @@ namespace OfficeArt
Initialize(); Initialize();
} }
OfficeArtDgContainer (const OfficeArtDgContainer& _officeArtDgContainer): rh( _officeArtDgContainer.rh ),officeArtRecords(_officeArtDgContainer.officeArtRecords), size(_officeArtDgContainer.size), bytes(NULL) OfficeArtDgContainer (const OfficeArtDgContainer& _officeArtDgContainer): rh(_officeArtDgContainer.rh),officeArtRecords(_officeArtDgContainer.officeArtRecords), size(_officeArtDgContainer.size), bytes(NULL)
{ {
if ( this->size != 0 ) if (0 != size)
{ {
this->bytes = new byte[this->size]; bytes = new byte[size];
if (bytes)
if ( this->bytes != NULL )
{ {
memset( this->bytes, 0, this->size ); memset(bytes, 0, size);
memcpy( this->bytes, _officeArtDgContainer.bytes, this->size ); memcpy(bytes, _officeArtDgContainer.bytes, size);
} }
} }
} }
virtual operator const byte* () const virtual operator const byte* () const
{ {
return (const byte*)(this->bytes); return (const byte*)(bytes);
} }
virtual operator byte* () const virtual operator byte* () const
{ {
return (byte*)(this->bytes); return (byte*)(bytes);
} }
virtual unsigned int Size() const virtual unsigned int Size() const
{ {
return this->size; return size;
} }
virtual IOfficeArtRecord* New() const virtual IOfficeArtRecord* New() const
...@@ -48,26 +47,24 @@ namespace OfficeArt ...@@ -48,26 +47,24 @@ namespace OfficeArt
virtual IOfficeArtRecord* Clone() const virtual IOfficeArtRecord* Clone() const
{ {
return new OfficeArtDgContainer( *this ); return new OfficeArtDgContainer(*this);
} }
virtual void PushBack( const IOfficeArtRecord& _officeArtRecord ) virtual void PushBack(const IOfficeArtRecord& _officeArtRecord)
{ {
this->officeArtRecords.push_back( OfficeArtRecordPtr( _officeArtRecord.Clone() ) ); officeArtRecords.push_back(OfficeArtRecordPtr(_officeArtRecord.Clone()));
Initialize();
this->Initialize();
} }
virtual unsigned int Count() const virtual unsigned int Count() const
{ {
return (unsigned int)this->officeArtRecords.size(); return (unsigned int)officeArtRecords.size();
} }
virtual void Clear() virtual void Clear()
{ {
this->officeArtRecords.clear(); officeArtRecords.clear();
Initialize();
this->Initialize();
} }
virtual ~OfficeArtDgContainer() virtual ~OfficeArtDgContainer()
...@@ -76,54 +73,53 @@ namespace OfficeArt ...@@ -76,54 +73,53 @@ namespace OfficeArt
} }
private: private:
void Initialize()
inline void Initialize()
{ {
this->size = 0; size = 0;
for ( list<OfficeArtRecordPtr>::const_iterator iter = this->officeArtRecords.begin(); iter != this->officeArtRecords.end(); iter++ ) for (std::list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter)
{ {
this->size += (*iter)->Size(); size += (*iter)->Size();
} }
this->rh = OfficeArtRecordHeader( 0xF, 0x000, 0xF002, this->size ); rh = OfficeArtRecordHeader( 0xF, 0x000, 0xF002, size);
this->size += sizeof(this->rh); size += sizeof(rh);
RELEASEARRAYOBJECTS (bytes); RELEASEARRAYOBJECTS (bytes);
if ( this->size != 0 ) if (0 != size)
{ {
this->bytes = new byte[this->size]; bytes = new byte[size];
if (bytes)
if ( this->bytes != NULL )
{ {
memset( this->bytes, 0, this->size ); memset(bytes, 0, size);
unsigned int offset = 0; unsigned int offset = 0;
memcpy( ( this->bytes + offset ), (byte*)(this->rh), sizeof(this->rh) ); memcpy((bytes + offset), (byte*)(rh), sizeof(rh));
offset += sizeof(this->rh); offset += sizeof(rh);
for ( list<OfficeArtRecordPtr>::const_iterator iter = this->officeArtRecords.begin(); iter != this->officeArtRecords.end(); iter++ ) for (std::list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter)
{ {
IOfficeArtRecord* officeArtRecord = iter->get(); const IOfficeArtRecord* officeArtRecord = iter->operator->();
if (officeArtRecord)
if ( officeArtRecord != NULL )
{ {
memcpy( ( this->bytes + offset ), (byte*)(*officeArtRecord), officeArtRecord->Size() ); memcpy((bytes + offset), (byte*)(*officeArtRecord), officeArtRecord->Size());
offset += officeArtRecord->Size(); offset += officeArtRecord->Size();
} }
} }
} }
} }
} }
protected: protected:
OfficeArtRecordHeader rh;
list<OfficeArtRecordPtr> officeArtRecords;
byte* bytes; OfficeArtRecordHeader rh;
unsigned int size; list<OfficeArtRecordPtr> officeArtRecords;
byte* bytes;
unsigned int size;
}; };
} }
\ No newline at end of file
...@@ -86,37 +86,34 @@ namespace OfficeArt ...@@ -86,37 +86,34 @@ namespace OfficeArt
void Initialize() void Initialize()
{ {
this->size = 0; size = 0;
for ( list<OfficeArtRecordPtr>::const_iterator iter = this->officeArtRecords.begin(); iter != this->officeArtRecords.end(); iter++ ) for (std::list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter)
{ {
this->size += (*iter)->Size(); size += (*iter)->Size();
} }
this->rh = OfficeArtRecordHeader( 0xF, 0x000, 0xF000, this->size ); rh = OfficeArtRecordHeader( 0xF, 0x000, 0xF000, size);
size += sizeof(rh);
this->size += sizeof(this->rh); RELEASEARRAYOBJECTS(bytes);
RELEASEARRAYOBJECTS (bytes); if (0 != size)
if ( this->size != 0 )
{ {
this->bytes = new byte[this->size]; bytes = new byte[size];
if (bytes)
if ( this->bytes != NULL )
{ {
memset( this->bytes, 0, this->size ); memset(bytes, 0, size);
unsigned int offset = 0; unsigned int offset = 0;
memcpy( ( this->bytes + offset ), (byte*)(this->rh), sizeof(this->rh) ); memcpy((bytes + offset), (byte*)(rh), sizeof(rh));
offset += sizeof(this->rh); offset += sizeof(rh);
for ( list<OfficeArtRecordPtr>::const_iterator iter = this->officeArtRecords.begin(); iter != this->officeArtRecords.end(); iter++ ) for (std::list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter)
{ {
IOfficeArtRecord* officeArtRecord = iter->get(); const IOfficeArtRecord* officeArtRecord = iter->operator->();
if (officeArtRecord)
if ( officeArtRecord != NULL )
{ {
memcpy( ( this->bytes + offset ), (byte*)(*officeArtRecord), officeArtRecord->Size() ); memcpy( ( this->bytes + offset ), (byte*)(*officeArtRecord), officeArtRecord->Size() );
offset += officeArtRecord->Size(); offset += officeArtRecord->Size();
......
...@@ -20,10 +20,9 @@ namespace OfficeArt ...@@ -20,10 +20,9 @@ namespace OfficeArt
OfficeArtInlineSpContainer (const OfficeArtInlineSpContainer& _officeArtInlineSpContainer) : shape(_officeArtInlineSpContainer.shape), rgfb(_officeArtInlineSpContainer.rgfb), bytes(NULL), size(_officeArtInlineSpContainer.size) OfficeArtInlineSpContainer (const OfficeArtInlineSpContainer& _officeArtInlineSpContainer) : shape(_officeArtInlineSpContainer.shape), rgfb(_officeArtInlineSpContainer.rgfb), bytes(NULL), size(_officeArtInlineSpContainer.size)
{ {
if (size != 0) if (0 != size)
{ {
bytes = new byte[size]; bytes = new byte[size];
if (bytes) if (bytes)
{ {
memset(bytes, 0, size); memset(bytes, 0, size);
...@@ -54,12 +53,12 @@ namespace OfficeArt ...@@ -54,12 +53,12 @@ namespace OfficeArt
virtual IOfficeArtRecord* Clone() const virtual IOfficeArtRecord* Clone() const
{ {
return new OfficeArtInlineSpContainer( *this ); return new OfficeArtInlineSpContainer(*this);
} }
virtual void PushBack (const OfficeArtBStoreContainerFileBlock& _officeArtBStoreContainerFileBlock ) virtual void PushBack (const OfficeArtBStoreContainerFileBlock& _officeArtBStoreContainerFileBlock )
{ {
rgfb.push_back( OfficeArtBStoreContainerFileBlockPtr( static_cast<OfficeArtBStoreContainerFileBlock*>( _officeArtBStoreContainerFileBlock.Clone() ) ) ); rgfb.push_back(OfficeArtBStoreContainerFileBlockPtr(static_cast<OfficeArtBStoreContainerFileBlock*>(_officeArtBStoreContainerFileBlock.Clone())));
Initialize(); Initialize();
} }
...@@ -81,37 +80,35 @@ namespace OfficeArt ...@@ -81,37 +80,35 @@ namespace OfficeArt
private: private:
void Initialize() inline void Initialize()
{ {
size = shape.Size(); size = shape.Size();
for ( list<OfficeArtBStoreContainerFileBlockPtr>::const_iterator iter = this->rgfb.begin(); iter != this->rgfb.end(); iter++ ) for (std::list<OfficeArtBStoreContainerFileBlockPtr>::const_iterator iter = rgfb.begin(); iter != rgfb.end(); ++iter)
{ {
this->size += (*iter)->Size(); size += (*iter)->Size();
} }
RELEASEARRAYOBJECTS (bytes); RELEASEARRAYOBJECTS(bytes);
if ( this->size != 0 ) if (0 != size)
{ {
this->bytes = new byte[this->size]; bytes = new byte[size];
if (bytes)
if ( this->bytes != NULL )
{ {
memset( this->bytes, 0, this->size ); memset(bytes, 0, size);
unsigned int offset = 0; unsigned int offset = 0;
memcpy( this->bytes, (byte*)(this->shape), this->shape.Size() ); memcpy(bytes, (byte*)(shape), shape.Size());
offset += this->shape.Size(); offset += shape.Size();
for ( list<OfficeArtBStoreContainerFileBlockPtr>::const_iterator iter = this->rgfb.begin(); iter != this->rgfb.end(); iter++ ) for (std::list<OfficeArtBStoreContainerFileBlockPtr>::const_iterator iter = rgfb.begin(); iter != rgfb.end(); ++iter)
{ {
OfficeArtBStoreContainerFileBlock* officeArtBStoreContainerFileBlock = iter->get(); const OfficeArtBStoreContainerFileBlock* officeArtBStoreContainerFileBlock = iter->operator->();
if ( officeArtBStoreContainerFileBlock != NULL ) if ( officeArtBStoreContainerFileBlock != NULL )
{ {
memcpy( ( this->bytes + offset ), (byte*)(*officeArtBStoreContainerFileBlock), officeArtBStoreContainerFileBlock->Size() ); memcpy((bytes + offset), (byte*)(*officeArtBStoreContainerFileBlock), officeArtBStoreContainerFileBlock->Size());
offset += officeArtBStoreContainerFileBlock->Size(); offset += officeArtBStoreContainerFileBlock->Size();
} }
} }
...@@ -121,10 +118,10 @@ namespace OfficeArt ...@@ -121,10 +118,10 @@ namespace OfficeArt
private: private:
OfficeArtSpContainer shape; OfficeArtSpContainer shape;
list<OfficeArtBStoreContainerFileBlockPtr> rgfb; std::list<OfficeArtBStoreContainerFileBlockPtr> rgfb;
byte* bytes; byte* bytes;
unsigned int size; unsigned int size;
}; };
} }
\ No newline at end of file
...@@ -8,39 +8,37 @@ namespace OfficeArt ...@@ -8,39 +8,37 @@ namespace OfficeArt
class OfficeArtSpContainer: public IOfficeArtAbstractContainer<IOfficeArtRecord> class OfficeArtSpContainer: public IOfficeArtAbstractContainer<IOfficeArtRecord>
{ {
public: public:
OfficeArtSpContainer() : rh( 0xF, 0x000, 0xF004, 0 ), bytes(NULL), size(sizeof(OfficeArtRecordHeader)) OfficeArtSpContainer() : rh(0xF, 0x000, 0xF004, 0), bytes(NULL), size(sizeof(OfficeArtRecordHeader))
{ {
Initialize(); Initialize();
} }
OfficeArtSpContainer( const OfficeArtSpContainer& _officeArtSpContainer ) : rh( _officeArtSpContainer.rh ),officeArtRecords(_officeArtSpContainer.officeArtRecords), size(_officeArtSpContainer.size), bytes(NULL) OfficeArtSpContainer(const OfficeArtSpContainer& _officeArtSpContainer) : rh(_officeArtSpContainer.rh),officeArtRecords(_officeArtSpContainer.officeArtRecords), size(_officeArtSpContainer.size), bytes(NULL)
{ {
if ( this->size != 0 ) if (0 != size)
{ {
this->bytes = new byte[this->size]; bytes = new byte[size];
if (bytes)
if ( this->bytes != NULL )
{ {
memset( this->bytes, 0, this->size ); memset(bytes, 0, size);
memcpy(bytes, _officeArtSpContainer.bytes, size);
memcpy( this->bytes, _officeArtSpContainer.bytes, this->size );
} }
} }
} }
virtual operator const byte* () const virtual operator const byte* () const
{ {
return (const byte*)(this->bytes); return (const byte*)(bytes);
} }
virtual operator byte* () const virtual operator byte* () const
{ {
return (byte*)(this->bytes); return (byte*)(bytes);
} }
virtual unsigned int Size() const virtual unsigned int Size() const
{ {
return this->size; return size;
} }
virtual IOfficeArtRecord* New() const virtual IOfficeArtRecord* New() const
...@@ -50,19 +48,18 @@ namespace OfficeArt ...@@ -50,19 +48,18 @@ namespace OfficeArt
virtual IOfficeArtRecord* Clone() const virtual IOfficeArtRecord* Clone() const
{ {
return new OfficeArtSpContainer( *this ); return new OfficeArtSpContainer(*this);
} }
virtual void PushBack( const IOfficeArtRecord& _officeArtRecord ) virtual void PushBack(const IOfficeArtRecord& _officeArtRecord)
{ {
this->officeArtRecords.push_back( OfficeArtRecordPtr( _officeArtRecord.Clone() ) ); officeArtRecords.push_back(OfficeArtRecordPtr(_officeArtRecord.Clone()));
Initialize();
this->Initialize();
} }
virtual unsigned int Count() const virtual unsigned int Count() const
{ {
return (unsigned int)this->officeArtRecords.size(); return (unsigned int)officeArtRecords.size();
} }
virtual void Clear() virtual void Clear()
...@@ -78,39 +75,37 @@ namespace OfficeArt ...@@ -78,39 +75,37 @@ namespace OfficeArt
private: private:
void Initialize() inline void Initialize()
{ {
this->size = 0; size = 0;
for ( list<OfficeArtRecordPtr>::const_iterator iter = this->officeArtRecords.begin(); iter != this->officeArtRecords.end(); iter++ ) for (list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter)
this->size += (*iter)->Size(); size += (*iter)->Size();
this->rh = OfficeArtRecordHeader( 0xF, 0x000, 0xF004, this->size ); rh = OfficeArtRecordHeader( 0xF, 0x000, 0xF004, size );
this->size += sizeof(this->rh); size += sizeof(rh);
RELEASEARRAYOBJECTS (bytes); RELEASEARRAYOBJECTS (bytes);
if ( this->size != 0 ) if (0 != size)
{ {
this->bytes = new byte[this->size]; bytes = new byte[size];
if (bytes)
if ( this->bytes != NULL )
{ {
memset( this->bytes, 0, this->size ); memset(bytes, 0, size);
unsigned int offset = 0; unsigned int offset = 0;
memcpy( ( this->bytes + offset ), (byte*)(this->rh), sizeof(this->rh) ); memcpy((bytes + offset), (byte*)(rh), sizeof(rh));
offset += sizeof(this->rh); offset += sizeof(rh);
for ( list<OfficeArtRecordPtr>::const_iterator iter = this->officeArtRecords.begin(); iter != this->officeArtRecords.end(); iter++ ) for (std::list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter)
{ {
IOfficeArtRecord* officeArtRecord = iter->get(); const IOfficeArtRecord* officeArtRecord = iter->operator->();
if (officeArtRecord)
if ( officeArtRecord != NULL )
{ {
memcpy( ( this->bytes + offset ), (byte*)(*officeArtRecord), officeArtRecord->Size() ); memcpy((bytes + offset), (byte*)(*officeArtRecord), officeArtRecord->Size());
offset += officeArtRecord->Size(); offset += officeArtRecord->Size();
} }
} }
...@@ -118,11 +113,11 @@ namespace OfficeArt ...@@ -118,11 +113,11 @@ namespace OfficeArt
} }
} }
protected: protected:
OfficeArtRecordHeader rh; OfficeArtRecordHeader rh;
list<OfficeArtRecordPtr> officeArtRecords; list<OfficeArtRecordPtr> officeArtRecords;
byte* bytes; byte* bytes;
unsigned int size; unsigned int size;
}; };
typedef OfficeArtSpContainer SpContainer; typedef OfficeArtSpContainer SpContainer;
......
...@@ -6,46 +6,39 @@ namespace OfficeArt ...@@ -6,46 +6,39 @@ namespace OfficeArt
{ {
class OfficeArtSpgrContainer: public IOfficeArtAbstractContainer<IOfficeArtRecord> class OfficeArtSpgrContainer: public IOfficeArtAbstractContainer<IOfficeArtRecord>
{ {
protected:
OfficeArtRecordHeader rh;
list<OfficeArtRecordPtr> officeArtRecords;
byte* bytes;
unsigned int size;
public: public:
OfficeArtSpgrContainer() : rh( 0xF, 0x000, 0xF003, 0 ), bytes(NULL), size(sizeof(OfficeArtRecordHeader))
OfficeArtSpgrContainer() : rh(0xF, 0x000, 0xF003, 0), bytes(NULL), size(sizeof(OfficeArtRecordHeader))
{ {
Initialize(); Initialize();
} }
OfficeArtSpgrContainer( const OfficeArtSpgrContainer& _officeContainer ): rh( _officeContainer.rh ), officeArtRecords(_officeContainer.officeArtRecords), size(_officeContainer.size), bytes(NULL) OfficeArtSpgrContainer(const OfficeArtSpgrContainer& _officeContainer): rh(_officeContainer.rh), officeArtRecords(_officeContainer.officeArtRecords), size(_officeContainer.size), bytes(NULL)
{ {
if ( size != 0 ) if ( size != 0 )
{ {
bytes = new byte[size]; bytes = new byte[size];
if (bytes) if (bytes)
{ {
memset( bytes, 0, size ); memset(bytes, 0, size);
memcpy( bytes, _officeContainer.bytes, size ); memcpy(bytes, _officeContainer.bytes, size);
} }
} }
} }
virtual operator const byte* () const virtual operator const byte* () const
{ {
return (const byte*)(this->bytes); return (const byte*)(bytes);
} }
virtual operator byte* () const virtual operator byte* () const
{ {
return (byte*)(this->bytes); return (byte*)(bytes);
} }
virtual unsigned int Size() const virtual unsigned int Size() const
{ {
return this->size; return size;
} }
virtual IOfficeArtRecord* New() const virtual IOfficeArtRecord* New() const
...@@ -55,26 +48,24 @@ namespace OfficeArt ...@@ -55,26 +48,24 @@ namespace OfficeArt
virtual IOfficeArtRecord* Clone() const virtual IOfficeArtRecord* Clone() const
{ {
return new OfficeArtSpgrContainer( *this ); return new OfficeArtSpgrContainer(*this);
} }
virtual void PushBack( const IOfficeArtRecord& _officeArtRecord ) virtual void PushBack( const IOfficeArtRecord& _officeArtRecord )
{ {
this->officeArtRecords.push_back( OfficeArtRecordPtr( _officeArtRecord.Clone() ) ); officeArtRecords.push_back( OfficeArtRecordPtr(_officeArtRecord.Clone()));
Initialize();
this->Initialize();
} }
virtual unsigned int Count() const virtual unsigned int Count() const
{ {
return (unsigned int)this->officeArtRecords.size(); return (unsigned int)officeArtRecords.size();
} }
virtual void Clear() virtual void Clear()
{ {
this->officeArtRecords.clear(); officeArtRecords.clear();
Initialize();
this->Initialize();
} }
virtual ~OfficeArtSpgrContainer() virtual ~OfficeArtSpgrContainer()
...@@ -83,46 +74,51 @@ namespace OfficeArt ...@@ -83,46 +74,51 @@ namespace OfficeArt
} }
private: private:
void Initialize()
inline void Initialize()
{ {
this->size = 0; size = 0;
for ( list<OfficeArtRecordPtr>::const_iterator iter = this->officeArtRecords.begin(); iter != this->officeArtRecords.end(); iter++ ) for (std::list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter)
{ {
this->size += (*iter)->Size(); size += (*iter)->Size();
} }
this->rh = OfficeArtRecordHeader( 0xF, 0x000, 0xF003, this->size ); rh = OfficeArtRecordHeader(0xF, 0x000, 0xF003, size);
size += sizeof(rh);
this->size += sizeof(this->rh);
RELEASEARRAYOBJECTS (bytes); RELEASEARRAYOBJECTS (bytes);
if ( this->size != 0 ) if (0 != size)
{ {
this->bytes = new byte[this->size]; bytes = new byte[size];
if (bytes)
if ( this->bytes != NULL )
{ {
memset( this->bytes, 0, this->size ); memset(bytes, 0, size);
unsigned int offset = 0; unsigned int offset = 0;
memcpy( ( this->bytes + offset ), (byte*)(this->rh), sizeof(this->rh) ); memcpy((bytes + offset), (byte*)(rh), sizeof(rh));
offset += sizeof(this->rh); offset += sizeof(rh);
for ( list<OfficeArtRecordPtr>::const_iterator iter = this->officeArtRecords.begin(); iter != this->officeArtRecords.end(); iter++ ) for (std::list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter)
{ {
IOfficeArtRecord* officeArtRecord = iter->get(); const IOfficeArtRecord* officeArtRecord = iter->operator->();
if (officeArtRecord)
if ( officeArtRecord != NULL )
{ {
memcpy( ( this->bytes + offset ), (byte*)(*officeArtRecord), officeArtRecord->Size() ); memcpy((bytes + offset), (byte*)(*officeArtRecord), officeArtRecord->Size());
offset += officeArtRecord->Size(); offset += officeArtRecord->Size();
} }
} }
} }
} }
} }
protected:
OfficeArtRecordHeader rh;
list<OfficeArtRecordPtr> officeArtRecords;
byte* bytes;
unsigned int size;
}; };
} }
\ No newline at end of file
...@@ -5,13 +5,13 @@ namespace OfficeArt ...@@ -5,13 +5,13 @@ namespace OfficeArt
class OfficeArtWordDrawing : public IOfficeArtAbstractContainer<IOfficeArtRecord> class OfficeArtWordDrawing : public IOfficeArtAbstractContainer<IOfficeArtRecord>
{ {
public: public:
OfficeArtWordDrawing (unsigned char type = 0) : dgglbl(type), bytes(NULL), size(sizeof(dgglbl)) OfficeArtWordDrawing(unsigned char type = 0) : dgglbl(type), bytes(NULL), size(sizeof(dgglbl))
{ {
Initialize(); Initialize();
} }
OfficeArtWordDrawing (const OfficeArtWordDrawing& _container) : dgglbl(_container.dgglbl), officeArtRecords(_container.officeArtRecords), size(_container.size), bytes(NULL) OfficeArtWordDrawing(const OfficeArtWordDrawing& _container) : dgglbl(_container.dgglbl), officeArtRecords(_container.officeArtRecords), size(_container.size), bytes(NULL)
{ {
if ( size != 0 ) if ( size != 0 )
{ {
...@@ -50,9 +50,9 @@ namespace OfficeArt ...@@ -50,9 +50,9 @@ namespace OfficeArt
return new OfficeArtWordDrawing (*this); return new OfficeArtWordDrawing (*this);
} }
virtual void PushBack( const IOfficeArtRecord& _officeArtRecord ) virtual void PushBack(const IOfficeArtRecord& _officeArtRecord)
{ {
officeArtRecords.push_back( OfficeArtRecordPtr( _officeArtRecord.Clone() ) ); officeArtRecords.push_back(OfficeArtRecordPtr(_officeArtRecord.Clone()));
Initialize(); Initialize();
} }
...@@ -74,14 +74,13 @@ namespace OfficeArt ...@@ -74,14 +74,13 @@ namespace OfficeArt
RELEASEARRAYOBJECTS (bytes); RELEASEARRAYOBJECTS (bytes);
} }
private: private:
void Initialize() inline void Initialize()
{ {
size = 0; size = 0;
for (list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) for (std::list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter)
{ {
size += (*iter)->Size(); size += (*iter)->Size();
} }
...@@ -90,10 +89,9 @@ namespace OfficeArt ...@@ -90,10 +89,9 @@ namespace OfficeArt
RELEASEARRAYOBJECTS (bytes); RELEASEARRAYOBJECTS (bytes);
if ( size != 0 ) if (0 != size)
{ {
bytes = new byte[size]; bytes = new byte[size];
if (bytes) if (bytes)
{ {
memset (bytes, 0, size); memset (bytes, 0, size);
...@@ -105,11 +103,10 @@ namespace OfficeArt ...@@ -105,11 +103,10 @@ namespace OfficeArt
for (list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter) for (list<OfficeArtRecordPtr>::const_iterator iter = officeArtRecords.begin(); iter != officeArtRecords.end(); ++iter)
{ {
IOfficeArtRecord* officeArtRecord = iter->get(); const IOfficeArtRecord* officeArtRecord = iter->operator->();
if (officeArtRecord) if (officeArtRecord)
{ {
memcpy( (bytes + offset), (byte*)(*officeArtRecord), officeArtRecord->Size() ); memcpy( (bytes + offset), (byte*)(*officeArtRecord), officeArtRecord->Size());
offset += officeArtRecord->Size(); offset += officeArtRecord->Size();
} }
} }
......
...@@ -21,7 +21,7 @@ namespace AVSDocFileFormat ...@@ -21,7 +21,7 @@ namespace AVSDocFileFormat
ParagraphItem (const ParagraphItem& oItem) : m_nItemOffset(oItem.m_nItemOffset) ParagraphItem (const ParagraphItem& oItem) : m_nItemOffset(oItem.m_nItemOffset)
{ {
if (oItem.m_item.get()) if (oItem.m_item.operator->())
{ {
m_item.reset(static_cast<IParagraphItem*>(oItem.m_item->Clone())); m_item.reset(static_cast<IParagraphItem*>(oItem.m_item->Clone()));
} }
...@@ -29,9 +29,9 @@ namespace AVSDocFileFormat ...@@ -29,9 +29,9 @@ namespace AVSDocFileFormat
ParagraphItem& operator = (const ParagraphItem& oItem) ParagraphItem& operator = (const ParagraphItem& oItem)
{ {
if (m_item != oItem.m_item) if (m_item.operator->() != oItem.m_item.operator->())
{ {
m_item.reset (static_cast<IParagraphItem*>(oItem.m_item->Clone())); m_item.reset(static_cast<IParagraphItem*>(oItem.m_item->Clone()));
m_nItemOffset = oItem.m_nItemOffset; m_nItemOffset = oItem.m_nItemOffset;
} }
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
#include "BinaryStorage.h" #include "BinaryStorage.h"
#include "OfficeArt/BlipFactory.h" #include "OfficeArt/BlipFactory.h"
#include "OfficeArt/OfficeArtFOPT.h" #include "OfficeArt/OfficeArtFOPT.h"
#include <boost/scoped_ptr.hpp>
#include "OfficeArt/OfficeArtClientAnchor.h" #include "OfficeArt/OfficeArtClientAnchor.h"
#define RATIO 1000 // TODO : #define RATIO 1000 // TODO : recalculate
namespace AVSDocFileFormat namespace AVSDocFileFormat
{ {
...@@ -33,81 +33,10 @@ namespace AVSDocFileFormat ...@@ -33,81 +33,10 @@ namespace AVSDocFileFormat
Brc80 brcBottom80 = Brc80(2, 0x00, 0x00, 0, false, false), Brc80 brcBottom80 = Brc80(2, 0x00, 0x00, 0, false, false),
Brc80 brcRight80 = Brc80(2, 0x00, 0x00, 0, false, false)) : m_oBinPictureInfo(), m_sTextType (std::wstring (&TextMark::Picture)), m_bOK(FALSE) Brc80 brcRight80 = Brc80(2, 0x00, 0x00, 0, false, false)) : m_oBinPictureInfo(), m_sTextType (std::wstring (&TextMark::Picture)), m_bOK(FALSE)
{ {
/*
// ONLY FOR TEST
if (0 == strFileName.length())
{
AVSDocFormatUtils::BitSet oShapeSettings (4);
oShapeSettings.SetBit (0, 0); // Group - A bit that specifies whether this shape is a group shape.
oShapeSettings.SetBit (0, 1); // Child - A bit that specifies whether this shape is a child shape.
oShapeSettings.SetBit (0, 2); // Patriarch - A bit that specifies whether this shape is the topmost group shape. Each drawing contains one topmost group shape
oShapeSettings.SetBit (0, 3); // Deleted - A bit that specifies whether this shape has been deleted.
oShapeSettings.SetBit (0, 4); // OleShape - A bit that specifies whether this shape is an OLE object.
oShapeSettings.SetBit (0, 5); // HaveMaster - A bit that specifies whether this shape has a valid master in the hspMaster property, as defined in section
oShapeSettings.SetBit (0, 6); // FlipH - A bit that specifies whether this shape is horizontally flipped.
oShapeSettings.SetBit (0, 7); // FlipV - A bit that specifies whether this shape is vertically flipped.
oShapeSettings.SetBit (0, 8); // Connector - A bit that specifies whether this shape is a connector shape.
oShapeSettings.SetBit (true, 9); // HaveAnchor - A bit that specifies whether this shape has an anchor.
oShapeSettings.SetBit (0, 10); // Background - A bit that specifies whether this shape is a background shape.
oShapeSettings.SetBit (true, 11); // HaveSpt - A bit that specifies whether this shape has a shape type property.
OfficeArt::OfficeArtFSP ShapeProp (OfficeArt::Enumerations::msosptUpArrow, 1024, FormatUtils::BytesToUInt32 (oShapeSettings.GetBytes(), 0, sizeof(unsigned int)));
OfficeArt::OfficeArtSpContainer shape;
shape.PushBack (ShapeProp);
OfficeArt::OfficeArtRGFOPTE oTable;
OfficeArt::OfficeArtFOPTE oEntry (OfficeArt::OfficeArtFOPTEOPID (OfficeArt::Enumerations::protectionBooleans, false, false), 0x01400140);
oTable.PushComplexProperty (OfficeArt::ComplexOfficeArtProperty (oEntry, NULL));
OfficeArt::OfficeArtFOPTE oCropFromTop (OfficeArt::OfficeArtFOPTEOPID (OfficeArt::Enumerations::cropFromTop, false, false), 0xffff0010);
oTable.PushComplexProperty (OfficeArt::ComplexOfficeArtProperty (oCropFromTop, NULL));
OfficeArt::OfficeArtFOPTE oCropFromBottom (OfficeArt::OfficeArtFOPTEOPID (OfficeArt::Enumerations::cropFromBottom, false, false), 0x0000fff0);
oTable.PushComplexProperty (OfficeArt::ComplexOfficeArtProperty (oCropFromBottom, NULL));
OfficeArt::OfficeArtRGFOPTE oTable2;
OfficeArt::OfficeArtFOPTE oDiagramBooleans (OfficeArt::OfficeArtFOPTEOPID (OfficeArt::Enumerations::diagramBooleans, false, false), 0x00010001);
oTable2.PushComplexProperty (OfficeArt::ComplexOfficeArtProperty (oDiagramBooleans, NULL));
OfficeArt::OfficeArtFOPT fopt (oTable);
shape.PushBack (fopt);
OfficeArt::OfficeArtFOPT fopt2 (oTable2);
shape.PushBack (fopt2);
OfficeArt::OfficeArtClientAnchor anchor (0x80000000);
shape.PushBack (anchor);
OfficeArt::OfficeArtInlineSpContainer oPicture (shape);
OfficeArt::OfficeArtFBSE oBlipStoreEntry (FALSE, OfficeArt::Enumerations::msoblipJPEG, OfficeArt::Enumerations::msoblipJPEG, 0);
oPicture.PushBack(oBlipStoreEntry);
PICMID oBorders (iWidth, iHeight, iRatioX, iRatioY, brcTop80, brcLeft80, brcBottom80, brcRight80);
//PICMID oBorders (2925, 3045, iRatioX, iRatioY, brcTop80, brcLeft80, brcBottom80, brcRight80);
PICF oPictureInfo (oPicture.Size(), oBorders);
m_oBinPictureInfo = PICFAndOfficeArtData (oPictureInfo, oPicture);
if (BinaryStorageSingleton::Instance())
{
int dataStreamOffset = BinaryStorageSingleton::Instance()->PushData( (const byte*)m_oBinPictureInfo, m_oBinPictureInfo.Size());
m_arProperties.push_back (Prl((short)DocFileFormat::sprmCPicLocation, (byte*)(&dataStreamOffset)));
m_arProperties.push_back (Prl((short)DocFileFormat::sprmCFSpec, (byte*)(&CFSpec)));
}
return;
}
*/
OfficeArt::BlipFactory oBlipFactory (strFileName); OfficeArt::BlipFactory oBlipFactory (strFileName);
boost::scoped_ptr<OfficeArt::OfficeArtBlip> oImage(oBlipFactory.GetOfficeArtBlip());
if (oImage.get()) OfficeArt::OfficeArtBlip* blip = oBlipFactory.GetOfficeArtBlip();
if (blip)
{ {
OfficeArt::OfficeArtSpContainer shape; OfficeArt::OfficeArtSpContainer shape;
OfficeArt::OfficeArtFSP shapeProp (OfficeArt::Enumerations::msosptPictureFrame); OfficeArt::OfficeArtFSP shapeProp (OfficeArt::Enumerations::msosptPictureFrame);
...@@ -121,14 +50,14 @@ namespace AVSDocFileFormat ...@@ -121,14 +50,14 @@ namespace AVSDocFileFormat
shape.PushBack (fopt); shape.PushBack (fopt);
OfficeArt::OfficeArtInlineSpContainer oPicture (shape); OfficeArt::OfficeArtInlineSpContainer oPicture (shape);
OfficeArt::OfficeArtFBSE oBlipStoreEntry (TRUE, oBlipFactory.GetBlipType(), oBlipFactory.GetBlipType(), oImage->Size() ); OfficeArt::OfficeArtFBSE oBlipStoreEntry (TRUE, oBlipFactory.GetBlipType(), oBlipFactory.GetBlipType(), blip->Size() );
oPicture.PushBack(oBlipStoreEntry); oPicture.PushBack(oBlipStoreEntry);
oPicture.PushBack(*oImage); oPicture.PushBack(*blip);
PICMID oBorders (iWidth, iHeight, iRatioX, iRatioY, brcTop80, brcLeft80, brcBottom80, brcRight80); PICMID oBorders (iWidth, iHeight, iRatioX, iRatioY, brcTop80, brcLeft80, brcBottom80, brcRight80);
PICF oPictureInfo (oPicture.Size(), oBorders); PICF oPictureInfo (oPicture.Size(), oBorders);
m_oBinPictureInfo = PICFAndOfficeArtData (oPictureInfo, oPicture); m_oBinPictureInfo = PICFAndOfficeArtData (oPictureInfo, oPicture);
if (BinaryStorageSingleton::Instance()) if (BinaryStorageSingleton::Instance())
{ {
...@@ -139,6 +68,8 @@ namespace AVSDocFileFormat ...@@ -139,6 +68,8 @@ namespace AVSDocFileFormat
m_bOK = TRUE; m_bOK = TRUE;
} }
RELEASEOBJECT(blip);
} }
} }
...@@ -201,19 +132,17 @@ namespace AVSDocFileFormat ...@@ -201,19 +132,17 @@ namespace AVSDocFileFormat
return (unsigned int)m_arProperties.size(); return (unsigned int)m_arProperties.size();
} }
//
inline BOOL IsValid() inline BOOL IsValid()
{ {
return m_bOK; return m_bOK;
} }
private: private:
BOOL m_bOK;
static const byte CFSpec = 1; static const byte CFSpec = 1;
BOOL m_bOK;
PICFAndOfficeArtData m_oBinPictureInfo; PICFAndOfficeArtData m_oBinPictureInfo;
std::wstring m_sTextType; std::wstring m_sTextType;
......
...@@ -15,8 +15,8 @@ namespace AVSDocFileFormat ...@@ -15,8 +15,8 @@ namespace AVSDocFileFormat
class Run : public IParagraphItem class Run : public IParagraphItem
{ {
protected: protected:
list<RunItem> items; std::list<RunItem> items;
list<Prl> properties; std::list<Prl> properties;
public: public:
typedef list<RunItem>::const_iterator const_iterator; typedef list<RunItem>::const_iterator const_iterator;
......
...@@ -4,30 +4,31 @@ ...@@ -4,30 +4,31 @@
namespace AVSDocFileFormat namespace AVSDocFileFormat
{ {
class RunItem: public Aggregat<IRunItem, RunItem> class RunItem : public Aggregat<IRunItem, RunItem>
{ {
public: public:
RunItem() : Aggregat() RunItem() : Aggregat()
{ {
} }
explicit RunItem( const IRunItem& _runItem ) : Aggregat(static_cast<IRunItem*>(_runItem.Clone())) explicit RunItem(const IRunItem& oRunItem) : Aggregat(static_cast<IRunItem*>(oRunItem.Clone()))
{ {
} }
RunItem( const RunItem& _runItem ) RunItem(const RunItem& oRunItem)
{ {
if ( _runItem.m_item.get() != NULL ) if (NULL != oRunItem.m_item.operator->())
{ {
this->m_item.reset( static_cast<IRunItem*>(_runItem.m_item->Clone()) ); m_item.reset( static_cast<IRunItem*>(oRunItem.m_item->Clone()));
} }
} }
RunItem& operator = ( const RunItem& _runItem ) RunItem& operator = (const RunItem& oRunItem)
{ {
if ( this->m_item != _runItem.m_item ) if (m_item.operator->() != oRunItem.m_item.operator->())
{ {
this->m_item.reset( static_cast<IRunItem*>(_runItem.m_item->Clone()) ); m_item.reset(static_cast<IRunItem*>(oRunItem.m_item->Clone()));
} }
return *this; return *this;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "OfficeArt/BlipFactory.h" #include "OfficeArt/BlipFactory.h"
#include "OfficeArt/OfficeArtFOPT.h" #include "OfficeArt/OfficeArtFOPT.h"
#include <boost/scoped_ptr.hpp>
#include "Logic/Pict.h" #include "Logic/Pict.h"
#include "Logic/DrawingWrap.h" #include "Logic/DrawingWrap.h"
...@@ -378,11 +377,13 @@ namespace AVSDocFileFormat ...@@ -378,11 +377,13 @@ namespace AVSDocFileFormat
virtual OfficeArtFBSE GetFBSE() virtual OfficeArtFBSE GetFBSE()
{ {
OfficeArt::BlipFactory oBlipFactory (m_strTextureFile); OfficeArt::BlipFactory oBlipFactory (m_strTextureFile);
boost::scoped_ptr<OfficeArt::OfficeArtBlip> oImage(oBlipFactory.GetOfficeArtBlip()); OfficeArt::OfficeArtBlip* blip = oBlipFactory.GetOfficeArtBlip();
if (oImage.get()) if (blip)
{ {
OfficeArt::OfficeArtFBSE oBlipStoreEntry (FALSE, oBlipFactory.GetBlipType(), oBlipFactory.GetBlipType(), oImage->Size(), oBlipFactory.Get_rgbUid1()); OfficeArt::OfficeArtFBSE oBlipStoreEntry (FALSE, oBlipFactory.GetBlipType(), oBlipFactory.GetBlipType(), blip->Size(), oBlipFactory.Get_rgbUid1());
oBlipStoreEntry.SetFoDelay(m_BlipPos); oBlipStoreEntry.SetFoDelay(m_BlipPos);
RELEASEOBJECT(blip);
return oBlipStoreEntry; return oBlipStoreEntry;
} }
......
...@@ -9,7 +9,7 @@ namespace AVSDocFileFormat ...@@ -9,7 +9,7 @@ namespace AVSDocFileFormat
for ( list<TableCellItemWithOffset>::iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) for ( list<TableCellItemWithOffset>::iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ )
{ {
Paragraph* paragraph = dynamic_cast<Paragraph*>( iter->tableCellItem.get() ); Paragraph* paragraph = dynamic_cast<Paragraph*>(iter->tableCellItem.operator->());
if ( paragraph != NULL ) if ( paragraph != NULL )
{ {
...@@ -18,7 +18,7 @@ namespace AVSDocFileFormat ...@@ -18,7 +18,7 @@ namespace AVSDocFileFormat
} }
if ( this->depth > 1 ) if ( this->depth > 1 )
{ {
Paragraph* paragraph = dynamic_cast<Paragraph*>( this->textItems.back().tableCellItem.get() ); Paragraph* paragraph = dynamic_cast<Paragraph*>(this->textItems.back().tableCellItem.operator->());
if ( paragraph != NULL ) if ( paragraph != NULL )
{ {
...@@ -78,15 +78,15 @@ namespace AVSDocFileFormat ...@@ -78,15 +78,15 @@ namespace AVSDocFileFormat
if ( !textItems.empty() ) if ( !textItems.empty() )
{ {
Paragraph* paragraph = dynamic_cast<Paragraph*>( this->textItems.back().tableCellItem.get() ); Paragraph* paragraph = dynamic_cast<Paragraph*>(textItems.back().tableCellItem.operator->());
if ( paragraph != NULL ) if ( paragraph != NULL )
{ {
paragraph->RemoveProperty( (short)DocFileFormat::sprmPFInnerTableCell, (void*)(&PFInnerTableCell) ); paragraph->RemoveProperty((short)DocFileFormat::sprmPFInnerTableCell, (void*)(&PFInnerTableCell));
} }
} }
Paragraph* paragraph = dynamic_cast<Paragraph*>( newTextItem.get() ); Paragraph* paragraph = dynamic_cast<Paragraph*>(newTextItem.operator->());
if ( paragraph != NULL ) if ( paragraph != NULL )
{ {
...@@ -109,7 +109,7 @@ namespace AVSDocFileFormat ...@@ -109,7 +109,7 @@ namespace AVSDocFileFormat
} }
this->textItems.push_back( TableCellItemWithOffset( newTextItem, this->tableCellItemsOffset ) ); this->textItems.push_back( TableCellItemWithOffset( newTextItem, this->tableCellItemsOffset ) );
this->tableCellItemsOffset += ( sizeof(WCHAR) * newTextItem.get()->GetAllText().size() ); this->tableCellItemsOffset += ( sizeof(WCHAR) * newTextItem.operator->()->GetAllText().size() );
//!!!TODO: Add empty run, if this is a paragraph. //!!!TODO: Add empty run, if this is a paragraph.
//(There is issue with table content, when last item in table cell is a picture)!!! //(There is issue with table content, when last item in table cell is a picture)!!!
......
...@@ -35,6 +35,6 @@ namespace AVSDocFileFormat ...@@ -35,6 +35,6 @@ namespace AVSDocFileFormat
protected: protected:
std::wstring text; std::wstring text;
list<Prl> properties; std::list<Prl> properties;
}; };
} }
\ No newline at end of file
...@@ -89,7 +89,8 @@ namespace AVSDocFileFormat ...@@ -89,7 +89,8 @@ namespace AVSDocFileFormat
for ( list<TextBoxItemWithOffset>::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) for ( list<TextBoxItemWithOffset>::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ )
{ {
vector<ITextItem*> textItemParagraphs = iter->textBoxItem->GetAllParagraphs(); ITextItem* item = (ITextItem*)iter->textBoxItem.operator->();
vector<ITextItem*> textItemParagraphs = item->GetAllParagraphs();
for ( vector<ITextItem*>::iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ ) for ( vector<ITextItem*>::iterator textItemParagraphsIter = textItemParagraphs.begin(); textItemParagraphsIter != textItemParagraphs.end(); textItemParagraphsIter++ )
{ {
......
...@@ -18,17 +18,17 @@ namespace AVSDocFileFormat ...@@ -18,17 +18,17 @@ namespace AVSDocFileFormat
TextItem (const TextItem& oItem) TextItem (const TextItem& oItem)
{ {
if (oItem.m_item.get()) if (oItem.m_item.operator->())
{ {
m_item.reset( static_cast<ITextItem*>(oItem.m_item->Clone())); m_item.reset(static_cast<ITextItem*>(oItem.m_item->Clone()));
} }
} }
TextItem& operator = (const TextItem& oItem) TextItem& operator = (const TextItem& oItem)
{ {
if (m_item != oItem.m_item) if (m_item.operator->() != oItem.m_item.operator->())
{ {
m_item.reset (static_cast<ITextItem*>(oItem.m_item->Clone())); m_item.reset(static_cast<ITextItem*>(oItem.m_item->Clone()));
} }
return *this; return *this;
...@@ -36,9 +36,9 @@ namespace AVSDocFileFormat ...@@ -36,9 +36,9 @@ namespace AVSDocFileFormat
TextItem& operator = (const ITextItem& oItem) TextItem& operator = (const ITextItem& oItem)
{ {
if (m_item.get() != &oItem) if (m_item.operator->() != &oItem)
{ {
m_item.reset( static_cast<ITextItem*>(oItem.Clone())); m_item.reset(static_cast<ITextItem*>(oItem.Clone()));
} }
return *this; return *this;
...@@ -46,21 +46,21 @@ namespace AVSDocFileFormat ...@@ -46,21 +46,21 @@ namespace AVSDocFileFormat
template<class T> vector<ParagraphItem> GetAllRunItemsByType() const template<class T> vector<ParagraphItem> GetAllRunItemsByType() const
{ {
vector<ParagraphItem> allParagraphItems; std::vector<ParagraphItem> allParagraphItems;
vector<unsigned int> paragraphsItemsOffsets; std::vector<unsigned int> paragraphsItemsOffsets;
vector<IParagraphItemPtr> paragraphsItems = m_item->GetAllRunsCopy( &paragraphsItemsOffsets ); std::vector<IParagraphItemPtr> paragraphsItems = m_item->GetAllRunsCopy(&paragraphsItemsOffsets);
for (size_t i = 0; i < paragraphsItems.size(); ++i) for (size_t i = 0; i < paragraphsItems.size(); ++i)
{ {
Run* run = dynamic_cast<Run*>(paragraphsItems[i].get()); Run* run = dynamic_cast<Run*>(paragraphsItems[i].operator->());
if (run) if (run)
{ {
for (list<RunItem>::const_iterator iter = run->begin(); iter != run->end(); ++iter) for (std::list<RunItem>::const_iterator iter = run->begin(); iter != run->end(); ++iter)
{ {
if ( iter->is<T>() ) if (iter->is<T>())
{ {
allParagraphItems.push_back( ParagraphItem( *run, paragraphsItemsOffsets[i] ) ); allParagraphItems.push_back(ParagraphItem(*run, paragraphsItemsOffsets[i]));
} }
} }
} }
...@@ -71,14 +71,14 @@ namespace AVSDocFileFormat ...@@ -71,14 +71,14 @@ namespace AVSDocFileFormat
template<class T> vector<ParagraphItem> GetAllParagraphItemsByType() const template<class T> vector<ParagraphItem> GetAllParagraphItemsByType() const
{ {
vector<ParagraphItem> allParagraphItems; std::vector<ParagraphItem> allParagraphItems;
vector<unsigned int> paragraphsItemsOffsets; std::vector<unsigned int> paragraphsItemsOffsets;
vector<IParagraphItemPtr> paragraphsItems = m_item->GetAllParagraphItemsCopy( &paragraphsItemsOffsets ); std::vector<IParagraphItemPtr> paragraphsItems = m_item->GetAllParagraphItemsCopy(&paragraphsItemsOffsets);
for (size_t i = 0; i < paragraphsItems.size(); ++i) for (size_t i = 0; i < paragraphsItems.size(); ++i)
{ {
T* paragraphItem = dynamic_cast<T*>( paragraphsItems[i].get() ); T* paragraphItem = dynamic_cast<T*>(paragraphsItems[i].operator->());
if (paragraphItem) if (paragraphItem)
{ {
allParagraphItems.push_back( ParagraphItem( *paragraphItem, paragraphsItemsOffsets[i] ) ); allParagraphItems.push_back( ParagraphItem( *paragraphItem, paragraphsItemsOffsets[i] ) );
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment