This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push:
new bb62c5cd6d Cleanup
bb62c5cd6d is described below
commit bb62c5cd6d2c386e4575c10b889ffeeecd287de8
Author: mseidel <[email protected]>
AuthorDate: Sun Feb 1 15:05:34 2026 +0100
Cleanup
---
main/vcl/source/control/spinfld.cxx | 653 +++++++++++++++++------------------
main/vcl/source/control/tabctrl.cxx | 15 +-
main/vcl/source/control/throbber.cxx | 382 ++++++++++----------
3 files changed, 523 insertions(+), 527 deletions(-)
diff --git a/main/vcl/source/control/spinfld.cxx
b/main/vcl/source/control/spinfld.cxx
index a3d5876932..25336bba7c 100644
--- a/main/vcl/source/control/spinfld.cxx
+++ b/main/vcl/source/control/spinfld.cxx
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
@@ -37,109 +35,108 @@
// =======================================================================
void ImplGetSpinbuttonValue( Window *pWin, const Rectangle& rUpperRect,
- const Rectangle& rLowerRect,
- sal_Bool bUpperIn, sal_Bool bLowerIn,
- sal_Bool bUpperEnabled, sal_Bool bLowerEnabled,
sal_Bool bHorz,
- SpinbuttonValue& rValue )
+ const Rectangle&
rLowerRect,
+ sal_Bool bUpperIn,
sal_Bool bLowerIn,
+ sal_Bool bUpperEnabled,
sal_Bool bLowerEnabled, sal_Bool bHorz,
+ SpinbuttonValue& rValue
)
{
- // convert spinbutton data to a SpinbuttonValue structure for native
painting
-
- rValue.maUpperRect = rUpperRect;
- rValue.maLowerRect = rLowerRect;
-
- Point aPointerPos = pWin->GetPointerPosPixel();
-
- ControlState nState = CTRL_STATE_ENABLED;
- if ( bUpperIn )
- nState |= CTRL_STATE_PRESSED;
- if ( !pWin->IsEnabled() || !bUpperEnabled )
- nState &= ~CTRL_STATE_ENABLED;
- if ( pWin->HasFocus() )
- nState |= CTRL_STATE_FOCUSED;
- if( pWin->IsMouseOver() && rUpperRect.IsInside( aPointerPos ) )
- nState |= CTRL_STATE_ROLLOVER;
- rValue.mnUpperState = nState;
-
- nState = CTRL_STATE_ENABLED;
- if ( bLowerIn )
- nState |= CTRL_STATE_PRESSED;
- if ( !pWin->IsEnabled() || !bLowerEnabled )
- nState &= ~CTRL_STATE_ENABLED;
- if ( pWin->HasFocus() )
- nState |= CTRL_STATE_FOCUSED;
- // for overlapping spins: highlight only one
- if( pWin->IsMouseOver() && rLowerRect.IsInside( aPointerPos ) &&
- !rUpperRect.IsInside( aPointerPos ) )
- nState |= CTRL_STATE_ROLLOVER;
- rValue.mnLowerState = nState;
-
- rValue.mnUpperPart = bHorz ? PART_BUTTON_LEFT : PART_BUTTON_UP;
- rValue.mnLowerPart = bHorz ? PART_BUTTON_RIGHT : PART_BUTTON_DOWN;
-}
+ // convert spinbutton data to a SpinbuttonValue structure for native
painting
+ rValue.maUpperRect = rUpperRect;
+ rValue.maLowerRect = rLowerRect;
+
+ Point aPointerPos = pWin->GetPointerPosPixel();
+
+ ControlState nState = CTRL_STATE_ENABLED;
+ if ( bUpperIn )
+ nState |= CTRL_STATE_PRESSED;
+ if ( !pWin->IsEnabled() || !bUpperEnabled )
+ nState &= ~CTRL_STATE_ENABLED;
+ if ( pWin->HasFocus() )
+ nState |= CTRL_STATE_FOCUSED;
+ if( pWin->IsMouseOver() && rUpperRect.IsInside( aPointerPos ) )
+ nState |= CTRL_STATE_ROLLOVER;
+ rValue.mnUpperState = nState;
+
+ nState = CTRL_STATE_ENABLED;
+ if ( bLowerIn )
+ nState |= CTRL_STATE_PRESSED;
+ if ( !pWin->IsEnabled() || !bLowerEnabled )
+ nState &= ~CTRL_STATE_ENABLED;
+ if ( pWin->HasFocus() )
+ nState |= CTRL_STATE_FOCUSED;
+ // for overlapping spins: highlight only one
+ if( pWin->IsMouseOver() && rLowerRect.IsInside( aPointerPos ) &&
+ !rUpperRect.IsInside(
aPointerPos ) )
+ nState |= CTRL_STATE_ROLLOVER;
+ rValue.mnLowerState = nState;
+
+ rValue.mnUpperPart = bHorz ? PART_BUTTON_LEFT : PART_BUTTON_UP;
+ rValue.mnLowerPart = bHorz ? PART_BUTTON_RIGHT : PART_BUTTON_DOWN;
+}
sal_Bool ImplDrawNativeSpinfield( Window *pWin, const SpinbuttonValue&
rSpinbuttonValue )
{
- sal_Bool bNativeOK = sal_False;
-
- if( pWin->IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL) &&
- // there is just no useful native support for spinfields with dropdown
- !(pWin->GetStyle() & WB_DROPDOWN) )
- {
- if( pWin->IsNativeControlSupported(CTRL_SPINBOX,
rSpinbuttonValue.mnUpperPart) &&
- pWin->IsNativeControlSupported(CTRL_SPINBOX,
rSpinbuttonValue.mnLowerPart) )
- {
- // only paint the embedded spin buttons, all buttons are painted
at once
- bNativeOK = pWin->DrawNativeControl( CTRL_SPINBOX,
PART_ALL_BUTTONS, Rectangle(), CTRL_STATE_ENABLED,
- rSpinbuttonValue, rtl::OUString() );
- }
- else
- {
- // paint the spinbox as a whole, use borderwindow to have proper
clipping
- Window *pBorder = pWin->GetWindow( WINDOW_BORDER );
-
- // to not overwrite everything, set the button region as
clipregion to the border window
- Rectangle aClipRect( rSpinbuttonValue.maLowerRect );
- aClipRect.Union( rSpinbuttonValue.maUpperRect );
-
- // convert from screen space to borderwin space
- aClipRect.SetPos(
pBorder->ScreenToOutputPixel(pWin->OutputToScreenPixel(aClipRect.TopLeft())) );
-
- Region oldRgn( pBorder->GetClipRegion() );
- pBorder->SetClipRegion( Region( aClipRect ) );
-
- Point aPt;
- Size aSize( pBorder->GetOutputSizePixel() ); // the size of the
border window, i.e., the whole control
- Rectangle aBound, aContent;
- Rectangle aNatRgn( aPt, aSize );
- if( ! ImplGetSVData()->maNWFData.mbCanDrawWidgetAnySize &&
- pBorder->GetNativeControlRegion( CTRL_SPINBOX,
PART_ENTIRE_CONTROL,
- aNatRgn, 0, rSpinbuttonValue,
rtl::OUString(), aBound, aContent) )
- {
- aSize = aContent.GetSize();
- }
-
- Rectangle aRgn( aPt, aSize );
- bNativeOK = pBorder->DrawNativeControl( CTRL_SPINBOX,
PART_ENTIRE_CONTROL, aRgn, CTRL_STATE_ENABLED,
- rSpinbuttonValue, rtl::OUString() );
-
- pBorder->SetClipRegion( oldRgn );
- }
- }
- return bNativeOK;
+ sal_Bool bNativeOK = sal_False;
+
+ if( pWin->IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL) &&
+ // there is just no useful native support for spinfields with
dropdown
+ !(pWin->GetStyle() & WB_DROPDOWN) )
+ {
+ if( pWin->IsNativeControlSupported(CTRL_SPINBOX,
rSpinbuttonValue.mnUpperPart) &&
+ pWin->IsNativeControlSupported(CTRL_SPINBOX,
rSpinbuttonValue.mnLowerPart) )
+ {
+ // only paint the embedded spin buttons, all buttons
are painted at once
+ bNativeOK = pWin->DrawNativeControl( CTRL_SPINBOX,
PART_ALL_BUTTONS, Rectangle(), CTRL_STATE_ENABLED,
+ rSpinbuttonValue,
rtl::OUString() );
+ }
+ else
+ {
+ // paint the spinbox as a whole, use borderwindow to
have proper clipping
+ Window *pBorder = pWin->GetWindow( WINDOW_BORDER );
+
+ // to not overwrite everything, set the button region
as clipregion to the border window
+ Rectangle aClipRect( rSpinbuttonValue.maLowerRect );
+ aClipRect.Union( rSpinbuttonValue.maUpperRect );
+
+ // convert from screen space to borderwin space
+ aClipRect.SetPos(
pBorder->ScreenToOutputPixel(pWin->OutputToScreenPixel(aClipRect.TopLeft())) );
+
+ Region oldRgn( pBorder->GetClipRegion() );
+ pBorder->SetClipRegion( Region( aClipRect ) );
+
+ Point aPt;
+ Size aSize( pBorder->GetOutputSizePixel() ); // the
size of the border window, i.e., the whole control
+ Rectangle aBound, aContent;
+ Rectangle aNatRgn( aPt, aSize );
+ if( ! ImplGetSVData()->maNWFData.mbCanDrawWidgetAnySize
&&
+ pBorder->GetNativeControlRegion( CTRL_SPINBOX,
PART_ENTIRE_CONTROL,
+
aNatRgn, 0, rSpinbuttonValue, rtl::OUString(), aBound,
aContent) )
+ {
+ aSize = aContent.GetSize();
+ }
+
+ Rectangle aRgn( aPt, aSize );
+ bNativeOK = pBorder->DrawNativeControl( CTRL_SPINBOX,
PART_ENTIRE_CONTROL, aRgn, CTRL_STATE_ENABLED,
+ rSpinbuttonValue,
rtl::OUString() );
+
+ pBorder->SetClipRegion( oldRgn );
+ }
+ }
+ return bNativeOK;
}
sal_Bool ImplDrawNativeSpinbuttons( Window *pWin, const SpinbuttonValue&
rSpinbuttonValue )
{
- sal_Bool bNativeOK = sal_False;
-
- if( pWin->IsNativeControlSupported(CTRL_SPINBUTTONS, PART_ENTIRE_CONTROL) )
- {
- // only paint the standalone spin buttons, all buttons are painted at
once
- bNativeOK = pWin->DrawNativeControl( CTRL_SPINBUTTONS,
PART_ALL_BUTTONS, Rectangle(), CTRL_STATE_ENABLED,
- rSpinbuttonValue, rtl::OUString() );
- }
- return bNativeOK;
+ sal_Bool bNativeOK = sal_False;
+
+ if( pWin->IsNativeControlSupported(CTRL_SPINBUTTONS,
PART_ENTIRE_CONTROL) )
+ {
+ // only paint the standalone spin buttons, all buttons are
painted at once
+ bNativeOK = pWin->DrawNativeControl( CTRL_SPINBUTTONS,
PART_ALL_BUTTONS, Rectangle(), CTRL_STATE_ENABLED,
+ rSpinbuttonValue, rtl::OUString() );
+ }
+ return bNativeOK;
}
void ImplDrawSpinButton( OutputDevice* pOutDev,
@@ -158,11 +155,11 @@ void ImplDrawSpinButton( OutputDevice* pOutDev,
const StyleSettings& rStyleSettings =
pOutDev->GetSettings().GetStyleSettings();
if ( rStyleSettings.GetOptions() & STYLE_OPTION_SPINARROW )
{
- // arrows are only use in OS/2 look
+ // arrows are only used in OS/2 look
if ( bHorz )
{
- eType1 = bMirrorHorz ? SYMBOL_ARROW_RIGHT : SYMBOL_ARROW_LEFT;
- eType2 = bMirrorHorz ? SYMBOL_ARROW_LEFT : SYMBOL_ARROW_RIGHT;
+ eType1 = bMirrorHorz ? SYMBOL_ARROW_RIGHT :
SYMBOL_ARROW_LEFT;
+ eType2 = bMirrorHorz ? SYMBOL_ARROW_LEFT :
SYMBOL_ARROW_RIGHT;
}
else
{
@@ -174,8 +171,8 @@ void ImplDrawSpinButton( OutputDevice* pOutDev,
{
if ( bHorz )
{
- eType1 = bMirrorHorz ? SYMBOL_SPIN_RIGHT : SYMBOL_SPIN_LEFT;
- eType2 = bMirrorHorz ? SYMBOL_SPIN_LEFT : SYMBOL_SPIN_RIGHT;
+ eType1 = bMirrorHorz ? SYMBOL_SPIN_RIGHT :
SYMBOL_SPIN_LEFT;
+ eType2 = bMirrorHorz ? SYMBOL_SPIN_LEFT :
SYMBOL_SPIN_RIGHT;
}
else
{
@@ -189,54 +186,54 @@ void ImplDrawSpinButton( OutputDevice* pOutDev,
if ( bUpperIn )
nTempStyle |= BUTTON_DRAW_PRESSED;
- sal_Bool bNativeOK = sal_False;
+ sal_Bool bNativeOK = sal_False;
Rectangle aUpRect;
- if( pOutDev->GetOutDevType() == OUTDEV_WINDOW )
- {
- Window *pWin = (Window*) pOutDev;
-
- // are we drawing standalone spin buttons or members of a spinfield ?
- ControlType aControl = CTRL_SPINBUTTONS;
- switch( pWin->GetType() )
- {
- case WINDOW_EDIT:
- case WINDOW_MULTILINEEDIT:
- case WINDOW_PATTERNFIELD:
- case WINDOW_METRICFIELD:
- case WINDOW_CURRENCYFIELD:
- case WINDOW_DATEFIELD:
- case WINDOW_TIMEFIELD:
- case WINDOW_LONGCURRENCYFIELD:
- case WINDOW_NUMERICFIELD:
- case WINDOW_SPINFIELD:
- aControl = CTRL_SPINBOX;
- break;
- default:
- aControl = CTRL_SPINBUTTONS;
- break;
- }
-
- SpinbuttonValue aValue;
- ImplGetSpinbuttonValue( pWin, rUpperRect, rLowerRect,
- bUpperIn, bLowerIn,
bUpperEnabled, bLowerEnabled,
- bHorz, aValue );
-
- if( aControl == CTRL_SPINBOX )
- bNativeOK = ImplDrawNativeSpinfield( pWin, aValue );
- else if( aControl == CTRL_SPINBUTTONS )
- bNativeOK = ImplDrawNativeSpinbuttons( pWin, aValue );
- }
-
- if( !bNativeOK )
- aUpRect = aDecoView.DrawButton( rUpperRect, nTempStyle );
+ if( pOutDev->GetOutDevType() == OUTDEV_WINDOW )
+ {
+ Window *pWin = (Window*) pOutDev;
+
+ // are we drawing standalone spin buttons or members of a
spinfield ?
+ ControlType aControl = CTRL_SPINBUTTONS;
+ switch( pWin->GetType() )
+ {
+ case WINDOW_EDIT:
+ case WINDOW_MULTILINEEDIT:
+ case WINDOW_PATTERNFIELD:
+ case WINDOW_METRICFIELD:
+ case WINDOW_CURRENCYFIELD:
+ case WINDOW_DATEFIELD:
+ case WINDOW_TIMEFIELD:
+ case WINDOW_LONGCURRENCYFIELD:
+ case WINDOW_NUMERICFIELD:
+ case WINDOW_SPINFIELD:
+ aControl = CTRL_SPINBOX;
+ break;
+ default:
+ aControl = CTRL_SPINBUTTONS;
+ break;
+ }
+
+ SpinbuttonValue aValue;
+ ImplGetSpinbuttonValue( pWin, rUpperRect, rLowerRect,
+ bUpperIn,
bLowerIn, bUpperEnabled, bLowerEnabled,
+ bHorz, aValue );
+
+ if( aControl == CTRL_SPINBOX )
+ bNativeOK = ImplDrawNativeSpinfield( pWin, aValue );
+ else if( aControl == CTRL_SPINBUTTONS )
+ bNativeOK = ImplDrawNativeSpinbuttons( pWin, aValue );
+ }
+
+ if( !bNativeOK )
+ aUpRect = aDecoView.DrawButton( rUpperRect, nTempStyle );
// Unteren/rechten Button malen
if ( bLowerIn )
nStyle |= BUTTON_DRAW_PRESSED;
Rectangle aLowRect;
- if( !bNativeOK )
- aLowRect = aDecoView.DrawButton( rLowerRect, nStyle );
+ if( !bNativeOK )
+ aLowRect = aDecoView.DrawButton( rLowerRect, nStyle );
// Zusaetzliche Default-Kante wollen wir auch ausnutzen
aUpRect.Left()--;
@@ -281,13 +278,13 @@ void ImplDrawSpinButton( OutputDevice* pOutDev,
nTempStyle = nSymStyle;
if ( !bUpperEnabled )
nTempStyle |= SYMBOL_DRAW_DISABLE;
- if( !bNativeOK )
- aDecoView.DrawSymbol( aUpRect, eType1,
rStyleSettings.GetButtonTextColor(), nTempStyle );
+ if( !bNativeOK )
+ aDecoView.DrawSymbol( aUpRect, eType1,
rStyleSettings.GetButtonTextColor(), nTempStyle );
if ( !bLowerEnabled )
nSymStyle |= SYMBOL_DRAW_DISABLE;
- if( !bNativeOK )
- aDecoView.DrawSymbol( aLowRect, eType2,
rStyleSettings.GetButtonTextColor(), nSymStyle );
+ if( !bNativeOK )
+ aDecoView.DrawSymbol( aLowRect, eType2,
rStyleSettings.GetButtonTextColor(), nSymStyle );
}
// =======================================================================
@@ -384,28 +381,28 @@ SpinField::~SpinField()
void SpinField::Up()
{
- ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_UP, maUpHdlLink, this
);
+ ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_UP, maUpHdlLink,
this );
}
// --------------------------------------------------------------------
void SpinField::Down()
{
- ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_DOWN, maDownHdlLink,
this );
+ ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_DOWN,
maDownHdlLink, this );
}
// --------------------------------------------------------------------
void SpinField::First()
{
- ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_FIRST,
maFirstHdlLink, this );
+ ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_FIRST,
maFirstHdlLink, this );
}
// --------------------------------------------------------------------
void SpinField::Last()
{
- ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_LAST, maLastHdlLink,
this );
+ ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_LAST,
maLastHdlLink, this );
}
// --------------------------------------------------------------------
@@ -588,27 +585,27 @@ long SpinField::Notify( NotifyEvent& rNEvt )
if ( rNEvt.GetType() == EVENT_COMMAND )
{
if ( ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL )
&& !IsReadOnly() )
- {
- sal_uInt16 nWheelBehavior(
GetSettings().GetMouseSettings().GetWheelBehavior() );
- if ( ( nWheelBehavior == MOUSE_WHEEL_ALWAYS )
- || ( ( nWheelBehavior == MOUSE_WHEEL_FOCUS_ONLY )
- && HasChildPathFocus()
- )
- )
- {
- const CommandWheelData* pData =
rNEvt.GetCommandEvent()->GetWheelData();
- if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
- {
- if ( pData->GetDelta() < 0L )
- Down();
- else
- Up();
- nDone = 1;
- }
- }
- else
- nDone = 0; // don't eat this event, let the default handling
happen (i.e. scroll the context)
- }
+ {
+ sal_uInt16 nWheelBehavior(
GetSettings().GetMouseSettings().GetWheelBehavior() );
+ if ( ( nWheelBehavior == MOUSE_WHEEL_ALWAYS )
+ || ( ( nWheelBehavior ==
MOUSE_WHEEL_FOCUS_ONLY )
+ && HasChildPathFocus()
+ )
+ )
+ {
+ const CommandWheelData* pData =
rNEvt.GetCommandEvent()->GetWheelData();
+ if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
+ {
+ if ( pData->GetDelta() < 0L )
+ Down();
+ else
+ Up();
+ nDone = 1;
+ }
+ }
+ else
+ nDone = 0; // don't eat this event, let the
default handling happen (i.e. scroll the context)
+ }
}
return nDone ? nDone : Edit::Notify( rNEvt );
@@ -625,14 +622,14 @@ void SpinField::Command( const CommandEvent& rCEvt )
void SpinField::FillLayoutData() const
{
- if( mbSpin )
- {
- mpControlData->mpLayoutData = new vcl::ControlLayoutData();
- AppendLayoutData( *GetSubEdit() );
- GetSubEdit()->SetLayoutDataParent( this );
- }
- else
- Edit::FillLayoutData();
+ if( mbSpin )
+ {
+ mpControlData->mpLayoutData = new vcl::ControlLayoutData();
+ AppendLayoutData( *GetSubEdit() );
+ GetSubEdit()->SetLayoutDataParent( this );
+ }
+ else
+ Edit::FillLayoutData();
}
// --------------------------------------------------------------------
@@ -642,8 +639,8 @@ void SpinField::Paint( const Rectangle& rRect )
if ( mbSpin )
{
sal_Bool bEnable = IsEnabled();
- ImplDrawSpinButton( this, maUpperRect, maLowerRect,
- mbUpperIn, mbLowerIn, bEnable, bEnable );
+ ImplDrawSpinButton( this, maUpperRect, maLowerRect,
+ mbUpperIn, mbLowerIn,
bEnable, bEnable );
}
if ( GetStyle() & WB_DROPDOWN )
@@ -697,52 +694,52 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev,
const Size& rOutSz, Rec
if ( !(aSize.Height() & 0x01) )
nBottom1--;
- sal_Bool bNativeRegionOK = sal_False;
- Rectangle aContentUp, aContentDown;
+ sal_Bool bNativeRegionOK = sal_False;
+ Rectangle aContentUp, aContentDown;
if ( (pDev->GetOutDevType() == OUTDEV_WINDOW) &&
- // there is just no useful native support for spinfields with
dropdown
- ! (GetStyle() & WB_DROPDOWN) &&
- IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL) )
- {
- Window *pWin = (Window*) pDev;
- Window *pBorder = pWin->GetWindow( WINDOW_BORDER );
-
- // get the system's spin button size
- ImplControlValue aControlValue;
- Rectangle aBound;
- Point aPoint;
-
- // use the full extent of the control
- Rectangle aArea( aPoint, pBorder->GetOutputSizePixel() );
-
- bNativeRegionOK =
- pWin->GetNativeControlRegion(CTRL_SPINBOX, PART_BUTTON_UP,
- aArea, 0, aControlValue, rtl::OUString(), aBound,
aContentUp) &&
- pWin->GetNativeControlRegion(CTRL_SPINBOX, PART_BUTTON_DOWN,
- aArea, 0, aControlValue, rtl::OUString(), aBound,
aContentDown);
-
- if( bNativeRegionOK )
- {
- // convert back from border space to local coordinates
- aPoint = pBorder->ScreenToOutputPixel(
pWin->OutputToScreenPixel( aPoint ) );
- aContentUp.Move(-aPoint.X(), -aPoint.Y());
- aContentDown.Move(-aPoint.X(), -aPoint.Y());
- }
- }
-
- if( bNativeRegionOK )
- {
- rSpinUpArea = aContentUp;
- rSpinDownArea = aContentDown;
- }
- else
- {
- aSize.Width() -= CalcZoom( GetDrawPixel( pDev,
rStyleSettings.GetSpinSize() ) );
-
- rSpinUpArea = Rectangle( aSize.Width(), nTop1,
rOutSz.Width()-aDropDownSize.Width()-1, nBottom1 );
- rSpinDownArea = Rectangle( rSpinUpArea.Left(), nTop2,
rSpinUpArea.Right(), nBottom2 );
- }
+ // there is just no useful native support for
spinfields with dropdown
+ ! (GetStyle() & WB_DROPDOWN) &&
+ IsNativeControlSupported(CTRL_SPINBOX,
PART_ENTIRE_CONTROL) )
+ {
+ Window *pWin = (Window*) pDev;
+ Window *pBorder = pWin->GetWindow( WINDOW_BORDER );
+
+ // get the system's spin button size
+ ImplControlValue aControlValue;
+ Rectangle aBound;
+ Point aPoint;
+
+ // use the full extent of the control
+ Rectangle aArea( aPoint, pBorder->GetOutputSizePixel()
);
+
+ bNativeRegionOK =
+ pWin->GetNativeControlRegion(CTRL_SPINBOX,
PART_BUTTON_UP,
+ aArea, 0, aControlValue,
rtl::OUString(), aBound, aContentUp) &&
+ pWin->GetNativeControlRegion(CTRL_SPINBOX,
PART_BUTTON_DOWN,
+ aArea, 0, aControlValue,
rtl::OUString(), aBound, aContentDown);
+
+ if( bNativeRegionOK )
+ {
+ // convert back from border space to local
coordinates
+ aPoint = pBorder->ScreenToOutputPixel(
pWin->OutputToScreenPixel( aPoint ) );
+ aContentUp.Move(-aPoint.X(), -aPoint.Y());
+ aContentDown.Move(-aPoint.X(), -aPoint.Y());
+ }
+ }
+
+ if( bNativeRegionOK )
+ {
+ rSpinUpArea = aContentUp;
+ rSpinDownArea = aContentDown;
+ }
+ else
+ {
+ aSize.Width() -= CalcZoom( GetDrawPixel( pDev,
rStyleSettings.GetSpinSize() ) );
+
+ rSpinUpArea = Rectangle( aSize.Width(), nTop1,
rOutSz.Width()-aDropDownSize.Width()-1, nBottom1 );
+ rSpinDownArea = Rectangle( rSpinUpArea.Left(), nTop2,
rSpinUpArea.Right(), nBottom2 );
+ }
}
else
{
@@ -759,50 +756,50 @@ void SpinField::Resize()
{
Control::Resize();
Size aSize = GetOutputSizePixel();
- bool bSubEditPositioned = false;
+ bool bSubEditPositioned = false;
if ( GetStyle() & (WB_SPIN|WB_DROPDOWN) )
{
ImplCalcButtonAreas( this, aSize, maDropDownRect,
maUpperRect, maLowerRect );
- ImplControlValue aControlValue;
- Point aPoint;
- Rectangle aContent, aBound;
-
- // use the full extent of the control
- Window *pBorder = GetWindow( WINDOW_BORDER );
- Rectangle aArea( aPoint, pBorder->GetOutputSizePixel() );
-
- // adjust position and size of the edit field
- if ( GetNativeControlRegion(CTRL_SPINBOX, PART_SUB_EDIT,
- aArea, 0, aControlValue, rtl::OUString(), aBound,
aContent) )
- {
- // convert back from border space to local coordinates
- aPoint = pBorder->ScreenToOutputPixel( OutputToScreenPixel(
aPoint ) );
- aContent.Move(-aPoint.X(), -aPoint.Y());
-
- // use the themes drop down size
- mpEdit->SetPosPixel( aContent.TopLeft() );
- bSubEditPositioned = true;
- aSize = aContent.GetSize();
- }
- else
- {
- if ( maUpperRect.IsEmpty() )
- {
- DBG_ASSERT( !maDropDownRect.IsEmpty(), "SpinField::Resize:
SPIN && DROPDOWN, but all empty rects?" );
- aSize.Width() = maDropDownRect.Left();
- }
- else
- aSize.Width() = maUpperRect.Left();
- }
+ ImplControlValue aControlValue;
+ Point aPoint;
+ Rectangle aContent, aBound;
+
+ // use the full extent of the control
+ Window *pBorder = GetWindow( WINDOW_BORDER );
+ Rectangle aArea( aPoint, pBorder->GetOutputSizePixel()
);
+
+ // adjust position and size of the edit field
+ if ( GetNativeControlRegion(CTRL_SPINBOX, PART_SUB_EDIT,
+ aArea, 0, aControlValue,
rtl::OUString(), aBound, aContent) )
+ {
+ // convert back from border space to local
coordinates
+ aPoint = pBorder->ScreenToOutputPixel(
OutputToScreenPixel( aPoint ) );
+ aContent.Move(-aPoint.X(), -aPoint.Y());
+
+ // use the themes drop down size
+ mpEdit->SetPosPixel( aContent.TopLeft() );
+ bSubEditPositioned = true;
+ aSize = aContent.GetSize();
+ }
+ else
+ {
+ if ( maUpperRect.IsEmpty() )
+ {
+ DBG_ASSERT( !maDropDownRect.IsEmpty(),
"SpinField::Resize: SPIN && DROPDOWN, but all empty rects?" );
+ aSize.Width() = maDropDownRect.Left();
+ }
+ else
+ aSize.Width() = maUpperRect.Left();
+ }
}
- if( ! bSubEditPositioned )
- {
- // this moves our sub edit if RTL gets switched
- mpEdit->SetPosPixel( Point() );
- }
+ if( ! bSubEditPositioned )
+ {
+ // this moves our sub edit if RTL gets switched
+ mpEdit->SetPosPixel( Point() );
+ }
mpEdit->SetSizePixel( aSize );
if ( GetStyle() & WB_SPIN )
@@ -868,12 +865,12 @@ void SpinField::StateChanged( StateChangedType nType )
ImplInitSettings( sal_False, sal_False, sal_True );
Invalidate();
}
- else if( nType == STATE_CHANGE_MIRRORING )
- {
- if( mpEdit )
- mpEdit->StateChanged( STATE_CHANGE_MIRRORING );
- Resize();
- }
+ else if( nType == STATE_CHANGE_MIRRORING )
+ {
+ if( mpEdit )
+ mpEdit->StateChanged( STATE_CHANGE_MIRRORING );
+ Resize();
+ }
}
// -----------------------------------------------------------------------
@@ -894,62 +891,62 @@ void SpinField::DataChanged( const DataChangedEvent&
rDCEvt )
Rectangle* SpinField::ImplFindPartRect( const Point& rPt )
{
- if( maUpperRect.IsInside( rPt ) )
- return &maUpperRect;
- else if( maLowerRect.IsInside( rPt ) )
- return &maLowerRect;
- else
- return NULL;
+ if( maUpperRect.IsInside( rPt ) )
+ return &maUpperRect;
+ else if( maLowerRect.IsInside( rPt ) )
+ return &maLowerRect;
+ else
+ return NULL;
}
long SpinField::PreNotify( NotifyEvent& rNEvt )
{
- long nDone = 0;
- const MouseEvent* pMouseEvt = NULL;
-
- if( (rNEvt.GetType() == EVENT_MOUSEMOVE) && (pMouseEvt =
rNEvt.GetMouseEvent()) != NULL )
- {
- if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() &&
!pMouseEvt->IsModifierChanged() )
- {
- // trigger redraw if mouse over state has changed
- if( IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL) ||
- IsNativeControlSupported(CTRL_SPINBOX, PART_ALL_BUTTONS) )
- {
- Rectangle* pRect = ImplFindPartRect( GetPointerPosPixel() );
- Rectangle* pLastRect = ImplFindPartRect(
GetLastPointerPosPixel() );
- if( pRect != pLastRect || (pMouseEvt->IsLeaveWindow() ||
pMouseEvt->IsEnterWindow()) )
- {
- // FIXME: this is currently only on aqua
- // check for other platforms that need similar handling
- if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
- IsNativeWidgetEnabled() &&
- IsNativeControlSupported( CTRL_EDITBOX,
PART_ENTIRE_CONTROL ) )
- {
- ImplInvalidateOutermostBorder( this );
- }
- else
- {
- // paint directly
- Region aRgn( GetActiveClipRegion() );
- if( pLastRect )
- {
- SetClipRegion( *pLastRect );
- Paint( *pLastRect );
- SetClipRegion( aRgn );
- }
- if( pRect )
- {
- SetClipRegion( *pRect );
- Paint( *pRect );
- SetClipRegion( aRgn );
- }
- }
- }
- }
- }
- }
-
- return nDone ? nDone : Edit::PreNotify(rNEvt);
+ long nDone = 0;
+ const MouseEvent* pMouseEvt = NULL;
+
+ if( (rNEvt.GetType() == EVENT_MOUSEMOVE) && (pMouseEvt =
rNEvt.GetMouseEvent()) != NULL )
+ {
+ if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() &&
!pMouseEvt->IsModifierChanged() )
+ {
+ // trigger redraw if mouse over state has changed
+ if( IsNativeControlSupported(CTRL_SPINBOX,
PART_ENTIRE_CONTROL) ||
+ IsNativeControlSupported(CTRL_SPINBOX,
PART_ALL_BUTTONS) )
+ {
+ Rectangle* pRect = ImplFindPartRect(
GetPointerPosPixel() );
+ Rectangle* pLastRect = ImplFindPartRect(
GetLastPointerPosPixel() );
+ if( pRect != pLastRect ||
(pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow()) )
+ {
+ // FIXME: this is currently only on aqua
+ // check for other platforms that need
similar handling
+ if(
ImplGetSVData()->maNWFData.mbNoFocusRects &&
+ IsNativeWidgetEnabled() &&
+ IsNativeControlSupported(
CTRL_EDITBOX, PART_ENTIRE_CONTROL ) )
+ {
+ ImplInvalidateOutermostBorder(
this );
+ }
+ else
+ {
+ // paint directly
+ Region aRgn(
GetActiveClipRegion() );
+ if( pLastRect )
+ {
+ SetClipRegion(
*pLastRect );
+ Paint( *pLastRect );
+ SetClipRegion( aRgn );
+ }
+ if( pRect )
+ {
+ SetClipRegion( *pRect );
+ Paint( *pRect );
+ SetClipRegion( aRgn );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return nDone ? nDone : Edit::PreNotify(rNEvt);
}
// -----------------------------------------------------------------------
@@ -985,12 +982,12 @@ Size SpinField::CalcMinimumSize() const
Size SpinField::GetOptimalSize(WindowSizeType eType) const
{
- switch (eType) {
- case WINDOWSIZE_MINIMUM:
- return CalcMinimumSize();
- default:
- return Edit::GetOptimalSize( eType );
- }
+ switch (eType) {
+ case WINDOWSIZE_MINIMUM:
+ return CalcMinimumSize();
+ default:
+ return Edit::GetOptimalSize( eType );
+ }
}
// -----------------------------------------------------------------------
@@ -1044,7 +1041,7 @@ void SpinField::Draw( OutputDevice* pDev, const Point&
rPos, const Size& rSize,
pDev->SetMapMode();
if ( eOutDevType == OUTDEV_PRINTER )
- {
+ {
StyleSettings aStyleSettings =
aOldSettings.GetStyleSettings();
aStyleSettings.SetFaceColor( COL_LIGHTGRAY );
aStyleSettings.SetButtonTextColor( COL_BLACK );
@@ -1088,3 +1085,5 @@ void SpinField::Draw( OutputDevice* pDev, const Point&
rPos, const Size& rSize,
pDev->SetSettings( aOldSettings );
}
}
+
+/* vim: set noet sw=4 ts=4: */
diff --git a/main/vcl/source/control/tabctrl.cxx
b/main/vcl/source/control/tabctrl.cxx
index 24cb0efb8f..9defbc8be7 100644
--- a/main/vcl/source/control/tabctrl.cxx
+++ b/main/vcl/source/control/tabctrl.cxx
@@ -90,7 +90,7 @@ struct ImplTabCtrlData
#define TAB_BORDER_RIGHT 2
#define TAB_BORDER_BOTTOM 2
-// Fuer die Ermittlung von den Tab-Positionen
+// Für die Ermittlung von den Tab-Positionen
#define TAB_PAGERECT 0xFFFF
// =======================================================================
@@ -120,7 +120,6 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle )
mpTabCtrlData = new ImplTabCtrlData;
mpTabCtrlData->mpListBox = NULL;
-
ImplInitSettings( sal_True, sal_True, sal_True );
if( (nStyle & WB_DROPDOWN) )
@@ -255,7 +254,7 @@ TabControl::~TabControl()
ImplFreeLayoutData();
- // TabCtrl-Daten loeschen
+ // TabCtrl-Daten löschen
if ( mpTabCtrlData )
{
if( mpTabCtrlData->mpListBox )
@@ -316,7 +315,7 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long
nMaxWidth )
else if ( pItem->maFormatText.Len() < TAB_EXTRASPACE_X )
aSize.Width() += TAB_EXTRASPACE_X-pItem->maFormatText.Len();
- // Evtl. den Text kuerzen
+ // Evtl. den Text kürzen
if ( aSize.Width()+4 >= nMaxWidth )
{
XubString aAppendStr( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
@@ -781,7 +780,7 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const
Rectangle& rCurRect, bo
else
nOff = 0;
- // Wenn wir die aktuelle Page sind, muessen wir etwas mehr zeichnen
+ // Wenn wir die aktuelle Page sind, müssen wir etwas mehr zeichnen
if ( pItem->mnId == mnCurPageId )
{
nOff2 = 2;
@@ -982,7 +981,6 @@ long TabControl::ImplHandleKeyEvent( const KeyEvent&
rKeyEvent )
return nRet;
}
-
// -----------------------------------------------------------------------
IMPL_LINK( TabControl, ImplListBoxSelectHdl, ListBox*, EMPTYARG )
@@ -998,7 +996,7 @@ IMPL_LINK( TabControl, ImplWindowEventListener,
VclSimpleEvent*, pEvent )
if ( pEvent && pEvent->ISA( VclWindowEvent ) && (pEvent->GetId() ==
VCLEVENT_WINDOW_KEYINPUT) )
{
VclWindowEvent* pWindowEvent = static_cast< VclWindowEvent*
>(pEvent);
- // Do not handle events from TabControl or it's children, which
is done in Notify(), where the events can be consumed.
+ // Do not handle events from TabControl or its children, which
is done in Notify(), where the events can be consumed.
if ( !IsWindowOrChild( pWindowEvent->GetWindow() ) )
{
KeyEvent* pKeyEvent = static_cast< KeyEvent*
>(pWindowEvent->GetData());
@@ -1008,7 +1006,6 @@ IMPL_LINK( TabControl, ImplWindowEventListener,
VclSimpleEvent*, pEvent )
return 0;
}
-
// -----------------------------------------------------------------------
void TabControl::MouseButtonDown( const MouseEvent& rMEvt )
@@ -1351,7 +1348,7 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt )
rtl::OUString aHelpId( rtl::OStringToOUString(
GetHelpId( nItemId ), RTL_TEXTENCODING_UTF8 ) );
if ( aHelpId.getLength() )
{
- // Wenn eine Hilfe existiert, dann ausloesen
+ // Wenn eine Hilfe existiert, dann auslösen
Help* pHelp = Application::GetHelp();
if ( pHelp )
pHelp->Start( aHelpId, this );
diff --git a/main/vcl/source/control/throbber.cxx
b/main/vcl/source/control/throbber.cxx
index f6514ed2d3..7f0524f9a9 100644
--- a/main/vcl/source/control/throbber.cxx
+++ b/main/vcl/source/control/throbber.cxx
@@ -47,262 +47,262 @@ namespace ImageScaleMode =
::com::sun::star::awt::ImageScaleMode;
//----------------------------------------------------------------------------------------------------------------------
Throbber::Throbber( Window* i_parentWindow, WinBits i_style, const ImageSet
i_imageSet )
- :ImageControl( i_parentWindow, i_style )
- ,mbRepeat( sal_True )
- ,mnStepTime( 100 )
- ,mnCurStep( 0 )
- ,mnStepCount( 0 )
- ,meImageSet( i_imageSet )
+ :ImageControl( i_parentWindow, i_style )
+ ,mbRepeat( sal_True )
+ ,mnStepTime( 100 )
+ ,mnCurStep( 0 )
+ ,mnStepCount( 0 )
+ ,meImageSet( i_imageSet )
{
- maWaitTimer.SetTimeout( mnStepTime );
- maWaitTimer.SetTimeoutHdl( LINK( this, Throbber, TimeOutHdl ) );
+ maWaitTimer.SetTimeout( mnStepTime );
+ maWaitTimer.SetTimeoutHdl( LINK( this, Throbber, TimeOutHdl ) );
- SetScaleMode( ImageScaleMode::NONE );
- initImages();
+ SetScaleMode( ImageScaleMode::NONE );
+ initImages();
}
//--------------------------------------------------------------------
Throbber::Throbber( Window* i_parentWindow, const ResId& i_resId, const
ImageSet i_imageSet )
- :ImageControl( i_parentWindow, i_resId )
- ,mbRepeat( sal_True )
- ,mnStepTime( 100 )
- ,mnCurStep( 0 )
- ,mnStepCount( 0 )
- ,meImageSet( i_imageSet )
+ :ImageControl( i_parentWindow, i_resId )
+ ,mbRepeat( sal_True )
+ ,mnStepTime( 100 )
+ ,mnCurStep( 0 )
+ ,mnStepCount( 0 )
+ ,meImageSet( i_imageSet )
{
- maWaitTimer.SetTimeout( mnStepTime );
- maWaitTimer.SetTimeoutHdl( LINK( this, Throbber, TimeOutHdl ) );
+ maWaitTimer.SetTimeout( mnStepTime );
+ maWaitTimer.SetTimeoutHdl( LINK( this, Throbber, TimeOutHdl ) );
- SetScaleMode( ImageScaleMode::NONE );
- initImages();
+ SetScaleMode( ImageScaleMode::NONE );
+ initImages();
}
//----------------------------------------------------------------------------------------------------------------------
Throbber::~Throbber()
{
- maWaitTimer.Stop();
+ maWaitTimer.Stop();
}
//----------------------------------------------------------------------------------------------------------------------
namespace
{
- ::std::vector< Image > lcl_loadImageSet( const Throbber::ImageSet
i_imageSet, const bool i_isHiContrast )
- {
- ::std::vector< Image > aImages;
- ENSURE_OR_RETURN( i_imageSet != Throbber::IMAGES_NONE,
"lcl_loadImageSet: illegal image set", aImages );
-
- const ::comphelper::ComponentContext aContext(
::comphelper::getProcessServiceFactory() );
- const Reference< XGraphicProvider > xGraphicProvider(
aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ),
UNO_QUERY_THROW );
-
- ::std::vector< ::rtl::OUString > aImageURLs(
Throbber::getDefaultImageURLs( i_imageSet ) );
- aImages.reserve( aImageURLs.size() );
-
- ::comphelper::NamedValueCollection aMediaProperties;
- for ( ::std::vector< ::rtl::OUString >::const_iterator imageURL =
aImageURLs.begin();
- imageURL != aImageURLs.end();
- ++imageURL
- )
- {
- Reference< XGraphic > xGraphic;
- if ( i_isHiContrast )
- {
- INetURLObject aURL( *imageURL );
- if ( aURL.GetProtocol() != INET_PROT_PRIV_SOFFICE )
- {
- const sal_Int32 separatorPos = imageURL->lastIndexOf( '/'
);
- if ( separatorPos != -1 )
- {
- ::rtl::OUStringBuffer composer;
- composer.append( imageURL->copy( 0, separatorPos ) );
- composer.appendAscii( RTL_CONSTASCII_STRINGPARAM(
"/hicontrast" ) );
- composer.append( imageURL->copy( separatorPos ) );
-
- aMediaProperties.put( "URL",
composer.makeStringAndClear() );
- xGraphic.set( xGraphicProvider->queryGraphic(
aMediaProperties.getPropertyValues() ), UNO_QUERY );
- }
- }
- }
- if ( !xGraphic.is() )
- {
- aMediaProperties.put( "URL", *imageURL );
- xGraphic.set( xGraphicProvider->queryGraphic(
aMediaProperties.getPropertyValues() ), UNO_QUERY );
- }
- aImages.push_back( Image( xGraphic ) );
- }
-
- return aImages;
- }
+ ::std::vector< Image > lcl_loadImageSet( const Throbber::ImageSet
i_imageSet, const bool i_isHiContrast )
+ {
+ ::std::vector< Image > aImages;
+ ENSURE_OR_RETURN( i_imageSet != Throbber::IMAGES_NONE,
"lcl_loadImageSet: illegal image set", aImages );
+
+ const ::comphelper::ComponentContext aContext(
::comphelper::getProcessServiceFactory() );
+ const Reference< XGraphicProvider > xGraphicProvider(
aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ),
UNO_QUERY_THROW );
+
+ ::std::vector< ::rtl::OUString > aImageURLs(
Throbber::getDefaultImageURLs( i_imageSet ) );
+ aImages.reserve( aImageURLs.size() );
+
+ ::comphelper::NamedValueCollection aMediaProperties;
+ for ( ::std::vector< ::rtl::OUString >::const_iterator
imageURL = aImageURLs.begin();
+ imageURL != aImageURLs.end();
+ ++imageURL
+ )
+ {
+ Reference< XGraphic > xGraphic;
+ if ( i_isHiContrast )
+ {
+ INetURLObject aURL( *imageURL );
+ if ( aURL.GetProtocol() !=
INET_PROT_PRIV_SOFFICE )
+ {
+ const sal_Int32 separatorPos =
imageURL->lastIndexOf( '/' );
+ if ( separatorPos != -1 )
+ {
+ ::rtl::OUStringBuffer composer;
+ composer.append(
imageURL->copy( 0, separatorPos ) );
+ composer.appendAscii(
RTL_CONSTASCII_STRINGPARAM( "/hicontrast" ) );
+ composer.append(
imageURL->copy( separatorPos ) );
+
+ aMediaProperties.put( "URL",
composer.makeStringAndClear() );
+ xGraphic.set(
xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ),
UNO_QUERY );
+ }
+ }
+ }
+ if ( !xGraphic.is() )
+ {
+ aMediaProperties.put( "URL", *imageURL );
+ xGraphic.set( xGraphicProvider->queryGraphic(
aMediaProperties.getPropertyValues() ), UNO_QUERY );
+ }
+ aImages.push_back( Image( xGraphic ) );
+ }
+
+ return aImages;
+ }
}
//----------------------------------------------------------------------------------------------------------------------
void Throbber::Resize()
{
- ImageControl::Resize();
+ ImageControl::Resize();
- if ( meImageSet == IMAGES_AUTO )
- initImages();
+ if ( meImageSet == IMAGES_AUTO )
+ initImages();
}
//----------------------------------------------------------------------------------------------------------------------
void Throbber::initImages()
{
- if ( meImageSet == IMAGES_NONE )
- return;
-
- try
- {
- ::std::vector< ::std::vector< Image > > aImageSets;
- const bool isHiContrast =
GetSettings().GetStyleSettings().GetHighContrastMode();
- if ( meImageSet == IMAGES_AUTO )
- {
- aImageSets.push_back( lcl_loadImageSet( IMAGES_16_PX, isHiContrast
) );
- aImageSets.push_back( lcl_loadImageSet( IMAGES_32_PX, isHiContrast
) );
- aImageSets.push_back( lcl_loadImageSet( IMAGES_64_PX, isHiContrast
) );
- }
- else
- {
- aImageSets.push_back( lcl_loadImageSet( meImageSet, isHiContrast )
);
- }
-
- // find the best matching image set (size-wise)
- const ::Size aWindowSizePixel = GetSizePixel();
- size_t nPreferredSet = 0;
- if ( aImageSets.size() > 1 )
- {
- long nMinimalDistance = ::std::numeric_limits< long >::max();
- for ( ::std::vector< ::std::vector< Image > >::const_iterator
check = aImageSets.begin();
- check != aImageSets.end();
- ++check
- )
- {
- ENSURE_OR_CONTINUE( !check->empty(), "Throbber::initImages:
illegal image!" );
- const Size aImageSize = (*check)[0].GetSizePixel();
-
- if ( ( aImageSize.Width() > aWindowSizePixel.Width() )
- || ( aImageSize.Height() > aWindowSizePixel.Height() )
- )
- // do not use an image set which doesn't fit into the
window
- continue;
-
- const sal_Int64 distance =
- ( aWindowSizePixel.Width() - aImageSize.Width() ) * (
aWindowSizePixel.Width() - aImageSize.Width() )
- + ( aWindowSizePixel.Height() - aImageSize.Height() ) *
( aWindowSizePixel.Height() - aImageSize.Height() );
- if ( distance < nMinimalDistance )
- {
- nMinimalDistance = distance;
- nPreferredSet = check - aImageSets.begin();
- }
- }
- }
-
- if ( nPreferredSet < aImageSets.size() )
- setImageList( aImageSets[nPreferredSet] );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
+ if ( meImageSet == IMAGES_NONE )
+ return;
+
+ try
+ {
+ ::std::vector< ::std::vector< Image > > aImageSets;
+ const bool isHiContrast =
GetSettings().GetStyleSettings().GetHighContrastMode();
+ if ( meImageSet == IMAGES_AUTO )
+ {
+ aImageSets.push_back( lcl_loadImageSet( IMAGES_16_PX,
isHiContrast ) );
+ aImageSets.push_back( lcl_loadImageSet( IMAGES_32_PX,
isHiContrast ) );
+ aImageSets.push_back( lcl_loadImageSet( IMAGES_64_PX,
isHiContrast ) );
+ }
+ else
+ {
+ aImageSets.push_back( lcl_loadImageSet( meImageSet,
isHiContrast ) );
+ }
+
+ // find the best matching image set (size-wise)
+ const ::Size aWindowSizePixel = GetSizePixel();
+ size_t nPreferredSet = 0;
+ if ( aImageSets.size() > 1 )
+ {
+ long nMinimalDistance = ::std::numeric_limits< long
>::max();
+ for ( ::std::vector< ::std::vector< Image >
>::const_iterator check = aImageSets.begin();
+ check != aImageSets.end();
+ ++check
+ )
+ {
+ ENSURE_OR_CONTINUE( !check->empty(),
"Throbber::initImages: illegal image!" );
+ const Size aImageSize =
(*check)[0].GetSizePixel();
+
+ if ( ( aImageSize.Width() >
aWindowSizePixel.Width() )
+ || ( aImageSize.Height() >
aWindowSizePixel.Height() )
+ )
+ // do not use an image set which
doesn't fit into the window
+ continue;
+
+ const sal_Int64 distance =
+ ( aWindowSizePixel.Width() -
aImageSize.Width() ) * ( aWindowSizePixel.Width() - aImageSize.Width() )
+ + ( aWindowSizePixel.Height() -
aImageSize.Height() ) * ( aWindowSizePixel.Height() - aImageSize.Height() );
+ if ( distance < nMinimalDistance )
+ {
+ nMinimalDistance = distance;
+ nPreferredSet = check -
aImageSets.begin();
+ }
+ }
+ }
+
+ if ( nPreferredSet < aImageSets.size() )
+ setImageList( aImageSets[nPreferredSet] );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
//----------------------------------------------------------------------------------------------------------------------
void Throbber::start()
{
- maWaitTimer.Start();
+ maWaitTimer.Start();
}
//----------------------------------------------------------------------------------------------------------------------
void Throbber::stop()
{
- maWaitTimer.Stop();
+ maWaitTimer.Stop();
}
//----------------------------------------------------------------------------------------------------------------------
bool Throbber::isRunning() const
{
- return maWaitTimer.IsActive();
+ return maWaitTimer.IsActive();
}
//----------------------------------------------------------------------------------------------------------------------
void Throbber::setImageList( ::std::vector< Image > const& i_images )
{
- maImageList = i_images;
+ maImageList = i_images;
- mnStepCount = maImageList.size();
- const Image aInitialImage( mnStepCount ? maImageList[ 0 ] : Image() );
- SetImage( aInitialImage );
+ mnStepCount = maImageList.size();
+ const Image aInitialImage( mnStepCount ? maImageList[ 0 ] : Image() );
+ SetImage( aInitialImage );
}
//----------------------------------------------------------------------------------------------------------------------
void Throbber::setImageList( const Sequence< Reference< XGraphic > >&
rImageList )
{
- ::std::vector< Image > aImages( rImageList.getLength() );
- ::std::copy(
- rImageList.getConstArray(),
- rImageList.getConstArray() + rImageList.getLength(),
- aImages.begin()
- );
- setImageList( aImages );
+ ::std::vector< Image > aImages( rImageList.getLength() );
+ ::std::copy(
+ rImageList.getConstArray(),
+ rImageList.getConstArray() + rImageList.getLength(),
+ aImages.begin()
+ );
+ setImageList( aImages );
}
//----------------------------------------------------------------------------------------------------------------------
::std::vector< ::rtl::OUString > Throbber::getDefaultImageURLs( const ImageSet
i_imageSet )
{
- ::std::vector< ::rtl::OUString > aImageURLs;
-
- sal_Char const* const pResolutions[] = { "16", "32", "64" };
- size_t const nImageCounts[] = { 12, 12, 12 };
-
- size_t index = 0;
- switch ( i_imageSet )
- {
- case IMAGES_16_PX: index = 0; break;
- case IMAGES_32_PX: index = 1; break;
- case IMAGES_64_PX: index = 2; break;
- case IMAGES_NONE:
- case IMAGES_AUTO:
- OSL_ENSURE( false, "Throbber::getDefaultImageURLs: illegal image set!"
);
- return aImageURLs;
- }
-
- aImageURLs.reserve( nImageCounts[index] );
- for ( size_t i=0; i<nImageCounts[index]; ++i )
- {
- ::rtl::OUStringBuffer aURL;
- aURL.appendAscii( "private:graphicrepository/vcl/res/spinner-" );
- aURL.appendAscii( pResolutions[index] );
- aURL.appendAscii( "-" );
- if ( i < 9 )
- aURL.appendAscii( "0" );
- aURL.append ( sal_Int32( i + 1 ) );
- aURL.appendAscii( ".png" );
-
- aImageURLs.push_back( aURL.makeStringAndClear() );
- }
-
- return aImageURLs;
+ ::std::vector< ::rtl::OUString > aImageURLs;
+
+ sal_Char const* const pResolutions[] = { "16", "32", "64" };
+ size_t const nImageCounts[] = { 12, 12, 12 };
+
+ size_t index = 0;
+ switch ( i_imageSet )
+ {
+ case IMAGES_16_PX: index = 0; break;
+ case IMAGES_32_PX: index = 1; break;
+ case IMAGES_64_PX: index = 2; break;
+ case IMAGES_NONE:
+ case IMAGES_AUTO:
+ OSL_ENSURE( false, "Throbber::getDefaultImageURLs: illegal
image set!" );
+ return aImageURLs;
+ }
+
+ aImageURLs.reserve( nImageCounts[index] );
+ for ( size_t i=0; i<nImageCounts[index]; ++i )
+ {
+ ::rtl::OUStringBuffer aURL;
+ aURL.appendAscii( "private:graphicrepository/vcl/res/spinner-"
);
+ aURL.appendAscii( pResolutions[index] );
+ aURL.appendAscii( "-" );
+ if ( i < 9 )
+ aURL.appendAscii( "0" );
+ aURL.append ( sal_Int32( i + 1 ) );
+ aURL.appendAscii( ".png" );
+
+ aImageURLs.push_back( aURL.makeStringAndClear() );
+ }
+
+ return aImageURLs;
}
//----------------------------------------------------------------------------------------------------------------------
IMPL_LINK( Throbber, TimeOutHdl, void*, EMPTYARG )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( maImageList.empty() )
- return 0;
-
- if ( mnCurStep < mnStepCount - 1 )
- mnCurStep += 1;
- else
- {
- if ( mbRepeat )
- {
- // start over
- mnCurStep = 0;
- }
- else
- {
- stop();
- }
- }
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( maImageList.empty() )
+ return 0;
+
+ if ( mnCurStep < mnStepCount - 1 )
+ mnCurStep += 1;
+ else
+ {
+ if ( mbRepeat )
+ {
+ // start over
+ mnCurStep = 0;
+ }
+ else
+ {
+ stop();
+ }
+ }
SetImage( maImageList[ mnCurStep ] );