summaryrefslogtreecommitdiffstats
path: root/lib/kotext/KoTextViewIface.h
blob: cee86f0652ba6b8fde409a36843575c90f3b5ca6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/* This file is part of the KDE project
   Copyright (C) 2002, Laurent MONTEL <lmontel@mandrakesoft.com>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

#ifndef KOTEXTVIEW_IFACE_H
#define KOTEXTVIEW_IFACE_H

#include <KoDocumentIface.h>
#include <dcopref.h>

#include <qstring.h>
#include <qcolor.h>
#include <KoRichText.h>
#include <koffice_export.h>
class KoTextView;

class KOTEXT_EXPORT KoTextViewIface :  public DCOPObject
{
    K_DCOP
public:
    KoTextViewIface( KoTextView *_textview );

k_dcop:
    void insertSoftHyphen();
    void insertNonbreakingSpace();
    void insertNonbreakingHyphen();
    void insertText( const QString &text );
    void newParagraph();
    void setBold(bool b);
    void setItalic(bool on);
    void setUnderline(bool on);
    void setDoubleUnderline(bool on);
    void setStrikeOut(bool on);
    void setPointSize( int s );
    void setTextSubScript(bool on);
    void setTextSuperScript(bool on);
    void setUnderlineColor( const QColor & color );
    void setDefaultFormat();
    void setRelativeTextSize( double _size);

    QColor textColor() const;
    QString textFontFamily()const;
    QColor textBackgroundColor()const;
    QColor textUnderlineColor() const;
    bool textDoubleUnderline() const;

    bool textItalic() const;
    bool textBold() const;
    bool textUnderline()const;
    bool textStrikeOut()const;
    bool textSubScript() const;
    bool textSuperScript() const;
    // TODO text shadow
    double relativeTextSize() const;
    bool wordByWord() const;

    void setWordByWord( bool _b );
    void setTextColor(const QColor &color);
    void setTextBackgroundColor(const QColor &);
    void setAlign(int align);
    void setAlign(const QString &);

    bool isReadWrite() const ;
    void setReadWrite( bool b );

    void hideCursor();
    void showCursor();

    int cursorParagraph() const;
    int cursorIndex() const;

    void moveCursorLeft(bool select);
    void moveCursorRight(bool select);
    void moveCursorUp(bool select);
    void moveCursorDown(bool select);
    void moveCursorHome(bool select);
    void moveCursorEnd(bool select);
    void moveCursorWordRight(bool select);
    void moveCursorWordLeft(bool select);
    void moveCursorLineEnd(bool select);
    void moveCursorLineStart(bool select);

    bool paragraphHasBorder() const;

    //return line spacing in pt
    double lineSpacing() const;

    double rightMargin() const;
    double leftMargin() const;
    double marginFirstLine() const;
    double spaceAfterParag() const;
    double spaceBeforeParag() const;

    void setMarginFirstLine(double pt);
    void setLineSpacing(double pt);
    void setLeftMargin(double pt);
    void setRightMargin(double pt);
    void setSpaceBeforeParag(double pt);
    void setSpaceAfterParag(double pt);

    // apply border, for the futur add border style
    void setLeftBorder( const QColor & c,double width );
    void setRightBorder( const QColor & c,double width );

    void setTopBorder( const QColor & c,double width );
    void setBottomBorder(const QColor & c,double width );

    void setLeftBorderColor( const QColor & c );
    void setRightBorderColor( const QColor & c );
    void setTopBorderColor( const QColor & c);
    void setBottomBorderColor(const QColor & c );
    void setLeftBorderWidth( double _witdh );
    void setRightBorderWidth( double _witdh );
    void setTopBorderWidth( double _witdh );
    void setBottomBorderWidth( double _witdh );


    //return border width in pt
    double leftBorderWidth() const ;
    double rightBorderWidth() const;
    double topBorderWidth() const;
    double bottomBorderWidth() const;

    QColor leftBorderColor() const ;
    QColor rightBorderColor() const;
    QColor topBorderColor() const;
    QColor bottomBorderColor() const;

    void changeCaseOfText( const QString & caseType);
    bool isALinkVariable() const;
    //return false if there is not a link
    bool changeLinkVariableUrl( const QString & _url) const;
    //return false if there is not a link
    bool changeLinkVariableName( const QString & _name) const;

    //be carefull these functions return QString::null when there is not
    //a variable
    QString linkVariableUrl( ) const;
    QString linkVariableName( ) const;

    bool isANoteVariable() const ;
    QString noteVariableText() const;
    //return false if there is not a note variable
    bool setNoteVariableText(const QString & note) const;

    void removeComment();
    QString underlineStyle() const;
    QString strikeOutStyle()const;

    void setLanguage(const QString & _lang);
    QString language() const;
    void addBookmarks(const QString &url);
    void copyLink();
    void removeLink();
    void copyTextOfComment();
    QString fontAttibute()const;
private:
    KoTextView *m_textView;
protected:
    //QString lineStyleToString( KoTextFormat::LineStyle _style ) const;
};

#endif