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

List:       koffice-devel
Subject:    Re: koffice/libs/kotext
From:       Pierre Stirnweiss <pierre.stirnweiss () t-online ! de>
Date:       2009-02-28 8:32:33
Message-ID: 200902280932.34337.pierre.stirnweiss () t-online ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Le vendredi 27 février 2009 22:59:33, Thomas Zander a écrit :
> On Friday 27. February 2009 20:37:22 Thomas Zander wrote:
> > On Friday 27. February 2009 19:55:00 Thorsten Zachmann wrote:
> > > Which brings me to the following to solve the default styles:
> > > When the first style is applied we should check if default properties
> > > are set in the style. If not we should set then.
> >
> > I like that suggestion :)
>
> Something like this should do the trick;
> --- libs/kotext/styles/KoCharacterStyle.cpp
> +++ libs/kotext/styles/KoCharacterStyle.cpp
> @@ -167,6 +167,11 @@ void KoCharacterStyle::clearForeground()
>
>  void KoCharacterStyle::applyStyle(QTextCharFormat &format) const
>  {
> +    // Since Qt takes its default size from the user config we will set a
> default size if nobody else does. +    if
> (!format.hasProperty(QTextFormat::FontPointSize))
> +        format.setFontPointSize(12);
> +    // TODO same for color and font-family
>      QList<int> keys = d->stylesPrivate.keys();
>      for (int i = 0; i < keys.count(); i++) {
>          QVariant variant = d->stylesPrivate.value(keys[i]);

yes, I would like to have a defined set of properties called defaultProperties. 
This set is created/populated on loading from either defaultstyles.xml or hard 
coded values.
applyStyle would iterate over these properties and check the format has these 
set.
That way we still keep the flexibility of defaultstyles.xml without it messing 
our loading.

Pierre

[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" \
content="1" /><style type="text/css">p, li { white-space: pre-wrap; \
}</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; \
font-weight:400; font-style:normal;">Le vendredi 27 février 2009 22:59:33, Thomas \
Zander a écrit :<br> &gt; On Friday 27. February 2009 20:37:22 Thomas Zander \
wrote:<br> &gt; &gt; On Friday 27. February 2009 19:55:00 Thorsten Zachmann \
wrote:<br> &gt; &gt; &gt; Which brings me to the following to solve the default \
styles:<br> &gt; &gt; &gt; When the first style is applied we should check if default \
properties<br> &gt; &gt; &gt; are set in the style. If not we should set then.<br>
&gt; &gt;<br>
&gt; &gt; I like that suggestion :)<br>
&gt;<br>
&gt; Something like this should do the trick;<br>
&gt; --- libs/kotext/styles/KoCharacterStyle.cpp<br>
&gt; +++ libs/kotext/styles/KoCharacterStyle.cpp<br>
&gt; @@ -167,6 +167,11 @@ void KoCharacterStyle::clearForeground()<br>
&gt;<br>
&gt;  void KoCharacterStyle::applyStyle(QTextCharFormat &amp;format) const<br>
&gt;  {<br>
&gt; +    // Since Qt takes its default size from the user config we will set a<br>
&gt; default size if nobody else does. +    if<br>
&gt; (!format.hasProperty(QTextFormat::FontPointSize))<br>
&gt; +        format.setFontPointSize(12);<br>
&gt; +    // TODO same for color and font-family<br>
&gt;      QList&lt;int&gt; keys = d-&gt;stylesPrivate.keys();<br>
&gt;      for (int i = 0; i &lt; keys.count(); i++) {<br>
&gt;          QVariant variant = d-&gt;stylesPrivate.value(keys[i]);<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br></p>yes, I would like to have a defined set of properties \
called defaultProperties. This set is created/populated on loading from either \
defaultstyles.xml or hard coded values.<br> applyStyle would iterate over these \
properties and check the format has these set.<br> That way we still keep the \
flexibility of defaultstyles.xml without it messing our loading.<br> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br></p>Pierre</p></body></html>



_______________________________________________
koffice-devel mailing list
koffice-devel@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