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

List:       kde-commits
Subject:    Re: koffice/libs/kotext/opendocument
From:       Thorsten Zachmann <t.zachmann () zagge ! de>
Date:       2010-11-08 3:33:33
Message-ID: 201011080433.34121.t.zachmann () zagge ! de
[Download RAW message or body]

Hello Thomas,

On Sunday, November 07, 2010 07:04:18 pm Thomas Zander wrote:
>          if (styleManager) {
> -            styleManager->add(it->second);
> +            styleManager->add(odfStyle.style);
>          } else {
> -            d->characterStylesToDelete.append(it->second);
> +            if (!odfStyle.parentStyle.isEmpty()) { // an auto style with a
> parent. +                // lets find the parent and set the styleId of
> that one on the auto-style too. +                // this will have the
> effect that whereever the autostyle is applied, it will
> +                // cause the parent style-id to be applied. So we don't
> loose this info. +                KoCharacterStyle *parent =
> characterStyle(odfStyle.parentStyle, false); +                if (!parent)
> +                    parent = characterStyle(odfStyle.parentStyle, true);
> // try harder +                if (parent)
> +                    odfStyle.style->setStyleId(parent->styleId());
>          }
> +            d->characterStylesToDelete.append(odfStyle.style);

there is a problem with the above code. If a style is in content.xml  and it 
is a automatic style its parent can be a automatic style in content.xml or a 
document style in styles.xml. If it is a automatic style and it is in 
styles.xml its parent can only be a automatic style in styles.xml or a 
document style in styles.xml. Also a document style can never have an 
automatic style as parent. 
The above code is problematic as automatic styles in content.xml and 
styles.xml can have the same name.

This needs to be taken into account by the above code. 

Thorsten

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

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