diff options
author | Joseph Powers <jpowers27@cox.net> | 2010-10-31 21:34:25 -0700 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2010-11-01 00:16:13 -0500 |
commit | ddec70f39e40eea43b8a3380edbb2086dcfb73ac (patch) | |
tree | 96f66959f84ae5dd7c72addd5f7bbe7e7fb3d4e1 /UnoControls/source/controls | |
parent | Use RTL_CONSTASCII_USTRINGPARAM macro (diff) | |
download | core-ddec70f39e40eea43b8a3380edbb2086dcfb73ac.tar.gz core-ddec70f39e40eea43b8a3380edbb2086dcfb73ac.zip |
Macro Cleanup in UNO land.
Diffstat (limited to 'UnoControls/source/controls')
-rw-r--r-- | UnoControls/source/controls/OConnectionPointHelper.cxx | 11 | ||||
-rw-r--r-- | UnoControls/source/controls/progressbar.cxx | 127 | ||||
-rw-r--r-- | UnoControls/source/controls/progressmonitor.cxx | 159 | ||||
-rw-r--r-- | UnoControls/source/controls/statusindicator.cxx | 73 |
4 files changed, 158 insertions, 212 deletions
diff --git a/UnoControls/source/controls/OConnectionPointHelper.cxx b/UnoControls/source/controls/OConnectionPointHelper.cxx index 71ff451b28b6..a8b174b01a3a 100644 --- a/UnoControls/source/controls/OConnectionPointHelper.cxx +++ b/UnoControls/source/controls/OConnectionPointHelper.cxx @@ -57,10 +57,11 @@ namespace unocontrols{ // construct/destruct //______________________________________________________________________________________________________________ -OConnectionPointHelper::OConnectionPointHelper( Mutex& aMutex , - OConnectionPointContainerHelper* pContainerImplementation , - UNO3_TYPE aType ) - : m_aSharedMutex ( aMutex ) +OConnectionPointHelper::OConnectionPointHelper( + Mutex& aMutex , + OConnectionPointContainerHelper* pContainerImplementation , + Type aType +) : m_aSharedMutex ( aMutex ) , m_oContainerWeakReference ( pContainerImplementation ) , m_pContainerImplementation ( pContainerImplementation ) , m_aInterfaceType ( aType ) @@ -82,7 +83,7 @@ Any SAL_CALL OConnectionPointHelper::queryInterface( const Type& aType ) throw( // Ask for my own supported interfaces ... Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XConnectionPoint* > ( this ) + static_cast< XConnectionPoint* > ( this ) ) ); diff --git a/UnoControls/source/controls/progressbar.cxx b/UnoControls/source/controls/progressbar.cxx index 4c33127925b0..7d05435e48b2 100644 --- a/UnoControls/source/controls/progressbar.cxx +++ b/UnoControls/source/controls/progressbar.cxx @@ -67,14 +67,14 @@ namespace unocontrols{ ProgressBar::ProgressBar( const Reference< XMultiServiceFactory >& xFactory ) : BaseControl ( xFactory ) - , m_bHorizontal ( DEFAULT_HORIZONTAL ) - , m_aBlockSize ( DEFAULT_BLOCKDIMENSION ) - , m_nForegroundColor ( DEFAULT_FOREGROUNDCOLOR ) - , m_nBackgroundColor ( DEFAULT_BACKGROUNDCOLOR ) - , m_nMinRange ( DEFAULT_MINRANGE ) - , m_nMaxRange ( DEFAULT_MAXRANGE ) - , m_nBlockValue ( DEFAULT_BLOCKVALUE ) - , m_nValue ( DEFAULT_VALUE ) + , m_bHorizontal ( PROGRESSBAR_DEFAULT_HORIZONTAL ) + , m_aBlockSize ( PROGRESSBAR_DEFAULT_BLOCKDIMENSION ) + , m_nForegroundColor ( PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR ) + , m_nBackgroundColor ( PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR ) + , m_nMinRange ( PROGRESSBAR_DEFAULT_MINRANGE ) + , m_nMaxRange ( PROGRESSBAR_DEFAULT_MAXRANGE ) + , m_nBlockValue ( PROGRESSBAR_DEFAULT_BLOCKVALUE ) + , m_nValue ( PROGRESSBAR_DEFAULT_VALUE ) { } @@ -153,9 +153,9 @@ Sequence< Type > SAL_CALL ProgressBar::getTypes() throw( RuntimeException ) if ( pTypeCollection == NULL ) { // Create a static typecollection ... - static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*)NULL ) , - ::getCppuType(( const Reference< XProgressBar >*)NULL ) , - BaseControl::getTypes() + static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XControlModel >*) NULL ) , + ::getCppuType(( const Reference< XProgressBar >*) NULL ) , + BaseControl::getTypes() ); // ... and set his address to static pointer! pTypeCollection = &aTypeCollection ; @@ -174,8 +174,8 @@ Any SAL_CALL ProgressBar::queryAggregation( const Type& aType ) throw( RuntimeEx // Ask for my own supported interfaces ... // Attention: XTypeProvider and XInterface are supported by OComponentHelper! Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XControlModel* > ( this ) , - static_cast< XProgressBar* > ( this ) + static_cast< XControlModel* > ( this ) , + static_cast< XProgressBar* > ( this ) ) ); @@ -312,7 +312,13 @@ sal_Int32 SAL_CALL ProgressBar::getValue () throw( RuntimeException ) // XWindow //____________________________________________________________________________________________________________ -void SAL_CALL ProgressBar::setPosSize ( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags ) throw( RuntimeException ) +void SAL_CALL ProgressBar::setPosSize ( + sal_Int32 nX, + sal_Int32 nY, + sal_Int32 nWidth, + sal_Int32 nHeight, + sal_Int16 nFlags +) throw( RuntimeException ) { // Take old size BEFORE you set the new values at baseclass! // You will control changes. At the other way, the values are the same! @@ -409,9 +415,9 @@ void ProgressBar::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGra for ( sal_Int16 i=1; i<=nBlockCount; ++i ) { // step free field - nBlockStart += FREESPACE ; + nBlockStart += PROGRESSBAR_FREESPACE ; // paint block - rGraphics->drawRect (nBlockStart, nY+FREESPACE, m_aBlockSize.Width, m_aBlockSize.Height) ; + rGraphics->drawRect (nBlockStart, nY+PROGRESSBAR_FREESPACE, m_aBlockSize.Width, m_aBlockSize.Height) ; // step next free field nBlockStart += m_aBlockSize.Width ; } @@ -427,20 +433,20 @@ void ProgressBar::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGra for ( sal_Int16 i=1; i<=nBlockCount; ++i ) { // step free field - nBlockStart -= FREESPACE ; + nBlockStart -= PROGRESSBAR_FREESPACE ; // paint block - rGraphics->drawRect (nX+FREESPACE, nBlockStart, m_aBlockSize.Width, m_aBlockSize.Height) ; + rGraphics->drawRect (nX+PROGRESSBAR_FREESPACE, nBlockStart, m_aBlockSize.Width, m_aBlockSize.Height) ; // step next free field nBlockStart -= m_aBlockSize.Height; } } // Paint shadow border around the progressbar - rGraphics->setLineColor ( LINECOLOR_SHADOW ) ; + rGraphics->setLineColor ( PROGRESSBAR_LINECOLOR_SHADOW ) ; rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ) ; rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ) ; - rGraphics->setLineColor ( LINECOLOR_BRIGHT ) ; + rGraphics->setLineColor ( PROGRESSBAR_LINECOLOR_BRIGHT ) ; rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ) ; rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ) ; } @@ -463,16 +469,16 @@ void ProgressBar::impl_recalcRange () if( nWindowWidth > nWindowHeight ) { m_bHorizontal = sal_True ; - fBlockHeight = (nWindowHeight-(2*FREESPACE)) ; + fBlockHeight = (nWindowHeight-(2*PROGRESSBAR_FREESPACE)) ; fBlockWidth = fBlockHeight ; - fMaxBlocks = nWindowWidth/(fBlockWidth+FREESPACE); + fMaxBlocks = nWindowWidth/(fBlockWidth+PROGRESSBAR_FREESPACE); } else { m_bHorizontal = sal_False ; - fBlockWidth = (nWindowWidth-(2*FREESPACE)) ; + fBlockWidth = (nWindowWidth-(2*PROGRESSBAR_FREESPACE)) ; fBlockHeight = fBlockWidth ; - fMaxBlocks = nWindowHeight/(fBlockHeight+FREESPACE); + fMaxBlocks = nWindowHeight/(fBlockHeight+PROGRESSBAR_FREESPACE); } double fRange = m_nMaxRange-m_nMinRange ; @@ -481,79 +487,6 @@ void ProgressBar::impl_recalcRange () m_nBlockValue = fBlockValue ; m_aBlockSize.Height = (sal_Int32)fBlockHeight; m_aBlockSize.Width = (sal_Int32)fBlockWidth ; -/* - // Calculate count of blocks for actual size - // (prevent error "division by zero") - if ( nHeight == 0 ) - { - nHeight = 1 ; - } - - nMaxBlock = nWidth / nHeight ; - nMaxBlock *= 2 ; - - // prevent error "division by zero" - if ( nMaxBlock == 0 ) - { - nMaxBlock = 1 ; - } - - // Calculate new value and new size for ONE block. - - // Do not a calculation like this: "m_nBlockValue=(m_nMaxRange-m_nMinRange)/nMaxBlock" ! - // If difference between m_nMaxRange and m_nMinRange to large, it give an overflow and a - // following error "division by zero" in method "paint() ... nBlockCount=nDifference/m_nBlockValue ..." - - // Overflow ? => example: _I32_MAX - _I32_MIN = -1 and not _UI32_MAX !!! - - m_nBlockValue = ( m_nMaxRange / nMaxBlock ) - ( m_nMinRange / nMaxBlock ) ; - m_aBlockSize.Height = ( nHeight - ( FREESPACE * 2 ) ) ; - m_aBlockSize.Width = ( ( nWidth / nMaxBlock ) - FREESPACE ) ; - } - else - { - // Don't forget to save this state! Used in "ProgressBar::paint()" - m_bHorizontal = sal_False ; - - double fBlockWidth = (nHeight-(2*FREESPACE)) ; - double fBlockHeight = fBlockWidth ; - double fRange = m_nMaxRange-m_nMinRange ; - double fBlockValue = fRange/(fBlockWidth+FREESPACE); - - m_nBlockValue = fBlockValue ; - m_aBlockSize.Height = (sal_Int32)fBlockHeight; - m_aBlockSize.Width = (sal_Int32)fBlockWidth ; - - // Calculate count of blocks for actual size - // (prevent error "division by zero") - if ( nWidth == 0 ) - { - nWidth = 1 ; - } - - nMaxBlock = nHeight / nWidth ; - nMaxBlock *= 2 ; - - // prevent error "division by zero" - if ( nMaxBlock == 0 ) - { - nMaxBlock = 1 ; - } - - // Calculate new value and new size for ONE block. - - // Do not a calculation like this: "m_nBlockValue=(m_nMaxRange-m_nMinRange)/nMaxBlock" ! - // If difference between m_nMaxRange and m_nMinRange to large, it give an overflow and a - // following error "division by zero" in method "paint() ... nBlockCount=nDifference/m_nBlockValue ..." - - // Overflow ? => example: _I32_MAX - _I32_MIN = -1 and not _UI32_MAX !!! - - m_nBlockValue = ( m_nMaxRange / nMaxBlock ) - ( m_nMinRange / nMaxBlock ) ; - m_aBlockSize.Height = ( ( nHeight / nMaxBlock ) - FREESPACE ) ; - m_aBlockSize.Width = ( nWidth - ( FREESPACE * 2 ) ) ; - - } -*/ } } // namespace unocontrols diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx index 6cc8acdde3f0..bf6dc153a933 100644 --- a/UnoControls/source/controls/progressmonitor.cxx +++ b/UnoControls/source/controls/progressmonitor.cxx @@ -74,12 +74,12 @@ ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFact ++m_refCount ; // Create instances for fixedtext, button and progress ... - m_xTopic_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; - m_xText_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; - m_xTopic_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; - m_xText_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; - m_xButton = Reference< XButton > ( xFactory->createInstance ( OUString::createFromAscii( BUTTON_SERVICENAME ) ), UNO_QUERY ) ; - m_xProgressBar = Reference< XProgressBar > ( xFactory->createInstance ( OUString::createFromAscii( SERVICENAME_PROGRESSBAR ) ), UNO_QUERY ) ; + m_xTopic_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; + m_xText_Top = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; + m_xTopic_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; + m_xText_Bottom = Reference< XFixedText > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME ) ), UNO_QUERY ) ; + m_xButton = Reference< XButton > ( xFactory->createInstance ( OUString::createFromAscii( BUTTON_SERVICENAME ) ), UNO_QUERY ) ; + m_xProgressBar = Reference< XProgressBar > ( xFactory->createInstance ( OUString::createFromAscii( SERVICENAME_PROGRESSBAR ) ), UNO_QUERY ) ; // ... cast controls to Reference< XControl > (for "setModel"!) ... Reference< XControl > xRef_Topic_Top ( m_xTopic_Top , UNO_QUERY ) ; @@ -90,11 +90,11 @@ ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFact Reference< XControl > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ; // ... set models ... - xRef_Topic_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; - xRef_Text_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; - xRef_Topic_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; - xRef_Text_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; - xRef_Button->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( BUTTON_MODELNAME ) ), UNO_QUERY ) ) ; + xRef_Topic_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; + xRef_Text_Top->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; + xRef_Topic_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; + xRef_Text_Bottom->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME ) ), UNO_QUERY ) ) ; + xRef_Button->setModel ( Reference< XControlModel > ( xFactory->createInstance ( OUString::createFromAscii( BUTTON_MODELNAME ) ), UNO_QUERY ) ) ; // ProgressBar has no model !!! // ... and add controls to basecontainercontrol! @@ -112,11 +112,11 @@ ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFact // Reset to defaults !!! // (progressbar take automaticly its own defaults) - m_xButton->setLabel ( OUString::createFromAscii( DEFAULT_BUTTONLABEL ) ) ; - m_xTopic_Top->setText ( OUString::createFromAscii( DEFAULT_TOPIC ) ) ; - m_xText_Top->setText ( OUString::createFromAscii( DEFAULT_TEXT ) ) ; - m_xTopic_Bottom->setText ( OUString::createFromAscii( DEFAULT_TOPIC ) ) ; - m_xText_Bottom->setText ( OUString::createFromAscii( DEFAULT_TEXT ) ) ; + m_xButton->setLabel ( OUString::createFromAscii( DEFAULT_BUTTONLABEL ) ) ; + m_xTopic_Top->setText ( OUString::createFromAscii( PROGRESSMONITOR_DEFAULT_TOPIC ) ) ; + m_xText_Top->setText ( OUString::createFromAscii( PROGRESSMONITOR_DEFAULT_TEXT ) ) ; + m_xTopic_Bottom->setText ( OUString::createFromAscii( PROGRESSMONITOR_DEFAULT_TOPIC ) ) ; + m_xText_Bottom->setText ( OUString::createFromAscii( PROGRESSMONITOR_DEFAULT_TEXT ) ) ; --m_refCount ; @@ -201,11 +201,11 @@ Sequence< Type > SAL_CALL ProgressMonitor::getTypes() throw( RuntimeException ) if ( pTypeCollection == NULL ) { // Create a static typecollection ... - static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XLayoutConstrains >*)NULL ) , - ::getCppuType(( const Reference< XButton >*)NULL ) , - ::getCppuType(( const Reference< XProgressMonitor >*)NULL ) , - BaseContainerControl::getTypes() - ); + static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XLayoutConstrains >*)NULL ) , + ::getCppuType(( const Reference< XButton >*)NULL ) , + ::getCppuType(( const Reference< XProgressMonitor >*)NULL ) , + BaseContainerControl::getTypes() + ); // ... and set his address to static pointer! pTypeCollection = &aTypeCollection ; } @@ -222,10 +222,10 @@ Any SAL_CALL ProgressMonitor::queryAggregation( const Type& aType ) throw( Runti { // Ask for my own supported interfaces ... // Attention: XTypeProvider and XInterface are supported by OComponentHelper! - Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XLayoutConstrains* > ( this ) , - static_cast< XButton* > ( this ) , - static_cast< XProgressMonitor* > ( this ) + Any aReturn ( ::cppu::queryInterface( aType , + static_cast< XLayoutConstrains* > ( this ) , + static_cast< XButton* > ( this ) , + static_cast< XProgressMonitor* > ( this ) ) ); @@ -243,7 +243,11 @@ Any SAL_CALL ProgressMonitor::queryAggregation( const Type& aType ) throw( Runti // XProgressMonitor //____________________________________________________________________________________________________________ -void SAL_CALL ProgressMonitor::addText( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress ) throw( RuntimeException ) +void SAL_CALL ProgressMonitor::addText( + const OUString& rTopic, + const OUString& rText, + sal_Bool bbeforeProgress +) throw( RuntimeException ) { // Safe impossible cases // Check valid call of this method. @@ -324,7 +328,11 @@ void SAL_CALL ProgressMonitor::removeText ( const OUString& rTopic, sal_Bool bbe // XProgressMonitor //____________________________________________________________________________________________________________ -void SAL_CALL ProgressMonitor::updateText ( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress ) throw( RuntimeException ) +void SAL_CALL ProgressMonitor::updateText ( + const OUString& rTopic, + const OUString& rText, + sal_Bool bbeforeProgress +) throw( RuntimeException ) { // Safe impossible cases // Check valid call of this method. @@ -490,7 +498,7 @@ void SAL_CALL ProgressMonitor::setActionCommand ( const OUString& rCommand ) thr Size SAL_CALL ProgressMonitor::getMinimumSize () throw( RuntimeException ) { - return Size (DEFAULT_WIDTH, DEFAULT_HEIGHT) ; + return Size (PROGRESSMONITOR_DEFAULT_WIDTH, PROGRESSMONITOR_DEFAULT_HEIGHT) ; } //____________________________________________________________________________________________________________ @@ -520,10 +528,10 @@ Size SAL_CALL ProgressMonitor::getPreferredSize () throw( RuntimeException ) sal_Int32 nWidth = 0 ; sal_Int32 nHeight = 0 ; - nWidth = 3 * FREEBORDER ; + nWidth = 3 * PROGRESSMONITOR_FREEBORDER ; nWidth += aProgressBarSize.Width ; - nHeight = 6 * FREEBORDER ; + nHeight = 6 * PROGRESSMONITOR_FREEBORDER ; nHeight += aTopicSize_Top.Height ; nHeight += aProgressBarSize.Height ; nHeight += aTopicSize_Bottom.Height; @@ -531,13 +539,13 @@ Size SAL_CALL ProgressMonitor::getPreferredSize () throw( RuntimeException ) nHeight += aButtonSize.Height ; // norm to minimum - if ( nWidth<DEFAULT_WIDTH ) + if ( nWidth < PROGRESSMONITOR_DEFAULT_WIDTH ) { - nWidth = DEFAULT_WIDTH ; + nWidth = PROGRESSMONITOR_DEFAULT_WIDTH ; } - if ( nHeight<DEFAULT_HEIGHT ) + if ( nHeight < PROGRESSMONITOR_DEFAULT_HEIGHT ) { - nHeight = DEFAULT_HEIGHT ; + nHeight = PROGRESSMONITOR_DEFAULT_HEIGHT ; } // return to caller @@ -686,19 +694,19 @@ void ProgressMonitor::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< MutexGuard aGuard ( m_aMutex ) ; // paint shadowed border around the progressmonitor - rGraphics->setLineColor ( LINECOLOR_SHADOW ) ; + rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_SHADOW ) ; rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ) ; rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ) ; - rGraphics->setLineColor ( LINECOLOR_BRIGHT ) ; + rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_BRIGHT ) ; rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ) ; rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ) ; // Paint 3D-line - rGraphics->setLineColor ( LINECOLOR_SHADOW ) ; + rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_SHADOW ) ; rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ; - rGraphics->setLineColor ( LINECOLOR_BRIGHT ) ; + rGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_BRIGHT ) ; rGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ; } } @@ -762,66 +770,66 @@ void ProgressMonitor::impl_recalcLayout () // calc position and size of child controls // Button has preferred size! - nWidth_Button = aButtonSize.Width ; - nHeight_Button = aButtonSize.Height ; + nWidth_Button = aButtonSize.Width ; + nHeight_Button = aButtonSize.Height ; // Left column before progressbar has preferred size and fixed position. // But "Width" is oriented on left column below progressbar to!!! "max(...)" - nX_Topic_Top = FREEBORDER ; - nY_Topic_Top = FREEBORDER ; - nWidth_Topic_Top = Max ( aTopicSize_Top.Width, aTopicSize_Bottom.Width ) ; - nHeight_Topic_Top = aTopicSize_Top.Height ; + nX_Topic_Top = PROGRESSMONITOR_FREEBORDER ; + nY_Topic_Top = PROGRESSMONITOR_FREEBORDER ; + nWidth_Topic_Top = Max ( aTopicSize_Top.Width, aTopicSize_Bottom.Width ) ; + nHeight_Topic_Top = aTopicSize_Top.Height ; // Right column before progressbar has relativ position to left column ... // ... and a size as rest of dialog size! - nX_Text_Top = nX_Topic_Top+nWidth_Topic_Top+FREEBORDER ; - nY_Text_Top = nY_Topic_Top ; - nWidth_Text_Top = Max ( aTextSize_Top.Width, aTextSize_Bottom.Width ) ; + nX_Text_Top = nX_Topic_Top+nWidth_Topic_Top+PROGRESSMONITOR_FREEBORDER; + nY_Text_Top = nY_Topic_Top ; + nWidth_Text_Top = Max ( aTextSize_Top.Width, aTextSize_Bottom.Width ) ; // Fix size of this column to minimum! - sal_Int32 nSummaryWidth = nWidth_Text_Top+nWidth_Topic_Top+(3*FREEBORDER) ; - if ( nSummaryWidth < DEFAULT_WIDTH ) - nWidth_Text_Top = DEFAULT_WIDTH-nWidth_Topic_Top-(3*FREEBORDER); + sal_Int32 nSummaryWidth = nWidth_Text_Top+nWidth_Topic_Top+(3*PROGRESSMONITOR_FREEBORDER) ; + if ( nSummaryWidth < PROGRESSMONITOR_DEFAULT_WIDTH ) + nWidth_Text_Top = PROGRESSMONITOR_DEFAULT_WIDTH-nWidth_Topic_Top-(3*PROGRESSMONITOR_FREEBORDER); // Fix size of column to maximum! if ( nSummaryWidth > impl_getWidth() ) - nWidth_Text_Top = impl_getWidth()-nWidth_Topic_Top-(3*FREEBORDER) ; + nWidth_Text_Top = impl_getWidth()-nWidth_Topic_Top-(3*PROGRESSMONITOR_FREEBORDER) ; nHeight_Text_Top = nHeight_Topic_Top ; // Position of progressbar is relativ to columns before. // Progressbar.Width = Dialog.Width !!! // Progressbar.Height = Button.Height nX_ProgressBar = nX_Topic_Top ; - nY_ProgressBar = nY_Topic_Top+nHeight_Topic_Top+FREEBORDER ; - nWidth_ProgressBar = FREEBORDER+nWidth_Topic_Top+nWidth_Text_Top ; + nY_ProgressBar = nY_Topic_Top+nHeight_Topic_Top+PROGRESSMONITOR_FREEBORDER ; + nWidth_ProgressBar = PROGRESSMONITOR_FREEBORDER+nWidth_Topic_Top+nWidth_Text_Top ; nHeight_ProgressBar = nHeight_Button ; // Oriented by left column before progressbar. nX_Topic_Bottom = nX_Topic_Top ; - nY_Topic_Bottom = nY_ProgressBar+nHeight_ProgressBar+FREEBORDER ; + nY_Topic_Bottom = nY_ProgressBar+nHeight_ProgressBar+PROGRESSMONITOR_FREEBORDER ; nWidth_Topic_Bottom = nWidth_Topic_Top ; nHeight_Topic_Bottom = aTopicSize_Bottom.Height ; // Oriented by right column before progressbar. - nX_Text_Bottom = nX_Topic_Bottom+nWidth_Topic_Bottom+FREEBORDER ; + nX_Text_Bottom = nX_Topic_Bottom+nWidth_Topic_Bottom+PROGRESSMONITOR_FREEBORDER ; nY_Text_Bottom = nY_Topic_Bottom ; nWidth_Text_Bottom = nWidth_Text_Top ; nHeight_Text_Bottom = nHeight_Topic_Bottom ; // Oriented by progressbar. nX_3DLine = nX_Topic_Top ; - nY_3DLine = nY_Topic_Bottom+nHeight_Topic_Bottom+(FREEBORDER/2) ; + nY_3DLine = nY_Topic_Bottom+nHeight_Topic_Bottom+(PROGRESSMONITOR_FREEBORDER/2) ; nWidth_3DLine = nWidth_ProgressBar ; nHeight_3DLine = 1 ; // Height for ONE line ! (But we paint two lines!) // Oriented by progressbar. nX_Button = nX_ProgressBar+nWidth_ProgressBar-nWidth_Button ; - nY_Button = nY_Topic_Bottom+nHeight_Topic_Bottom+FREEBORDER ; + nY_Button = nY_Topic_Bottom+nHeight_Topic_Bottom+PROGRESSMONITOR_FREEBORDER ; // Calc offsets to center controls sal_Int32 nDx ; sal_Int32 nDy ; - nDx = ( (2*FREEBORDER)+nWidth_ProgressBar ) ; - nDy = ( (6*FREEBORDER)+nHeight_Topic_Top+nHeight_ProgressBar+nHeight_Topic_Bottom+2+nHeight_Button ) ; + nDx = ( (2*PROGRESSMONITOR_FREEBORDER)+nWidth_ProgressBar ) ; + nDy = ( (6*PROGRESSMONITOR_FREEBORDER)+nHeight_Topic_Top+nHeight_ProgressBar+nHeight_Topic_Bottom+2+nHeight_Button ) ; // At this point use original dialog size to center controls! nDx = (impl_getWidth ()/2)-(nDx/2) ; @@ -844,26 +852,26 @@ void ProgressMonitor::impl_recalcLayout () Reference< XWindow > xRef_Button ( m_xButton , UNO_QUERY ) ; Reference< XWindow > xRef_ProgressBar ( m_xProgressBar , UNO_QUERY ) ; - xRef_Topic_Top->setPosSize ( nDx+nX_Topic_Top , nDy+nY_Topic_Top , nWidth_Topic_Top , nHeight_Topic_Top , 15 ) ; - xRef_Text_Top->setPosSize ( nDx+nX_Text_Top , nDy+nY_Text_Top , nWidth_Text_Top , nHeight_Text_Top , 15 ) ; - xRef_Topic_Bottom->setPosSize ( nDx+nX_Topic_Bottom , nDy+nY_Topic_Bottom , nWidth_Topic_Bottom , nHeight_Topic_Bottom , 15 ) ; - xRef_Text_Bottom->setPosSize ( nDx+nX_Text_Bottom , nDy+nY_Text_Bottom , nWidth_Text_Bottom , nHeight_Text_Bottom , 15 ) ; - xRef_Button->setPosSize ( nDx+nX_Button , nDy+nY_Button , nWidth_Button , nHeight_Button , 15 ) ; - xRef_ProgressBar->setPosSize ( nDx+nX_ProgressBar , nDy+nY_ProgressBar , nWidth_ProgressBar , nHeight_ProgressBar , 15 ) ; + xRef_Topic_Top->setPosSize ( nDx+nX_Topic_Top , nDy+nY_Topic_Top , nWidth_Topic_Top , nHeight_Topic_Top , 15 ) ; + xRef_Text_Top->setPosSize ( nDx+nX_Text_Top , nDy+nY_Text_Top , nWidth_Text_Top , nHeight_Text_Top , 15 ) ; + xRef_Topic_Bottom->setPosSize ( nDx+nX_Topic_Bottom , nDy+nY_Topic_Bottom , nWidth_Topic_Bottom , nHeight_Topic_Bottom , 15 ) ; + xRef_Text_Bottom->setPosSize ( nDx+nX_Text_Bottom , nDy+nY_Text_Bottom , nWidth_Text_Bottom , nHeight_Text_Bottom , 15 ) ; + xRef_Button->setPosSize ( nDx+nX_Button , nDy+nY_Button , nWidth_Button , nHeight_Button , 15 ) ; + xRef_ProgressBar->setPosSize ( nDx+nX_ProgressBar , nDy+nY_ProgressBar , nWidth_ProgressBar , nHeight_ProgressBar , 15 ) ; - m_a3DLine.X = nDx+nX_Topic_Top ; - m_a3DLine.Y = nDy+nY_Topic_Bottom+nHeight_Topic_Bottom+(FREEBORDER/2) ; - m_a3DLine.Width = nWidth_ProgressBar ; - m_a3DLine.Height = nHeight_ProgressBar ; + m_a3DLine.X = nDx+nX_Topic_Top ; + m_a3DLine.Y = nDy+nY_Topic_Bottom+nHeight_Topic_Bottom+(PROGRESSMONITOR_FREEBORDER/2) ; + m_a3DLine.Width = nWidth_ProgressBar ; + m_a3DLine.Height = nHeight_ProgressBar ; // All childcontrols make an implicit repaint in setPosSize()! // Make it also for this 3D-line ... Reference< XGraphics > xGraphics = impl_getGraphicsPeer () ; - xGraphics->setLineColor ( LINECOLOR_SHADOW ) ; + xGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_SHADOW ) ; xGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ; - xGraphics->setLineColor ( LINECOLOR_BRIGHT ) ; + xGraphics->setLineColor ( PROGRESSMONITOR_LINECOLOR_BRIGHT ) ; xGraphics->drawLine ( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ; } @@ -881,7 +889,7 @@ void ProgressMonitor::impl_rebuildFixedText () // Rebuild left site of text if (m_xTopic_Top.is()) { - OUString aCollectString ; + OUString aCollectString ; // Collect all topics from list and format text. // "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!! @@ -1033,8 +1041,11 @@ IMPL_TextlistItem* ProgressMonitor::impl_searchTopic ( const OUString& rTopic, s #ifdef DBG_UTIL // addText, updateText -sal_Bool ProgressMonitor::impl_debug_checkParameter ( const OUString& rTopic, const OUString& rText, sal_Bool /*bbeforeProgress*/ ) -{ +sal_Bool ProgressMonitor::impl_debug_checkParameter ( + const OUString& rTopic, + const OUString& rText, + sal_Bool /*bbeforeProgress*/ +) { // Check "rTopic" if ( &rTopic == NULL ) return sal_False ; // NULL-pointer for reference ???!!! if ( rTopic.getLength () < 1 ) return sal_False ; // "" diff --git a/UnoControls/source/controls/statusindicator.cxx b/UnoControls/source/controls/statusindicator.cxx index 8dbd6f2d03f7..70b195931c18 100644 --- a/UnoControls/source/controls/statusindicator.cxx +++ b/UnoControls/source/controls/statusindicator.cxx @@ -87,7 +87,7 @@ StatusIndicator::StatusIndicator( const Reference< XMultiServiceFactory >& xFact xProgressWindow->setVisible( sal_True ); // Reset to defaults !!! // (progressbar take automaticly its own defaults) - m_xText->setText( OUString::createFromAscii( DEFAULT_TEXT ) ); + m_xText->setText( OUString::createFromAscii( STATUSINDICATOR_DEFAULT_TEXT ) ); --m_refCount ; } @@ -170,9 +170,9 @@ Sequence< Type > SAL_CALL StatusIndicator::getTypes() throw( RuntimeException ) if ( pTypeCollection == NULL ) { // Create a static typecollection ... - static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XLayoutConstrains >*)NULL ) , - ::getCppuType(( const Reference< XStatusIndicator >*)NULL ) , - BaseContainerControl::getTypes() + static OTypeCollection aTypeCollection ( ::getCppuType(( const Reference< XLayoutConstrains >*)NULL ) , + ::getCppuType(( const Reference< XStatusIndicator >*)NULL ) , + BaseContainerControl::getTypes() ); // ... and set his address to static pointer! pTypeCollection = &aTypeCollection ; @@ -190,9 +190,9 @@ Any SAL_CALL StatusIndicator::queryAggregation( const Type& aType ) throw( Runti { // Ask for my own supported interfaces ... // Attention: XTypeProvider and XInterface are supported by OComponentHelper! - Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XLayoutConstrains* > ( this ) , - static_cast< XStatusIndicator* > ( this ) + Any aReturn ( ::cppu::queryInterface( aType , + static_cast< XLayoutConstrains* > ( this ) , + static_cast< XStatusIndicator* > ( this ) ) ); @@ -284,7 +284,7 @@ void SAL_CALL StatusIndicator::reset() throw( RuntimeException ) Size SAL_CALL StatusIndicator::getMinimumSize () throw( RuntimeException ) { - return Size (DEFAULT_WIDTH, DEFAULT_HEIGHT) ; + return Size (STATUSINDICATOR_DEFAULT_WIDTH, STATUSINDICATOR_DEFAULT_HEIGHT) ; } //____________________________________________________________________________________________________________ @@ -304,16 +304,16 @@ Size SAL_CALL StatusIndicator::getPreferredSize () throw( RuntimeException ) // calc preferred size of status indicator sal_Int32 nWidth = impl_getWidth() ; - sal_Int32 nHeight = (2*FREEBORDER)+aTextSize.Height ; + sal_Int32 nHeight = (2*STATUSINDICATOR_FREEBORDER)+aTextSize.Height ; // norm to minimum - if ( nWidth<DEFAULT_WIDTH ) + if ( nWidth<STATUSINDICATOR_DEFAULT_WIDTH ) { - nWidth = DEFAULT_WIDTH ; + nWidth = STATUSINDICATOR_DEFAULT_WIDTH ; } - if ( nHeight<DEFAULT_HEIGHT ) + if ( nHeight<STATUSINDICATOR_DEFAULT_HEIGHT ) { - nHeight = DEFAULT_HEIGHT ; + nHeight = STATUSINDICATOR_DEFAULT_HEIGHT ; } // return to caller @@ -333,7 +333,10 @@ Size SAL_CALL StatusIndicator::calcAdjustedSize ( const Size& /*rNewSize*/ ) thr // XControl //____________________________________________________________________________________________________________ -void SAL_CALL StatusIndicator::createPeer ( const Reference< XToolkit > & rToolkit, const Reference< XWindowPeer > & rParent ) throw( RuntimeException ) +void SAL_CALL StatusIndicator::createPeer ( + const Reference< XToolkit > & rToolkit, + const Reference< XWindowPeer > & rParent +) throw( RuntimeException ) { if( getPeer().is() == sal_False ) { @@ -395,7 +398,13 @@ void SAL_CALL StatusIndicator::dispose () throw( RuntimeException ) // XWindow //____________________________________________________________________________________________________________ -void SAL_CALL StatusIndicator::setPosSize ( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags ) throw( RuntimeException ) +void SAL_CALL StatusIndicator::setPosSize ( + sal_Int32 nX, + sal_Int32 nY, + sal_Int32 nWidth, + sal_Int32 nHeight, + sal_Int16 nFlags +) throw( RuntimeException ) { Rectangle aBasePosSize = getPosSize () ; BaseContainerControl::setPosSize (nX, nY, nWidth, nHeight, nFlags) ; @@ -473,25 +482,25 @@ void StatusIndicator::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< // background = gray Reference< XWindowPeer > xPeer( impl_getPeerWindow(), UNO_QUERY ); if( xPeer.is() == sal_True ) - xPeer->setBackground( BACKGROUNDCOLOR ); + xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); // FixedText background = gray Reference< XControl > xTextControl( m_xText, UNO_QUERY ); xPeer = xTextControl->getPeer(); if( xPeer.is() == sal_True ) - xPeer->setBackground( BACKGROUNDCOLOR ); + xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); // Progress background = gray xPeer = Reference< XWindowPeer >( m_xProgressBar, UNO_QUERY ); if( xPeer.is() == sal_True ) - xPeer->setBackground( BACKGROUNDCOLOR ); + xPeer->setBackground( STATUSINDICATOR_BACKGROUNDCOLOR ); // paint shadow border - rGraphics->setLineColor ( LINECOLOR_BRIGHT ); + rGraphics->setLineColor ( STATUSINDICATOR_LINECOLOR_BRIGHT ); rGraphics->drawLine ( nX, nY, impl_getWidth(), nY ); rGraphics->drawLine ( nX, nY, nX , impl_getHeight() ); - rGraphics->setLineColor ( LINECOLOR_SHADOW ); + rGraphics->setLineColor ( STATUSINDICATOR_LINECOLOR_SHADOW ); rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY ); rGraphics->drawLine ( impl_getWidth()-1, impl_getHeight()-1, nX , impl_getHeight()-1 ); } @@ -520,24 +529,24 @@ void StatusIndicator::impl_recalcLayout ( const WindowEvent& aEvent ) Reference< XLayoutConstrains > xTextLayout ( m_xText, UNO_QUERY ); Size aTextSize = xTextLayout->getPreferredSize(); - if( aWindowSize.Width < DEFAULT_WIDTH ) + if( aWindowSize.Width < STATUSINDICATOR_DEFAULT_WIDTH ) { - aWindowSize.Width = DEFAULT_WIDTH; + aWindowSize.Width = STATUSINDICATOR_DEFAULT_WIDTH; } - if( aWindowSize.Height < DEFAULT_HEIGHT ) + if( aWindowSize.Height < STATUSINDICATOR_DEFAULT_HEIGHT ) { - aWindowSize.Height = DEFAULT_HEIGHT; + aWindowSize.Height = STATUSINDICATOR_DEFAULT_HEIGHT; } // calc position and size of child controls - nX_Text = FREEBORDER ; - nY_Text = FREEBORDER ; + nX_Text = STATUSINDICATOR_FREEBORDER ; + nY_Text = STATUSINDICATOR_FREEBORDER ; nWidth_Text = aTextSize.Width ; nHeight_Text = aTextSize.Height ; - nX_ProgressBar = nX_Text+nWidth_Text+FREEBORDER ; + nX_ProgressBar = nX_Text+nWidth_Text+STATUSINDICATOR_FREEBORDER ; nY_ProgressBar = nY_Text ; - nWidth_ProgressBar = aWindowSize.Width-nWidth_Text-(3*FREEBORDER) ; + nWidth_ProgressBar = aWindowSize.Width-nWidth_Text-(3*STATUSINDICATOR_FREEBORDER) ; nHeight_ProgressBar = nHeight_Text ; // Set new position and size on all controls @@ -548,14 +557,6 @@ void StatusIndicator::impl_recalcLayout ( const WindowEvent& aEvent ) xProgressWindow->setPosSize ( nX_ProgressBar, nY_ProgressBar, nWidth_ProgressBar, nHeight_ProgressBar , 15 ) ; } -//____________________________________________________________________________________________________________ -// debug methods -//____________________________________________________________________________________________________________ - -#if OSL_DEBUG_LEVEL > 1 - -#endif // #if OSL_DEBUG_LEVEL > 1 - } // namespace unocontrols /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |