[Libreoffice] Questions about OpenOffice developing

Dmitry A. Ashkadov dmitry.ashkadov at rosalab.ru
Tue Apr 26 07:20:48 PDT 2011


Hello!

> Ah - so Window is misleading, that is a very low base class. You want
> to inherit from eg. Dialog, or SystemWindow I suspect.
1. I expect this window hasn't any system borders and menus (close, 
minimize and so on). I expect this window isn't a dialog and hasn't any 
menubar (SystemWindow has the menubar). I need draw on this window, set 
its position and get mouse input from it.

> Well; you sure it is white ? I had a hack at this in the past - I
> attach my nasty patch to writer to make shockingly ugly looking
> gradients in the background ;-) hopefully it shows you where to hack.
> Having said that I think some of that code needs cleaning up really :-)
2. I did the gradient background in a same way (in _PaintDesktop() 
function), like this:

    Color col_start(0xFF, 0x00, 0x00), col_end(0x00, 0x00, 0xFF);
    Size sz = pWin->GetSizePixel(); // we get size of window containing
    a document [in pixels]
    Rectangle rect(0, 0, sz.Widht(), sz.Height());
    rect = GetOut()->PixelToLogic(rect); // convert rect of window to
    logic space
    ...
    float alpha1 = float(aRectangle.Top() - rect.Top()) /
    float(rect.Height());
    float alpha2 = float(aRectangle.Bottom() - rect.Top()) /
    float(rect.Height());
    Color c1 = (1 - alpha1)*col_start + (alpha1) *col_end; // this is
    math formula, but it is not difficult to implement in C++
    Color c2 = (1 - alpha2)*col_start + (alpha2) *col_end; // this is
    math formula, but it is not difficult to implement in C++
    GetOut()->DrawGradient(aRectangle, Gradient(GradientStyle_LINEAR,
    c1, c2));

But this solution has probably two problems. First, during scrolling the 
borders of page doesn't redraw correctly (this artifact cannot be seen 
in case of old background with one simple color). Second, the space 
between pages doesn't redraw during scrolling.
Your variant has the same problem.


26.04.2011 17:09, Michael Meeks пишет:
> Hi there !
>
> On Tue, 2011-04-26 at 12:25 +0400, Георгий Сапронов wrote:
>> Rafael Cabral from Mandriva recommended you as professional in
>> OpenOffice developing.
> 	Good man :-) but really the best thing is to CC the public development
> list: don't be afraid - we're quite friendly.
>
> 	libreoffice at lists.freedesktop.org
>
> 	please CC your replies to this there :-) it is much quicker and you get
> replies when I'm on holiday / busy etc.
>
>> I and Dmitry Ashkadov (in CC) making changes in OpenOffice. But we get
>> in trouble. We'll be glad if you could help us a little :)
> 	We love changes :-)
>
>> 1. Can we create graphical element (I mean to implement class inherit
>> from Window class VCL module) so this element can float on top of its
>> parent. What methods we should override and how add it so it can
>> receive mouse events?
> 	Ah - so Window is misleading, that is a very low base class. You want
> to inherit from eg. Dialog, or SystemWindow I suspect.
>
>> 2. In the SwEditWin class we have override Paint() function in which
>> we want to draw a background.
> 	Oooh - fun :-)
>
>>   The ViewShell class has _PaintDesktop() function where background
>> draw partly. If we comment _PaintDesktop function to prevent
>> background drawing  we'll receive white background. And if we draw
>> something in SwEditWin::Paint() we have the same white background. If
>> we comment in SwEditWin::Paint() line pWrtShell->Paint(...) background
>> will not paint in white. So we can't understand where occurs white
>> paint. What do you think?
> 	Well; you sure it is white ? I had a hack at this in the past - I
> attach my nasty patch to writer to make shockingly ugly looking
> gradients in the background ;-) hopefully it shows you where to hack.
> Having said that I think some of that code needs cleaning up really :-)
>
> 	ATB,
>
> 		Michael.
>


-- 
С Уважением,
Дмитрий

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110426/bd82922f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gradient.diff
Type: text/x-patch
Size: 1057 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110426/bd82922f/attachment-0001.bin>
-------------- next part --------------
An embedded message was scrubbed...
From: Michael Meeks <michael.meeks at novell.com>
Subject: simple app background gradients ...
Date: Fri, 28 Jan 2011 18:20:55 +0000
Size: 5640
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110426/bd82922f/attachment-0001.eml>


More information about the LibreOffice mailing list