Thanks! :)<br><br><div class="gmail_quote">On Tue, Feb 8, 2011 at 7:04 PM, C. Boemann <span dir="ltr"><<a href="mailto:cbo@boemann.dk">cbo@boemann.dk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Tuesday 08 February 2011 13:59:47 Gopalakrishna Bhat wrote:<br>
> I was looking as this piece of code in KoTextEditor.cpp<br>
><br>
><br>
> void KoTextEditor::newLine()<br>
> {<br>
> d->updateState(KoTextEditor::Private::Custom, i18n("Line Break"));<br>
> if (d->caret.hasSelection())<br>
> d->deleteInlineObjects();<br>
> KoTextDocument koDocument(d->document);<br>
> KoStyleManager *styleManager = koDocument.styleManager();<br>
> KoParagraphStyle *nextStyle = 0;<br>
> KoParagraphStyle *currentStyle = 0;<br>
> if (styleManager) {<br>
> int id =<br>
> d->caret.blockFormat().intProperty(KoParagraphStyle::StyleId);<br>
> currentStyle = styleManager->paragraphStyle(id);<br>
> if (currentStyle == 0) // not a style based parag. Lets make the<br>
> next one correct.<br>
> nextStyle = styleManager->defaultParagraphStyle();<br>
> else<br>
> nextStyle =<br>
> styleManager->paragraphStyle(currentStyle->nextStyle());<br>
> Q_ASSERT(nextStyle);<br>
> if (currentStyle == nextStyle)<br>
> nextStyle = 0;<br>
> }<br>
> .<br>
> .<br>
> .<br>
><br>
> }<br>
><br>
><br>
> Here the parameter passed to styleManager->paragraphStyle(id) is a integer<br>
> whereas its signature shows that it is a const QString....Is this the right<br>
> way to call or am I missing something?<br>
><br>
> //snippet from KoStyleManager.cpp<br>
> KoParagraphStyle *KoStyleManager::paragraphStyle(const QString &name) const<br>
> {<br>
> foreach(KoParagraphStyle *style, d->paragStyles) {<br>
> qDebug()<<Q_FUNC_INFO<<" name "<<name<<"style->name<br>
> "<<style->name();<br>
> if (style->name() == name)<br>
> return style;<br>
> }<br>
> return 0;<br>
<br>
</div></div>from KoStyleManager.h:<br>
<br>
<br>
/**<br>
* Return a paragraphStyle by its id.<br>
* From documents you can retrieve the id out of each QTextBlockFormat<br>
* by requesting the KoParagraphStyle::StyleId property.<br>
* @param id the unique Id to search for.<br>
* @see KoParagraphStyle::styleId()<br>
*/<br>
KoParagraphStyle *paragraphStyle(int id) const;<br>
_______________________________________________<br>
calligra-devel mailing list<br>
<a href="mailto:calligra-devel@kde.org">calligra-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/calligra-devel" target="_blank">https://mail.kde.org/mailman/listinfo/calligra-devel</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>My blog <a href="http://gkbhat.blogspot.com">http://gkbhat.blogspot.com</a><br>