1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: graphwin.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <soldep/graphwin.hxx>
32 //#include "depapp.hxx"
33 #include <soldep/soldep.hxx>
36 GraphWin::GraphWin( Window
* pParent
, void * pClass
)
37 : ScrollableWindow( pParent
, 0L, SCRWIN_DEFAULT
| SCRWIN_VCENTER
| SCRWIN_HCENTER
)
38 , aBufferWindow( this )
41 SetSizePixel( pParent
->GetSizePixel());
42 SetPosPixel( pParent
->GetPosPixel());
43 SetTotalSize( Size( 2000,2000 ));
45 aBufferWindow
.SetBackground( Wallpaper( Color( COL_WHITE
)));
46 aBufferWindow
.SetPosSizePixel( PIXELS( 0, 0, 2000, 2000 ) );
47 aBufferWindow
.Show(); // Content
48 Show(); // Window with Scrollbars
51 void GraphWin::EndScroll( long nDeltaX
, long nDeltaY
)
53 // get the visible area
54 Rectangle
aArea( GetVisibleArea());
55 long nX
= aArea
.Right();
56 long nY
= aArea
.Bottom();
58 // set the new pos and size by using LogicToPixel (this is mandatory)
59 aBufferWindow
.SetPosSizePixel( LogicToPixel( Point( 0, 0 )),
60 LogicToPixel( Size( nX
, nY
)));
61 aBufferWindow
.Invalidate();
64 void GraphWin::Resize()
66 // get the visible area
67 ScrollableWindow::Resize();
68 Rectangle
aArea( GetVisibleArea());
69 long nX
= aArea
.Right();
70 long nY
= aArea
.Bottom();
72 // set the new pos and size by using LogicToPixel (this is mandatory)
73 aBufferWindow
.SetPosSizePixel( LogicToPixel( Point( 0, 0 )),
74 LogicToPixel( Size( nX
, nY
)));
77 void GraphWin::Command( const CommandEvent
& rEvent
)
79 ScrollableWindow::Command( rEvent
);