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->();
} }
T* get() const const T* get() const
{ {
return this->m_item.get(); return m_item.operator->();
} }
T* operator -> () const T* operator ->()
{ {
return this->m_item.operator -> (); return m_item.operator->();
}
const T* operator ->() const
{
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;
...@@ -654,47 +574,45 @@ namespace AVSDocFormatUtils ...@@ -654,47 +574,45 @@ 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 )
{ {
......
#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)
......
...@@ -3,15 +3,11 @@ ...@@ -3,15 +3,11 @@
namespace AVSDocFileFormat namespace AVSDocFileFormat
{ {
Endnote::Endnote( short _aFtnIdx ): Endnote::Endnote( short _aFtnIdx ) : endnoteItemsOffset(0), aFtnIdx(_aFtnIdx)
endnoteItemsOffset(0), aFtnIdx(_aFtnIdx)
{ {
} }
/*========================================================================================================*/ Endnote::Endnote( const Endnote& _endnote ) : endnoteItemsOffset(_endnote.endnoteItemsOffset), aFtnIdx(_endnote.aFtnIdx)
Endnote::Endnote( const Endnote& _endnote ):
endnoteItemsOffset(_endnote.endnoteItemsOffset), aFtnIdx(_endnote.aFtnIdx)
{ {
for ( list<EndnoteItemWithOffset>::const_iterator iter = _endnote.textItems.begin(); iter != _endnote.textItems.end(); iter++ ) for ( list<EndnoteItemWithOffset>::const_iterator iter = _endnote.textItems.begin(); iter != _endnote.textItems.end(); iter++ )
{ {
...@@ -19,8 +15,6 @@ namespace AVSDocFileFormat ...@@ -19,8 +15,6 @@ namespace AVSDocFileFormat
} }
} }
/*========================================================================================================*/
void Endnote::AddTextItem( const ITextItem& _textItem ) void Endnote::AddTextItem( const ITextItem& _textItem )
{ {
ITextItem* textItem = static_cast<ITextItem*>( _textItem.Clone() ); ITextItem* textItem = static_cast<ITextItem*>( _textItem.Clone() );
...@@ -32,21 +26,15 @@ namespace AVSDocFileFormat ...@@ -32,21 +26,15 @@ namespace AVSDocFileFormat
} }
} }
/*========================================================================================================*/
short Endnote::GetIndex() const short Endnote::GetIndex() const
{ {
return this->aFtnIdx; return this->aFtnIdx;
} }
/*========================================================================================================*/
Endnote::~Endnote() Endnote::~Endnote()
{ {
} }
/*========================================================================================================*/
wstring Endnote::GetAllText() const wstring Endnote::GetAllText() const
{ {
wstring allText; wstring allText;
...@@ -59,8 +47,6 @@ namespace AVSDocFileFormat ...@@ -59,8 +47,6 @@ namespace AVSDocFileFormat
return allText; return allText;
} }
/*========================================================================================================*/
Endnote::operator wstring() const Endnote::operator wstring() const
{ {
wstring allText; wstring allText;
...@@ -73,8 +59,6 @@ namespace AVSDocFileFormat ...@@ -73,8 +59,6 @@ namespace AVSDocFileFormat
return allText; return allText;
} }
/*========================================================================================================*/
vector<TextItemPtr> Endnote::GetAllParagraphsCopy() const vector<TextItemPtr> Endnote::GetAllParagraphsCopy() const
{ {
vector<TextItemPtr> allParagraphs; vector<TextItemPtr> allParagraphs;
...@@ -92,13 +76,11 @@ namespace AVSDocFileFormat ...@@ -92,13 +76,11 @@ namespace AVSDocFileFormat
return allParagraphs; return allParagraphs;
} }
/*========================================================================================================*/
vector<ITextItem*> Endnote::GetAllParagraphs() vector<ITextItem*> Endnote::GetAllParagraphs()
{ {
vector<ITextItem*> allParagraphs; vector<ITextItem*> allParagraphs;
for ( list<EndnoteItemWithOffset>::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) for (std::list<EndnoteItemWithOffset>::iterator iter = textItems.begin(); iter != textItems.end(); ++iter)
{ {
vector<ITextItem*> textItemParagraphs = iter->endnoteItem->GetAllParagraphs(); vector<ITextItem*> textItemParagraphs = iter->endnoteItem->GetAllParagraphs();
...@@ -111,8 +93,6 @@ namespace AVSDocFileFormat ...@@ -111,8 +93,6 @@ namespace AVSDocFileFormat
return allParagraphs; return allParagraphs;
} }
/*========================================================================================================*/
vector<PapxInFkp> Endnote::GetAllParagraphsProperties( vector<unsigned int>* allParagraphsOffsets ) const vector<PapxInFkp> Endnote::GetAllParagraphsProperties( vector<unsigned int>* allParagraphsOffsets ) const
{ {
vector<PapxInFkp> allParagraphsProperties; vector<PapxInFkp> allParagraphsProperties;
...@@ -138,8 +118,6 @@ namespace AVSDocFileFormat ...@@ -138,8 +118,6 @@ namespace AVSDocFileFormat
return allParagraphsProperties; return allParagraphsProperties;
} }
/*========================================================================================================*/
vector<Chpx> Endnote::GetAllRunProperties( vector<unsigned int>* allRunsOffsets ) const vector<Chpx> Endnote::GetAllRunProperties( vector<unsigned int>* allRunsOffsets ) const
{ {
vector<Chpx> allRunsProperties; vector<Chpx> allRunsProperties;
...@@ -165,8 +143,6 @@ namespace AVSDocFileFormat ...@@ -165,8 +143,6 @@ namespace AVSDocFileFormat
return allRunsProperties; return allRunsProperties;
} }
/*========================================================================================================*/
vector<IParagraphItemPtr> Endnote::GetAllRunsCopy( vector<unsigned int>* allRunsOffsets ) const vector<IParagraphItemPtr> Endnote::GetAllRunsCopy( vector<unsigned int>* allRunsOffsets ) const
{ {
vector<IParagraphItemPtr> allRuns; vector<IParagraphItemPtr> allRuns;
...@@ -193,8 +169,6 @@ namespace AVSDocFileFormat ...@@ -193,8 +169,6 @@ namespace AVSDocFileFormat
return allRuns; return allRuns;
} }
/*========================================================================================================*/
vector<IParagraphItemPtr> Endnote::GetAllParagraphItemsCopy( vector<unsigned int>* allParagraphItemsOffsets ) const vector<IParagraphItemPtr> Endnote::GetAllParagraphItemsCopy( vector<unsigned int>* allParagraphItemsOffsets ) const
{ {
vector<IParagraphItemPtr> allParagraphItems; vector<IParagraphItemPtr> allParagraphItems;
...@@ -221,17 +195,13 @@ namespace AVSDocFileFormat ...@@ -221,17 +195,13 @@ namespace AVSDocFileFormat
return allParagraphItems; return allParagraphItems;
} }
/*========================================================================================================*/
IVirtualConstructor* Endnote::New() const IVirtualConstructor* Endnote::New() const
{ {
return new Endnote(); return new Endnote();
} }
/*========================================================================================================*/
IVirtualConstructor* Endnote::Clone() const IVirtualConstructor* Endnote::Clone() const
{ {
return new Endnote( *this ); return new Endnote(*this);
} }
} }
\ No newline at end of file
...@@ -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:
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
namespace AVSDocFileFormat namespace AVSDocFileFormat
{ {
Footer::Footer(): Footer::Footer() : footerItemsOffset(0)
footerItemsOffset(0)
{ {
Paragraph paragraph; Paragraph paragraph;
paragraph.AddParagraphItem( Run() ); paragraph.AddParagraphItem( Run() );
...@@ -12,10 +11,7 @@ namespace AVSDocFileFormat ...@@ -12,10 +11,7 @@ namespace AVSDocFileFormat
this->footerItemsOffset += ( sizeof(WCHAR) * paragraph.GetAllText().size() ); this->footerItemsOffset += ( sizeof(WCHAR) * paragraph.GetAllText().size() );
} }
/*========================================================================================================*/ Footer::Footer( const Footer& _footer ) : footerItemsOffset(_footer.footerItemsOffset)
Footer::Footer( const Footer& _footer ):
footerItemsOffset(_footer.footerItemsOffset)
{ {
for ( list<FooterItemWithOffset>::const_iterator iter = _footer.textItems.begin(); iter != _footer.textItems.end(); iter++ ) for ( list<FooterItemWithOffset>::const_iterator iter = _footer.textItems.begin(); iter != _footer.textItems.end(); iter++ )
{ {
...@@ -23,8 +19,6 @@ namespace AVSDocFileFormat ...@@ -23,8 +19,6 @@ namespace AVSDocFileFormat
} }
} }
/*========================================================================================================*/
void Footer::AddTextItem( const ITextItem& _textItem ) void Footer::AddTextItem( const ITextItem& _textItem )
{ {
ITextItem* textItem = static_cast<ITextItem*>( _textItem.Clone() ); ITextItem* textItem = static_cast<ITextItem*>( _textItem.Clone() );
...@@ -51,14 +45,10 @@ namespace AVSDocFileFormat ...@@ -51,14 +45,10 @@ namespace AVSDocFileFormat
} }
} }
/*========================================================================================================*/
Footer::~Footer() Footer::~Footer()
{ {
} }
/*========================================================================================================*/
wstring Footer::GetAllText() const wstring Footer::GetAllText() const
{ {
wstring allText; wstring allText;
...@@ -71,8 +61,6 @@ namespace AVSDocFileFormat ...@@ -71,8 +61,6 @@ namespace AVSDocFileFormat
return allText; return allText;
} }
/*========================================================================================================*/
Footer::operator wstring() const Footer::operator wstring() const
{ {
wstring allText; wstring allText;
...@@ -85,8 +73,6 @@ namespace AVSDocFileFormat ...@@ -85,8 +73,6 @@ namespace AVSDocFileFormat
return allText; return allText;
} }
/*========================================================================================================*/
vector<TextItemPtr> Footer::GetAllParagraphsCopy() const vector<TextItemPtr> Footer::GetAllParagraphsCopy() const
{ {
vector<TextItemPtr> allParagraphs; vector<TextItemPtr> allParagraphs;
...@@ -104,15 +90,15 @@ namespace AVSDocFileFormat ...@@ -104,15 +90,15 @@ namespace AVSDocFileFormat
return allParagraphs; return allParagraphs;
} }
/*========================================================================================================*/
vector<ITextItem*> Footer::GetAllParagraphs() vector<ITextItem*> Footer::GetAllParagraphs()
{ {
vector<ITextItem*> allParagraphs; vector<ITextItem*> allParagraphs;
for ( list<FooterItemWithOffset>::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) for ( list<FooterItemWithOffset>::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ )
{ {
vector<ITextItem*> textItemParagraphs = iter->footerItem->GetAllParagraphs(); ITextItem* item = (ITextItem*)iter->footerItem.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++ )
{ {
...@@ -123,8 +109,6 @@ namespace AVSDocFileFormat ...@@ -123,8 +109,6 @@ namespace AVSDocFileFormat
return allParagraphs; return allParagraphs;
} }
/*========================================================================================================*/
vector<PapxInFkp> Footer::GetAllParagraphsProperties( vector<unsigned int>* allParagraphsOffsets ) const vector<PapxInFkp> Footer::GetAllParagraphsProperties( vector<unsigned int>* allParagraphsOffsets ) const
{ {
vector<PapxInFkp> allParagraphsProperties; vector<PapxInFkp> allParagraphsProperties;
...@@ -150,8 +134,6 @@ namespace AVSDocFileFormat ...@@ -150,8 +134,6 @@ namespace AVSDocFileFormat
return allParagraphsProperties; return allParagraphsProperties;
} }
/*========================================================================================================*/
vector<Chpx> Footer::GetAllRunProperties( vector<unsigned int>* allRunsOffsets ) const vector<Chpx> Footer::GetAllRunProperties( vector<unsigned int>* allRunsOffsets ) const
{ {
vector<Chpx> allRunsProperties; vector<Chpx> allRunsProperties;
...@@ -177,8 +159,6 @@ namespace AVSDocFileFormat ...@@ -177,8 +159,6 @@ namespace AVSDocFileFormat
return allRunsProperties; return allRunsProperties;
} }
/*========================================================================================================*/
vector<IParagraphItemPtr> Footer::GetAllRunsCopy( vector<unsigned int>* allRunsOffsets ) const vector<IParagraphItemPtr> Footer::GetAllRunsCopy( vector<unsigned int>* allRunsOffsets ) const
{ {
vector<IParagraphItemPtr> allRuns; vector<IParagraphItemPtr> allRuns;
...@@ -205,8 +185,6 @@ namespace AVSDocFileFormat ...@@ -205,8 +185,6 @@ namespace AVSDocFileFormat
return allRuns; return allRuns;
} }
/*========================================================================================================*/
vector<IParagraphItemPtr> Footer::GetAllParagraphItemsCopy( vector<unsigned int>* allParagraphItemsOffsets ) const vector<IParagraphItemPtr> Footer::GetAllParagraphItemsCopy( vector<unsigned int>* allParagraphItemsOffsets ) const
{ {
vector<IParagraphItemPtr> allParagraphItems; vector<IParagraphItemPtr> allParagraphItems;
...@@ -233,15 +211,11 @@ namespace AVSDocFileFormat ...@@ -233,15 +211,11 @@ namespace AVSDocFileFormat
return allParagraphItems; return allParagraphItems;
} }
/*========================================================================================================*/
IVirtualConstructor* Footer::New() const IVirtualConstructor* Footer::New() const
{ {
return new Footer(); return new Footer();
} }
/*========================================================================================================*/
IVirtualConstructor* Footer::Clone() const IVirtualConstructor* Footer::Clone() const
{ {
return new Footer( *this ); return new Footer( *this );
......
...@@ -11,14 +11,14 @@ namespace AVSDocFileFormat ...@@ -11,14 +11,14 @@ namespace AVSDocFileFormat
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)
{ {
} }
}; };
......
...@@ -3,15 +3,11 @@ ...@@ -3,15 +3,11 @@
namespace AVSDocFileFormat namespace AVSDocFileFormat
{ {
Footnote::Footnote( short _aFtnIdx ): Footnote::Footnote( short _aFtnIdx ) : footnoteItemsOffset(0), aFtnIdx(_aFtnIdx)
footnoteItemsOffset(0), aFtnIdx(_aFtnIdx)
{ {
} }
/*========================================================================================================*/ Footnote::Footnote( const Footnote& _footnote ) : footnoteItemsOffset(_footnote.footnoteItemsOffset), aFtnIdx(_footnote.aFtnIdx)
Footnote::Footnote( const Footnote& _footnote ):
footnoteItemsOffset(_footnote.footnoteItemsOffset), aFtnIdx(_footnote.aFtnIdx)
{ {
for ( list<FootnoteItemWithOffset>::const_iterator iter = _footnote.textItems.begin(); iter != _footnote.textItems.end(); iter++ ) for ( list<FootnoteItemWithOffset>::const_iterator iter = _footnote.textItems.begin(); iter != _footnote.textItems.end(); iter++ )
{ {
...@@ -19,8 +15,6 @@ namespace AVSDocFileFormat ...@@ -19,8 +15,6 @@ namespace AVSDocFileFormat
} }
} }
/*========================================================================================================*/
void Footnote::AddTextItem( const ITextItem& _textItem ) void Footnote::AddTextItem( const ITextItem& _textItem )
{ {
ITextItem* textItem = static_cast<ITextItem*>( _textItem.Clone() ); ITextItem* textItem = static_cast<ITextItem*>( _textItem.Clone() );
...@@ -32,21 +26,15 @@ namespace AVSDocFileFormat ...@@ -32,21 +26,15 @@ namespace AVSDocFileFormat
} }
} }
/*========================================================================================================*/
short Footnote::GetIndex() const short Footnote::GetIndex() const
{ {
return this->aFtnIdx; return this->aFtnIdx;
} }
/*========================================================================================================*/
Footnote::~Footnote() Footnote::~Footnote()
{ {
} }
/*========================================================================================================*/
wstring Footnote::GetAllText() const wstring Footnote::GetAllText() const
{ {
wstring allText; wstring allText;
...@@ -59,8 +47,6 @@ namespace AVSDocFileFormat ...@@ -59,8 +47,6 @@ namespace AVSDocFileFormat
return allText; return allText;
} }
/*========================================================================================================*/
Footnote::operator wstring() const Footnote::operator wstring() const
{ {
wstring allText; wstring allText;
...@@ -73,8 +59,6 @@ namespace AVSDocFileFormat ...@@ -73,8 +59,6 @@ namespace AVSDocFileFormat
return allText; return allText;
} }
/*========================================================================================================*/
vector<TextItemPtr> Footnote::GetAllParagraphsCopy() const vector<TextItemPtr> Footnote::GetAllParagraphsCopy() const
{ {
vector<TextItemPtr> allParagraphs; vector<TextItemPtr> allParagraphs;
...@@ -92,15 +76,15 @@ namespace AVSDocFileFormat ...@@ -92,15 +76,15 @@ namespace AVSDocFileFormat
return allParagraphs; return allParagraphs;
} }
/*========================================================================================================*/
vector<ITextItem*> Footnote::GetAllParagraphs() vector<ITextItem*> Footnote::GetAllParagraphs()
{ {
vector<ITextItem*> allParagraphs; vector<ITextItem*> allParagraphs;
for ( list<FootnoteItemWithOffset>::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ ) for ( list<FootnoteItemWithOffset>::const_iterator iter = this->textItems.begin(); iter != this->textItems.end(); iter++ )
{ {
vector<ITextItem*> textItemParagraphs = iter->footnoteItem->GetAllParagraphs(); ITextItem* item = (ITextItem*)iter->footnoteItem.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++ )
{ {
...@@ -111,8 +95,6 @@ namespace AVSDocFileFormat ...@@ -111,8 +95,6 @@ namespace AVSDocFileFormat
return allParagraphs; return allParagraphs;
} }
/*========================================================================================================*/
vector<PapxInFkp> Footnote::GetAllParagraphsProperties( vector<unsigned int>* allParagraphsOffsets ) const vector<PapxInFkp> Footnote::GetAllParagraphsProperties( vector<unsigned int>* allParagraphsOffsets ) const
{ {
vector<PapxInFkp> allParagraphsProperties; vector<PapxInFkp> allParagraphsProperties;
...@@ -138,8 +120,6 @@ namespace AVSDocFileFormat ...@@ -138,8 +120,6 @@ namespace AVSDocFileFormat
return allParagraphsProperties; return allParagraphsProperties;
} }
/*========================================================================================================*/
vector<Chpx> Footnote::GetAllRunProperties( vector<unsigned int>* allRunsOffsets ) const vector<Chpx> Footnote::GetAllRunProperties( vector<unsigned int>* allRunsOffsets ) const
{ {
vector<Chpx> allRunsProperties; vector<Chpx> allRunsProperties;
...@@ -165,8 +145,6 @@ namespace AVSDocFileFormat ...@@ -165,8 +145,6 @@ namespace AVSDocFileFormat
return allRunsProperties; return allRunsProperties;
} }
/*========================================================================================================*/
vector<IParagraphItemPtr> Footnote::GetAllRunsCopy( vector<unsigned int>* allRunsOffsets ) const vector<IParagraphItemPtr> Footnote::GetAllRunsCopy( vector<unsigned int>* allRunsOffsets ) const
{ {
vector<IParagraphItemPtr> allRuns; vector<IParagraphItemPtr> allRuns;
...@@ -193,8 +171,6 @@ namespace AVSDocFileFormat ...@@ -193,8 +171,6 @@ namespace AVSDocFileFormat
return allRuns; return allRuns;
} }
/*========================================================================================================*/
vector<IParagraphItemPtr> Footnote::GetAllParagraphItemsCopy( vector<unsigned int>* allParagraphItemsOffsets ) const vector<IParagraphItemPtr> Footnote::GetAllParagraphItemsCopy( vector<unsigned int>* allParagraphItemsOffsets ) const
{ {
vector<IParagraphItemPtr> allParagraphItems; vector<IParagraphItemPtr> allParagraphItems;
...@@ -221,15 +197,11 @@ namespace AVSDocFileFormat ...@@ -221,15 +197,11 @@ namespace AVSDocFileFormat
return allParagraphItems; return allParagraphItems;
} }
/*========================================================================================================*/
IVirtualConstructor* Footnote::New() const IVirtualConstructor* Footnote::New() const
{ {
return new Footnote(); return new Footnote();
} }
/*========================================================================================================*/
IVirtualConstructor* Footnote::Clone() const IVirtualConstructor* Footnote::Clone() const
{ {
return new Footnote( *this ); return new Footnote( *this );
......
...@@ -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,13 +2,15 @@ ...@@ -2,13 +2,15 @@
#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;
......
...@@ -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();
} }
} }
......
...@@ -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,6 +105,7 @@ namespace OfficeArt ...@@ -108,6 +105,7 @@ namespace OfficeArt
} }
protected: protected:
list<OfficeArtRecordPtr> officeArtRecords; list<OfficeArtRecordPtr> officeArtRecords;
byte* bytes; byte* bytes;
......
...@@ -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,41 +73,40 @@ namespace OfficeArt ...@@ -76,41 +73,40 @@ 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();
} }
} }
......
...@@ -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();
} }
} }
...@@ -122,7 +119,7 @@ namespace OfficeArt ...@@ -122,7 +119,7 @@ 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;
......
...@@ -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();
} }
} }
......
...@@ -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
...@@ -6,12 +6,12 @@ namespace OfficeArt ...@@ -6,12 +6,12 @@ namespace OfficeArt
{ {
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,9 +50,9 @@ namespace AVSDocFileFormat ...@@ -121,9 +50,9 @@ 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);
...@@ -139,6 +68,8 @@ namespace AVSDocFileFormat ...@@ -139,6 +68,8 @@ namespace AVSDocFileFormat
m_bOK = TRUE; m_bOK = TRUE;
} }
RELEASEOBJECT(blip);
} }
} }
...@@ -201,8 +132,6 @@ namespace AVSDocFileFormat ...@@ -201,8 +132,6 @@ 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;
...@@ -210,10 +139,10 @@ namespace AVSDocFileFormat ...@@ -210,10 +139,10 @@ namespace AVSDocFileFormat
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;
......
...@@ -8,124 +8,100 @@ namespace AVSDocFileFormat ...@@ -8,124 +8,100 @@ namespace AVSDocFileFormat
{ {
class SectionProperties class SectionProperties
{ {
private:
Sepx sepx;
TextItem evenPageHeader;
TextItem oddPageHeader;
TextItem evenPageFooter;
TextItem oddPageFooter;
TextItem firstPageHeader;
TextItem firstPageFooter;
public: public:
explicit SectionProperties( const Sepx& _sepx ): explicit SectionProperties(const Sepx& _sepx) : sepx(_sepx)
sepx(_sepx)
{
this->SetEvenPageHeader( Header() );
this->SetOddPageHeader( Header() );
this->SetEvenPageFooter( Footer() );
this->SetOddPageFooter( Footer() );
this->SetFirstPageHeader( Header() );
this->SetFirstPageFooter( Footer() );
}
SectionProperties( const SectionProperties& _sectionProperties ):
sepx(_sectionProperties.sepx)
{
if ( _sectionProperties.evenPageHeader.get() != NULL )
{ {
this->SetEvenPageHeader( _sectionProperties.evenPageHeader.as<Header>() ); SetEvenPageHeader(Header());
SetOddPageHeader(Header());
SetEvenPageFooter(Footer());
SetOddPageFooter(Footer());
SetFirstPageHeader(Header());
SetFirstPageFooter(Footer());
} }
if ( _sectionProperties.oddPageHeader.get() != NULL ) SectionProperties(const SectionProperties& sp) : sepx(sp.sepx)
{ {
this->SetOddPageHeader( _sectionProperties.oddPageHeader.as<Header>() ); if (sp.evenPageHeader.IsInit()) SetEvenPageHeader(sp.evenPageHeader.as<Header>());
if (sp.oddPageHeader.IsInit()) SetOddPageHeader(sp.oddPageHeader.as<Header>());
if (sp.evenPageFooter.IsInit()) SetEvenPageFooter(sp.evenPageFooter.as<Footer>());
if (sp.oddPageFooter.IsInit()) SetOddPageFooter(sp.oddPageFooter.as<Footer>());
if (sp.firstPageHeader.IsInit()) SetFirstPageHeader(sp.firstPageHeader.as<Header>());
if (sp.firstPageFooter.IsInit()) SetFirstPageFooter(sp.firstPageFooter.as<Footer>());
} }
if ( _sectionProperties.evenPageFooter.get() != NULL ) inline const Sepx& GetSepx() const
{ {
this->SetEvenPageFooter( _sectionProperties.evenPageFooter.as<Footer>() ); return sepx;
} }
if ( _sectionProperties.oddPageFooter.get() != NULL ) inline void SetEvenPageHeader(const Header& _header)
{ {
this->SetOddPageFooter( _sectionProperties.oddPageFooter.as<Footer>() ); evenPageHeader = _header;
} }
if ( _sectionProperties.firstPageHeader.get() != NULL ) inline void SetOddPageHeader(const Header& _header)
{ {
this->SetFirstPageHeader( _sectionProperties.firstPageHeader.as<Header>() ); oddPageHeader = _header;
}
if ( _sectionProperties.firstPageFooter.get() != NULL )
{
this->SetFirstPageFooter( _sectionProperties.firstPageFooter.as<Footer>() );
}
} }
const Sepx& GetSepx() const inline void SetEvenPageFooter(const Footer& _footer)
{ {
return this->sepx; evenPageFooter = _footer;
} }
void SetEvenPageHeader( const Header& _header ) inline void SetOddPageFooter(const Footer& _footer)
{ {
this->evenPageHeader = _header; oddPageFooter = _footer;
} }
void SetOddPageHeader( const Header& _header ) inline void SetFirstPageHeader(const Header& _header)
{ {
this->oddPageHeader = _header; firstPageHeader = _header;
} }
void SetEvenPageFooter( const Footer& _footer ) inline void SetFirstPageFooter(const Footer& _footer)
{ {
this->evenPageFooter = _footer; firstPageFooter = _footer;
} }
void SetOddPageFooter( const Footer& _footer ) inline const Header* GetEvenPageHeader() const
{ {
this->oddPageFooter = _footer; return static_cast<const Header*>(evenPageHeader.Get());
} }
void SetFirstPageHeader( const Header& _header ) inline const Header* GetOddPageHeader() const
{ {
this->firstPageHeader = _header; return static_cast<const Header*>(oddPageHeader.Get());
} }
void SetFirstPageFooter( const Footer& _footer ) inline const Footer* GetEvenPageFooter() const
{ {
this->firstPageFooter = _footer; return static_cast<const Footer*>(evenPageFooter.Get());
} }
const Header* GetEvenPageHeader() const inline const Footer* GetOddPageFooter() const
{ {
return static_cast<const Header*>(this->evenPageHeader.get()); return static_cast<const Footer*>(oddPageFooter.Get());
} }
const Header* GetOddPageHeader() const inline const Header* GetFirstPageHeader() const
{ {
return static_cast<const Header*>(this->oddPageHeader.get()); return static_cast<const Header*>(firstPageHeader.Get());
} }
const Footer* GetEvenPageFooter() const inline const Footer* GetFirstPageFooter() const
{ {
return static_cast<const Footer*>(this->evenPageFooter.get()); return static_cast<const Footer*>(firstPageFooter.Get());
} }
const Footer* GetOddPageFooter() const private:
{
return static_cast<const Footer*>(this->oddPageFooter.get());
}
const Header* GetFirstPageHeader() const
{
return static_cast<const Header*>(this->firstPageHeader.get());
}
const Footer* GetFirstPageFooter() const Sepx sepx;
{ TextItem evenPageHeader;
return static_cast<const Footer*>(this->firstPageFooter.get()); TextItem oddPageHeader;
} TextItem evenPageFooter;
TextItem oddPageFooter;
TextItem firstPageHeader;
TextItem firstPageFooter;
}; };
} }
\ No newline at end of file
...@@ -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] ) );
......
...@@ -13,28 +13,32 @@ EndProject ...@@ -13,28 +13,32 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "..\Common\ASCDocxFormat\Projects\Common2005.vcproj", "{399893AA-3617-4CD8-A980-7F15CDAFA3D2}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "..\Common\ASCDocxFormat\Projects\Common2005.vcproj", "{399893AA-3617-4CD8-A980-7F15CDAFA3D2}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{7B9F3647-32D3-4F82-8CA5-A43E490E1457} = {7B9F3647-32D3-4F82-8CA5-A43E490E1457} {7B9F3647-32D3-4F82-8CA5-A43E490E1457} = {7B9F3647-32D3-4F82-8CA5-A43E490E1457}
{918D1327-C6ED-43E6-AE22-84A3736F0E87} = {918D1327-C6ED-43E6-AE22-84A3736F0E87}
{C1587C15-6268-4451-9263-937E63A945F6} = {C1587C15-6268-4451-9263-937E63A945F6}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\Common\ASCDocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\Common\ASCDocxFormat\Projects\DocxFormat2005.vcproj", "{A100103A-353E-45E8-A9B8-90B87CC5C0B0}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{C1587C15-6268-4451-9263-937E63A945F6} = {C1587C15-6268-4451-9263-937E63A945F6}
{918D1327-C6ED-43E6-AE22-84A3736F0E87} = {918D1327-C6ED-43E6-AE22-84A3736F0E87}
{399893AA-3617-4CD8-A980-7F15CDAFA3D2} = {399893AA-3617-4CD8-A980-7F15CDAFA3D2} {399893AA-3617-4CD8-A980-7F15CDAFA3D2} = {399893AA-3617-4CD8-A980-7F15CDAFA3D2}
{7B9F3647-32D3-4F82-8CA5-A43E490E1457} = {7B9F3647-32D3-4F82-8CA5-A43E490E1457} {7B9F3647-32D3-4F82-8CA5-A43E490E1457} = {7B9F3647-32D3-4F82-8CA5-A43E490E1457}
{C1587C15-6268-4451-9263-937E63A945F6} = {C1587C15-6268-4451-9263-937E63A945F6}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML", "..\Common\ASCDocxFormat\Projects\XML2005.vcproj", "{C1587C15-6268-4451-9263-937E63A945F6}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML", "..\Common\ASCDocxFormat\Projects\XML2005.vcproj", "{C1587C15-6268-4451-9263-937E63A945F6}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{918D1327-C6ED-43E6-AE22-84A3736F0E87} = {918D1327-C6ED-43E6-AE22-84A3736F0E87}
{7B9F3647-32D3-4F82-8CA5-A43E490E1457} = {7B9F3647-32D3-4F82-8CA5-A43E490E1457} {7B9F3647-32D3-4F82-8CA5-A43E490E1457} = {7B9F3647-32D3-4F82-8CA5-A43E490E1457}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utility", "..\Common\ASCDocxFormat\Projects\Utility2005.vcproj", "{7B9F3647-32D3-4F82-8CA5-A43E490E1457}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utility", "..\Common\ASCDocxFormat\Projects\Utility2005.vcproj", "{7B9F3647-32D3-4F82-8CA5-A43E490E1457}"
ProjectSection(ProjectDependencies) = postProject
{918D1327-C6ED-43E6-AE22-84A3736F0E87} = {918D1327-C6ED-43E6-AE22-84A3736F0E87}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeSvmFile", "..\ASCImageStudio3\ASCGraphics\OfficeSvmFile\OfficeSvmFile2005.vcproj", "{918D1327-C6ED-43E6-AE22-84A3736F0E87}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeSvmFile", "..\ASCImageStudio3\ASCGraphics\OfficeSvmFile\OfficeSvmFile2005.vcproj", "{918D1327-C6ED-43E6-AE22-84A3736F0E87}"
EndProject EndProject
Global Global
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
...@@ -81,4 +85,7 @@ Global ...@@ -81,4 +85,7 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
EndGlobal EndGlobal
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