summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-03 23:36:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-04 01:40:24 +0200
commit714d907d304fae5cc8613eced127060199639af6 (patch)
tree31e495ddd9e12b32220dacbceabfca56ea7cf99e /toolkit
parent8c4a24092bd9ccd1d577d10ae0559cef406e8fae (diff)
loplugin:flatten in toolkit
Change-Id: I8f4b29620134566f256f05bbab677e83baf20ec7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100031 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/vclxaccessiblecomponent.cxx38
-rw-r--r--toolkit/source/awt/vclxgraphics.cxx108
-rw-r--r--toolkit/source/awt/vclxmenu.cxx126
-rw-r--r--toolkit/source/awt/vclxspinbutton.cxx76
-rw-r--r--toolkit/source/awt/vclxtabpagecontainer.cxx26
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx110
-rw-r--r--toolkit/source/awt/vclxwindow.cxx241
-rw-r--r--toolkit/source/awt/vclxwindows.cxx1538
-rw-r--r--toolkit/source/controls/controlmodelcontainerbase.cxx120
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx97
-rw-r--r--toolkit/source/controls/roadmapcontrol.cxx28
-rw-r--r--toolkit/source/controls/tree/treedatamodel.cxx60
-rw-r--r--toolkit/source/controls/unocontrol.cxx54
-rw-r--r--toolkit/source/controls/unocontrolbase.cxx56
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx80
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx172
-rw-r--r--toolkit/source/controls/unocontrols.cxx164
-rw-r--r--toolkit/source/helper/unowrapper.cxx22
18 files changed, 1557 insertions, 1559 deletions
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx
index b046e9280768..b70a0dbb9bfc 100644
--- a/toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -352,28 +352,28 @@ VclPtr<vcl::Window> VCLXAccessibleComponent::GetWindow() const
void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
{
VclPtr<vcl::Window> pWindow = GetWindow();
- if ( pWindow )
+ if ( !pWindow )
+ return;
+
+ vcl::Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
+ if ( pLabeledBy && pLabeledBy != pWindow )
{
- vcl::Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
- if ( pLabeledBy && pLabeledBy != pWindow )
- {
- uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pLabeledBy->GetAccessible() };
- rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
- }
+ uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pLabeledBy->GetAccessible() };
+ rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
+ }
- vcl::Window* pLabelFor = pWindow->GetAccessibleRelationLabelFor();
- if ( pLabelFor && pLabelFor != pWindow )
- {
- uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pLabelFor->GetAccessible() };
- rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABEL_FOR, aSequence ) );
- }
+ vcl::Window* pLabelFor = pWindow->GetAccessibleRelationLabelFor();
+ if ( pLabelFor && pLabelFor != pWindow )
+ {
+ uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pLabelFor->GetAccessible() };
+ rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABEL_FOR, aSequence ) );
+ }
- vcl::Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
- if ( pMemberOf && pMemberOf != pWindow )
- {
- uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pMemberOf->GetAccessible() };
- rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
- }
+ vcl::Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
+ if ( pMemberOf && pMemberOf != pWindow )
+ {
+ uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pMemberOf->GetAccessible() };
+ rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
}
}
diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx
index 9fcb527a0970..958817053663 100644
--- a/toolkit/source/awt/vclxgraphics.cxx
+++ b/toolkit/source/awt/vclxgraphics.cxx
@@ -98,30 +98,30 @@ void VCLXGraphics::initAttrs()
void VCLXGraphics::InitOutputDevice( InitOutDevFlags nFlags )
{
- if(mpOutputDevice)
- {
- SolarMutexGuard aVclGuard;
+ if(!mpOutputDevice)
+ return;
- if ( nFlags & InitOutDevFlags::FONT )
- {
- mpOutputDevice->SetFont( maFont );
- mpOutputDevice->SetTextColor( maTextColor );
- mpOutputDevice->SetTextFillColor( maTextFillColor );
- }
+ SolarMutexGuard aVclGuard;
- if ( nFlags & InitOutDevFlags::COLORS )
- {
- mpOutputDevice->SetLineColor( maLineColor );
- mpOutputDevice->SetFillColor( maFillColor );
- }
-
- mpOutputDevice->SetRasterOp( meRasterOp );
+ if ( nFlags & InitOutDevFlags::FONT )
+ {
+ mpOutputDevice->SetFont( maFont );
+ mpOutputDevice->SetTextColor( maTextColor );
+ mpOutputDevice->SetTextFillColor( maTextFillColor );
+ }
- if( mpClipRegion )
- mpOutputDevice->SetClipRegion( *mpClipRegion );
- else
- mpOutputDevice->SetClipRegion();
+ if ( nFlags & InitOutDevFlags::COLORS )
+ {
+ mpOutputDevice->SetLineColor( maLineColor );
+ mpOutputDevice->SetFillColor( maFillColor );
}
+
+ mpOutputDevice->SetRasterOp( meRasterOp );
+
+ if( mpClipRegion )
+ mpOutputDevice->SetClipRegion( *mpClipRegion );
+ else
+ mpOutputDevice->SetClipRegion();
}
uno::Reference< awt::XDevice > VCLXGraphics::getDevice()
@@ -274,32 +274,32 @@ void VCLXGraphics::draw( const uno::Reference< awt::XDisplayBitmap >& rxBitmapHa
{
SolarMutexGuard aGuard;
- if( mpOutputDevice )
- {
- InitOutputDevice( InitOutDevFlags::NONE);
- uno::Reference< awt::XBitmap > xBitmap( rxBitmapHandle, uno::UNO_QUERY );
- BitmapEx aBmpEx = VCLUnoHelper::GetBitmap( xBitmap );
-
- Point aPos(nDestX - nSourceX, nDestY - nSourceY);
- Size aSz = aBmpEx.GetSizePixel();
+ if( !mpOutputDevice )
+ return;
- if(nDestWidth != nSourceWidth)
- {
- float zoomX = static_cast<float>(nDestWidth) / static_cast<float>(nSourceWidth);
- aSz.setWidth( static_cast<long>(static_cast<float>(aSz.Width()) * zoomX) );
- }
+ InitOutputDevice( InitOutDevFlags::NONE);
+ uno::Reference< awt::XBitmap > xBitmap( rxBitmapHandle, uno::UNO_QUERY );
+ BitmapEx aBmpEx = VCLUnoHelper::GetBitmap( xBitmap );
- if(nDestHeight != nSourceHeight)
- {
- float zoomY = static_cast<float>(nDestHeight) / static_cast<float>(nSourceHeight);
- aSz.setHeight( static_cast<long>(static_cast<float>(aSz.Height()) * zoomY) );
- }
+ Point aPos(nDestX - nSourceX, nDestY - nSourceY);
+ Size aSz = aBmpEx.GetSizePixel();
- if(nSourceX || nSourceY || aSz.Width() != nSourceWidth || aSz.Height() != nSourceHeight)
- mpOutputDevice->IntersectClipRegion(vcl::Region(tools::Rectangle(nDestX, nDestY, nDestX + nDestWidth - 1, nDestY + nDestHeight - 1)));
+ if(nDestWidth != nSourceWidth)
+ {
+ float zoomX = static_cast<float>(nDestWidth) / static_cast<float>(nSourceWidth);
+ aSz.setWidth( static_cast<long>(static_cast<float>(aSz.Width()) * zoomX) );
+ }
- mpOutputDevice->DrawBitmapEx( aPos, aSz, aBmpEx );
+ if(nDestHeight != nSourceHeight)
+ {
+ float zoomY = static_cast<float>(nDestHeight) / static_cast<float>(nSourceHeight);
+ aSz.setHeight( static_cast<long>(static_cast<float>(aSz.Height()) * zoomY) );
}
+
+ if(nSourceX || nSourceY || aSz.Width() != nSourceWidth || aSz.Height() != nSourceHeight)
+ mpOutputDevice->IntersectClipRegion(vcl::Region(tools::Rectangle(nDestX, nDestY, nDestX + nDestWidth - 1, nDestY + nDestHeight - 1)));
+
+ mpOutputDevice->DrawBitmapEx( aPos, aSz, aBmpEx );
}
void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y )
@@ -432,19 +432,19 @@ void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_
{
SolarMutexGuard aGuard;
- if( mpOutputDevice )
- {
- InitOutputDevice( InitOutDevFlags::COLORS );
- Gradient aGradient(static_cast<GradientStyle>(rGradient.Style), Color(rGradient.StartColor), Color(rGradient.EndColor));
- aGradient.SetAngle(rGradient.Angle);
- aGradient.SetBorder(rGradient.Border);
- aGradient.SetOfsX(rGradient.XOffset);
- aGradient.SetOfsY(rGradient.YOffset);
- aGradient.SetStartIntensity(rGradient.StartIntensity);
- aGradient.SetEndIntensity(rGradient.EndIntensity);
- aGradient.SetSteps(rGradient.StepCount);
- mpOutputDevice->DrawGradient( tools::Rectangle( Point( x, y ), Size( width, height ) ), aGradient );
- }
+ if( !mpOutputDevice )
+ return;
+
+ InitOutputDevice( InitOutDevFlags::COLORS );
+ Gradient aGradient(static_cast<GradientStyle>(rGradient.Style), Color(rGradient.StartColor), Color(rGradient.EndColor));
+ aGradient.SetAngle(rGradient.Angle);
+ aGradient.SetBorder(rGradient.Border);
+ aGradient.SetOfsX(rGradient.XOffset);
+ aGradient.SetOfsY(rGradient.YOffset);
+ aGradient.SetStartIntensity(rGradient.StartIntensity);
+ aGradient.SetEndIntensity(rGradient.EndIntensity);
+ aGradient.SetSteps(rGradient.StepCount);
+ mpOutputDevice->DrawGradient( tools::Rectangle( Point( x, y ), Size( width, height ) ), aGradient );
}
void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const OUString& rText )
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
index 0ba38df421c2..93d154a92ed2 100644
--- a/toolkit/source/awt/vclxmenu.cxx
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -88,79 +88,79 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclMenuEvent&, rMenuEvent, void )
{
DBG_ASSERT( rMenuEvent.GetMenu() && mpMenu, "Menu???" );
- if ( rMenuEvent.GetMenu() == mpMenu ) // Also called for the root menu
+ if ( rMenuEvent.GetMenu() != mpMenu ) // Also called for the root menu
+ return;
+
+ switch ( rMenuEvent.GetId() )
{
- switch ( rMenuEvent.GetId() )
+ case VclEventId::MenuSelect:
{
- case VclEventId::MenuSelect:
- {
- if ( maMenuListeners.getLength() )
- {
- css::awt::MenuEvent aEvent;
- aEvent.Source = static_cast<cppu::OWeakObject*>(this);
- aEvent.MenuId = mpMenu->GetCurItemId();
- maMenuListeners.itemSelected( aEvent );
- }
- }
- break;
- case VclEventId::ObjectDying:
+ if ( maMenuListeners.getLength() )
{
- mpMenu = nullptr;
+ css::awt::MenuEvent aEvent;
+ aEvent.Source = static_cast<cppu::OWeakObject*>(this);
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.itemSelected( aEvent );
}
- break;
- case VclEventId::MenuHighlight:
+ }
+ break;
+ case VclEventId::ObjectDying:
+ {
+ mpMenu = nullptr;
+ }
+ break;
+ case VclEventId::MenuHighlight:
+ {
+ if ( maMenuListeners.getLength() )
{
- if ( maMenuListeners.getLength() )
- {
- css::awt::MenuEvent aEvent;
- aEvent.Source = static_cast<cppu::OWeakObject*>(this);
- aEvent.MenuId = mpMenu->GetCurItemId();
- maMenuListeners.itemHighlighted( aEvent );
- }
+ css::awt::MenuEvent aEvent;
+ aEvent.Source = static_cast<cppu::OWeakObject*>(this);
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.itemHighlighted( aEvent );
}
- break;
- case VclEventId::MenuActivate:
+ }
+ break;
+ case VclEventId::MenuActivate:
+ {
+ if ( maMenuListeners.getLength() )
{
- if ( maMenuListeners.getLength() )
- {
- css::awt::MenuEvent aEvent;
- aEvent.Source = static_cast<cppu::OWeakObject*>(this);
- aEvent.MenuId = mpMenu->GetCurItemId();
- maMenuListeners.itemActivated( aEvent );
- }
+ css::awt::MenuEvent aEvent;
+ aEvent.Source = static_cast<cppu::OWeakObject*>(this);
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.itemActivated( aEvent );
}
- break;
- case VclEventId::MenuDeactivate:
+ }
+ break;
+ case VclEventId::MenuDeactivate:
+ {
+ if ( maMenuListeners.getLength() )
{
- if ( maMenuListeners.getLength() )
- {
- css::awt::MenuEvent aEvent;
- aEvent.Source = static_cast<cppu::OWeakObject*>(this);
- aEvent.MenuId = mpMenu->GetCurItemId();
- maMenuListeners.itemDeactivated( aEvent );
- }
+ css::awt::MenuEvent aEvent;
+ aEvent.Source = static_cast<cppu::OWeakObject*>(this);
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.itemDeactivated( aEvent );
}
- break;
-
- // ignore accessibility events
- case VclEventId::MenuEnable:
- case VclEventId::MenuInsertItem:
- case VclEventId::MenuRemoveItem:
- case VclEventId::MenuSubmenuActivate:
- case VclEventId::MenuSubmenuDeactivate:
- case VclEventId::MenuSubmenuChanged:
- case VclEventId::MenuDehighlight:
- case VclEventId::MenuDisable:
- case VclEventId::MenuItemTextChanged:
- case VclEventId::MenuItemChecked:
- case VclEventId::MenuItemUnchecked:
- case VclEventId::MenuShow:
- case VclEventId::MenuHide:
- break;
-
- default: OSL_FAIL( "MenuEventListener - Unknown event!" );
- }
- }
+ }
+ break;
+
+ // ignore accessibility events
+ case VclEventId::MenuEnable:
+ case VclEventId::MenuInsertItem:
+ case VclEventId::MenuRemoveItem:
+ case VclEventId::MenuSubmenuActivate:
+ case VclEventId::MenuSubmenuDeactivate:
+ case VclEventId::MenuSubmenuChanged:
+ case VclEventId::MenuDehighlight:
+ case VclEventId::MenuDisable:
+ case VclEventId::MenuItemTextChanged:
+ case VclEventId::MenuItemChecked:
+ case VclEventId::MenuItemUnchecked:
+ case VclEventId::MenuShow:
+ case VclEventId::MenuHide:
+ break;
+
+ default: OSL_FAIL( "MenuEventListener - Unknown event!" );
+ }
}
diff --git a/toolkit/source/awt/vclxspinbutton.cxx b/toolkit/source/awt/vclxspinbutton.cxx
index 197997a12652..7941f3760c9a 100644
--- a/toolkit/source/awt/vclxspinbutton.cxx
+++ b/toolkit/source/awt/vclxspinbutton.cxx
@@ -234,45 +234,45 @@ namespace toolkit
sal_Int32 nValue = 0;
bool bIsLongValue = ( Value >>= nValue );
- if ( GetWindow() )
- {
- sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
- switch ( nPropertyId )
- {
- case BASEPROPERTY_BACKGROUNDCOLOR:
- // the default implementation of the base class doesn't work here, since our
- // interpretation for this property is slightly different
- setButtonLikeFaceColor( GetWindow(), Value);
- break;
-
- case BASEPROPERTY_SPINVALUE:
- if ( bIsLongValue )
- setValue( nValue );
- break;
-
- case BASEPROPERTY_SPINVALUE_MIN:
- if ( bIsLongValue )
- setMinimum( nValue );
- break;
-
- case BASEPROPERTY_SPINVALUE_MAX:
- if ( bIsLongValue )
- setMaximum( nValue );
- break;
-
- case BASEPROPERTY_SPININCREMENT:
- if ( bIsLongValue )
- setSpinIncrement( nValue );
- break;
-
- case BASEPROPERTY_ORIENTATION:
- if ( bIsLongValue )
- lcl_modifyStyle( GetWindow(), WB_HSCROLL, nValue == ScrollBarOrientation::HORIZONTAL );
- break;
+ if ( !GetWindow() )
+ return;
- default:
- VCLXWindow::setProperty( PropertyName, Value );
- }
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ // the default implementation of the base class doesn't work here, since our
+ // interpretation for this property is slightly different
+ setButtonLikeFaceColor( GetWindow(), Value);
+ break;
+
+ case BASEPROPERTY_SPINVALUE:
+ if ( bIsLongValue )
+ setValue( nValue );
+ break;
+
+ case BASEPROPERTY_SPINVALUE_MIN:
+ if ( bIsLongValue )
+ setMinimum( nValue );
+ break;
+
+ case BASEPROPERTY_SPINVALUE_MAX:
+ if ( bIsLongValue )
+ setMaximum( nValue );
+ break;
+
+ case BASEPROPERTY_SPININCREMENT:
+ if ( bIsLongValue )
+ setSpinIncrement( nValue );
+ break;
+
+ case BASEPROPERTY_ORIENTATION:
+ if ( bIsLongValue )
+ lcl_modifyStyle( GetWindow(), WB_HSCROLL, nValue == ScrollBarOrientation::HORIZONTAL );
+ break;
+
+ default:
+ VCLXWindow::setProperty( PropertyName, Value );
}
}
diff --git a/toolkit/source/awt/vclxtabpagecontainer.cxx b/toolkit/source/awt/vclxtabpagecontainer.cxx
index d51fedcff6a2..42751be785cf 100644
--- a/toolkit/source/awt/vclxtabpagecontainer.cxx
+++ b/toolkit/source/awt/vclxtabpagecontainer.cxx
@@ -140,22 +140,22 @@ void VCLXTabPageContainer::ProcessWindowEvent( const VclWindowEvent& _rVclWindow
{
SolarMutexClearableGuard aGuard;
VclPtr<TabControl> pTabControl = GetAs<TabControl>();
- if ( pTabControl )
+ if ( !pTabControl )
+ return;
+
+ switch ( _rVclWindowEvent.GetId() )
{
- switch ( _rVclWindowEvent.GetId() )
+ case VclEventId::TabpageActivate:
{
- case VclEventId::TabpageActivate:
- {
- sal_uLong page = reinterpret_cast<sal_uLong>(_rVclWindowEvent.GetData());
- awt::tab::TabPageActivatedEvent aEvent(nullptr,page);
- m_aTabPageListeners.tabPageActivated(aEvent);
- break;
- }
- default:
- aGuard.clear();
- VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
- break;
+ sal_uLong page = reinterpret_cast<sal_uLong>(_rVclWindowEvent.GetData());
+ awt::tab::TabPageActivatedEvent aEvent(nullptr,page);
+ m_aTabPageListeners.tabPageActivated(aEvent);
+ break;
}
+ default:
+ aGuard.clear();
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+ break;
}
}
void SAL_CALL VCLXTabPageContainer::disposing( const css::lang::EventObject& /*Source*/ )
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 25d28ed823e1..95c43c643a45 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -2396,27 +2396,27 @@ void VCLXToolkit::callTopWindowListeners(
{
vcl::Window * pWindow
= static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow();
- if (pWindow->IsTopWindow())
+ if (!pWindow->IsTopWindow())
+ return;
+
+ std::vector< css::uno::Reference< css::uno::XInterface > >
+ aListeners(m_aTopWindowListeners.getElements());
+ if (aListeners.empty())
+ return;
+
+ css::lang::EventObject aAwtEvent(
+ static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()));
+ for (const css::uno::Reference<XInterface> & i : aListeners)
{
- std::vector< css::uno::Reference< css::uno::XInterface > >
- aListeners(m_aTopWindowListeners.getElements());
- if (!aListeners.empty())
+ css::uno::Reference< css::awt::XTopWindowListener >
+ xListener(i, css::uno::UNO_QUERY);
+ try
{
- css::lang::EventObject aAwtEvent(
- static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()));
- for (const css::uno::Reference<XInterface> & i : aListeners)
- {
- css::uno::Reference< css::awt::XTopWindowListener >
- xListener(i, css::uno::UNO_QUERY);
- try
- {
- (xListener.get()->*pFn)(aAwtEvent);
- }
- catch (const css::uno::RuntimeException &)
- {
- DBG_UNHANDLED_EXCEPTION("toolkit");
- }
- }
+ (xListener.get()->*pFn)(aAwtEvent);
+ }
+ catch (const css::uno::RuntimeException &)
+ {
+ DBG_UNHANDLED_EXCEPTION("toolkit");
}
}
}
@@ -2471,43 +2471,43 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
{
vcl::Window * pWindow
= static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow();
- if (pWindow->IsTopWindow())
- {
- std::vector< css::uno::Reference< css::uno::XInterface > >
- aListeners(m_aFocusListeners.getElements());
- if (!aListeners.empty())
+ if (!pWindow->IsTopWindow())
+ return;
+
+ std::vector< css::uno::Reference< css::uno::XInterface > >
+ aListeners(m_aFocusListeners.getElements());
+ if (aListeners.empty())
+ return;
+
+ // Ignore the interior of compound controls when determining the
+ // window that gets the focus next (see implementation in
+ // vclxwindow.cxx for mapping between VCL and UNO AWT event):
+ css::uno::Reference< css::uno::XInterface > xNext;
+ vcl::Window * pFocus = ::Application::GetFocusWindow();
+ for (vcl::Window * p = pFocus; p != nullptr; p = p->GetParent())
+ if (!p->IsCompoundControl())
{
- // Ignore the interior of compound controls when determining the
- // window that gets the focus next (see implementation in
- // vclxwindow.cxx for mapping between VCL and UNO AWT event):
- css::uno::Reference< css::uno::XInterface > xNext;
- vcl::Window * pFocus = ::Application::GetFocusWindow();
- for (vcl::Window * p = pFocus; p != nullptr; p = p->GetParent())
- if (!p->IsCompoundControl())
- {
- pFocus = p;
- break;
- }
- if (pFocus != nullptr)
- xNext = pFocus->GetComponentInterface();
- css::awt::FocusEvent aAwtEvent(
- static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()),
- static_cast<sal_Int16>(pWindow->GetGetFocusFlags()),
- xNext, false);
- for (const css::uno::Reference<XInterface> & i : aListeners)
- {
- css::uno::Reference< css::awt::XFocusListener > xListener(
- i, css::uno::UNO_QUERY);
- try
- {
- bGained ? xListener->focusGained(aAwtEvent)
- : xListener->focusLost(aAwtEvent);
- }
- catch (const css::uno::RuntimeException &)
- {
- DBG_UNHANDLED_EXCEPTION("toolkit");
- }
- }
+ pFocus = p;
+ break;
+ }
+ if (pFocus != nullptr)
+ xNext = pFocus->GetComponentInterface();
+ css::awt::FocusEvent aAwtEvent(
+ static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()),
+ static_cast<sal_Int16>(pWindow->GetGetFocusFlags()),
+ xNext, false);
+ for (const css::uno::Reference<XInterface> & i : aListeners)
+ {
+ css::uno::Reference< css::awt::XFocusListener > xListener(
+ i, css::uno::UNO_QUERY);
+ try
+ {
+ bGained ? xListener->focusGained(aAwtEvent)
+ : xListener->focusLost(aAwtEvent);
+ }
+ catch (const css::uno::RuntimeException &)
+ {
+ DBG_UNHANDLED_EXCEPTION("toolkit");
}
}
}
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index dbeeb20f0cdd..18ce820ab417 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -905,37 +905,37 @@ void VCLXWindow::dispose( )
mpImpl->mxViewGraphics = nullptr;
- if ( !mpImpl->mbDisposing )
- {
- mpImpl->mbDisposing = true;
+ if ( mpImpl->mbDisposing )
+ return;
- mpImpl->disposing();
+ mpImpl->mbDisposing = true;
- if ( GetWindow() )
- {
- VclPtr<OutputDevice> pOutDev = GetOutputDevice();
- SetWindow( nullptr ); // so that handlers are logged off, if necessary (virtual)
- SetOutputDevice( nullptr );
- pOutDev.disposeAndClear();
- }
+ mpImpl->disposing();
- // #i14103# dispose the accessible context after the window has been destroyed,
- // otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent()
- // for VclEventId::WindowChildDestroyed contains a reference to an already disposed accessible object
- try
- {
- css::uno::Reference< css::lang::XComponent > xComponent( mpImpl->mxAccessibleContext, css::uno::UNO_QUERY );
- if ( xComponent.is() )
- xComponent->dispose();
- }
- catch ( const css::uno::Exception& )
- {
- OSL_FAIL( "VCLXWindow::dispose: could not dispose the accessible context!" );
- }
- mpImpl->mxAccessibleContext.clear();
+ if ( GetWindow() )
+ {
+ VclPtr<OutputDevice> pOutDev = GetOutputDevice();
+ SetWindow( nullptr ); // so that handlers are logged off, if necessary (virtual)
+ SetOutputDevice( nullptr );
+ pOutDev.disposeAndClear();
+ }
- mpImpl->mbDisposing = false;
+ // #i14103# dispose the accessible context after the window has been destroyed,
+ // otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent()
+ // for VclEventId::WindowChildDestroyed contains a reference to an already disposed accessible object
+ try
+ {
+ css::uno::Reference< css::lang::XComponent > xComponent( mpImpl->mxAccessibleContext, css::uno::UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
}
+ catch ( const css::uno::Exception& )
+ {
+ OSL_FAIL( "VCLXWindow::dispose: could not dispose the accessible context!" );
+ }
+ mpImpl->mxAccessibleContext.clear();
+
+ mpImpl->mbDisposing = false;
}
void VCLXWindow::addEventListener( const css::uno::Reference< css::lang::XEventListener >& rxListener )
@@ -1123,19 +1123,19 @@ void VCLXWindow::setBackground( sal_Int32 nColor )
{
SolarMutexGuard aGuard;
- if ( GetWindow() )
- {
- Color aColor(nColor);
- GetWindow()->SetBackground( aColor );
- GetWindow()->SetControlBackground( aColor );
+ if ( !GetWindow() )
+ return;
- WindowType eWinType = GetWindow()->GetType();
- if ( ( eWinType == WindowType::WINDOW ) ||
- ( eWinType == WindowType::WORKWINDOW ) ||
- ( eWinType == WindowType::FLOATINGWINDOW ) )
- {
- GetWindow()->Invalidate();
- }
+ Color aColor(nColor);
+ GetWindow()->SetBackground( aColor );
+ GetWindow()->SetControlBackground( aColor );
+
+ WindowType eWinType = GetWindow()->GetType();
+ if ( ( eWinType == WindowType::WINDOW ) ||
+ ( eWinType == WindowType::WORKWINDOW ) ||
+ ( eWinType == WindowType::FLOATINGWINDOW ) )
+ {
+ GetWindow()->Invalidate();
}
}
@@ -1215,29 +1215,28 @@ void VCLXWindow::getStyles( sal_Int16 nType, css::awt::FontDescriptor& Font, sal
{
SolarMutexGuard aGuard;
- if ( GetWindow() )
- {
- const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings();
+ if ( !GetWindow() )
+ return;
- switch ( nType )
+ const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings();
+
+ switch ( nType )
+ {
+ case css::awt::Style::FRAME:
{
- case css::awt::Style::FRAME:
- {
- Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
- ForegroundColor = sal_Int32(rStyleSettings.GetWindowTextColor());
- BackgroundColor = sal_Int32(rStyleSettings.GetWindowColor());
- }
- break;
- case css::awt::Style::DIALOG:
- {
- Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
- ForegroundColor = sal_Int32(rStyleSettings.GetDialogTextColor());
- BackgroundColor = sal_Int32(rStyleSettings.GetDialogColor());
- }
- break;
- default: OSL_FAIL( "VCLWindow::getStyles() - unknown Type" );
+ Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
+ ForegroundColor = sal_Int32(rStyleSettings.GetWindowTextColor());
+ BackgroundColor = sal_Int32(rStyleSettings.GetWindowColor());
}
-
+ break;
+ case css::awt::Style::DIALOG:
+ {
+ Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
+ ForegroundColor = sal_Int32(rStyleSettings.GetDialogTextColor());
+ BackgroundColor = sal_Int32(rStyleSettings.GetDialogColor());
+ }
+ break;
+ default: OSL_FAIL( "VCLWindow::getStyles() - unknown Type" );
}
}
@@ -2208,82 +2207,82 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY )
if ( !pWindow )
return;
- if ( isDesignMode() || mpImpl->isEnableVisible() )
- {
- OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics );
- if (!pDev)
- pDev = pWindow->GetParent();
- TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow.get() );
- if ( pTabPage )
- {
- Point aPos( nX, nY );
- aPos = pDev->PixelToLogic( aPos );
- pTabPage->Draw( pDev, aPos, DrawFlags::NONE );
- return;
- }
+ if ( !(isDesignMode() || mpImpl->isEnableVisible()) )
+ return;
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics );
+ if (!pDev)
+ pDev = pWindow->GetParent();
+ TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow.get() );
+ if ( pTabPage )
+ {
Point aPos( nX, nY );
+ aPos = pDev->PixelToLogic( aPos );
+ pTabPage->Draw( pDev, aPos, DrawFlags::NONE );
+ return;
+ }
- if ( pWindow->GetParent() && !pWindow->IsSystemWindow() && ( pWindow->GetParent() == pDev ) )
+ Point aPos( nX, nY );
+
+ if ( pWindow->GetParent() && !pWindow->IsSystemWindow() && ( pWindow->GetParent() == pDev ) )
+ {
+ // #i40647# don't draw here if this is a recursive call
+ // sometimes this is called recursively, because the Update call on the parent
+ // (strangely) triggers another paint. Prevent a stack overflow here
+ // Yes, this is only fixing symptoms for the moment...
+ // #i40647# / 2005-01-18 / frank.schoenheit@sun.com
+ if ( !mpImpl->getDrawingOntoParent_ref() )
{
- // #i40647# don't draw here if this is a recursive call
- // sometimes this is called recursively, because the Update call on the parent
- // (strangely) triggers another paint. Prevent a stack overflow here
- // Yes, this is only fixing symptoms for the moment...
- // #i40647# / 2005-01-18 / frank.schoenheit@sun.com
- if ( !mpImpl->getDrawingOntoParent_ref() )
- {
- ::comphelper::FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() );
+ ::comphelper::FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() );
- bool bWasVisible = pWindow->IsVisible();
- Point aOldPos( pWindow->GetPosPixel() );
+ bool bWasVisible = pWindow->IsVisible();
+ Point aOldPos( pWindow->GetPosPixel() );
- if ( bWasVisible && aOldPos == aPos )
- {
- pWindow->PaintImmediately();
- return;
- }
+ if ( bWasVisible && aOldPos == aPos )
+ {
+ pWindow->PaintImmediately();
+ return;
+ }
+
+ pWindow->SetPosPixel( aPos );
- pWindow->SetPosPixel( aPos );
+ // Update parent first to avoid painting the parent upon the update
+ // of this window, as it may otherwise cause the parent
+ // to hide this window again
+ if( pWindow->GetParent() )
+ pWindow->GetParent()->PaintImmediately();
- // Update parent first to avoid painting the parent upon the update
- // of this window, as it may otherwise cause the parent
- // to hide this window again
- if( pWindow->GetParent() )
- pWindow->GetParent()->PaintImmediately();
+ pWindow->Show();
+ pWindow->PaintImmediately();
+ pWindow->SetParentUpdateMode( false );
+ pWindow->Hide();
+ pWindow->SetParentUpdateMode( true );
+ pWindow->SetPosPixel( aOldPos );
+ if ( bWasVisible )
pWindow->Show();
- pWindow->PaintImmediately();
- pWindow->SetParentUpdateMode( false );
- pWindow->Hide();
- pWindow->SetParentUpdateMode( true );
+ }
+ }
+ else if ( pDev )
+ {
+ Point aP = pDev->PixelToLogic( aPos );
- pWindow->SetPosPixel( aOldPos );
- if ( bWasVisible )
- pWindow->Show();
- }
+ vcl::PDFExtOutDevData* pPDFExport = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData());
+ bool bDrawSimple = ( pDev->GetOutDevType() == OUTDEV_PRINTER )
+ || ( pDev->GetOutDevViewType() == OutDevViewType::PrintPreview )
+ || ( pPDFExport != nullptr );
+ if ( bDrawSimple )
+ {
+ pWindow->Draw( pDev, aP, DrawFlags::NoControls );
}
- else if ( pDev )
+ else
{
- Point aP = pDev->PixelToLogic( aPos );
-
- vcl::PDFExtOutDevData* pPDFExport = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData());
- bool bDrawSimple = ( pDev->GetOutDevType() == OUTDEV_PRINTER )
- || ( pDev->GetOutDevViewType() == OutDevViewType::PrintPreview )
- || ( pPDFExport != nullptr );
- if ( bDrawSimple )
- {
- pWindow->Draw( pDev, aP, DrawFlags::NoControls );
- }
- else
- {
- bool bOldNW =pWindow->IsNativeWidgetEnabled();
- if( bOldNW )
- pWindow->EnableNativeWidget(false);
- pWindow->PaintToDevice( pDev, aP );
- if( bOldNW )
- pWindow->EnableNativeWidget();
- }
+ bool bOldNW =pWindow->IsNativeWidgetEnabled();
+ if( bOldNW )
+ pWindow->EnableNativeWidget(false);
+ pWindow->PaintToDevice( pDev, aP );
+ if( bOldNW )
+ pWindow->EnableNativeWidget();
}
}
}
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index f3a29af6465b..6475fbd4062e 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -489,43 +489,43 @@ void VCLXButton::setProperty( const OUString& PropertyName, const css::uno::Any&
SolarMutexGuard aGuard;
VclPtr< Button > pButton = GetAs< Button >();
- if ( pButton )
- {
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
- {
- case BASEPROPERTY_FOCUSONCLICK:
- ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_NOPOINTERFOCUS, true );
- break;
-
- case BASEPROPERTY_TOGGLE:
- ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_TOGGLE, false );
- break;
+ if ( !pButton )
+ return;
- case BASEPROPERTY_DEFAULTBUTTON:
- {
- WinBits nStyle = pButton->GetStyle() | WB_DEFBUTTON;
- bool b = bool();
- if ( ( Value >>= b ) && !b )
- nStyle &= ~WB_DEFBUTTON;
- pButton->SetStyle( nStyle );
- }
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_FOCUSONCLICK:
+ ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_NOPOINTERFOCUS, true );
break;
- case BASEPROPERTY_STATE:
- {
- if ( GetWindow()->GetType() == WindowType::PUSHBUTTON )
- {
- sal_Int16 n = sal_Int16();
- if ( Value >>= n )
- static_cast<PushButton*>(pButton.get())->SetState( static_cast<TriState>(n) );
- }
- }
+
+ case BASEPROPERTY_TOGGLE:
+ ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_TOGGLE, false );
break;
- default:
+
+ case BASEPROPERTY_DEFAULTBUTTON:
+ {
+ WinBits nStyle = pButton->GetStyle() | WB_DEFBUTTON;
+ bool b = bool();
+ if ( ( Value >>= b ) && !b )
+ nStyle &= ~WB_DEFBUTTON;
+ pButton->SetStyle( nStyle );
+ }
+ break;
+ case BASEPROPERTY_STATE:
+ {
+ if ( GetWindow()->GetType() == WindowType::PUSHBUTTON )
{
- VCLXGraphicControl::setProperty( PropertyName, Value );
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ static_cast<PushButton*>(pButton.get())->SetState( static_cast<TriState>(n) );
}
}
+ break;
+ default:
+ {
+ VCLXGraphicControl::setProperty( PropertyName, Value );
+ }
}
}
@@ -864,27 +864,27 @@ void VCLXCheckBox::setState( sal_Int16 n )
SolarMutexGuard aGuard;
VclPtr< CheckBox> pCheckBox = GetAs< CheckBox >();
- if ( pCheckBox)
+ if ( !pCheckBox)
+ return;
+
+ TriState eState;
+ switch ( n )
{
- TriState eState;
- switch ( n )
- {
- case 0: eState = TRISTATE_FALSE; break;
- case 1: eState = TRISTATE_TRUE; break;
- case 2: eState = TRISTATE_INDET; break;
- default: eState = TRISTATE_FALSE;
- }
- pCheckBox->SetState( eState );
+ case 0: eState = TRISTATE_FALSE; break;
+ case 1: eState = TRISTATE_TRUE; break;
+ case 2: eState = TRISTATE_INDET; break;
+ default: eState = TRISTATE_FALSE;
+ }
+ pCheckBox->SetState( eState );
- // #105198# call C++ click listeners (needed for accessibility)
- // pCheckBox->GetClickHdl().Call( pCheckBox );
+ // #105198# call C++ click listeners (needed for accessibility)
+ // pCheckBox->GetClickHdl().Call( pCheckBox );
- // #107218# Call same virtual methods and listeners like VCL would do after user interaction
- SetSynthesizingVCLEvent( true );
- pCheckBox->Toggle();
- pCheckBox->Click();
- SetSynthesizingVCLEvent( false );
- }
+ // #107218# Call same virtual methods and listeners like VCL would do after user interaction
+ SetSynthesizingVCLEvent( true );
+ pCheckBox->Toggle();
+ pCheckBox->Click();
+ SetSynthesizingVCLEvent( false );
}
sal_Int16 VCLXCheckBox::getState()
@@ -954,33 +954,33 @@ void VCLXCheckBox::setProperty( const OUString& PropertyName, const css::uno::An
SolarMutexGuard aGuard;
VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
- if ( pCheckBox )
- {
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
- {
- case BASEPROPERTY_VISUALEFFECT:
- ::toolkit::setVisualEffect( Value, pCheckBox );
- break;
+ if ( !pCheckBox )
+ return;
- case BASEPROPERTY_TRISTATE:
- {
- bool b = bool();
- if ( Value >>= b )
- pCheckBox->EnableTriState( b );
- }
- break;
- case BASEPROPERTY_STATE:
- {
- sal_Int16 n = sal_Int16();
- if ( Value >>= n )
- setState( n );
- }
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VISUALEFFECT:
+ ::toolkit::setVisualEffect( Value, pCheckBox );
break;
- default:
- {
- VCLXGraphicControl::setProperty( PropertyName, Value );
- }
+
+ case BASEPROPERTY_TRISTATE:
+ {
+ bool b = bool();
+ if ( Value >>= b )
+ pCheckBox->EnableTriState( b );
+ }
+ break;
+ case BASEPROPERTY_STATE:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ setState( n );
+ }
+ break;
+ default:
+ {
+ VCLXGraphicControl::setProperty( PropertyName, Value );
}
}
}
@@ -1132,40 +1132,40 @@ void VCLXRadioButton::setProperty( const OUString& PropertyName, const css::uno:
SolarMutexGuard aGuard;
VclPtr< RadioButton > pButton = GetAs< RadioButton >();
- if ( pButton )
- {
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
- {
- case BASEPROPERTY_VISUALEFFECT:
- ::toolkit::setVisualEffect( Value, pButton );
- break;
+ if ( !pButton )
+ return;
- case BASEPROPERTY_STATE:
- {
- sal_Int16 n = sal_Int16();
- if ( Value >>= n )
- {
- bool b = n != 0;
- if ( pButton->IsRadioCheckEnabled() )
- pButton->Check( b );
- else
- pButton->SetState( b );
- }
- }
- break;
- case BASEPROPERTY_AUTOTOGGLE:
- {
- bool b = bool();
- if ( Value >>= b )
- pButton->EnableRadioCheck( b );
- }
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VISUALEFFECT:
+ ::toolkit::setVisualEffect( Value, pButton );
break;
- default:
+
+ case BASEPROPERTY_STATE:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
{
- VCLXGraphicControl::setProperty( PropertyName, Value );
+ bool b = n != 0;
+ if ( pButton->IsRadioCheckEnabled() )
+ pButton->Check( b );
+ else
+ pButton->SetState( b );
}
}
+ break;
+ case BASEPROPERTY_AUTOTOGGLE:
+ {
+ bool b = bool();
+ if ( Value >>= b )
+ pButton->EnableRadioCheck( b );
+ }
+ break;
+ default:
+ {
+ VCLXGraphicControl::setProperty( PropertyName, Value );
+ }
}
}
@@ -1570,20 +1570,20 @@ void VCLXListBox::addItems( const css::uno::Sequence< OUString>& aItems, sal_Int
{
SolarMutexGuard aGuard;
VclPtr< ListBox > pBox = GetAs< ListBox >();
- if ( pBox )
+ if ( !pBox )
+ return;
+
+ sal_uInt16 nP = nPos;
+ for ( auto const & item : aItems )
{
- sal_uInt16 nP = nPos;
- for ( auto const & item : aItems )
+ if ( nP == 0xFFFF )
{
- if ( nP == 0xFFFF )
- {
- OSL_FAIL( "VCLXListBox::addItems: too many entries!" );
- // skip remaining entries, list cannot hold them, anyway
- break;
- }
-
- pBox->InsertEntry( item, nP++ );
+ OSL_FAIL( "VCLXListBox::addItems: too many entries!" );
+ // skip remaining entries, list cannot hold them, anyway
+ break;
}
+
+ pBox->InsertEntry( item, nP++ );
}
}
@@ -1710,40 +1710,40 @@ void VCLXListBox::selectItemsPos( const css::uno::Sequence<sal_Int16>& aPosition
SolarMutexGuard aGuard;
VclPtr< ListBox > pBox = GetAs< ListBox >();
- if ( pBox )
- {
- std::vector<sal_Int32> aPositionVec;
- aPositionVec.reserve(aPositions.getLength());
+ if ( !pBox )
+ return;
+
+ std::vector<sal_Int32> aPositionVec;
+ aPositionVec.reserve(aPositions.getLength());
- bool bChanged = false;
- for ( auto n = aPositions.getLength(); n; )
+ bool bChanged = false;
+ for ( auto n = aPositions.getLength(); n; )
+ {
+ const auto nPos = aPositions.getConstArray()[--n];
+ if ( pBox->IsEntryPosSelected( nPos ) != bool(bSelect) )
{
- const auto nPos = aPositions.getConstArray()[--n];
- if ( pBox->IsEntryPosSelected( nPos ) != bool(bSelect) )
- {
- aPositionVec.push_back(nPos);
- bChanged = true;
- }
+ aPositionVec.push_back(nPos);
+ bChanged = true;
}
+ }
- if ( bChanged )
- {
- bool bOrigUpdateMode = pBox->IsUpdateMode();
- pBox->SetUpdateMode(false);
+ if ( !bChanged )
+ return;
- pBox->SelectEntriesPos(aPositionVec, bSelect);
+ bool bOrigUpdateMode = pBox->IsUpdateMode();
+ pBox->SetUpdateMode(false);
- pBox->SetUpdateMode(bOrigUpdateMode);
+ pBox->SelectEntriesPos(aPositionVec, bSelect);
- // VCL doesn't call select handler after API call.
- // ImplCallItemListeners();
+ pBox->SetUpdateMode(bOrigUpdateMode);
- // #107218# Call same listeners like VCL would do after user interaction
- SetSynthesizingVCLEvent( true );
- pBox->Select();
- SetSynthesizingVCLEvent( false );
- }
- }
+ // VCL doesn't call select handler after API call.
+ // ImplCallItemListeners();
+
+ // #107218# Call same listeners like VCL would do after user interaction
+ SetSynthesizingVCLEvent( true );
+ pBox->Select();
+ SetSynthesizingVCLEvent( false );
}
void VCLXListBox::selectItem( const OUString& rItemText, sal_Bool bSelect )
@@ -1861,75 +1861,75 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const css::uno::Any
{
SolarMutexGuard aGuard;
VclPtr< ListBox > pListBox = GetAs< ListBox >();
- if ( pListBox )
+ if ( !pListBox )
+ return;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
{
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ case BASEPROPERTY_ITEM_SEPARATOR_POS:
{
- case BASEPROPERTY_ITEM_SEPARATOR_POS:
- {
- sal_Int16 nSeparatorPos(0);
- if ( Value >>= nSeparatorPos )
- pListBox->SetSeparatorPos( nSeparatorPos );
- }
- break;
- case BASEPROPERTY_READONLY:
- {
- bool b = false;
- if ( Value >>= b )
- pListBox->SetReadOnly( b);
- }
- break;
- case BASEPROPERTY_MULTISELECTION:
- {
- bool b = false;
- if ( Value >>= b )
- pListBox->EnableMultiSelection( b );
- }
- break;
- case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
- ::toolkit::adjustBooleanWindowStyle( Value, pListBox, WB_SIMPLEMODE, false );
- break;
- case BASEPROPERTY_LINECOUNT:
- {
- sal_Int16 n = 0;
- if ( Value >>= n )
- pListBox->SetDropDownLineCount( n );
- }
+ sal_Int16 nSeparatorPos(0);
+ if ( Value >>= nSeparatorPos )
+ pListBox->SetSeparatorPos( nSeparatorPos );
+ }
+ break;
+ case BASEPROPERTY_READONLY:
+ {
+ bool b = false;
+ if ( Value >>= b )
+ pListBox->SetReadOnly( b);
+ }
+ break;
+ case BASEPROPERTY_MULTISELECTION:
+ {
+ bool b = false;
+ if ( Value >>= b )
+ pListBox->EnableMultiSelection( b );
+ }
+ break;
+ case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
+ ::toolkit::adjustBooleanWindowStyle( Value, pListBox, WB_SIMPLEMODE, false );
break;
- case BASEPROPERTY_STRINGITEMLIST:
+ case BASEPROPERTY_LINECOUNT:
+ {
+ sal_Int16 n = 0;
+ if ( Value >>= n )
+ pListBox->SetDropDownLineCount( n );
+ }
+ break;
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ css::uno::Sequence< OUString> aItems;
+ if ( Value >>= aItems )
{
- css::uno::Sequence< OUString> aItems;
- if ( Value >>= aItems )
- {
- pListBox->Clear();
- addItems( aItems, 0 );
- }
+ pListBox->Clear();
+ addItems( aItems, 0 );
}
- break;
- case BASEPROPERTY_SELECTEDITEMS:
+ }
+ break;
+ case BASEPROPERTY_SELECTEDITEMS:
+ {
+ css::uno::Sequence<sal_Int16> aItems;
+ if ( Value >>= aItems )
{
- css::uno::Sequence<sal_Int16> aItems;
- if ( Value >>= aItems )
- {
- for ( auto n = pListBox->GetEntryCount(); n; )
- pListBox->SelectEntryPos( --n, false );
+ for ( auto n = pListBox->GetEntryCount(); n; )
+ pListBox->SelectEntryPos( --n, false );
- if ( aItems.hasElements() )
- selectItemsPos( aItems, true );
- else
- pListBox->SetNoSelection();
+ if ( aItems.hasElements() )
+ selectItemsPos( aItems, true );
+ else
+ pListBox->SetNoSelection();
- if ( !pListBox->GetSelectedEntryCount() )
- pListBox->SetTopEntry( 0 );
- }
- }
- break;
- default:
- {
- VCLXWindow::setProperty( PropertyName, Value );
+ if ( !pListBox->GetSelectedEntryCount() )
+ pListBox->SetTopEntry( 0 );
}
}
+ break;
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
}
}
@@ -2409,41 +2409,41 @@ void SAL_CALL VCLXDialog::setProperty(
{
SolarMutexGuard aGuard;
VclPtr< Dialog > pDialog = GetAs< Dialog >();
- if ( pDialog )
- {
- bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+ if ( !pDialog )
+ return;
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_GRAPHIC:
{
- case BASEPROPERTY_GRAPHIC:
+ Reference< XGraphic > xGraphic;
+ if (( Value >>= xGraphic ) && xGraphic.is() )
{
- Reference< XGraphic > xGraphic;
- if (( Value >>= xGraphic ) && xGraphic.is() )
- {
- Graphic aImage(xGraphic);
-
- Wallpaper aWallpaper(aImage.GetBitmapEx());
- aWallpaper.SetStyle( WallpaperStyle::Scale );
- pDialog->SetBackground( aWallpaper );
- }
- else if ( bVoid || !xGraphic.is() )
- {
- Color aColor = pDialog->GetControlBackground();
- if ( aColor == COL_AUTO )
- aColor = pDialog->GetSettings().GetStyleSettings().GetDialogColor();
+ Graphic aImage(xGraphic);
- Wallpaper aWallpaper( aColor );
- pDialog->SetBackground( aWallpaper );
- }
+ Wallpaper aWallpaper(aImage.GetBitmapEx());
+ aWallpaper.SetStyle( WallpaperStyle::Scale );
+ pDialog->SetBackground( aWallpaper );
}
- break;
-
- default:
+ else if ( bVoid || !xGraphic.is() )
{
- VCLXContainer::setProperty( PropertyName, Value );
+ Color aColor = pDialog->GetControlBackground();
+ if ( aColor == COL_AUTO )
+ aColor = pDialog->GetSettings().GetStyleSettings().GetDialogColor();
+
+ Wallpaper aWallpaper( aColor );
+ pDialog->SetBackground( aWallpaper );
}
}
+ break;
+
+ default:
+ {
+ VCLXContainer::setProperty( PropertyName, Value );
+ }
}
}
@@ -2540,51 +2540,51 @@ void SAL_CALL VCLXMultiPage::setProperty(
SolarMutexGuard aGuard;
VclPtr< TabControl > pTabControl = GetAs< TabControl >();
- if ( pTabControl )
- {
- bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+ if ( !pTabControl )
+ return;
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_MULTIPAGEVALUE:
{
- case BASEPROPERTY_MULTIPAGEVALUE:
+ SAL_INFO("toolkit", "***MULTIPAGE VALUE");
+ sal_Int32 nId(0);
+ Value >>= nId;
+ // when the multipage is created we attempt to set the activepage
+ // but no pages created
+ if ( nId && nId <= getWindows().getLength() )
+ activateTab( nId );
+ break;
+ }
+ case BASEPROPERTY_GRAPHIC:
+ {
+ Reference< XGraphic > xGraphic;
+ if (( Value >>= xGraphic ) && xGraphic.is() )
{
- SAL_INFO("toolkit", "***MULTIPAGE VALUE");
- sal_Int32 nId(0);
- Value >>= nId;
- // when the multipage is created we attempt to set the activepage
- // but no pages created
- if ( nId && nId <= getWindows().getLength() )
- activateTab( nId );
- break;
+ Graphic aImage(xGraphic);
+
+ Wallpaper aWallpaper(aImage.GetBitmapEx());
+ aWallpaper.SetStyle( WallpaperStyle::Scale );
+ pTabControl->SetBackground( aWallpaper );
}
- case BASEPROPERTY_GRAPHIC:
+ else if ( bVoid || !xGraphic.is() )
{
- Reference< XGraphic > xGraphic;
- if (( Value >>= xGraphic ) && xGraphic.is() )
- {
- Graphic aImage(xGraphic);
+ Color aColor = pTabControl->GetControlBackground();
+ if ( aColor == COL_AUTO )
+ aColor = pTabControl->GetSettings().GetStyleSettings().GetDialogColor();
- Wallpaper aWallpaper(aImage.GetBitmapEx());
- aWallpaper.SetStyle( WallpaperStyle::Scale );
- pTabControl->SetBackground( aWallpaper );
- }
- else if ( bVoid || !xGraphic.is() )
- {
- Color aColor = pTabControl->GetControlBackground();
- if ( aColor == COL_AUTO )
- aColor = pTabControl->GetSettings().GetStyleSettings().GetDialogColor();
-
- Wallpaper aWallpaper( aColor );
- pTabControl->SetBackground( aWallpaper );
- }
+ Wallpaper aWallpaper( aColor );
+ pTabControl->SetBackground( aWallpaper );
}
- break;
+ }
+ break;
- default:
- {
- VCLXContainer::setProperty( PropertyName, Value );
- }
+ default:
+ {
+ VCLXContainer::setProperty( PropertyName, Value );
}
}
}
@@ -2763,49 +2763,49 @@ void SAL_CALL VCLXTabPage::setProperty(
{
SolarMutexGuard aGuard;
VclPtr< TabPage > pTabPage = GetAs< TabPage >();
- if ( pTabPage )
- {
- bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+ if ( !pTabPage )
+ return;
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_GRAPHIC:
{
- case BASEPROPERTY_GRAPHIC:
+ Reference< XGraphic > xGraphic;
+ if (( Value >>= xGraphic ) && xGraphic.is() )
{
- Reference< XGraphic > xGraphic;
- if (( Value >>= xGraphic ) && xGraphic.is() )
- {
- Graphic aImage(xGraphic);
+ Graphic aImage(xGraphic);
- Wallpaper aWallpaper(aImage.GetBitmapEx());
- aWallpaper.SetStyle( WallpaperStyle::Scale );
- pTabPage->SetBackground( aWallpaper );
- }
- else if ( bVoid || !xGraphic.is() )
- {
- Color aColor = pTabPage->GetControlBackground();
- if ( aColor == COL_AUTO )
- aColor = pTabPage->GetSettings().GetStyleSettings().GetDialogColor();
+ Wallpaper aWallpaper(aImage.GetBitmapEx());
+ aWallpaper.SetStyle( WallpaperStyle::Scale );
+ pTabPage->SetBackground( aWallpaper );
+ }
+ else if ( bVoid || !xGraphic.is() )
+ {
+ Color aColor = pTabPage->GetControlBackground();
+ if ( aColor == COL_AUTO )
+ aColor = pTabPage->GetSettings().GetStyleSettings().GetDialogColor();
- Wallpaper aWallpaper( aColor );
- pTabPage->SetBackground( aWallpaper );
- }
+ Wallpaper aWallpaper( aColor );
+ pTabPage->SetBackground( aWallpaper );
}
- break;
- case BASEPROPERTY_TITLE:
+ }
+ break;
+ case BASEPROPERTY_TITLE:
+ {
+ OUString sTitle;
+ if ( Value >>= sTitle )
{
- OUString sTitle;
- if ( Value >>= sTitle )
- {
- pTabPage->SetText(sTitle);
- }
+ pTabPage->SetText(sTitle);
}
- break;
-
- default:
- {
- VCLXContainer::setProperty( PropertyName, Value );
}
+ break;
+
+ default:
+ {
+ VCLXContainer::setProperty( PropertyName, Value );
}
}
}
@@ -2953,20 +2953,20 @@ void VCLXFixedHyperlink::setAlignment( sal_Int16 nAlign )
SolarMutexGuard aGuard;
VclPtr< vcl::Window > pWindow = GetWindow();
- if ( pWindow )
- {
- WinBits nNewBits = 0;
- if ( nAlign == css::awt::TextAlign::LEFT )
- nNewBits = WB_LEFT;
- else if ( nAlign == css::awt::TextAlign::CENTER )
- nNewBits = WB_CENTER;
- else
- nNewBits = WB_RIGHT;
+ if ( !pWindow )
+ return;
- WinBits nStyle = pWindow->GetStyle();
- nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
- pWindow->SetStyle( nStyle | nNewBits );
- }
+ WinBits nNewBits = 0;
+ if ( nAlign == css::awt::TextAlign::LEFT )
+ nNewBits = WB_LEFT;
+ else if ( nAlign == css::awt::TextAlign::CENTER )
+ nNewBits = WB_CENTER;
+ else
+ nNewBits = WB_RIGHT;
+
+ WinBits nStyle = pWindow->GetStyle();
+ nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
+ pWindow->SetStyle( nStyle | nNewBits );
}
sal_Int16 VCLXFixedHyperlink::getAlignment()
@@ -3037,31 +3037,31 @@ void VCLXFixedHyperlink::setProperty( const OUString& PropertyName, const css::u
SolarMutexGuard aGuard;
VclPtr< FixedHyperlink > pBase = GetAs< FixedHyperlink >();
- if ( pBase )
+ if ( !pBase )
+ return;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
{
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ case BASEPROPERTY_LABEL:
{
- case BASEPROPERTY_LABEL:
- {
- OUString sNewLabel;
- if ( Value >>= sNewLabel )
- pBase->SetText(sNewLabel);
- break;
- }
+ OUString sNewLabel;
+ if ( Value >>= sNewLabel )
+ pBase->SetText(sNewLabel);
+ break;
+ }
- case BASEPROPERTY_URL:
- {
- OUString sNewURL;
- if ( Value >>= sNewURL )
- pBase->SetURL( sNewURL );
- break;
- }
+ case BASEPROPERTY_URL:
+ {
+ OUString sNewURL;
+ if ( Value >>= sNewURL )
+ pBase->SetURL( sNewURL );
+ break;
+ }
- default:
- {
- VCLXWindow::setProperty( PropertyName, Value );
- }
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
}
}
}
@@ -3205,20 +3205,20 @@ void VCLXFixedText::setAlignment( sal_Int16 nAlign )
SolarMutexGuard aGuard;
VclPtr< vcl::Window > pWindow = GetWindow();
- if ( pWindow )
- {
- WinBits nNewBits = 0;
- if ( nAlign == css::awt::TextAlign::LEFT )
- nNewBits = WB_LEFT;
- else if ( nAlign == css::awt::TextAlign::CENTER )
- nNewBits = WB_CENTER;
- else
- nNewBits = WB_RIGHT;
+ if ( !pWindow )
+ return;
- WinBits nStyle = pWindow->GetStyle();
- nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
- pWindow->SetStyle( nStyle | nNewBits );
- }
+ WinBits nNewBits = 0;
+ if ( nAlign == css::awt::TextAlign::LEFT )
+ nNewBits = WB_LEFT;
+ else if ( nAlign == css::awt::TextAlign::CENTER )
+ nNewBits = WB_CENTER;
+ else
+ nNewBits = WB_RIGHT;
+
+ WinBits nStyle = pWindow->GetStyle();
+ nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
+ pWindow->SetStyle( nStyle | nNewBits );
}
sal_Int16 VCLXFixedText::getAlignment()
@@ -3510,112 +3510,112 @@ void VCLXScrollBar::setProperty( const OUString& PropertyName, const css::uno::A
SolarMutexGuard aGuard;
VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
- if ( pScrollBar )
- {
- bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+ if ( !pScrollBar )
+ return;
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_LIVE_SCROLL:
{
- case BASEPROPERTY_LIVE_SCROLL:
+ bool bDo = false;
+ if ( !bVoid )
{
- bool bDo = false;
- if ( !bVoid )
- {
- OSL_VERIFY( Value >>= bDo );
- }
- AllSettings aSettings( pScrollBar->GetSettings() );
- StyleSettings aStyle( aSettings.GetStyleSettings() );
- DragFullOptions nDragOptions = aStyle.GetDragFullOptions();
- if ( bDo )
- nDragOptions |= DragFullOptions::Scroll;
- else
- nDragOptions &= ~DragFullOptions::Scroll;
- aStyle.SetDragFullOptions( nDragOptions );
- aSettings.SetStyleSettings( aStyle );
- pScrollBar->SetSettings( aSettings );
+ OSL_VERIFY( Value >>= bDo );
}
- break;
+ AllSettings aSettings( pScrollBar->GetSettings() );
+ StyleSettings aStyle( aSettings.GetStyleSettings() );
+ DragFullOptions nDragOptions = aStyle.GetDragFullOptions();
+ if ( bDo )
+ nDragOptions |= DragFullOptions::Scroll;
+ else
+ nDragOptions &= ~DragFullOptions::Scroll;
+ aStyle.SetDragFullOptions( nDragOptions );
+ aSettings.SetStyleSettings( aStyle );
+ pScrollBar->SetSettings( aSettings );
+ }
+ break;
- case BASEPROPERTY_SCROLLVALUE:
+ case BASEPROPERTY_SCROLLVALUE:
+ {
+ if ( !bVoid )
{
- if ( !bVoid )
- {
- sal_Int32 n = 0;
- if ( Value >>= n )
- setValue( n );
- }
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setValue( n );
}
- break;
- case BASEPROPERTY_SCROLLVALUE_MAX:
- case BASEPROPERTY_SCROLLVALUE_MIN:
+ }
+ break;
+ case BASEPROPERTY_SCROLLVALUE_MAX:
+ case BASEPROPERTY_SCROLLVALUE_MIN:
+ {
+ if ( !bVoid )
{
- if ( !bVoid )
+ sal_Int32 n = 0;
+ if ( Value >>= n )
{
- sal_Int32 n = 0;
- if ( Value >>= n )
- {
- if ( nPropType == BASEPROPERTY_SCROLLVALUE_MAX )
- setMaximum( n );
- else
- setMinimum( n );
- }
+ if ( nPropType == BASEPROPERTY_SCROLLVALUE_MAX )
+ setMaximum( n );
+ else
+ setMinimum( n );
}
}
- break;
- case BASEPROPERTY_LINEINCREMENT:
+ }
+ break;
+ case BASEPROPERTY_LINEINCREMENT:
+ {
+ if ( !bVoid )
{
- if ( !bVoid )
- {
- sal_Int32 n = 0;
- if ( Value >>= n )
- setLineIncrement( n );
- }
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setLineIncrement( n );
}
- break;
- case BASEPROPERTY_BLOCKINCREMENT:
+ }
+ break;
+ case BASEPROPERTY_BLOCKINCREMENT:
+ {
+ if ( !bVoid )
{
- if ( !bVoid )
- {
- sal_Int32 n = 0;
- if ( Value >>= n )
- setBlockIncrement( n );
- }
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setBlockIncrement( n );
}
- break;
- case BASEPROPERTY_VISIBLESIZE:
+ }
+ break;
+ case BASEPROPERTY_VISIBLESIZE:
+ {
+ if ( !bVoid )
{
- if ( !bVoid )
- {
- sal_Int32 n = 0;
- if ( Value >>= n )
- setVisibleSize( n );
- }
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setVisibleSize( n );
}
- break;
- case BASEPROPERTY_ORIENTATION:
+ }
+ break;
+ case BASEPROPERTY_ORIENTATION:
+ {
+ if ( !bVoid )
{
- if ( !bVoid )
- {
- sal_Int32 n = 0;
- if ( Value >>= n )
- setOrientation( n );
- }
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setOrientation( n );
}
- break;
+ }
+ break;
- case BASEPROPERTY_BACKGROUNDCOLOR:
- {
- // the default implementation of the base class doesn't work here, since our
- // interpretation for this property is slightly different
- ::toolkit::setButtonLikeFaceColor( pScrollBar, Value);
- }
- break;
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ {
+ // the default implementation of the base class doesn't work here, since our
+ // interpretation for this property is slightly different
+ ::toolkit::setButtonLikeFaceColor( pScrollBar, Value);
+ }
+ break;
- default:
- {
- VCLXWindow::setProperty( PropertyName, Value );
- }
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
}
}
}
@@ -3970,42 +3970,42 @@ void VCLXEdit::setProperty( const OUString& PropertyName, const css::uno::Any& V
SolarMutexGuard aGuard;
VclPtr< Edit > pEdit = GetAs< Edit >();
- if ( pEdit )
- {
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
- {
- case BASEPROPERTY_HIDEINACTIVESELECTION:
- ::toolkit::adjustBooleanWindowStyle( Value, pEdit, WB_NOHIDESELECTION, true );
- if ( pEdit->GetSubEdit() )
- ::toolkit::adjustBooleanWindowStyle( Value, pEdit->GetSubEdit(), WB_NOHIDESELECTION, true );
- break;
+ if ( !pEdit )
+ return;
- case BASEPROPERTY_READONLY:
- {
- bool b = bool();
- if ( Value >>= b )
- pEdit->SetReadOnly( b );
- }
- break;
- case BASEPROPERTY_ECHOCHAR:
- {
- sal_Int16 n = sal_Int16();
- if ( Value >>= n )
- pEdit->SetEchoChar( n );
- }
- break;
- case BASEPROPERTY_MAXTEXTLEN:
- {
- sal_Int16 n = sal_Int16();
- if ( Value >>= n )
- pEdit->SetMaxTextLen( n );
- }
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_HIDEINACTIVESELECTION:
+ ::toolkit::adjustBooleanWindowStyle( Value, pEdit, WB_NOHIDESELECTION, true );
+ if ( pEdit->GetSubEdit() )
+ ::toolkit::adjustBooleanWindowStyle( Value, pEdit->GetSubEdit(), WB_NOHIDESELECTION, true );
break;
- default:
- {
- VCLXWindow::setProperty( PropertyName, Value );
- }
+
+ case BASEPROPERTY_READONLY:
+ {
+ bool b = bool();
+ if ( Value >>= b )
+ pEdit->SetReadOnly( b );
+ }
+ break;
+ case BASEPROPERTY_ECHOCHAR:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ pEdit->SetEchoChar( n );
+ }
+ break;
+ case BASEPROPERTY_MAXTEXTLEN:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ pEdit->SetMaxTextLen( n );
+ }
+ break;
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
}
}
}
@@ -4237,18 +4237,18 @@ void VCLXComboBox::addItems( const css::uno::Sequence< OUString>& aItems, sal_In
SolarMutexGuard aGuard;
VclPtr< ComboBox > pBox = GetAs< ComboBox >();
- if ( pBox )
+ if ( !pBox )
+ return;
+
+ sal_uInt16 nP = nPos;
+ for ( const auto& rItem : aItems )
{
- sal_uInt16 nP = nPos;
- for ( const auto& rItem : aItems )
+ pBox->InsertEntry( rItem, nP );
+ if ( nP == 0xFFFF )
{
- pBox->InsertEntry( rItem, nP );
- if ( nP == 0xFFFF )
- {
- OSL_FAIL( "VCLXComboBox::addItems: too many entries!" );
- // skip remaining entries, list cannot hold them, anyway
- break;
- }
+ OSL_FAIL( "VCLXComboBox::addItems: too many entries!" );
+ // skip remaining entries, list cannot hold them, anyway
+ break;
}
}
}
@@ -4328,52 +4328,52 @@ void VCLXComboBox::setProperty( const OUString& PropertyName, const css::uno::An
SolarMutexGuard aGuard;
VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
- if ( pComboBox )
+ if ( !pComboBox )
+ return;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
{
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ case BASEPROPERTY_LINECOUNT:
{
- case BASEPROPERTY_LINECOUNT:
- {
- sal_Int16 n = sal_Int16();
- if ( Value >>= n )
- pComboBox->SetDropDownLineCount( n );
- }
- break;
- case BASEPROPERTY_AUTOCOMPLETE:
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ pComboBox->SetDropDownLineCount( n );
+ }
+ break;
+ case BASEPROPERTY_AUTOCOMPLETE:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ pComboBox->EnableAutocomplete( n != 0 );
+ else
{
- sal_Int16 n = sal_Int16();
- if ( Value >>= n )
- pComboBox->EnableAutocomplete( n != 0 );
- else
- {
- bool b = bool();
- if ( Value >>= b )
- pComboBox->EnableAutocomplete( b );
- }
+ bool b = bool();
+ if ( Value >>= b )
+ pComboBox->EnableAutocomplete( b );
}
- break;
- case BASEPROPERTY_STRINGITEMLIST:
+ }
+ break;
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ css::uno::Sequence< OUString> aItems;
+ if ( Value >>= aItems )
{
- css::uno::Sequence< OUString> aItems;
- if ( Value >>= aItems )
- {
- pComboBox->Clear();
- addItems( aItems, 0 );
- }
+ pComboBox->Clear();
+ addItems( aItems, 0 );
}
- break;
- default:
- {
- VCLXEdit::setProperty( PropertyName, Value );
+ }
+ break;
+ default:
+ {
+ VCLXEdit::setProperty( PropertyName, Value );
- // #109385# SetBorderStyle is not virtual
- if ( nPropType == BASEPROPERTY_BORDER )
- {
- sal_uInt16 nBorder = sal_uInt16();
- if ( (Value >>= nBorder) && nBorder != 0 )
- pComboBox->SetBorderStyle( static_cast<WindowBorderStyle>(nBorder) );
- }
+ // #109385# SetBorderStyle is not virtual
+ if ( nPropType == BASEPROPERTY_BORDER )
+ {
+ sal_uInt16 nBorder = sal_uInt16();
+ if ( (Value >>= nBorder) && nBorder != 0 )
+ pComboBox->SetBorderStyle( static_cast<WindowBorderStyle>(nBorder) );
}
}
}
@@ -4666,37 +4666,37 @@ void VCLXFormattedSpinField::setProperty( const OUString& PropertyName, const cs
SolarMutexGuard aGuard;
FormatterBase* pFormatter = GetFormatter();
- if ( pFormatter )
+ if ( !pFormatter )
+ return;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
{
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ case BASEPROPERTY_SPIN:
{
- case BASEPROPERTY_SPIN:
+ bool b = bool();
+ if ( Value >>= b )
{
- bool b = bool();
- if ( Value >>= b )
- {
- WinBits nStyle = GetWindow()->GetStyle() | WB_SPIN;
- if ( !b )
- nStyle &= ~WB_SPIN;
- GetWindow()->SetStyle( nStyle );
- }
- }
- break;
- case BASEPROPERTY_STRICTFORMAT:
- {
- bool b = bool();
- if ( Value >>= b )
- {
- pFormatter->SetStrictFormat( b );
- }
+ WinBits nStyle = GetWindow()->GetStyle() | WB_SPIN;
+ if ( !b )
+ nStyle &= ~WB_SPIN;
+ GetWindow()->SetStyle( nStyle );
}
- break;
- default:
+ }
+ break;
+ case BASEPROPERTY_STRICTFORMAT:
+ {
+ bool b = bool();
+ if ( Value >>= b )
{
- VCLXSpinField::setProperty( PropertyName, Value );
+ pFormatter->SetStrictFormat( b );
}
}
+ break;
+ default:
+ {
+ VCLXSpinField::setProperty( PropertyName, Value );
+ }
}
}
@@ -4814,68 +4814,68 @@ void VCLXDateField::setProperty( const OUString& PropertyName, const css::uno::A
{
SolarMutexGuard aGuard;
- if ( GetWindow() )
- {
- bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+ if ( !(GetWindow()) )
+ return;
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_DATE:
{
- case BASEPROPERTY_DATE:
+ if ( bVoid )
{
- if ( bVoid )
- {
- GetAs< DateField >()->EnableEmptyFieldValue( true );
- GetAs< DateField >()->SetEmptyFieldValue();
- }
- else
- {
- util::Date d;
- if ( Value >>= d )
- setDate( d );
- }
+ GetAs< DateField >()->EnableEmptyFieldValue( true );
+ GetAs< DateField >()->SetEmptyFieldValue();
}
- break;
- case BASEPROPERTY_DATEMIN:
- {
- util::Date d;
- if ( Value >>= d )
- setMin( d );
- }
- break;
- case BASEPROPERTY_DATEMAX:
+ else
{
util::Date d;
if ( Value >>= d )
- setMax( d );
- }
- break;
- case BASEPROPERTY_EXTDATEFORMAT:
- {
- sal_Int16 n = sal_Int16();
- if ( Value >>= n )
- GetAs< DateField >()->SetExtDateFormat( static_cast<ExtDateFieldFormat>(n) );
- }
- break;
- case BASEPROPERTY_DATESHOWCENTURY:
- {
- bool b = bool();
- if ( Value >>= b )
- GetAs< DateField >()->SetShowDateCentury( b );
- }
- break;
- case BASEPROPERTY_ENFORCE_FORMAT:
- {
- bool bEnforce( true );
- OSL_VERIFY( Value >>= bEnforce );
- GetAs< DateField >()->EnforceValidValue( bEnforce );
- }
- break;
- default:
- {
- VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ setDate( d );
}
}
+ break;
+ case BASEPROPERTY_DATEMIN:
+ {
+ util::Date d;
+ if ( Value >>= d )
+ setMin( d );
+ }
+ break;
+ case BASEPROPERTY_DATEMAX:
+ {
+ util::Date d;
+ if ( Value >>= d )
+ setMax( d );
+ }
+ break;
+ case BASEPROPERTY_EXTDATEFORMAT:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ GetAs< DateField >()->SetExtDateFormat( static_cast<ExtDateFieldFormat>(n) );
+ }
+ break;
+ case BASEPROPERTY_DATESHOWCENTURY:
+ {
+ bool b = bool();
+ if ( Value >>= b )
+ GetAs< DateField >()->SetShowDateCentury( b );
+ }
+ break;
+ case BASEPROPERTY_ENFORCE_FORMAT:
+ {
+ bool bEnforce( true );
+ OSL_VERIFY( Value >>= bEnforce );
+ GetAs< DateField >()->EnforceValidValue( bEnforce );
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
}
}
@@ -5303,61 +5303,61 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const css::uno::A
{
SolarMutexGuard aGuard;
- if ( GetWindow() )
- {
- bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+ if ( !(GetWindow()) )
+ return;
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_TIME:
{
- case BASEPROPERTY_TIME:
- {
- if ( bVoid )
- {
- GetAs< TimeField >()->EnableEmptyFieldValue( true );
- GetAs< TimeField >()->SetEmptyFieldValue();
- }
- else
- {
- util::Time t;
- if ( Value >>= t )
- setTime( t );
- }
- }
- break;
- case BASEPROPERTY_TIMEMIN:
+ if ( bVoid )
{
- util::Time t;
- if ( Value >>= t )
- setMin( t );
+ GetAs< TimeField >()->EnableEmptyFieldValue( true );
+ GetAs< TimeField >()->SetEmptyFieldValue();
}
- break;
- case BASEPROPERTY_TIMEMAX:
+ else
{
util::Time t;
if ( Value >>= t )
- setMax( t );
- }
- break;
- case BASEPROPERTY_EXTTIMEFORMAT:
- {
- sal_Int16 n = sal_Int16();
- if ( Value >>= n )
- GetAs< TimeField >()->SetExtFormat( static_cast<ExtTimeFieldFormat>(n) );
- }
- break;
- case BASEPROPERTY_ENFORCE_FORMAT:
- {
- bool bEnforce( true );
- OSL_VERIFY( Value >>= bEnforce );
- GetAs< TimeField >()->EnforceValidValue( bEnforce );
- }
- break;
- default:
- {
- VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ setTime( t );
}
}
+ break;
+ case BASEPROPERTY_TIMEMIN:
+ {
+ util::Time t;
+ if ( Value >>= t )
+ setMin( t );
+ }
+ break;
+ case BASEPROPERTY_TIMEMAX:
+ {
+ util::Time t;
+ if ( Value >>= t )
+ setMax( t );
+ }
+ break;
+ case BASEPROPERTY_EXTTIMEFORMAT:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ GetAs< TimeField >()->SetExtFormat( static_cast<ExtTimeFieldFormat>(n) );
+ }
+ break;
+ case BASEPROPERTY_ENFORCE_FORMAT:
+ {
+ bool bEnforce( true );
+ OSL_VERIFY( Value >>= bEnforce );
+ GetAs< TimeField >()->EnforceValidValue( bEnforce );
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
}
}
@@ -5473,23 +5473,23 @@ void VCLXNumericField::setValue( double Value )
SolarMutexGuard aGuard;
NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter());
- if ( pNumericFormatter )
- {
- // shift long value using decimal digits
- // (e.g., input 105 using 2 digits returns 1,05)
- // Thus, to set a value of 1,05, insert 105 and 2 digits
- pNumericFormatter->SetValue(
- static_cast<long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) );
+ if ( !pNumericFormatter )
+ return;
- // #107218# Call same listeners like VCL would do after user interaction
- VclPtr< Edit > pEdit = GetAs< Edit >();
- if ( pEdit )
- {
- SetSynthesizingVCLEvent( true );
- pEdit->SetModifyFlag();
- pEdit->Modify();
- SetSynthesizingVCLEvent( false );
- }
+ // shift long value using decimal digits
+ // (e.g., input 105 using 2 digits returns 1,05)
+ // Thus, to set a value of 1,05, insert 105 and 2 digits
+ pNumericFormatter->SetValue(
+ static_cast<long>(ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() )) );
+
+ // #107218# Call same listeners like VCL would do after user interaction
+ VclPtr< Edit > pEdit = GetAs< Edit >();
+ if ( pEdit )
+ {
+ SetSynthesizingVCLEvent( true );
+ pEdit->SetModifyFlag();
+ pEdit->Modify();
+ SetSynthesizingVCLEvent( false );
}
}
@@ -5638,76 +5638,76 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const css::uno
{
SolarMutexGuard aGuard;
- if ( GetWindow() )
- {
- bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+ if ( !(GetWindow()) )
+ return;
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VALUE_DOUBLE:
{
- case BASEPROPERTY_VALUE_DOUBLE:
+ if ( bVoid )
{
- if ( bVoid )
- {
- NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter());
- if (!pNumericFormatter)
- return;
- pNumericFormatter->EnableEmptyFieldValue( true );
- pNumericFormatter->SetEmptyFieldValue();
- }
- else
- {
- double d = 0;
- if ( Value >>= d )
- setValue( d );
- }
- }
- break;
- case BASEPROPERTY_VALUEMIN_DOUBLE:
- {
- double d = 0;
- if ( Value >>= d )
- setMin( d );
- }
- break;
- case BASEPROPERTY_VALUEMAX_DOUBLE:
- {
- double d = 0;
- if ( Value >>= d )
- setMax( d );
+ NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter());
+ if (!pNumericFormatter)
+ return;
+ pNumericFormatter->EnableEmptyFieldValue( true );
+ pNumericFormatter->SetEmptyFieldValue();
}
- break;
- case BASEPROPERTY_VALUESTEP_DOUBLE:
+ else
{
double d = 0;
if ( Value >>= d )
- setSpinSize( d );
- }
- break;
- case BASEPROPERTY_DECIMALACCURACY:
- {
- sal_Int16 n = sal_Int16();
- if ( Value >>= n )
- setDecimalDigits( n );
+ setValue( d );
}
- break;
- case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
- {
- bool b = bool();
- if ( Value >>= b )
- {
- NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter());
- if (!pNumericFormatter)
- return;
- pNumericFormatter->SetUseThousandSep( b );
- }
- }
- break;
- default:
+ }
+ break;
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ {
+ double d = 0;
+ if ( Value >>= d )
+ setMin( d );
+ }
+ break;
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ {
+ double d = 0;
+ if ( Value >>= d )
+ setMax( d );
+ }
+ break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ {
+ double d = 0;
+ if ( Value >>= d )
+ setSpinSize( d );
+ }
+ break;
+ case BASEPROPERTY_DECIMALACCURACY:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ setDecimalDigits( n );
+ }
+ break;
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ {
+ bool b = bool();
+ if ( Value >>= b )
{
- VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter());
+ if (!pNumericFormatter)
+ return;
+ pNumericFormatter->SetUseThousandSep( b );
}
}
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
}
}
@@ -5940,50 +5940,50 @@ void VCLXMetricField::setProperty( const OUString& PropertyName, const css::uno:
{
SolarMutexGuard aGuard;
- if ( GetWindow() )
+ if ( !(GetWindow()) )
+ return;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
{
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ case BASEPROPERTY_DECIMALACCURACY:
{
- case BASEPROPERTY_DECIMALACCURACY:
- {
- sal_Int16 n = 0;
- if ( Value >>= n )
- setDecimalDigits( n );
- break;
- }
- case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
- {
- bool b = false;
- if ( Value >>= b )
- {
- NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter());
- if (!pNumericFormatter)
- return;
- pNumericFormatter->SetUseThousandSep( b );
- }
- }
+ sal_Int16 n = 0;
+ if ( Value >>= n )
+ setDecimalDigits( n );
break;
- case BASEPROPERTY_UNIT:
- {
- sal_uInt16 nVal = 0;
- if ( Value >>= nVal )
- GetAs< MetricField >()->SetUnit( static_cast<FieldUnit>(nVal) );
- break;
- }
- case BASEPROPERTY_CUSTOMUNITTEXT:
- {
- OUString aStr;
- if ( Value >>= aStr )
- GetAs< MetricField >()->SetCustomUnitText( aStr );
- break;
- }
- default:
+ }
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ {
+ bool b = false;
+ if ( Value >>= b )
{
- VCLXFormattedSpinField::setProperty( PropertyName, Value );
- break;
+ NumericFormatter* pNumericFormatter = static_cast<NumericFormatter*>(GetFormatter());
+ if (!pNumericFormatter)
+ return;
+ pNumericFormatter->SetUseThousandSep( b );
}
}
+ break;
+ case BASEPROPERTY_UNIT:
+ {
+ sal_uInt16 nVal = 0;
+ if ( Value >>= nVal )
+ GetAs< MetricField >()->SetUnit( static_cast<FieldUnit>(nVal) );
+ break;
+ }
+ case BASEPROPERTY_CUSTOMUNITTEXT:
+ {
+ OUString aStr;
+ if ( Value >>= aStr )
+ GetAs< MetricField >()->SetCustomUnitText( aStr );
+ break;
+ }
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ break;
+ }
}
}
@@ -6135,32 +6135,32 @@ void VCLXPatternField::setProperty( const OUString& PropertyName, const css::uno
{
SolarMutexGuard aGuard;
- if ( GetWindow() )
+ if ( !(GetWindow()) )
+ return;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
{
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
+ case BASEPROPERTY_EDITMASK:
+ case BASEPROPERTY_LITERALMASK:
{
- case BASEPROPERTY_EDITMASK:
- case BASEPROPERTY_LITERALMASK:
+ OUString aString;
+ if ( Value >>= aString )
{
- OUString aString;
- if ( Value >>= aString )
- {
- OUString aEditMask, aLiteralMask;
- getMasks( aEditMask, aLiteralMask );
- if ( nPropType == BASEPROPERTY_EDITMASK )
- aEditMask = aString;
- else
- aLiteralMask = aString;
- setMasks( aEditMask, aLiteralMask );
- }
- }
- break;
- default:
- {
- VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ OUString aEditMask, aLiteralMask;
+ getMasks( aEditMask, aLiteralMask );
+ if ( nPropType == BASEPROPERTY_EDITMASK )
+ aEditMask = aString;
+ else
+ aLiteralMask = aString;
+ setMasks( aEditMask, aLiteralMask );
}
}
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
}
}
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
index 05b9edb18643..880b25c53a82 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -1100,24 +1100,24 @@ void ResourceListener::startListening(
// --- SAFE ---
}
- if ( rResource.is() )
+ if ( !rResource.is() )
+ return;
+
+ try
{
- try
- {
- rResource->addModifyListener( this );
+ rResource->addModifyListener( this );
- // --- SAFE ---
- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
- m_bListening = true;
- // --- SAFE ---
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ m_bListening = true;
+ // --- SAFE ---
+ }
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
+ catch (const Exception&)
+ {
}
}
@@ -1132,26 +1132,26 @@ void ResourceListener::stopListening()
aGuard.clear();
// --- SAFE ---
- if ( xModifyBroadcaster.is() )
+ if ( !xModifyBroadcaster.is() )
+ return;
+
+ try
+ {
+ // --- SAFE ---
+ aGuard.reset();
+ m_bListening = false;
+ m_xResource.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ xModifyBroadcaster->removeModifyListener( this );
+ }
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
+ catch (const Exception&)
{
- try
- {
- // --- SAFE ---
- aGuard.reset();
- m_bListening = false;
- m_xResource.clear();
- aGuard.clear();
- // --- SAFE ---
-
- xModifyBroadcaster->removeModifyListener( this );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
}
}
@@ -1167,19 +1167,19 @@ void SAL_CALL ResourceListener::modified(
aGuard.clear();
// --- SAFE ---
- if ( xListener.is() )
+ if ( !xListener.is() )
+ return;
+
+ try
+ {
+ xListener->modified( aEvent );
+ }
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
+ catch (const Exception&)
{
- try
- {
- xListener->modified( aEvent );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
}
}
@@ -1610,20 +1610,20 @@ void ControlContainerBase::addingControl( const Reference< XControl >& _rxContro
SolarMutexGuard aGuard;
UnoControlContainer::addingControl( _rxControl );
- if ( _rxControl.is() )
+ if ( !_rxControl.is() )
+ return;
+
+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
+ if ( xProps.is() )
{
- Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
- if ( xProps.is() )
- {
- const Sequence< OUString > aNames {
- "PositionX",
- "PositionY",
- "Width",
- "Height"
- };
-
- xProps->addPropertiesChangeListener( aNames, this );
- }
+ const Sequence< OUString > aNames {
+ "PositionX",
+ "PositionY",
+ "Width",
+ "Height"
+ };
+
+ xProps->addPropertiesChangeListener( aNames, this );
}
}
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index a4c695223f57..bf035e3bcfa6 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -349,26 +349,25 @@ void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, cons
UnoControlContainer::createPeer( rxToolkit, rParentPeer );
Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
- if ( xTW.is() )
- {
- xTW->setMenuBar( mxMenuBar );
-
- if ( !mbWindowListener )
- {
- Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
- addWindowListener( xWL );
- mbWindowListener = true;
- }
+ if ( !xTW.is() )
+ return;
- if ( maTopWindowListeners.getLength() )
- xTW->addTopWindowListener( &maTopWindowListeners );
- // there must be a better way than doing this, we can't
- // process the scrolltop & scrollleft in XDialog because
- // the children haven't been added when those props are applied
- ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLTOP ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLTOP ) ) );
- ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLLEFT ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLLEFT ) ) );
+ xTW->setMenuBar( mxMenuBar );
+ if ( !mbWindowListener )
+ {
+ Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
+ addWindowListener( xWL );
+ mbWindowListener = true;
}
+
+ if ( maTopWindowListeners.getLength() )
+ xTW->addTopWindowListener( &maTopWindowListeners );
+ // there must be a better way than doing this, we can't
+ // process the scrolltop & scrollleft in XDialog because
+ // the children haven't been added when those props are applied
+ ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLTOP ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLTOP ) ) );
+ ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLLEFT ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLLEFT ) ) );
}
OUString UnoDialogControl::getImplementationName()
@@ -1046,46 +1045,46 @@ void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
ControlContainerBase::ImplSetPosSize( rxCtrl );
Reference < XWindow > xW( rxCtrl, UNO_QUERY );
- if ( !bOwnCtrl && xW.is() && !sTitle.isEmpty() )
+ if ( bOwnCtrl || !xW.is() || sTitle.isEmpty() )
+ return;
+
+ awt::Rectangle aSizePos = xW->getPosSize();
+
+ sal_Int32 nX = aSizePos.X, nY = aSizePos.Y, nWidth = aSizePos.Width, nHeight = aSizePos.Height;
+ // Retrieve the values set by the base class
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ if ( pOutDev )
{
- awt::Rectangle aSizePos = xW->getPosSize();
+ // Adjust Y based on height of Title
+ ::tools::Rectangle aRect = pOutDev->GetTextRect( {}, sTitle );
+ nY = nY + ( aRect.GetHeight() / 2 );
+ }
+ else
+ {
+ Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer();
+ Reference< XDevice > xD( xPeer, UNO_QUERY );
- sal_Int32 nX = aSizePos.X, nY = aSizePos.Y, nWidth = aSizePos.Width, nHeight = aSizePos.Height;
- // Retrieve the values set by the base class
- OutputDevice*pOutDev = Application::GetDefaultDevice();
- if ( pOutDev )
+ SimpleFontMetric aFM;
+ FontDescriptor aFD;
+ Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
+
+ aVal >>= aFD;
+ if ( !aFD.StyleName.isEmpty() )
{
- // Adjust Y based on height of Title
- ::tools::Rectangle aRect = pOutDev->GetTextRect( {}, sTitle );
- nY = nY + ( aRect.GetHeight() / 2 );
+ Reference< XFont > xFont = xD->getFont( aFD );
+ aFM = xFont->getFontMetric();
}
else
{
- Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer();
- Reference< XDevice > xD( xPeer, UNO_QUERY );
-
- SimpleFontMetric aFM;
- FontDescriptor aFD;
- Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
-
- aVal >>= aFD;
- if ( !aFD.StyleName.isEmpty() )
- {
- Reference< XFont > xFont = xD->getFont( aFD );
- aFM = xFont->getFontMetric();
- }
- else
- {
- Reference< XGraphics > xG = xD->createGraphics();
- aFM = xG->getFontMetric();
- }
-
- sal_Int16 nH = aFM.Ascent + aFM.Descent;
- // offset y based on height of font ( not sure if my guess at the correct calculation is correct here )
- nY = nY + ( nH / 8); // how do I test this
+ Reference< XGraphics > xG = xD->createGraphics();
+ aFM = xG->getFontMetric();
}
- xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
+
+ sal_Int16 nH = aFM.Ascent + aFM.Descent;
+ // offset y based on height of font ( not sure if my guess at the correct calculation is correct here )
+ nY = nY + ( nH / 8); // how do I test this
}
+ xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
}
// ------------- UnoFrameModel -----------------
diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx
index 9bc540593742..0a0006014981 100644
--- a/toolkit/source/controls/roadmapcontrol.cxx
+++ b/toolkit/source/controls/roadmapcontrol.cxx
@@ -297,22 +297,22 @@ static void lcl_throwIndexOutOfBoundsException( )
Reference< XPropertySet > xPropertySet( static_cast<XAggregation*>(static_cast<cppu::OWeakAggObject*>(this)), UNO_QUERY );
sal_Int16 n_CurrentItemID = GetCurrentItemID( xPropertySet );
Any aAny;
- if ( Index <= n_CurrentItemID )
+ if ( Index > n_CurrentItemID )
+ return;
+
+ if ( n_CurrentItemID >= static_cast<sal_Int32>(maRoadmapItems.size()) )
{
- if ( n_CurrentItemID >= static_cast<sal_Int32>(maRoadmapItems.size()) )
- {
- n_CurrentItemID = sal::static_int_cast< sal_Int16 >(
- maRoadmapItems.size()-1);
- if ( n_CurrentItemID < 0 )
- return;
- aAny <<= n_CurrentItemID;
- }
- else if (Index == n_CurrentItemID)
- aAny <<= sal_Int16(-1);
- else if( Index < n_CurrentItemID)
- aAny <<= static_cast<sal_Int16>( n_CurrentItemID - 1 );
- xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny );
+ n_CurrentItemID = sal::static_int_cast< sal_Int16 >(
+ maRoadmapItems.size()-1);
+ if ( n_CurrentItemID < 0 )
+ return;
+ aAny <<= n_CurrentItemID;
}
+ else if (Index == n_CurrentItemID)
+ aAny <<= sal_Int16(-1);
+ else if( Index < n_CurrentItemID)
+ aAny <<= static_cast<sal_Int16>( n_CurrentItemID - 1 );
+ xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny );
}
diff --git a/toolkit/source/controls/tree/treedatamodel.cxx b/toolkit/source/controls/tree/treedatamodel.cxx
index c4fa7c6e34f3..34d3bf4ab67b 100644
--- a/toolkit/source/controls/tree/treedatamodel.cxx
+++ b/toolkit/source/controls/tree/treedatamodel.cxx
@@ -143,23 +143,23 @@ MutableTreeDataModel::MutableTreeDataModel()
void MutableTreeDataModel::broadcast( broadcast_type eType, const Reference< XTreeNode >& xParentNode, const Reference< XTreeNode >& rNode )
{
::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( cppu::UnoType<XTreeDataModelListener>::get() );
- if( pIter )
- {
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- const Sequence< Reference< XTreeNode > > aNodes { rNode };
- TreeDataModelEvent aEvent( xSource, aNodes, xParentNode );
+ if( !pIter )
+ return;
+
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ const Sequence< Reference< XTreeNode > > aNodes { rNode };
+ TreeDataModelEvent aEvent( xSource, aNodes, xParentNode );
- ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
- while(aListIter.hasMoreElements())
+ ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
+ while(aListIter.hasMoreElements())
+ {
+ XTreeDataModelListener* pListener = static_cast<XTreeDataModelListener*>(aListIter.next());
+ switch( eType )
{
- XTreeDataModelListener* pListener = static_cast<XTreeDataModelListener*>(aListIter.next());
- switch( eType )
- {
- case nodes_changed: pListener->treeNodesChanged(aEvent); break;
- case nodes_inserted: pListener->treeNodesInserted(aEvent); break;
- case nodes_removed: pListener->treeNodesRemoved(aEvent); break;
- case structure_changed: pListener->treeStructureChanged(aEvent); break;
- }
+ case nodes_changed: pListener->treeNodesChanged(aEvent); break;
+ case nodes_inserted: pListener->treeNodesInserted(aEvent); break;
+ case nodes_removed: pListener->treeNodesRemoved(aEvent); break;
+ case structure_changed: pListener->treeStructureChanged(aEvent); break;
}
}
}
@@ -175,25 +175,25 @@ void SAL_CALL MutableTreeDataModel::setRoot( const Reference< XMutableTreeNode >
throw IllegalArgumentException();
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- if( xNode != mxRootNode )
+ if( xNode == mxRootNode )
+ return;
+
+ if( mxRootNode.is() )
{
- if( mxRootNode.is() )
- {
- MutableTreeNodeRef xOldImpl( dynamic_cast< MutableTreeNode* >( mxRootNode.get() ) );
- if( xOldImpl.is() )
- xOldImpl->mbIsInserted = false;
- }
+ MutableTreeNodeRef xOldImpl( dynamic_cast< MutableTreeNode* >( mxRootNode.get() ) );
+ if( xOldImpl.is() )
+ xOldImpl->mbIsInserted = false;
+ }
- MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) );
- if( !xImpl.is() || xImpl->mbIsInserted )
- throw IllegalArgumentException();
+ MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) );
+ if( !xImpl.is() || xImpl->mbIsInserted )
+ throw IllegalArgumentException();
- xImpl->mbIsInserted = true;
- mxRootNode.set(xImpl.get());
+ xImpl->mbIsInserted = true;
+ mxRootNode.set(xImpl.get());
- Reference< XTreeNode > xParentNode;
- broadcast( structure_changed, xParentNode, mxRootNode );
- }
+ Reference< XTreeNode > xParentNode;
+ broadcast( structure_changed, xParentNode, mxRootNode );
}
Reference< XTreeNode > SAL_CALL MutableTreeDataModel::getRoot( )
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index aeb84bd8139a..e38a68ff8322 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -250,39 +250,39 @@ void UnoControl::ImplSetPeerProperty( const OUString& rPropName, const Any& rVal
// releases our mutex before calling here in)
// That's why this additional check
- if ( mxVclWindowPeer.is() )
- {
- Any aConvertedValue( rVal );
+ if ( !mxVclWindowPeer.is() )
+ return;
+
+ Any aConvertedValue( rVal );
- if ( mpData->bLocalizationSupport )
+ if ( mpData->bLocalizationSupport )
+ {
+ // We now support a mapping for language dependent properties. This is the
+ // central method to implement it.
+ if( rPropName == "Text" ||
+ rPropName == "Label" ||
+ rPropName == "Title" ||
+ rPropName == "HelpText" ||
+ rPropName == "CurrencySymbol" ||
+ rPropName == "StringItemList" )
{
- // We now support a mapping for language dependent properties. This is the
- // central method to implement it.
- if( rPropName == "Text" ||
- rPropName == "Label" ||
- rPropName == "Title" ||
- rPropName == "HelpText" ||
- rPropName == "CurrencySymbol" ||
- rPropName == "StringItemList" )
+ OUString aValue;
+ uno::Sequence< OUString > aSeqValue;
+ if ( aConvertedValue >>= aValue )
{
- OUString aValue;
- uno::Sequence< OUString > aSeqValue;
- if ( aConvertedValue >>= aValue )
- {
- if ( ImplCheckLocalize( aValue ) )
- aConvertedValue <<= aValue;
- }
- else if ( aConvertedValue >>= aSeqValue )
- {
- for ( auto& rValue : aSeqValue )
- ImplCheckLocalize( rValue );
- aConvertedValue <<= aSeqValue;
- }
+ if ( ImplCheckLocalize( aValue ) )
+ aConvertedValue <<= aValue;
+ }
+ else if ( aConvertedValue >>= aSeqValue )
+ {
+ for ( auto& rValue : aSeqValue )
+ ImplCheckLocalize( rValue );
+ aConvertedValue <<= aSeqValue;
}
}
-
- mxVclWindowPeer->setProperty( rPropName, aConvertedValue );
}
+
+ mxVclWindowPeer->setProperty( rPropName, aConvertedValue );
}
void UnoControl::PrepareWindowDescriptor( WindowDescriptor& )
diff --git a/toolkit/source/controls/unocontrolbase.cxx b/toolkit/source/controls/unocontrolbase.cxx
index 86a5a65686f6..8b9732bb1425 100644
--- a/toolkit/source/controls/unocontrolbase.cxx
+++ b/toolkit/source/controls/unocontrolbase.cxx
@@ -57,47 +57,47 @@ void UnoControlBase::ImplSetPropertyValues( const css::uno::Sequence< OUString >
return;
DBG_ASSERT( xMPS.is(), "UnoControlBase::ImplSetPropertyValues: no multi property set interface!" );
- if ( xMPS.is() )
+ if ( !xMPS.is() )
+ return;
+
+ if ( !bUpdateThis )
+ ImplLockPropertyChangeNotifications( aPropertyNames, true );
+
+ try
+ {
+ xMPS->setPropertyValues( aPropertyNames, aValues );
+ }
+ catch( const css::uno::Exception& )
{
- if ( !bUpdateThis )
- ImplLockPropertyChangeNotifications( aPropertyNames, true );
-
- try
- {
- xMPS->setPropertyValues( aPropertyNames, aValues );
- }
- catch( const css::uno::Exception& )
- {
- if ( !bUpdateThis )
- ImplLockPropertyChangeNotifications( aPropertyNames, false );
- }
if ( !bUpdateThis )
ImplLockPropertyChangeNotifications( aPropertyNames, false );
}
+ if ( !bUpdateThis )
+ ImplLockPropertyChangeNotifications( aPropertyNames, false );
}
void UnoControlBase::ImplSetPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue, bool bUpdateThis )
{
// Model might be logged off already but an event still fires
- if ( mxModel.is() )
+ if ( !mxModel.is() )
+ return;
+
+ css::uno::Reference< css::beans::XPropertySet > xPSet( mxModel, css::uno::UNO_QUERY );
+ if ( !bUpdateThis )
+ ImplLockPropertyChangeNotification( aPropertyName, true );
+
+ try
+ {
+ xPSet->setPropertyValue( aPropertyName, aValue );
+ }
+ catch( const css::uno::Exception& )
{
- css::uno::Reference< css::beans::XPropertySet > xPSet( mxModel, css::uno::UNO_QUERY );
- if ( !bUpdateThis )
- ImplLockPropertyChangeNotification( aPropertyName, true );
-
- try
- {
- xPSet->setPropertyValue( aPropertyName, aValue );
- }
- catch( const css::uno::Exception& )
- {
- if ( !bUpdateThis )
- ImplLockPropertyChangeNotification( aPropertyName, false );
- throw;
- }
if ( !bUpdateThis )
ImplLockPropertyChangeNotification( aPropertyName, false );
+ throw;
}
+ if ( !bUpdateThis )
+ ImplLockPropertyChangeNotification( aPropertyName, false );
}
css::uno::Any UnoControlBase::ImplGetPropertyValue( const OUString& aPropertyName )
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
index 48e69247ba05..552b9ee52af8 100644
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -717,52 +717,52 @@ void UnoControlContainer::createPeer( const uno::Reference< awt::XToolkit >& rxT
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- if( !getPeer().is() )
- {
- bool bVis = maComponentInfos.bVisible;
- if( bVis )
- UnoControl::setVisible( false );
+ if( getPeer().is() )
+ return;
- // Create a new peer
- UnoControl::createPeer( rxToolkit, rParent );
+ bool bVis = maComponentInfos.bVisible;
+ if( bVis )
+ UnoControl::setVisible( false );
- // Create all children's peers
- if ( !mbCreatingCompatiblePeer )
- {
- // Evaluate "Step" property
- uno::Reference< awt::XControlModel > xModel( getModel() );
- uno::Reference< beans::XPropertySet > xPSet
- ( xModel, uno::UNO_QUERY );
- uno::Reference< beans::XPropertySetInfo >
- xInfo = xPSet->getPropertySetInfo();
- OUString aPropName( "Step" );
- if ( xInfo->hasPropertyByName( aPropName ) )
- {
- css::uno::Any aVal = xPSet->getPropertyValue( aPropName );
- sal_Int32 nDialogStep = 0;
- aVal >>= nDialogStep;
- uno::Reference< awt::XControlContainer > xContainer =
- static_cast< awt::XControlContainer* >(this);
- implUpdateVisibility( nDialogStep, xContainer );
-
- uno::Reference< beans::XPropertyChangeListener > xListener =
- new DialogStepChangedListener(xContainer);
- xPSet->addPropertyChangeListener( aPropName, xListener );
- }
+ // Create a new peer
+ UnoControl::createPeer( rxToolkit, rParent );
- uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
- for( auto& rCtrl : aCtrls )
- rCtrl->createPeer( rxToolkit, getPeer() );
-
- uno::Reference< awt::XVclContainerPeer > xC( getPeer(), uno::UNO_QUERY );
- if ( xC.is() )
- xC->enableDialogControl( true );
- ImplActivateTabControllers();
+ // Create all children's peers
+ if ( !mbCreatingCompatiblePeer )
+ {
+ // Evaluate "Step" property
+ uno::Reference< awt::XControlModel > xModel( getModel() );
+ uno::Reference< beans::XPropertySet > xPSet
+ ( xModel, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySetInfo >
+ xInfo = xPSet->getPropertySetInfo();
+ OUString aPropName( "Step" );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ css::uno::Any aVal = xPSet->getPropertyValue( aPropName );
+ sal_Int32 nDialogStep = 0;
+ aVal >>= nDialogStep;
+ uno::Reference< awt::XControlContainer > xContainer =
+ static_cast< awt::XControlContainer* >(this);
+ implUpdateVisibility( nDialogStep, xContainer );
+
+ uno::Reference< beans::XPropertyChangeListener > xListener =
+ new DialogStepChangedListener(xContainer);
+ xPSet->addPropertyChangeListener( aPropName, xListener );
}
- if( bVis && !isDesignMode() )
- UnoControl::setVisible( true );
+ uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
+ for( auto& rCtrl : aCtrls )
+ rCtrl->createPeer( rxToolkit, getPeer() );
+
+ uno::Reference< awt::XVclContainerPeer > xC( getPeer(), uno::UNO_QUERY );
+ if ( xC.is() )
+ xC->enableDialogControl( true );
+ ImplActivateTabControllers();
}
+
+ if( bVis && !isDesignMode() )
+ UnoControl::setVisible( true );
}
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index a735178bdca1..695b6fcb00e5 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -709,60 +709,60 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt
xMark->deleteMark(nPropDataBeginMark);
}
- if ( aProps.find( BASEPROPERTY_FONTDESCRIPTOR ) != aProps.end() )
- {
- const css::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ];
- // Until 5.0 export arrives, write old format...
- css::awt::FontDescriptor aFD;
- (*pProp) >>= aFD;
+ if ( aProps.find( BASEPROPERTY_FONTDESCRIPTOR ) == aProps.end() )
+ return;
- for ( sal_uInt16 n = BASEPROPERTY_FONT_TYPE; n <= BASEPROPERTY_FONT_ATTRIBS; n++ )
- {
- sal_Int32 nPropDataBeginMark = xMark->createMark();
- OutStream->writeLong( 0 ); // DataLen
- OutStream->writeShort( n ); // PropId
- OutStream->writeBoolean( false ); // Void
+ const css::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ];
+ // Until 5.0 export arrives, write old format...
+ css::awt::FontDescriptor aFD;
+ (*pProp) >>= aFD;
- if ( n == BASEPROPERTY_FONT_TYPE )
- {
- OutStream->writeUTF( aFD.Name );
- OutStream->writeUTF( aFD.StyleName );
- OutStream->writeShort( aFD.Family );
- OutStream->writeShort( aFD.CharSet );
- OutStream->writeShort( aFD.Pitch );
- }
- else if ( n == BASEPROPERTY_FONT_SIZE )
- {
- OutStream->writeLong( aFD.Width );
- OutStream->writeLong( aFD.Height );
- OutStream->writeShort(
- sal::static_int_cast< sal_Int16 >(
- vcl::unohelper::ConvertFontWidth(aFD.CharacterWidth)) );
- }
- else if ( n == BASEPROPERTY_FONT_ATTRIBS )
- {
- OutStream->writeShort(
- sal::static_int_cast< sal_Int16 >(
- vcl::unohelper::ConvertFontWeight(aFD.Weight)) );
- OutStream->writeShort(
- sal::static_int_cast< sal_Int16 >(aFD.Slant) );
- OutStream->writeShort( aFD.Underline );
- OutStream->writeShort( aFD.Strikeout );
- OutStream->writeShort( static_cast<short>(aFD.Orientation * 10) );
- OutStream->writeBoolean( aFD.Kerning );
- OutStream->writeBoolean( aFD.WordLineMode );
- }
- else
- {
- OSL_FAIL( "Property?!" );
- }
+ for ( sal_uInt16 n = BASEPROPERTY_FONT_TYPE; n <= BASEPROPERTY_FONT_ATTRIBS; n++ )
+ {
+ sal_Int32 nPropDataBeginMark = xMark->createMark();
+ OutStream->writeLong( 0 ); // DataLen
+ OutStream->writeShort( n ); // PropId
+ OutStream->writeBoolean( false ); // Void
- sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
- xMark->jumpToMark( nPropDataBeginMark );
- OutStream->writeLong( nPropDataLen );
- xMark->jumpToFurthest();
- xMark->deleteMark(nPropDataBeginMark);
+ if ( n == BASEPROPERTY_FONT_TYPE )
+ {
+ OutStream->writeUTF( aFD.Name );
+ OutStream->writeUTF( aFD.StyleName );
+ OutStream->writeShort( aFD.Family );
+ OutStream->writeShort( aFD.CharSet );
+ OutStream->writeShort( aFD.Pitch );
+ }
+ else if ( n == BASEPROPERTY_FONT_SIZE )
+ {
+ OutStream->writeLong( aFD.Width );
+ OutStream->writeLong( aFD.Height );
+ OutStream->writeShort(
+ sal::static_int_cast< sal_Int16 >(
+ vcl::unohelper::ConvertFontWidth(aFD.CharacterWidth)) );
+ }
+ else if ( n == BASEPROPERTY_FONT_ATTRIBS )
+ {
+ OutStream->writeShort(
+ sal::static_int_cast< sal_Int16 >(
+ vcl::unohelper::ConvertFontWeight(aFD.Weight)) );
+ OutStream->writeShort(
+ sal::static_int_cast< sal_Int16 >(aFD.Slant) );
+ OutStream->writeShort( aFD.Underline );
+ OutStream->writeShort( aFD.Strikeout );
+ OutStream->writeShort( static_cast<short>(aFD.Orientation * 10) );
+ OutStream->writeBoolean( aFD.Kerning );
+ OutStream->writeBoolean( aFD.WordLineMode );
+ }
+ else
+ {
+ OSL_FAIL( "Property?!" );
}
+
+ sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
+ xMark->jumpToMark( nPropDataBeginMark );
+ OutStream->writeLong( nPropDataLen );
+ xMark->jumpToFurthest();
+ xMark->deleteMark(nPropDataBeginMark);
}
}
@@ -1308,49 +1308,49 @@ void UnoControlModel::setPropertyValues( const css::uno::Sequence< OUString >& r
sal_Int32 nValidHandles = getInfoHelper().fillHandles( pHandles, rPropertyNames );
- if ( nValidHandles )
+ if ( !nValidHandles )
+ return;
+
+ // if somebody sets properties which are single aspects of a font descriptor,
+ // remove them, and build a font descriptor instead
+ std::unique_ptr< awt::FontDescriptor > pFD;
+ for ( sal_Int32 n = 0; n < nProps; ++n )
{
- // if somebody sets properties which are single aspects of a font descriptor,
- // remove them, and build a font descriptor instead
- std::unique_ptr< awt::FontDescriptor > pFD;
- for ( sal_Int32 n = 0; n < nProps; ++n )
+ if ( ( pHandles[n] >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( pHandles[n] <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
{
- if ( ( pHandles[n] >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( pHandles[n] <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ if (!pFD)
{
- if (!pFD)
- {
- css::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ];
- pFD.reset( new awt::FontDescriptor );
- (*pProp) >>= *pFD;
- }
- lcl_ImplMergeFontProperty( *pFD, static_cast<sal_uInt16>(pHandles[n]), pValues[n] );
- pHandles[n] = -1;
- nValidHandles--;
+ css::uno::Any* pProp = &maData[ BASEPROPERTY_FONTDESCRIPTOR ];
+ pFD.reset( new awt::FontDescriptor );
+ (*pProp) >>= *pFD;
}
+ lcl_ImplMergeFontProperty( *pFD, static_cast<sal_uInt16>(pHandles[n]), pValues[n] );
+ pHandles[n] = -1;
+ nValidHandles--;
}
+ }
- if ( nValidHandles )
- {
- ImplNormalizePropertySequence( nProps, pHandles, pValues, &nValidHandles );
- aGuard.clear();
- // clear our guard before calling into setFastPropertyValues - this method
- // will implicitly call property listeners, and this should not happen with
- // our mutex locked
- // #i23451#
- setFastPropertyValues( nProps, pHandles, pValues, nValidHandles );
- }
- else
- aGuard.clear();
- // same as a few lines above
+ if ( nValidHandles )
+ {
+ ImplNormalizePropertySequence( nProps, pHandles, pValues, &nValidHandles );
+ aGuard.clear();
+ // clear our guard before calling into setFastPropertyValues - this method
+ // will implicitly call property listeners, and this should not happen with
+ // our mutex locked
+ // #i23451#
+ setFastPropertyValues( nProps, pHandles, pValues, nValidHandles );
+ }
+ else
+ aGuard.clear();
+ // same as a few lines above
- // Don't merge FD property into array, as it is sorted
- if (pFD)
- {
- css::uno::Any aValue;
- aValue <<= *pFD;
- sal_Int32 nHandle = BASEPROPERTY_FONTDESCRIPTOR;
- setFastPropertyValues( 1, &nHandle, &aValue, 1 );
- }
+ // Don't merge FD property into array, as it is sorted
+ if (pFD)
+ {
+ css::uno::Any aValue;
+ aValue <<= *pFD;
+ sal_Int32 nHandle = BASEPROPERTY_FONTDESCRIPTOR;
+ setFastPropertyValues( 1, &nHandle, &aValue, 1 );
}
}
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index 8a9988f386f2..fde094051708 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -2122,39 +2122,39 @@ void SAL_CALL UnoControlListBoxModel::setFastPropertyValue_NoBroadcast( sal_Int3
{
UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- if ( nHandle == BASEPROPERTY_STRINGITEMLIST )
- {
- // reset selection
- uno::Sequence<sal_Int16> aSeq;
- setDependentFastPropertyValue( BASEPROPERTY_SELECTEDITEMS, uno::Any(aSeq) );
+ if ( nHandle != BASEPROPERTY_STRINGITEMLIST )
+ return;
- if ( !m_xData->m_bSettingLegacyProperty )
- {
- // synchronize the legacy StringItemList property with our list items
- Sequence< OUString > aStringItemList;
- Any aPropValue;
- getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
- OSL_VERIFY( aPropValue >>= aStringItemList );
-
- ::std::vector< ListItem > aItems( aStringItemList.getLength() );
- ::std::transform(
- aStringItemList.begin(),
- aStringItemList.end(),
- aItems.begin(),
- CreateListItem()
- );
- m_xData->setAllItems( aItems );
-
- // since an XItemListListener does not have a "all items modified" or some such method,
- // we simulate this by notifying removal of all items, followed by insertion of all new
- // items
- lang::EventObject aEvent;
- aEvent.Source = *this;
- m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
- // TODO: OPropertySetHelper calls into this method with the mutex locked ...
- // which is wrong for the above notifications ...
- }
- }
+ // reset selection
+ uno::Sequence<sal_Int16> aSeq;
+ setDependentFastPropertyValue( BASEPROPERTY_SELECTEDITEMS, uno::Any(aSeq) );
+
+ if ( m_xData->m_bSettingLegacyProperty )
+ return;
+
+ // synchronize the legacy StringItemList property with our list items
+ Sequence< OUString > aStringItemList;
+ Any aPropValue;
+ getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
+ OSL_VERIFY( aPropValue >>= aStringItemList );
+
+ ::std::vector< ListItem > aItems( aStringItemList.getLength() );
+ ::std::transform(
+ aStringItemList.begin(),
+ aStringItemList.end(),
+ aItems.begin(),
+ CreateListItem()
+ );
+ m_xData->setAllItems( aItems );
+
+ // since an XItemListListener does not have a "all items modified" or some such method,
+ // we simulate this by notifying removal of all items, followed by insertion of all new
+ // items
+ lang::EventObject aEvent;
+ aEvent.Source = *this;
+ m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
+ // TODO: OPropertySetHelper calls into this method with the mutex locked ...
+ // which is wrong for the above notifications ...
}
@@ -2638,23 +2638,23 @@ void UnoListBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount )
uno::Sequence< OUString> aSeq;
aVal >>= aSeq;
sal_uInt16 nOldLen = static_cast<sal_uInt16>(aSeq.getLength());
- if ( nOldLen && ( nPos < nOldLen ) )
- {
- if ( nCount > ( nOldLen-nPos ) )
- nCount = nOldLen-nPos;
+ if ( !(nOldLen && ( nPos < nOldLen )) )
+ return;
- sal_uInt16 nNewLen = nOldLen - nCount;
+ if ( nCount > ( nOldLen-nPos ) )
+ nCount = nOldLen-nPos;
- uno::Sequence< OUString> aNewSeq( nNewLen );
+ sal_uInt16 nNewLen = nOldLen - nCount;
- // Items before the Remove-Position
- std::copy(aSeq.begin(), std::next(aSeq.begin(), nPos), aNewSeq.begin());
+ uno::Sequence< OUString> aNewSeq( nNewLen );
- // Rest of Items
- std::copy(std::next(aSeq.begin(), nPos + nCount), aSeq.end(), std::next(aNewSeq.begin(), nPos));
+ // Items before the Remove-Position
+ std::copy(aSeq.begin(), std::next(aSeq.begin(), nPos), aNewSeq.begin());
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), uno::Any(aNewSeq), true );
- }
+ // Rest of Items
+ std::copy(std::next(aSeq.begin(), nPos + nCount), aSeq.end(), std::next(aNewSeq.begin(), nPos));
+
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), uno::Any(aNewSeq), true );
}
sal_Int16 UnoListBoxControl::getItemCount()
@@ -2937,32 +2937,32 @@ void SAL_CALL UnoControlComboBoxModel::setFastPropertyValue_NoBroadcast( sal_Int
{
UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
- if ( nHandle == BASEPROPERTY_STRINGITEMLIST && !m_xData->m_bSettingLegacyProperty)
- {
- // synchronize the legacy StringItemList property with our list items
- Sequence< OUString > aStringItemList;
- Any aPropValue;
- getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
- OSL_VERIFY( aPropValue >>= aStringItemList );
-
- ::std::vector< ListItem > aItems( aStringItemList.getLength() );
- ::std::transform(
- aStringItemList.begin(),
- aStringItemList.end(),
- aItems.begin(),
- CreateListItem()
- );
- m_xData->setAllItems( aItems );
-
- // since an XItemListListener does not have a "all items modified" or some such method,
- // we simulate this by notifying removal of all items, followed by insertion of all new
- // items
- lang::EventObject aEvent;
- aEvent.Source = *this;
- m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
- // TODO: OPropertySetHelper calls into this method with the mutex locked ...
- // which is wrong for the above notifications ...
- }
+ if (nHandle != BASEPROPERTY_STRINGITEMLIST || m_xData->m_bSettingLegacyProperty)
+ return;
+
+ // synchronize the legacy StringItemList property with our list items
+ Sequence< OUString > aStringItemList;
+ Any aPropValue;
+ getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
+ OSL_VERIFY( aPropValue >>= aStringItemList );
+
+ ::std::vector< ListItem > aItems( aStringItemList.getLength() );
+ ::std::transform(
+ aStringItemList.begin(),
+ aStringItemList.end(),
+ aItems.begin(),
+ CreateListItem()
+ );
+ m_xData->setAllItems( aItems );
+
+ // since an XItemListListener does not have a "all items modified" or some such method,
+ // we simulate this by notifying removal of all items, followed by insertion of all new
+ // items
+ lang::EventObject aEvent;
+ aEvent.Source = *this;
+ m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
+ // TODO: OPropertySetHelper calls into this method with the mutex locked ...
+ // which is wrong for the above notifications ...
}
uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
@@ -3231,23 +3231,23 @@ void UnoComboBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount )
uno::Sequence< OUString> aSeq;
aVal >>= aSeq;
sal_uInt16 nOldLen = static_cast<sal_uInt16>(aSeq.getLength());
- if ( nOldLen && ( nPos < nOldLen ) )
- {
- if ( nCount > ( nOldLen-nPos ) )
- nCount = nOldLen-nPos;
+ if ( !nOldLen || ( nPos >= nOldLen ) )
+ return;
- sal_uInt16 nNewLen = nOldLen - nCount;
+ if ( nCount > ( nOldLen-nPos ) )
+ nCount = nOldLen-nPos;
- uno::Sequence< OUString> aNewSeq( nNewLen );
+ sal_uInt16 nNewLen = nOldLen - nCount;
- // items before the deletion position
- std::copy(aSeq.begin(), std::next(aSeq.begin(), nPos), aNewSeq.begin());
+ uno::Sequence< OUString> aNewSeq( nNewLen );
- // remainder of old items
- std::copy(std::next(aSeq.begin(), nPos + nCount), aSeq.end(), std::next(aNewSeq.begin(), nPos));
+ // items before the deletion position
+ std::copy(aSeq.begin(), std::next(aSeq.begin(), nPos), aNewSeq.begin());
- ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), uno::Any(aNewSeq), true );
- }
+ // remainder of old items
+ std::copy(std::next(aSeq.begin(), nPos + nCount), aSeq.end(), std::next(aNewSeq.begin(), nPos));
+
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), uno::Any(aNewSeq), true );
}
sal_Int16 UnoComboBoxControl::getItemCount()
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
index 1078973864dc..eb37d4137419 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -164,19 +164,19 @@ void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, css::uno::Reference<
VCLXWindow* pVCLXWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( xIFace );
DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" );
- if ( pVCLXWindow )
+ if ( !pVCLXWindow )
+ return;
+
+ css::uno::Reference< css::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
+ if( xPeer.is() )
{
- css::uno::Reference< css::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
- if( xPeer.is() )
- {
- bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() ));
- DBG_ASSERT( bSameInstance, "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" );
- if ( bSameInstance )
- return;
- }
- pVCLXWindow->SetWindow( pWindow );
- pWindow->SetWindowPeer( xIFace, pVCLXWindow );
+ bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() ));
+ DBG_ASSERT( bSameInstance, "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" );
+ if ( bSameInstance )
+ return;
}
+ pVCLXWindow->SetWindow( pWindow );
+ pWindow->SetWindowPeer( xIFace, pVCLXWindow );
}
css::uno::Reference< css::awt::XGraphics> UnoWrapper::CreateGraphics( OutputDevice* pOutDev )