update dev300-m58
[ooovba.git] / sd / source / ui / toolpanel / EmptyWindow.cxx
blob337b980ba960f071037dd32387088801c22dc52d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: EmptyWindow.cxx,v $
10 * $Revision: 1.6 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include "EmptyWindow.hxx"
36 namespace sd { namespace toolpanel {
39 EmptyWindow::EmptyWindow (
40 Window* pParentWindow,
41 Color aBackgroundColor,
42 const String& rText)
43 : Window (pParentWindow, WinBits()),
44 msText (rText)
46 SetBackground (aBackgroundColor);
52 EmptyWindow::~EmptyWindow (void)
59 void EmptyWindow::Paint (const Rectangle& )
61 Size aWindowSize (GetOutputSizePixel());
62 Point aPosition(aWindowSize.Width()/2,aWindowSize.Height()/2);
64 Rectangle aBBox;
65 aPosition = Point(10,aWindowSize.Height()/2);
66 if (GetTextBoundRect (aBBox, msText))
67 aPosition = Point (
68 (aWindowSize.Width()-aBBox.GetWidth())/2,
69 (aWindowSize.Height()-aBBox.GetHeight())/2);
70 DrawText (aPosition, msText);
72 String sSizeString = String::CreateFromInt32(aWindowSize.Width());
73 sSizeString.Append (String::CreateFromAscii(" x "));
74 sSizeString.Append (String::CreateFromInt32(aWindowSize.Height()));
75 if (GetTextBoundRect (aBBox, sSizeString))
76 aPosition = Point (
77 (aWindowSize.Width()-aBBox.GetWidth())/2,
78 aPosition.Y() + GetTextHeight() + aBBox.GetHeight());
79 DrawText (aPosition, sSizeString);
85 void EmptyWindow::Resize (void)
87 Window::Resize();
93 void EmptyWindow::GetFocus (void)
95 GetParent()->GrabFocus();
99 } } // end of namespace ::sd::tpv