1f8e07b45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f8e07b45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f8e07b45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f8e07b45SAndrew Rist * distributed with this work for additional information 6f8e07b45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f8e07b45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f8e07b45SAndrew Rist * "License"); you may not use this file except in compliance 9f8e07b45SAndrew Rist * with the License. You may obtain a copy of the License at 10f8e07b45SAndrew Rist * 11f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12f8e07b45SAndrew Rist * 13f8e07b45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f8e07b45SAndrew Rist * software distributed under the License is distributed on an 15f8e07b45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f8e07b45SAndrew Rist * KIND, either express or implied. See the License for the 17f8e07b45SAndrew Rist * specific language governing permissions and limitations 18f8e07b45SAndrew Rist * under the License. 19f8e07b45SAndrew Rist * 20f8e07b45SAndrew Rist *************************************************************/ 21f8e07b45SAndrew Rist 22f8e07b45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef __FRAMEWORK_HELPER_VCLSTATUSINDICATOR_HXX_ 25cdf0e10cSrcweir #define __FRAMEWORK_HELPER_VCLSTATUSINDICATOR_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir //----------------------------------------------- 28cdf0e10cSrcweir // includes of own modules 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 31cdf0e10cSrcweir #include <macros/generic.hxx> 32cdf0e10cSrcweir #include <macros/xinterface.hxx> 33cdf0e10cSrcweir #include <general.h> 34cdf0e10cSrcweir 35cdf0e10cSrcweir //----------------------------------------------- 36cdf0e10cSrcweir // includes of interfaces 37cdf0e10cSrcweir #include <com/sun/star/task/XStatusIndicator.hpp> 38cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 39cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 40cdf0e10cSrcweir 41cdf0e10cSrcweir //----------------------------------------------- 42cdf0e10cSrcweir // includes of external modules 43cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 44cdf0e10cSrcweir #include <vcl/status.hxx> 45cdf0e10cSrcweir 46cdf0e10cSrcweir //----------------------------------------------- 47cdf0e10cSrcweir // namespace 48cdf0e10cSrcweir 49cdf0e10cSrcweir namespace framework { 50cdf0e10cSrcweir 51cdf0e10cSrcweir //----------------------------------------------- 52cdf0e10cSrcweir // declaration 53cdf0e10cSrcweir 54cdf0e10cSrcweir class VCLStatusIndicator : public css::task::XStatusIndicator 55cdf0e10cSrcweir , private ThreadHelpBase // must be the first real base class! 56cdf0e10cSrcweir , public ::cppu::OWeakObject 57cdf0e10cSrcweir { 58cdf0e10cSrcweir //------------------------------------------- 59cdf0e10cSrcweir // member 60cdf0e10cSrcweir 61cdf0e10cSrcweir private: 62cdf0e10cSrcweir 63cdf0e10cSrcweir /** can be used to create own needed uno resources. */ 64cdf0e10cSrcweir css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; 65cdf0e10cSrcweir 66cdf0e10cSrcweir /** points to the parent window of this progress and 67cdf0e10cSrcweir hold it alive. */ 68cdf0e10cSrcweir css::uno::Reference< css::awt::XWindow > m_xParentWindow; 69cdf0e10cSrcweir 70cdf0e10cSrcweir /** shows the progress. 71cdf0e10cSrcweir 7207a3d7f1SPedro Giffuni @attention This member isn't synchronized using our own mutex! 73*15289133Smseidel It's guarded by the solarmutex only. Otherwise 74cdf0e10cSrcweir we have to lock two of them, which can force a deadlock ... 75cdf0e10cSrcweir */ 76cdf0e10cSrcweir StatusBar* m_pStatusBar; 77cdf0e10cSrcweir 78cdf0e10cSrcweir /** knows the current info text of the progress. */ 79cdf0e10cSrcweir ::rtl::OUString m_sText; 80cdf0e10cSrcweir 81cdf0e10cSrcweir /** knows the current range of the progress. */ 82cdf0e10cSrcweir sal_Int32 m_nRange; 83cdf0e10cSrcweir 84cdf0e10cSrcweir /** knows the current value of the progress. */ 85cdf0e10cSrcweir sal_Int32 m_nValue; 86cdf0e10cSrcweir 87cdf0e10cSrcweir //------------------------------------------- 88cdf0e10cSrcweir // interface 89cdf0e10cSrcweir 90cdf0e10cSrcweir public: 91cdf0e10cSrcweir 92cdf0e10cSrcweir FWK_DECLARE_XINTERFACE 93cdf0e10cSrcweir 94cdf0e10cSrcweir /// ctor 95cdf0e10cSrcweir VCLStatusIndicator(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , 96cdf0e10cSrcweir const css::uno::Reference< css::awt::XWindow >& xParentWindow); 97cdf0e10cSrcweir 98cdf0e10cSrcweir /// dtor 99cdf0e10cSrcweir virtual ~VCLStatusIndicator(); 100cdf0e10cSrcweir 101cdf0e10cSrcweir /// XStatusIndicator 102cdf0e10cSrcweir virtual void SAL_CALL start(const ::rtl::OUString& sText , 103cdf0e10cSrcweir sal_Int32 nRange) 104cdf0e10cSrcweir throw(css::uno::RuntimeException); 105cdf0e10cSrcweir 106cdf0e10cSrcweir virtual void SAL_CALL reset() 107cdf0e10cSrcweir throw(css::uno::RuntimeException); 108cdf0e10cSrcweir 109cdf0e10cSrcweir virtual void SAL_CALL end() 110cdf0e10cSrcweir throw(css::uno::RuntimeException); 111cdf0e10cSrcweir 112cdf0e10cSrcweir virtual void SAL_CALL setText(const ::rtl::OUString& sText) 113cdf0e10cSrcweir throw(css::uno::RuntimeException); 114cdf0e10cSrcweir 115cdf0e10cSrcweir virtual void SAL_CALL setValue(sal_Int32 nValue) 116cdf0e10cSrcweir throw(css::uno::RuntimeException); 117cdf0e10cSrcweir 118cdf0e10cSrcweir //------------------------------------------- 119cdf0e10cSrcweir // helper 120cdf0e10cSrcweir 121cdf0e10cSrcweir private: 122cdf0e10cSrcweir 123cdf0e10cSrcweir static void impl_recalcLayout(Window* pStatusBar , 124cdf0e10cSrcweir Window* pParentWindow); 125cdf0e10cSrcweir }; 126cdf0e10cSrcweir 127cdf0e10cSrcweir } // namespace framework 128cdf0e10cSrcweir 129cdf0e10cSrcweir #endif // __FRAMEWORK_HELPER_VCLSTATUSINDICATOR_HXX_ 130