summaryrefslogtreecommitdiffstats
path: root/lib/kotext/KoTextViewIface.h
blob: 1d993932c5665a1169bdc43982441e267b9d66a0 (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 <tqstring.h>
#include <tqcolor.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 TQString &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 TQColor & color );
    void setDefaultFormat();
    void setRelativeTextSize( double _size);

    TQColor textColor() const;
    TQString textFontFamily()const;
    TQColor textBackgroundColor()const;
    TQColor 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 TQColor &color);
    void setTextBackgroundColor(const TQColor &);
    void setAlign(int align);
    void setAlign(const TQString &);

    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 TQColor & c,double width );
    void setRightBorder( const TQColor & c,double width );

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

    void setLeftBorderColor( const TQColor & c );
    void setRightBorderColor( const TQColor & c );
    void setTopBorderColor( const TQColor & c);
    void setBottomBorderColor(const TQColor & 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;

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

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

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

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

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

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

#endif