1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 29*cdf0e10cSrcweir // my own includes 30*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include "progressmonitor.hxx" 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 35*cdf0e10cSrcweir // includes of other projects 36*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 37*cdf0e10cSrcweir #include <com/sun/star/awt/GradientStyle.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/awt/RasterOperation.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/awt/Gradient.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/awt/XGraphics.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp> 42*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 43*cdf0e10cSrcweir #include <tools/debug.hxx> 44*cdf0e10cSrcweir #include <tools/solar.h> 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 47*cdf0e10cSrcweir // includes of my project 48*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 49*cdf0e10cSrcweir #include "progressbar.hxx" 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 52*cdf0e10cSrcweir // namespace 53*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir using namespace ::cppu ; 56*cdf0e10cSrcweir using namespace ::osl ; 57*cdf0e10cSrcweir using namespace ::rtl ; 58*cdf0e10cSrcweir using namespace ::com::sun::star::uno ; 59*cdf0e10cSrcweir using namespace ::com::sun::star::lang ; 60*cdf0e10cSrcweir using namespace ::com::sun::star::awt ; 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir namespace unocontrols{ 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 65*cdf0e10cSrcweir // construct/destruct 66*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFactory ) 69*cdf0e10cSrcweir : BaseContainerControl ( xFactory ) 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir // Its not allowed to work with member in this method (refcounter !!!) 72*cdf0e10cSrcweir // But with a HACK (++refcount) its "OK" :-( 73*cdf0e10cSrcweir ++m_refCount ; 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir // Create instances for fixedtext, button and progress ... 76*cdf0e10cSrcweir m_xTopic_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; 77*cdf0e10cSrcweir m_xText_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; 78*cdf0e10cSrcweir m_xTopic_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; 79*cdf0e10cSrcweir m_xText_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; 80*cdf0e10cSrcweir m_xButton = Reference< XButton > ( xFactory->createInstance ( OUString::createFromAscii( BUTTON_SERVICENAME ) ), UNO_QUERY ) ; 81*cdf0e10cSrcweir m_xProgressBar = Reference< XProgressBar > ( xFactory->createInstance ( OUString::createFromAscii( SERVICENAME_PROGRESSBAR ) ), UNO_QUERY ) ; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir // ... cast controls to Reference< XControl > (for "setModel"!) ... 84*cdf0e10cSrcweir Reference< XControl > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ; 85*cdf0e10cSrcweir Reference< XControl > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ; 86*cdf0e10cSrcweir Reference< XControl > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; 87*cdf0e10cSrcweir Reference< XControl > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ; 88*cdf0e10cSrcweir Reference< XControl > xRef_Button ( m_xButton , UNO_QUERY ) ; 89*cdf0e10cSrcweir Reference< XControl > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir // ... set models ... 92*cdf0e10cSrcweir xRef_Topic_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; 93*cdf0e10cSrcweir xRef_Text_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; 94*cdf0e10cSrcweir xRef_Topic_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; 95*cdf0e10cSrcweir xRef_Text_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; 96*cdf0e10cSrcweir xRef_Button->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( BUTTON_MODELNAME ) ), UNO_QUERY ) ) ; 97*cdf0e10cSrcweir // ProgressBar has no model !!! 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir // ... and add controls to basecontainercontrol! 100*cdf0e10cSrcweir addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Topic_Top ) ; 101*cdf0e10cSrcweir addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Text_Top ) ; 102*cdf0e10cSrcweir addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Topic_Bottom ) ; 103*cdf0e10cSrcweir addControl ( OUString::createFromAscii( CONTROLNAME_TEXT ) , xRef_Text_Bottom ) ; 104*cdf0e10cSrcweir addControl ( OUString::createFromAscii( CONTROLNAME_BUTTON ) , xRef_Button ) ; 105*cdf0e10cSrcweir addControl ( OUString::createFromAscii( CONTROLNAME_PROGRESSBAR ) , xRef_ProgressBar ) ; 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir // FixedText make it automaticly visible by himself ... but not the progressbar !!! 108*cdf0e10cSrcweir // it must be set explicitly 109*cdf0e10cSrcweir Reference< XWindow > xWindowRef_ProgressBar( m_xProgressBar, UNO_QUERY ); 110*cdf0e10cSrcweir xWindowRef_ProgressBar->setVisible( sal_True ); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir // Reset to defaults !!! 113*cdf0e10cSrcweir // (progressbar take automaticly its own defaults) 114*cdf0e10cSrcweir m_xButton->setLabel ( OUString::createFromAscii( DEFAULT_BUTTONLABEL ) ) ; 115*cdf0e10cSrcweir m_xTopic_Top->setText ( OUString::createFromAscii( DEFAULT_TOPIC ) ) ; 116*cdf0e10cSrcweir m_xText_Top->setText ( OUString::createFromAscii( DEFAULT_TEXT ) ) ; 117*cdf0e10cSrcweir m_xTopic_Bottom->setText ( OUString::createFromAscii( DEFAULT_TOPIC ) ) ; 118*cdf0e10cSrcweir m_xText_Bottom->setText ( OUString::createFromAscii( DEFAULT_TEXT ) ) ; 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir --m_refCount ; 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir // Initialize info lists for fixedtext's 123*cdf0e10cSrcweir m_pTextlist_Top = new IMPL_Textlist ; 124*cdf0e10cSrcweir m_pTextlist_Bottom = new IMPL_Textlist ; 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir ProgressMonitor::~ProgressMonitor() 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir impl_cleanMemory () ; 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 133*cdf0e10cSrcweir // XInterface 134*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir Any SAL_CALL ProgressMonitor::queryInterface( const Type& rType ) throw( RuntimeException ) 137*cdf0e10cSrcweir { 138*cdf0e10cSrcweir // Attention: 139*cdf0e10cSrcweir // Don't use mutex or guard in this method!!! Is a method of XInterface. 140*cdf0e10cSrcweir Any aReturn ; 141*cdf0e10cSrcweir Reference< XInterface > xDel = BaseContainerControl::impl_getDelegator(); 142*cdf0e10cSrcweir if ( xDel.is() ) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir // If an delegator exist, forward question to his queryInterface. 145*cdf0e10cSrcweir // Delegator will ask his own queryAggregation! 146*cdf0e10cSrcweir aReturn = xDel->queryInterface( rType ); 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir else 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir // If an delegator unknown, forward question to own queryAggregation. 151*cdf0e10cSrcweir aReturn = queryAggregation( rType ); 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir return aReturn ; 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 158*cdf0e10cSrcweir // XInterface 159*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::acquire() throw() 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir // Attention: 164*cdf0e10cSrcweir // Don't use mutex or guard in this method!!! Is a method of XInterface. 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir // Forward to baseclass 167*cdf0e10cSrcweir BaseControl::acquire(); 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 171*cdf0e10cSrcweir // XInterface 172*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::release() throw() 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir // Attention: 177*cdf0e10cSrcweir // Don't use mutex or guard in this method!!! Is a method of XInterface. 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir // Forward to baseclass 180*cdf0e10cSrcweir BaseControl::release(); 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 184*cdf0e10cSrcweir // XTypeProvider 185*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir Sequence< Type > SAL_CALL ProgressMonitor::getTypes() throw( RuntimeException ) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir // Optimize this method ! 190*cdf0e10cSrcweir // We initialize a static variable only one time. And we don't must use a mutex at every call! 191*cdf0e10cSrcweir // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! 192*cdf0e10cSrcweir static OTypeCollection* pTypeCollection = NULL ; 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir if ( pTypeCollection == NULL ) 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir // Ready for multithreading; get global mutex for first call of this method only! see before 197*cdf0e10cSrcweir MutexGuard aGuard( Mutex::getGlobalMutex() ); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir // Control these pointer again ... it can be, that another instance will be faster then these! 200*cdf0e10cSrcweir if ( pTypeCollection == NULL ) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir // Create a static typecollection ... 203*cdf0e10cSrcweir static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XLayoutConstrains >*)NULL ) , 204*cdf0e10cSrcweir ::getCppuType(( const Reference< XButton >*)NULL ) , 205*cdf0e10cSrcweir ::getCppuType(( const Reference< XProgressMonitor >*)NULL ) , 206*cdf0e10cSrcweir BaseContainerControl::getTypes() 207*cdf0e10cSrcweir ); 208*cdf0e10cSrcweir // ... and set his address to static pointer! 209*cdf0e10cSrcweir pTypeCollection = &aTypeCollection ; 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir return pTypeCollection->getTypes(); 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 217*cdf0e10cSrcweir // XAggregation 218*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir Any SAL_CALL ProgressMonitor::queryAggregation( const Type& aType ) throw( RuntimeException ) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir // Ask for my own supported interfaces ... 223*cdf0e10cSrcweir // Attention: XTypeProvider and XInterface are supported by OComponentHelper! 224*cdf0e10cSrcweir Any aReturn ( ::cppu::queryInterface( aType , 225*cdf0e10cSrcweir static_cast< XLayoutConstrains* > ( this ) , 226*cdf0e10cSrcweir static_cast< XButton* > ( this ) , 227*cdf0e10cSrcweir static_cast< XProgressMonitor* > ( this ) 228*cdf0e10cSrcweir ) 229*cdf0e10cSrcweir ); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir // If searched interface not supported by this class ... 232*cdf0e10cSrcweir if ( aReturn.hasValue() == sal_False ) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir // ... ask baseclasses. 235*cdf0e10cSrcweir aReturn = BaseControl::queryAggregation( aType ); 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir return aReturn ; 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 242*cdf0e10cSrcweir // XProgressMonitor 243*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::addText( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress ) throw( RuntimeException ) 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir // Safe impossible cases 248*cdf0e10cSrcweir // Check valid call of this method. 249*cdf0e10cSrcweir DBG_ASSERT ( impl_debug_checkParameter ( rTopic, rText, bbeforeProgress ) , "ProgressMonitor::addText()\nCall without valid parameters!\n") ; 250*cdf0e10cSrcweir DBG_ASSERT ( !(impl_searchTopic ( rTopic, bbeforeProgress ) != NULL ) , "ProgresMonitor::addText()\nThe text already exist.\n" ) ; 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir // Do nothing (in Release), if topic already exist. 253*cdf0e10cSrcweir if ( impl_searchTopic ( rTopic, bbeforeProgress ) != NULL ) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir return ; 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir // Else ... take memory for new item ... 259*cdf0e10cSrcweir IMPL_TextlistItem* pTextItem = new IMPL_TextlistItem ; 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir if ( pTextItem != NULL ) 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir // Set values ... 264*cdf0e10cSrcweir pTextItem->sTopic = rTopic ; 265*cdf0e10cSrcweir pTextItem->sText = rText ; 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir // Ready for multithreading 268*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir // ... and insert it in right list. 271*cdf0e10cSrcweir if ( bbeforeProgress == sal_True ) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir m_pTextlist_Top->Insert ( pTextItem, LIST_APPEND ) ; 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir else 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir m_pTextlist_Bottom->Insert ( pTextItem, LIST_APPEND ) ; 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir // ... update window 282*cdf0e10cSrcweir impl_rebuildFixedText () ; 283*cdf0e10cSrcweir impl_recalcLayout () ; 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 287*cdf0e10cSrcweir // XProgressMonitor 288*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::removeText ( const OUString& rTopic, sal_Bool bbeforeProgress ) throw( RuntimeException ) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir // Safe impossible cases 293*cdf0e10cSrcweir // Check valid call of this method. 294*cdf0e10cSrcweir DBG_ASSERT ( impl_debug_checkParameter ( rTopic, bbeforeProgress ), "ProgressMonitor::removeText()\nCall without valid parameters!\n" ) ; 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir // Search the topic ... 297*cdf0e10cSrcweir IMPL_TextlistItem* pSearchItem = impl_searchTopic ( rTopic, bbeforeProgress ) ; 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir if ( pSearchItem != NULL ) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir // Ready for multithreading 302*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir // ... delete item from right list ... 305*cdf0e10cSrcweir if ( bbeforeProgress == sal_True ) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir m_pTextlist_Top->Remove ( pSearchItem ) ; 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir else 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir m_pTextlist_Bottom->Remove ( pSearchItem ) ; 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir delete pSearchItem ; 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir // ... and update window. 317*cdf0e10cSrcweir impl_rebuildFixedText () ; 318*cdf0e10cSrcweir impl_recalcLayout () ; 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 323*cdf0e10cSrcweir // XProgressMonitor 324*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::updateText ( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress ) throw( RuntimeException ) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir // Safe impossible cases 329*cdf0e10cSrcweir // Check valid call of this method. 330*cdf0e10cSrcweir DBG_ASSERT ( impl_debug_checkParameter ( rTopic, rText, bbeforeProgress ), "ProgressMonitor::updateText()\nCall without valid parameters!\n" ) ; 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir // Search topic ... 333*cdf0e10cSrcweir IMPL_TextlistItem* pSearchItem = impl_searchTopic ( rTopic, bbeforeProgress ) ; 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir if ( pSearchItem != NULL ) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir // Ready for multithreading 338*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir // ... update text ... 341*cdf0e10cSrcweir pSearchItem->sText = rText ; 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir // ... and update window. 344*cdf0e10cSrcweir impl_rebuildFixedText () ; 345*cdf0e10cSrcweir impl_recalcLayout () ; 346*cdf0e10cSrcweir } 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 350*cdf0e10cSrcweir // XProgressBar 351*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::setForegroundColor ( sal_Int32 nColor ) throw( RuntimeException ) 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir // Ready for multithreading 356*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir if ( m_xProgressBar.is () ) 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir m_xProgressBar->setForegroundColor ( nColor ) ; 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 365*cdf0e10cSrcweir // XProgressBar 366*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::setBackgroundColor ( sal_Int32 nColor ) throw( RuntimeException ) 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir // Ready for multithreading 371*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir if ( m_xProgressBar.is () ) 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir m_xProgressBar->setBackgroundColor ( nColor ) ; 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 380*cdf0e10cSrcweir // XProgressBar 381*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::setValue ( sal_Int32 nValue ) throw( RuntimeException ) 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir // Ready for multithreading 386*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir if ( m_xProgressBar.is () ) 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir m_xProgressBar->setValue ( nValue ) ; 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 395*cdf0e10cSrcweir // XProgressBar 396*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::setRange ( sal_Int32 nMin, sal_Int32 nMax ) throw( RuntimeException ) 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir // Ready for multithreading 401*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir if ( m_xProgressBar.is () ) 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir m_xProgressBar->setRange ( nMin, nMax ) ; 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir } 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 410*cdf0e10cSrcweir // XProgressBar 411*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir sal_Int32 SAL_CALL ProgressMonitor::getValue () throw( RuntimeException ) 414*cdf0e10cSrcweir { 415*cdf0e10cSrcweir // Ready for multithreading 416*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir if (m_xProgressBar.is()) 419*cdf0e10cSrcweir { 420*cdf0e10cSrcweir return m_xProgressBar->getValue () ; 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir return 0 ; 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 427*cdf0e10cSrcweir // XButton 428*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 429*cdf0e10cSrcweir 430*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::addActionListener ( const Reference< XActionListener > & rListener ) throw( RuntimeException ) 431*cdf0e10cSrcweir { 432*cdf0e10cSrcweir // Ready for multithreading 433*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir if ( m_xButton.is () ) 436*cdf0e10cSrcweir { 437*cdf0e10cSrcweir m_xButton->addActionListener ( rListener ) ; 438*cdf0e10cSrcweir } 439*cdf0e10cSrcweir } 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 442*cdf0e10cSrcweir // XButton 443*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::removeActionListener ( const Reference< XActionListener > & rListener ) throw( RuntimeException ) 446*cdf0e10cSrcweir { 447*cdf0e10cSrcweir // Ready for multithreading 448*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir if ( m_xButton.is () ) 451*cdf0e10cSrcweir { 452*cdf0e10cSrcweir m_xButton->removeActionListener ( rListener ) ; 453*cdf0e10cSrcweir } 454*cdf0e10cSrcweir } 455*cdf0e10cSrcweir 456*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 457*cdf0e10cSrcweir // XButton 458*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::setLabel ( const OUString& rLabel ) throw( RuntimeException ) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir // Ready for multithreading 463*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir if ( m_xButton.is () ) 466*cdf0e10cSrcweir { 467*cdf0e10cSrcweir m_xButton->setLabel ( rLabel ) ; 468*cdf0e10cSrcweir } 469*cdf0e10cSrcweir } 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 472*cdf0e10cSrcweir // XButton 473*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::setActionCommand ( const OUString& rCommand ) throw( RuntimeException ) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir // Ready for multithreading 478*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir if ( m_xButton.is () ) 481*cdf0e10cSrcweir { 482*cdf0e10cSrcweir m_xButton->setActionCommand ( rCommand ) ; 483*cdf0e10cSrcweir } 484*cdf0e10cSrcweir } 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 487*cdf0e10cSrcweir // XLayoutConstrains 488*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir Size SAL_CALL ProgressMonitor::getMinimumSize () throw( RuntimeException ) 491*cdf0e10cSrcweir { 492*cdf0e10cSrcweir return Size (DEFAULT_WIDTH, DEFAULT_HEIGHT) ; 493*cdf0e10cSrcweir } 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 496*cdf0e10cSrcweir // XLayoutConstrains 497*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir Size SAL_CALL ProgressMonitor::getPreferredSize () throw( RuntimeException ) 500*cdf0e10cSrcweir { 501*cdf0e10cSrcweir // Ready for multithreading 502*cdf0e10cSrcweir ClearableMutexGuard aGuard ( m_aMutex ) ; 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir // get information about required place of child controls 505*cdf0e10cSrcweir Reference< XLayoutConstrains > xTopicLayout_Top ( m_xTopic_Top , UNO_QUERY ) ; 506*cdf0e10cSrcweir Reference< XLayoutConstrains > xTopicLayout_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; 507*cdf0e10cSrcweir Reference< XLayoutConstrains > xButtonLayout ( m_xButton , UNO_QUERY ) ; 508*cdf0e10cSrcweir Reference< XWindow > xProgressBarWindow ( m_xProgressBar , UNO_QUERY ) ; 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir Size aTopicSize_Top = xTopicLayout_Top->getPreferredSize (); 511*cdf0e10cSrcweir Size aTopicSize_Bottom = xTopicLayout_Bottom->getPreferredSize (); 512*cdf0e10cSrcweir Size aButtonSize = xButtonLayout->getPreferredSize (); 513*cdf0e10cSrcweir Rectangle aTempRectangle = xProgressBarWindow->getPosSize (); 514*cdf0e10cSrcweir Size aProgressBarSize = Size( aTempRectangle.Width, aTempRectangle.Height ); 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir aGuard.clear () ; 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir // calc preferred size of progressmonitor 519*cdf0e10cSrcweir sal_Int32 nWidth = 0 ; 520*cdf0e10cSrcweir sal_Int32 nHeight = 0 ; 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir nWidth = 3 * FREEBORDER ; 523*cdf0e10cSrcweir nWidth += aProgressBarSize.Width ; 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir nHeight = 6 * FREEBORDER ; 526*cdf0e10cSrcweir nHeight += aTopicSize_Top.Height ; 527*cdf0e10cSrcweir nHeight += aProgressBarSize.Height ; 528*cdf0e10cSrcweir nHeight += aTopicSize_Bottom.Height; 529*cdf0e10cSrcweir nHeight += 2 ; // 1 for black line, 1 for white line = 3D-Line! 530*cdf0e10cSrcweir nHeight += aButtonSize.Height ; 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir // norm to minimum 533*cdf0e10cSrcweir if ( nWidth<DEFAULT_WIDTH ) 534*cdf0e10cSrcweir { 535*cdf0e10cSrcweir nWidth = DEFAULT_WIDTH ; 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir if ( nHeight<DEFAULT_HEIGHT ) 538*cdf0e10cSrcweir { 539*cdf0e10cSrcweir nHeight = DEFAULT_HEIGHT ; 540*cdf0e10cSrcweir } 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir // return to caller 543*cdf0e10cSrcweir return Size ( nWidth, nHeight ) ; 544*cdf0e10cSrcweir } 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 547*cdf0e10cSrcweir // XLayoutConstrains 548*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir Size SAL_CALL ProgressMonitor::calcAdjustedSize ( const Size& /*rNewSize*/ ) throw( RuntimeException ) 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir return getPreferredSize () ; 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 556*cdf0e10cSrcweir // XControl 557*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::createPeer ( const Reference< XToolkit > & rToolkit, const Reference< XWindowPeer > & rParent ) throw( RuntimeException ) 560*cdf0e10cSrcweir { 561*cdf0e10cSrcweir if (!getPeer().is()) 562*cdf0e10cSrcweir { 563*cdf0e10cSrcweir BaseContainerControl::createPeer ( rToolkit, rParent ) ; 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir // If user forget to call "setPosSize()", we have still a correct size. 566*cdf0e10cSrcweir // And a "MinimumSize" IS A "MinimumSize"! 567*cdf0e10cSrcweir // We change not the position of control at this point. 568*cdf0e10cSrcweir Size aDefaultSize = getMinimumSize () ; 569*cdf0e10cSrcweir setPosSize ( 0, 0, aDefaultSize.Width, aDefaultSize.Height, PosSize::SIZE ) ; 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 574*cdf0e10cSrcweir // XControl 575*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir sal_Bool SAL_CALL ProgressMonitor::setModel ( const Reference< XControlModel > & /*rModel*/ ) throw( RuntimeException ) 578*cdf0e10cSrcweir { 579*cdf0e10cSrcweir // We have no model. 580*cdf0e10cSrcweir return sal_False ; 581*cdf0e10cSrcweir } 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 584*cdf0e10cSrcweir // XControl 585*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir Reference< XControlModel > SAL_CALL ProgressMonitor::getModel () throw( RuntimeException ) 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir // We have no model. 590*cdf0e10cSrcweir // return (XControlModel*)this ; 591*cdf0e10cSrcweir return Reference< XControlModel > () ; 592*cdf0e10cSrcweir } 593*cdf0e10cSrcweir 594*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 595*cdf0e10cSrcweir // XComponent 596*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 597*cdf0e10cSrcweir 598*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::dispose () throw( RuntimeException ) 599*cdf0e10cSrcweir { 600*cdf0e10cSrcweir // Ready for multithreading 601*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir // "removeControl()" control the state of a reference 604*cdf0e10cSrcweir Reference< XControl > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ; 605*cdf0e10cSrcweir Reference< XControl > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ; 606*cdf0e10cSrcweir Reference< XControl > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; 607*cdf0e10cSrcweir Reference< XControl > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ; 608*cdf0e10cSrcweir Reference< XControl > xRef_Button ( m_xButton , UNO_QUERY ) ; 609*cdf0e10cSrcweir Reference< XControl > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ; 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir removeControl ( xRef_Topic_Top ) ; 612*cdf0e10cSrcweir removeControl ( xRef_Text_Top ) ; 613*cdf0e10cSrcweir removeControl ( xRef_Topic_Bottom ) ; 614*cdf0e10cSrcweir removeControl ( xRef_Text_Bottom ) ; 615*cdf0e10cSrcweir removeControl ( xRef_Button ) ; 616*cdf0e10cSrcweir removeControl ( xRef_ProgressBar ) ; 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir // do'nt use "...->clear ()" or "... = XFixedText ()" 619*cdf0e10cSrcweir // when other hold a reference at this object !!! 620*cdf0e10cSrcweir xRef_Topic_Top->dispose () ; 621*cdf0e10cSrcweir xRef_Text_Top->dispose () ; 622*cdf0e10cSrcweir xRef_Topic_Bottom->dispose () ; 623*cdf0e10cSrcweir xRef_Text_Bottom->dispose () ; 624*cdf0e10cSrcweir xRef_Button->dispose () ; 625*cdf0e10cSrcweir xRef_ProgressBar->dispose () ; 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir BaseContainerControl::dispose () ; 628*cdf0e10cSrcweir } 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 631*cdf0e10cSrcweir // XWindow 632*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir void SAL_CALL ProgressMonitor::setPosSize ( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags ) throw( RuntimeException ) 635*cdf0e10cSrcweir { 636*cdf0e10cSrcweir Rectangle aBasePosSize = getPosSize () ; 637*cdf0e10cSrcweir BaseContainerControl::setPosSize (nX, nY, nWidth, nHeight, nFlags) ; 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir // if position or size changed 640*cdf0e10cSrcweir if ( 641*cdf0e10cSrcweir ( nWidth != aBasePosSize.Width ) || 642*cdf0e10cSrcweir ( nHeight != aBasePosSize.Height) 643*cdf0e10cSrcweir ) 644*cdf0e10cSrcweir { 645*cdf0e10cSrcweir // calc new layout for controls 646*cdf0e10cSrcweir impl_recalcLayout () ; 647*cdf0e10cSrcweir // clear background (!) 648*cdf0e10cSrcweir // [Childs was repainted in "recalcLayout" by setPosSize() automaticly!] 649*cdf0e10cSrcweir getPeer()->invalidate(2); 650*cdf0e10cSrcweir // and repaint the control 651*cdf0e10cSrcweir impl_paint ( 0, 0, impl_getGraphicsPeer() ) ; 652*cdf0e10cSrcweir } 653*cdf0e10cSrcweir } 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 656*cdf0e10cSrcweir // impl but public method to register service 657*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir const Sequence< OUString > ProgressMonitor::impl_getStaticSupportedServiceNames() 660*cdf0e10cSrcweir { 661*cdf0e10cSrcweir MutexGuard aGuard( Mutex::getGlobalMutex() ); 662*cdf0e10cSrcweir Sequence< OUString > seqServiceNames( 1 ); 663*cdf0e10cSrcweir seqServiceNames.getArray() [0] = OUString::createFromAscii( SERVICENAME_PROGRESSMONITOR ); 664*cdf0e10cSrcweir return seqServiceNames ; 665*cdf0e10cSrcweir } 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 668*cdf0e10cSrcweir // impl but public method to register service 669*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir const OUString ProgressMonitor::impl_getStaticImplementationName() 672*cdf0e10cSrcweir { 673*cdf0e10cSrcweir return OUString::createFromAscii( IMPLEMENTATIONNAME_PROGRESSMONITOR ); 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 677*cdf0e10cSrcweir // protected method 678*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir void ProgressMonitor::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics ) 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir if (rGraphics.is()) 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir // Ready for multithreading 685*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 686*cdf0e10cSrcweir 687*cdf0e10cSrcweir // paint shadowed border around the progressmonitor 688*cdf0e10cSrcweir rGraphics->setLineColor ( LINECOLOR_SHADOW ) ; 689*cdf0e10cSrcweir rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ) ; 690*cdf0e10cSrcweir rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ) ; 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir rGraphics->setLineColor ( LINECOLOR_BRIGHT ) ; 693*cdf0e10cSrcweir rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ) ; 694*cdf0e10cSrcweir rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ) ; 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir // Paint 3D-line 697*cdf0e10cSrcweir rGraphics->setLineColor ( LINECOLOR_SHADOW ) ; 698*cdf0e10cSrcweir rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ; 699*cdf0e10cSrcweir 700*cdf0e10cSrcweir rGraphics->setLineColor ( LINECOLOR_BRIGHT ) ; 701*cdf0e10cSrcweir rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ; 702*cdf0e10cSrcweir } 703*cdf0e10cSrcweir } 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 706*cdf0e10cSrcweir // private method 707*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 708*cdf0e10cSrcweir 709*cdf0e10cSrcweir void ProgressMonitor::impl_recalcLayout () 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir sal_Int32 nX_Button ; 712*cdf0e10cSrcweir sal_Int32 nY_Button ; 713*cdf0e10cSrcweir sal_Int32 nWidth_Button ; 714*cdf0e10cSrcweir sal_Int32 nHeight_Button ; 715*cdf0e10cSrcweir 716*cdf0e10cSrcweir sal_Int32 nX_ProgressBar ; 717*cdf0e10cSrcweir sal_Int32 nY_ProgressBar ; 718*cdf0e10cSrcweir sal_Int32 nWidth_ProgressBar ; 719*cdf0e10cSrcweir sal_Int32 nHeight_ProgressBar ; 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir sal_Int32 nX_3DLine ; 722*cdf0e10cSrcweir sal_Int32 nY_3DLine ; 723*cdf0e10cSrcweir sal_Int32 nWidth_3DLine ; 724*cdf0e10cSrcweir sal_Int32 nHeight_3DLine ; 725*cdf0e10cSrcweir 726*cdf0e10cSrcweir sal_Int32 nX_Text_Top ; 727*cdf0e10cSrcweir sal_Int32 nY_Text_Top ; 728*cdf0e10cSrcweir sal_Int32 nWidth_Text_Top ; 729*cdf0e10cSrcweir sal_Int32 nHeight_Text_Top ; 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir sal_Int32 nX_Topic_Top ; 732*cdf0e10cSrcweir sal_Int32 nY_Topic_Top ; 733*cdf0e10cSrcweir sal_Int32 nWidth_Topic_Top ; 734*cdf0e10cSrcweir sal_Int32 nHeight_Topic_Top ; 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir sal_Int32 nX_Text_Bottom ; 737*cdf0e10cSrcweir sal_Int32 nY_Text_Bottom ; 738*cdf0e10cSrcweir sal_Int32 nWidth_Text_Bottom ; 739*cdf0e10cSrcweir sal_Int32 nHeight_Text_Bottom ; 740*cdf0e10cSrcweir 741*cdf0e10cSrcweir sal_Int32 nX_Topic_Bottom ; 742*cdf0e10cSrcweir sal_Int32 nY_Topic_Bottom ; 743*cdf0e10cSrcweir sal_Int32 nWidth_Topic_Bottom ; 744*cdf0e10cSrcweir sal_Int32 nHeight_Topic_Bottom ; 745*cdf0e10cSrcweir 746*cdf0e10cSrcweir // Ready for multithreading 747*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 748*cdf0e10cSrcweir 749*cdf0e10cSrcweir // get information about required place of child controls 750*cdf0e10cSrcweir Reference< XLayoutConstrains > xTopicLayout_Top ( m_xTopic_Top , UNO_QUERY ) ; 751*cdf0e10cSrcweir Reference< XLayoutConstrains > xTextLayout_Top ( m_xText_Top , UNO_QUERY ) ; 752*cdf0e10cSrcweir Reference< XLayoutConstrains > xTopicLayout_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; 753*cdf0e10cSrcweir Reference< XLayoutConstrains > xTextLayout_Bottom ( m_xText_Bottom , UNO_QUERY ) ; 754*cdf0e10cSrcweir Reference< XLayoutConstrains > xButtonLayout ( m_xButton , UNO_QUERY ) ; 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir Size aTopicSize_Top = xTopicLayout_Top->getPreferredSize () ; 757*cdf0e10cSrcweir Size aTextSize_Top = xTextLayout_Top->getPreferredSize () ; 758*cdf0e10cSrcweir Size aTopicSize_Bottom = xTopicLayout_Bottom->getPreferredSize () ; 759*cdf0e10cSrcweir Size aTextSize_Bottom = xTextLayout_Bottom->getPreferredSize () ; 760*cdf0e10cSrcweir Size aButtonSize = xButtonLayout->getPreferredSize () ; 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir // calc position and size of child controls 763*cdf0e10cSrcweir // Button has preferred size! 764*cdf0e10cSrcweir nWidth_Button = aButtonSize.Width ; 765*cdf0e10cSrcweir nHeight_Button = aButtonSize.Height ; 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir // Left column before progressbar has preferred size and fixed position. 768*cdf0e10cSrcweir // But "Width" is oriented on left column below progressbar to!!! "max(...)" 769*cdf0e10cSrcweir nX_Topic_Top = FREEBORDER ; 770*cdf0e10cSrcweir nY_Topic_Top = FREEBORDER ; 771*cdf0e10cSrcweir nWidth_Topic_Top = Max ( aTopicSize_Top.Width, aTopicSize_Bottom.Width ) ; 772*cdf0e10cSrcweir nHeight_Topic_Top = aTopicSize_Top.Height ; 773*cdf0e10cSrcweir 774*cdf0e10cSrcweir // Right column before progressbar has relativ position to left column ... 775*cdf0e10cSrcweir // ... and a size as rest of dialog size! 776*cdf0e10cSrcweir nX_Text_Top = nX_Topic_Top+nWidth_Topic_Top+FREEBORDER ; 777*cdf0e10cSrcweir nY_Text_Top = nY_Topic_Top ; 778*cdf0e10cSrcweir nWidth_Text_Top = Max ( aTextSize_Top.Width, aTextSize_Bottom.Width ) ; 779*cdf0e10cSrcweir // Fix size of this column to minimum! 780*cdf0e10cSrcweir sal_Int32 nSummaryWidth = nWidth_Text_Top+nWidth_Topic_Top+(3*FREEBORDER) ; 781*cdf0e10cSrcweir if ( nSummaryWidth < DEFAULT_WIDTH ) 782*cdf0e10cSrcweir nWidth_Text_Top = DEFAULT_WIDTH-nWidth_Topic_Top-(3*FREEBORDER); 783*cdf0e10cSrcweir // Fix size of column to maximum! 784*cdf0e10cSrcweir if ( nSummaryWidth > impl_getWidth() ) 785*cdf0e10cSrcweir nWidth_Text_Top = impl_getWidth()-nWidth_Topic_Top-(3*FREEBORDER) ; 786*cdf0e10cSrcweir nHeight_Text_Top = nHeight_Topic_Top ; 787*cdf0e10cSrcweir 788*cdf0e10cSrcweir // Position of progressbar is relativ to columns before. 789*cdf0e10cSrcweir // Progressbar.Width = Dialog.Width !!! 790*cdf0e10cSrcweir // Progressbar.Height = Button.Height 791*cdf0e10cSrcweir nX_ProgressBar = nX_Topic_Top ; 792*cdf0e10cSrcweir nY_ProgressBar = nY_Topic_Top+nHeight_Topic_Top+FREEBORDER ; 793*cdf0e10cSrcweir nWidth_ProgressBar = FREEBORDER+nWidth_Topic_Top+nWidth_Text_Top ; 794*cdf0e10cSrcweir nHeight_ProgressBar = nHeight_Button ; 795*cdf0e10cSrcweir 796*cdf0e10cSrcweir // Oriented by left column before progressbar. 797*cdf0e10cSrcweir nX_Topic_Bottom = nX_Topic_Top ; 798*cdf0e10cSrcweir nY_Topic_Bottom = nY_ProgressBar+nHeight_ProgressBar+FREEBORDER ; 799*cdf0e10cSrcweir nWidth_Topic_Bottom = nWidth_Topic_Top ; 800*cdf0e10cSrcweir nHeight_Topic_Bottom = aTopicSize_Bottom.Height ; 801*cdf0e10cSrcweir 802*cdf0e10cSrcweir // Oriented by right column before progressbar. 803*cdf0e10cSrcweir nX_Text_Bottom = nX_Topic_Bottom+nWidth_Topic_Bottom+FREEBORDER ; 804*cdf0e10cSrcweir nY_Text_Bottom = nY_Topic_Bottom ; 805*cdf0e10cSrcweir nWidth_Text_Bottom = nWidth_Text_Top ; 806*cdf0e10cSrcweir nHeight_Text_Bottom = nHeight_Topic_Bottom ; 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir // Oriented by progressbar. 809*cdf0e10cSrcweir nX_3DLine = nX_Topic_Top ; 810*cdf0e10cSrcweir nY_3DLine = nY_Topic_Bottom+nHeight_Topic_Bottom+(FREEBORDER/2) ; 811*cdf0e10cSrcweir nWidth_3DLine = nWidth_ProgressBar ; 812*cdf0e10cSrcweir nHeight_3DLine = 1 ; // Height for ONE line ! (But we paint two lines!) 813*cdf0e10cSrcweir 814*cdf0e10cSrcweir // Oriented by progressbar. 815*cdf0e10cSrcweir nX_Button = nX_ProgressBar+nWidth_ProgressBar-nWidth_Button ; 816*cdf0e10cSrcweir nY_Button = nY_Topic_Bottom+nHeight_Topic_Bottom+FREEBORDER ; 817*cdf0e10cSrcweir 818*cdf0e10cSrcweir // Calc offsets to center controls 819*cdf0e10cSrcweir sal_Int32 nDx ; 820*cdf0e10cSrcweir sal_Int32 nDy ; 821*cdf0e10cSrcweir 822*cdf0e10cSrcweir nDx = ( (2*FREEBORDER)+nWidth_ProgressBar ) ; 823*cdf0e10cSrcweir nDy = ( (6*FREEBORDER)+nHeight_Topic_Top+nHeight_ProgressBar+nHeight_Topic_Bottom+2+nHeight_Button ) ; 824*cdf0e10cSrcweir 825*cdf0e10cSrcweir // At this point use original dialog size to center controls! 826*cdf0e10cSrcweir nDx = (impl_getWidth ()/2)-(nDx/2) ; 827*cdf0e10cSrcweir nDy = (impl_getHeight()/2)-(nDy/2) ; 828*cdf0e10cSrcweir 829*cdf0e10cSrcweir if ( nDx<0 ) 830*cdf0e10cSrcweir { 831*cdf0e10cSrcweir nDx=0 ; 832*cdf0e10cSrcweir } 833*cdf0e10cSrcweir if ( nDy<0 ) 834*cdf0e10cSrcweir { 835*cdf0e10cSrcweir nDy=0 ; 836*cdf0e10cSrcweir } 837*cdf0e10cSrcweir 838*cdf0e10cSrcweir // Set new position and size on all controls 839*cdf0e10cSrcweir Reference< XWindow > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ; 840*cdf0e10cSrcweir Reference< XWindow > xRef_Text_Top ( m_xText_Top , UNO_QUERY ) ; 841*cdf0e10cSrcweir Reference< XWindow > xRef_Topic_Bottom ( m_xTopic_Bottom , UNO_QUERY ) ; 842*cdf0e10cSrcweir Reference< XWindow > xRef_Text_Bottom ( m_xText_Bottom , UNO_QUERY ) ; 843*cdf0e10cSrcweir Reference< XWindow > xRef_Button ( m_xButton , UNO_QUERY ) ; 844*cdf0e10cSrcweir Reference< XWindow > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ; 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir xRef_Topic_Top->setPosSize ( nDx+nX_Topic_Top , nDy+nY_Topic_Top , nWidth_Topic_Top , nHeight_Topic_Top , 15 ) ; 847*cdf0e10cSrcweir xRef_Text_Top->setPosSize ( nDx+nX_Text_Top , nDy+nY_Text_Top , nWidth_Text_Top , nHeight_Text_Top , 15 ) ; 848*cdf0e10cSrcweir xRef_Topic_Bottom->setPosSize ( nDx+nX_Topic_Bottom , nDy+nY_Topic_Bottom , nWidth_Topic_Bottom , nHeight_Topic_Bottom , 15 ) ; 849*cdf0e10cSrcweir xRef_Text_Bottom->setPosSize ( nDx+nX_Text_Bottom , nDy+nY_Text_Bottom , nWidth_Text_Bottom , nHeight_Text_Bottom , 15 ) ; 850*cdf0e10cSrcweir xRef_Button->setPosSize ( nDx+nX_Button , nDy+nY_Button , nWidth_Button , nHeight_Button , 15 ) ; 851*cdf0e10cSrcweir xRef_ProgressBar->setPosSize ( nDx+nX_ProgressBar , nDy+nY_ProgressBar , nWidth_ProgressBar , nHeight_ProgressBar , 15 ) ; 852*cdf0e10cSrcweir 853*cdf0e10cSrcweir m_a3DLine.X = nDx+nX_Topic_Top ; 854*cdf0e10cSrcweir m_a3DLine.Y = nDy+nY_Topic_Bottom+nHeight_Topic_Bottom+(FREEBORDER/2) ; 855*cdf0e10cSrcweir m_a3DLine.Width = nWidth_ProgressBar ; 856*cdf0e10cSrcweir m_a3DLine.Height = nHeight_ProgressBar ; 857*cdf0e10cSrcweir 858*cdf0e10cSrcweir // All childcontrols make an implicit repaint in setPosSize()! 859*cdf0e10cSrcweir // Make it also for this 3D-line ... 860*cdf0e10cSrcweir Reference< XGraphics > xGraphics = impl_getGraphicsPeer () ; 861*cdf0e10cSrcweir 862*cdf0e10cSrcweir xGraphics->setLineColor ( LINECOLOR_SHADOW ) ; 863*cdf0e10cSrcweir xGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ; 864*cdf0e10cSrcweir 865*cdf0e10cSrcweir xGraphics->setLineColor ( LINECOLOR_BRIGHT ) ; 866*cdf0e10cSrcweir xGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ; 867*cdf0e10cSrcweir } 868*cdf0e10cSrcweir 869*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 870*cdf0e10cSrcweir // private method 871*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 872*cdf0e10cSrcweir 873*cdf0e10cSrcweir void ProgressMonitor::impl_rebuildFixedText () 874*cdf0e10cSrcweir { 875*cdf0e10cSrcweir // Ready for multithreading 876*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir // Rebuild fixedtext before progress 879*cdf0e10cSrcweir 880*cdf0e10cSrcweir // Rebuild left site of text 881*cdf0e10cSrcweir if (m_xTopic_Top.is()) 882*cdf0e10cSrcweir { 883*cdf0e10cSrcweir OUString aCollectString ; 884*cdf0e10cSrcweir 885*cdf0e10cSrcweir // Collect all topics from list and format text. 886*cdf0e10cSrcweir // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! 887*cdf0e10cSrcweir for ( sal_uInt32 n=0; n<m_pTextlist_Top->Count(); ++n ) 888*cdf0e10cSrcweir { 889*cdf0e10cSrcweir IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject (n) ; 890*cdf0e10cSrcweir aCollectString += pSearchItem->sTopic ; 891*cdf0e10cSrcweir aCollectString += OUString::createFromAscii("\n") ; 892*cdf0e10cSrcweir } 893*cdf0e10cSrcweir aCollectString += OUString::createFromAscii("\0") ; // It's better :-) 894*cdf0e10cSrcweir 895*cdf0e10cSrcweir m_xTopic_Top->setText ( aCollectString ) ; 896*cdf0e10cSrcweir } 897*cdf0e10cSrcweir 898*cdf0e10cSrcweir // Rebuild right site of text 899*cdf0e10cSrcweir if (m_xText_Top.is()) 900*cdf0e10cSrcweir { 901*cdf0e10cSrcweir OUString aCollectString ; 902*cdf0e10cSrcweir 903*cdf0e10cSrcweir // Collect all topics from list and format text. 904*cdf0e10cSrcweir // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! 905*cdf0e10cSrcweir for ( sal_uInt32 n=0; n<m_pTextlist_Top->Count(); ++n ) 906*cdf0e10cSrcweir { 907*cdf0e10cSrcweir IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject (n) ; 908*cdf0e10cSrcweir aCollectString += pSearchItem->sText ; 909*cdf0e10cSrcweir aCollectString += OUString::createFromAscii("\n") ; 910*cdf0e10cSrcweir } 911*cdf0e10cSrcweir aCollectString += OUString::createFromAscii("\0") ; // It's better :-) 912*cdf0e10cSrcweir 913*cdf0e10cSrcweir m_xText_Top->setText ( aCollectString ) ; 914*cdf0e10cSrcweir } 915*cdf0e10cSrcweir 916*cdf0e10cSrcweir // Rebuild fixedtext below progress 917*cdf0e10cSrcweir 918*cdf0e10cSrcweir // Rebuild left site of text 919*cdf0e10cSrcweir if (m_xTopic_Bottom.is()) 920*cdf0e10cSrcweir { 921*cdf0e10cSrcweir OUString aCollectString ; 922*cdf0e10cSrcweir 923*cdf0e10cSrcweir // Collect all topics from list and format text. 924*cdf0e10cSrcweir // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! 925*cdf0e10cSrcweir for ( sal_uInt32 n=0; n<m_pTextlist_Bottom->Count(); ++n ) 926*cdf0e10cSrcweir { 927*cdf0e10cSrcweir IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject (n) ; 928*cdf0e10cSrcweir aCollectString += pSearchItem->sTopic ; 929*cdf0e10cSrcweir aCollectString += OUString::createFromAscii("\n") ; 930*cdf0e10cSrcweir } 931*cdf0e10cSrcweir aCollectString += OUString::createFromAscii("\0") ; // It's better :-) 932*cdf0e10cSrcweir 933*cdf0e10cSrcweir m_xTopic_Bottom->setText ( aCollectString ) ; 934*cdf0e10cSrcweir } 935*cdf0e10cSrcweir 936*cdf0e10cSrcweir // Rebuild right site of text 937*cdf0e10cSrcweir if (m_xText_Bottom.is()) 938*cdf0e10cSrcweir { 939*cdf0e10cSrcweir OUString aCollectString ; 940*cdf0e10cSrcweir 941*cdf0e10cSrcweir // Collect all topics from list and format text. 942*cdf0e10cSrcweir // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! 943*cdf0e10cSrcweir for ( sal_uInt32 n=0; n<m_pTextlist_Bottom->Count(); ++n ) 944*cdf0e10cSrcweir { 945*cdf0e10cSrcweir IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject (n) ; 946*cdf0e10cSrcweir aCollectString += pSearchItem->sText ; 947*cdf0e10cSrcweir aCollectString += OUString::createFromAscii("\n") ; 948*cdf0e10cSrcweir } 949*cdf0e10cSrcweir aCollectString += OUString::createFromAscii("\0") ; // It's better :-) 950*cdf0e10cSrcweir 951*cdf0e10cSrcweir m_xText_Bottom->setText ( aCollectString ) ; 952*cdf0e10cSrcweir } 953*cdf0e10cSrcweir } 954*cdf0e10cSrcweir 955*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 956*cdf0e10cSrcweir // private method 957*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 958*cdf0e10cSrcweir 959*cdf0e10cSrcweir void ProgressMonitor::impl_cleanMemory () 960*cdf0e10cSrcweir { 961*cdf0e10cSrcweir // Ready for multithreading 962*cdf0e10cSrcweir MutexGuard aGuard ( m_aMutex ) ; 963*cdf0e10cSrcweir 964*cdf0e10cSrcweir // Delete all of lists. 965*cdf0e10cSrcweir 966*cdf0e10cSrcweir sal_uInt32 nPosition ; 967*cdf0e10cSrcweir 968*cdf0e10cSrcweir for ( nPosition = 0; nPosition < m_pTextlist_Top->Count () ; ++nPosition ) 969*cdf0e10cSrcweir { 970*cdf0e10cSrcweir IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject ( nPosition ) ; 971*cdf0e10cSrcweir delete pSearchItem ; 972*cdf0e10cSrcweir } 973*cdf0e10cSrcweir m_pTextlist_Top->Clear () ; 974*cdf0e10cSrcweir delete m_pTextlist_Top ; 975*cdf0e10cSrcweir 976*cdf0e10cSrcweir for ( nPosition = 0; nPosition < m_pTextlist_Bottom->Count () ; ++nPosition ) 977*cdf0e10cSrcweir { 978*cdf0e10cSrcweir IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject ( nPosition ) ; 979*cdf0e10cSrcweir delete pSearchItem ; 980*cdf0e10cSrcweir } 981*cdf0e10cSrcweir m_pTextlist_Bottom->Clear () ; 982*cdf0e10cSrcweir delete m_pTextlist_Bottom ; 983*cdf0e10cSrcweir } 984*cdf0e10cSrcweir 985*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 986*cdf0e10cSrcweir // private method 987*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 988*cdf0e10cSrcweir 989*cdf0e10cSrcweir IMPL_TextlistItem* ProgressMonitor::impl_searchTopic ( const OUString& rTopic, sal_Bool bbeforeProgress ) 990*cdf0e10cSrcweir { 991*cdf0e10cSrcweir // Get right textlist for following operations. 992*cdf0e10cSrcweir IMPL_Textlist* pTextList ; 993*cdf0e10cSrcweir 994*cdf0e10cSrcweir // Ready for multithreading 995*cdf0e10cSrcweir ClearableMutexGuard aGuard ( m_aMutex ) ; 996*cdf0e10cSrcweir 997*cdf0e10cSrcweir if ( bbeforeProgress == sal_True ) 998*cdf0e10cSrcweir { 999*cdf0e10cSrcweir pTextList = m_pTextlist_Top ; 1000*cdf0e10cSrcweir } 1001*cdf0e10cSrcweir else 1002*cdf0e10cSrcweir { 1003*cdf0e10cSrcweir pTextList = m_pTextlist_Bottom ; 1004*cdf0e10cSrcweir } 1005*cdf0e10cSrcweir 1006*cdf0e10cSrcweir // Switch off guard. 1007*cdf0e10cSrcweir aGuard.clear () ; 1008*cdf0e10cSrcweir 1009*cdf0e10cSrcweir // Search the topic in textlist. 1010*cdf0e10cSrcweir sal_uInt32 nPosition = 0 ; 1011*cdf0e10cSrcweir sal_uInt32 nCount = pTextList->Count () ; 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir for ( nPosition = 0; nPosition < nCount ; ++nPosition ) 1014*cdf0e10cSrcweir { 1015*cdf0e10cSrcweir IMPL_TextlistItem* pSearchItem = pTextList->GetObject ( nPosition ) ; 1016*cdf0e10cSrcweir 1017*cdf0e10cSrcweir if ( pSearchItem->sTopic == rTopic ) 1018*cdf0e10cSrcweir { 1019*cdf0e10cSrcweir // We have found this topic ... return a valid pointer. 1020*cdf0e10cSrcweir return pSearchItem ; 1021*cdf0e10cSrcweir } 1022*cdf0e10cSrcweir } 1023*cdf0e10cSrcweir 1024*cdf0e10cSrcweir // We have'nt found this topic ... return a nonvalid pointer. 1025*cdf0e10cSrcweir return NULL ; 1026*cdf0e10cSrcweir } 1027*cdf0e10cSrcweir 1028*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 1029*cdf0e10cSrcweir // debug methods 1030*cdf0e10cSrcweir //____________________________________________________________________________________________________________ 1031*cdf0e10cSrcweir 1032*cdf0e10cSrcweir #ifdef DBG_UTIL 1033*cdf0e10cSrcweir 1034*cdf0e10cSrcweir // addText, updateText 1035*cdf0e10cSrcweir sal_Bool ProgressMonitor::impl_debug_checkParameter ( const OUString& rTopic, const OUString& rText, sal_Bool /*bbeforeProgress*/ ) 1036*cdf0e10cSrcweir { 1037*cdf0e10cSrcweir // Check "rTopic" 1038*cdf0e10cSrcweir if ( &rTopic == NULL ) return sal_False ; // NULL-pointer for reference ???!!! 1039*cdf0e10cSrcweir if ( rTopic.getLength () < 1 ) return sal_False ; // "" 1040*cdf0e10cSrcweir 1041*cdf0e10cSrcweir // Check "rText" 1042*cdf0e10cSrcweir if ( &rText == NULL ) return sal_False ; // NULL-pointer for reference ???!!! 1043*cdf0e10cSrcweir if ( rText.getLength () < 1 ) return sal_False ; // "" 1044*cdf0e10cSrcweir 1045*cdf0e10cSrcweir // "bbeforeProgress" is valid in everyway! 1046*cdf0e10cSrcweir 1047*cdf0e10cSrcweir // Parameter OK ... return sal_True. 1048*cdf0e10cSrcweir return sal_True ; 1049*cdf0e10cSrcweir } 1050*cdf0e10cSrcweir 1051*cdf0e10cSrcweir // removeText 1052*cdf0e10cSrcweir sal_Bool ProgressMonitor::impl_debug_checkParameter ( const OUString& rTopic, sal_Bool /*bbeforeProgress*/ ) 1053*cdf0e10cSrcweir { 1054*cdf0e10cSrcweir // Check "rTopic" 1055*cdf0e10cSrcweir if ( &rTopic == NULL ) return sal_False ; // NULL-pointer for reference ???!!! 1056*cdf0e10cSrcweir if ( rTopic.getLength () < 1 ) return sal_False ; // "" 1057*cdf0e10cSrcweir 1058*cdf0e10cSrcweir // "bbeforeProgress" is valid in everyway! 1059*cdf0e10cSrcweir 1060*cdf0e10cSrcweir // Parameter OK ... return sal_True. 1061*cdf0e10cSrcweir return sal_True ; 1062*cdf0e10cSrcweir } 1063*cdf0e10cSrcweir 1064*cdf0e10cSrcweir #endif // #ifdef DBG_UTIL 1065*cdf0e10cSrcweir 1066*cdf0e10cSrcweir } // namespace unocontrols 1067