From koffice-devel Wed Nov 17 15:40:17 2010 From: Thomas Zander Date: Wed, 17 Nov 2010 15:40:17 +0000 To: koffice-devel Subject: Re: insert inline object problem Message-Id: <201011171640.17317.zander () kde ! org> X-MARC-Message: https://marc.info/?l=koffice-devel&m=129000846330511 On Tuesday 16. November 2010 11.38.29 you wrote: > Hello, > > I work on problem which can be seen when open file from bug: 244396. > Problem is that we can see double stroked line through "Picture 1" text > above inserted picture. Fact is that it's not stroked line of that text ! > It's stroked line, text-properties, text char format in cursor, of > inserted picture ! > > Reasons of current state: > > 1. inline object manager uses char format (current text properties) > > void KoInlineTextObjectManager::insertInlineObject(QTextCursor &cursor, > KoInlineObject *object) { > 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); > ..... > > 2. we are using default properties from MSWord, which are as default in UI, > not as default for text in MSWord (not easy to find default char format > for text) > > 3. Stroked line of picture is shown one line upper. Stroked line should be > hidden behind picture. It's not stroked line of text one line upper ! > > > Possible solutions: > > 1. set default char format for inline object manager - NOT good - we will > lost possible format variables -> which variables are used for inline > pictures from text properties ?? > > 2. set correct default text properties for "Normal" style. parse correct > default text format - not easy to find, or create some kword default text > format - ths should be fixed too, because when you start write text > anywhere, than it's still double stroked ! MSWord doesn't use default text > style which has set in UI ! MSWord uses different default text format ! > > 3. Fix that stroked line of inline object is shown one line upper. This > should be fixed ! Is it Qt problem ? Can we ignore it and close bug ? > > Which way do you prefer actually ? > > Maybe we can also create workaround like don't use stroked line for inline > objects, but is just like hide problem number 3 The behavior as it is is correct for when a user inserts a KoVariable, not so currect when the user inserts most other KoInlineObjects. So, the ideal solution sounds to me to be that we reuse the old format only when inserting a variable. One way to do this is to alter the insertInlineObject() to take a QTextCharFormat; void KoInlineTextObjectManager::insertInlineObject(QTextCursor &cursor, KoInlineObject *object, const QTextCharFormat &cf = QTextCharFormat()) and make the command that inserts variables pass in the old format. (see InsertVariableAction.cpp) -- Thomas Zander _______________________________________________ koffice-devel mailing list koffice-devel@kde.org https://mail.kde.org/mailman/listinfo/koffice-devel