summaryrefslogtreecommitdiff
path: root/vcl/source/window/printdlg.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-04 00:04:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-04 01:41:02 +0200
commitce47b1a9c68a27fc37594148f6be2661f27120ea (patch)
tree4c9b5c3da29b76c7c8eb23cdbf85c496b0efd87e /vcl/source/window/printdlg.cxx
parent6fc2a300ad8b1c6936b513eff94fd527ea74b469 (diff)
loplugin:flatten in vcl/window
Change-Id: I94e69e988f038e85b1fb78985211d478bb5ed9b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100033 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/window/printdlg.cxx')
-rw-r--r--vcl/source/window/printdlg.cxx152
1 files changed, 76 insertions, 76 deletions
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 28e4b689d276..d964390ef062 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -1692,50 +1692,50 @@ void PrintDialog::updateWindowFromProperty( const OUString& i_rProperty )
{
beans::PropertyValue* pValue = maPController->getValue( i_rProperty );
auto it = maPropertyToWindowMap.find( i_rProperty );
- if( pValue && it != maPropertyToWindowMap.end() )
+ if( !(pValue && it != maPropertyToWindowMap.end()) )
+ return;
+
+ const auto& rWindows( it->second );
+ if( rWindows.empty() )
+ return;
+
+ bool bVal = false;
+ sal_Int32 nVal = -1;
+ if( pValue->Value >>= bVal )
{
- const auto& rWindows( it->second );
- if( ! rWindows.empty() )
+ // we should have a CheckBox for this one
+ weld::CheckButton* pBox = dynamic_cast<weld::CheckButton*>(rWindows.front());
+ if( pBox )
{
- bool bVal = false;
- sal_Int32 nVal = -1;
- if( pValue->Value >>= bVal )
- {
- // we should have a CheckBox for this one
- weld::CheckButton* pBox = dynamic_cast<weld::CheckButton*>(rWindows.front());
- if( pBox )
- {
- pBox->set_active( bVal );
- }
- else if ( i_rProperty == "PrintProspect" )
- {
- // EVIL special case
- if( bVal )
- mxBrochureBtn->set_active(true);
- else
- mxPagesBtn->set_active(true);
- }
- else
- {
- SAL_WARN( "vcl", "missing a checkbox" );
- }
- }
- else if( pValue->Value >>= nVal )
- {
- // this could be a ListBox or a RadioButtonGroup
- weld::ComboBox* pList = dynamic_cast<weld::ComboBox*>(rWindows.front());
- if( pList )
- {
- pList->set_active( static_cast< sal_uInt16 >(nVal) );
- }
- else if( nVal >= 0 && nVal < sal_Int32(rWindows.size() ) )
- {
- weld::RadioButton* pBtn = dynamic_cast<weld::RadioButton*>(rWindows[nVal]);
- SAL_WARN_IF( !pBtn, "vcl", "unexpected control for property" );
- if( pBtn )
- pBtn->set_active(true);
- }
- }
+ pBox->set_active( bVal );
+ }
+ else if ( i_rProperty == "PrintProspect" )
+ {
+ // EVIL special case
+ if( bVal )
+ mxBrochureBtn->set_active(true);
+ else
+ mxPagesBtn->set_active(true);
+ }
+ else
+ {
+ SAL_WARN( "vcl", "missing a checkbox" );
+ }
+ }
+ else if( pValue->Value >>= nVal )
+ {
+ // this could be a ListBox or a RadioButtonGroup
+ weld::ComboBox* pList = dynamic_cast<weld::ComboBox*>(rWindows.front());
+ if( pList )
+ {
+ pList->set_active( static_cast< sal_uInt16 >(nVal) );
+ }
+ else if( nVal >= 0 && nVal < sal_Int32(rWindows.size() ) )
+ {
+ weld::RadioButton* pBtn = dynamic_cast<weld::RadioButton*>(rWindows[nVal]);
+ SAL_WARN_IF( !pBtn, "vcl", "unexpected control for property" );
+ if( pBtn )
+ pBtn->set_active(true);
}
}
}
@@ -2048,54 +2048,54 @@ IMPL_LINK( PrintDialog, UIOption_RadioHdl, weld::ToggleButton&, i_rBtn, void )
// this handler gets called for all radiobuttons that get unchecked, too
// however we only want one notification for the new value (that is for
// the button that gets checked)
- if( i_rBtn.get_active() )
- {
- PropertyValue* pVal = getValueForWindow( &i_rBtn );
- auto it = maControlToNumValMap.find( &i_rBtn );
- if( pVal && it != maControlToNumValMap.end() )
- {
- makeEnabled( &i_rBtn );
+ if( !i_rBtn.get_active() )
+ return;
- sal_Int32 nVal = it->second;
- pVal->Value <<= nVal;
+ PropertyValue* pVal = getValueForWindow( &i_rBtn );
+ auto it = maControlToNumValMap.find( &i_rBtn );
+ if( !(pVal && it != maControlToNumValMap.end()) )
+ return;
- updateOrientationBox();
+ makeEnabled( &i_rBtn );
- checkOptionalControlDependencies();
+ sal_Int32 nVal = it->second;
+ pVal->Value <<= nVal;
- // tdf#41205 give focus to the page range edit if the corresponding radio button was selected
- if (pVal->Name == "PrintContent" && mxPageRangesRadioButton->get_active())
- mxPageRangeEdit->grab_focus();
+ updateOrientationBox();
- // update preview and page settings
- preparePreview(false);
- }
- }
+ checkOptionalControlDependencies();
+
+ // tdf#41205 give focus to the page range edit if the corresponding radio button was selected
+ if (pVal->Name == "PrintContent" && mxPageRangesRadioButton->get_active())
+ mxPageRangeEdit->grab_focus();
+
+ // update preview and page settings
+ preparePreview(false);
}
IMPL_LINK( PrintDialog, UIOption_SelectHdl, weld::ComboBox&, i_rBox, void )
{
PropertyValue* pVal = getValueForWindow( &i_rBox );
- if( pVal )
- {
- makeEnabled( &i_rBox );
+ if( !pVal )
+ return;
- sal_Int32 nVal( i_rBox.get_active() );
- pVal->Value <<= nVal;
+ makeEnabled( &i_rBox );
- //If we are in impress we start in print slides mode and get a
- //maFirstPageSize for slides which are usually landscape mode, if we
- //change to notes which are usually in portrait mode, and then visit
- //n-up print, we will assume notes are in landscape unless we throw
- //away maFirstPageSize when we change page content type
- if (pVal->Name == "PageContentType")
- maFirstPageSize = Size();
+ sal_Int32 nVal( i_rBox.get_active() );
+ pVal->Value <<= nVal;
- checkOptionalControlDependencies();
+ //If we are in impress we start in print slides mode and get a
+ //maFirstPageSize for slides which are usually landscape mode, if we
+ //change to notes which are usually in portrait mode, and then visit
+ //n-up print, we will assume notes are in landscape unless we throw
+ //away maFirstPageSize when we change page content type
+ if (pVal->Name == "PageContentType")
+ maFirstPageSize = Size();
- // update preview and page settings
- preparePreview(false);
- }
+ checkOptionalControlDependencies();
+
+ // update preview and page settings
+ preparePreview(false);
}
IMPL_LINK( PrintDialog, UIOption_SpinModifyHdl, weld::SpinButton&, i_rBox, void )