1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_cui.hxx"
26
27 #include <readonlyimage.hxx>
28 #include <vcl/help.hxx>
29 #include <dialmgr.hxx>
30 #include <cuires.hrc>
31
32 /*-- 26.02.2004 13:31:04---------------------------------------------------
33
34 -----------------------------------------------------------------------*/
ReadOnlyImage(Window * pParent,const ResId rResId)35 ReadOnlyImage::ReadOnlyImage(Window* pParent, const ResId rResId) :
36 FixedImage(pParent, rResId)
37 {
38 sal_Bool bHighContrast = pParent->GetSettings().GetStyleSettings().GetHighContrastMode();
39 SetImage( Image(CUI_RES(bHighContrast ? RID_SVXBMP_LOCK_HC : RID_SVXBMP_LOCK )));
40 }
41
42 /*-- 26.02.2004 13:31:04---------------------------------------------------
43
44 -----------------------------------------------------------------------*/
~ReadOnlyImage()45 ReadOnlyImage::~ReadOnlyImage()
46 {
47 }
48 /*-- 26.02.2004 13:31:04---------------------------------------------------
49
50 -----------------------------------------------------------------------*/
RequestHelp(const HelpEvent & rHEvt)51 void ReadOnlyImage::RequestHelp( const HelpEvent& rHEvt )
52 {
53 if( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() )
54 {
55 Rectangle aLogicPix( LogicToPixel( Rectangle( Point(), GetOutputSize() ) ) );
56 Rectangle aScreenRect( OutputToScreenPixel( aLogicPix.TopLeft() ),
57 OutputToScreenPixel( aLogicPix.BottomRight() ) );
58
59 String aStr(ReadOnlyImage::GetHelpTip());
60 if ( Help::IsBalloonHelpEnabled() )
61 Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aScreenRect,
62 aStr );
63 else if ( Help::IsQuickHelpEnabled() )
64 Help::ShowQuickHelp( this, aScreenRect, aStr );
65 }
66 else
67 Window::RequestHelp( rHEvt );
68 }
69
70 /*-- 26.02.2004 14:20:21---------------------------------------------------
71
72 -----------------------------------------------------------------------*/
GetHelpTip()73 const String& ReadOnlyImage::GetHelpTip()
74 {
75 static String aStr(CUI_RES(RID_SVXSTR_READONLY_CONFIG_TIP));
76 return aStr;
77 }
78