~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kword/part/KWView.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* This file is part of the KDE project
2
2
 * Copyright (C) 2001 David Faure <faure@kde.org>
3
3
 * Copyright (C) 2005-2007, 2009, 2010 Thomas Zander <zander@kde.org>
 
4
 * Copyright (C) 2010 Boudewijn Rempt <boud@kogmbh.com>
4
5
 *
5
6
 * This library is free software; you can redistribute it and/or
6
7
 * modify it under the terms of the GNU Library General Public
27
28
#include <rdf/KoDocumentRdf.h>
28
29
#include <rdf/KoSemanticStylesheetsEditor.h>
29
30
#include "dockers/KWRdfDocker.h"
 
31
#include "dockers/KWRdfDockerFactory.h"
30
32
#endif
31
33
#include "KWCanvas.h"
32
34
#include "KWViewMode.h"
47
49
#include "dockers/KWStatisticsDocker.h"
48
50
#include "commands/KWFrameCreateCommand.h"
49
51
#include "commands/KWCreateOutlineCommand.h"
 
52
#include "commands/KWClipFrameCommand.h"
 
53
#include "commands/KWRemoveFrameClipCommand.h"
50
54
 
51
55
// koffice libs includes
 
56
#include <kofficeversion.h>
52
57
#include <KoCopyController.h>
53
58
#include <KoTextDocument.h>
54
59
#include <KoTextShapeData.h>
59
64
#include <KoStandardAction.h>
60
65
#include <KoPasteController.h>
61
66
#include <KoShape.h>
 
67
#include <KoTextOnShapeContainer.h>
62
68
#include <KoText.h>
63
69
#include <KoFind.h>
64
70
#include <KoShapeContainer.h>
70
76
#include <KoMainWindow.h>
71
77
#include <KoTextEditor.h>
72
78
#include <KoToolProxy.h>
73
 
#include <KoResourceManager.h>
74
79
#include <KoTextAnchor.h>
75
80
#include <KoShapeGroupCommand.h>
76
81
#include <KoZoomController.h>
81
86
 
82
87
// KDE + Qt includes
83
88
#include <QHBoxLayout>
84
 
#include <QMenu>
 
89
#include <KMenu>
85
90
#include <QTimer>
86
91
#include <klocale.h>
87
92
#include <kdebug.h>
96
101
 
97
102
static KWFrame *frameForShape(KoShape *shape)
98
103
{
99
 
    KoShape *parent = shape;
100
 
    while (parent->parent())
101
 
        parent = parent->parent();
102
 
    return dynamic_cast<KWFrame*>(parent->applicationData());
 
104
    while (shape) {
 
105
        KWFrame *answer = dynamic_cast<KWFrame*>(shape->applicationData());
 
106
        if (answer)
 
107
            return answer;
 
108
        if (shape->parent() == 0)
 
109
            break;
 
110
        shape = shape->parent();
 
111
    }
 
112
 
 
113
    KWFrame *answer = dynamic_cast<KWFrame*>(shape->applicationData());
 
114
    if (answer == 0) { // this may be a clipping shape containing the frame-shape
 
115
        KoShapeContainer *container = dynamic_cast<KoShapeContainer*>(shape);
 
116
        if (container && container->shapeCount() == 1) {
 
117
            answer = dynamic_cast<KWFrame*>(container->shapes()[0]->applicationData());
 
118
        }
 
119
    }
 
120
    return answer;
103
121
}
104
122
 
105
123
KWView::KWView(const QString &viewMode, KWDocument *document, QWidget *parent)
106
124
        : KoView(document, parent)
 
125
        , m_canvas(0), m_actionMenu(0)
107
126
{
108
127
    m_document = document;
109
128
    m_snapToGrid = m_document->gridData().snapToGrid();
132
151
        KWStatisticsDockerFactory statisticsFactory(this);
133
152
        KWStatisticsDocker *docker = dynamic_cast<KWStatisticsDocker *>(shell()->createDockWidget(&statisticsFactory));
134
153
        if (docker && docker->view() != this) docker->setView(this);
 
154
 
 
155
#ifdef SHOULD_BUILD_RDF
 
156
        KWRdfDockerFactory factory(this);
 
157
        shell()->createDockWidget(&factory);
 
158
#endif
135
159
    }
136
160
 
137
161
    if (statusBar())
159
183
 
