mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
x2t -deleting atl relations
This commit is contained in:
@ -72,6 +72,8 @@ namespace DocFileFormat
|
||||
_isSectionPageBreak = 0;
|
||||
_isTextBoxContent = false;
|
||||
_embeddedObject = false;
|
||||
|
||||
_cacheListNum = -1;
|
||||
}
|
||||
|
||||
DocumentMapping::~DocumentMapping()
|
||||
@ -101,6 +103,22 @@ namespace DocFileFormat
|
||||
|
||||
return m_document->SectionPlex->CharacterPositions[current + 1];
|
||||
}
|
||||
int DocumentMapping::getListNumCache(int fc, int fc_end)
|
||||
{
|
||||
if ( !m_document->ListPlex ) return -1;
|
||||
|
||||
for (int i = 1; i < m_document->ListPlex->CharacterPositions.size(); i++)
|
||||
{
|
||||
if ((fc >= m_document->ListPlex->CharacterPositions[i-1]) && (fc_end <= m_document->ListPlex->CharacterPositions[i]))
|
||||
{
|
||||
ListNumCache* listNum = dynamic_cast<ListNumCache*> (m_document->ListPlex->Elements[i-1]);
|
||||
|
||||
return listNum->value;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
bool DocumentMapping::isSectionEnd(int cp)
|
||||
{
|
||||
bool result = false;
|
||||
@ -176,8 +194,8 @@ namespace DocFileFormat
|
||||
|
||||
// get all CHPX between these boundaries to determine the count of runs
|
||||
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fc, fcEnd);
|
||||
std::vector<int>* chpxFcs = m_document->GetFileCharacterPositions(fc, fcEnd);
|
||||
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions(fc, fcEnd);
|
||||
std::vector<int>* chpxFcs = m_document->GetFileCharacterPositions(fc, fcEnd);
|
||||
|
||||
CharacterPropertyExceptions* paraEndChpx = NULL;
|
||||
|
||||
@ -204,8 +222,8 @@ namespace DocFileFormat
|
||||
{
|
||||
isBidi = currentSection->isBidi;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
//_cacheListNum = getListNumCache(fc, fcEnd);
|
||||
_isSectionPageBreak = 0;
|
||||
if (sectionEnd)
|
||||
{
|
||||
|
||||
@ -79,53 +79,53 @@ namespace DocFileFormat
|
||||
std::wstring getOLEObject() { return _lastOLEObject; }
|
||||
protected:
|
||||
|
||||
// Looks into the section table to find out if this CP is the current of a section
|
||||
int getCurrentSection(int cp);
|
||||
// Looks into the section table to find out if this CP is the end of a section
|
||||
bool isSectionEnd( int cp );
|
||||
// Writes a Paragraph that starts at the given cp and
|
||||
// ends at the next paragraph end mark or section end mark
|
||||
int getListNumCache (int fc, int fc_end);
|
||||
int getCurrentSection (int cp);
|
||||
//---------------------------------
|
||||
bool isSectionEnd ( int cp );
|
||||
// Writes a Paragraph that starts at the given cp and
|
||||
// ends at the next paragraph end mark or section end mark
|
||||
int writeParagraph( int cp );
|
||||
// Writes a Paragraph that starts at the given cpStart and
|
||||
// ends at the given cpEnd
|
||||
// Writes a Paragraph that starts at the given cpStart and
|
||||
// ends at the given cpEnd
|
||||
int writeParagraph( int initialCp, int cpEnd, bool sectionEnd, bool lastBad = false );
|
||||
// Writes a Paragraph RSID
|
||||
// Writes a Paragraph RSID
|
||||
void writeParagraphRsid( const ParagraphPropertyExceptions* papx );
|
||||
// Writes a run with the given characters and CHPX
|
||||
// Writes a run with the given characters and CHPX
|
||||
int writeRun( std::vector<wchar_t>* chars, CharacterPropertyExceptions* chpx, int initialCp );
|
||||
// Writes the given text to the document
|
||||
// Writes the given text to the document
|
||||
int writeText ( std::vector<wchar_t>* chars, int initialCp, CharacterPropertyExceptions* chpx, bool writeDeletedText );
|
||||
void writeTextElement ( const std::wstring& text, const std::wstring& textType );
|
||||
void writeTextStart ( const std::wstring& textType, bool preserve_space);
|
||||
void writeTextEnd ( const std::wstring& textType );
|
||||
|
||||
int writeText( std::vector<wchar_t>* chars, int initialCp, CharacterPropertyExceptions* chpx, bool writeDeletedText );
|
||||
void writeTextElement( const std::wstring& text, const std::wstring& textType );
|
||||
void writeTextStart( const std::wstring& textType, bool preserve_space);
|
||||
void writeTextEnd( const std::wstring& textType );
|
||||
|
||||
// Searches for bookmarks in the list of characters.
|
||||
// Searches for bookmarks in the list of characters.
|
||||
std::vector<int> searchBookmarks( std::vector<wchar_t>* chars, int initialCp );
|
||||
ParagraphPropertyExceptions* findValidPapx( int fc );
|
||||
// Splits a list of characters into several lists
|
||||
// Splits a list of characters into several lists
|
||||
std::list<std::vector<wchar_t> >* splitCharList( std::vector<wchar_t>* chars, std::vector<int>* splitIndices );
|
||||
// Writes the table starts at the given cp value
|
||||
int writeTable( int initialCp, unsigned int nestingLevel );
|
||||
// Builds a list that contains the width of the several columns of the table.
|
||||
// Writes the table starts at the given cp value
|
||||
int writeTable ( int initialCp, unsigned int nestingLevel );
|
||||
// Builds a list that contains the width of the several columns of the table.
|
||||
std::vector<short>* buildTableGrid( int initialCp, unsigned int nestingLevel );
|
||||
// Finds the FC of the next row end mark.
|
||||
int findRowEndFc( int initialCp, int& rowEndCp, unsigned int nestingLevel );
|
||||
// Finds the FC of the next row end mark.
|
||||
int findRowEndFc( int initialCp, unsigned int nestingLevel );
|
||||
// Writes the table row that starts at the given cp value and ends at the next row end mark
|
||||
int writeTableRow( int initialCp, std::vector<short>* grid, unsigned int nestingLevel );
|
||||
// Writes the table cell that starts at the given cp value and ends at the next cell end mark
|
||||
int writeTableCell( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel );
|
||||
int findCellEndCp( int initialCp, unsigned int nestingLevel );
|
||||
bool writeBookmarks( int cp );
|
||||
bool writeBookmarkStart( short id );
|
||||
bool writeBookmarkEnd( short id );
|
||||
// Checks if the CHPX is special
|
||||
// Finds the FC of the next row end mark.
|
||||
int findRowEndFc ( int initialCp, int& rowEndCp, unsigned int nestingLevel );
|
||||
// Finds the FC of the next row end mark.
|
||||
int findRowEndFc ( int initialCp, unsigned int nestingLevel );
|
||||
// Writes the table row that starts at the given cp value and ends at the next row end mark
|
||||
int writeTableRow ( int initialCp, std::vector<short>* grid, unsigned int nestingLevel );
|
||||
// Writes the table cell that starts at the given cp value and ends at the next cell end mark
|
||||
int writeTableCell ( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel );
|
||||
int findCellEndCp ( int initialCp, unsigned int nestingLevel );
|
||||
|
||||
bool writeBookmarks ( int cp );
|
||||
bool writeBookmarkStart ( short id );
|
||||
bool writeBookmarkEnd ( short id );
|
||||
// Checks if the CHPX is special
|
||||
bool isSpecial( CharacterPropertyExceptions* chpx );
|
||||
// Finds the SEPX that is valid for the given CP.
|
||||
// Finds the SEPX that is valid for the given CP.
|
||||
SectionPropertyExceptions* findValidSepx( int cp );
|
||||
// Searches the given vector for the next FieldEnd character.
|
||||
// Searches the given vector for the next FieldEnd character.
|
||||
int searchNextTextMark( std::vector<wchar_t>* chars, int initialCp, wchar_t mark );
|
||||
Symbol getSymbol ( const CharacterPropertyExceptions* chpx );
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
@ -152,5 +152,6 @@ namespace DocFileFormat
|
||||
unsigned int _fldCharCounter;
|
||||
std::wstring _writeAfterRun;
|
||||
std::wstring _lastOLEObject;
|
||||
int _cacheListNum;
|
||||
};
|
||||
}
|
||||
|
||||
@ -49,39 +49,46 @@ namespace DocFileFormat
|
||||
unsigned char fNested:1;
|
||||
unsigned char fHasSep:1;
|
||||
};
|
||||
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 2;
|
||||
|
||||
FieldCharacter():
|
||||
fldch(0), grffld(0)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~FieldCharacter()
|
||||
{
|
||||
}
|
||||
FieldCharacter() : fldch(0), grffld(0) {}
|
||||
virtual ~FieldCharacter() {}
|
||||
|
||||
virtual ByteStructure* ConstructObject (VirtualStreamReader* pReader, int length)
|
||||
{
|
||||
FieldCharacter* pFldChar = new FieldCharacter();
|
||||
FieldCharacter* pFldChar = new FieldCharacter();
|
||||
if (pFldChar)
|
||||
{
|
||||
pFldChar->fldch = pReader->ReadByte();
|
||||
pFldChar->grffld = pReader->ReadByte();
|
||||
|
||||
#ifdef _DEBUG
|
||||
grffldEnd* __grffldEnd = (grffldEnd*)(&pFldChar->grffld);
|
||||
int dbg = 0;
|
||||
#endif
|
||||
pFldChar->fldch = pReader->ReadByte();
|
||||
pFldChar->grffld = pReader->ReadByte();
|
||||
}
|
||||
|
||||
return static_cast<ByteStructure*>(pFldChar);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
unsigned char fldch;
|
||||
unsigned char grffld;
|
||||
};
|
||||
|
||||
class ListNumCache: public ByteStructure
|
||||
{
|
||||
public:
|
||||
static const int STRUCTURE_SIZE = 4;
|
||||
|
||||
ListNumCache() : value(-1) {}
|
||||
virtual ~ListNumCache() {}
|
||||
|
||||
virtual ByteStructure* ConstructObject (VirtualStreamReader* pReader, int length)
|
||||
{
|
||||
ListNumCache* pList = new ListNumCache();
|
||||
if (pList)
|
||||
{
|
||||
pList->value = pReader->ReadInt32();
|
||||
}
|
||||
|
||||
return static_cast<ByteStructure*>(pList);
|
||||
}
|
||||
|
||||
int value;
|
||||
};
|
||||
}
|
||||
@ -73,10 +73,7 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(_pPr);
|
||||
RELEASEOBJECT(_framePr);
|
||||
}
|
||||
}
|
||||
|
||||
namespace DocFileFormat
|
||||
{
|
||||
int ParagraphPropertiesMapping::get_section_page_break()
|
||||
{
|
||||
return _isSectionPageBreak;
|
||||
@ -148,14 +145,12 @@ namespace DocFileFormat
|
||||
case sprmPFAutoSpaceDE:
|
||||
{
|
||||
appendFlagElement(_pPr, *iter, _T( "autoSpaceDE" ), true);
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
|
||||
case sprmPFAutoSpaceDN:
|
||||
{
|
||||
appendFlagElement( _pPr, *iter, _T( "autoSpaceDN" ), true );
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
|
||||
case sprmPFBiDi:
|
||||
{
|
||||
@ -248,8 +243,7 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
appendValueAttribute( &ind, flName.c_str(), flValue );
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
|
||||
case sprmPDxcLeft1:
|
||||
appendValueAttribute( &ind, _T( "w:firstLineChars" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
|
||||
@ -305,10 +299,9 @@ namespace DocFileFormat
|
||||
|
||||
//no line rule means auto
|
||||
spacing.AppendAttribute( lineRule );
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
|
||||
//justification code
|
||||
//justification code
|
||||
case sprmOldPJc:
|
||||
case sprmPJc:
|
||||
case sprmPJc80:
|
||||
@ -324,10 +317,8 @@ namespace DocFileFormat
|
||||
XMLTools::XMLAttribute<wchar_t> jcVal( L"w:val", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15 ).c_str() );
|
||||
jc->AppendAttribute( jcVal );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
//borders
|
||||
}break;
|
||||
//borders
|
||||
//case 0x461C:
|
||||
case sprmOldPBrcTop:
|
||||
case sprmPBrcTop:
|
||||
@ -341,8 +332,7 @@ namespace DocFileFormat
|
||||
appendBorderAttributes( &bc, &topBorder );
|
||||
|
||||
addOrSetBorder( &pBdr, &topBorder );
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
|
||||
//case 0x461D:
|
||||
case sprmOldPBrcLeft:
|
||||
@ -357,8 +347,7 @@ namespace DocFileFormat
|
||||
appendBorderAttributes( &bc, &leftBorder );
|
||||
|
||||
addOrSetBorder( &pBdr, &leftBorder );
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
|
||||
//case 0x461E:
|
||||
case sprmOldPBrcBottom:
|
||||
@ -373,9 +362,8 @@ namespace DocFileFormat
|
||||
appendBorderAttributes( &bc, &bottomBorder );
|
||||
|
||||
addOrSetBorder( &pBdr, &bottomBorder );
|
||||
}
|
||||
break;
|
||||
|
||||
}break;
|
||||
|
||||
//case 0x461F:
|
||||
case sprmOldPBrcRight:
|
||||
case sprmPBrcRight:
|
||||
@ -389,8 +377,7 @@ namespace DocFileFormat
|
||||
appendBorderAttributes( &bc, &rightBorder );
|
||||
|
||||
addOrSetBorder( &pBdr, &rightBorder );
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
|
||||
//case 0x4620:
|
||||
case sprmOldPBrcBetween:
|
||||
@ -405,8 +392,7 @@ namespace DocFileFormat
|
||||
appendBorderAttributes( &bc, &betweenBorder );
|
||||
|
||||
addOrSetBorder( &pBdr, &betweenBorder );
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
|
||||
//case 0x4621:
|
||||
case sprmOldPBrcBar:
|
||||
@ -421,18 +407,17 @@ namespace DocFileFormat
|
||||
appendBorderAttributes( &bc, &barBorder );
|
||||
|
||||
addOrSetBorder( &pBdr, &barBorder );
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
|
||||
//shading
|
||||
//shading
|
||||
case sprmPShd80:
|
||||
case sprmPShd:
|
||||
{
|
||||
ShadingDescriptor desc( iter->Arguments, iter->argumentsSize );
|
||||
|
||||
appendShading( _pPr, desc );
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
|
||||
|
||||
//numbering
|
||||
case sprmOldPAnld:
|
||||
@ -470,8 +455,10 @@ namespace DocFileFormat
|
||||
}break;
|
||||
|
||||
case sprmPIlfo:
|
||||
{
|
||||
{
|
||||
//Если numbering.xml пустой, то не пищем свойство
|
||||
//Todo разобраться с закоментированным кодом
|
||||
if (NULL != m_document->listTable && false == m_document->listTable->listData.empty())
|
||||
{
|
||||
appendValueElement( &numPr, _T( "numId" ), FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ), true );
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ namespace DocFileFormat
|
||||
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
|
||||
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL),
|
||||
AnnotationsReferencePlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
|
||||
TextboxIndividualPlex(NULL),
|
||||
TextboxIndividualPlex(NULL),AssocNames(NULL), BookmarkAnnotNames(NULL), Captions(NULL), AutoCaptions(NULL), ListPlex(NULL),
|
||||
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
|
||||
AutoTextPlex(NULL), AllPapxFkps(NULL), AllChpxFkps(NULL), AllPapx(NULL), AllPapxVector(NULL), AllSepx(NULL), Styles(NULL), listTable(NULL),
|
||||
AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL), encryptionHeader(NULL)
|
||||
@ -218,10 +218,14 @@ namespace DocFileFormat
|
||||
m_pStorage->GetStream ("WordDocument", &TableStream);
|
||||
}
|
||||
|
||||
RevisionAuthorTable = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfRMark, FIB->m_FibWord97.lcbSttbfRMark, bOlderVersion);
|
||||
FontTable = new StringTable<FontFamilyName> (TableStream, FIB->m_FibWord97.fcSttbfFfn, FIB->m_FibWord97.lcbSttbfFfn, bOlderVersion);
|
||||
BookmarkNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfBkmk, FIB->m_FibWord97.lcbSttbfBkmk, bOlderVersion);
|
||||
AutoTextNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfGlsy, FIB->m_FibWord97.lcbSttbfGlsy, bOlderVersion);
|
||||
RevisionAuthorTable = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfRMark, FIB->m_FibWord97.lcbSttbfRMark, bOlderVersion);
|
||||
FontTable = new StringTable<FontFamilyName> (TableStream, FIB->m_FibWord97.fcSttbfFfn, FIB->m_FibWord97.lcbSttbfFfn, bOlderVersion);
|
||||
BookmarkNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfBkmk, FIB->m_FibWord97.lcbSttbfBkmk, bOlderVersion);
|
||||
AutoTextNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfGlsy, FIB->m_FibWord97.lcbSttbfGlsy, bOlderVersion);
|
||||
AssocNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAssoc, FIB->m_FibWord97.lcbSttbfAssoc, bOlderVersion);
|
||||
BookmarkAnnotNames = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAtnBkmk, FIB->m_FibWord97.lcbSttbfAtnBkmk, bOlderVersion);
|
||||
Captions = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfCaption, FIB->m_FibWord97.lcbSttbfCaption, bOlderVersion);
|
||||
AutoCaptions = new StringTable<WideString> (TableStream, FIB->m_FibWord97.fcSttbfAutoCaption, FIB->m_FibWord97.lcbSttbfAutoCaption, bOlderVersion);
|
||||
|
||||
if (m_pCallFunc)
|
||||
{
|
||||
@ -286,12 +290,13 @@ namespace DocFileFormat
|
||||
}
|
||||
}
|
||||
|
||||
AutoTextPlex = new Plex<EmptyStructure> (EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, bOlderVersion);
|
||||
FieldsPlex = new Plex<FieldCharacter> (FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, bOlderVersion);
|
||||
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter> (FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, bOlderVersion);
|
||||
EndnoteDocumentFieldsPlex = new Plex<FieldCharacter> (FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, bOlderVersion);
|
||||
HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter> (FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, bOlderVersion);
|
||||
|
||||
AutoTextPlex = new Plex<EmptyStructure>(EmptyStructure::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfGlsy, FIB->m_FibWord97.lcbPlcfGlsy, bOlderVersion);
|
||||
FieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldMom, FIB->m_FibWord97.lcbPlcfFldMom, bOlderVersion);
|
||||
FootnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldFtn, FIB->m_FibWord97.lcbPlcfFldFtn, bOlderVersion);
|
||||
EndnoteDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldEdn, FIB->m_FibWord97.lcbPlcfFldEdn, bOlderVersion);
|
||||
HeadersAndFootersDocumentFieldsPlex = new Plex<FieldCharacter>(FieldCharacter::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfFldHdr, FIB->m_FibWord97.lcbPlcfFldHdr, bOlderVersion);
|
||||
ListPlex = new Plex<ListNumCache> (ListNumCache::STRUCTURE_SIZE, TableStream, FIB->m_FibWord97.fcPlcfBteLvc, FIB->m_FibWord97.lcbPlcfBteLvc, bOlderVersion);
|
||||
|
||||
if (m_pCallFunc)
|
||||
{
|
||||
m_pCallFunc->OnProgress(m_pCallFunc->caller, DOC_ONPROGRESSEVENT_ID, 200000 );
|
||||
@ -592,6 +597,11 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(FontTable);
|
||||
RELEASEOBJECT(BookmarkNames);
|
||||
RELEASEOBJECT(AutoTextNames);
|
||||
RELEASEOBJECT(AutoCaptions);
|
||||
RELEASEOBJECT(Captions);
|
||||
RELEASEOBJECT(BookmarkAnnotNames);
|
||||
RELEASEOBJECT(AssocNames);
|
||||
|
||||
RELEASEOBJECT(IndividualFootnotesPlex);
|
||||
RELEASEOBJECT(FootnoteReferenceCharactersPlex);
|
||||
RELEASEOBJECT(IndividualEndnotesPlex);
|
||||
@ -613,6 +623,7 @@ namespace DocFileFormat
|
||||
RELEASEOBJECT(BookmarkStartPlex);
|
||||
RELEASEOBJECT(BookmarkEndPlex);
|
||||
RELEASEOBJECT(AutoTextPlex);
|
||||
RELEASEOBJECT(ListPlex);
|
||||
RELEASEOBJECT(Styles);
|
||||
RELEASEOBJECT(listTable);
|
||||
RELEASEOBJECT(AllPapx);
|
||||
@ -699,8 +710,7 @@ namespace DocFileFormat
|
||||
{
|
||||
FormattedDiskPageCHPX *fkp = (*iter);
|
||||
|
||||
// get the CHPX
|
||||
|
||||
// get the CHPX
|
||||
for (unsigned int j = 0; j < fkp->grpchpxSize; ++j)
|
||||
{
|
||||
if ( ( fkp->rgfc[j] < fcMin ) && ( fkp->rgfc[j + 1] > fcMin ) )
|
||||
|
||||
@ -177,6 +177,10 @@ namespace DocFileFormat
|
||||
StringTable<FontFamilyName> *FontTable; // A list of all font names, used in the doucument
|
||||
StringTable<WideString> *BookmarkNames;
|
||||
StringTable<WideString> *AutoTextNames;
|
||||
StringTable<WideString> *AssocNames;
|
||||
StringTable<WideString> *BookmarkAnnotNames;
|
||||
StringTable<WideString> *Captions;
|
||||
StringTable<WideString> *AutoCaptions;
|
||||
|
||||
Plex<EmptyStructure> *IndividualFootnotesPlex; //A plex of locations of individual footnotes
|
||||
Plex<FootnoteDescriptor> *FootnoteReferenceCharactersPlex; //A plex of footnote reference characters
|
||||
@ -200,13 +204,14 @@ namespace DocFileFormat
|
||||
Plex<BookmarkFirst> *BookmarkStartPlex;
|
||||
Plex<EmptyStructure> *BookmarkEndPlex;
|
||||
|
||||
Plex<ListNumCache> *ListPlex;
|
||||
Plex<FieldCharacter> *FieldsPlex;
|
||||
Plex<FieldCharacter> *FootnoteDocumentFieldsPlex;
|
||||
Plex<FieldCharacter> *EndnoteDocumentFieldsPlex;
|
||||
Plex<FieldCharacter> *HeadersAndFootersDocumentFieldsPlex;
|
||||
Plex<AnnotationReferenceDescriptor> *AnnotationsReferencePlex;
|
||||
Plex<EmptyStructure> *AutoTextPlex; // Each character position specifies the beginning of\
|
||||
a range of text that constitutes the contents of an AutoText item
|
||||
Plex<EmptyStructure> *AutoTextPlex;
|
||||
// Each character position specifies the beginning of a range of text that constitutes the contents of an AutoText item
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@ -1846,87 +1846,7 @@ public:
|
||||
return sRes;
|
||||
}
|
||||
};
|
||||
//class CComment
|
||||
//{
|
||||
//public:
|
||||
// int Id;
|
||||
// CString Initials;
|
||||
// CString UserName;
|
||||
// CString Date;
|
||||
// CString Text;
|
||||
// CAtlArray<CComment*> replies;
|
||||
//
|
||||
// bool bId;
|
||||
//public:
|
||||
// CComment()
|
||||
// {
|
||||
// bId = false;
|
||||
// }
|
||||
// ~CComment()
|
||||
// {
|
||||
// for(int i = 0, length = replies.GetCount(); i < length; ++i)
|
||||
// {
|
||||
// delete replies[i];
|
||||
// }
|
||||
// replies.RemoveAll();
|
||||
// }
|
||||
// CString Write()
|
||||
// {
|
||||
// CString sRes;
|
||||
// if(bId)
|
||||
// {
|
||||
// sRes.AppendFormat(_T("<w:comment w:id=\"%d\""), Id);
|
||||
// if(false == UserName.IsEmpty())
|
||||
// {
|
||||
// CString sUserName = XmlUtils::EncodeXmlString(UserName);
|
||||
// sRes.AppendFormat(_T(" w:author=\"%ls\""), sUserName);
|
||||
// }
|
||||
// if(false == Date.IsEmpty())
|
||||
// {
|
||||
// CString sDate = XmlUtils::EncodeXmlString(Date);
|
||||
// sRes.AppendFormat(_T(" w:date=\"%ls\""), sDate);
|
||||
// }
|
||||
// if(false == Initials.IsEmpty())
|
||||
// {
|
||||
// CString sInitials = XmlUtils::EncodeXmlString(Initials);
|
||||
// sRes.AppendFormat(_T(" w:initials=\"%ls\""), sInitials);
|
||||
// }
|
||||
// sRes.Append(_T(">"));
|
||||
//
|
||||
// sRes.Append(WriteCommentContent(this, true));
|
||||
//
|
||||
// sRes.Append(_T("</w:comment>"));
|
||||
// }
|
||||
// return sRes;
|
||||
// }
|
||||
//private:
|
||||
// CString WriteCommentContent(CComment* pComment, bool bCheckLast)
|
||||
// {
|
||||
// CString sRes;
|
||||
// CString sFormat = _T("<w:p><w:pPr><w:spacing w:line=\"240\" w:after=\"0\" w:lineRule=\"auto\" w:before=\"0\"/><w:ind w:firstLine=\"0\" w:left=\"0\" w:right=\"0\"/><w:jc w:val=\"left\"/></w:pPr><w:r><w:rPr><w:rFonts w:eastAsia=\"Arial\" w:ascii=\"Arial\" w:hAnsi=\"Arial\" w:cs=\"Arial\"/><w:sz w:val=\"22\"/></w:rPr><w:t xml:space=\"preserve\">%ls</w:t></w:r></w:p>");
|
||||
// CString sName = XmlUtils::EncodeXmlString(pComment->UserName + _T(":"));
|
||||
// sRes.AppendFormat(sFormat, sName);
|
||||
// if(false == pComment->Text.IsEmpty())
|
||||
// {
|
||||
// CString sText = XmlUtils::EncodeXmlString(pComment->Text);
|
||||
// sRes.AppendFormat(sFormat, sText);
|
||||
// }
|
||||
// if(false == bCheckLast || pComment->replies.GetCount() > 0)
|
||||
// sRes.Append(_T("<w:p><w:pPr><w:pBdr><w:top w:space=\"1\" w:sz=\"4\" w:color=\"auto\" w:val=\"single\"/></w:pBdr></w:pPr></w:p>"));
|
||||
//
|
||||
// if(pComment->replies.GetCount() > 0)
|
||||
// {
|
||||
// for(int i = 0, length = pComment->replies.GetCount(); i < length; ++i)
|
||||
// {
|
||||
// if(i != length - 1)
|
||||
// sRes += WriteCommentContent(pComment->replies[i], false);
|
||||
// else
|
||||
// sRes += WriteCommentContent(pComment->replies[i], bCheckLast);
|
||||
// }
|
||||
// }
|
||||
// return sRes;
|
||||
// }
|
||||
//};
|
||||
|
||||
class CDrawingPropertyWrapPoint
|
||||
{
|
||||
public:
|
||||
|
||||
@ -2931,25 +2931,6 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteBytesArray(m_pThemeData, m_nThemeDataSize);
|
||||
}
|
||||
}
|
||||
//void WriteImageMapContent()
|
||||
//{
|
||||
// CAtlArray<CString> aMediaArr;
|
||||
// aMediaArr.SetCount(m_aMedia.GetCount());
|
||||
|
||||
// POSITION pos = m_aMedia.GetStartPosition();
|
||||
// while(NULL != pos)
|
||||
// {
|
||||
// CAtlMap<CString, int>::CPair* pair = m_aMedia.GetNext(pos);
|
||||
// if(NULL != pair)
|
||||
// aMediaArr[pair->m_value] = pair->m_key;
|
||||
// }
|
||||
// for(size_t i = 0, length = aMediaArr.GetCount(); i < length; ++i)
|
||||
// {
|
||||
// CString& sMedia = aMediaArr[i];
|
||||
// m_oBcw.m_oStream.WriteBYTE(c_oSerOtherTableTypes::ImageMap_Src);
|
||||
// m_oBcw.m_oStream.WriteStringW(sMedia);
|
||||
// }
|
||||
//}
|
||||
};
|
||||
class BinaryDocumentTableWriter
|
||||
{
|
||||
|
||||
@ -32,12 +32,7 @@
|
||||
#ifndef CHART_WRITER
|
||||
#define CHART_WRITER
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
@ -32,12 +32,7 @@
|
||||
#ifndef DOCX_SERIALIZER
|
||||
#define DOCX_SERIALIZER
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
|
||||
|
||||
namespace Writers
|
||||
|
||||
@ -34,14 +34,9 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
|
||||
|
||||
//#include "DocWrapper/Base.h"
|
||||
namespace NSCommon{
|
||||
template<class Type> class nullable;
|
||||
|
||||
@ -32,13 +32,7 @@
|
||||
#ifndef XLSX_SERIALIZER
|
||||
#define XLSX_SERIALIZER
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#include <string>
|
||||
|
||||
namespace OOX
|
||||
|
||||
@ -35,12 +35,7 @@
|
||||
|
||||
#include "../progressCallback.h"
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
#include <vector>
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <windows.h>
|
||||
#include <gdiplus.h>
|
||||
#pragma comment(lib, "gdiplus.lib")
|
||||
#endif
|
||||
|
||||
@ -32,12 +32,11 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../../DesktopEditor/common/ASCVariant.h"
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
#endif
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
@ -32,13 +32,12 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../../DesktopEditor/common/ASCVariant.h"
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
#include <vector>
|
||||
/**************************************************************
|
||||
теперь все структуры...
|
||||
|
||||
@ -39,29 +39,8 @@
|
||||
|
||||
#define __USE_ANIMATION__
|
||||
|
||||
#define CHECK_RECORD_3X(VER,INSTANCE,TYPE) ATLASSERT(m_oHeader.RecVersion==##VER&&m_oHeader.RecInstance==##INSTANCE&&m_oHeader.RecType==##TYPE);
|
||||
|
||||
inline int sort (const long* a, const long* b) { return *a > *b ? 1 : -1; }
|
||||
|
||||
namespace debug
|
||||
{
|
||||
inline static void tracearrf (std::vector<double>& arr)
|
||||
{
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
for ( int i = 0; i < (int)arr.size(); ++i )
|
||||
ATLTRACE ( _T("%f, "), arr [i] );
|
||||
|
||||
ATLTRACE ( _T("\n") );
|
||||
#endif
|
||||
}
|
||||
inline static void trace (CString& str)
|
||||
{
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
ATLTRACE (_T("%ls\n"), str);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#if !defined(_WIN32) && !defined (_WIN64)
|
||||
|
||||
typedef struct _FILETIME {
|
||||
@ -479,9 +458,6 @@ namespace Animations
|
||||
{
|
||||
m_oHeader = thisHeader;
|
||||
|
||||
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
CHECK_RECORD_3X(0xF,0x0,RT_ParaBuild);
|
||||
#endif
|
||||
SRecordHeader oHeader;
|
||||
UINT res = 0;
|
||||
|
||||
@ -552,9 +528,6 @@ namespace Animations
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
|
||||
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
CHECK_RECORD_3X(0xF,0x0,RT_BuildList);
|
||||
#endif
|
||||
LONG lPos = 0;
|
||||
StreamUtils::StreamPosition ( lPos, pStream );
|
||||
|
||||
@ -1015,8 +988,6 @@ namespace Animations
|
||||
|
||||
TimeVariant* pRecord = NULL;
|
||||
|
||||
// ATLTRACE ("%x\n",ReadHeader.RecType);
|
||||
|
||||
TimePropertyID4TimeNode VariableType = ( TimePropertyID4TimeNode ) ReadHeader.RecInstance;
|
||||
|
||||
switch ( VariableType )
|
||||
@ -1973,7 +1944,6 @@ namespace Animations
|
||||
virtual void ReadFromStream ( UINT& CurLen, SRecordHeader & oHeader, POLE::Stream* pStream )
|
||||
{
|
||||
m_oTimeAnimationValueAtom.ReadFromStream ( oHeader, pStream );
|
||||
// ATLTRACE(_T("Time : %d\n"), m_oTimeAnimationValueAtom.m_nTime );
|
||||
|
||||
UINT res = 0;
|
||||
SRecordHeader ReadHeader;
|
||||
@ -1981,13 +1951,6 @@ namespace Animations
|
||||
if ( ReadHeader.ReadFromStream(pStream) )
|
||||
{
|
||||
m_VarValue.ReadFromStream ( ReadHeader, pStream );
|
||||
//if ( m_VarValue.m_Value.GetLength () > 1 )
|
||||
//{
|
||||
|
||||
// ATLTRACE(_T("VarValue : ") );
|
||||
// ATLTRACE(CW2A (m_VarValue.m_Value));
|
||||
// ATLTRACE(_T("\n"));
|
||||
//}
|
||||
}
|
||||
|
||||
CurLen += 8 + ReadHeader.RecLen;
|
||||
@ -1995,12 +1958,6 @@ namespace Animations
|
||||
if ( ReadHeader.ReadFromStream(pStream) )
|
||||
{
|
||||
m_VarFormula.ReadFromStream ( ReadHeader, pStream );
|
||||
//if ( m_VarFormula.m_Value.GetLength () > 1 )
|
||||
//{
|
||||
// ATLTRACE(_T("Formula : ") );
|
||||
// ATLTRACE(CW2A (m_VarFormula.m_Value));
|
||||
// ATLTRACE(_T("\n"));
|
||||
//}
|
||||
}
|
||||
|
||||
CurLen += 8 + ReadHeader.RecLen;
|
||||
@ -2491,10 +2448,6 @@ namespace Animations
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
ATLTRACE ( _T("SlaveContainer : UNKNOW RECORD : 0x%x\n"), nRecord );
|
||||
#endif
|
||||
StreamUtils::StreamSkip ( ReadHeader.RecLen, pStream );
|
||||
}
|
||||
}
|
||||
@ -2587,9 +2540,6 @@ namespace Animations
|
||||
{
|
||||
m_oHeader = oHeader;
|
||||
|
||||
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
CHECK_RECORD_3X (0xF,0x01,RT_TimeExtTimeNodeContainer);
|
||||
#endif
|
||||
LONG lPos = 0;
|
||||
StreamUtils::StreamPosition ( lPos, pStream );
|
||||
|
||||
@ -2798,13 +2748,9 @@ namespace Animations
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
ATLTRACE ( _T("ExtTimeNodeContainer : UNKNOW RECORD : 0x%x\n"), nRecord );
|
||||
#endif
|
||||
StreamUtils::StreamSkip ( ReadHeader.RecLen, pStream );
|
||||
}
|
||||
|
||||
//ATLTRACE ("ExtTimeNodeContainer : %d\n"), rgExtTimeNodeChildren.size() );
|
||||
|
||||
// StreamUtils::StreamSeek ( lPos + m_oHeader.RecLen, pStream );
|
||||
}
|
||||
@ -3031,17 +2977,10 @@ namespace Animations
|
||||
m_arrEffects.push_back ( m_oTop );
|
||||
|
||||
m_nDuration = (std::max) ( m_nDuration, m_oTop.dTime + m_oTop.dDuration );
|
||||
|
||||
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
ATLTRACE ( _T("Push : %d, begin : %d, duration : %d\n"), nType, (int)m_oTop.dTime, (int)m_oTop.dDuration );
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void Pop ()
|
||||
{
|
||||
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
ATLTRACE ( _T("Pop \n") );
|
||||
#endif
|
||||
if ( (int)m_arrEffects.size() )
|
||||
m_arrEffects.pop_back ();
|
||||
|
||||
@ -3186,10 +3125,6 @@ namespace Animations
|
||||
|
||||
UpdateParagraph ();
|
||||
|
||||
#if defined(_DEBUG_LOG) && (defined(_WIN32) || defined(_WIN64))
|
||||
ATLTRACE(_T("duration : %f,\n"), GetTime () );
|
||||
ATLTRACE(_T("=======================================================================================\n"));
|
||||
#endif
|
||||
return (0 != m_oAnimation.size());
|
||||
}
|
||||
|
||||
@ -3294,11 +3229,6 @@ namespace Animations
|
||||
|
||||
m_bSaveEffect = true;
|
||||
}
|
||||
|
||||
#if defined(_DEBUG_LOG) && (defined(_WIN32) || defined(_WIN64))
|
||||
// ATLTRACE ( _T("idObj : %d, effect : %ls\t\t"), nID, Helpers::GetEffectNameByID ( m_oTopEffect.m_nEffectType, m_oTopEffect.m_nEffectID ) );
|
||||
// ATLTRACE ( _T("dbg - NodeType : %d, count : %d\n"), nNodeType, (int)pNode->rgExtTimeNodeChildren.size() );
|
||||
#endif
|
||||
}
|
||||
|
||||
for ( int i = 0; i < (int)pContainer->rgExtTimeNodeChildren.size(); ++i )
|
||||
@ -3414,12 +3344,6 @@ namespace Animations
|
||||
oEffect.m_bRemoveEmptyBlocks = true; // ALWAYS
|
||||
|
||||
EffectToMap (oEffect);
|
||||
|
||||
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
//ATLTRACE ( _T("REF : %d, EffectType : %d, EffectID : %d, EffectDir : %d, Group : %d, Begin : %f, Dur : %f, ShapeIgnore : %d, TextBlock : %d\n"),
|
||||
// oEffect.m_nRefID, oEffect.m_nEffectType, oEffect.m_nEffectID, oEffect.m_nEffectDir, oEffect.m_nEffectNodeType, oEffect.m_nBeginTime, oEffect.m_nDuration, oEffect.m_bIgnoreShape, oEffect.m_nTextSequence);
|
||||
ATLTRACE (_T("REF : %d, [ %f, %f ]\n"), oEffect.m_nRefID, oEffect.m_nBeginTime, oEffect.m_nDuration);
|
||||
#endif
|
||||
}
|
||||
inline void EffectToMap (const Effect& oEffect)
|
||||
{
|
||||
@ -3724,10 +3648,6 @@ namespace Animations
|
||||
{
|
||||
oEffect.m_nTextSequence = ind;
|
||||
|
||||
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
//ATLTRACE ( _T("REF : %d, EffectType : %d, EffectID : %d, EffectDir : %d, Group : %d, Begin : %f, Dur : %f, ShapeIgnore : %d, TextBlock : %d\n"),
|
||||
// oEffect.m_nRefID, oEffect.m_nEffectType, oEffect.m_nEffectID, oEffect.m_nEffectDir, oEffect.m_nEffectNodeType, oEffect.m_nBeginTime, oEffect.m_nDuration, oEffect.m_bIgnoreShape, oEffect.m_nTextSequence);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,9 +32,9 @@
|
||||
#ifndef ASC_OFFICE_DRAWING_CONVERTER
|
||||
#define ASC_OFFICE_DRAWING_CONVERTER
|
||||
|
||||
#include "../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../DesktopEditor/common/ASCVariant.h"
|
||||
#endif
|
||||
|
||||
@ -34,13 +34,12 @@
|
||||
|
||||
//todo
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../DesktopEditor/common/ASCVariant.h"
|
||||
#include "../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#include "../DesktopEditor/common/ASCVariant.h"
|
||||
#endif
|
||||
|
||||
#include "../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
#include "../Common/DocxFormat/Source/Base/Base.h"
|
||||
#include "PPTXFormat/PPTXEvent.h"
|
||||
|
||||
|
||||
@ -32,13 +32,11 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#include "../../DesktopEditor/common/Types.h"
|
||||
#endif
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#include "../../DesktopEditor/common/Types.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/Types_32.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -86,7 +86,6 @@ public:
|
||||
|
||||
//dwRet = CCalculatorCRC32::Calc(pBuffer, nReaded);
|
||||
//
|
||||
////ATLTRACE("CRC32: 0x%08X\n", dwRet);
|
||||
//delete [] pBuffer;
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
@ -31,12 +31,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
//#if defined(_WIN32) || defined(_WIN64)
|
||||
// #include <atlcoll.h>
|
||||
// #include <gdiplus.h>
|
||||
//#else
|
||||
#include "../../PPTXLib/Linux/PPTXFormatLib/linux_gdiplus.h"
|
||||
//#endif
|
||||
#include "../../PPTXLib/Linux/PPTXFormatLib/linux_gdiplus.h"
|
||||
|
||||
#include "Metric.h"
|
||||
#include "Effects.h"
|
||||
|
||||
@ -33,12 +33,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
|
||||
namespace NSPresentationEditor
|
||||
|
||||
@ -33,10 +33,9 @@
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
#include "../../../DesktopEditor/common/ASCVariant.h"
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#else
|
||||
#include <atlbase.h>
|
||||
#endif
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
@ -34,15 +34,7 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#include "../../../../Common/atldefine.h"
|
||||
|
||||
#else
|
||||
#include "../../../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
|
||||
#include "../../../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#include "../../../../../Common/DocxFormat/Source/Base/Base.h"
|
||||
#include "../../../../../DesktopEditor/graphics/GraphicsPath.h"
|
||||
|
||||
|
||||
@ -32,11 +32,9 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlwin.h>
|
||||
#include <atltypes.h>
|
||||
#include <atlcoll.h>
|
||||
#endif
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#include "../../Common/DocxFormat/Source/SystemUtility/File.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -38,10 +38,7 @@
|
||||
|
||||
#include "../../Common/DocxFormat/Source/Base/Nullable.h"
|
||||
#include "../../Common/DocxFormat/Source/SystemUtility/File.h"
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
namespace NSBinPptxRW
|
||||
{
|
||||
@ -362,41 +359,41 @@ namespace NSBinPptxRW
|
||||
{
|
||||
// можно ускорить (см. как сделано в шейпах)
|
||||
CString s = strValue;
|
||||
s.Replace(_T("&"), _T("&"));
|
||||
s.Replace(_T("'"), _T("'"));
|
||||
s.Replace(_T("<"), _T("<"));
|
||||
s.Replace(_T(">"), _T(">"));
|
||||
s.Replace(_T("\""), _T("""));
|
||||
s.Replace(L"&", L"&");
|
||||
s.Replace(L"'", L"'");
|
||||
s.Replace(L"<", L"<");
|
||||
s.Replace(L">", L">");
|
||||
s.Replace(L"\"", L""");
|
||||
m_oWriter.WriteString(s);
|
||||
}
|
||||
AVSINLINE void WriteDouble(const double& val)
|
||||
{
|
||||
CString str = _T("");
|
||||
str.Format(_T("%lf"), val);
|
||||
CString str;
|
||||
str.Format(L"%lf", val);
|
||||
m_oWriter.WriteString(str);
|
||||
}
|
||||
AVSINLINE void WriteLONG(const long& val)
|
||||
{
|
||||
CString str = _T("");
|
||||
str.Format(_T("%d"), val);
|
||||
CString str;
|
||||
str.Format(L"%d", val);
|
||||
m_oWriter.WriteString(str);
|
||||
}
|
||||
AVSINLINE void WriteINT(const int& val)
|
||||
{
|
||||
CString str = _T("");
|
||||
str.Format(_T("%d"), val);
|
||||
CString str;
|
||||
str.Format(L"%d", val);
|
||||
m_oWriter.WriteString(str);
|
||||
}
|
||||
AVSINLINE void WriteDWORD(const DWORD& val)
|
||||
{
|
||||
CString str = _T("");
|
||||
str.Format(_T("%u"), val);
|
||||
CString str;
|
||||
str.Format(L"%u", val);
|
||||
m_oWriter.WriteString(str);
|
||||
}
|
||||
AVSINLINE void WriteDWORD_hex(const DWORD& val)
|
||||
{
|
||||
CString str = _T("");
|
||||
str.Format(_T("%x"), val);
|
||||
CString str;
|
||||
str.Format(L"%x", val);
|
||||
m_oWriter.WriteString(str);
|
||||
}
|
||||
AVSINLINE void WriteBool(const bool& val)
|
||||
@ -427,8 +424,8 @@ namespace NSBinPptxRW
|
||||
{
|
||||
m_oWriter.WriteString(strAttributeName);
|
||||
m_oWriter.AddSize(15);
|
||||
CString s = _T("");
|
||||
s.Format(_T("%.1lf"), val);
|
||||
CString s;
|
||||
s.Format(L"%.1lf", val);
|
||||
m_oWriter.AddCharNoCheck(WCHAR(':'));
|
||||
m_oWriter.WriteString(s);
|
||||
m_oWriter.AddCharNoCheck(WCHAR(';'));
|
||||
@ -447,8 +444,8 @@ namespace NSBinPptxRW
|
||||
{
|
||||
m_oWriter.WriteString(strAttributeName);
|
||||
m_oWriter.AddSize(20);
|
||||
CString s = _T("");
|
||||
s.Format(_T("%.1lf"), val);
|
||||
CString s;
|
||||
s.Format(L"%.1lf", val);
|
||||
m_oWriter.AddCharNoCheck(WCHAR(':'));
|
||||
m_oWriter.WriteString(s);
|
||||
m_oWriter.AddCharNoCheck(WCHAR('p'));
|
||||
@ -715,21 +712,6 @@ namespace NSBinPptxRW
|
||||
m_oWriter.WriteString(g_bstr_nodeclose);
|
||||
}
|
||||
|
||||
//#ifdef _WIN32
|
||||
// template<typename T>
|
||||
// AVSINLINE void WriteArray(const CString& strName, const CAtlArray<T>& arr)
|
||||
// {
|
||||
// size_t nCount = arr.GetCount();
|
||||
// if (0 != nCount)
|
||||
// {
|
||||
// StartNode(strName);
|
||||
// m_oWriter.WriteString(g_bstr_nodeclose);
|
||||
// for (size_t i = 0; i < nCount; ++i)
|
||||
// arr[i].toXmlWriter(this);
|
||||
// EndNode(strName);
|
||||
// }
|
||||
// }
|
||||
//#endif //#ifdef _WIN32
|
||||
template<typename T>
|
||||
AVSINLINE void WriteArray(const CString& strName, const std::vector<T>& arr)
|
||||
{
|
||||
@ -743,19 +725,6 @@ namespace NSBinPptxRW
|
||||
EndNode(strName);
|
||||
}
|
||||
}
|
||||
|
||||
//#ifdef _WIN32
|
||||
// template<typename T>
|
||||
// AVSINLINE void WriteArray2(const CAtlArray<T>& arr)
|
||||
// {
|
||||
// size_t nCount = arr.GetCount();
|
||||
// if (0 != nCount)
|
||||
// {
|
||||
// for (size_t i = 0; i < nCount; ++i)
|
||||
// arr[i].toXmlWriter(this);
|
||||
// }
|
||||
// }
|
||||
//#endif //#ifdef _WIN32
|
||||
template<typename T>
|
||||
AVSINLINE void WriteArray2(const std::vector<T>& arr)
|
||||
{
|
||||
|
||||
@ -34,11 +34,7 @@
|
||||
#define PPTXOOX_NAMESPACES_INCLUDE_H_
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/Base/Base.h"
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
|
||||
@ -33,10 +33,7 @@
|
||||
|
||||
#include "NamespaceOwn.h"
|
||||
#include "../../../Common/DocxFormat/Source/XML/xmlutils.h"
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include "atlstr.h"
|
||||
#endif
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
|
||||
@ -1,157 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2016
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <atlutil.h>
|
||||
#include <atlstr.h>
|
||||
|
||||
namespace PathHelpers
|
||||
{
|
||||
static inline BOOL UnescapeURL (LPCWSTR szStringIn, LPWSTR szStringOut, LPDWORD pdwStrLen, DWORD dwMaxLength)
|
||||
{
|
||||
ATLENSURE(szStringIn != NULL);
|
||||
ATLENSURE(szStringOut != NULL);
|
||||
/// convert to local code page
|
||||
BOOL bRet = FALSE;
|
||||
|
||||
int nSrcLen = (int) wcslen(szStringIn);
|
||||
int nCnt = WideCharToMultiByte(CP_ACP, 0, szStringIn, nSrcLen, NULL, 0, NULL, NULL); // AtlUnicodeToACP(szStringIn, nSrcLen, NULL, 0);
|
||||
if (nCnt != 0)
|
||||
{
|
||||
nCnt++;
|
||||
CHeapPtr<char> szIn;
|
||||
|
||||
char szInBuf[ATL_URL_MAX_URL_LENGTH];
|
||||
char *pszIn = szInBuf;
|
||||
|
||||
if (nCnt <= 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// try to avoid allocation
|
||||
if (nCnt > ATL_URL_MAX_URL_LENGTH)
|
||||
{
|
||||
if (!szIn.AllocateBytes(nCnt))
|
||||
{
|
||||
// out of memory
|
||||
return FALSE;
|
||||
}
|
||||
pszIn = szIn;
|
||||
}
|
||||
|
||||
nCnt = WideCharToMultiByte(CP_ACP, 0, szStringIn, nSrcLen, pszIn, nCnt, NULL, NULL); // AtlUnicodeToACP(szStringIn, nSrcLen, pszIn, nCnt);
|
||||
ATLASSERT( nCnt != 0 );
|
||||
|
||||
pszIn[nCnt] = '\0';
|
||||
|
||||
char szOutBuf[ATL_URL_MAX_URL_LENGTH];
|
||||
char *pszOut = szOutBuf;
|
||||
CHeapPtr<char> szTmp;
|
||||
|
||||
// try to avoid allocation
|
||||
if (dwMaxLength > ATL_URL_MAX_URL_LENGTH)
|
||||
{
|
||||
if (!szTmp.AllocateBytes(dwMaxLength))
|
||||
{
|
||||
// out of memory
|
||||
return FALSE;
|
||||
}
|
||||
pszOut = szTmp;
|
||||
}
|
||||
|
||||
DWORD dwStrLen = 0;
|
||||
bRet = AtlUnescapeUrl(pszIn, pszOut, &dwStrLen, dwMaxLength);
|
||||
|
||||
if (bRet != FALSE)
|
||||
{
|
||||
// it is now safe to convert using any codepage, since there
|
||||
// are no non-ASCII characters
|
||||
_ATLTRY
|
||||
{
|
||||
Checked::wmemcpy_s(szStringOut, dwMaxLength, CA2W( pszOut ), dwStrLen);
|
||||
}
|
||||
_ATLCATCHALL()
|
||||
{
|
||||
bRet = FALSE;
|
||||
}
|
||||
}
|
||||
if (pdwStrLen)
|
||||
{
|
||||
*pdwStrLen = dwStrLen;
|
||||
}
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
static inline CString ResourceFileSystemPath (const CString& toPath)
|
||||
{
|
||||
CString sPathName = toPath;
|
||||
|
||||
int lIndex = -1;
|
||||
lIndex = sPathName.Find(_T("file:///"));
|
||||
if (0 == lIndex)
|
||||
sPathName = sPathName.Mid(8);
|
||||
|
||||
lIndex = sPathName.Find(_T("file://"));
|
||||
if (0 == lIndex)
|
||||
sPathName = sPathName.Mid(7);
|
||||
|
||||
lIndex = sPathName.Find(_T("file:\\"));
|
||||
if (0 == lIndex)
|
||||
sPathName = sPathName.Mid(6);
|
||||
|
||||
DWORD dwLength = 0;
|
||||
CString filePath;
|
||||
|
||||
if (UnescapeURL (sPathName, filePath.GetBuffer(4096), &dwLength, 4096))
|
||||
sPathName = filePath;
|
||||
|
||||
filePath.ReleaseBuffer();
|
||||
|
||||
return sPathName;
|
||||
}
|
||||
|
||||
static inline CString ResourceFileSystemPathXml (const CString& toPath)
|
||||
{
|
||||
CString sPathName = ResourceFileSystemPath (toPath);
|
||||
|
||||
sPathName.Replace ( _T("&"), _T("&") );
|
||||
sPathName.Replace ( _T("'"), _T("'") );
|
||||
sPathName.Replace ( _T("<"), _T("<") );
|
||||
sPathName.Replace ( _T(">"), _T(">") );
|
||||
sPathName.Replace ( _T("\""), _T(""") );
|
||||
|
||||
return sPathName;
|
||||
}
|
||||
}
|
||||
@ -34,10 +34,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#endif
|
||||
|
||||
namespace FileSystem {
|
||||
#ifdef UNICODE
|
||||
|
||||
@ -46,6 +46,10 @@ const double g_cdMaxWriteOoxPercent = 0.30;
|
||||
|
||||
//#define MEMORY_SAFE_CONVERTATION
|
||||
|
||||
#if defined (_WIN32) || defined(_WIN64)
|
||||
#pragma comment(lib, "Gdi32.lib")
|
||||
#endif
|
||||
|
||||
HRESULT RtfConvertationManager::ConvertRtfToOOX( std::wstring sSrcFileName, std::wstring sDstPath )
|
||||
{
|
||||
m_bParseFirstItem = true;
|
||||
|
||||
@ -33,12 +33,7 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
class IdGenerator
|
||||
{
|
||||
|
||||
@ -181,8 +181,9 @@ HRESULT CTxtXmlFile::txt_SaveToFile(const std::wstring & sDstFileName, const std
|
||||
}
|
||||
|
||||
|
||||
void CTxtXmlFile::CreateDocxEmpty(CString strDirectory, Writers::FileWriter * pDocxWriter)
|
||||
void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::FileWriter * pDocxWriter)
|
||||
{
|
||||
CString strDirectory = std_string2string(_strDirectory);
|
||||
// rels
|
||||
OOX::CPath pathRels = strDirectory + FILE_SEPARATOR_STR + _T("_rels");
|
||||
FileSystem::Directory::CreateDirectory(pathRels.GetPath());
|
||||
|
||||
@ -37,7 +37,6 @@
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <windows.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../../DesktopEditor/common/ASCVariant.h"
|
||||
#endif
|
||||
@ -61,6 +60,6 @@ public:
|
||||
CTxtXmlFile();
|
||||
|
||||
private:
|
||||
void CreateDocxEmpty(CString path, Writers::FileWriter * DocxWriter) ;
|
||||
void CreateDocxEmpty(const std::wstring & path, Writers::FileWriter * DocxWriter) ;
|
||||
|
||||
};
|
||||
|
||||
@ -6,6 +6,7 @@ core_win_64 {
|
||||
LIBS += -L$$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/icu/lib64 -licuuc
|
||||
}
|
||||
core_win_32 {
|
||||
message($$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/icu/lib)
|
||||
LIBS += -L$$PWD/$$CORE_BUILDS_PLATFORM_PREFIX/icu/lib -licuuc
|
||||
}
|
||||
|
||||
|
||||
@ -37,9 +37,7 @@
|
||||
#define _AVSUTILS_H_
|
||||
|
||||
#ifdef _WIN32
|
||||
//#include <windows.h>
|
||||
//#include <atlbase.h>
|
||||
//#include <atlcoll.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ASCUtilsDefines.h"
|
||||
@ -123,25 +121,6 @@
|
||||
}\
|
||||
}
|
||||
|
||||
class CSynchAccess
|
||||
{
|
||||
public:
|
||||
HANDLE m_hSynchAccess;
|
||||
|
||||
public:
|
||||
CSynchAccess(HANDLE hSynchAccess)
|
||||
{
|
||||
m_hSynchAccess=hSynchAccess;
|
||||
WaitForSingleObject(m_hSynchAccess, INFINITE);
|
||||
}
|
||||
|
||||
~CSynchAccess(void)
|
||||
{
|
||||
if (m_hSynchAccess!=NULL)
|
||||
ReleaseMutex(m_hSynchAccess);
|
||||
}
|
||||
};
|
||||
|
||||
class IBaseUnknown
|
||||
{
|
||||
private:
|
||||
@ -170,171 +149,7 @@ public:
|
||||
{
|
||||
}
|
||||
};
|
||||
//нигде не используется ...
|
||||
//template< typename E, class ETraits = CElementTraits< E > >
|
||||
//class CPtrAtlArray:
|
||||
// public CAtlArray<E, ETraits>
|
||||
//{
|
||||
//public:
|
||||
// ~CPtrAtlArray()
|
||||
// {
|
||||
// FreeAll();
|
||||
// }
|
||||
//
|
||||
// inline E& GetFromBegin()
|
||||
// {
|
||||
// ATLASSERT( GetCount()>0 );
|
||||
// if (GetCount()==0)
|
||||
// ATL::AtlThrow(E_INVALIDARG);
|
||||
//
|
||||
// return( GetAt(0) );
|
||||
// }
|
||||
//
|
||||
// inline E& GetFromEnd()
|
||||
// {
|
||||
// ATLASSERT( GetCount()>0 );
|
||||
// if (GetCount()==0)
|
||||
// ATL::AtlThrow(E_INVALIDARG);
|
||||
//
|
||||
// return( GetAt(GetCount()-1) );
|
||||
// }
|
||||
//
|
||||
// void FreeAt(size_t iElement, size_t nCount = 1)
|
||||
// {
|
||||
// if (iElement >= GetCount()) return;
|
||||
// if (iElement + nCount > GetCount()) nCount = GetCount() - iElement;
|
||||
// for (size_t i = iElement; i < iElement + nCount; i++)
|
||||
// {
|
||||
// RELEASEOBJECT(GetAt(i))
|
||||
// }
|
||||
// RemoveAt(iElement, nCount);
|
||||
// }
|
||||
// void FreeAll()
|
||||
// {
|
||||
// for (unsigned int i = 0; i < GetCount(); i++)
|
||||
// {
|
||||
// RELEASEOBJECT(GetAt(i))
|
||||
// }
|
||||
// RemoveAll();
|
||||
// }
|
||||
//};
|
||||
//
|
||||
//template< typename E, class ETraits = CElementTraits< E > >
|
||||
//class CIPtrAtlArray:
|
||||
// public CAtlArray<E, ETraits>
|
||||
//{
|
||||
//public:
|
||||
// ~CIPtrAtlArray()
|
||||
// {
|
||||
// FreeAll();
|
||||
// }
|
||||
// inline E& GetFromBegin()
|
||||
// {
|
||||
// ATLASSERT( GetCount()>0 );
|
||||
// if (GetCount()==0)
|
||||
// ATL::AtlThrow(E_INVALIDARG);
|
||||
//
|
||||
// return( GetAt(0) );
|
||||
// }
|
||||
//
|
||||
// inline E& GetFromEnd()
|
||||
// {
|
||||
// ATLASSERT( GetCount()>0 );
|
||||
// if (GetCount()==0)
|
||||
// AtlThrow(E_INVALIDARG);
|
||||
//
|
||||
// return( GetAt(GetCount()-1) );
|
||||
// }
|
||||
//
|
||||
// void FreeAt(size_t iElement, size_t nCount = 1)
|
||||
// {
|
||||
// if (iElement >= GetCount()) return;
|
||||
// if (iElement + nCount > GetCount()) nCount = GetCount() - iElement;
|
||||
// for (size_t i = iElement; i < iElement + nCount; i++)
|
||||
// {
|
||||
// RELEASEINTERFACE(GetAt(i))
|
||||
// }
|
||||
// RemoveAt(iElement, nCount);
|
||||
// }
|
||||
// void FreeAll()
|
||||
// {
|
||||
// for (unsigned int i = 0; i < GetCount(); i++)
|
||||
// {
|
||||
// RELEASEINTERFACE(GetAt(i))
|
||||
// }
|
||||
// RemoveAll();
|
||||
// }
|
||||
//};
|
||||
// то что выше нигде не используется
|
||||
|
||||
class CPerfomanceCounter
|
||||
{
|
||||
private:
|
||||
LARGE_INTEGER m_PerformanceCounter;
|
||||
FILE* m_fLogFile;
|
||||
|
||||
LARGE_INTEGER m_PCBeg;
|
||||
LARGE_INTEGER m_PCEnd;
|
||||
LARGE_INTEGER m_PCFreq;
|
||||
|
||||
LONG m_CallCounter;
|
||||
public:
|
||||
void __fastcall ReInitCounter()
|
||||
{
|
||||
m_PerformanceCounter.QuadPart=0;
|
||||
m_CallCounter=0;
|
||||
}
|
||||
|
||||
void __fastcall StartCounter()
|
||||
{
|
||||
QueryPerformanceCounter(&m_PCBeg);
|
||||
m_CallCounter++;
|
||||
}
|
||||
DOUBLE __fastcall StopCounter()
|
||||
{
|
||||
QueryPerformanceCounter(&m_PCEnd);
|
||||
m_PerformanceCounter.QuadPart += m_PCEnd.QuadPart - m_PCBeg.QuadPart;
|
||||
|
||||
double fps=(double)m_PerformanceCounter.QuadPart/m_PCFreq.QuadPart;
|
||||
fps/=m_CallCounter;
|
||||
fps=1/fps;
|
||||
if (m_fLogFile!=NULL)
|
||||
{
|
||||
fprintf(m_fLogFile, "FPS=%f\n", fps);
|
||||
fflush(m_fLogFile);
|
||||
}
|
||||
return fps;
|
||||
}
|
||||
|
||||
CPerfomanceCounter(char* fileName)
|
||||
{
|
||||
m_PerformanceCounter.QuadPart=0;
|
||||
m_CallCounter=0;
|
||||
QueryPerformanceFrequency(&m_PCFreq);
|
||||
|
||||
m_fLogFile=NULL;
|
||||
if (fileName!=NULL)
|
||||
{
|
||||
fopen_s(&m_fLogFile, fileName, "a");
|
||||
}
|
||||
}
|
||||
~CPerfomanceCounter()
|
||||
{
|
||||
if (m_fLogFile!=NULL)
|
||||
{
|
||||
fclose(m_fLogFile);
|
||||
m_fLogFile=NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static SAFEARRAY* SafeArrayCreateVector(VARTYPE vt, unsigned int size)
|
||||
{
|
||||
SAFEARRAYBOUND rgsabound[1];
|
||||
rgsabound[0].lLbound = 0;
|
||||
rgsabound[0].cElements = size;
|
||||
return SafeArrayCreate(vt, 1, rgsabound);
|
||||
}
|
||||
#endif // #ifdef _WIN32
|
||||
#endif // #ifndef _AVSUTILS_H_ // For Borland compiler
|
||||
|
||||
|
||||
@ -29,11 +29,10 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#pragma once // for MSVS
|
||||
#endif // #ifdef _MSC_VER
|
||||
|
||||
#ifndef _ASCUTILSDEFINES_H_ // For Borland compiler
|
||||
#pragma once
|
||||
|
||||
#ifndef _ASCUTILSDEFINES_H_
|
||||
#define _ASCUTILSDEFINES_H_
|
||||
|
||||
#define ACCURATE_SEEKMODE 0
|
||||
|
||||
@ -2096,10 +2096,6 @@
|
||||
RelativePath="..\Source\DocxFormat\RId.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\SystemUtility\SystemUtility.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\DocxFormat\UnknowTypeFile.h"
|
||||
>
|
||||
|
||||
@ -4574,12 +4574,12 @@ struct StdStringEqualsNoCaseA
|
||||
#endif // #ifndef STDSTRING_H
|
||||
|
||||
|
||||
#if !defined(_WIN32) && !defined (_WIN64)
|
||||
//#if !defined(_WIN32) && !defined (_WIN64)
|
||||
typedef CStdStringW CStringW;
|
||||
typedef CStdStringA CStringA;
|
||||
#ifdef UNICODE
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef CStringW CString;
|
||||
typedef CStringW BSTR;
|
||||
#define __T(x) L##x
|
||||
#else // UNICODE
|
||||
typedef CStringA CString;
|
||||
@ -4594,7 +4594,7 @@ struct StdStringEqualsNoCaseA
|
||||
typedef wchar_t* LPWSTR;
|
||||
typedef const wchar_t* LPCWSTR;
|
||||
|
||||
#endif // _WIN32
|
||||
//#endif // _WIN32
|
||||
|
||||
|
||||
|
||||
|
||||
@ -31,78 +31,24 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ASCString.h"
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#pragma warning( disable : 4996 )
|
||||
|
||||
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
// windows-stype separator for paths i.e. 'c:\home\documents\file.ext'
|
||||
#ifndef FILE_SEPARATOR
|
||||
#define FILE_SEPARATOR
|
||||
#define FILE_SEPARATOR_CHAR '\\'
|
||||
#define FILE_SEPARATOR_STR _T("\\")
|
||||
#endif
|
||||
|
||||
#ifndef _CRT_NONSTDC_NO_DEPRECATE
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#endif
|
||||
|
||||
#ifndef STRICT
|
||||
#define STRICT
|
||||
#endif
|
||||
|
||||
// Modify the following defines if you have to target a platform prior to the ones specified below.
|
||||
// Refer to MSDN for the latest info on corresponding values for different platforms.
|
||||
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
|
||||
#define WINVER 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
|
||||
#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 2000 or later.
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
|
||||
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
|
||||
#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
|
||||
#endif
|
||||
|
||||
#ifndef _ATL_APARTMENT_THREADED
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
#endif
|
||||
|
||||
#ifndef _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
|
||||
#endif
|
||||
|
||||
#ifndef _ATL_ALL_WARNINGS
|
||||
// turns off ATL's hiding of some common and often safely ignored warning messages
|
||||
#define _ATL_ALL_WARNINGS
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#include <atltypes.h>
|
||||
|
||||
// windows-stype separator for paths i.e. 'c:\home\documents\file.ext'
|
||||
#ifndef FILE_SEPARATOR
|
||||
#define FILE_SEPARATOR
|
||||
#define FILE_SEPARATOR_CHAR '\\'
|
||||
#define FILE_SEPARATOR_STR _T("\\")
|
||||
#endif
|
||||
|
||||
#include "../../../ASCUtils.h"
|
||||
|
||||
using namespace ATL;
|
||||
|
||||
#else
|
||||
#include "ASCString.h"
|
||||
#include "stdint.h"
|
||||
#include "stdint.h"
|
||||
|
||||
// linux-stype separator for paths i.e. '/home/documents/file.ext'
|
||||
#ifndef FILE_SEPARATOR
|
||||
#define FILE_SEPARATOR
|
||||
#define FILE_SEPARATOR_CHAR '/'
|
||||
#define FILE_SEPARATOR_STR _T("/")
|
||||
// linux-stype separator for paths i.e. '/home/documents/file.ext'
|
||||
#ifndef FILE_SEPARATOR
|
||||
#define FILE_SEPARATOR
|
||||
#define FILE_SEPARATOR_CHAR '/'
|
||||
#define FILE_SEPARATOR_STR _T("/")
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -165,15 +165,6 @@ namespace NSCommon
|
||||
this->m_pPointer = new Type( cwsValue );
|
||||
return *this;
|
||||
}
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
nullable<Type>& operator=(const BSTR &value)
|
||||
{
|
||||
RELEASEOBJECT(this->m_pPointer);
|
||||
if (NULL != value)
|
||||
this->m_pPointer = new Type( value );
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
//nullable<Type>& operator=(std::wstring& cwsValue)
|
||||
//{
|
||||
@ -304,17 +295,17 @@ namespace NSCommon
|
||||
RELEASEOBJECT(this->m_pPointer);
|
||||
this->m_pPointer = pType;
|
||||
}
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
AVSINLINE void operator=(const BSTR& value)
|
||||
{
|
||||
RELEASEOBJECT(this->m_pPointer);
|
||||
if (NULL != value)
|
||||
{
|
||||
this->m_pPointer = new Type();
|
||||
this->m_pPointer->_set((CString)value);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#if defined(_WIN32) || defined (_WIN64)
|
||||
// AVSINLINE void operator=(const BSTR& value)
|
||||
// {
|
||||
// RELEASEOBJECT(this->m_pPointer);
|
||||
// if (NULL != value)
|
||||
// {
|
||||
// this->m_pPointer = new Type();
|
||||
// this->m_pPointer->_set((CString)value);
|
||||
// }
|
||||
// }
|
||||
//#endif
|
||||
AVSINLINE void operator=(const BYTE& value)
|
||||
{
|
||||
RELEASEOBJECT(this->m_pPointer);
|
||||
@ -395,15 +386,15 @@ namespace NSCommon
|
||||
|
||||
return *this;
|
||||
}
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
AVSINLINE void operator=(const BSTR& value)
|
||||
{
|
||||
RELEASEOBJECT(this->m_pPointer);
|
||||
|
||||
if (NULL != value)
|
||||
this->m_pPointer = new int(XmlUtils::GetInteger(value));
|
||||
}
|
||||
#endif
|
||||
//#if defined(_WIN32) || defined (_WIN64)
|
||||
// AVSINLINE void operator=(const BSTR& value)
|
||||
// {
|
||||
// RELEASEOBJECT(this->m_pPointer);
|
||||
//
|
||||
// if (NULL != value)
|
||||
// this->m_pPointer = new int(XmlUtils::GetInteger(value));
|
||||
// }
|
||||
//#endif
|
||||
AVSINLINE void operator=(const CString& value)
|
||||
{
|
||||
RELEASEOBJECT(this->m_pPointer);
|
||||
@ -544,14 +535,14 @@ namespace NSCommon
|
||||
|
||||
return *this;
|
||||
}
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
AVSINLINE void operator=(const BSTR& value)
|
||||
{
|
||||
RELEASEOBJECT(m_pPointer);
|
||||
if (NULL != value)
|
||||
m_pPointer = new double(XmlUtils::GetDouble(value));
|
||||
}
|
||||
#endif
|
||||
//#if defined(_WIN32) || defined (_WIN64)
|
||||
// AVSINLINE void operator=(const BSTR& value)
|
||||
// {
|
||||
// RELEASEOBJECT(m_pPointer);
|
||||
// if (NULL != value)
|
||||
// m_pPointer = new double(XmlUtils::GetDouble(value));
|
||||
// }
|
||||
//#endif
|
||||
AVSINLINE void operator=(const double& value)
|
||||
{
|
||||
RELEASEOBJECT(m_pPointer);
|
||||
@ -610,14 +601,14 @@ namespace NSCommon
|
||||
|
||||
return *this;
|
||||
}
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
AVSINLINE void operator=(const BSTR& value)
|
||||
{
|
||||
RELEASEOBJECT(m_pPointer);
|
||||
if (NULL != value)
|
||||
m_pPointer = new bool(set((CString)value));
|
||||
}
|
||||
#endif
|
||||
//#if defined(_WIN32) || defined (_WIN64)
|
||||
// AVSINLINE void operator=(const BSTR& value)
|
||||
// {
|
||||
// RELEASEOBJECT(m_pPointer);
|
||||
// if (NULL != value)
|
||||
// m_pPointer = new bool(set((CString)value));
|
||||
// }
|
||||
//#endif
|
||||
AVSINLINE void operator=(const bool& value)
|
||||
{
|
||||
RELEASEOBJECT(m_pPointer);
|
||||
@ -675,14 +666,14 @@ namespace NSCommon
|
||||
else
|
||||
m_pPointer = new CString( *oOther.m_pPointer );
|
||||
}
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
AVSINLINE void operator=(const BSTR& value)
|
||||
{
|
||||
RELEASEOBJECT(m_pPointer);
|
||||
if (NULL != value)
|
||||
m_pPointer = new CString(value);
|
||||
}
|
||||
#endif
|
||||
//#if defined(_WIN32) || defined (_WIN64)
|
||||
// AVSINLINE void operator=(const BSTR& value)
|
||||
// {
|
||||
// RELEASEOBJECT(m_pPointer);
|
||||
// if (NULL != value)
|
||||
// m_pPointer = new CString(value);
|
||||
// }
|
||||
//#endif
|
||||
AVSINLINE void operator=(const CString& value)
|
||||
{
|
||||
RELEASEOBJECT(m_pPointer);
|
||||
|
||||
@ -42,11 +42,6 @@ namespace SimpleTypes
|
||||
// строк, вместо этого высчитываем хэш и сравниваем по его значению.
|
||||
|
||||
#define SimpleType_FromString(Enum) \
|
||||
virtual Enum FromString(const BSTR &bsValue)\
|
||||
{\
|
||||
CString sTemp( bsValue );\
|
||||
return FromString( (CString &)sTemp );\
|
||||
}\
|
||||
virtual Enum FromString(const wchar_t* cwsStr)\
|
||||
{\
|
||||
std::wstring wsTemp = cwsStr;\
|
||||
@ -59,11 +54,6 @@ namespace SimpleTypes
|
||||
}
|
||||
|
||||
#define SimpleType_FromString2(Enum) \
|
||||
Enum FromString(const BSTR &bsValue)\
|
||||
{\
|
||||
CString sTemp( bsValue );\
|
||||
return FromString( (CString &)sTemp );\
|
||||
}\
|
||||
Enum FromString(const wchar_t* cwsStr)\
|
||||
{\
|
||||
std::wstring wsTemp = cwsStr;\
|
||||
@ -91,45 +81,36 @@ namespace SimpleTypes
|
||||
return false;\
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#define SimpleType_Operator_Equal(Class) \
|
||||
Class(const BSTR &bsValue)\
|
||||
{\
|
||||
FromString( bsValue );\
|
||||
}\
|
||||
Class(CString &sValue)\
|
||||
{\
|
||||
FromString( sValue );\
|
||||
}\
|
||||
Class(const wchar_t* cwsValue)\
|
||||
{\
|
||||
FromString( cwsValue );\
|
||||
}\
|
||||
Class(const std::wstring& wsStr)\
|
||||
{\
|
||||
FromString( wsStr );\
|
||||
}\
|
||||
const Class &operator =(CString &sValue)\
|
||||
{\
|
||||
FromString( sValue );\
|
||||
return *this;\
|
||||
}\
|
||||
const Class &operator =(const BSTR &bsValue)\
|
||||
{\
|
||||
FromString( bsValue );\
|
||||
return *this;\
|
||||
}\
|
||||
const Class &operator =(const wchar_t* cwsString)\
|
||||
{\
|
||||
FromString( cwsString );\
|
||||
return *this;\
|
||||
}\
|
||||
const Class &operator =(const std::wstring& wsStr)\
|
||||
{\
|
||||
FromString( wsStr );\
|
||||
return *this;\
|
||||
}
|
||||
#else
|
||||
//#if defined(_WIN32) || defined (_WIN64)
|
||||
//#define SimpleType_Operator_Equal(Class) \
|
||||
// Class(CString &sValue)\
|
||||
// {\
|
||||
// FromString( sValue );\
|
||||
// }\
|
||||
// Class(const wchar_t* cwsValue)\
|
||||
// {\
|
||||
// FromString( cwsValue );\
|
||||
// }\
|
||||
// Class(const std::wstring& wsStr)\
|
||||
// {\
|
||||
// FromString( wsStr );\
|
||||
// }\
|
||||
// const Class &operator =(CString &sValue)\
|
||||
// {\
|
||||
// FromString( sValue );\
|
||||
// return *this;\
|
||||
// }\
|
||||
// const Class &operator =(const wchar_t* cwsString)\
|
||||
// {\
|
||||
// FromString( cwsString );\
|
||||
// return *this;\
|
||||
// }\
|
||||
// const Class &operator =(const std::wstring& wsStr)\
|
||||
// {\
|
||||
// FromString( wsStr );\
|
||||
// return *this;\
|
||||
// }
|
||||
//#else
|
||||
#define SimpleType_Operator_Equal(Class) \
|
||||
Class(CString &sValue)\
|
||||
{\
|
||||
@ -158,7 +139,7 @@ namespace SimpleTypes
|
||||
FromString( wsStr );\
|
||||
return *this;\
|
||||
}
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
template<typename E, E DefValue = 0>
|
||||
class CSimpleType
|
||||
@ -180,7 +161,6 @@ namespace SimpleTypes
|
||||
m_eValue = eValue;
|
||||
}
|
||||
|
||||
virtual E FromString(const BSTR &bsValue) = 0;
|
||||
virtual E FromString(CString &sValue) = 0;
|
||||
virtual CString ToString () const = 0;
|
||||
|
||||
@ -196,7 +176,6 @@ namespace SimpleTypes
|
||||
CUniversalMeasure() {}
|
||||
|
||||
virtual double FromString(CString &sValue) = 0;
|
||||
virtual double FromString(const BSTR &bsValue) = 0;
|
||||
virtual CString ToString () const = 0;
|
||||
|
||||
double ToPoints() const
|
||||
|
||||
@ -293,14 +293,6 @@ namespace SimpleTypes
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
bool FromString(const BSTR bsValue)
|
||||
{
|
||||
CString sTemp( bsValue );
|
||||
return FromString( (CString &)sTemp );
|
||||
}
|
||||
#endif
|
||||
|
||||
bool FromString(const std::wstring& wsStr)
|
||||
{
|
||||
// TO DO: переделать
|
||||
|
||||
@ -4702,11 +4702,6 @@ namespace SimpleTypes
|
||||
m_wcDelimiter = 0x20;
|
||||
FromString( oOther.ToString() );
|
||||
}
|
||||
CVml_Polygon2D_Units(const BSTR &bsValue)\
|
||||
{
|
||||
m_wcDelimiter = 0x20;
|
||||
FromString( bsValue );
|
||||
}
|
||||
CVml_Polygon2D_Units(CString &sValue)
|
||||
{
|
||||
m_wcDelimiter = 0x20;
|
||||
|
||||
@ -33,8 +33,9 @@
|
||||
#ifndef OOX_NAMESPACES_INCLUDE_H_
|
||||
#define OOX_NAMESPACES_INCLUDE_H_
|
||||
|
||||
#include "..\Base\Base.h"
|
||||
#include <atlstr.h>
|
||||
#include "../Base/Base.h"
|
||||
#include "../Base/ASCString.h"
|
||||
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
|
||||
@ -31,10 +31,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
//#include "NamespaceOwn.h"
|
||||
#include "../XML/xmlutils.h"
|
||||
//#include "atlstr.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace OOX
|
||||
|
||||
@ -41,7 +41,7 @@ namespace OOX
|
||||
class WritingVector : public WritingElement
|
||||
{
|
||||
public:
|
||||
CAtlArray<T> m_items;
|
||||
std::vector<T> m_items;
|
||||
|
||||
public:
|
||||
WritingVector() : m_items() {}
|
||||
@ -63,14 +63,14 @@ namespace OOX
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (node.GetNodes(_T("*"), oNodes))
|
||||
{
|
||||
int nCount = oNodes.GetCount();
|
||||
int nCount = oNodes.size();
|
||||
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode nodeTemp;
|
||||
oNodes.GetAt(i, nodeTemp);
|
||||
|
||||
m_items.Add(T(nodeTemp));
|
||||
m_items.push_back(T(nodeTemp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,9 +358,9 @@ namespace StreamUtils
|
||||
ULONG lReadByte = 0;
|
||||
lReadByte = pStream->read(pMem, 4);
|
||||
|
||||
#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
ATLASSERT(4 == lReadByte);
|
||||
#endif
|
||||
//#if defined(_DEBUG) && (defined(_WIN32) || defined(_WIN64))
|
||||
// ATLASSERT(4 == lReadByte);
|
||||
//#endif
|
||||
|
||||
if (lReadByte == 4)
|
||||
{
|
||||
@ -502,17 +502,17 @@ namespace CDirectory
|
||||
}
|
||||
static bool OpenFile(CString strFolderPath, CString strFileName, CFile* pFile)
|
||||
{
|
||||
CString strFile = strFolderPath + FILE_SEPARATOR_CHAR + strFileName;
|
||||
CString strFile = strFolderPath + FILE_SEPARATOR_STR + strFileName;
|
||||
return (S_OK == pFile->OpenFile(strFile));
|
||||
}
|
||||
static bool CreateFile(CString strFolderPath, CString strFileName, CFile* pFile)
|
||||
{
|
||||
CString strFile = strFolderPath + FILE_SEPARATOR_CHAR + strFileName;
|
||||
CString strFile = strFolderPath + FILE_SEPARATOR_STR + strFileName;
|
||||
return (S_OK == pFile->CreateFile(strFile));
|
||||
}
|
||||
static bool CreateDirectory(CString strFolderPathRoot, CString strFolderName)
|
||||
{
|
||||
CString strFolder = strFolderPathRoot + FILE_SEPARATOR_CHAR + strFolderName;
|
||||
CString strFolder = strFolderPathRoot + FILE_SEPARATOR_STR + strFolderName;
|
||||
return ::CreateDirectory(strFolder, NULL);
|
||||
}
|
||||
static bool CreateDirectory(CString strFolderPath)
|
||||
@ -546,13 +546,13 @@ namespace CDirectory
|
||||
|
||||
static CString GetUnder(CString strFolderPathRoot, CString strFolderName)
|
||||
{
|
||||
CString strFolder = strFolderPathRoot + '\\' + strFolderName;
|
||||
CString strFolder = strFolderPathRoot + L"\\" + strFolderName;
|
||||
return strFolder;
|
||||
}
|
||||
|
||||
static CString GetFileName(CString strFullName)
|
||||
{
|
||||
int nStart = strFullName.ReverseFind('\\');
|
||||
int nStart = strFullName.ReverseFind(L"\\");
|
||||
CString strName = strFullName.Mid(nStart + 1);
|
||||
return strName;
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#include "Rpc.h" // 'UuidCreate' functuin, need to link Rpcrt4.lib
|
||||
|
||||
#pragma comment(lib,"rpcrt4.lib")
|
||||
#pragma comment(lib,"Shlwapi.lib")
|
||||
|
||||
#ifndef FILE_SEPARATOR
|
||||
#define FILE_SEPARATOR
|
||||
@ -221,19 +222,18 @@ namespace FileSystem
|
||||
return created;
|
||||
}
|
||||
|
||||
StringArray Directory::GetFilesInDirectory(LPCTSTR path, const bool& andSubdirectories) {
|
||||
size_t pathLength = 0;
|
||||
StringCchLength(path, MAX_PATH, &pathLength);
|
||||
++pathLength;
|
||||
size_t pathToFilesLength = pathLength + 3;
|
||||
LPTSTR pathToFiles = new TCHAR[pathToFilesLength];
|
||||
StringArray Directory::GetFilesInDirectory(LPCTSTR _path, const bool& andSubdirectories)
|
||||
{
|
||||
std::wstring path(_path);
|
||||
|
||||
size_t pathLength = path.length();
|
||||
size_t pathToFilesLength = pathLength + 3;
|
||||
|
||||
StringCchCopy(pathToFiles, pathLength, path);
|
||||
StringCchCat(pathToFiles, pathToFilesLength, TEXT("\\*"));
|
||||
std::wstring pathToFiles = path;
|
||||
pathToFiles += L"\\*";
|
||||
|
||||
WIN32_FIND_DATA findData;
|
||||
HANDLE findResult = FindFirstFile(pathToFiles, &findData);
|
||||
delete[] pathToFiles;
|
||||
HANDLE findResult = FindFirstFile(pathToFiles.c_str(), &findData);
|
||||
|
||||
if (findResult == INVALID_HANDLE_VALUE)
|
||||
return StringArray();
|
||||
|
||||
@ -32,19 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Settings.h"
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <windows.h>
|
||||
|
||||
#include <tchar.h>
|
||||
#include <atlstr.h>
|
||||
|
||||
#include <tchar.h>
|
||||
#include <strsafe.h>
|
||||
#include <string>
|
||||
#else
|
||||
#include "../../Base/ASCString.h"
|
||||
#endif
|
||||
#include "../../Base/ASCString.h"
|
||||
|
||||
|
||||
namespace FileSystem {
|
||||
|
||||
@ -33,17 +33,14 @@
|
||||
|
||||
#include "../Base/Base.h"
|
||||
#include "../Base/SmartPtr.h"
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlenc.h>
|
||||
#include <comutil.h>
|
||||
#endif
|
||||
#include "../Base/ASCString.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef _USE_NULLABLE_PROPERTY_
|
||||
using namespace NSCommon;
|
||||
#endif
|
||||
|
||||
namespace XmlUtils
|
||||
{
|
||||
static CString strInvalidValue = _T("x(-Jdl%^8sFGs@gkp14jJU(90dyjhjnb*EcfFf%#2124sf98hc");
|
||||
@ -170,44 +167,6 @@ namespace XmlUtils
|
||||
_stscanf(string, _T("%f"), &f);
|
||||
return f;
|
||||
}
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
AVSINLINE static int GetInteger (BSTR string)
|
||||
{
|
||||
return _wtoi(string);
|
||||
}
|
||||
AVSINLINE static size_t GetUInteger(BSTR string)
|
||||
{
|
||||
return (size_t)_wtoi(string);
|
||||
}
|
||||
AVSINLINE static double GetDouble (BSTR string)
|
||||
{
|
||||
double d = 0;
|
||||
swscanf(string, _T("%lf"), &d);
|
||||
return d;
|
||||
}
|
||||
AVSINLINE static float GetFloat (BSTR string)
|
||||
{
|
||||
float f = 0;
|
||||
swscanf(string, _T("%f"), &f);
|
||||
return f;
|
||||
}
|
||||
AVSINLINE static void GetDouble (BSTR string, double* p)
|
||||
{
|
||||
*p = 0;
|
||||
swscanf(string, _T("%lf"), *p);
|
||||
}
|
||||
AVSINLINE static void GetFloat (BSTR string, float* p)
|
||||
{
|
||||
*p = 0;
|
||||
swscanf(string, _T("%f"), *p);
|
||||
}
|
||||
AVSINLINE static void GetInteger (BSTR string, int* p)
|
||||
{
|
||||
*p = 0;
|
||||
swscanf(string, _T("%d"), *p);
|
||||
}
|
||||
#endif
|
||||
|
||||
AVSINLINE CString BoolToString (const bool & value)
|
||||
{
|
||||
CString sResult = ( value ? _T("true") : _T("false") );
|
||||
|
||||
@ -34,12 +34,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../Base/ASCString.h"
|
||||
#endif
|
||||
|
||||
std::wstring string2std_string(const CString& val);
|
||||
std::string string2std_string(const CStringA& val);
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include "stringcommon.h"
|
||||
|
||||
#include "../Base/Base.h"
|
||||
#include "../../../Base64.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -1267,11 +1268,12 @@ namespace XmlUtils
|
||||
if ((NULL==pData) || (0==lSize))
|
||||
return false;
|
||||
|
||||
int nStrSize = Base64EncodeGetRequiredLength(lSize);
|
||||
int nStrSize = Base64::Base64EncodeGetRequiredLength(lSize);
|
||||
|
||||
CStringA saTemp;
|
||||
LPSTR pStrData = saTemp.GetBuffer(nStrSize + 1);
|
||||
bool bSuccess = Base64Encode(pData, lSize, pStrData, &nStrSize);
|
||||
|
||||
bool bSuccess = Base64::Base64Encode(pData, lSize, pStrData, &nStrSize);
|
||||
|
||||
pStrData[nStrSize] = '\0';
|
||||
saTemp.ReleaseBuffer();
|
||||
@ -1582,7 +1584,7 @@ namespace XmlUtils
|
||||
return false;
|
||||
// LPSTR pStrData = sData.GetBuffer(nStrSize + 1);
|
||||
CStringA saData; saData = sData;
|
||||
return Base64Decode((LPCSTR)saData/*.GetBuffer()*/, saData.GetLength(), pData, &nSize);
|
||||
return Base64::Base64Decode((LPCSTR)saData/*.GetBuffer()*/, saData.GetLength(), pData, &nSize);
|
||||
}
|
||||
};
|
||||
};
|
||||
@ -2718,13 +2720,11 @@ namespace XmlUtils
|
||||
int iSize = WideCharToMultiByte (CP_UTF8, 0, sXML, -1, NULL, 0, NULL, NULL);
|
||||
if (iSize <= 0)
|
||||
{
|
||||
ATLTRACE2 ("ConvertToUTF8() error (size detection): 0x%x\n", GetLastError());
|
||||
return CStringA(sXML); // Conversion to ANSI
|
||||
}
|
||||
CStringA sOutXML;
|
||||
if (0 == WideCharToMultiByte (CP_UTF8, 0, sXML, -1, sOutXML.GetBuffer(iSize + 1), iSize, NULL, NULL))
|
||||
{
|
||||
ATLTRACE2 ("ConvertToUTF8() error (utf-8 conversion): 0x%x\n", GetLastError());
|
||||
return CStringA(sXML);
|
||||
}
|
||||
sOutXML.ReleaseBuffer();
|
||||
|
||||
@ -44,8 +44,8 @@ namespace ComplexTypes
|
||||
ComplexType(){};
|
||||
virtual ~ComplexType() {};
|
||||
|
||||
virtual void FromXML(XmlUtils::CXmlNode& oNode) = 0;
|
||||
virtual std::wstring ToString() const = 0;
|
||||
virtual void FromXML(XmlUtils::CXmlNode& oNode) = 0;
|
||||
virtual std::wstring ToString() const = 0;
|
||||
};
|
||||
|
||||
template<SimpleTypes::EOnOff eDefValue = SimpleTypes::onoffTrue>
|
||||
|
||||
@ -56,7 +56,6 @@ namespace SimpleTypes
|
||||
m_eValue = eValue;
|
||||
}
|
||||
|
||||
virtual E FromString(const BSTR &bsValue) = 0;
|
||||
virtual E FromString(CString &sValue) = 0;
|
||||
virtual std::wstring ToString() const = 0;
|
||||
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
//#include "NamespaceOwn.h"
|
||||
//#include "../XML/XmlUtils.h"
|
||||
|
||||
//#include "atlstr.h"
|
||||
#include "../../../DesktopEditor/common/StringBuilder.h"
|
||||
|
||||
namespace OOX
|
||||
|
||||
@ -31,8 +31,9 @@
|
||||
*/
|
||||
#include "FileDownloader.h"
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#include "../DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
|
||||
#include <wininet.h>
|
||||
#pragma comment(lib, "Wininet")
|
||||
|
||||
|
||||
@ -1,345 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2016
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
/***************************************************************
|
||||
|
||||
CShareMemArray
|
||||
|
||||
шаблон класса для работы с именованной
|
||||
Shared-памятью. Реализаваны загрузка массива
|
||||
из памяти и сохранение в память.
|
||||
|
||||
***************************************************************/
|
||||
|
||||
#pragma once
|
||||
#pragma warning( disable : 4996 4244) // No CRT-secure warning
|
||||
|
||||
#include <atlcoll.h>
|
||||
#include "ASCUtils.h" // CSyncAccess class definition
|
||||
|
||||
#define AVS_USER_NAME_LEN 1024
|
||||
|
||||
// Статус хранилища (ошибка, уже создано, новое)
|
||||
enum TSMAStatus {SMAS_ERROR, SMAS_ALREADYEXISTS, SMAS_NEW};
|
||||
|
||||
// Хранилище
|
||||
template <typename STOR_TYPE>
|
||||
class CShareMemArray
|
||||
{
|
||||
protected:
|
||||
HANDLE m_hAccessMutex; // Мьютекс для безопасного доступа к Shared-Memory
|
||||
HANDLE m_hMapFile; // Хендл на map таблицы
|
||||
STOR_TYPE *m_pArray; // Указатель на массив
|
||||
LONG64 m_nSize; // Размер таблицы
|
||||
CString m_sMutexName; // Имя мьютекса
|
||||
CString m_sMapName; // Имя маппа
|
||||
TSMAStatus m_sStatus;
|
||||
|
||||
protected:
|
||||
// Читаем из памяти
|
||||
bool ReadFromSharedMem(LONG64 nIndex, STOR_TYPE &nValue)
|
||||
{
|
||||
if (NULL == m_pArray)
|
||||
{
|
||||
m_sStatus = SMAS_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
__try
|
||||
{
|
||||
STOR_TYPE *pTable = (STOR_TYPE *) (((BYTE *) m_pArray) + sizeof(LONG64)); // sizeof(LONG64) - размер таблицы
|
||||
nValue = pTable[nIndex];
|
||||
}
|
||||
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
|
||||
{
|
||||
// Failed to read from the view.
|
||||
ATLTRACE2("CIndexerStorage::ReadFromSharedMem()\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Пишем в память
|
||||
bool WriteToSharedMem(LONG64 nIndex, STOR_TYPE aValue)
|
||||
{
|
||||
if (NULL == m_pArray)
|
||||
{
|
||||
m_sStatus = SMAS_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
__try
|
||||
{
|
||||
STOR_TYPE *pTable = (STOR_TYPE *) (((BYTE *) m_pArray) + sizeof(LONG64)); // sizeof(LONG64) - размер таблицы
|
||||
pTable[nIndex] = aValue;
|
||||
}
|
||||
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
|
||||
{
|
||||
// Failed to read from the view.
|
||||
ATLTRACE2("Error CIndexerStorage::WriteToSharedMem(#i)\n", nIndex);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Загрузка таблицы индексов из SharedMemory
|
||||
bool SaveTable_unsync(CAtlArray<STOR_TYPE> &aTable)
|
||||
{
|
||||
if ((NULL == m_pArray) || (NULL == m_hMapFile))
|
||||
{
|
||||
m_sStatus = SMAS_ERROR;
|
||||
return false; // Защита от дурака
|
||||
}
|
||||
|
||||
bool bRes = true;
|
||||
|
||||
// Защита от дурака
|
||||
LONG64 nCopyCount = (m_nSize <= (LONG64) aTable.GetCount()) ? m_nSize : aTable.GetCount();
|
||||
|
||||
// Сохраняем размер таблицы
|
||||
Size_unsync(m_nSize);
|
||||
|
||||
// копируем из памяти в массив (safe)
|
||||
for (LONG64 nIndex = 0; nIndex < nCopyCount; nIndex++)
|
||||
{
|
||||
bRes &= WriteToSharedMem (nIndex, aTable[nIndex]);
|
||||
}
|
||||
|
||||
return bRes;
|
||||
}
|
||||
|
||||
// Сохранение таблицы индексов из SharedMemory
|
||||
bool LoadTable_unsync(CAtlArray<STOR_TYPE> &aTable)
|
||||
{
|
||||
if ((NULL == m_pArray) || (NULL == m_hMapFile))
|
||||
{
|
||||
m_sStatus = SMAS_ERROR;
|
||||
return false; // Защита от дурака
|
||||
}
|
||||
|
||||
aTable.RemoveAll();
|
||||
|
||||
// Определяем размер
|
||||
m_nSize = Size_unsync();
|
||||
|
||||
STOR_TYPE nValue;
|
||||
|
||||
// копируем из памяти в массив
|
||||
for (DWORD nIndex = 0; nIndex < m_nSize; nIndex++)
|
||||
{
|
||||
if (ReadFromSharedMem(nIndex, nValue))
|
||||
{
|
||||
// Добавляем в таблицу
|
||||
aTable.Add(nValue);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Размер
|
||||
LONG64 Size_unsync()
|
||||
{
|
||||
LONG64 nValue = -1;
|
||||
|
||||
if (NULL == m_pArray)
|
||||
{
|
||||
m_sStatus = SMAS_ERROR;
|
||||
return nValue;
|
||||
}
|
||||
|
||||
__try
|
||||
{
|
||||
LONG64 *pSize = (LONG64 *) m_pArray;
|
||||
nValue = *pSize;
|
||||
}
|
||||
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
|
||||
{
|
||||
// Failed to read from the view.
|
||||
ATLTRACE2("CIndexerStorage::Size_unsync()\n");
|
||||
return -1;
|
||||
}
|
||||
return nValue;
|
||||
}
|
||||
|
||||
void Size_unsync(LONG64 aSize)
|
||||
{
|
||||
if (NULL == m_pArray)
|
||||
{
|
||||
m_sStatus = SMAS_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
__try
|
||||
{
|
||||
LONG64 *pSize = (LONG64*) m_pArray; // sizeof(LONG64) - размер таблицы
|
||||
*pSize = aSize;
|
||||
}
|
||||
__except(EXCEPTION_IN_PAGE_ERROR == GetExceptionCode() ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
|
||||
{
|
||||
// Failed to read from the view.
|
||||
ATLTRACE2("Error CIndexerStorage::Size_unsync(LONG64 aSize)\n");
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
// aSize - размер таблицы индексации (кол-во полусекунд),
|
||||
// Id - дополнительный идектификатор, чтоб можно было создавать много сторейджей для одного файла
|
||||
CShareMemArray(CString &aFileName, LONG64 aSize, DWORD aId = ISID_DEFAULT):
|
||||
m_hMapFile(NULL), m_nSize(aSize), m_pArray(NULL), m_sStatus(SMAS_ERROR)
|
||||
{
|
||||
// "Вытаскиваем" имя файла
|
||||
TCHAR aDrive[_MAX_DRIVE];
|
||||
TCHAR aDir[_MAX_DIR];
|
||||
TCHAR aFName[_MAX_FNAME];
|
||||
TCHAR aExt[_MAX_EXT];
|
||||
|
||||
_tsplitpath (aFileName.GetBuffer(), aDrive, aDir, aFName, aExt);
|
||||
//_wsplitpath_s (aFileName.GetBuffer(), aDrive, _MAX_DRIVE, aDir, _MAX_DIR, aFName, _MAX_FNAME, aExt, _MAX_EXT);
|
||||
|
||||
// Дополнительно формируем уникальные символы для этого пути, чтобы включить в имя файла
|
||||
DWORD dwPathID = 0;
|
||||
TCHAR tcPathIDItem = 0;
|
||||
|
||||
// Подсчитываем контрольную сумму для пути
|
||||
for (int i = 0; i < (int) _tcslen(aDir); i++)
|
||||
{
|
||||
tcPathIDItem ^= aDir[i];
|
||||
dwPathID ^= dwPathID << 1;
|
||||
dwPathID += (DWORD) tcPathIDItem;
|
||||
}
|
||||
|
||||
// Подсчитываем контрольную сумму для расширения
|
||||
DWORD dwExtID = 0;
|
||||
TCHAR tcExtIDItem = 0;
|
||||
for (int i = 0; i < (int) _tcslen(aExt); i++)
|
||||
{
|
||||
tcExtIDItem ^= aExt[i];
|
||||
dwExtID ^= dwExtID << 1;
|
||||
dwExtID += (DWORD) tcExtIDItem;
|
||||
}
|
||||
|
||||
// Формируем имя мутекса и мапа
|
||||
// Этот код не работает если зашло два пользователя и каждый запускает свою копию приложения.
|
||||
// Фича в именовании мьютекса.
|
||||
// В начале имени мьютекса должно стоять "Global\"
|
||||
// ШульгаИван: "Global\" не проходит на Win7, если прога запущена не под админом
|
||||
m_sMutexName.Format(_T("Local\\avs_mutex%u_%s_%06x_%06I64x_%06x"), aId, aFName, dwPathID, aSize, dwExtID);
|
||||
m_sMapName.Format(_T("Local\\avs_storage%u_%s_%06x_%06I64x_%06x"), aId, aFName, dwPathID, aSize, dwExtID);
|
||||
|
||||
// добавляем имя юзера
|
||||
TCHAR pBufferUserName[AVS_USER_NAME_LEN];
|
||||
DWORD dwBufferUserNameLen = AVS_USER_NAME_LEN;
|
||||
GetUserName(pBufferUserName, &dwBufferUserNameLen);
|
||||
|
||||
CString strUserName(pBufferUserName, dwBufferUserNameLen);
|
||||
m_sMutexName += strUserName;
|
||||
m_sMapName += strUserName;
|
||||
|
||||
// Создаем мьютекс
|
||||
m_hAccessMutex = CreateMutex(NULL, FALSE, m_sMutexName.GetBuffer());
|
||||
|
||||
// Далее все делаем "под мутексом" :)
|
||||
CSynchAccess oAccess = m_hAccessMutex;
|
||||
|
||||
// Создаем мап
|
||||
ATLTRACE2("CShareMemArray()::CShareMemArray(): m_nSize = %d\n", m_nSize);
|
||||
|
||||
ULARGE_INTEGER nMappingSize;
|
||||
nMappingSize.QuadPart = m_nSize * sizeof(STOR_TYPE) + sizeof(LONG64);
|
||||
|
||||
m_hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, nMappingSize.HighPart, nMappingSize.LowPart, m_sMapName.GetBuffer());
|
||||
if (NULL == m_hMapFile)
|
||||
{
|
||||
// Ошибка
|
||||
ATLTRACE2("CShareMemArray::CShareMemArray():CreateFileMapping() FAILS (0x%x)!\n", GetLastError());
|
||||
m_sStatus = SMAS_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Все ок!
|
||||
m_sStatus = (GetLastError() == ERROR_ALREADY_EXISTS) ? SMAS_ALREADYEXISTS : SMAS_NEW;
|
||||
ATLTRACE2 (SMAS_ALREADYEXISTS == m_sStatus ? "CShareMemArray: open existing!\n" : "CShareMemArray: create new!\n");
|
||||
|
||||
// создаем View of file
|
||||
m_pArray = (STOR_TYPE *) MapViewOfFile(m_hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, (SIZE_T) nMappingSize.QuadPart);
|
||||
if (NULL == m_pArray)
|
||||
{
|
||||
// Ошибка
|
||||
ATLTRACE2("CShareMemArray::CShareMemArray():MapViewOfFile() FAILS (0x%x)!\n", GetLastError());
|
||||
m_sStatus = SMAS_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~CShareMemArray()
|
||||
{
|
||||
if (m_pArray) UnmapViewOfFile(m_pArray); // удаляем view
|
||||
if (NULL != m_hMapFile) CloseHandle(m_hMapFile); // удаляем мап
|
||||
if (NULL != m_hAccessMutex) CloseHandle(m_hAccessMutex); // Удаляем мьютекс
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Сохранить таблицу в шаред-мемори
|
||||
bool Save(CAtlArray<STOR_TYPE> &aTable)
|
||||
{
|
||||
CSynchAccess oAccess = m_hAccessMutex;
|
||||
return SaveTable_unsync(aTable);
|
||||
}
|
||||
|
||||
// Загрузить таблицу
|
||||
bool Load(CAtlArray<STOR_TYPE> &aTable)
|
||||
{
|
||||
CSynchAccess oAccess = m_hAccessMutex;
|
||||
return LoadTable_unsync(aTable);
|
||||
}
|
||||
|
||||
// Размер получение
|
||||
LONG64 Size()
|
||||
{
|
||||
CSynchAccess oAccess = m_hAccessMutex;
|
||||
return Size_unsync();
|
||||
}
|
||||
|
||||
/*void Size(LONG64 aSize)
|
||||
{
|
||||
CSynchAccess oAccess = m_hAccessMutex;
|
||||
Size_unsync(aSize);
|
||||
}*/
|
||||
|
||||
// Получение статуса
|
||||
TSMAStatus Status(void) const
|
||||
{
|
||||
CSynchAccess oAccess = m_hAccessMutex;
|
||||
return m_sStatus;
|
||||
}
|
||||
};
|
||||
|
||||
@ -41,39 +41,39 @@
|
||||
using namespace NExtractTools;
|
||||
|
||||
#if !defined(_WIN32) && !defined (_WIN64)
|
||||
static std::wstring utf8_to_unicode(const char *src)
|
||||
{
|
||||
if (src == NULL) return _T("");
|
||||
std::string temp = src;
|
||||
static std::wstring utf8_to_unicode(const char *src)
|
||||
{
|
||||
if (src == NULL) return _T("");
|
||||
std::string temp = src;
|
||||
|
||||
unsigned int nLength = temp.length();
|
||||
unsigned int nLength = temp.length();
|
||||
|
||||
UTF32 *pStrUtf32 = new UTF32 [nLength+1];
|
||||
memset ((void *) pStrUtf32, 0, sizeof (UTF32) * (nLength+1));
|
||||
UTF32 *pStrUtf32 = new UTF32 [nLength+1];
|
||||
memset ((void *) pStrUtf32, 0, sizeof (UTF32) * (nLength+1));
|
||||
|
||||
|
||||
UTF8 *pStrUtf8 = (UTF8 *) src;
|
||||
UTF8 *pStrUtf8 = (UTF8 *) src;
|
||||
|
||||
// this values will be modificated
|
||||
const UTF8 *pStrUtf8_Conv = pStrUtf8;
|
||||
UTF32 *pStrUtf32_Conv = pStrUtf32;
|
||||
// this values will be modificated
|
||||
const UTF8 *pStrUtf8_Conv = pStrUtf8;
|
||||
UTF32 *pStrUtf32_Conv = pStrUtf32;
|
||||
|
||||
ConversionResult eUnicodeConversionResult = ConvertUTF8toUTF32 (&pStrUtf8_Conv,
|
||||
&pStrUtf8[nLength]
|
||||
, &pStrUtf32_Conv
|
||||
, &pStrUtf32 [nLength]
|
||||
, strictConversion);
|
||||
ConversionResult eUnicodeConversionResult = ConvertUTF8toUTF32 (&pStrUtf8_Conv,
|
||||
&pStrUtf8[nLength]
|
||||
, &pStrUtf32_Conv
|
||||
, &pStrUtf32 [nLength]
|
||||
, strictConversion);
|
||||
|
||||
if (conversionOK != eUnicodeConversionResult)
|
||||
{
|
||||
delete [] pStrUtf32;
|
||||
return L"";
|
||||
}
|
||||
std::wstring wsEntryName ((wchar_t *) pStrUtf32);
|
||||
if (conversionOK != eUnicodeConversionResult)
|
||||
{
|
||||
delete [] pStrUtf32;
|
||||
return L"";
|
||||
}
|
||||
std::wstring wsEntryName ((wchar_t *) pStrUtf32);
|
||||
|
||||
delete [] pStrUtf32;
|
||||
return wsEntryName;
|
||||
}
|
||||
delete [] pStrUtf32;
|
||||
return wsEntryName;
|
||||
}
|
||||
#endif
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -100,14 +100,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
return getReturnErrorCode(AVS_FILEUTILS_ERROR_CONVERT_PARAMS);
|
||||
}
|
||||
std::wstring sArg1, sExePath;
|
||||
std::wstring sArg1, sExePath;
|
||||
|
||||
#if !defined(_WIN32) && !defined (_WIN64)
|
||||
sExePath = utf8_to_unicode(argv [0]);
|
||||
sArg1 = utf8_to_unicode(argv [1]);
|
||||
#else
|
||||
sExePath = CA2T(argv [0]);
|
||||
sArg1 = CA2T(argv [1]);
|
||||
std::string s;
|
||||
s = std::string(argv [0]); sExePath = std::wstring(s.begin(), s.end());
|
||||
s = std::string(argv [1]); sArg1 = std::wstring(s.begin(), s.end());
|
||||
#endif
|
||||
|
||||
int result = 0;
|
||||
@ -126,10 +127,10 @@ int main(int argc, char *argv[])
|
||||
if (argc >= 5) sArg4 = utf8_to_unicode(argv [4]);
|
||||
if (argc >= 6) sArg5 = utf8_to_unicode(argv [5]);
|
||||
#else
|
||||
if (argc >= 3) sArg2 = CA2T(argv [2]);
|
||||
if (argc >= 4) sArg3 = CA2T(argv [3]);
|
||||
if (argc >= 5) sArg4 = CA2T(argv [4]);
|
||||
if (argc >= 6) sArg5 = CA2T(argv [5]);
|
||||
if (argc >= 3) { s = std::string(argv [2]); sArg2 = std::wstring(s.begin(), s.end()); }
|
||||
if (argc >= 4) { s = std::string(argv [3]); sArg3 = std::wstring(s.begin(), s.end()); }
|
||||
if (argc >= 5) { s = std::string(argv [4]); sArg4 = std::wstring(s.begin(), s.end()); }
|
||||
if (argc >= 6) { s = std::string(argv [5]); sArg5 = std::wstring(s.begin(), s.end()); }
|
||||
#endif
|
||||
InputParams oInputParams;
|
||||
oInputParams.m_sFileFrom = new std::wstring(sArg1);
|
||||
|
||||
@ -570,6 +570,7 @@
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/bigobj"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
|
||||
@ -32,12 +32,7 @@
|
||||
#ifndef SERIALIZER_COMMON
|
||||
#define SERIALIZER_COMMON
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
|
||||
|
||||
@ -34,12 +34,7 @@
|
||||
|
||||
#include <stack>
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
|
||||
@ -39,12 +39,7 @@
|
||||
#define CP_UTF8 65001
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#else
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
#endif
|
||||
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
|
||||
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
#include "../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
|
||||
|
||||
Reference in New Issue
Block a user