lib

KoViewIface.cpp
1/* This file is part of the KDE project
2 Copyright (c) 2000 Simon Hausmann <hausmann@kde.org>
3
4 $Id: KoViewIface.cpp 508787 2006-02-12 18:28:12Z ingwa $
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21#include "KoViewIface.h"
22
23#include "KoView.h"
24
25#include <tdeapplication.h>
26#include <dcopclient.h>
27#include <kdcopactionproxy.h>
28#include <tdeaction.h>
29
30//static
31TQCString KoViewIface::newIfaceName()
32{
33 static int s_viewIFNumber = 0;
34 TQCString name; name.setNum( s_viewIFNumber++ ); name.prepend("View-");
35 return name;
36}
37
38KoViewIface::KoViewIface( KoView *view )
39 : DCOPObject( newIfaceName() )
40{
41 m_actionProxy = new KDCOPActionProxy( view->actionCollection(), this );
42}
43
44KoViewIface::KoViewIface( const char *name, KoView *view )
45 : DCOPObject( name )
46{
47 m_pView = view;
48 m_actionProxy = new KDCOPActionProxy( view->actionCollection(), this );
49}
50
51KoViewIface::~KoViewIface()
52{
53 delete m_actionProxy;
54}
55
56DCOPRef KoViewIface::action( const TQCString &name )
57{
58 return DCOPRef( kapp->dcopClient()->appId(), m_actionProxy->actionObjectId( name ) );
59}
60
61QCStringList KoViewIface::actions()
62{
63 QCStringList res;
64 TQValueList<TDEAction *> lst = m_actionProxy->actions();
65 TQValueList<TDEAction *>::ConstIterator it = lst.begin();
66 TQValueList<TDEAction *>::ConstIterator end = lst.end();
67 for (; it != end; ++it )
68 res.append( (*it)->name() );
69
70 return res;
71}
72
73TQMap<TQCString,DCOPRef> KoViewIface::actionMap()
74{
75 return m_actionProxy->actionMap();
76}
virtual TDEActionCollection * actionCollection() const
This class is used to display a KoDocument.
Definition KoView.h:58
const char * name(StdAction id)