~ubuntu-branches/ubuntu/oneiric/koffice/oneiric-updates

« back to all changes in this revision

Viewing changes to kword/plugins/scripting/Module.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:
2
2
 * This file is part of KWord
3
3
 *
4
4
 * Copyright (c) 2006 Sebastian Sauer <mail@dipe.org>
 
5
 * Copyright (C) 2010 Thomas Zander <zander@kde.org>
5
6
 *
6
7
 * This program is free software; you can redistribute it and/or modify
7
8
 * it under the terms of the GNU Library General Public License as published by
29
30
#include <KWView.h>
30
31
#include <KWPage.h>
31
32
 
32
 
#include <QPointer>
 
33
#include <QWeakPointer>
33
34
 
34
35
extern "C"
35
36
{
40
41
 
41
42
using namespace Scripting;
42
43
 
43
 
namespace Scripting
44
 
{
45
 
 
46
 
/// \internal d-pointer class.
47
 
class Module::Private
48
 
{
49
 
public:
50
 
    QPointer<KWDocument> doc;
51
 
};
52
 
}
53
 
 
54
44
Module::Module(QObject* parent)
55
 
        : KoScriptingModule(parent, "KWord")
56
 
        , d(new Private())
 
45
    : KoScriptingModule(parent, "KWord")
57
46
{
58
 
    d->doc = 0;
59
47
}
60
48
 
61
49
Module::~Module()
62
50
{
63
 
    delete d;
64
51
}
65
52
 
66
53
KWDocument* Module::kwDoc()
67
54
{
68
 
    if (! d->doc) {
69
 
        if (KWView* v = dynamic_cast< KWView* >(view()))
70
 
            d->doc = v->kwdocument();
71
 
        if (! d->doc)
72
 
            d->doc = new KWDocument(0, this);
 
55
    if (!m_doc) {
 
56
        if (KWView *v = dynamic_cast< KWView* >(view()))
 
57
            m_doc = v->kwdocument();
 
58
        if (!m_doc)
 
59
            m_doc = new KWDocument(0, this);
73
60
    }
74
 
    return d->doc;
 
61
    return m_doc.data();
75
62
}
76
63
 
77
64
KoDocument* Module::doc()