RichText: Header/Footer can be changed by paragraph/table

git-svn-id: svn://ultimatepp.org/upp/trunk@10084 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-07-21 05:45:44 +00:00
parent d65073ef29
commit 4b1727cab9
25 changed files with 506 additions and 356 deletions

View file

@ -171,7 +171,7 @@ RichPara::Format::Format()
rulerink = Black;
rulerstyle = RULER_SOLID;
bullet = 0;
keep = newpage = keepnext = orphan = false;
keep = newpage = keepnext = orphan = newhdrftr = false;
tabsize = 296;
memset(number, 0, sizeof(number));
reset_number = false;
@ -341,6 +341,8 @@ String RichPara::Pack(const RichPara::Format& style, Array<RichObject>& obj) con
if(format.ruler != style.ruler) pattr |= 0x10000;
if(format.rulerink != style.rulerink) pattr |= 0x20000;
if(format.rulerstyle != style.rulerstyle) pattr |= 0x40000;
if(format.newhdrftr != style.newhdrftr) pattr |= 0x80000;
out.Put32(pattr);
if(pattr & 1) out.Put16(format.align);
if(pattr & 2) out.Put16(format.before);
@ -388,6 +390,16 @@ String RichPara::Pack(const RichPara::Format& style, Array<RichObject>& obj) con
}
if(pattr & 0x40000)
out.Put16(format.rulerstyle);
if(pattr & 0x80000) {
out.Put(format.newhdrftr);
if(format.newhdrftr) {
String t = format.header_qtf;
String f = format.footer_qtf;
out % t % f;
}
}
obj.Clear();
CharFormat cf = style;
if(part.GetCount())
@ -612,6 +624,13 @@ void RichPara::Unpack(const String& data, const Array<RichObject>& obj,
format.rulerink.Serialize(in);
if(pattr & 0x40000)
format.rulerstyle = in.Get16();
if(pattr & 0x80000) {
format.newhdrftr = in.Get();
if(format.newhdrftr)
in % format.header_qtf % format.footer_qtf;
}
part.Clear();
int oi = 0;
UnpackParts(in, style, part, obj, oi);