Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
9503207e
Commit
9503207e
authored
Sep 29, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RtfFormatWriter - section (refactoring)
parent
6abc59ec
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
141 additions
and
86 deletions
+141
-86
ASCOfficeRtfFile/RtfFormatLib/source/Basic.h
ASCOfficeRtfFile/RtfFormatLib/source/Basic.h
+12
-5
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
+7
-5
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
+11
-7
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDocumentReader.h
...iceRtfFile/RtfFormatLib/source/Reader/OOXDocumentReader.h
+48
-22
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXParagraphElementReaders.cpp
...RtfFormatLib/source/Reader/OOXParagraphElementReaders.cpp
+5
-5
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXTextItemReader.h
...iceRtfFile/RtfFormatLib/source/Reader/OOXTextItemReader.h
+9
-9
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.cpp
+3
-1
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.h
+13
-7
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
+4
-4
ASCOfficeRtfFile/RtfFormatLib/source/RtfWriter.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfWriter.cpp
+11
-8
ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp
...eRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp
+13
-12
ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.h
...iceRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.h
+1
-1
ASCOfficeRtfFile/RtfFormatTest/win32/RtfFormatTest.vcproj
ASCOfficeRtfFile/RtfFormatTest/win32/RtfFormatTest.vcproj
+4
-0
No files found.
ASCOfficeRtfFile/RtfFormatLib/source/Basic.h
View file @
9503207e
...
...
@@ -92,10 +92,8 @@ public:
template
<
class
T
>
class
ItemContainer
{
protected:
std
::
vector
<
T
>
m_aArray
;
public:
std
::
vector
<
T
>
m_aArray
;
ItemContainer
(
)
{
...
...
@@ -138,9 +136,13 @@ public:
void
RemoveItem
(
int
nIndex
=
-
1
)
{
if
(
nIndex
>=
0
&&
nIndex
<
(
int
)
m_aArray
.
size
()
)
{
m_aArray
.
erase
(
m_aArray
.
begin
()
+
nIndex
);
}
else
if
(
-
1
==
nIndex
&&
0
<
(
int
)
m_aArray
.
size
()
)
{
m_aArray
.
pop_back
();
}
}
void
RemoveAll
()
...
...
@@ -149,9 +151,9 @@ public:
}
bool
GetItem
(
T
&
oOutput
,
int
nIndex
=
-
1
)
{
if
(
-
1
==
nIndex
&&
(
int
)
m_aArray
.
size
()
>
0
)
if
(
-
1
==
nIndex
&&
!
m_aArray
.
empty
()
)
{
oOutput
=
m_aArray
[
m_aArray
.
size
()
-
1
]
;
oOutput
=
m_aArray
.
back
()
;
return
true
;
}
if
(
nIndex
>=
0
&&
nIndex
<
(
int
)
m_aArray
.
size
())
...
...
@@ -159,6 +161,11 @@ public:
oOutput
=
m_aArray
[
nIndex
];
return
true
;
}
else
if
(
!
m_aArray
.
empty
())
{
oOutput
=
m_aArray
[
0
];
// default
return
true
;
}
return
false
;
}
void
InsertItem
(
T
&
oOutput
,
int
nIndex
=
-
1
)
...
...
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
View file @
9503207e
...
...
@@ -356,16 +356,16 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader
}
else
if
(
_T
(
"sect"
)
==
sCommand
)
{
RtfSectionPtr
oCurS
ection
;
if
(
true
==
oDocument
.
GetItem
(
oCurS
ection
)
)
_section
s
ection
;
if
(
true
==
oDocument
.
GetItem
(
s
ection
)
)
{
oCurSection
->
m_oProperty
=
oReader
.
m_oCurSectionProp
;
section
.
props
->
m_oProperty
=
oReader
.
m_oCurSectionProp
;
if
(
oParagraphReaderDestination
.
nCurItap
>
0
)
{
}
else
{
oCurSection
->
m_bFinalize
=
true
;
section
.
props
->
m_bFinalize
=
true
;
}
}
...
...
@@ -373,7 +373,9 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader
RtfSectionPtr
oNewSection
=
RtfSectionPtr
(
new
RtfSection
()
);
oParagraphReaderDestination
.
m_oTextItems
=
oNewSection
;
oDocument
.
AddItem
(
oNewSection
);
_section
new_section
(
oNewSection
);
oDocument
.
AddItem
(
new_section
);
//вручную обнуляем footer, т.к. sectd может встретиться и после field
///?????
...
...
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h
View file @
9503207e
...
...
@@ -2440,12 +2440,13 @@ public:
RtfNormalReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
{
RtfSectionPtr
oCurSection
;
SectDef
(
oDocument
,
oReader
);
if
(
true
==
oDocument
.
GetItem
(
oCurSection
)
)
_section
section
;
if
(
true
==
oDocument
.
GetItem
(
section
)
)
{
oCurSection
->
m_oProperty
=
oReader
.
m_oCurSectionProp
;
oParagraphReaderDestination
.
m_oTextItems
=
oCurSection
;
section
.
props
->
m_oProperty
=
oReader
.
m_oCurSectionProp
;
oParagraphReaderDestination
.
m_oTextItems
=
section
.
props
;
}
m_nCurGroups
=
0
;
}
...
...
@@ -2457,9 +2458,12 @@ public:
void
ExitReader
(
RtfDocument
&
oDocument
,
RtfReader
&
oReader
)
{
oParagraphReaderDestination
.
Finalize
(
oReader
/*, RtfSectionPtr()*/
);
RtfSectionPtr
oCurSection
;
if
(
true
==
oDocument
.
GetItem
(
oCurSection
)
)
oCurSection
->
m_oProperty
=
oReader
.
m_oCurSectionProp
;
_section
section
;
if
(
true
==
oDocument
.
GetItem
(
section
)
)
{
section
.
props
->
m_oProperty
=
oReader
.
m_oCurSectionProp
;
}
if
(
NULL
==
oDocument
.
m_oFootnoteCon
)
{
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDocumentReader.h
View file @
9503207e
...
...
@@ -54,19 +54,29 @@ public:
bool
Parse
(
ReaderParameter
oParam
)
{
if
(
m_ooxDocument
==
NULL
)
return
false
;
if
(
m_ooxDocument
==
NULL
)
return
false
;
m_poReader
=
oParam
.
oReader
;
m_poDocument
=
oParam
.
oRtf
;
m_poReader
=
oParam
.
oReader
;
m_poDocument
=
oParam
.
oRtf
;
oParam
.
oRtf
->
m_oStatusSection
.
start_new
=
false
;
//
oParam.oRtf->m_oStatusSection.start_new = false;
RtfSectionPtr
oCurSection
;
if
(
true
==
oParam
.
oRtf
->
GetItem
(
oCurSection
)
)
_section
first_section
;
//if( true == oParam.oRtf->GetItem( first_section ) )
{
oCurSection
->
m_oProperty
.
SetDefaultOOX
();
//сначала считаем количесво секций и заполняем их свойства ..
//first_section.props->m_oProperty.SetDefaultOOX();
//if (m_ooxDocument->m_oSectPr.IsInit())// свойства последней секции
//{
// OOXSectionPropertyReader oSectReader(m_ooxDocument->m_oSectPr.GetPointer());
// if (oSectReader.Parse( oParam, first_section.props->m_oProperty ))
// {
// }
//}
int
last_section_start
=
0
;
//считаем количесво секций и заполняем их свойства ..
for
(
long
i
=
0
;
i
<
m_ooxDocument
->
m_arrItems
.
size
();
i
++
)
{
if
(
m_ooxDocument
->
m_arrItems
[
i
]
==
NULL
)
continue
;
...
...
@@ -77,35 +87,51 @@ public:
if
((
para
)
&&
(
para
->
m_oParagraphProperty
))
{
if
(
para
->
m_oParagraphProperty
->
m_oSectPr
.
IsInit
())
if
(
para
->
m_oParagraphProperty
->
m_oSectPr
.
IsInit
()
)
{
_section
section
(
RtfSectionPtr
(
new
RtfSection
()
),
last_section_start
,
i
+
1
);
//if (i == last_section_start) section.end_para = 1;
last_section_start
=
i
+
1
;
section
.
props
->
m_oProperty
.
SetDefaultOOX
();
OOXSectionPropertyReader
oSectReader
(
para
->
m_oParagraphProperty
->
m_oSectPr
.
GetPointer
());
if
(
true
==
oSectReader
.
Parse
(
oParam
,
oCurSection
->
m_oProperty
)
)
if
(
true
==
oSectReader
.
Parse
(
oParam
,
section
.
props
->
m_oProperty
)
)
{
//создаем новую секцию
oCurSection
=
RtfSectionPtr
(
new
RtfSection
()
);
oCurSection
->
m_oProperty
.
SetDefaultOOX
();
oParam
.
oRtf
->
AddItem
(
oCurSection
);
oParam
.
oRtf
->
AddItem
(
section
);
}
}
}
}
}
if
(
m_ooxDocument
->
m_oSectPr
.
IsInit
())
// свойства последней секции
m_poDocument
->
RemoveItem
(
0
);
_section
last_section
;
m_poDocument
->
GetItem
(
last_section
);
if
(
last_section
.
end_para
<
m_ooxDocument
->
m_arrItems
.
size
())
{
OOXSectionPropertyReader
oSectReader
(
m_ooxDocument
->
m_oSectPr
.
GetPointer
());
if
(
oSectReader
.
Parse
(
oParam
,
oCurSection
->
m_oProperty
))
_section
section
(
RtfSectionPtr
(
new
RtfSection
()
),
last_section
.
end_para
,
m_ooxDocument
->
m_arrItems
.
size
());
section
.
props
->
m_oProperty
.
SetDefaultOOX
();
if
(
m_ooxDocument
->
m_oSectPr
.
IsInit
())
// свойства последней секции
{
OOXSectionPropertyReader
oSectReader
(
m_ooxDocument
->
m_oSectPr
.
GetPointer
());
if
(
oSectReader
.
Parse
(
oParam
,
section
.
props
->
m_oProperty
))
{
}
}
oParam
.
oRtf
->
AddItem
(
section
);
}
RtfSectionPtr
oFirstSection
;
if
(
true
==
m_poDocument
->
GetItem
(
oFirstSection
,
0
)
)
for
(
int
sect
=
0
;
sect
<
m_poDocument
->
GetCount
();
sect
++
)
{
m_oTextItemReader
.
m_oTextItems
=
oFirstSection
;
oParam
.
oRtf
->
m_oStatusSection
.
number
=
1
;
m_oTextItemReader
.
m_oTextItems
=
m_poDocument
->
m_aArray
[
sect
].
props
;
for
(
long
i
=
0
;
i
<
m_ooxDocument
->
m_arrItems
.
size
()
;
i
++
)
for
(
long
i
=
m_poDocument
->
m_aArray
[
sect
].
start_para
;
i
<
m_poDocument
->
m_aArray
[
sect
].
end_para
;
i
++
)
{
m_oTextItemReader
.
Parse
(
m_ooxDocument
->
m_arrItems
[
i
],
oParam
);
}
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXParagraphElementReaders.cpp
View file @
9503207e
...
...
@@ -1115,11 +1115,11 @@ bool OOXpPrReader::Parse( ReaderParameter oParam ,RtfParagraphProperty& oOutputP
OOXpPrTabReader
oTabReader
(
m_ooxParaProps
->
m_oTabs
.
GetPointer
());
oTabReader
.
Parse
(
oParam
,
oOutputProperty
.
m_oTabs
);
}
if
(
m_ooxParaProps
->
m_oSectPr
.
IsInit
())
{
oParam
.
oRtf
->
m_oStatusSection
.
number
++
;
oParam
.
oRtf
->
m_oStatusSection
.
start_new
=
true
;
}
//
if( m_ooxParaProps->m_oSectPr.IsInit())
//
{
//
oParam.oRtf->m_oStatusSection.number++;
//
oParam.oRtf->m_oStatusSection.start_new = true;
//
}
if
(
m_ooxParaProps
->
m_oRPr
.
IsInit
()
)
{
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXTextItemReader.h
View file @
9503207e
...
...
@@ -67,15 +67,15 @@ public:
if
(
true
==
m_oParagraphReader
.
Parse
(
oParam
,
(
*
oNewParagraph
),
CcnfStyle
()
))
{
m_oTextItems
->
AddItem
(
oNewParagraph
);
if
(
true
==
oParam
.
oRtf
->
m_oStatusSection
.
start_new
)
{
RtfSectionPtr
oCurSection
;
if
(
true
==
oParam
.
oRtf
->
GetItem
(
oCurSection
,
oParam
.
oRtf
->
m_oStatusSection
.
number
-
1
)
)
{
m_oTextItems
=
oCurSection
;
}
oParam
.
oRtf
->
m_oStatusSection
.
start_new
=
false
;
}
//
if( true == oParam.oRtf->m_oStatusSection.start_new )
//
{
//
RtfSectionPtr oCurSection;
//
if( true == oParam.oRtf->GetItem( oCurSection, oParam.oRtf->m_oStatusSection.number - 1) )
//
{
//
m_oTextItems = oCurSection;
//
}
//
oParam.oRtf->m_oStatusSection.start_new = false;
//
}
}
}
break
;
case
OOX
:
:
et_w_tbl
:
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.cpp
View file @
9503207e
...
...
@@ -41,7 +41,9 @@
RtfDocument
::
RtfDocument
()
{
m_aArray
.
push_back
(
RtfSectionPtr
(
new
RtfSection
()
)
);
_section
section
(
RtfSectionPtr
(
new
RtfSection
()),
0
,
0
);
m_aArray
.
push_back
(
section
);
m_oProperty
.
SetDefaultOOX
();
m_oDefaultCharProp
.
SetDefaultRtf
();
m_oDefaultParagraphProp
.
SetDefaultRtf
();
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.h
View file @
9503207e
...
...
@@ -36,7 +36,18 @@
#include "RtfSection.h"
#include "RtfMath.h"
class
RtfDocument
:
public
ItemContainer
<
RtfSectionPtr
>
struct
_section
{
_section
()
:
start_para
(
0
),
end_para
(
-
1
)
{}
_section
(
RtfSectionPtr
&
p
,
int
start
=
0
,
int
end
=
-
1
)
:
props
(
p
),
start_para
(
start
),
end_para
(
end
)
{}
RtfSectionPtr
props
;
int
start_para
;
int
end_para
;
};
class
RtfDocument
:
public
ItemContainer
<
_section
>
{
public:
RtfDocumentProperty
m_oProperty
;
...
...
@@ -60,14 +71,9 @@ public:
//для того чтобы конвертировать старый формат List в Numbering
std
::
vector
<
RtfOldListPtr
>
m_aOldLists
;
struct
_status_section
{
bool
start_new
;
int
number
;
}
m_oStatusSection
;
private:
std
::
vector
<
int
>
m_aShapeId
;
public:
IdGenerator
m_oIdGenerator
;
void
SetShapeId
(
int
nShapeId
)
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
View file @
9503207e
...
...
@@ -1883,11 +1883,11 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
}
}
RtfSectionPtr
oCurS
ection
;
if
(
true
==
poRtfDocument
->
GetItem
(
oCurS
ection
)
)
_section
s
ection
;
if
(
true
==
poRtfDocument
->
GetItem
(
s
ection
)
)
{
sResult
+=
oCurSection
->
RenderToOOX
(
oRenderParameter
);
oCurSection
->
m_bFinalize
=
false
;
sResult
+=
section
.
props
->
RenderToOOX
(
oRenderParameter
);
section
.
props
->
m_bFinalize
=
false
;
}
if
(
0
==
m_bAutoHyphenation
)
sResult
+=
_T
(
"<w:suppressAutoHyphens/>"
);
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfWriter.cpp
View file @
9503207e
...
...
@@ -97,7 +97,7 @@ bool RtfWriter::SaveByItem()
oNewParam
.
poWriter
=
this
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_UNKNOWN
;
if
(
m_oDocument
.
GetCount
()
>
1
&&
m_oDocument
[
0
]
->
GetCount
()
==
0
)
if
(
m_oDocument
.
GetCount
()
>
1
&&
m_oDocument
[
0
]
.
props
->
GetCount
()
==
0
)
{
//пишем конец секции
CStringA
sRtfExt
=
"
\\
sect"
;
...
...
@@ -125,7 +125,7 @@ bool RtfWriter::SaveByItem()
m_bFirst
=
false
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_FIRST_SECTION
;
}
sRtf
=
m_oDocument
[
0
]
->
m_oProperty
.
RenderToRtf
(
oNewParam
);
sRtf
=
m_oDocument
[
0
]
.
props
->
m_oProperty
.
RenderToRtf
(
oNewParam
);
RtfUtility
::
RtfInternalEncoder
::
Decode
(
sRtf
,
*
m_oCurTempFileSectWriter
);
//дописываем в файл
RELEASEOBJECT
(
m_oCurTempFileSectWriter
);
...
...
@@ -143,11 +143,14 @@ bool RtfWriter::SaveByItem()
m_oDocument
.
RemoveItem
(
0
);
}
//пишем параграф
if
(
m_oDocument
.
GetCount
()
>
0
&&
m_oDocument
[
0
]
->
GetCount
()
>
0
)
if
(
m_oDocument
.
GetCount
()
>
0
&&
m_oDocument
[
0
]
.
props
->
GetCount
()
>
0
)
{
CString
sRtf
;
sRtf
=
m_oDocument
[
0
]
->
operator
[](
0
)
->
RenderToRtf
(
oNewParam
);
if
(
TYPE_RTF_PARAGRAPH
==
m_oDocument
[
0
]
->
operator
[](
0
)
->
GetType
()
&&
!
(
m_oDocument
[
0
]
->
GetCount
()
==
0
&&
m_oDocument
.
GetCount
()
>
1
)
)
//для последнего параграфа секции не пишем \par
sRtf
=
m_oDocument
[
0
].
props
->
operator
[](
0
)
->
RenderToRtf
(
oNewParam
);
if
(
TYPE_RTF_PARAGRAPH
==
m_oDocument
[
0
].
props
->
operator
[](
0
)
->
GetType
()
&&
!
(
m_oDocument
[
0
].
props
->
GetCount
()
==
0
&&
m_oDocument
.
GetCount
()
>
1
)
)
//для последнего параграфа секции не пишем \par
{
sRtf
+=
_T
(
"
\\
par"
);
//oNewParam.nValue = RENDER_TO_RTF_PARAM_NO_PAR;
...
...
@@ -156,7 +159,7 @@ bool RtfWriter::SaveByItem()
//m_oTempFileWriter->Write( (BYTE*)(LPCSTR)sRtf, sRtf.GetLength() );
//удаляем элемент который только что написали
m_oDocument
[
0
]
->
RemoveItem
(
0
);
m_oDocument
[
0
]
.
props
->
RemoveItem
(
0
);
}
return
true
;
}
...
...
@@ -182,7 +185,7 @@ bool RtfWriter::SaveByItemEnd()
m_bFirst
=
false
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_FIRST_SECTION
;
}
sRtf
=
m_oDocument
[
0
]
->
m_oProperty
.
RenderToRtf
(
oNewParam
);
sRtf
=
m_oDocument
[
0
]
.
props
->
m_oProperty
.
RenderToRtf
(
oNewParam
);
RtfUtility
::
RtfInternalEncoder
::
Decode
(
sRtf
,
*
m_oCurTempFileSectWriter
);
//дописываем в файл
RELEASEOBJECT
(
m_oCurTempFileSectWriter
);
...
...
@@ -265,7 +268,7 @@ int RtfWriter::GetCount()
{
int
nCount
=
0
;
for
(
int
i
=
0
;
i
<
m_oDocument
.
GetCount
();
i
++
)
nCount
+=
m_oDocument
[
i
]
->
GetCount
();
nCount
+=
m_oDocument
[
i
]
.
props
->
GetCount
();
return
nCount
;
}
CString
RtfWriter
::
CreateRtfStart
()
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp
View file @
9503207e
...
...
@@ -179,7 +179,8 @@ CString OOXDocumentWriter::CreateXmlEnd( )
oNewParam
.
poWriter
=
&
m_oWriter
;
oNewParam
.
poRels
=
&
m_oWriter
.
m_oDocRels
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_UNKNOWN
;
sResult
+=
m_oDocument
[
0
]
->
m_oProperty
.
RenderToOOX
(
oNewParam
);
sResult
+=
m_oDocument
[
0
].
props
->
m_oProperty
.
RenderToOOX
(
oNewParam
);
sResult
+=
_T
(
"</w:body>"
);
sResult
+=
_T
(
"</w:document>"
);
...
...
@@ -222,12 +223,12 @@ bool OOXDocumentWriter::SaveByItem()
oNewParam
.
poRels
=
&
m_oWriter
.
m_oDocRels
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_UNKNOWN
;
if
(
m_oDocument
.
GetCount
()
>
1
)
//если что-то есть в следующей секции значит пред
у
дущая закончилась
if
(
m_oDocument
.
GetCount
()
>
1
)
//если что-то есть в следующей секции значит пред
ы
дущая закончилась
{
if
(
m_oDocument
[
1
]
->
GetCount
()
>
0
)
if
(
m_oDocument
[
1
]
.
props
->
GetCount
()
>
0
)
{
CString
sSectPr
=
m_oDocument
[
0
]
->
m_oProperty
.
RenderToOOX
(
oNewParam
);
CString
sXml
=
m_oDocument
[
1
]
->
operator
[](
0
)
->
RenderToOOX
(
oNewParam
);
CString
sSectPr
=
m_oDocument
[
0
]
.
props
->
m_oProperty
.
RenderToOOX
(
oNewParam
);
CString
sXml
=
m_oDocument
[
1
]
.
props
->
operator
[](
0
)
->
RenderToOOX
(
oNewParam
);
int
nIndexP
=
sXml
.
Find
(
_T
(
"<w:p>"
)
);
...
...
@@ -253,13 +254,13 @@ bool OOXDocumentWriter::SaveByItem()
m_oFileWriter
->
Write
((
BYTE
*
)
sXmlUTF
.
c_str
(),
sXmlUTF
.
length
());
m_oDocument
[
1
]
->
RemoveItem
(
0
);
//удаляем первый параграф
m_oDocument
[
1
]
.
props
->
RemoveItem
(
0
);
//удаляем первый параграф
m_oDocument
.
RemoveItem
(
0
);
//удаляем секцию
}
}
else
if
(
m_oDocument
.
GetCount
()
>
0
&&
m_oDocument
[
0
]
->
GetCount
()
>
0
)
//пишем параграф
else
if
(
m_oDocument
.
GetCount
()
>
0
&&
m_oDocument
[
0
]
.
props
->
GetCount
()
>
0
)
//пишем параграф
{
CString
sXml
=
m_oDocument
[
0
]
->
operator
[](
0
)
->
RenderToOOX
(
oNewParam
);
CString
sXml
=
m_oDocument
[
0
]
.
props
->
operator
[](
0
)
->
RenderToOOX
(
oNewParam
);
std
::
string
sXmlUTF
=
NSFile
::
CUtf8Converter
::
GetUtf8StringFromUnicode
(
sXml
.
GetBuffer
());
if
(
m_oFileWriter
)
...
...
@@ -272,7 +273,7 @@ bool OOXDocumentWriter::SaveByItem()
m_oFileWriter
=
NULL
;
}
m_oDocument
[
0
]
->
RemoveItem
(
0
);
//удаляем первый параграф
m_oDocument
[
0
]
.
props
->
RemoveItem
(
0
);
//удаляем первый параграф
}
}
return
true
;
...
...
@@ -285,11 +286,11 @@ bool OOXDocumentWriter::SaveByItemEnd()
oNewParam
.
poRels
=
&
m_oWriter
.
m_oDocRels
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_UNKNOWN
;
if
(
m_oDocument
.
GetCount
()
>
0
&&
m_oDocument
[
0
]
->
GetCount
()
>
0
)
//дописываем последний параграф
if
(
m_oDocument
.
GetCount
()
>
0
&&
m_oDocument
[
0
]
.
props
->
GetCount
()
>
0
)
//дописываем последний параграф
{
CString
sXml
=
m_oDocument
[
0
]
->
operator
[](
0
)
->
RenderToOOX
(
oNewParam
);
CString
sXml
=
m_oDocument
[
0
]
.
props
->
operator
[](
0
)
->
RenderToOOX
(
oNewParam
);
//удаляем первый параграф
m_oDocument
[
0
]
->
RemoveItem
(
0
);
m_oDocument
[
0
]
.
props
->
RemoveItem
(
0
);
std
::
string
sXmlUTF
=
NSFile
::
CUtf8Converter
::
GetUtf8StringFromUnicode
(
sXml
.
GetBuffer
());
m_oFileWriter
->
Write
((
BYTE
*
)
sXmlUTF
.
c_str
(),
sXmlUTF
.
length
());
...
...
ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.h
View file @
9503207e
...
...
@@ -64,7 +64,7 @@ public:
{
int
nCount
=
0
;
for
(
int
i
=
0
;
i
<
m_oDocument
.
GetCount
();
i
++
)
nCount
+=
m_oDocument
[
i
]
->
GetCount
();
nCount
+=
m_oDocument
[
i
]
.
props
->
GetCount
();
return
nCount
;
}
};
ASCOfficeRtfFile/RtfFormatTest/win32/RtfFormatTest.vcproj
View file @
9503207e
...
...
@@ -343,6 +343,10 @@
Filter=
"cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier=
"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=
"..\..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
>
</File>
<File
RelativePath=
"..\..\..\XlsxSerializerCom\Reader\ChartFromToBinary.cpp"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment