mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-04 14:22:43 -06:00
RichText/RichEdit: Header/Footer support
git-svn-id: svn://ultimatepp.org/upp/trunk@6476 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
09edff5e1c
commit
39d5b3f06d
20 changed files with 474 additions and 82 deletions
|
|
@ -731,6 +731,13 @@ void RichEditWithToolBar::RefreshBar()
|
|||
toolbar.Set(THISBACK(TheBar));
|
||||
}
|
||||
|
||||
void RichEdit::EvaluateFields()
|
||||
{
|
||||
WhenStartEvaluating();
|
||||
text.EvaluateFields(vars);
|
||||
Finish();
|
||||
}
|
||||
|
||||
RichEditWithToolBar::RichEditWithToolBar()
|
||||
{
|
||||
InsertFrame(0, toolbar);
|
||||
|
|
|
|||
137
uppsrc/RichEdit/HeaderFooter.cpp
Normal file
137
uppsrc/RichEdit/HeaderFooter.cpp
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
#include "RichEdit.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
struct RichEditHdrFtr : public RichEdit {
|
||||
ToolBar toolbar;
|
||||
|
||||
void RefreshBar();
|
||||
void TheBar(Bar& bar);
|
||||
|
||||
void PageNumber();
|
||||
void PageCount();
|
||||
|
||||
void Init(int pageno, int pagecount);
|
||||
|
||||
typedef RichEditHdrFtr CLASSNAME;
|
||||
|
||||
RichEditHdrFtr();
|
||||
};
|
||||
|
||||
void RichEditHdrFtr::TheBar(Bar& bar)
|
||||
{
|
||||
EditTools(bar);
|
||||
bar.Gap();
|
||||
FontTools(bar);
|
||||
bar.Gap();
|
||||
InkTool(bar);
|
||||
PaperTool(bar);
|
||||
bar.Gap();
|
||||
LanguageTool(bar);
|
||||
SpellCheckTool(bar);
|
||||
bar.Break();
|
||||
StyleTool(bar);
|
||||
bar.Gap();
|
||||
ParaTools(bar);
|
||||
bar.Gap();
|
||||
TableTools(bar);
|
||||
bar.Gap();
|
||||
bar.Add(!IsReadOnly(), t_("Insert page number"), RichEditImg::PageNumber(), THISBACK(PageNumber));
|
||||
bar.Add(!IsReadOnly(), t_("Insert page count"), RichEditImg::PageCount(), THISBACK(PageCount));
|
||||
}
|
||||
|
||||
void RichEditHdrFtr::PageNumber()
|
||||
{
|
||||
DLOG("PAGENUMBER");
|
||||
DDUMP(GetCursor());
|
||||
PasteText(ParseQTF("{:VALUE:PAGENUMBER:}"));
|
||||
DDUMP(GetCursor());
|
||||
EvaluateFields();
|
||||
DDUMP(GetCursor());
|
||||
}
|
||||
|
||||
void RichEditHdrFtr::PageCount()
|
||||
{
|
||||
PasteText(ParseQTF("{:VALUE:PAGECOUNT:}"));
|
||||
EvaluateFields();
|
||||
}
|
||||
|
||||
void RichEditHdrFtr::RefreshBar()
|
||||
{
|
||||
toolbar.Set(THISBACK(TheBar));
|
||||
}
|
||||
|
||||
RichEditHdrFtr::RichEditHdrFtr()
|
||||
{
|
||||
InsertFrame(0, toolbar);
|
||||
WhenRefreshBar = callback(this, &RichEditHdrFtr::RefreshBar);
|
||||
SetVar("PAGECOUNT", "###");
|
||||
SetVar("PAGENUMBER", "#");
|
||||
SetVar("__DISPLAY_VALUE_FIELDS", 1);
|
||||
}
|
||||
|
||||
struct HeaderFooterDlg : WithHeaderFooterLayout<TopWindow> {
|
||||
typedef HeaderFooterDlg CLASSNAME;
|
||||
|
||||
RichEditHdrFtr header_editor, footer_editor;
|
||||
|
||||
void Sync();
|
||||
void Load(const RichText& text);
|
||||
void Save(RichText& text);
|
||||
|
||||
HeaderFooterDlg();
|
||||
};
|
||||
|
||||
void HeaderFooterDlg::Sync()
|
||||
{
|
||||
header_editor.Enable(use_header);
|
||||
footer_editor.Enable(use_footer);
|
||||
}
|
||||
|
||||
HeaderFooterDlg::HeaderFooterDlg()
|
||||
{
|
||||
CtrlLayoutOKCancel(*this, "Header / Footer");
|
||||
use_header <<= use_footer <<= THISBACK(Sync);
|
||||
Sync();
|
||||
}
|
||||
|
||||
void HeaderFooterDlg::Load(const RichText& text)
|
||||
{
|
||||
String h = text.GetHeaderQtf();
|
||||
use_header = !IsNull(h);
|
||||
if(use_header)
|
||||
header_editor.SetQTF(h);
|
||||
header_editor.EvaluateFields();
|
||||
h = text.GetFooterQtf();
|
||||
use_footer = !IsNull(h);
|
||||
if(use_footer)
|
||||
footer_editor.SetQTF(h);
|
||||
footer_editor.EvaluateFields();
|
||||
Sync();
|
||||
}
|
||||
|
||||
void HeaderFooterDlg::Save(RichText& text)
|
||||
{
|
||||
if(use_header)
|
||||
text.SetHeaderQtf(header_editor.GetQTF());
|
||||
else
|
||||
text.ClearHeader();
|
||||
if(use_footer)
|
||||
text.SetFooterQtf(footer_editor.GetQTF());
|
||||
else
|
||||
text.ClearFooter();
|
||||
}
|
||||
|
||||
void RichEdit::HeaderFooter()
|
||||
{
|
||||
HeaderFooterDlg dlg;
|
||||
dlg.Load(text);
|
||||
dlg.SetRect(0, 0, GetSize().cx, dlg.GetLayoutSize().cy);
|
||||
if(dlg.Execute() == IDOK) {
|
||||
dlg.Save(text);
|
||||
Refresh();
|
||||
Finish();
|
||||
}
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
@ -295,7 +295,10 @@ void RichEdit::PasteText(const RichText& text)
|
|||
RemoveSelection();
|
||||
Insert(cursor, text, false);
|
||||
ReadStyles();
|
||||
DDUMP(text.GetLength());
|
||||
DDUMP(cursor);
|
||||
Move(cursor + text.GetLength(), false);
|
||||
DDUMP(cursor);
|
||||
}
|
||||
|
||||
struct ToParaIterator : RichText::Iterator {
|
||||
|
|
|
|||
|
|
@ -605,6 +605,8 @@ private:
|
|||
|
||||
void StyleKeys();
|
||||
void ApplyStyleKey(int i);
|
||||
|
||||
void HeaderFooter();
|
||||
|
||||
bool BegSelTabFix();
|
||||
void BegSelTabFixEnd(bool fix);
|
||||
|
|
@ -749,10 +751,14 @@ public:
|
|||
|
||||
void InsertImageTool(Bar& bar);
|
||||
void StyleKeysTool(Bar& bar);
|
||||
|
||||
void HeaderFooterTool(Bar& bar);
|
||||
|
||||
void DefaultBar(Bar& bar, bool extended = true);
|
||||
|
||||
void EvaluateFields() { WhenStartEvaluating(); text.EvaluateFields(vars); }
|
||||
void SetVar(const String& id, const Value& v) { vars.GetAdd(id) = v; }
|
||||
Value GetVar(const String& id) const { return vars.Get(id, Value()); }
|
||||
void EvaluateFields();
|
||||
|
||||
void GotoLabel(const String& lbl);
|
||||
void BeginPara();
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ IMAGE_ID(SplitCell)
|
|||
IMAGE_ID(JoinCell)
|
||||
IMAGE_ID(CellProperties)
|
||||
IMAGE_ID(LoadImageFile)
|
||||
IMAGE_ID(HeaderFooter)
|
||||
IMAGE_ID(PageNumber)
|
||||
IMAGE_ID(PageCount)
|
||||
IMAGE_ID(sss)
|
||||
|
||||
IMAGE_BEGIN_DATA
|
||||
IMAGE_DATA(120,156,237,90,219,114,196,32,8,181,211,78,247,242,212,79,222,79,219,63,75,147,236,58,37,22,1,197,123,100,199,135)
|
||||
|
|
@ -89,63 +93,83 @@ IMAGE_DATA(105,255,216,246,87,163,95,148,238,35,138,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|||
IMAGE_END_DATA(672, 26)
|
||||
|
||||
IMAGE_BEGIN_DATA
|
||||
IMAGE_DATA(120,156,237,154,109,110,131,48,12,134,179,77,147,214,105,63,122,228,104,234,193,122,51,86,196,160,193,56,137,191,72,82)
|
||||
IMAGE_DATA(200,43,89,20,154,199,118,76,112,144,90,119,117,87,119,113,95,174,107,165,225,223,224,249,144,25,231,220,150,227,92,147)
|
||||
IMAGE_DATA(242,218,248,144,135,243,197,230,143,241,144,229,154,85,254,92,158,82,127,234,253,127,93,245,102,176,149,247,126,24,13,158)
|
||||
IMAGE_DATA(135,215,176,113,243,53,248,153,122,77,202,107,227,99,115,10,231,134,205,31,227,33,203,181,90,243,167,212,159,122,255,95)
|
||||
IMAGE_DATA(90,13,54,3,233,142,82,58,151,26,49,91,202,165,70,204,150,114,57,158,122,51,232,241,123,252,166,226,215,211,212,12)
|
||||
IMAGE_DATA(62,106,167,1,228,135,201,52,236,202,199,252,58,23,61,218,241,218,252,91,80,175,255,41,213,94,51,64,23,131,150,47)
|
||||
IMAGE_DATA(184,24,181,249,215,86,175,255,105,213,94,51,152,228,21,175,95,35,11,120,242,98,154,57,41,111,145,255,17,120,32,118)
|
||||
IMAGE_DATA(253,140,249,46,138,218,107,6,150,93,221,236,53,147,185,51,105,115,174,185,179,89,198,151,214,127,197,50,121,111,112,47)
|
||||
IMAGE_DATA(78,250,86,81,160,25,12,4,139,178,57,81,120,44,38,149,221,57,118,172,6,164,216,247,251,125,117,156,89,138,33,236)
|
||||
IMAGE_DATA(114,78,177,148,15,142,133,254,82,241,111,191,183,197,176,28,230,185,199,248,71,197,22,131,49,185,181,195,234,24,222,59)
|
||||
IMAGE_DATA(110,253,176,181,195,48,59,77,205,224,221,210,101,118,33,103,30,170,38,120,23,60,184,185,115,200,75,207,195,5,43,49)
|
||||
IMAGE_DATA(224,143,107,77,213,255,196,124,61,237,208,12,98,210,78,88,195,107,59,169,134,199,118,158,82,60,54,158,227,67,195,167)
|
||||
IMAGE_DATA(198,81,124,104,118,69,237,206,202,201,79,194,166,198,106,121,185,78,212,12,172,124,148,142,143,45,22,41,107,225,163,84)
|
||||
IMAGE_DATA(124,88,179,216,81,195,82,124,72,190,231,60,204,82,86,58,62,46,208,12,164,175,152,212,14,92,139,15,85,154,15,57)
|
||||
IMAGE_DATA(137,15,13,143,141,231,248,208,240,169,113,20,31,20,105,88,171,252,36,236,158,247,71,110,140,55,3,110,145,49,86,234)
|
||||
IMAGE_DATA(67,195,67,70,178,88,164,124,234,97,222,155,199,198,115,124,104,120,78,51,200,241,212,28,185,108,108,188,164,25,228,62)
|
||||
IMAGE_DATA(231,226,90,222,31,105,51,133,111,6,126,192,143,80,212,113,18,229,124,199,190,183,200,129,234,171,228,252,75,230,192,245)
|
||||
IMAGE_DATA(177,231,252,107,228,32,245,81,98,253,83,159,73,133,46,143,102,240,237,222,212,126,186,88,10,187,183,230,115,91,26,119)
|
||||
IMAGE_DATA(150,31,247,89,59,141,132,198,39,102,54,25,255,252,109,176,148,15,44,95,207,226,183,99,249,252,115,188,164,6,62,241)
|
||||
IMAGE_DATA(27,43,221,71,104,50,31,241,156,90,240,113,164,63,198,252,1,158,192,167,158,0,0,0,0,0,0,0,0,0,0,0)
|
||||
IMAGE_END_DATA(640, 17)
|
||||
IMAGE_DATA(120,156,237,90,109,142,218,48,16,117,187,170,212,173,246,199,30,133,27,112,10,254,243,171,127,56,4,81,181,7,224,70)
|
||||
IMAGE_DATA(112,51,23,3,206,14,195,216,158,15,19,27,200,147,70,33,137,223,188,231,137,51,142,186,117,159,238,211,189,187,223,110)
|
||||
IMAGE_DATA(198,21,252,37,240,185,47,140,115,238,150,39,185,166,229,91,245,49,31,207,151,154,63,197,199,92,105,212,242,47,229,115)
|
||||
IMAGE_DATA(234,207,125,254,143,139,185,25,220,98,24,6,31,2,159,195,107,212,184,120,13,255,230,94,211,242,173,250,212,156,224,220)
|
||||
IMAGE_DATA(168,249,83,124,204,149,70,171,249,115,234,207,125,254,15,141,14,155,129,118,71,153,218,75,11,205,158,188,180,208,236,201)
|
||||
IMAGE_DATA(203,243,97,110,6,179,254,172,223,149,126,59,156,155,193,91,107,27,8,131,63,135,133,123,149,35,126,206,37,143,245,248)
|
||||
IMAGE_DATA(86,255,61,96,174,255,75,162,191,102,64,46,6,43,127,194,197,104,245,223,26,115,253,95,22,253,53,131,51,6,195,231)
|
||||
IMAGE_DATA(87,224,34,62,123,49,69,158,150,95,195,255,51,240,17,196,245,171,204,159,193,65,127,205,160,102,87,175,246,153,41,220)
|
||||
IMAGE_DATA(153,172,158,91,238,108,53,245,181,245,191,226,10,249,67,133,103,241,162,95,21,119,110,6,91,103,251,7,24,191,223,239)
|
||||
IMAGE_DATA(125,10,133,93,97,123,196,105,28,165,25,16,238,95,60,138,181,195,61,139,246,114,185,196,215,163,143,83,205,194,220,114)
|
||||
IMAGE_DATA(218,235,245,218,111,54,155,241,8,114,20,235,29,57,171,213,106,204,1,239,29,14,135,108,132,49,48,7,228,75,98,177)
|
||||
IMAGE_DATA(88,248,221,110,119,138,120,45,165,249,245,239,107,140,120,45,250,189,232,111,115,252,227,147,24,3,242,65,56,141,127,80)
|
||||
IMAGE_DATA(251,241,217,113,106,24,198,129,218,195,53,200,125,103,240,186,177,227,220,12,126,86,203,231,46,139,93,2,135,62,201,123)
|
||||
IMAGE_DATA(224,59,240,226,150,206,49,95,123,14,23,172,38,80,62,105,116,85,255,23,230,183,195,29,154,65,10,150,9,199,110,169)
|
||||
IMAGE_DATA(237,130,212,162,151,106,107,59,49,181,243,104,180,33,159,235,1,143,199,249,36,218,169,156,92,237,82,222,212,24,205,174)
|
||||
IMAGE_DATA(168,105,130,148,118,42,127,110,12,183,62,165,250,114,80,183,145,60,72,51,176,242,61,58,62,146,62,181,88,180,220,26)
|
||||
IMAGE_DATA(57,166,210,199,53,75,29,45,92,78,14,205,125,201,203,172,229,106,199,167,129,154,129,164,163,74,195,154,223,194,143,93)
|
||||
IMAGE_DATA(154,187,227,228,118,15,173,118,204,35,245,0,57,48,151,84,155,202,39,209,206,229,228,106,75,60,112,80,210,46,33,229)
|
||||
IMAGE_DATA(129,227,47,53,63,201,51,162,116,74,115,211,142,45,7,243,203,0,47,70,41,2,247,47,154,0,23,81,59,230,145,122)
|
||||
IMAGE_DATA(128,28,152,75,170,77,229,147,104,227,135,47,209,198,245,231,120,192,227,97,253,75,30,40,109,42,103,202,131,164,25,228)
|
||||
IMAGE_DATA(180,75,160,60,104,154,1,117,46,105,6,165,223,57,93,92,95,202,23,5,106,109,81,254,82,184,109,66,215,205,96,240)
|
||||
IMAGE_DATA(244,17,131,59,78,131,82,238,212,253,26,30,184,185,166,156,255,148,30,164,57,238,57,255,22,30,180,57,166,88,255,220)
|
||||
IMAGE_DATA(119,210,128,247,99,51,248,227,126,152,243,204,16,1,238,144,150,223,125,33,236,44,31,238,87,107,27,25,132,55,38,134)
|
||||
IMAGE_DATA(142,255,253,183,193,169,114,80,126,7,17,255,118,172,156,255,61,94,83,131,33,243,55,86,126,14,24,186,28,105,79,61)
|
||||
IMAGE_DATA(228,120,166,255,24,243,31,246,50,208,145,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
|
||||
IMAGE_END_DATA(800, 17)
|
||||
|
||||
IMAGE_BEGIN_DATA
|
||||
IMAGE_DATA(120,156,237,90,219,114,196,32,8,245,161,125,104,167,15,253,100,63,188,51,105,221,174,89,130,128,224,37,184,109,206,142)
|
||||
IMAGE_DATA(147,155,71,14,72,48,201,108,248,12,159,225,35,188,4,3,54,161,85,185,20,148,252,189,47,220,42,249,36,87,169,31)
|
||||
IMAGE_DATA(246,165,142,139,254,196,120,184,175,38,86,173,144,230,103,166,93,173,253,217,154,158,201,255,181,144,138,193,107,248,90,79)
|
||||
IMAGE_DATA(88,3,182,116,163,54,182,157,191,53,52,196,15,149,36,168,241,103,219,47,180,252,83,255,167,216,239,200,63,119,164,98)
|
||||
IMAGE_DATA(240,54,120,204,24,227,30,240,251,126,19,23,143,145,182,92,3,67,176,85,248,12,190,164,191,37,6,86,110,109,92,133)
|
||||
IMAGE_DATA(255,203,242,189,225,237,255,244,248,173,90,12,224,43,128,181,24,96,4,99,49,232,225,75,250,207,136,95,109,220,63,157)
|
||||
IMAGE_DATA(204,147,225,237,255,51,22,3,118,101,237,229,107,111,230,85,249,189,254,247,194,59,25,175,98,176,120,252,86,44,6,158)
|
||||
IMAGE_DATA(43,251,76,254,73,241,99,225,157,140,87,49,88,60,126,51,94,19,70,67,10,130,38,24,222,252,51,161,209,42,233,247)
|
||||
IMAGE_DATA(230,123,195,219,127,215,248,165,98,240,62,100,164,95,68,176,138,165,253,136,86,53,124,76,93,211,110,53,124,172,135,160)
|
||||
IMAGE_DATA(61,86,254,123,127,131,253,227,68,86,236,75,92,35,92,184,134,196,43,158,102,238,60,139,109,60,70,139,110,120,179,152)
|
||||
IMAGE_DATA(125,6,188,174,120,183,216,38,198,152,207,31,93,12,122,33,85,190,158,202,122,22,127,101,244,234,247,230,123,195,219,255)
|
||||
IMAGE_DATA(167,123,50,24,12,234,157,217,242,30,77,189,179,91,222,227,123,236,67,59,135,134,206,107,249,181,243,35,237,83,253,56)
|
||||
IMAGE_DATA(62,30,131,229,41,199,224,248,53,109,18,95,19,155,101,248,130,239,150,62,118,188,254,148,130,183,219,255,30,14,70,40)
|
||||
IMAGE_DATA(112,21,136,58,79,38,137,112,238,96,31,62,158,81,215,131,28,188,252,33,100,119,234,167,164,254,94,72,219,244,47,17)
|
||||
IMAGE_DATA(120,204,56,187,3,114,184,125,203,24,120,171,225,230,134,125,129,231,57,192,127,199,96,251,185,229,174,84,211,218,79,217)
|
||||
IMAGE_DATA(157,38,142,254,242,42,251,159,251,83,124,109,252,153,229,178,208,76,205,191,100,159,143,235,118,224,26,248,213,15,0,88)
|
||||
IMAGE_DATA(63,97,154,180,167,181,223,203,55,54,95,224,98,160,64,143,51,27,5,37,127,239,11,183,74,62,201,21,244,31,170,170)
|
||||
IMAGE_DATA(192,173,250,9,198,43,182,66,34,137,137,167,72,68,245,77,196,220,72,221,246,255,187,254,134,230,143,134,98,160,69,107)
|
||||
IMAGE_DATA(64,14,55,97,195,132,236,251,205,252,200,62,98,233,244,71,52,198,246,248,221,146,23,254,168,68,2,92,220,95,197,111)
|
||||
IMAGE_DATA(211,62,42,254,97,20,255,42,8,39,99,112,49,176,38,157,121,2,0,151,220,86,38,236,214,39,34,29,209,62,97,59)
|
||||
IMAGE_DATA(39,114,126,128,118,211,1,142,25,29,42,126,197,190,73,59,229,255,204,248,231,227,220,145,138,219,85,0,28,81,41,6)
|
||||
IMAGE_DATA(35,156,120,172,148,81,197,165,11,71,68,199,188,22,110,194,200,132,85,241,243,183,130,173,188,97,40,126,145,176,104,37)
|
||||
IMAGE_DATA(183,36,52,213,191,73,63,176,127,233,183,233,199,205,172,223,120,157,104,150,235,237,152,240,154,208,235,204,140,96,155,38)
|
||||
IMAGE_DATA(179,72,94,208,168,235,53,251,152,111,213,111,189,153,6,235,15,136,31,106,246,33,55,95,199,79,21,53,253,251,62,90)
|
||||
IMAGE_DATA(20,224,113,77,63,230,64,174,33,254,133,221,154,255,129,209,140,125,65,253,40,136,254,43,65,233,35,241,13,245,223,34)
|
||||
IMAGE_DATA(108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
|
||||
IMAGE_END_DATA(832, 17)
|
||||
IMAGE_DATA(120,156,237,90,75,110,227,48,12,229,98,186,232,96,22,221,204,25,10,244,48,179,235,121,162,67,230,56,5,60,150,91)
|
||||
IMAGE_DATA(41,52,77,74,164,62,145,210,250,5,132,127,122,226,35,37,211,150,17,120,129,23,248,3,191,192,128,37,97,89,46,7)
|
||||
IMAGE_DATA(37,63,182,197,91,37,159,229,42,245,227,182,220,241,161,61,211,31,109,171,201,85,41,82,227,211,211,175,214,127,111,77)
|
||||
IMAGE_DATA(143,20,255,92,240,197,224,9,62,230,19,86,128,197,223,168,133,22,249,75,129,17,62,100,38,65,142,223,219,255,65,203)
|
||||
IMAGE_DATA(15,141,191,139,255,138,249,55,28,190,24,60,183,239,246,29,110,73,127,175,224,238,250,184,92,46,139,100,136,47,86,97)
|
||||
IMAGE_DATA(223,206,57,119,48,11,95,225,95,212,95,152,3,43,87,132,82,127,146,175,200,95,55,255,163,241,237,243,55,99,49,88)
|
||||
IMAGE_DATA(177,92,175,215,205,252,62,24,139,129,231,5,248,125,48,22,131,20,95,83,12,36,253,150,28,192,89,12,166,195,183,207)
|
||||
IMAGE_DATA(95,135,98,32,62,89,107,249,92,34,131,61,2,191,54,254,90,40,245,79,203,31,141,209,241,119,207,223,140,197,128,2)
|
||||
IMAGE_DATA(140,55,227,172,252,59,229,79,196,232,201,120,22,131,201,243,215,105,153,208,20,169,36,104,146,49,154,127,79,104,180,166)
|
||||
IMAGE_DATA(244,143,230,143,198,232,248,135,230,207,23,131,223,77,122,2,120,91,215,183,110,125,138,189,133,53,254,186,143,143,233,117)
|
||||
IMAGE_DATA(138,112,205,133,39,241,186,125,5,248,135,143,241,117,142,143,183,212,63,195,195,107,243,216,254,162,243,31,184,49,22,170)
|
||||
IMAGE_DATA(79,138,255,47,195,53,160,134,11,149,220,224,91,227,131,250,177,232,222,141,11,234,211,162,27,251,211,234,222,119,240,249)
|
||||
IMAGE_DATA(189,167,246,219,77,237,155,93,145,118,70,67,30,45,139,65,11,164,42,95,77,101,189,23,127,102,212,234,31,205,31,141)
|
||||
IMAGE_DATA(209,241,63,212,155,65,7,112,107,102,203,58,154,91,179,91,214,241,53,254,177,159,157,145,243,90,126,238,124,75,255,92)
|
||||
IMAGE_DATA(59,137,79,251,16,121,202,62,36,126,78,91,138,175,201,205,52,252,68,236,150,54,118,60,173,165,224,121,251,223,195,206)
|
||||
IMAGE_DATA(9,7,169,2,113,231,217,73,146,56,183,243,255,213,31,23,172,38,121,225,67,72,12,106,45,169,159,23,252,214,255,75)
|
||||
IMAGE_DATA(4,31,11,193,70,96,142,180,111,233,131,110,53,220,96,52,22,124,94,2,254,119,12,245,31,44,52,229,76,235,223,207)
|
||||
IMAGE_DATA(110,63,112,252,151,215,116,252,161,61,199,215,230,95,120,92,30,52,115,227,159,242,47,231,117,217,113,13,124,203,135,0)
|
||||
IMAGE_DATA(177,146,112,254,180,254,107,249,70,27,11,90,12,20,168,9,102,225,160,228,199,182,120,171,228,179,220,132,254,93,85,77)
|
||||
IMAGE_DATA(112,179,113,162,254,14,219,196,68,74,78,60,197,68,84,223,68,194,141,84,237,255,167,235,47,176,241,40,40,6,90,148)
|
||||
IMAGE_DATA(38,100,119,19,22,12,72,220,47,230,59,241,21,75,167,223,145,62,150,219,111,155,188,248,199,77,36,196,165,237,85,252)
|
||||
IMAGE_DATA(50,237,173,242,15,173,248,103,65,184,51,26,23,3,235,164,51,15,0,226,178,219,204,128,109,109,28,209,225,236,3,22)
|
||||
IMAGE_DATA(57,78,138,3,217,166,3,29,11,58,84,252,140,127,147,118,46,254,158,249,15,199,161,33,151,183,179,0,12,68,166,24)
|
||||
IMAGE_DATA(180,8,226,246,164,116,42,46,95,56,28,57,150,181,72,3,198,78,88,21,63,124,43,88,142,55,12,199,63,76,88,242)
|
||||
IMAGE_DATA(36,183,76,104,174,125,145,126,228,255,212,111,211,79,205,172,223,120,157,49,203,245,114,116,88,38,212,6,211,35,217,166)
|
||||
IMAGE_DATA(193,60,76,94,100,220,245,156,127,202,183,234,183,222,76,141,245,3,225,67,206,63,230,134,235,244,173,34,167,63,238,147)
|
||||
IMAGE_DATA(135,2,62,206,233,167,28,204,53,228,255,224,55,23,63,8,154,105,44,164,29,135,100,252,74,112,250,88,252,7,240,41)
|
||||
IMAGE_DATA(238,88,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
|
||||
IMAGE_END_DATA(896, 17)
|
||||
|
||||
IMAGE_BEGIN_DATA
|
||||
IMAGE_DATA(120,156,237,149,209,10,195,32,12,69,243,218,183,126,178,148,125,152,127,230,112,160,68,155,152,24,157,29,195,11,23,149)
|
||||
IMAGE_DATA(246,104,76,53,133,19,78,56,32,4,152,167,96,112,193,39,57,231,130,164,111,240,145,211,90,90,63,142,32,173,195,245)
|
||||
IMAGE_DATA(255,153,31,252,254,143,199,255,0,111,240,28,237,98,176,168,24,112,222,252,230,43,222,224,57,90,92,12,84,188,247,254)
|
||||
IMAGE_DATA(227,152,204,212,143,86,206,79,242,233,25,165,154,39,46,124,102,235,150,226,241,250,45,86,138,95,193,138,249,67,57,187)
|
||||
IMAGE_DATA(181,104,157,192,242,204,33,174,114,251,83,124,79,49,39,10,58,123,254,176,181,241,91,120,163,199,21,139,193,128,70,131)
|
||||
IMAGE_DATA(176,108,100,168,208,76,226,185,177,133,111,197,216,171,226,202,64,255,126,165,255,24,158,119,9,47,236,225,86,72,107,246)
|
||||
IMAGE_DATA(117,201,166,120,3,155,121,204,166,248,20,44,180,222,85,176,153,239,200,87,161,55,0,70,16,237,0,0,0,0,0,0)
|
||||
IMAGE_END_DATA(224, 4)
|
||||
IMAGE_DATA(120,156,237,150,189,74,3,65,16,128,183,18,237,124,14,245,17,44,242,2,1,17,34,62,66,64,176,75,234,40,218,165)
|
||||
IMAGE_DATA(176,16,132,52,118,22,119,207,16,72,151,198,34,72,44,130,85,172,12,54,193,23,88,157,203,237,101,127,102,111,103,119)
|
||||
IMAGE_DATA(207,68,67,6,134,187,203,237,183,243,187,147,99,251,108,159,237,49,206,89,117,194,3,84,225,133,116,58,29,238,146,223)
|
||||
IMAGE_DATA(224,129,163,170,203,62,60,49,97,199,118,191,201,124,100,253,215,238,255,26,248,0,173,70,182,195,96,69,195,192,166,91)
|
||||
IMAGE_DATA(126,203,107,124,128,86,35,43,30,6,36,126,48,24,100,10,201,20,247,160,196,253,81,94,188,195,68,231,145,3,95,176)
|
||||
IMAGE_DATA(250,21,227,101,251,101,172,203,127,2,235,204,159,148,51,227,42,217,225,86,222,210,196,90,110,255,20,239,51,204,145,129)
|
||||
IMAGE_DATA(110,237,63,89,169,254,135,240,129,26,47,48,12,34,4,156,104,68,242,62,123,52,88,92,50,162,7,21,195,11,71,245)
|
||||
IMAGE_DATA(31,227,101,86,143,207,55,183,124,60,94,28,23,184,54,26,222,241,186,254,199,50,93,21,159,36,206,24,140,65,42,179)
|
||||
IMAGE_DATA(181,26,227,151,23,140,223,92,217,245,252,204,228,173,236,181,164,57,123,116,168,212,169,96,225,29,172,17,254,17,88,38)
|
||||
IMAGE_DATA(214,10,86,177,41,249,1,126,33,108,193,19,213,236,173,200,97,128,9,24,58,8,112,142,105,76,118,207,9,138,240,7)
|
||||
IMAGE_DATA(17,188,18,139,109,178,107,95,44,91,126,115,248,216,254,169,180,127,61,52,94,228,97,224,248,148,114,10,172,251,250,76)
|
||||
IMAGE_DATA(114,77,139,123,95,254,229,249,158,159,158,28,7,242,105,198,238,238,238,40,60,37,30,217,255,159,71,133,167,196,83,198)
|
||||
IMAGE_DATA(131,79,16,87,40,191,204,73,90,250,201,43,226,7,94,94,175,243,139,120,82,35,71,203,218,45,223,91,252,55,126,115)
|
||||
IMAGE_DATA(249,165,230,51,49,124,42,171,39,203,155,94,246,223,149,83,44,158,143,247,167,194,254,251,219,163,211,62,166,119,119,183)
|
||||
IMAGE_DATA(36,222,94,227,133,239,148,158,112,199,228,127,70,172,103,188,250,97,144,26,186,110,190,217,108,42,83,180,213,106,189,82)
|
||||
IMAGE_DATA(121,193,244,122,61,229,185,221,110,63,248,248,175,239,23,194,215,235,245,140,117,31,58,60,6,38,29,40,204,134,203,126)
|
||||
IMAGE_DATA(183,219,181,238,65,27,6,75,95,250,253,190,179,198,101,245,160,242,114,253,134,195,97,169,255,24,47,239,225,202,31,214)
|
||||
IMAGE_DATA(83,62,53,94,21,79,26,6,155,38,179,217,204,24,4,121,67,83,165,104,36,216,75,60,231,77,21,34,25,63,26,141)
|
||||
IMAGE_DATA(188,248,233,116,90,12,2,56,4,33,54,133,78,38,19,111,223,231,243,185,50,8,242,92,132,72,104,12,161,60,58,8)
|
||||
IMAGE_DATA(32,30,10,156,215,41,58,127,255,69,190,1,56,87,173,247,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
|
||||
IMAGE_END_DATA(640, 8)
|
||||
|
|
|
|||
|
|
@ -213,3 +213,13 @@ LAYOUT(StyleKeysLayout, 736, 556)
|
|||
ITEM(Button, cancel, SetLabel(t_("Cancel")).LeftPosZ(664, 64).TopPosZ(524, 24))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(HeaderFooterLayout, 548, 580)
|
||||
ITEM(Option, use_header, SetLabel(t_("Use header")).LeftPosZ(4, 120).TopPosZ(4, 16))
|
||||
UNTYPED(header_editor, HSizePosZ(0, 0).TopPosZ(24, 240))
|
||||
ITEM(Option, use_footer, SetLabel(t_("Use footer")).LeftPosZ(4, 120).VSizePosZ(280, 284))
|
||||
UNTYPED(footer_editor, HSizePosZ(0, 0).BottomPosZ(40, 240))
|
||||
ITEM(Button, ok, SetLabel(t_("OK")).RightPosZ(76, 64).BottomPosZ(8, 24))
|
||||
ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 64).BottomPosZ(8, 24))
|
||||
ITEM(LabelBox, dv___6, LeftPosZ(0, 548).TopPosZ(260, 24))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ file
|
|||
Tool.cpp,
|
||||
Clip.cpp,
|
||||
StyleKeys.cpp,
|
||||
HeaderFooter.cpp,
|
||||
RichEdit.t charset "UTF-8",
|
||||
RichEdit.icpp,
|
||||
RichEdit.lay,
|
||||
|
|
|
|||
|
|
@ -440,6 +440,11 @@ void RichEdit::StyleKeysTool(Bar& bar)
|
|||
bar.Add(t_("Style keys.."), USERBACK(StyleKeys));
|
||||
}
|
||||
|
||||
void RichEdit::HeaderFooterTool(Bar& bar)
|
||||
{
|
||||
bar.Add(t_("Header/Footer.."), RichEditImg::HeaderFooter(), USERBACK(HeaderFooter));
|
||||
}
|
||||
|
||||
void RichEdit::DefaultBar(Bar& bar, bool extended)
|
||||
{
|
||||
EditTools(bar);
|
||||
|
|
@ -461,6 +466,10 @@ void RichEdit::DefaultBar(Bar& bar, bool extended)
|
|||
StyleTool(bar);
|
||||
bar.Gap();
|
||||
ParaTools(bar);
|
||||
if(extended) {
|
||||
bar.Gap();
|
||||
HeaderFooterTool(bar);
|
||||
}
|
||||
bar.Gap();
|
||||
if(extended) {
|
||||
LabelTool(bar);
|
||||
|
|
|
|||
|
|
@ -475,6 +475,14 @@ String AsQTF(const RichText& text, byte charset, dword options)
|
|||
// for(i = 0; i < text.GetPartCount(); i++)
|
||||
// sm.FindAdd(text.GetParaStyle(i));
|
||||
|
||||
String hdr = text.GetHeaderQtf(charset, options);
|
||||
if(hdr.GetCount())
|
||||
qtf << "^H" << hdr << "^^\r\n";
|
||||
|
||||
String ftr = text.GetFooterQtf(charset, options);
|
||||
if(hdr.GetCount())
|
||||
qtf << "^F" << ftr << "^^\r\n";
|
||||
|
||||
if(!(options & QTF_NOSTYLES))
|
||||
for(i = 0; i < sm.GetCount(); i++) {
|
||||
Uuid id = sm[i];
|
||||
|
|
|
|||
100
uppsrc/RichText/HeaderFooter.cpp
Normal file
100
uppsrc/RichText/HeaderFooter.cpp
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
#include "RichText.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
struct RichNumberField : RichPara::FieldType {
|
||||
virtual Array<RichPara::Part> Evaluate(const String& param, VectorMap<String, Value>& vars,
|
||||
const RichPara::CharFormat& fmt) {
|
||||
String h = AsString(vars.Get(param, Null));
|
||||
Array<RichPara::Part> ps;
|
||||
RichPara::Part& p = ps.Add();
|
||||
p.format = fmt;
|
||||
if(!IsNull(vars.Get("__DISPLAY_VALUE_FIELDS", Null)))
|
||||
p.format.paper = WhiteGray();
|
||||
p.text = h.ToWString();
|
||||
return ps;
|
||||
}
|
||||
};
|
||||
|
||||
INITBLOCK {
|
||||
RichPara::Register<RichNumberField>("VALUE");
|
||||
}
|
||||
|
||||
Rect RichText::GetPageMinusHeaderFooter(const Rect& page) const
|
||||
{
|
||||
Rect p = page;
|
||||
VectorMap<String, Value> vars;
|
||||
vars.Add("PAGENUMBER", 999999999);
|
||||
vars.Add("PAGECOUNT", 999999999);
|
||||
if(header) {
|
||||
header->EvaluateFields(vars);
|
||||
p.top += header->GetHeight(page.GetWidth());
|
||||
}
|
||||
if(footer) {
|
||||
footer->EvaluateFields(vars);
|
||||
p.bottom -= footer->GetHeight(page.GetWidth());
|
||||
}
|
||||
return p.GetHeight() > page.GetHeight() / 2 ? p : page;
|
||||
}
|
||||
|
||||
void RichText::PaintHeaderFooter(PageDraw& pw, const Rect& page, const PaintInfo& pi_,
|
||||
int from_page, int to_page, int page_count) const
|
||||
{
|
||||
Rect rpage = GetPageMinusHeaderFooter(page);
|
||||
if(rpage == page)
|
||||
return;
|
||||
PaintInfo pi = pi_;
|
||||
pi.sell = pi.selh = 0;
|
||||
VectorMap<String, Value> vars;
|
||||
vars.Add("PAGECOUNT", GetHeight(rpage).page);
|
||||
for(int i = from_page; i <= to_page; i++) {
|
||||
vars.GetAdd("PAGENUMBER") = i + 1;
|
||||
if(header) {
|
||||
header->EvaluateFields(vars);
|
||||
header->Paint(pw, PageY(i, page.top), page, pi);
|
||||
}
|
||||
if(footer) {
|
||||
footer->EvaluateFields(vars);
|
||||
Rect pr = page;
|
||||
pr.top = rpage.bottom;
|
||||
footer->Paint(pw, PageY(i, pr.top), page, pi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RichText::PickHeader(pick_ RichText& txt)
|
||||
{
|
||||
txt.ClearHeader();
|
||||
header.Create() = txt;
|
||||
}
|
||||
|
||||
void RichText::PickFooter(pick_ RichText& txt)
|
||||
{
|
||||
txt.ClearFooter();
|
||||
footer.Create() = txt;
|
||||
}
|
||||
|
||||
void RichText::SetHeaderQtf(const char *qtf)
|
||||
{
|
||||
header.Clear();
|
||||
if(qtf)
|
||||
PickHeader(ParseQTF(qtf));
|
||||
}
|
||||
|
||||
void RichText::SetFooterQtf(const char *qtf)
|
||||
{
|
||||
if(qtf)
|
||||
PickFooter(ParseQTF(qtf));
|
||||
}
|
||||
|
||||
String RichText::GetHeaderQtf(byte charset, dword options) const
|
||||
{
|
||||
return header ? AsQTF(*header, charset, options) : String();
|
||||
}
|
||||
|
||||
String RichText::GetFooterQtf(byte charset, dword options) const
|
||||
{
|
||||
return footer ? AsQTF(*footer, charset, options) : String();
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
@ -227,6 +227,7 @@ struct RichPara {
|
|||
|
||||
static const VectorMap<Id, FieldType *>& fieldtype();
|
||||
static void Register(Id id, FieldType& ft) init_;
|
||||
template <class T> static void Register(Id id) init_ { static T x; Register(id, x); }
|
||||
|
||||
int64 cacheid;
|
||||
bool incache;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ class RichQtfParser {
|
|||
int GetNumber();
|
||||
int ReadNumber();
|
||||
String GetText(int delim);
|
||||
String GetText2(int delim1, int delim2);
|
||||
Color GetColor();
|
||||
void Number2(int& a, int& b);
|
||||
|
||||
|
|
@ -156,6 +157,25 @@ String RichQtfParser::GetText(int delim) {
|
|||
}
|
||||
}
|
||||
|
||||
String RichQtfParser::GetText2(int delim1, int delim2) {
|
||||
String s;
|
||||
for(;;) {
|
||||
if(*term == '\0') return s;
|
||||
if(*term == '`') {
|
||||
term++;
|
||||
if(*term == '\0') return s;
|
||||
s.Cat(*term++);
|
||||
}
|
||||
else
|
||||
if(term[0] == delim1 && term[1] == delim2) {
|
||||
term += 2;
|
||||
return s;
|
||||
}
|
||||
else
|
||||
s.Cat(*term++);
|
||||
}
|
||||
}
|
||||
|
||||
int RichQtfParser::ReadNumber()
|
||||
{
|
||||
if(!IsDigit(*term))
|
||||
|
|
@ -825,6 +845,12 @@ void RichQtfParser::Parse(const char *qtf, int _accesskey)
|
|||
SetFormat();
|
||||
}
|
||||
else
|
||||
if(Key2('^', 'H'))
|
||||
target.SetHeaderQtf(GetText2('^', '^'));
|
||||
else
|
||||
if(Key2('^', 'F'))
|
||||
target.SetFooterQtf(GetText2('^', '^'));
|
||||
else
|
||||
if(Key2('{', ':')) {
|
||||
Flush();
|
||||
String field = GetText(':');
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ struct PaintInfo {
|
|||
int highlightpara;
|
||||
Color highlight;
|
||||
bool coloroverride;
|
||||
void *context;
|
||||
void *context;
|
||||
bool showlabels;
|
||||
bool shrink_oversized_objects;
|
||||
|
||||
|
|
@ -369,6 +369,17 @@ struct RichContext {
|
|||
|
||||
struct RichCellPos;
|
||||
|
||||
enum {
|
||||
QTF_BODY = 1,
|
||||
QTF_ALL_STYLES = 2,
|
||||
QTF_NOSTYLES = 4,
|
||||
QTF_CRLF = 8,
|
||||
QTF_NOCHARSET = 16,
|
||||
QTF_NOLANG = 32,
|
||||
|
||||
QTF_ALL = 0xffffffff
|
||||
};
|
||||
|
||||
#include "Txt.h"
|
||||
#include "Table.h"
|
||||
#include "Text.h"
|
||||
|
|
@ -414,16 +425,6 @@ RichText ParseQTF(const char *qtf, int accesskey = 0, void *context = NULL);
|
|||
|
||||
RichText AsRichText(const wchar *s, const RichPara::Format& f = RichPara::Format());
|
||||
|
||||
enum
|
||||
{
|
||||
QTF_BODY = 1,
|
||||
QTF_ALL_STYLES = 2,
|
||||
QTF_NOSTYLES = 4,
|
||||
QTF_CRLF = 8,
|
||||
QTF_NOCHARSET = 16,
|
||||
QTF_NOLANG = 32,
|
||||
};
|
||||
|
||||
String AsQTF(const RichText& doc, byte charset = CHARSET_UTF8,
|
||||
dword options = QTF_BODY|QTF_ALL_STYLES|QTF_CRLF);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ file
|
|||
TableData.cpp,
|
||||
Text.h,
|
||||
TextPaint.cpp,
|
||||
HeaderFooter.cpp,
|
||||
TextStyle.cpp,
|
||||
TextData.cpp,
|
||||
TextTable.cpp,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,17 @@
|
|||
class RichText : public RichTxt, public DeepCopyOption<RichText> {
|
||||
RichStyles style;
|
||||
String footer; // ugly hack
|
||||
String footer_hack; // ugly hack
|
||||
|
||||
mutable One<RichText> header, footer;
|
||||
|
||||
bool nolinks;
|
||||
|
||||
void Init();
|
||||
|
||||
Rect GetPageMinusHeaderFooter(const Rect& page) const;
|
||||
void PaintHeaderFooter(PageDraw& pw, const Rect& page, const PaintInfo& pi,
|
||||
int from_page, int to_page, int page_count) const;
|
||||
|
||||
struct StyleChangeOp;
|
||||
struct SetStylesOp;
|
||||
struct RemoveStyleOp;
|
||||
|
|
@ -123,10 +130,19 @@ public:
|
|||
};
|
||||
|
||||
static void Register(ClipboardType& type);
|
||||
|
||||
void PickHeader(pick_ RichText& txt);
|
||||
void PickFooter(pick_ RichText& txt);
|
||||
void SetHeaderQtf(const char *qtf);
|
||||
void SetFooterQtf(const char *qtf);
|
||||
void ClearHeader() { header.Clear(); }
|
||||
void ClearFooter() { footer.Clear(); }
|
||||
String GetHeaderQtf(byte charset = CHARSET_UTF8, dword options = QTF_ALL) const;
|
||||
String GetFooterQtf(byte charset = CHARSET_UTF8, dword options = QTF_ALL) const;
|
||||
|
||||
//Ugly hacks
|
||||
void SetFooter(const String& s) { footer = s; }
|
||||
String GetFooter() const { return footer; }
|
||||
void SetFooter(const String& s) { footer_hack = s; }
|
||||
String GetFooter() const { return footer_hack; }
|
||||
void PrintNoLinks(bool b = true) { nolinks = b; }
|
||||
bool IsPrintNoLinks() const { return nolinks; }
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ NAMESPACE_UPP
|
|||
RichContext RichText::Context(const Rect& page) const
|
||||
{
|
||||
RichContext c(style);
|
||||
c.page = page;
|
||||
c.py = PageY(0, page.top);
|
||||
c.page = GetPageMinusHeaderFooter(page);
|
||||
c.py = PageY(0, c.page.top);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
@ -30,13 +30,20 @@ int RichText::GetWidth() const
|
|||
void RichText::Paint(PageDraw& w, PageY py, const Rect& page, const PaintInfo& pi) const
|
||||
{
|
||||
RichContext ctx = Context(page);
|
||||
int from_page = py.page;
|
||||
if(py.y < ctx.page.top)
|
||||
py.y = ctx.page.top;
|
||||
ctx.py = py;
|
||||
RichTxt::Paint(w, ctx, pi);
|
||||
PaintHeaderFooter(w, page, pi, from_page, ctx.py.page, 9999);
|
||||
}
|
||||
|
||||
void RichText::Paint(PageDraw& w, const Rect& page, const PaintInfo& pi) const
|
||||
{
|
||||
RichTxt::Paint(w, Context(page), pi);
|
||||
RichContext ctx = Context(page);
|
||||
int from_page = ctx.py.page;
|
||||
RichTxt::Paint(w, ctx, pi);
|
||||
PaintHeaderFooter(w, page, pi, from_page, ctx.py.page, 9999);
|
||||
}
|
||||
|
||||
RichCaret RichText::GetCaret(int pos, const Rect& page) const
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ protected:
|
|||
PageY GetTop(RichContext rc) const;
|
||||
PageY GetHeight(RichContext rc) const;
|
||||
int GetWidth(const RichStyles& st) const;
|
||||
void Paint(PageDraw& w, RichContext rc, const PaintInfo& pi) const;
|
||||
void Paint(PageDraw& w, RichContext& rc, const PaintInfo& pi) const;
|
||||
RichCaret GetCaret(int pos, RichContext rc) const;
|
||||
int GetPos(int x, PageY y, RichContext rc) const;
|
||||
int GetVertMove(int pos, int gx, RichContext rc, int dir) const;
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ bool IsPainting(PageDraw& pw, Zoom z, const Rect& page, PageY top, PageY bottom)
|
|||
}
|
||||
|
||||
|
||||
void RichTxt::Paint(PageDraw& pw, RichContext rc, const PaintInfo& _pi) const
|
||||
void RichTxt::Paint(PageDraw& pw, RichContext& rc, const PaintInfo& _pi) const
|
||||
{
|
||||
PaintInfo pi = _pi;
|
||||
int parti = 0;
|
||||
|
|
|
|||
|
|
@ -169,13 +169,12 @@ Array<Drawing> RenderPages(const RichText& txt, Size pagesize)
|
|||
{
|
||||
DrawingPageDraw__ pd;
|
||||
pd.size = pagesize;
|
||||
PageY py(0, 0);
|
||||
PaintInfo paintinfo;
|
||||
paintinfo.top = PageY(0, 0);
|
||||
paintinfo.bottom = PageY(INT_MAX, INT_MAX);
|
||||
paintinfo.indexentry = Null;
|
||||
paintinfo.hyperlink = Null;
|
||||
txt.Paint(pd, PageY(0, 0), pagesize, paintinfo);
|
||||
txt.Paint(pd, pagesize, paintinfo);
|
||||
pd.Flush();
|
||||
return pd.page;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,8 +407,8 @@ code. Example: [*C@3 `"`[l200;4 `"]]
|
|||
[s0; Paragraph styles are defined using normal character/paragraph
|
||||
formatting sequence with&]
|
||||
[s0; &]
|
||||
[s0; [@(128.0.255) `$`$][@(0.0.255) number][@(128.0.255) ,][@(0.0.255) nnumber][@(128.0.255) #][@(0.0.255) u
|
||||
uid][@(128.0.255) :][@(0.0.255) name]&]
|
||||
[s0; [@(128.0.255) `$`$][/@(0.0.255) number][@(128.0.255) ,][/@(0.0.255) nnumber][@(128.0.255) #
|
||||
][/@(0.0.255) uuid][@(128.0.255) :][/@(0.0.255) name]&]
|
||||
[s0; &]
|
||||
[s0; instead of text, where&]
|
||||
[s0; &]
|
||||
|
|
@ -437,12 +437,12 @@ paragraph format command code.]}}&]
|
|||
[s0; Object plays the role of the single character and is displayed
|
||||
according to its type. It is started with a header in the form&]
|
||||
[s0; &]
|
||||
[s0; [@(128.0.255) `@`@][@(0.0.255) format][@(128.0.255) :][@(0.0.255) cx][@(128.0.255) `&][@(0.0.255) c
|
||||
[s0; [@(128.0.255) `@`@][/@(0.0.255) format][@(128.0.255) :][/@(0.0.255) cx][@(128.0.255) `&][/@(0.0.255) c
|
||||
y]&]
|
||||
[s0;@(0.0.255) &]
|
||||
[s0;%- or&]
|
||||
[s0;%- &]
|
||||
[s0; [@(128.0.255) `@`@][@(0.0.255) format][@(128.0.255) :][@(0.0.255) cx][@(128.0.255) `*][@(0.0.255) c
|
||||
[s0; [@(128.0.255) `@`@][/@(0.0.255) format][@(128.0.255) :][/@(0.0.255) cx][@(128.0.255) `*][/@(0.0.255) c
|
||||
y]&]
|
||||
[s0;%- &]
|
||||
[s0;%- where&]
|
||||
|
|
@ -487,7 +487,32 @@ mage`_name]. Example of full object definition in [*/ iml] format:&]
|
|||
[s0; [*C@3 `"`@`@iml:400`*400``CtrlImg:exclamation```"]&]
|
||||
[s0;@(0.0.255) &]
|
||||
[s0;@(0.0.255) &]
|
||||
[s2; Fields&]
|
||||
[s0;@(0.0.255) &]
|
||||
[s0; Fields are special elements of text that are evaluated by client
|
||||
code into rich text. QTF format for fields is&]
|
||||
[s0;@(0.0.255) &]
|
||||
[s0; [@(128.0.255) `{:][/@(0.0.255) field`_type`_id][@(128.0.255) :][/@(0.0.255) parameter][@(128.0.255) :
|
||||
`}]&]
|
||||
[s0;@(128.0.255) &]
|
||||
[ {{1879:8121^ [s0; [@(0.0.255) field`_type`_id]]
|
||||
:: [s0; Type of field. Field types are represented by RichPara`::FieldType
|
||||
derived instances and registred using RichPara`::Register function.]
|
||||
:: [s0; [@(0.0.255) parameter]]
|
||||
:: [s0; Additional string parameter that gets passed to FieldType`::Evaluate
|
||||
method]}}&]
|
||||
[s0;@(128.0.255) &]
|
||||
[s0;@(0.0.255) &]
|
||||
[s2; Header and Footer&]
|
||||
[s0; &]
|
||||
[s0; Gloval text header is defined using [%-C@(128.0.255) `^H][%-/C@(0.0.255) qtf`_text][%-C@(128.0.255) `^
|
||||
`^], footer [%-C@(128.0.255) `^F][%-/C@(0.0.255) qtf`_text][%-C@(128.0.255) `^`^],
|
||||
where [%-C@(128.0.255) H][%-/C@(0.0.255) qtf`_text] is complete embeded
|
||||
QTF representing header/footer. This QTF can contain field[@5
|
||||
`{:VALUE:PAGENUMBER:`} ]to represent page number and[@5 `{:VALUE:PAGECOUNT:`}]
|
||||
to represent total number of pages.&]
|
||||
[s0;3 &]
|
||||
[s0;3 &]
|
||||
[s2; Tables&]
|
||||
[s0; &]
|
||||
[s0; Table definition starts with&]
|
||||
|
|
@ -600,6 +625,17 @@ as table start/stop and [@(128.0.255) `|`| `-`-] to divide cells/lines.
|
|||
&]
|
||||
[s0;3 &]
|
||||
[s0;3 &]
|
||||
[s2; Header and Footer&]
|
||||
[s0; &]
|
||||
[s0; Gloval text header is defined using [%-C@(128.0.255) `^H][%-/C@(0.0.255) qtf`_text][%-C@(128.0.255) `^
|
||||
`^], footer [%-C@(128.0.255) `^F][%-/C@(0.0.255) qtf`_text][%-C@(128.0.255) `^`^],
|
||||
where [%-C@(128.0.255) H][%-/C@(0.0.255) qtf`_text] is complete embeded
|
||||
QTF representing header/footer. This QTF can contain field[@5
|
||||
`{:VALUE:PAGENUMBER:`} ]to represent page number and[@5 `{:VALUE:PAGECOUNT:`}]
|
||||
to represent total number of pages.&]
|
||||
[s0;3 &]
|
||||
[s0;3 &]
|
||||
[s0;3 &]
|
||||
[s2; [3 Examples]&]
|
||||
[s0; &]
|
||||
[ {{10000 [s0; [*C@3;1 `"Normal `[`* bold`] `[/ italic`] `[`_ underline`] `[``
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue