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
841dfe40
Commit
841dfe40
authored
May 17, 2016
by
konovalovsergey
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open/save page border
parent
a0bebab5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
267 additions
and
11 deletions
+267
-11
ASCOfficeDocxFile2/BinReader/ReaderClasses.h
ASCOfficeDocxFile2/BinReader/ReaderClasses.h
+3
-0
ASCOfficeDocxFile2/BinReader/Readers.h
ASCOfficeDocxFile2/BinReader/Readers.h
+117
-0
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
+20
-1
ASCOfficeDocxFile2/BinWriter/BinWriters.h
ASCOfficeDocxFile2/BinWriter/BinWriters.h
+92
-0
Common/DocxFormat/Source/Common/SimpleTypes_Word.h
Common/DocxFormat/Source/Common/SimpleTypes_Word.h
+26
-1
Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.h
Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.h
+9
-9
No files found.
ASCOfficeDocxFile2/BinReader/ReaderClasses.h
View file @
841dfe40
...
...
@@ -24,6 +24,7 @@ public:
int
PageNumStart
;
CString
sectPrChange
;
CString
cols
;
CString
pgBorders
;
bool
bHeader
;
bool
bFooter
;
...
...
@@ -89,6 +90,8 @@ public:
if
(
bFooter
)
sRes
.
AppendFormat
(
_T
(
" w:footer=
\"
%d
\"
"
),
nMFooter
);
sRes
.
Append
(
_T
(
"/>"
));
if
(
!
pgBorders
.
IsEmpty
())
sRes
.
Append
(
pgBorders
);
if
(
bPageNumStart
)
sRes
.
AppendFormat
(
_T
(
"<w:pgNumType w:start=
\"
%d
\"
/>"
),
PageNumStart
);
if
(
!
cols
.
IsEmpty
())
...
...
ASCOfficeDocxFile2/BinReader/Readers.h
View file @
841dfe40
...
...
@@ -1171,6 +1171,12 @@ public:
res
=
Read1
(
length
,
&
Binary_pPrReader
::
ReadCols
,
this
,
&
oCols
);
pSectPr
->
cols
=
oCols
.
toXML
();
}
else
if
(
c_oSerProp_secPrType
::
pgBorders
==
type
)
{
OOX
::
Logic
::
CPageBorders
pgBorders
;
res
=
Read1
(
length
,
&
Binary_pPrReader
::
ReadPageBorders
,
this
,
&
pgBorders
);
pSectPr
->
pgBorders
=
pgBorders
.
toXML
();
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
...
...
@@ -1381,6 +1387,117 @@ public:
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
}
int
ReadPageBorders
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
OOX
::
Logic
::
CPageBorders
*
pPageBorders
=
static_cast
<
OOX
::
Logic
::
CPageBorders
*>
(
poResult
);
int
res
=
c_oSerConstants
::
ReadOk
;
if
(
c_oSerPageBorders
::
Display
==
type
)
{
pPageBorders
->
m_oDisplay
.
Init
();
pPageBorders
->
m_oDisplay
->
SetValue
((
SimpleTypes
::
EPageBorderDisplay
)
m_oBufferedStream
.
GetChar
());
}
else
if
(
c_oSerPageBorders
::
OffsetFrom
==
type
)
{
pPageBorders
->
m_oOffsetFrom
.
Init
();
pPageBorders
->
m_oOffsetFrom
->
SetValue
((
SimpleTypes
::
EPageBorderOffset
)
m_oBufferedStream
.
GetChar
());
}
else
if
(
c_oSerPageBorders
::
ZOrder
==
type
)
{
pPageBorders
->
m_oZOrder
.
Init
();
pPageBorders
->
m_oZOrder
->
SetValue
((
SimpleTypes
::
EPageBorderZOrder
)
m_oBufferedStream
.
GetChar
());
}
else
if
(
c_oSerPageBorders
::
Bottom
==
type
)
{
pPageBorders
->
m_oBottom
.
Init
();
res
=
Read2
(
length
,
&
Binary_pPrReader
::
ReadPageBorder
,
this
,
pPageBorders
->
m_oBottom
.
GetPointer
());
}
else
if
(
c_oSerPageBorders
::
Left
==
type
)
{
pPageBorders
->
m_oLeft
.
Init
();
res
=
Read2
(
length
,
&
Binary_pPrReader
::
ReadPageBorder
,
this
,
pPageBorders
->
m_oLeft
.
GetPointer
());
}
else
if
(
c_oSerPageBorders
::
Right
==
type
)
{
pPageBorders
->
m_oRight
.
Init
();
res
=
Read2
(
length
,
&
Binary_pPrReader
::
ReadPageBorder
,
this
,
pPageBorders
->
m_oRight
.
GetPointer
());
}
else
if
(
c_oSerPageBorders
::
Top
==
type
)
{
pPageBorders
->
m_oTop
.
Init
();
res
=
Read2
(
length
,
&
Binary_pPrReader
::
ReadPageBorder
,
this
,
pPageBorders
->
m_oTop
.
GetPointer
());
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
}
int
ReadPageBorder
(
BYTE
type
,
long
length
,
void
*
poResult
)
{
ComplexTypes
::
Word
::
CPageBorder
*
pPageBorder
=
static_cast
<
ComplexTypes
::
Word
::
CPageBorder
*>
(
poResult
);
int
res
=
c_oSerConstants
::
ReadOk
;
if
(
c_oSerPageBorders
::
Color
==
type
)
{
docRGB
color
=
oBinary_CommonReader2
.
ReadColor
();
pPageBorder
->
m_oColor
.
Init
();
pPageBorder
->
m_oColor
->
SetValue
(
SimpleTypes
::
hexcolorRGB
);
pPageBorder
->
m_oColor
->
Set_R
(
color
.
R
);
pPageBorder
->
m_oColor
->
Set_G
(
color
.
G
);
pPageBorder
->
m_oColor
->
Set_B
(
color
.
B
);
}
else
if
(
c_oSerPageBorders
::
ColorTheme
==
type
)
{
CThemeColor
themeColor
;
oBinary_CommonReader2
.
ReadThemeColor
(
length
,
themeColor
);
if
(
themeColor
.
Auto
)
{
pPageBorder
->
m_oColor
.
Init
();
pPageBorder
->
m_oColor
->
SetValue
(
SimpleTypes
::
hexcolorAuto
);
}
if
(
themeColor
.
bColor
)
{
pPageBorder
->
m_oThemeColor
.
Init
();
pPageBorder
->
m_oThemeColor
->
SetValue
((
SimpleTypes
::
EThemeColor
)
themeColor
.
Color
);
}
if
(
themeColor
.
bShade
)
{
pPageBorder
->
m_oThemeShade
.
Init
();
pPageBorder
->
m_oThemeShade
->
SetValue
(
themeColor
.
Shade
);
}
if
(
themeColor
.
bTint
)
{
pPageBorder
->
m_oThemeTint
.
Init
();
pPageBorder
->
m_oThemeTint
->
SetValue
(
themeColor
.
Tint
);
}
}
else
if
(
c_oSerPageBorders
::
Space
==
type
)
{
pPageBorder
->
m_oSpace
.
Init
();
pPageBorder
->
m_oSpace
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSerPageBorders
::
Sz
==
type
)
{
pPageBorder
->
m_oSz
.
Init
();
pPageBorder
->
m_oSz
->
SetValue
(
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSerPageBorders
::
Val
==
type
)
{
pPageBorder
->
m_oVal
.
Init
();
pPageBorder
->
m_oVal
->
SetValue
((
SimpleTypes
::
EBorder
)
m_oBufferedStream
.
GetLong
());
}
else
if
(
c_oSerPageBorders
::
Frame
==
type
)
{
pPageBorder
->
m_oFrame
.
Init
();
pPageBorder
->
m_oFrame
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
if
(
c_oSerPageBorders
::
Shadow
==
type
)
{
pPageBorder
->
m_oShadow
.
Init
();
pPageBorder
->
m_oShadow
->
FromBool
(
m_oBufferedStream
.
GetBool
());
}
else
res
=
c_oSerConstants
::
ReadUnknown
;
return
res
;
}
};
class
Binary_tblPrReader
:
public
Binary_CommonReader
<
Binary_tblPrReader
>
{
...
...
ASCOfficeDocxFile2/BinWriter/BinReaderWriterDefines.h
View file @
841dfe40
...
...
@@ -390,7 +390,8 @@ extern int g_nCurFormatVersion;
hdrftrelem
=
5
,
pageNumType
=
6
,
sectPrChange
=
7
,
cols
=
8
cols
=
8
,
pgBorders
=
9
};}
namespace
c_oSerProp_secPrSettingsType
{
enum
c_oSerProp_secPrSettingsType
{
...
...
@@ -882,6 +883,24 @@ extern int g_nCurFormatVersion;
ColumnSpace
=
5
,
ColumnW
=
6
};}
namespace
c_oSerPageBorders
{
enum
c_oSerPageBorders
{
Display
=
0
,
OffsetFrom
=
1
,
ZOrder
=
2
,
Bottom
=
3
,
Left
=
4
,
Right
=
5
,
Top
=
6
,
Color
=
7
,
Frame
=
8
,
Id
=
9
,
Shadow
=
10
,
Space
=
11
,
Sz
=
12
,
ColorTheme
=
13
,
Val
=
16
};}
}
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES
ASCOfficeDocxFile2/BinWriter/BinWriters.h
View file @
841dfe40
...
...
@@ -1297,6 +1297,12 @@ namespace BinDocxRW
WriteColumns
(
pSectPr
->
m_oCols
.
get
());
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
if
(
pSectPr
->
m_oPgBorders
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerProp_secPrType
::
pgBorders
);
WritePageBorders
(
pSectPr
->
m_oPgBorders
.
get
());
m_oBcw
.
WriteItemEnd
(
nCurPos
);
}
};
void
WritePageSettings
(
OOX
::
Logic
::
CSectionProperty
*
pSectPr
)
{
...
...
@@ -1517,6 +1523,92 @@ namespace BinDocxRW
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
}
void
WritePageBorders
(
const
OOX
::
Logic
::
CPageBorders
&
PageBorders
)
{
int
nCurPos
=
0
;
if
(
PageBorders
.
m_oDisplay
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerPageBorders
::
Display
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
PageBorders
.
m_oDisplay
->
GetValue
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
if
(
PageBorders
.
m_oOffsetFrom
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerPageBorders
::
OffsetFrom
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
PageBorders
.
m_oOffsetFrom
->
GetValue
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
if
(
PageBorders
.
m_oZOrder
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerPageBorders
::
ZOrder
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
PageBorders
.
m_oZOrder
->
GetValue
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
if
(
PageBorders
.
m_oBottom
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerPageBorders
::
Bottom
);
WritePageBorder
(
PageBorders
.
m_oBottom
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
if
(
PageBorders
.
m_oLeft
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerPageBorders
::
Left
);
WritePageBorder
(
PageBorders
.
m_oLeft
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
if
(
PageBorders
.
m_oRight
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerPageBorders
::
Right
);
WritePageBorder
(
PageBorders
.
m_oRight
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
if
(
PageBorders
.
m_oTop
.
IsInit
())
{
nCurPos
=
m_oBcw
.
WriteItemStart
(
c_oSerPageBorders
::
Top
);
WritePageBorder
(
PageBorders
.
m_oTop
.
get
());
m_oBcw
.
WriteItemWithLengthEnd
(
nCurPos
);
}
};
void
WritePageBorder
(
const
ComplexTypes
::
Word
::
CPageBorder
&
pageBorder
)
{
int
nCurPos
=
0
;
if
(
pageBorder
.
m_oColor
.
IsInit
())
{
m_oBcw
.
WriteColor
(
c_oSerPageBorders
::
Color
,
pageBorder
.
m_oColor
.
get
());
}
m_oBcw
.
WriteThemeColor
(
c_oSerPageBorders
::
ColorTheme
,
pageBorder
.
m_oColor
,
pageBorder
.
m_oThemeColor
,
pageBorder
.
m_oThemeTint
,
pageBorder
.
m_oThemeShade
);
if
(
pageBorder
.
m_oSpace
.
IsInit
())
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPageBorders
::
Space
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Long
);
m_oBcw
.
m_oStream
.
WriteLONG
(
pageBorder
.
m_oSpace
->
GetValue
());
}
if
(
pageBorder
.
m_oSz
.
IsInit
())
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPageBorders
::
Sz
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Long
);
m_oBcw
.
m_oStream
.
WriteLONG
(
pageBorder
.
m_oSz
->
GetValue
());
}
if
(
pageBorder
.
m_oVal
.
IsInit
())
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPageBorders
::
Val
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Long
);
m_oBcw
.
m_oStream
.
WriteLONG
(
pageBorder
.
m_oVal
.
get
().
GetValue
());
}
if
(
pageBorder
.
m_oFrame
.
IsInit
())
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPageBorders
::
Frame
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Byte
);
m_oBcw
.
m_oStream
.
WriteBOOL
(
pageBorder
.
m_oFrame
->
ToBool
());
}
if
(
pageBorder
.
m_oShadow
.
IsInit
())
{
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPageBorders
::
Shadow
);
m_oBcw
.
m_oStream
.
WriteBYTE
(
c_oSerPropLenType
::
Byte
);
m_oBcw
.
m_oStream
.
WriteBOOL
(
pageBorder
.
m_oShadow
->
ToBool
());
}
//todo id
};
};
class
Binary_tblPrWriter
{
...
...
Common/DocxFormat/Source/Common/SimpleTypes_Word.h
View file @
841dfe40
...
...
@@ -1860,7 +1860,7 @@ namespace SimpleTypes
//--------------------------------------------------------------------------------
template
<
int
nDefValue
=
0
>
class
CEighthPointMeasure
:
CSimpleType
<
int
,
nDefValue
>
class
CEighthPointMeasure
:
public
CSimpleType
<
int
,
nDefValue
>
{
public:
CEighthPointMeasure
()
{}
...
...
@@ -2634,6 +2634,31 @@ namespace SimpleTypes
default
:
return
_T
(
"auto"
);
}
}
virtual
CString
ToStringNoAlpha
()
const
{
switch
(
this
->
m_eValue
)
{
case
hexcolorAuto
:
return
_T
(
"auto"
);
case
hexcolorRGB
:
{
CString
sResult
=
_T
(
""
);
//alfa
if
(
m_unR
>
0x0f
)
sResult
.
AppendFormat
(
_T
(
"%X"
),
m_unR
);
else
sResult
.
AppendFormat
(
_T
(
"0%X"
),
m_unR
);
if
(
m_unG
>
0x0f
)
sResult
.
AppendFormat
(
_T
(
"%X"
),
m_unG
);
else
sResult
.
AppendFormat
(
_T
(
"0%X"
),
m_unG
);
if
(
m_unB
>
0x0f
)
sResult
.
AppendFormat
(
_T
(
"%X"
),
m_unB
);
else
sResult
.
AppendFormat
(
_T
(
"0%X"
),
m_unB
);
return
sResult
;
}
default
:
return
_T
(
"auto"
);
}
}
SimpleType_FromString
(
EHexColor
)
SimpleType_Operator_Equal
(
CHexColor
)
...
...
Common/DocxFormat/Source/DocxFormat/Logic/SectionProperty.h
View file @
841dfe40
...
...
@@ -404,14 +404,14 @@ namespace ComplexTypes
if
(
m_oColor
.
IsInit
()
)
{
sResult
+=
_T
(
"w:color=
\"
"
);
sResult
+=
m_oColor
->
ToString
();
sResult
+=
m_oColor
->
ToString
NoAlpha
();
sResult
+=
_T
(
"
\"
"
);
}
if
(
m_oFrame
.
IsInit
()
)
{
sResult
+=
_T
(
"w:frame=
\"
"
);
sResult
+=
m_oFrame
->
ToString
(
);
sResult
+=
m_oFrame
->
ToString
2
(
SimpleTypes
::
onofftostring1
);
sResult
+=
_T
(
"
\"
"
);
}
if
(
m_oId
.
IsInit
()
)
...
...
@@ -424,7 +424,7 @@ namespace ComplexTypes
if
(
m_oShadow
.
IsInit
()
)
{
sResult
+=
_T
(
"w:shadow=
\"
"
);
sResult
+=
m_oShadow
->
ToString
(
);
sResult
+=
m_oShadow
->
ToString
2
(
SimpleTypes
::
onofftostring1
);
sResult
+=
_T
(
"
\"
"
);
}
...
...
@@ -561,14 +561,14 @@ namespace ComplexTypes
if
(
m_oColor
.
IsInit
()
)
{
sResult
+=
_T
(
"w:color=
\"
"
);
sResult
+=
m_oColor
->
ToString
();
sResult
+=
m_oColor
->
ToString
NoAlpha
();
sResult
+=
_T
(
"
\"
"
);
}
if
(
m_oFrame
.
IsInit
()
)
{
sResult
+=
_T
(
"w:frame=
\"
"
);
sResult
+=
m_oFrame
->
ToString
(
);
sResult
+=
m_oFrame
->
ToString
2
(
SimpleTypes
::
onofftostring1
);
sResult
+=
_T
(
"
\"
"
);
}
if
(
m_oId
.
IsInit
()
)
...
...
@@ -581,7 +581,7 @@ namespace ComplexTypes
if
(
m_oShadow
.
IsInit
()
)
{
sResult
+=
_T
(
"w:shadow=
\"
"
);
sResult
+=
m_oShadow
->
ToString
(
);
sResult
+=
m_oShadow
->
ToString
2
(
SimpleTypes
::
onofftostring1
);
sResult
+=
_T
(
"
\"
"
);
}
...
...
@@ -700,14 +700,14 @@ namespace ComplexTypes
if
(
m_oColor
.
IsInit
()
)
{
sResult
+=
_T
(
"w:color=
\"
"
);
sResult
+=
m_oColor
->
ToString
();
sResult
+=
m_oColor
->
ToString
NoAlpha
();
sResult
+=
_T
(
"
\"
"
);
}
if
(
m_oFrame
.
IsInit
()
)
{
sResult
+=
_T
(
"w:frame=
\"
"
);
sResult
+=
m_oFrame
->
ToString
(
);
sResult
+=
m_oFrame
->
ToString
2
(
SimpleTypes
::
onofftostring1
);
sResult
+=
_T
(
"
\"
"
);
}
if
(
m_oId
.
IsInit
()
)
...
...
@@ -720,7 +720,7 @@ namespace ComplexTypes
if
(
m_oShadow
.
IsInit
()
)
{
sResult
+=
_T
(
"w:shadow=
\"
"
);
sResult
+=
m_oShadow
->
ToString
(
);
sResult
+=
m_oShadow
->
ToString
2
(
SimpleTypes
::
onofftostring1
);
sResult
+=
_T
(
"
\"
"
);
}
...
...
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