Changeset View
Changeset View
Standalone View
Standalone View
src/worksheet.cpp
Show All 31 Lines | |||||
32 | #include <KFontAction> | 32 | #include <KFontAction> | ||
33 | #include <KFontSizeAction> | 33 | #include <KFontSizeAction> | ||
34 | #include <KToggleAction> | 34 | #include <KToggleAction> | ||
35 | 35 | | |||
36 | #include "worksheet.h" | 36 | #include "worksheet.h" | ||
37 | #include "settings.h" | 37 | #include "settings.h" | ||
38 | #include "commandentry.h" | 38 | #include "commandentry.h" | ||
39 | #include "textentry.h" | 39 | #include "textentry.h" | ||
40 | #include "markdownentry.h" | ||||
40 | #include "latexentry.h" | 41 | #include "latexentry.h" | ||
41 | #include "imageentry.h" | 42 | #include "imageentry.h" | ||
42 | #include "pagebreakentry.h" | 43 | #include "pagebreakentry.h" | ||
43 | #include "placeholderentry.h" | 44 | #include "placeholderentry.h" | ||
44 | #include "lib/backend.h" | 45 | #include "lib/backend.h" | ||
45 | #include "lib/extension.h" | 46 | #include "lib/extension.h" | ||
46 | #include "lib/helpresult.h" | 47 | #include "lib/helpresult.h" | ||
47 | #include "lib/session.h" | 48 | #include "lib/session.h" | ||
▲ Show 20 Lines • Show All 491 Lines • ▼ Show 20 Line(s) | 539 | { | |||
539 | return appendEntry(CommandEntry::Type); | 540 | return appendEntry(CommandEntry::Type); | ||
540 | } | 541 | } | ||
541 | 542 | | |||
542 | WorksheetEntry* Worksheet::appendTextEntry() | 543 | WorksheetEntry* Worksheet::appendTextEntry() | ||
543 | { | 544 | { | ||
544 | return appendEntry(TextEntry::Type); | 545 | return appendEntry(TextEntry::Type); | ||
545 | } | 546 | } | ||
546 | 547 | | |||
548 | WorksheetEntry* Worksheet::appendMarkdownEntry() | ||||
549 | { | ||||
550 | return appendEntry(MarkdownEntry::Type); | ||||
551 | } | ||||
547 | 552 | | |||
548 | WorksheetEntry* Worksheet::appendPageBreakEntry() | 553 | WorksheetEntry* Worksheet::appendPageBreakEntry() | ||
549 | { | 554 | { | ||
550 | return appendEntry(PageBreakEntry::Type); | 555 | return appendEntry(PageBreakEntry::Type); | ||
551 | } | 556 | } | ||
552 | 557 | | |||
553 | WorksheetEntry* Worksheet::appendImageEntry() | 558 | WorksheetEntry* Worksheet::appendImageEntry() | ||
554 | { | 559 | { | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 585 | { | |||
607 | return entry; | 612 | return entry; | ||
608 | } | 613 | } | ||
609 | 614 | | |||
610 | WorksheetEntry* Worksheet::insertTextEntry(WorksheetEntry* current) | 615 | WorksheetEntry* Worksheet::insertTextEntry(WorksheetEntry* current) | ||
611 | { | 616 | { | ||
612 | return insertEntry(TextEntry::Type, current); | 617 | return insertEntry(TextEntry::Type, current); | ||
613 | } | 618 | } | ||
614 | 619 | | |||
620 | WorksheetEntry* Worksheet::insertMarkdownEntry(WorksheetEntry* current) | ||||
621 | { | ||||
622 | return insertEntry(MarkdownEntry::Type, current); | ||||
623 | } | ||||
624 | | ||||
615 | WorksheetEntry* Worksheet::insertCommandEntry(WorksheetEntry* current) | 625 | WorksheetEntry* Worksheet::insertCommandEntry(WorksheetEntry* current) | ||
616 | { | 626 | { | ||
617 | return insertEntry(CommandEntry::Type, current); | 627 | return insertEntry(CommandEntry::Type, current); | ||
618 | } | 628 | } | ||
619 | 629 | | |||
620 | WorksheetEntry* Worksheet::insertImageEntry(WorksheetEntry* current) | 630 | WorksheetEntry* Worksheet::insertImageEntry(WorksheetEntry* current) | ||
621 | { | 631 | { | ||
622 | return insertEntry(ImageEntry::Type, current); | 632 | return insertEntry(ImageEntry::Type, current); | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 656 | { | |||
670 | return entry; | 680 | return entry; | ||
671 | } | 681 | } | ||
672 | 682 | | |||
673 | WorksheetEntry* Worksheet::insertTextEntryBefore(WorksheetEntry* current) | 683 | WorksheetEntry* Worksheet::insertTextEntryBefore(WorksheetEntry* current) | ||
674 | { | 684 | { | ||
675 | return insertEntryBefore(TextEntry::Type, current); | 685 | return insertEntryBefore(TextEntry::Type, current); | ||
676 | } | 686 | } | ||
677 | 687 | | |||
688 | WorksheetEntry* Worksheet::insertMarkdownEntryBefore(WorksheetEntry* current) | ||||
689 | { | ||||
690 | return insertEntryBefore(MarkdownEntry::Type, current); | ||||
691 | } | ||||
692 | | ||||
678 | WorksheetEntry* Worksheet::insertCommandEntryBefore(WorksheetEntry* current) | 693 | WorksheetEntry* Worksheet::insertCommandEntryBefore(WorksheetEntry* current) | ||
679 | { | 694 | { | ||
680 | return insertEntryBefore(CommandEntry::Type, current); | 695 | return insertEntryBefore(CommandEntry::Type, current); | ||
681 | } | 696 | } | ||
682 | 697 | | |||
683 | WorksheetEntry* Worksheet::insertPageBreakEntryBefore(WorksheetEntry* current) | 698 | WorksheetEntry* Worksheet::insertPageBreakEntryBefore(WorksheetEntry* current) | ||
684 | { | 699 | { | ||
685 | return insertEntryBefore(PageBreakEntry::Type, current); | 700 | return insertEntryBefore(PageBreakEntry::Type, current); | ||
▲ Show 20 Lines • Show All 382 Lines • ▼ Show 20 Line(s) | 1081 | while (!expressionChild.isNull()) { | |||
1068 | if (tag == QLatin1String("Expression")) | 1083 | if (tag == QLatin1String("Expression")) | ||
1069 | { | 1084 | { | ||
1070 | entry = appendCommandEntry(); | 1085 | entry = appendCommandEntry(); | ||
1071 | entry->setContent(expressionChild, file); | 1086 | entry->setContent(expressionChild, file); | ||
1072 | } else if (tag == QLatin1String("Text")) | 1087 | } else if (tag == QLatin1String("Text")) | ||
1073 | { | 1088 | { | ||
1074 | entry = appendTextEntry(); | 1089 | entry = appendTextEntry(); | ||
1075 | entry->setContent(expressionChild, file); | 1090 | entry->setContent(expressionChild, file); | ||
1091 | } else if (tag == QLatin1String("Markdown")) | ||||
1092 | { | ||||
1093 | entry = appendMarkdownEntry(); | ||||
1094 | entry->setContent(expressionChild, file); | ||||
1076 | } else if (tag == QLatin1String("Latex")) | 1095 | } else if (tag == QLatin1String("Latex")) | ||
1077 | { | 1096 | { | ||
1078 | entry = appendLatexEntry(); | 1097 | entry = appendLatexEntry(); | ||
1079 | entry->setContent(expressionChild, file); | 1098 | entry->setContent(expressionChild, file); | ||
1080 | } else if (tag == QLatin1String("PageBreak")) | 1099 | } else if (tag == QLatin1String("PageBreak")) | ||
1081 | { | 1100 | { | ||
1082 | entry = appendPageBreakEntry(); | 1101 | entry = appendPageBreakEntry(); | ||
1083 | entry->setContent(expressionChild, file); | 1102 | entry->setContent(expressionChild, file); | ||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | 1169 | { | |||
1165 | menu->addSeparator(); | 1184 | menu->addSeparator(); | ||
1166 | 1185 | | |||
1167 | if (entry) { | 1186 | if (entry) { | ||
1168 | QMenu* insert = new QMenu(menu); | 1187 | QMenu* insert = new QMenu(menu); | ||
1169 | QMenu* insertBefore = new QMenu(menu); | 1188 | QMenu* insertBefore = new QMenu(menu); | ||
1170 | 1189 | | |||
1171 | insert->addAction(i18n("Command Entry"), entry, SLOT(insertCommandEntry())); | 1190 | insert->addAction(i18n("Command Entry"), entry, SLOT(insertCommandEntry())); | ||
1172 | insert->addAction(i18n("Text Entry"), entry, SLOT(insertTextEntry())); | 1191 | insert->addAction(i18n("Text Entry"), entry, SLOT(insertTextEntry())); | ||
1192 | insert->addAction(i18n("Markdown Entry"), entry, SLOT(insertMarkdownEntry())); | ||||
1173 | insert->addAction(i18n("LaTeX Entry"), entry, SLOT(insertLatexEntry())); | 1193 | insert->addAction(i18n("LaTeX Entry"), entry, SLOT(insertLatexEntry())); | ||
1174 | insert->addAction(i18n("Image"), entry, SLOT(insertImageEntry())); | 1194 | insert->addAction(i18n("Image"), entry, SLOT(insertImageEntry())); | ||
1175 | insert->addAction(i18n("Page Break"), entry, SLOT(insertPageBreakEntry())); | 1195 | insert->addAction(i18n("Page Break"), entry, SLOT(insertPageBreakEntry())); | ||
1176 | 1196 | | |||
1177 | insertBefore->addAction(i18n("Command Entry"), entry, SLOT(insertCommandEntryBefore())); | 1197 | insertBefore->addAction(i18n("Command Entry"), entry, SLOT(insertCommandEntryBefore())); | ||
1178 | insertBefore->addAction(i18n("Text Entry"), entry, SLOT(insertTextEntryBefore())); | 1198 | insertBefore->addAction(i18n("Text Entry"), entry, SLOT(insertTextEntryBefore())); | ||
1199 | insertBefore->addAction(i18n("Markdown Entry"), entry, SLOT(insertMarkdownEntryBefore())); | ||||
1179 | insertBefore->addAction(i18n("LaTeX Entry"), entry, SLOT(insertLatexEntryBefore())); | 1200 | insertBefore->addAction(i18n("LaTeX Entry"), entry, SLOT(insertLatexEntryBefore())); | ||
1180 | insertBefore->addAction(i18n("Image"), entry, SLOT(insertImageEntryBefore())); | 1201 | insertBefore->addAction(i18n("Image"), entry, SLOT(insertImageEntryBefore())); | ||
1181 | insertBefore->addAction(i18n("Page Break"), entry, SLOT(insertPageBreakEntryBefore())); | 1202 | insertBefore->addAction(i18n("Page Break"), entry, SLOT(insertPageBreakEntryBefore())); | ||
1182 | 1203 | | |||
1183 | insert->setTitle(i18n("Insert")); | 1204 | insert->setTitle(i18n("Insert")); | ||
1184 | insertBefore->setTitle(i18n("Insert Before")); | 1205 | insertBefore->setTitle(i18n("Insert Before")); | ||
1185 | menu->addMenu(insert); | 1206 | menu->addMenu(insert); | ||
1186 | menu->addMenu(insertBefore); | 1207 | menu->addMenu(insertBefore); | ||
1187 | } else { | 1208 | } else { | ||
1188 | menu->addAction(i18n("Insert Command Entry"), this, SLOT(appendCommandEntry())); | 1209 | menu->addAction(i18n("Insert Command Entry"), this, SLOT(appendCommandEntry())); | ||
1189 | menu->addAction(i18n("Insert Text Entry"), this, SLOT(appendTextEntry())); | 1210 | menu->addAction(i18n("Insert Text Entry"), this, SLOT(appendTextEntry())); | ||
1211 | menu->addAction(i18n("Insert Markdown Entry"), this, SLOT(appendMarkdownEntry())); | ||||
1190 | menu->addAction(i18n("Insert LaTeX Entry"), this, SLOT(appendLatexEntry())); | 1212 | menu->addAction(i18n("Insert LaTeX Entry"), this, SLOT(appendLatexEntry())); | ||
1191 | menu->addAction(i18n("Insert Image"), this, SLOT(appendImageEntry())); | 1213 | menu->addAction(i18n("Insert Image"), this, SLOT(appendImageEntry())); | ||
1192 | menu->addAction(i18n("Insert Page Break"), this, SLOT(appendPageBreakEntry())); | 1214 | menu->addAction(i18n("Insert Page Break"), this, SLOT(appendPageBreakEntry())); | ||
1193 | } | 1215 | } | ||
1194 | } | 1216 | } | ||
1195 | 1217 | | |||
1196 | void Worksheet::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) | 1218 | void Worksheet::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) | ||
1197 | { | 1219 | { | ||
▲ Show 20 Lines • Show All 640 Lines • Show Last 20 Lines |