Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <uielement/logoimagestatusbarcontroller.hxx>
21 : #include <classes/fwlresid.hxx>
22 : #include <services.h>
23 : #include <classes/resource.hrc>
24 : #include <osl/mutex.hxx>
25 : #include <vcl/svapp.hxx>
26 : #include <vcl/window.hxx>
27 : #include <vcl/status.hxx>
28 : #include <toolkit/unohlp.hxx>
29 : #include <toolkit/helper/convert.hxx>
30 :
31 : using namespace ::rtl;
32 : using namespace ::cppu;
33 : using namespace ::com::sun::star;
34 : using namespace ::com::sun::star::uno;
35 : using namespace ::com::sun::star::lang;
36 : using namespace ::com::sun::star::frame;
37 :
38 : namespace framework
39 : {
40 :
41 0 : DEFINE_XSERVICEINFO_MULTISERVICE ( LogoImageStatusbarController ,
42 : OWeakObject ,
43 : SERVICENAME_STATUSBARCONTROLLER ,
44 : IMPLEMENTATIONNAME_LOGOIMAGESTATUSBARCONTROLLER
45 : )
46 :
47 0 : DEFINE_INIT_SERVICE ( LogoImageStatusbarController, {} )
48 :
49 0 : LogoImageStatusbarController::LogoImageStatusbarController( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
50 0 : svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), rtl::OUString(), 0 )
51 : {
52 0 : Image aImage( FwlResId( RID_IMAGE_STATUSBAR_LOGO ));
53 0 : m_aLogoImage = aImage;
54 0 : }
55 :
56 0 : LogoImageStatusbarController::~LogoImageStatusbarController()
57 : {
58 0 : }
59 :
60 : // XInterface
61 0 : Any SAL_CALL LogoImageStatusbarController::queryInterface( const Type& rType )
62 : throw ( RuntimeException )
63 : {
64 0 : return svt::StatusbarController::queryInterface( rType );
65 : }
66 :
67 0 : void SAL_CALL LogoImageStatusbarController::acquire() throw ()
68 : {
69 0 : svt::StatusbarController::acquire();
70 0 : }
71 :
72 0 : void SAL_CALL LogoImageStatusbarController::release() throw ()
73 : {
74 0 : svt::StatusbarController::release();
75 0 : }
76 :
77 0 : void SAL_CALL LogoImageStatusbarController::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
78 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
79 : {
80 0 : SolarMutexGuard aSolarMutexGuard;
81 :
82 0 : svt::StatusbarController::initialize( aArguments );
83 0 : }
84 :
85 : // XComponent
86 0 : void SAL_CALL LogoImageStatusbarController::dispose()
87 : throw (::com::sun::star::uno::RuntimeException)
88 : {
89 0 : svt::StatusbarController::dispose();
90 0 : }
91 :
92 : // XEventListener
93 0 : void SAL_CALL LogoImageStatusbarController::disposing( const EventObject& Source )
94 : throw ( RuntimeException )
95 : {
96 0 : svt::StatusbarController::disposing( Source );
97 0 : }
98 :
99 : // XStatusListener
100 0 : void SAL_CALL LogoImageStatusbarController::statusChanged( const FeatureStateEvent& )
101 : throw ( RuntimeException )
102 : {
103 0 : }
104 :
105 : // XStatusbarController
106 0 : ::sal_Bool SAL_CALL LogoImageStatusbarController::mouseButtonDown(
107 : const awt::MouseEvent& )
108 : throw (::com::sun::star::uno::RuntimeException)
109 : {
110 0 : return sal_False;
111 : }
112 :
113 0 : ::sal_Bool SAL_CALL LogoImageStatusbarController::mouseMove(
114 : const awt::MouseEvent& )
115 : throw (::com::sun::star::uno::RuntimeException)
116 : {
117 0 : return sal_False;
118 : }
119 :
120 0 : ::sal_Bool SAL_CALL LogoImageStatusbarController::mouseButtonUp(
121 : const awt::MouseEvent& )
122 : throw (::com::sun::star::uno::RuntimeException)
123 : {
124 0 : return sal_False;
125 : }
126 :
127 0 : void SAL_CALL LogoImageStatusbarController::command(
128 : const awt::Point& aPos,
129 : ::sal_Int32 nCommand,
130 : ::sal_Bool bMouseEvent,
131 : const ::com::sun::star::uno::Any& aData )
132 : throw (::com::sun::star::uno::RuntimeException)
133 : {
134 0 : svt::StatusbarController::command( aPos, nCommand, bMouseEvent, aData );
135 0 : }
136 :
137 0 : void SAL_CALL LogoImageStatusbarController::paint(
138 : const ::com::sun::star::uno::Reference< awt::XGraphics >& xGraphics,
139 : const awt::Rectangle& rOutputRectangle,
140 : ::sal_Int32 /*nItemId*/,
141 : ::sal_Int32 /*nStyle*/ )
142 : throw (::com::sun::star::uno::RuntimeException)
143 : {
144 0 : SolarMutexGuard aGuard;
145 :
146 0 : OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( xGraphics );;
147 0 : if ( pOutDev )
148 : {
149 0 : ::Rectangle aRect = VCLRectangle( rOutputRectangle );
150 0 : pOutDev->DrawImage( aRect.TopLeft(), aRect.GetSize(), m_aLogoImage );
151 0 : }
152 0 : }
153 :
154 0 : void SAL_CALL LogoImageStatusbarController::click()
155 : throw (::com::sun::star::uno::RuntimeException)
156 : {
157 0 : svt::StatusbarController::click();
158 0 : }
159 :
160 0 : void SAL_CALL LogoImageStatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException)
161 : {
162 0 : svt::StatusbarController::doubleClick();
163 0 : }
164 :
165 : }
166 :
167 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|