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

List:       koffice-devel
Subject:    Re: Page Variable Support
From:       Thorsten Zachmann <t.zachmann () zagge ! de>
Date:       2009-08-23 4:39:49
Message-ID: 200908230639.49693.t.zachmann () zagge ! de
[Download RAW message or body]

On Sat August 22 2009, Thomas Zander wrote:
> On Friday 21. August 2009 22.17.40 Thorsten Zachmann wrote:
> > it worked fine this exact way in koffice 1.x and I think it can see no
> > problem to behave like that also in flake e.g. by getting the page number
> > in the paint method.
>
> Actually, that would really be a huge problem.
> A lot has changed since we used Qt3 and a lot was fundamentally wrong with
> doing stuff like that in the paint method, for example we actually had
> different looking text at every zoom level. Embedding of shapes was
> practically impossible, tables was not really possible to do right etc.

I can't see what that has to do with what I proposed.

> > > So I guess you have something similar to the KWCopyShape, which makes
> > > this much easier.
> >
> > I don't think that is a solution.
>
> Can you elaborate?

The shape for the master page are the same shapes for all pages involved. They 
are on the same position etc. They are the same shapes no need to copy them.

Strange if I look in the paint method of the KWCopyShape there is exactly done 
what I proposed to do for the paint method of the text shape:

void KWCopyShape::paint(QPainter &painter, const KoViewConverter &converter)
{
    painter.setClipRect(QRectF(QPointF(0, 0), 
converter.documentToView(size()))
                        .adjusted(-2, -2, 2, 2), // adjust for anti aliassing.
                        Qt::IntersectClip);
    if (m_pageManager) {
        KoTextShapeData *data = qobject_cast<KoTextShapeData*>(m_original-
>userData());
        if (data) {
            KWPage currentPage = m_pageManager->page(this);
            KWPageTextInfo info(currentPage);
            data->relayoutFor(info);
        }
    }

    painter.save();
    m_original->paint(painter, converter);
    painter.restore();
    if (m_original->border())
        m_original->border()->paintBorder(m_original, painter, converter);
}

a relayout with the data for the current page. If that would be done in the 
paint method of the text shape it looks like it would work for kopageapp based 
applications too. 
There is one missing piece, we don't get the view to the paint method which 
would be essential for kopageapp to find out on which page we are currently 
one. This might be fixed for kopageapp based with KoCanvasResource that points 
to the current page.

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