160
184
KWView::~KWView()
161
185
{
 
186
    m_canvas = 0;
162
187
}
163
188
 
164
 
KWCanvas *KWView::kwcanvas() const
 
189
KoCanvasBase *KWView::canvasBase() const
165
190
{
166
191
    return m_canvas;
167
192
}
178
203
 
179
204
void KWView::updateReadWrite(bool readWrite)
180
205
{
 
206
    m_canvas->setReadWrite(readWrite);
 
207
    KoToolManager::instance()->updateReadWrite(m_gui->canvasController(), readWrite);
181
208
    m_actionFormatFrameSet->setEnabled(readWrite);
182
209
    m_actionInsertFrameBreak->setEnabled(readWrite);
183
210
    m_actionViewHeader->setEnabled(readWrite);
282
309
    actionCollection()->addAction("send_toback_frame", m_actionSendBackward);
283
310
    connect(m_actionSendBackward, SIGNAL(triggered()), this, SLOT(sendToBack()));
284
311
 
285
 
    KActionMenu *actionMenu = new KActionMenu(i18n("Variable"), this);
286
 
    foreach (QAction *action, m_document->inlineTextObjectManager()->createInsertVariableActions(kwcanvas()))
287
 
        actionMenu->addAction(action);
288
 
    actionCollection()->addAction("insert_variable", actionMenu);
 
312
    m_actionMenu = new KActionMenu(i18n("Variable"), this);
 
313
    foreach (QAction *action, m_document->inlineTextObjectManager()->createInsertVariableActions(canvasBase()))
 
314
        m_actionMenu->addAction(action);
 
315
    actionCollection()->addAction("insert_variable", m_actionMenu);
 
316
    connect(m_document->inlineTextObjectManager()->variableManager(), SIGNAL(valueChanged()), this, SLOT(variableChanged()));
289
317
 
290
318
#ifdef SHOULD_BUILD_RDF
291
319
    if (KoDocumentRdf* rdf = m_document->documentRdf()) {
292
 
        KAction* createRef = rdf->createInsertSemanticObjectReferenceAction(kwcanvas());
 
320
        KAction* createRef = rdf->createInsertSemanticObjectReferenceAction(canvasBase());
293
321
        actionCollection()->addAction("insert_semanticobject_ref", createRef);
294
322
        KActionMenu *subMenu = new KActionMenu(i18n("Create"), this);
295
323
        actionCollection()->addAction("insert_semanticobject_new", subMenu);
296
 
        foreach(KAction *action, rdf->createInsertSemanticObjectNewActions(kwcanvas())) {
 
324
        foreach(KAction *action, rdf->createInsertSemanticObjectNewActions(canvasBase())) {
297
325
            subMenu->addAction(action);
298
326
        }
299
327
    }
353
381
 
354
382
    // -------------- Edit actions
355
383
    action = actionCollection()->addAction(KStandardAction::Cut,  "edit_cut", 0, 0);
356
 
    new KoCutController(kwcanvas(), action);
 
384
    new KoCutController(canvasBase(), action);
357
385
    action = actionCollection()->addAction(KStandardAction::Copy,  "edit_copy", 0, 0);
358
 
    new KoCopyController(kwcanvas(), action);
 
386
    new KoCopyController(canvasBase(), action);
359
387
    action = actionCollection()->addAction(KStandardAction::Paste,  "edit_paste", 0, 0);
360
 
    new KoPasteController(kwcanvas(), action);
 
388
    new KoPasteController(canvasBase(), action);
361
389
 
362
390
    action  = new KAction(i18n("Statistics"), this);
363
391
    actionCollection()->addAction("file_statistics", action);
403
431
    action = new KAction(KIcon("edit-delete"), i18n("Delete"), this);
404
432
    action->setShortcut(QKeySequence("Del"));
405
433
    connect(action, SIGNAL(triggered()), this, SLOT(editDeleteSelection()));
406
 
    connect(kwcanvas()->toolProxy(), SIGNAL(selectionChanged(bool)), action, SLOT(setEnabled(bool)));
 
434
    connect(canvasBase()->toolProxy(), SIGNAL(selectionChanged(bool)), action, SLOT(setEnabled(bool)));
407
435
    actionCollection()->addAction("edit_delete", action);
408
436
 
409
437
    action = m_document->gridData().gridToggleAction(m_canvas);
419
447
    action->setWhatsThis(i18n("Create a copy of the current frame, that remains linked to it. This means they always show the same contents: modifying the contents in such a frame will update all its linked copies."));
420
448
    connect(action, SIGNAL(triggered()), this, SLOT(createLinkedFrame()));
421
449
 
422
 
    action = new KAction(i18n("Create custom outline"), this);
 
450
    action = new KAction(i18n("Create Custom Outline"), this);
423
451
    actionCollection()->addAction("create_custom_outline", action);
424
452
    action->setToolTip(i18n("Create a custom vector outline that text will run around"));
425
453
    action->setWhatsThis(i18n("Text normally runs around the content of a shape, when you want a custom outline that is independent of the content you can create one and alter it with the vector tools"));
426
454
    connect(action, SIGNAL(triggered()), this, SLOT(createCustomOutline()));
427
455
 
428
 
 
429
 
    //------------------------ Settings menu
430
 
    action = new KToggleAction(i18n("Status Bar"), this);
431
 
    action->setToolTip(i18n("Shows or hides the status bar"));
432
 
    actionCollection()->addAction("showStatusBar", action);
433
 
    connect(action, SIGNAL(toggled(bool)), this, SLOT(showStatusBar(bool)));
 
456
    action = new KAction(i18n("Create Frame-clip"), this);
 
457
    actionCollection()->addAction("create_clipped_frame", action);
 
458
    connect(action, SIGNAL(triggered()), this, SLOT(createFrameClipping()));
 
459
 
 
460
    action = new KAction(i18n("Remove Frame-clip"), this);
 
461
    actionCollection()->addAction("remove_clipped_frame", action);
 
462
    connect(action, SIGNAL(triggered()), this, SLOT(removeFrameClipping()));
 
463
 
 
464
    action = new KAction(i18n("Add Text on Shape"), this);
 
465
    actionCollection()->addAction("add_text_on_shape", action);
 
466
    connect(action, SIGNAL(triggered()), this, SLOT(createTextOnShape()));
 
467
 
 
468
    KToggleAction *tAction = new KToggleAction(i18n("Show Status Bar"), this);
 
469
    tAction->setCheckedState(KGuiItem(i18n("Hide Status Bar")));
 
470
    tAction->setToolTip(i18n("Shows or hides the status bar"));
 
471
    actionCollection()->addAction("showStatusBar", tAction);
 
472
    connect(tAction, SIGNAL(toggled(bool)), this, SLOT(showStatusBar(bool)));
434
473
 
435
474
    // -------------- Insert menu
436
475
    /* ********** From old kwview ****
896
935
QList<KWFrame*> KWView::selectedFrames() const
897
936
{
898
937
    QList<KWFrame*> frames;
899
 
    foreach (KoShape *shape, kwcanvas()->shapeManager()->selection()->selectedShapes()) {
 
938
    foreach (KoShape *shape, canvasBase()->shapeManager()->selection()->selectedShapes()) {
900
939
        KWFrame *frame = frameForShape(shape);
901
940
        Q_ASSERT(frame);
902
941
        frames.append(frame);
914
953
 
915
954
KoPrintJob *KWView::createPrintJob()
916
955
{
917
 
    KWPrintingDialog *dia = new KWPrintingDialog(this);
 
956
    KWPrintingDialog *dia = new KWPrintingDialog(m_document, m_canvas->shapeManager(), this);
918
957
    dia->printer().setResolution(600);
919
 
    dia->printer().setCreator("KWord 2.2");
 
958
    dia->printer().setCreator(QString("KWord %1.%2.$3").arg(KOffice::versionMajor(),
 
959
        KOffice::versionMinor(), KOffice::versionRelease()));
920
960
    dia->printer().setFullPage(true); // ignore printer margins
921
961
    return dia;
922
962
}
923
963
 
924
964
void KWView::insertFrameBreak()
925
965
{
926
 
    KoTextEditor *handler = qobject_cast<KoTextEditor*> (kwcanvas()->toolProxy()->selection());
 
966
    KoTextEditor *handler = qobject_cast<KoTextEditor*> (canvasBase()->toolProxy()->selection());
927
967
    if (handler) {
928
968
        // this means we have the text tool selected right now.
929
969
        handler->insertFrameBreak();
937
977
{
938
978
    QString name, suggestedName;
939
979
 
940
 
    KoSelection *selection = kwcanvas()->shapeManager()->selection();
 
980
    KoSelection *selection = canvasBase()->shapeManager()->selection();
941
981
    KoShape *shape = 0;
942
982
    shape = selection->firstSelectedShape();
943
983
    if (shape == 0) return; // no shape selected
949
989
 
950
990
    QString tool = KoToolManager::instance()->preferredToolForSelection(selection->selectedShapes());
951
991
    KoToolManager::instance()->switchToolRequested(tool);
952
 
    KoTextEditor *handler = qobject_cast<KoTextEditor*> (kwcanvas()->toolProxy()->selection());
 
992
    KoTextEditor *handler = qobject_cast<KoTextEditor*> (canvasBase()->toolProxy()->selection());
953
993
    Q_ASSERT(handler);
954
994
 
955
995
    KoBookmarkManager *manager = m_document->inlineTextObjectManager()->bookmarkManager();
988
1028
 
989
1029
    KoBookmark *bookmark = manager->retrieveBookmark(name);
990
1030
    KoShape *shape = bookmark->shape();
991
 
    KoSelection *selection = kwcanvas()->shapeManager()->selection();
 
1031
    KoSelection *selection = canvasBase()->shapeManager()->selection();
992
1032
    selection->deselectAll();
993
1033
    selection->select(shape);
994
1034
 
1027
1067
void KWView::editDeleteFrame()
1028
1068
{
1029
1069
    QList<KoShape*> frames;
1030
 
    foreach (KoShape *shape, kwcanvas()->shapeManager()->selection()->selectedShapes(KoFlake::TopLevelSelection)) {
 
1070
    foreach (KoShape *shape, canvasBase()->shapeManager()->selection()->selectedShapes(KoFlake::TopLevelSelection)) {
1031
1071
        KWFrame *frame = frameForShape(shape);
1032
1072
        if (frame) {
1033
1073
            KWTextFrameSet *fs = dynamic_cast<KWTextFrameSet*>(frame->frameSet());
1036
1076
        }
1037
1077
        frames.append(shape);
1038
1078
    }
1039
 
    QUndoCommand *cmd = kwcanvas()->shapeController()->removeShapes(frames);
 
1079
    QUndoCommand *cmd = canvasBase()->shapeController()->removeShapes(frames);
1040
1080
    m_document->addCommand(cmd);
1041
1081
}
1042
1082
 
1067
1107
void KWView::adjustZOrderOfSelectedFrames(KoShapeReorderCommand::MoveShapeType direction)
1068
1108
{
1069
1109
    // TODO we should not allow any shapes to fall behind the main text frame.
1070
 
    QUndoCommand *cmd = KoShapeReorderCommand::createCommand(kwcanvas()->shapeManager()->selection()->selectedShapes(),
1071
 
                        kwcanvas()->shapeManager(), direction);
 
1110
    QUndoCommand *cmd = KoShapeReorderCommand::createCommand(canvasBase()->shapeManager()->selection()->selectedShapes(),
 
1111
                        canvasBase()->shapeManager(), direction);
1072
1112
    if (cmd)
1073
1113
        m_document->addCommand(cmd);
1074
1114
}
1075
1115
 
1076
1116
void KWView::toggleViewFrameBorders(bool on)
1077
1117
{
1078
 
    kwcanvas()->resourceManager()->setResource(KoText::ShowTextFrames, on);
1079
 
    kwcanvas()->update();
 
1118
    m_canvas->resourceManager()->setResource(KoText::ShowTextFrames, on);
 
1119
    m_canvas->update();
1080
1120
    m_document->config().setViewFrameBorders(on);
1081
1121
}
1082
1122
 
1108
1148
void KWView::inlineFrame()
1109
1149
{
1110
1150
    Q_ASSERT(kwdocument()->mainFrameSet());
1111
 
    KoSelection *selection = kwcanvas()->shapeManager()->selection();
 
1151
    KoSelection *selection = canvasBase()->shapeManager()->selection();
1112
1152
 
1113
1153
    KoShape *targetShape = 0;
1114
1154
    foreach (KoShape *shape, selection->selectedShapes(KoFlake::TopLevelSelection)) {
1152
1192
 
1153
1193
    QString tool = KoToolManager::instance()->preferredToolForSelection(selection->selectedShapes());
1154
1194
    KoToolManager::instance()->switchToolRequested(tool);
1155
 
    KoTextEditor *handler = qobject_cast<KoTextEditor*> (kwcanvas()->toolProxy()->selection());
 
1195
    KoTextEditor *handler = qobject_cast<KoTextEditor*> (canvasBase()->toolProxy()->selection());
1156
1196
    Q_ASSERT(handler);
1157
1197
    KoTextAnchor *anchor = new KoTextAnchor(targetShape);
1158
1198
    anchor->setOffset(QPointF(0, -targetShape->size().height()));
1175
1215
 
1176
1216
void KWView::createLinkedFrame()
1177
1217
{
1178
 
    KoSelection *selection = kwcanvas()->shapeManager()->selection();
 
1218
    KoSelection *selection = canvasBase()->shapeManager()->selection();
1179
1219
    QList<KoShape*> oldSelection = selection->selectedShapes(KoFlake::TopLevelSelection);
1180
1220
    if (oldSelection.count() == 0)
1181
1221
        return;
1188
1228
        KWCopyShape *copy = new KWCopyShape(frame->shape(), m_document->pageManager());
1189
1229
        copy->setPosition(frame->shape()->position());
1190
1230
        QPointF offset(40, 40);
1191
 
        kwcanvas()->clipToDocument(copy, offset);
 
1231
        canvasBase()->clipToDocument(copy, offset);
1192
1232
        copy->setPosition(frame->shape()->position() + offset);
1193
1233
        copy->setZIndex(frame->shape()->zIndex() + 1);
1194
1234
        KWFrame *newFrame = new KWFrame(copy, frame->frameSet());
1238
1278
 
1239
1279
void KWView::editSelectAllFrames()
1240
1280
{
1241
 
    KoSelection *selection = kwcanvas()->shapeManager()->selection();
 
1281
    KoSelection *selection = canvasBase()->shapeManager()->selection();
1242
1282
    foreach (KWFrameSet *fs, m_document->frameSets()) {
1243
1283
        foreach (KWFrame *frame, fs->frames()) {
1244
1284
            if (frame->shape()->isVisible())
1249
1289
 
1250
1290
void KWView::editDeleteSelection()
1251
1291
{
1252
 
    kwcanvas()->toolProxy()->deleteSelection();
 
1292
    canvasBase()->toolProxy()->deleteSelection();
1253
1293
}
1254
1294
 
1255
1295
void KWView::createCustomOutline()
1266
1306
        m_document->addCommand(cmd);
1267
1307
    }
1268
1308
 
1269
 
    KoSelection *selection = kwcanvas()->shapeManager()->selection();
 
1309
    KoSelection *selection = canvasBase()->shapeManager()->selection();
1270
1310
    selection->deselectAll();
1271
1311
    foreach (KWFrame *frame, frames) {
1272
1312
        KoShapeContainer *group = frame->shape()->parent();
1277
1317
    KoToolManager::instance()->switchToolRequested("PathToolFactoryId");
1278
1318
}
1279
1319
 
 
1320
void KWView::createFrameClipping()
 
1321
{
 
1322
    QSet<KWFrame *> clipFrames;
 
1323
    foreach (KoShape *shape, canvasBase()->shapeManager()->selection()->selectedShapes(KoFlake::TopLevelSelection)) {
 
1324
        KWFrame *frame = frameForShape(shape);
 
1325
        Q_ASSERT(frame);
 
1326
        if (frame->shape()->parent() == 0)
 
1327
            clipFrames << frame;
 
1328
    }
 
1329
    if (!clipFrames.isEmpty()) {
 
1330
        KWClipFrameCommand *cmd = new KWClipFrameCommand(clipFrames.toList(), m_document);
 
1331
        m_document->addCommand(cmd);
 
1332
    }
 
1333
}
 
1334
 
 
1335
void KWView::removeFrameClipping()
 
1336
{
 
1337
    QSet<KWFrame *> unClipFrames;
 
1338
    foreach (KoShape *shape, canvasBase()->shapeManager()->selection()->selectedShapes(KoFlake::TopLevelSelection)) {
 
1339
        KWFrame *frame = frameForShape(shape);
 
1340
        Q_ASSERT(frame);
 
1341
        if (frame->shape()->parent())
 
1342
            unClipFrames << frame;
 
1343
    }
 
1344
    if (!unClipFrames.isEmpty()) {
 
1345
        KWRemoveFrameClipCommand *cmd = new KWRemoveFrameClipCommand(unClipFrames.toList(), m_document);
 
1346
        m_document->addCommand(cmd);
 
1347
    }
 
1348
}
 
1349
 
1280
1350
void KWView::insertImage()
1281
1351
{
1282
1352
    KoShape *shape = KoImageSelectionWidget::selectImageShape(m_document->resourceManager(), this);
1313
1383
void KWView::setGuideVisibility(bool on)
1314
1384
{
1315
1385
    m_document->guidesData().setShowGuideLines(on);
1316
 
    kwcanvas()->update();
 
1386
    m_canvas->update();
 
1387
}
 
1388
 
 
1389
void KWView::createTextOnShape()
 
1390
{
 
1391
    QSet<KoShape *> frameShapes;
 
1392
    KoSelection *selection = canvasBase()->shapeManager()->selection();
 
1393
    foreach (KoShape *shape, selection->selectedShapes(KoFlake::TopLevelSelection)) {
 
1394
        KWFrame *frame = frameForShape(shape);
 
1395
        Q_ASSERT(frame);
 
1396
        if (frame->shape()->parent() == 0) {
 
1397
            frameShapes << frame->shape();
 
1398
        }
 
1399
    }
 
1400
#if 0
 
1401
    if (!frameShapes.isEmpty()) {
 
1402
        KoAddTextOnShapeCommand *cmd = new KoAddTextOnShapeCommand(frameShapes.toList(), m_document);
 
1403
        m_document->addCommand(cmd);
 
1404
    }
 
1405
#else
 
1406
    foreach (KoShape *shape, frameShapes) {
 
1407
        selection->deselect(shape);
 
1408
        KoTextOnShapeContainer *decorator = new KoTextOnShapeContainer(shape, m_document->resourceManager());
 
1409
        decorator->setPlainText("dummy text, la la la enzo");
 
1410
        m_document->addShape(decorator);
 
1411
        selection->select(decorator);
 
1412
    }
 
1413
#endif
1317
1414
}
1318
1415
 
1319
1416
// end of actions
1337
1434
 
1338
1435
void KWView::selectionChanged()
1339
1436
{
1340
 
    KoShape *shape = kwcanvas()->shapeManager()->selection()-> firstSelectedShape();
 
1437
    KoShape *shape = canvasBase()->shapeManager()->selection()-> firstSelectedShape();
1341
1438
    m_actionFormatFrameSet->setEnabled(shape != 0);
1342
1439
    m_actionAddBookmark->setEnabled(shape != 0);
1343
1440
    if (shape) {
1349
1446
        else
1350
1447
            m_actionAddBookmark->setEnabled(false);
1351
1448
    }
1352
 
    // actions need at least one shape selected
1353
 
    actionCollection()->action("create_linked_frame")->setEnabled(shape);
 
1449
    // actions that need at least one shape selected
 
1450
    QAction *action = actionCollection()->action("create_linked_frame");
 
1451
    if (action) action->setEnabled(shape);
 
1452
    action = actionCollection()->action("inline_frame");
 
1453
    if (action) action->setEnabled(shape && kwdocument()->mainFrameSet());
1354
1454
 
1355
 
    foreach (KoShape *shape, kwcanvas()->shapeManager()->selection()->selectedShapes(KoFlake::TopLevelSelection)) {
 
1455
    foreach (KoShape *shape, canvasBase()->shapeManager()->selection()->selectedShapes(KoFlake::TopLevelSelection)) {
1356
1456
        KWFrame *frame = frameForShape(shape);
1357
1457
        Q_ASSERT(frame);
1358
1458
        QVariant variant;
1448
1548
{
1449
1549
#ifdef SHOULD_BUILD_RDF
1450
1550
    kDebug(30015) << "xmlid:" << xmlid << " reflow item:" << item->name();
1451
 
    KoTextEditor *editor = qobject_cast<KoTextEditor*>(kwcanvas()->toolProxy()->selection());
 
1551
    KoTextEditor *editor = qobject_cast<KoTextEditor*>(canvasBase()->toolProxy()->selection());
1452
1552
    if (!editor) {
1453
1553
        kDebug(30015) << "no editor, not reflowing rdf semantic item.";
1454
1554
        return;
1459
1559
#endif
1460
1560
}
1461
1561
 
 
1562
void KWView::variableChanged(){
 
1563
    m_actionMenu->menu()->clear();
 
1564
    foreach (QAction *action, m_document->inlineTextObjectManager()->createInsertVariableActions(canvasBase()))
 
1565
        m_actionMenu->addAction(action);
 
1566
}