1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_ 29 #define __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_ 30 31 //_______________________________________________ 32 // include files of own module 33 34 #include <helper/statusindicatorfactory.hxx> 35 #include <threadhelp/threadhelpbase.hxx> 36 #include <macros/xinterface.hxx> 37 #include <macros/xtypeprovider.hxx> 38 #include <macros/debug.hxx> 39 #include <macros/generic.hxx> 40 41 //_______________________________________________ 42 // include UNO interfaces 43 #include <com/sun/star/task/XStatusIndicator.hpp> 44 45 //_______________________________________________ 46 // include all others 47 #include <cppuhelper/weak.hxx> 48 #include <cppuhelper/weakref.hxx> 49 50 //_______________________________________________ 51 // namespace 52 53 namespace framework{ 54 55 //_______________________________________________ 56 // definitions 57 58 //_______________________________________________ 59 /** 60 @short implement a status indicator object 61 62 @descr With this indicator you can show a message and a progress ... 63 but you share the output device with other indicator objects, 64 if this instances was created by the same factory. 65 Then the last created object has full access to device. 66 All others change her internal data structure only. 67 68 All objects of this StatusIndicator class calls a c++ interface 69 on the StatusIndicatorFactory (where they was created). 70 The factory holds all data structures and paints the progress. 71 72 @devstatus ready to use 73 @threadsafe yes 74 */ 75 class StatusIndicator : public css::lang::XTypeProvider 76 , public css::task::XStatusIndicator 77 , private ThreadHelpBase // Order of baseclasses is neccessary for right initializaton! 78 , public ::cppu::OWeakObject // => XInterface 79 { 80 //------------------------------------------- 81 // member 82 private: 83 84 /** @short weak reference to our factory 85 @descr All our interface calls will be forwarded 86 to a suitable c++ interface on this factory. 87 But we dont hold our factory alive. They 88 correspond with e.g. with a Frame service and 89 will be owned by him. If the frame will be closed 90 he close our factory too ... 91 */ 92 css::uno::WeakReference< css::task::XStatusIndicatorFactory > m_xFactory; 93 94 //------------------------------------------- 95 // c++ interface 96 public: 97 98 //---------------------------------------- 99 /** @short initialize new instance of this class. 100 101 @param pFactory 102 pointer to our factory 103 */ 104 StatusIndicator(StatusIndicatorFactory* pFactory); 105 106 //---------------------------------------- 107 /** @short does nothing real .... 108 */ 109 virtual ~StatusIndicator(); 110 111 //------------------------------------------- 112 // uno interface 113 public: 114 115 //--------------------------------------- 116 // XInterface, XTypeProvider 117 FWK_DECLARE_XINTERFACE 118 FWK_DECLARE_XTYPEPROVIDER 119 120 //--------------------------------------- 121 // XStatusIndicator 122 virtual void SAL_CALL start(const ::rtl::OUString& sText , 123 sal_Int32 nRange) 124 throw(css::uno::RuntimeException); 125 126 virtual void SAL_CALL end() 127 throw(css::uno::RuntimeException); 128 129 virtual void SAL_CALL reset() 130 throw(css::uno::RuntimeException); 131 132 virtual void SAL_CALL setText(const ::rtl::OUString& sText) 133 throw(css::uno::RuntimeException); 134 135 virtual void SAL_CALL setValue(sal_Int32 nValue) 136 throw(css::uno::RuntimeException); 137 138 }; // class StatusIndicator 139 140 } // namespace framework 141 142 #endif // __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_ 143