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

List:       koffice-devel
Subject:    Re: koffice/libs/kotext
From:       Thorsten Zachmann <t.zachmann () zagge ! de>
Date:       2009-02-28 3:50:00
Message-ID: 200902280450.00495.t.zachmann () zagge ! de
[Download RAW message or body]

Hello,

I will answer at the end of the mail as all the points are connected.

On Friday 27 February 2009, Pierre Stirnweiss wrote:
> Le vendredi 27 février 2009 19:55:00, Thorsten Zachmann a écrit  :
> > why should that be wrong? It can only have the color if the style or its
> > parent defines one. If there is none the already active is used. That is
> > the one that was defined before the span was opened.
> >
> > 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.
>
> yes, I was thinking along the same lines. However there is still something
> I think needs to be discussed:
>
> <span color=red>red<span bold=true parent="color=green">this text is bold,
> but what color should it be</span></span>
>
> my current thinking is: check first up the parent chain, then if property
> is not found check along the parent chain of each container in turn up the
> container chain. This indeed means that we should only care about the
> higher level container set the default properties for loading.
>
> However this leaves the case of things just needing the kotext-textshape
> without loading of odf text (like, legacy kwt loading, non primarily text
> koffice apps (krita or karbon), perhaps scripts, external apps).
>
> Which means we are a bit in a conflict of interest there.
>
> One solution I was considering is the following:
> -set default properties on all styles. have a register of the properties
> that are inherited from the default properties (meaning, the ones which
> were not set by the parenting chain).
> - on loading a span, check if those flagged properties which are not set by
> the parent chain are set in the "container chain" properties. If yes, use
> the "container chain" ones, if not the "default" ones.
>
> What do you think?
>
> Bearing in mind that this needs to be fixed before 2.0, because
> defaultstyles.xml hit the same way as my last patch because of:
>
> KoCharacterStyle * characterStyle = d->textSharedData-
>
> >characterStyle(styleName, d->stylesDotXml);
>
>             if (characterStyle) {
>                 characterStyle->applyStyle(&cursor);
>
> the characterStale returned by the TextSharedLoadingData will have the
> default properties set.
>
> and defaultstyle is needed.

You are right here. If I add the <style:default-style 
style:family="paragraph"> as defined in the file like it is done for kword 
then the loading of the text formats is broken. Looks like we missed 
something when we added this. 

How about the way I described in applying the default style when a textshape 
is created.

That means we should remove the usage of the m_defaultStylesReader from 
KoOdfLoadingContext again and use the values of the defaultstyles.xml to set 
the values of the text default styles for the properties not yet set by 
itself. Then when a textshape is created the default style will be applied.

Here an example.

defaultstyles.xml:
------------------
 <office:styles>
  <style:default-style style:family="paragraph">
   <style:text-properties fo:color="#000000" fo:font-family="Sans Serif" 
fo:font-size="12.000000000000000pt"/>
  </style:default-style>
 </office:styles>

styles.xml:
-----------
 <office:styles>
    <style:default-style style:family="paragraph">
      <style:text-properties fo:font-size="14pt"/>
    </style:default-style>
.....
 </office:styles>

With a configuration like the above we set the default style we use

font-size = 14
fo:color = #00000
font-family = Sans Serif

If now a new textshape is created we always set default style which will set 
the above values on the textshape.

If then a style overwrites one of the values that is fine and will be used. If 
it is not overwritten then the default ones will be used and we should be 
fine.

For applications which don't define a defaultstyles.xml we could use a koffice 
specific version of the file.

For others we would just set sane defaults in the default style if it is not 
given.

Thorsten

_______________________________________________
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