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
789bb1d4
Commit
789bb1d4
authored
Nov 28, 2017
by
Sergey Konovalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add open/save bookmarks
parent
4138ae5c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
252 additions
and
3 deletions
+252
-3
ASCOfficeDocxFile2/BinReader/Readers.h
ASCOfficeDocxFile2/BinReader/Readers.h
+111
-0
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
+17
-3
ASCOfficeDocxFile2/BinWriter/BinWriters.h
ASCOfficeDocxFile2/BinWriter/BinWriters.h
+124
-0
No files found.
ASCOfficeDocxFile2/BinReader/Readers.h
View file @
789bb1d4
...
...
@@ -3734,6 +3734,18 @@ public:
res
=
Read2
(
length
,
&
Binary_DocumentTableReader
::
Read_Background
,
this
,
&
oBackground
);
m_oDocumentWriter
.
m_oBackground
.
WriteString
(
oBackground
.
Write
());
}
else
if
(
c_oSerParType
::
BookmarkStart
==
type
)
{
OOX
::
Logic
::
CBookmarkStart
oBookmarkStart
;
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadBookmarkStart
,
this
,
&
oBookmarkStart
);
m_oDocumentWriter
.
m_oContent
.
WriteString
(
oBookmarkStart
.
toXML
());
}
else
if
(
c_oSerParType
::
BookmarkEnd
==
type
)
{
OOX
::
Logic
::
CBookmarkEnd
oBookmarkEnd
;
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadBookmarkEnd
,
this
,
&
oBookmarkEnd
);
m_oDocumentWriter
.
m_oContent
.
WriteString
(
oBookmarkEnd
.
toXML
());
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
...
...
@@ -3872,6 +3884,18 @@ public:
SdtWraper
oSdt
(
1
);
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadSdt
,
this
,
&
oSdt
);
}
else
if
(
c_oSerParType
::
BookmarkStart
==
type
)
{
OOX
::
Logic
::
CBookmarkStart
oBookmarkStart
;
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadBookmarkStart
,
this
,
&
oBookmarkStart
);
m_oDocumentWriter
.
m_oContent
.
WriteString
(
oBookmarkStart
.
toXML
());
}
else
if
(
c_oSerParType
::
BookmarkEnd
==
type
)
{
OOX
::
Logic
::
CBookmarkEnd
oBookmarkEnd
;
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadBookmarkEnd
,
this
,
&
oBookmarkEnd
);
m_oDocumentWriter
.
m_oContent
.
WriteString
(
oBookmarkEnd
.
toXML
());
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
...
...
@@ -4267,6 +4291,57 @@ public:
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
}
int
ReadBookmarkStart
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
OOX
::
Logic
::
CBookmarkStart
*
pBookmarkStart
=
static_cast
<
OOX
::
Logic
::
CBookmarkStart
*>
(
poResult
);
if
(
c_oSerBookmark
::
Id
==
type
)
{
pBookmarkStart
->
m_oId
.
Init
();
pBookmarkStart
->
m_oId
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSerBookmark
::
Name
==
type
)
{
pBookmarkStart
->
m_sName
.
Init
();
pBookmarkStart
->
m_sName
->
append
(
m_oBufferedStream
.
GetString3
(
length
));
}
else
if
(
c_oSerBookmark
::
DisplacedByCustomXml
==
type
)
{
pBookmarkStart
->
m_oDisplacedByCustomXml
.
Init
();
pBookmarkStart
->
m_oDisplacedByCustomXml
->
SetValue
((
SimpleTypes
::
EDisplacedByCustomXml
)
m_oBufferedStream
.
GetUChar
());
}
else
if
(
c_oSerBookmark
::
ColFirst
==
type
)
{
pBookmarkStart
->
m_oColFirst
.
Init
();
pBookmarkStart
->
m_oColFirst
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSerBookmark
::
ColLast
==
type
)
{
pBookmarkStart
->
m_oColLast
.
Init
();
pBookmarkStart
->
m_oColLast
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
}
int
ReadBookmarkEnd
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
int
res
=
c_oSerConstants
::
ReadOk
;
OOX
::
Logic
::
CBookmarkEnd
*
pBookmarkEnd
=
static_cast
<
OOX
::
Logic
::
CBookmarkEnd
*>
(
poResult
);
if
(
c_oSerBookmark
::
Id
==
type
)
{
pBookmarkEnd
->
m_oId
.
Init
();
pBookmarkEnd
->
m_oId
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSerBookmark
::
DisplacedByCustomXml
==
type
)
{
pBookmarkEnd
->
m_oDisplacedByCustomXml
.
Init
();
pBookmarkEnd
->
m_oDisplacedByCustomXml
->
SetValue
((
SimpleTypes
::
EDisplacedByCustomXml
)
m_oBufferedStream
.
GetUChar
());
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
}
int
ReadHyperlink
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
...
...
@@ -4460,6 +4535,18 @@ public:
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadMathSSup
,
this
,
poResult
);
GetRunStringWriter
().
WriteString
(
std
::
wstring
(
_T
(
"</m:sSup>"
)));
}
else
if
(
c_oSer_OMathContentType
::
BookmarkStart
==
type
)
{
OOX
::
Logic
::
CBookmarkStart
oBookmarkStart
;
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadBookmarkStart
,
this
,
&
oBookmarkStart
);
GetRunStringWriter
().
WriteString
(
oBookmarkStart
.
toXML
());
}
else
if
(
c_oSer_OMathContentType
::
BookmarkEnd
==
type
)
{
OOX
::
Logic
::
CBookmarkEnd
oBookmarkEnd
;
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadBookmarkEnd
,
this
,
&
oBookmarkEnd
);
GetRunStringWriter
().
WriteString
(
oBookmarkEnd
.
toXML
());
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
...
...
@@ -6923,6 +7010,18 @@ public:
SdtWraper
oSdt
(
2
);
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadSdt
,
this
,
&
oSdt
);
}
else
if
(
c_oSerDocTableType
::
BookmarkStart
==
type
)
{
OOX
::
Logic
::
CBookmarkStart
oBookmarkStart
;
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadBookmarkStart
,
this
,
&
oBookmarkStart
);
pCStringWriter
->
WriteString
(
oBookmarkStart
.
toXML
());
}
else
if
(
c_oSerDocTableType
::
BookmarkEnd
==
type
)
{
OOX
::
Logic
::
CBookmarkEnd
oBookmarkEnd
;
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadBookmarkEnd
,
this
,
&
oBookmarkEnd
);
pCStringWriter
->
WriteString
(
oBookmarkEnd
.
toXML
());
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
...
...
@@ -6960,6 +7059,18 @@ public:
SdtWraper
oSdt
(
3
);
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadSdt
,
this
,
&
oSdt
);
}
else
if
(
c_oSerDocTableType
::
BookmarkStart
==
type
)
{
OOX
::
Logic
::
CBookmarkStart
oBookmarkStart
;
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadBookmarkStart
,
this
,
&
oBookmarkStart
);
pCStringWriter
->
WriteString
(
oBookmarkStart
.
toXML
());
}
else
if
(
c_oSerDocTableType
::
BookmarkEnd
==
type
)
{
OOX
::
Logic
::
CBookmarkEnd
oBookmarkEnd
;
res
=
Read1
(
length
,
&
Binary_DocumentTableReader
::
ReadBookmarkEnd
,
this
,
&
oBookmarkEnd
);
pCStringWriter
->
WriteString
(
oBookmarkEnd
.
toXML
());
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
...
...
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
View file @
789bb1d4
...
...
@@ -476,7 +476,9 @@ extern int g_nCurFormatVersion;
MoveFromRangeStart
=
18
,
MoveFromRangeEnd
=
19
,
MoveToRangeStart
=
20
,
MoveToRangeEnd
=
21
MoveToRangeEnd
=
21
,
BookmarkStart
=
22
,
BookmarkEnd
=
23
};}
namespace
c_oSerDocTableType
{
enum
c_oSerDocTableType
{
...
...
@@ -491,7 +493,9 @@ extern int g_nCurFormatVersion;
Cell_Pr
=
7
,
Cell_Content
=
8
,
tblGridChange
=
9
,
Sdt
=
10
Sdt
=
10
,
BookmarkStart
=
11
,
BookmarkEnd
=
12
};}
namespace
c_oSerRunType
{
enum
c_oSerRunType
{
...
...
@@ -900,7 +904,9 @@ extern int g_nCurFormatVersion;
Ins
=
62
,
Del
=
63
,
columnbreak
=
64
,
ARPr
=
65
ARPr
=
65
,
BookmarkStart
=
66
,
BookmarkEnd
=
67
};}
namespace
c_oSer_FramePrType
{
enum
c_oSer_FramePrType
{
...
...
@@ -1105,6 +1111,14 @@ extern int g_nCurFormatVersion;
Name
=
6
,
UserId
=
7
};}
namespace
c_oSerBookmark
{
enum
c_oSerBookmark
{
Id
=
0
,
Name
=
1
,
DisplacedByCustomXml
=
2
,
ColFirst
=
3
,
ColLast
=
4
};}
}
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES
ASCOfficeDocxFile2/BinWriter/BinWriters.h
View file @
789bb1d4
...
...
@@ -3076,6 +3076,20 @@ namespace BinDocxRW
OOX
::
Logic
::
CBdo
*
pBdo
=
static_cast
<
OOX
::
Logic
::
CBdo
*>
(
item
);
WriteDocumentContent
(
pBdo
->
m_arrItems
);
}
break
;
case
OOX
:
:
et_w_bookmarkStart
:
{
OOX
::
Logic
::
CBookmarkStart
*
pBookmarkStart
=
static_cast
<
OOX
::
Logic
::
CBookmarkStart
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerParType
::
BookmarkStart
);
WriteBookmarkStart
(
*
pBookmarkStart
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
break
;
case
OOX
:
:
et_w_bookmarkEnd
:
{
OOX
::
Logic
::
CBookmarkEnd
*
pBookmarkEnd
=
static_cast
<
OOX
::
Logic
::
CBookmarkEnd
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerParType
::
BookmarkEnd
);
WriteBookmarkEnd
(
*
pBookmarkEnd
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
break
;
default:
break
;
}
...
...
@@ -3249,6 +3263,22 @@ namespace BinDocxRW
WriteComment
(
OOX
::
et_w_commentRangeEnd
,
pCommentRangeEnd
->
m_oId
);
break
;
}
case
OOX
:
:
et_w_bookmarkStart
:
{
OOX
::
Logic
::
CBookmarkStart
*
pBookmarkStart
=
static_cast
<
OOX
::
Logic
::
CBookmarkStart
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerParType
::
BookmarkStart
);
WriteBookmarkStart
(
*
pBookmarkStart
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
break
;
}
case
OOX
:
:
et_w_bookmarkEnd
:
{
OOX
::
Logic
::
CBookmarkEnd
*
pBookmarkEnd
=
static_cast
<
OOX
::
Logic
::
CBookmarkEnd
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerParType
::
BookmarkEnd
);
WriteBookmarkEnd
(
*
pBookmarkEnd
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
break
;
}
//todo moveRange on all levels(body, p ...)
// case OOX::et_w_moveFromRangeStart:
// {
...
...
@@ -3660,6 +3690,56 @@ namespace BinDocxRW
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
void
WriteBookmarkStart
(
const
OOX
::
Logic
::
CBookmarkStart
&
oBookmarkStart
)
{
int
nCurPos
=
0
;
if
(
oBookmarkStart
.
m_oId
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerBookmark
::
Id
);
m_oBcw
.
m_oStream
.
WriteLONG
(
oBookmarkStart
.
m_oId
->
GetValue
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
if
(
oBookmarkStart
.
m_sName
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerBookmark
::
Name
);
m_oBcw
.
m_oStream
.
WriteStringW3
(
oBookmarkStart
.
m_sName
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
if
(
oBookmarkStart
.
m_oDisplacedByCustomXml
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerBookmark
::
DisplacedByCustomXml
);
m_oBcw
.
m_oStream
.
WriteBYTE
((
BYTE
)
oBookmarkStart
.
m_oDisplacedByCustomXml
->
GetValue
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
if
(
oBookmarkStart
.
m_oColFirst
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerBookmark
::
ColFirst
);
m_oBcw
.
m_oStream
.
WriteLONG
(
oBookmarkStart
.
m_oColFirst
->
GetValue
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
if
(
oBookmarkStart
.
m_oColLast
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerBookmark
::
ColLast
);
m_oBcw
.
m_oStream
.
WriteLONG
(
oBookmarkStart
.
m_oColLast
->
GetValue
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
void
WriteBookmarkEnd
(
const
OOX
::
Logic
::
CBookmarkEnd
&
oBookmarkEnd
)
{
int
nCurPos
=
0
;
if
(
oBookmarkEnd
.
m_oId
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerBookmark
::
Id
);
m_oBcw
.
m_oStream
.
WriteLONG
(
oBookmarkEnd
.
m_oId
->
GetValue
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
if
(
oBookmarkEnd
.
m_oDisplacedByCustomXml
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerBookmark
::
DisplacedByCustomXml
);
m_oBcw
.
m_oStream
.
WriteBYTE
((
BYTE
)
oBookmarkEnd
.
m_oDisplacedByCustomXml
->
GetValue
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
void
WriteHyperlink
(
OOX
::
Logic
::
CHyperlink
*
pHyperlink
)
{
...
...
@@ -4097,6 +4177,22 @@ namespace BinDocxRW
m_oBcw
.
WriteItemEnd
(
nCurPos
);
break
;
}
case
OOX
:
:
et_w_bookmarkStart
:
{
OOX
::
Logic
::
CBookmarkStart
*
pBookmarkStart
=
static_cast
<
OOX
::
Logic
::
CBookmarkStart
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSer_OMathContentType
::
BookmarkStart
);
WriteBookmarkStart
(
*
pBookmarkStart
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
break
;
}
case
OOX
:
:
et_w_bookmarkEnd
:
{
OOX
::
Logic
::
CBookmarkEnd
*
pBookmarkEnd
=
static_cast
<
OOX
::
Logic
::
CBookmarkEnd
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSer_OMathContentType
::
BookmarkEnd
);
WriteBookmarkEnd
(
*
pBookmarkEnd
);
m_oBcw
.
WriteItemEnd
(
nCurPos
);
break
;
}
default:
break
;
}
...
...
@@ -6638,6 +6734,20 @@ namespace BinDocxRW
OOX
::
Logic
::
CBdo
*
pBdo
=
static_cast
<
OOX
::
Logic
::
CBdo
*>
(
item
);
WriteTableContent
(
pBdo
->
m_arrItems
,
pTblPr
,
nRows
,
nCols
);
}
else
if
(
OOX
::
et_w_bookmarkStart
==
item
->
getType
())
{
OOX
::
Logic
::
CBookmarkStart
*
pBookmarkStart
=
static_cast
<
OOX
::
Logic
::
CBookmarkStart
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerDocTableType
::
BookmarkStart
);
WriteBookmarkStart
(
*
pBookmarkStart
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
else
if
(
OOX
::
et_w_bookmarkEnd
==
item
->
getType
())
{
OOX
::
Logic
::
CBookmarkEnd
*
pBookmarkEnd
=
static_cast
<
OOX
::
Logic
::
CBookmarkEnd
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerDocTableType
::
BookmarkEnd
);
WriteBookmarkEnd
(
*
pBookmarkEnd
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
}
void
WriteRow
(
const
OOX
::
Logic
::
CTr
&
Row
,
OOX
::
Logic
::
CTableProperty
*
pTblPr
,
int
nCurRowIndex
,
int
nRows
,
int
nCols
)
...
...
@@ -6698,6 +6808,20 @@ namespace BinDocxRW
OOX
::
Logic
::
CBdo
*
pBdo
=
static_cast
<
OOX
::
Logic
::
CBdo
*>
(
item
);
WriteRowContent
(
pBdo
->
m_arrItems
,
pTblPr
,
nCurRowIndex
,
nRows
,
nCols
);
}
else
if
(
OOX
::
et_w_bookmarkStart
==
item
->
getType
())
{
OOX
::
Logic
::
CBookmarkStart
*
pBookmarkStart
=
static_cast
<
OOX
::
Logic
::
CBookmarkStart
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerDocTableType
::
BookmarkStart
);
WriteBookmarkStart
(
*
pBookmarkStart
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
else
if
(
OOX
::
et_w_bookmarkEnd
==
item
->
getType
())
{
OOX
::
Logic
::
CBookmarkEnd
*
pBookmarkEnd
=
static_cast
<
OOX
::
Logic
::
CBookmarkEnd
*>
(
item
);
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerDocTableType
::
BookmarkEnd
);
WriteBookmarkEnd
(
*
pBookmarkEnd
);
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
}
void
WriteCell
(
OOX
::
Logic
::
CTc
&
tc
,
OOX
::
Logic
::
CTableProperty
*
pTblPr
,
int
nCurRowIndex
,
int
nCurColIndex
,
int
nRows
,
int
nCols
)
...
...
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