Changeset View
Changeset View
Standalone View
Standalone View
components/impl/TextDocumentImpl.cpp
Show All 33 Lines | |||||
34 | #include <KoShapeContainer.h> | 34 | #include <KoShapeContainer.h> | ||
35 | #include <KoToolManager.h> | 35 | #include <KoToolManager.h> | ||
36 | #include <KoZoomController.h> | 36 | #include <KoZoomController.h> | ||
37 | #include <KoZoomHandler.h> | 37 | #include <KoZoomHandler.h> | ||
38 | 38 | | |||
39 | #include <QTextDocument> | 39 | #include <QTextDocument> | ||
40 | #include <QTextFrame> | 40 | #include <QTextFrame> | ||
41 | #include <QTextLayout> | 41 | #include <QTextLayout> | ||
42 | #include <QDebug> | ||||
43 | #include <QPointer> | ||||
42 | 44 | | |||
43 | #include "ComponentsKoCanvasController.h" | 45 | #include "ComponentsKoCanvasController.h" | ||
44 | #include <libs/textlayout/KoTextShapeData.h> | 46 | #include <libs/textlayout/KoTextShapeData.h> | ||
45 | 47 | | |||
46 | using namespace Calligra::Components; | 48 | using namespace Calligra::Components; | ||
47 | 49 | | |||
48 | class TextDocumentImpl::Private | 50 | class TextDocumentImpl::Private | ||
49 | { | 51 | { | ||
50 | public: | 52 | public: | ||
51 | Private() : part{nullptr}, document{nullptr} | 53 | Private() : part{nullptr}, document{nullptr} | ||
52 | { } | 54 | { } | ||
53 | 55 | | |||
54 | KWPart* part; | 56 | QPointer<KWPart> part; | ||
55 | KWDocument* document; | 57 | QPointer<KWDocument> document; | ||
56 | KWCanvasItem* canvas; | 58 | QPointer<KWCanvasItem> canvas; | ||
57 | QTimer indexChangedDelay; | 59 | QTimer indexChangedDelay; | ||
58 | 60 | | |||
59 | QList< QPair< QRectF, QUrl > > links; | 61 | QList< QPair< QRectF, QUrl > > links; | ||
60 | 62 | | |||
61 | QList<KoShape*> deepShapeFind(QList<KoShape*> shapes) | 63 | QList<KoShape*> deepShapeFind(QList<KoShape*> shapes) | ||
62 | { | 64 | { | ||
63 | QList<KoShape*> allShapes; | 65 | QList<KoShape*> allShapes; | ||
64 | foreach(KoShape* shape, shapes) { | 66 | foreach(KoShape* shape, shapes) { | ||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Line(s) | 174 | { | |||
179 | d->document = new KWDocument{d->part}; | 181 | d->document = new KWDocument{d->part}; | ||
180 | setKoDocument(d->document); | 182 | setKoDocument(d->document); | ||
181 | d->part->setDocument(d->document); | 183 | d->part->setDocument(d->document); | ||
182 | 184 | | |||
183 | d->document->setAutoSave(0); | 185 | d->document->setAutoSave(0); | ||
184 | d->document->setCheckAutoSaveFile(false); | 186 | d->document->setCheckAutoSaveFile(false); | ||
185 | 187 | | |||
186 | bool retval = d->document->openUrl(url); | 188 | bool retval = d->document->openUrl(url); | ||
189 | qDebug() << "Attempting to open" << url << "and our success was" << retval; | ||||
187 | 190 | | |||
188 | d->canvas = static_cast<KWCanvasItem*>(d->part->canvasItem(d->document)); | 191 | d->canvas = static_cast<KWCanvasItem*>(d->part->canvasItem(d->document)); | ||
189 | 192 | | |||
190 | createAndSetCanvasController(d->canvas); | 193 | createAndSetCanvasController(d->canvas); | ||
191 | createAndSetZoomController(d->canvas); | 194 | createAndSetZoomController(d->canvas); | ||
192 | zoomController()->setPageSize(d->document->pageManager()->begin().rect().size()); | 195 | zoomController()->setPageSize(d->document->pageManager()->begin().rect().size()); | ||
193 | connect(d->canvas, SIGNAL(documentSize(QSizeF)), zoomController(), SLOT(setDocumentSize(QSizeF))); | 196 | connect(d->canvas, SIGNAL(documentSize(QSizeF)), zoomController(), SLOT(setDocumentSize(QSizeF))); | ||
194 | 197 | | |||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |