From koffice-devel Mon Oct 31 23:26:48 2005 From: Gary Cramblitt Date: Mon, 31 Oct 2005 23:26:48 +0000 To: koffice-devel Subject: Re: How get paragraph from frame? Message-Id: <200510311826.48884.garycramblitt () comcast ! net> X-MARC-Message: https://marc.info/?l=koffice-devel&m=113080355729265 On Saturday 29 October 2005 09:45 am, Gary Cramblitt wrote: > I've browsed and browsed the KWord code and can't figure this out. > > Given a text frameset and a frame in the frameset, how do I get the first > paragraph of the frame? Perhaps if I explain WHY I asked this question, someone will lend a hand. As it currently stands, mouseless keyboard access in KWord is severly hampered by the inability to position the caret inside text frames. One way to provide that is to allow the user to edit frames from the document structure area panel on the left. With the recent enhancements, it is now easy for a user to position focus to the doc structure area and invoke functions. However, when choosing the "Edit Text Frameset" option, KWord always positions the caret to the first frame of the frameset. For example, if you have Text Frameset 1 Page 1 Page 2 Page 3 no matter which Page you highlight, when you choose Edit Text Frameset, the caret always goes to Page 1. So what is needed is an "Edit Text Frame" option that goes to the first paragraph of the highlighted frame. Hence my question. I can probably do this by first invoking the "Select Text Frameset" option, then simulating a mouse click there, but that would be ugly. I've studied the code and it appears that everything hinges on mouse clicks in the text area. The KoRichText object takes care of positioning the caret where the mouse is clicked and code can then do things like KWTextFrameSetEdit* textEdit = dynamic_cast(m_currentFrameSetEdit->currentTextEdit()); KoTextCursor* cursor = textEdit->cursor(); KoTextParag* parag = cursor->parag(0); But this depends upon the caret being first positioned according to the mouse click. I did notice there was some code when a caret exits to the left from a table that involved creating a temporary Anchor object. Is this is a possibility? I don't understand what anchors are. -- Gary Cramblitt (aka PhantomsDad) _______________________________________________ koffice-devel mailing list koffice-devel@kde.org https://mail.kde.org/mailman/listinfo/koffice-devel