[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: DCOP, KWord and Cursor
From:       David Faure <faure () kde ! org>
Date:       2004-08-25 19:28:11
Message-ID: 200408252128.12407.faure () kde ! org
[Download RAW message or body]

On Tuesday 24 August 2004 23:20, BlackFire wrote:
> Hello everybody,
> 	it's my first post so forget me if I break some "list tradition" :P
> I'm getting mad with DCOP programming:
> 
> 1) I wasn't able to find any good dcop reference (ie even a list of the
> functions that can be called via dcop - sort of an api reference) and
> resolved exploring by hand via dcop client (and kdcop). Any advice?

http://www.koffice.org/developer/dcop/

> 2) I'm writing an app using kword as an editor, but I need to find out the
> cursor position in the text, expressed in characters from the start or
> row/columns coordinates. I was able to find out how to move the cursor via
> DCOP, but I couldn't figure out how to get its position. Help is really
> needed here :P (I've seen KWrite has got the iface I need, but what about
> kword?)

That's not available indeed. Can you try this patch?

Index: KoTextViewIface.cc
===================================================================
RCS file: /home/kde/koffice/lib/kotext/KoTextViewIface.cc,v
retrieving revision 1.45
diff -u -p -r1.45 KoTextViewIface.cc
--- KoTextViewIface.cc  24 Jul 2004 13:20:59 -0000      1.45
+++ KoTextViewIface.cc  25 Aug 2004 19:26:39 -0000
@@ -244,6 +244,16 @@ void KoTextViewIface::showCursor()
     m_textView->showCursor();
 }

+int KoTextViewIface::cursorParagraph() const
+{
+    return m_textView->cursor()->parag()->paragId();
+}
+
+int KoTextViewIface::cursorIndex() const
+{
+    return m_textView->cursor()->index();
+}
+
 void KoTextViewIface::moveCursorLeft(bool select)
 {
   m_textView->moveCursor(KoTextView::MoveBackward,select);

Index: KoTextViewIface.h
===================================================================
RCS file: /home/kde/koffice/lib/kotext/KoTextViewIface.h,v
retrieving revision 1.36
diff -u -p -r1.36 KoTextViewIface.h
--- KoTextViewIface.h   24 Jul 2004 13:20:59 -0000      1.36
+++ KoTextViewIface.h   25 Aug 2004 19:26:39 -0000
@@ -80,6 +80,9 @@ k_dcop:
     void hideCursor();
     void showCursor();

+    int cursorParagraph() const;
+    int cursorIndex() const;
+
     void moveCursorLeft(bool select);
     void moveCursorRight(bool select);
     void moveCursorUp(bool select);


-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic