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

List:       kde-commits
Subject:    koffice/libs/kotext
From:       Pavol Korinek <pavol.korinek () ixonos ! com>
Date:       2010-11-19 22:54:50
Message-ID: 20101119225450.B22FFAC8A0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1198838 by pavolk:

inline object can be inserted with specified char format

 M  +2 -4      KoInlineTextObjectManager.cpp  
 M  +2 -1      KoInlineTextObjectManager.h  
 M  +1 -1      KoTextEditor.cpp  


--- trunk/koffice/libs/kotext/KoInlineTextObjectManager.cpp #1198837:1198838
@@ -53,12 +53,10 @@
     return m_objects.value(id);
 }
 
-void KoInlineTextObjectManager::insertInlineObject(QTextCursor &cursor, \
KoInlineObject *object) +void \
KoInlineTextObjectManager::insertInlineObject(QTextCursor &cursor, KoInlineObject \
*object, QTextCharFormat charFormat)  {
     QTextCharFormat oldCf = cursor.charFormat();
-    // create a new format out of the old so that the current formatting is
-    // also used for the inserted object.  KoVariables render text too ;)
-    QTextCharFormat cf(oldCf);
+    QTextCharFormat cf(charFormat);
     cf.setObjectType(QTextFormat::UserObject + 1);
     cf.setProperty(InlineInstanceId, ++m_lastObjectId);
     cursor.insertText(QString(QChar::ObjectReplacementCharacter), cf);
--- trunk/koffice/libs/kotext/KoInlineTextObjectManager.h #1198837:1198838
@@ -74,8 +74,9 @@
      * @param cursor the cursor which indicated the document and the position in \
                that document
      *      where the inline object will be inserted.
      * @param object the inline object to insert.
+     * @param charFormat specifies char format which will be used to insert inline \
                object
      */
-    void insertInlineObject(QTextCursor &cursor, KoInlineObject *object);
+    void insertInlineObject(QTextCursor &cursor, KoInlineObject *object, \
QTextCharFormat charFormat = QTextCharFormat());  
     /**
      * Remove an inline object from this manager (as well as the document).
--- trunk/koffice/libs/kotext/KoTextEditor.cpp #1198837:1198838
@@ -742,7 +742,7 @@
     KoTextDocumentLayout *layout = \
qobject_cast<KoTextDocumentLayout*>(d->document->documentLayout());  \
Q_ASSERT(layout);  Q_ASSERT(layout->inlineTextObjectManager());
-    layout->inlineTextObjectManager()->insertInlineObject(d->caret, inliner);
+    layout->inlineTextObjectManager()->insertInlineObject(d->caret, inliner, \
d->caret.charFormat());  d->updateState(KoTextEditor::Private::NoOp);
 }
 


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

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