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 #pragma once 21 22 #include <com/sun/star/awt/XLayoutConstrains.hpp> 23 #include <com/sun/star/task/XStatusIndicator.hpp> 24 #include <rtl/ref.hxx> 25 26 #include <basecontainercontrol.hxx> 27 28 namespace com::sun::star::awt { class XControlModel; } 29 namespace com::sun::star::awt { class XFixedText; } 30 namespace com::sun::star::awt { class XGraphics; } 31 namespace com::sun::star::awt { class XToolkit; } 32 namespace com::sun::star::awt { class XWindowPeer; } 33 34 namespace unocontrols { 35 36 class ProgressBar; 37 38 #define STATUSINDICATOR_FREEBORDER 5 // border around and between the controls 39 #define STATUSINDICATOR_BACKGROUNDCOLOR sal_Int32(Color( 0xC0, 0xC0, 0xC0 )) // lightgray 40 #define STATUSINDICATOR_LINECOLOR_BRIGHT sal_Int32(Color( 0xFF, 0xFF, 0xFF )) // white 41 #define STATUSINDICATOR_LINECOLOR_SHADOW sal_Int32(Color( 0x00, 0x00, 0x00 )) // black 42 #define STATUSINDICATOR_DEFAULT_WIDTH 300 43 #define STATUSINDICATOR_DEFAULT_HEIGHT 25 44 45 class StatusIndicator final : public css::awt::XLayoutConstrains 46 , public css::task::XStatusIndicator 47 , public BaseContainerControl 48 { 49 public: 50 StatusIndicator( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); 51 52 virtual ~StatusIndicator() override; 53 54 // XInterface 55 56 /** 57 @short give answer, if interface is supported 58 @descr The interfaces are searched by type. 59 60 @seealso XInterface 61 62 @param "rType" is the type of searched interface. 63 64 @return Any information about found interface 65 66 @onerror A RuntimeException is thrown. 67 */ 68 69 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; 70 71 /** 72 @short increment refcount 73 @seealso XInterface 74 @seealso release() 75 @onerror A RuntimeException is thrown. 76 */ 77 78 virtual void SAL_CALL acquire() noexcept override; 79 80 /** 81 @short decrement refcount 82 @seealso XInterface 83 @seealso acquire() 84 @onerror A RuntimeException is thrown. 85 */ 86 87 virtual void SAL_CALL release() noexcept override; 88 89 // XTypeProvider 90 91 /** 92 @short get information about supported interfaces 93 @seealso XTypeProvider 94 @return Sequence of types of all supported interfaces 95 96 @onerror A RuntimeException is thrown. 97 */ 98 99 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; 100 101 // XAggregation 102 103 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override; 104 105 // XStatusIndicator 106 107 virtual void SAL_CALL start( 108 const OUString& sText , 109 sal_Int32 nRange 110 ) override; 111 112 virtual void SAL_CALL end() override; 113 114 virtual void SAL_CALL reset() override; 115 116 virtual void SAL_CALL setText( const OUString& sText ) override; 117 118 virtual void SAL_CALL setValue( sal_Int32 nValue ) override; 119 120 // XLayoutConstrains 121 122 virtual css::awt::Size SAL_CALL getMinimumSize() override; 123 124 virtual css::awt::Size SAL_CALL getPreferredSize() override; 125 126 virtual css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; 127 128 // XControl 129 130 virtual void SAL_CALL createPeer( 131 const css::uno::Reference< css::awt::XToolkit >& xToolkit , 132 const css::uno::Reference< css::awt::XWindowPeer >& xParent 133 ) override; 134 135 virtual sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& xModel ) override; 136 137 virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override; 138 139 // XComponent 140 141 virtual void SAL_CALL dispose() override; 142 143 // XWindow 144 145 virtual void SAL_CALL setPosSize( sal_Int32 nX , 146 sal_Int32 nY , 147 sal_Int32 nWidth , 148 sal_Int32 nHeight , 149 sal_Int16 nFlags ) override; 150 151 private: 152 virtual css::awt::WindowDescriptor impl_getWindowDescriptor( 153 const css::uno::Reference< css::awt::XWindowPeer >& xParentPeer 154 ) override; 155 156 virtual void impl_paint ( 157 sal_Int32 nX, 158 sal_Int32 nY, 159 const css::uno::Reference< css::awt::XGraphics > & rGraphics 160 ) override; 161 162 virtual void impl_recalcLayout( const css::awt::WindowEvent& aEvent ) override; 163 164 css::uno::Reference< css::awt::XFixedText > m_xText; 165 rtl::Reference<ProgressBar> m_xProgressBar; 166 167 }; 168 169 } 170 171 172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 173