karbon

karbon_part_iface.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20
21#include <dcopclient.h>
22
23#include <tdeapplication.h>
24
25#include "karbon_part.h"
26#include "karbon_part_iface.h"
27#include "vselection.h"
28#include "vlayer.h"
29
30
31KarbonPartIface::KarbonPartIface( KarbonPart* part )
32 : KoDocumentIface( part )
33{
34 m_part = part;
35}
36
37void KarbonPartIface::selectAllObjects()
38{
39 m_part->document().selection()->append();
40}
41
42void KarbonPartIface::deselectAllObjects()
43{
44 m_part->document().selection()->clear();
45}
46
47bool KarbonPartIface::showStatusBar () const
48{
49 return m_part->showStatusBar();
50}
51
52void KarbonPartIface::setShowStatusBar ( bool b )
53{
54 m_part->setShowStatusBar( b );
55 m_part->reorganizeGUI();
56}
57
58void KarbonPartIface::setUndoRedoLimit( int undo )
59{
60 m_part->setUndoRedoLimit( undo );
61}
62
63void KarbonPartIface::initConfig()
64{
65 m_part->initConfig();
66}
67
68
69void KarbonPartIface::clearHistory()
70{
71 m_part->clearHistory();
72}
73
74
75TQString KarbonPartIface::unitName() const
76{
77 return m_part->unitName();
78}
79
80TQString
81KarbonPartIface::widthInUnits()
82{
83 TQString val = KoUnit::toUserStringValue( m_part->document().width(), m_part->unit() );
84 return TQString( "%1%2" ).arg( val ).arg( m_part->unitName() );
85}
86
87TQString
88KarbonPartIface::heightInUnits()
89{
90 TQString val = KoUnit::toUserStringValue( m_part->document().height(), m_part->unit() );
91 return TQString( "%1%2" ).arg( val ).arg( m_part->unitName() );
92}
93
94double
95KarbonPartIface::width()
96{
97 return m_part->document().width();
98}
99
100double
101KarbonPartIface::height()
102{
103 return m_part->document().height();
104}
105
106int KarbonPartIface::nbLayer() const
107{
108 return m_part->document().layers().count();
109}
110
111DCOPRef KarbonPartIface::activeLayer()
112{
113 if( !m_part->document().activeLayer() )
114 return DCOPRef();
115
116 return DCOPRef( kapp->dcopClient()->appId(),
117 m_part->document().activeLayer()->dcopObject()->objId() );
118}
119
Keeps track of visual per document properties.
Definition karbon_part.h:46
VSelection * selection() const
Returns a pointer to the selection.
Definition vdocument.h:238
void append()
Adds all objects to the selection.