Update ooo320-m1
[ooovba.git] / svx / source / cui / readonlyimage.cxx
blob77e842cac703011bd32e60cbdf71e4b6c97e70d7
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: readonlyimage.cxx,v $
10 * $Revision: 1.7 $
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_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
36 #endif
37 #include <readonlyimage.hxx>
38 #include <vcl/help.hxx>
39 #include <svx/dialmgr.hxx>
40 #ifndef _SVX_DIALOGS_HRC
41 #include <svx/dialogs.hrc>
42 #endif
43 /*-- 26.02.2004 13:31:04---------------------------------------------------
45 -----------------------------------------------------------------------*/
46 ReadOnlyImage::ReadOnlyImage(Window* pParent, const ResId rResId) :
47 FixedImage(pParent, rResId)
49 sal_Bool bHighContrast = pParent->GetDisplayBackground().GetColor().IsDark();
50 SetImage( Image(SVX_RES(bHighContrast ? RID_SVXBMP_LOCK_HC : RID_SVXBMP_LOCK )));
53 /*-- 26.02.2004 13:31:04---------------------------------------------------
55 -----------------------------------------------------------------------*/
56 ReadOnlyImage::~ReadOnlyImage()
59 /*-- 26.02.2004 13:31:04---------------------------------------------------
61 -----------------------------------------------------------------------*/
62 void ReadOnlyImage::RequestHelp( const HelpEvent& rHEvt )
64 if( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() )
66 Rectangle aLogicPix( LogicToPixel( Rectangle( Point(), GetOutputSize() ) ) );
67 Rectangle aScreenRect( OutputToScreenPixel( aLogicPix.TopLeft() ),
68 OutputToScreenPixel( aLogicPix.BottomRight() ) );
70 String aStr(ReadOnlyImage::GetHelpTip());
71 if ( Help::IsBalloonHelpEnabled() )
72 Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aScreenRect,
73 aStr );
74 else if ( Help::IsQuickHelpEnabled() )
75 Help::ShowQuickHelp( this, aScreenRect, aStr );
77 else
78 Window::RequestHelp( rHEvt );
81 /*-- 26.02.2004 14:20:21---------------------------------------------------
83 -----------------------------------------------------------------------*/
84 const String& ReadOnlyImage::GetHelpTip()
86 static String aStr(SVX_RES(RID_SVXSTR_READONLY_CONFIG_TIP));
87 return aStr;