summaryrefslogtreecommitdiff
path: root/sw/source/ui/dialog
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-30 10:39:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-30 20:18:57 +0200
commit4209d94b46cdd96898c02344b11700369ae88784 (patch)
tree02fedf63092cb7d00cd3b4c4a6b5a35eff952f41 /sw/source/ui/dialog
parent30562669909def344c529e9c899c03248bc11149 (diff)
loplugin:flatten in sw/ui/dialog..sw/ui/table
Change-Id: I2350c1d3f5fab727b0d47b6f3684804b77e68122 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99805 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/ui/dialog')
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx50
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx260
2 files changed, 155 insertions, 155 deletions
diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx
index 327c5573e67a..e05e881e45cb 100644
--- a/sw/source/ui/dialog/ascfldlg.cxx
+++ b/sw/source/ui/dialog/ascfldlg.cxx
@@ -276,22 +276,22 @@ void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions )
// save the user settings
OUString sData;
rOptions.WriteUserData( sData );
- if (!sData.isEmpty())
+ if (sData.isEmpty())
+ return;
+
+ const OUString sFindNm = OUString::createFromAscii(
+ m_xFontLB->get_visible() ? sDialogImpExtraData
+ : sDialogExpExtraData);
+ sal_Int32 nEnd, nStt = m_sExtraData.indexOf( sFindNm );
+ if( -1 != nStt )
{
- const OUString sFindNm = OUString::createFromAscii(
- m_xFontLB->get_visible() ? sDialogImpExtraData
- : sDialogExpExtraData);
- sal_Int32 nEnd, nStt = m_sExtraData.indexOf( sFindNm );
- if( -1 != nStt )
- {
- // called twice, so remove "old" settings
- nEnd = m_sExtraData.indexOf( cDialogExtraDataClose,
- nStt + nDialogExtraDataLen );
- if( -1 != nEnd )
- m_sExtraData = m_sExtraData.replaceAt( nStt, nEnd - nStt + 1, "" );
- }
- m_sExtraData += sFindNm + sData + OUStringChar(cDialogExtraDataClose);
+ // called twice, so remove "old" settings
+ nEnd = m_sExtraData.indexOf( cDialogExtraDataClose,
+ nStt + nDialogExtraDataLen );
+ if( -1 != nEnd )
+ m_sExtraData = m_sExtraData.replaceAt( nStt, nEnd - nStt + 1, "" );
}
+ m_sExtraData += sFindNm + sData + OUStringChar(cDialogExtraDataClose);
}
void SwAsciiFilterDlg::SetCRLF( LineEnd eEnd )
@@ -334,18 +334,18 @@ bool SwAsciiFilterDlg::GetIncludeBOM() const
void SwAsciiFilterDlg::UpdateIncludeBOMSensitiveState()
{
- if (m_xIncludeBOM_CB->get_visible())
+ if (!m_xIncludeBOM_CB->get_visible())
+ return;
+
+ switch (m_xCharSetLB->GetSelectTextEncoding())
{
- switch (m_xCharSetLB->GetSelectTextEncoding())
- {
- case RTL_TEXTENCODING_UTF8:
- case RTL_TEXTENCODING_UCS2:
- m_xIncludeBOM_CB->set_sensitive(true);
- break;
- default:
- m_xIncludeBOM_CB->set_sensitive(false);
- break;
- }
+ case RTL_TEXTENCODING_UTF8:
+ case RTL_TEXTENCODING_UCS2:
+ m_xIncludeBOM_CB->set_sensitive(true);
+ break;
+ default:
+ m_xIncludeBOM_CB->set_sensitive(false);
+ break;
}
}
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index c51e2a7fd927..790254fc9496 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -538,21 +538,21 @@ SwEditRegionDlg::~SwEditRegionDlg( )
void SwEditRegionDlg::SelectSection(const OUString& rSectionName)
{
std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
- if (m_xTree->get_iter_first(*xIter))
+ if (!m_xTree->get_iter_first(*xIter))
+ return;
+
+ do
{
- do
+ SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(*xIter).toInt64());
+ if (pRepr->GetSectionData().GetSectionName() == rSectionName)
{
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(*xIter).toInt64());
- if (pRepr->GetSectionData().GetSectionName() == rSectionName)
- {
- m_xTree->unselect_all();
- m_xTree->select(*xIter);
- m_xTree->scroll_to_row(*xIter);
- GetFirstEntryHdl(*m_xTree);
- break;
- }
- } while (m_xTree->iter_next(*xIter));
- }
+ m_xTree->unselect_all();
+ m_xTree->select(*xIter);
+ m_xTree->scroll_to_row(*xIter);
+ GetFirstEntryHdl(*m_xTree);
+ break;
+ }
+ } while (m_xTree->iter_next(*xIter));
}
// selected entry in TreeListBox is showed in Edit window in case of
@@ -1022,58 +1022,58 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, weld::Button&, void)
aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
SwSectionPropertyTabDialog aTabDlg(m_xDialog.get(), aSet, rSh);
- if (RET_OK == aTabDlg.run())
- {
- const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
- if( pOutSet && pOutSet->Count() )
- {
- const SfxPoolItem *pColItem, *pBrushItem,
- *pFootnoteItem, *pEndItem, *pBalanceItem,
- *pFrameDirItem, *pLRSpaceItem;
- SfxItemState eColState = pOutSet->GetItemState(
- RES_COL, false, &pColItem );
- SfxItemState eBrushState = pOutSet->GetItemState(
- RES_BACKGROUND, false, &pBrushItem );
- SfxItemState eFootnoteState = pOutSet->GetItemState(
- RES_FTN_AT_TXTEND, false, &pFootnoteItem );
- SfxItemState eEndState = pOutSet->GetItemState(
- RES_END_AT_TXTEND, false, &pEndItem );
- SfxItemState eBalanceState = pOutSet->GetItemState(
- RES_COLUMNBALANCE, false, &pBalanceItem );
- SfxItemState eFrameDirState = pOutSet->GetItemState(
- RES_FRAMEDIR, false, &pFrameDirItem );
- SfxItemState eLRState = pOutSet->GetItemState(
- RES_LR_SPACE, false, &pLRSpaceItem);
-
- if( SfxItemState::SET == eColState ||
- SfxItemState::SET == eBrushState ||
- SfxItemState::SET == eFootnoteState ||
- SfxItemState::SET == eEndState ||
- SfxItemState::SET == eBalanceState||
- SfxItemState::SET == eFrameDirState||
- SfxItemState::SET == eLRState)
- {
- m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
- if( SfxItemState::SET == eColState )
- pRepr->GetCol() = *static_cast<const SwFormatCol*>(pColItem);
- if( SfxItemState::SET == eBrushState )
- pRepr->GetBackground().reset(static_cast<SvxBrushItem*>(pBrushItem->Clone()));
- if( SfxItemState::SET == eFootnoteState )
- pRepr->GetFootnoteNtAtEnd() = *static_cast<const SwFormatFootnoteAtTextEnd*>(pFootnoteItem);
- if( SfxItemState::SET == eEndState )
- pRepr->GetEndNtAtEnd() = *static_cast<const SwFormatEndAtTextEnd*>(pEndItem);
- if( SfxItemState::SET == eBalanceState )
- pRepr->GetBalance().SetValue(static_cast<const SwFormatNoBalancedColumns*>(pBalanceItem)->GetValue());
- if( SfxItemState::SET == eFrameDirState )
- pRepr->GetFrameDir()->SetValue(static_cast<const SvxFrameDirectionItem*>(pFrameDirItem)->GetValue());
- if( SfxItemState::SET == eLRState )
- pRepr->GetLRSpace().reset(static_cast<SvxLRSpaceItem*>(pLRSpaceItem->Clone()));
- return false;
- });
- }
- }
- }
+ if (RET_OK != aTabDlg.run())
+ return;
+
+ const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
+ if( !(pOutSet && pOutSet->Count()) )
+ return;
+
+ const SfxPoolItem *pColItem, *pBrushItem,
+ *pFootnoteItem, *pEndItem, *pBalanceItem,
+ *pFrameDirItem, *pLRSpaceItem;
+ SfxItemState eColState = pOutSet->GetItemState(
+ RES_COL, false, &pColItem );
+ SfxItemState eBrushState = pOutSet->GetItemState(
+ RES_BACKGROUND, false, &pBrushItem );
+ SfxItemState eFootnoteState = pOutSet->GetItemState(
+ RES_FTN_AT_TXTEND, false, &pFootnoteItem );
+ SfxItemState eEndState = pOutSet->GetItemState(
+ RES_END_AT_TXTEND, false, &pEndItem );
+ SfxItemState eBalanceState = pOutSet->GetItemState(
+ RES_COLUMNBALANCE, false, &pBalanceItem );
+ SfxItemState eFrameDirState = pOutSet->GetItemState(
+ RES_FRAMEDIR, false, &pFrameDirItem );
+ SfxItemState eLRState = pOutSet->GetItemState(
+ RES_LR_SPACE, false, &pLRSpaceItem);
+
+ if( !(SfxItemState::SET == eColState ||
+ SfxItemState::SET == eBrushState ||
+ SfxItemState::SET == eFootnoteState ||
+ SfxItemState::SET == eEndState ||
+ SfxItemState::SET == eBalanceState||
+ SfxItemState::SET == eFrameDirState||
+ SfxItemState::SET == eLRState))
+ return;
+
+ m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
+ SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+ if( SfxItemState::SET == eColState )
+ pRepr->GetCol() = *static_cast<const SwFormatCol*>(pColItem);
+ if( SfxItemState::SET == eBrushState )
+ pRepr->GetBackground().reset(static_cast<SvxBrushItem*>(pBrushItem->Clone()));
+ if( SfxItemState::SET == eFootnoteState )
+ pRepr->GetFootnoteNtAtEnd() = *static_cast<const SwFormatFootnoteAtTextEnd*>(pFootnoteItem);
+ if( SfxItemState::SET == eEndState )
+ pRepr->GetEndNtAtEnd() = *static_cast<const SwFormatEndAtTextEnd*>(pEndItem);
+ if( SfxItemState::SET == eBalanceState )
+ pRepr->GetBalance().SetValue(static_cast<const SwFormatNoBalancedColumns*>(pBalanceItem)->GetValue());
+ if( SfxItemState::SET == eFrameDirState )
+ pRepr->GetFrameDir()->SetValue(static_cast<const SvxFrameDirectionItem*>(pFrameDirItem)->GetValue());
+ if( SfxItemState::SET == eLRState )
+ pRepr->GetLRSpace().reset(static_cast<SvxLRSpaceItem*>(pLRSpaceItem->Clone()));
+ return false;
+ });
}
IMPL_LINK(SwEditRegionDlg, FileNameComboBoxHdl, weld::ComboBox&, rEdit, void)
@@ -1134,46 +1134,46 @@ IMPL_LINK(SwEditRegionDlg, DDEHdl, weld::ToggleButton&, rButton, void)
if (!CheckPasswd(&rButton))
return;
SectRepr* pSectRepr = reinterpret_cast<SectRepr*>(m_xTree->get_selected_id().toInt64());
- if (pSectRepr)
+ if (!pSectRepr)
+ return;
+
+ bool bFile = m_xFileCB->get_active();
+ SwSectionData & rData( pSectRepr->GetSectionData() );
+ bool bDDE = rButton.get_active();
+ if(bDDE)
{
- bool bFile = m_xFileCB->get_active();
- SwSectionData & rData( pSectRepr->GetSectionData() );
- bool bDDE = rButton.get_active();
- if(bDDE)
+ m_xFileNameFT->hide();
+ m_xDDECommandFT->set_sensitive(true);
+ m_xDDECommandFT->show();
+ m_xSubRegionFT->hide();
+ m_xSubRegionED->hide();
+ if (SectionType::FileLink == rData.GetType())
{
- m_xFileNameFT->hide();
- m_xDDECommandFT->set_sensitive(true);
- m_xDDECommandFT->show();
- m_xSubRegionFT->hide();
- m_xSubRegionED->hide();
- if (SectionType::FileLink == rData.GetType())
- {
- pSectRepr->SetFile(OUString());
- m_xFileNameED->set_text(OUString());
- rData.SetLinkFilePassword(OUString());
- }
- rData.SetType(SectionType::DdeLink);
+ pSectRepr->SetFile(OUString());
+ m_xFileNameED->set_text(OUString());
+ rData.SetLinkFilePassword(OUString());
}
- else
+ rData.SetType(SectionType::DdeLink);
+ }
+ else
+ {
+ m_xDDECommandFT->hide();
+ m_xFileNameFT->set_sensitive(bFile);
+ m_xFileNameFT->show();
+ m_xSubRegionED->show();
+ m_xSubRegionFT->show();
+ m_xSubRegionED->set_sensitive(bFile);
+ m_xSubRegionFT->set_sensitive(bFile);
+ m_xSubRegionED->set_sensitive(bFile);
+ if (SectionType::DdeLink == rData.GetType())
{
- m_xDDECommandFT->hide();
- m_xFileNameFT->set_sensitive(bFile);
- m_xFileNameFT->show();
- m_xSubRegionED->show();
- m_xSubRegionFT->show();
- m_xSubRegionED->set_sensitive(bFile);
- m_xSubRegionFT->set_sensitive(bFile);
- m_xSubRegionED->set_sensitive(bFile);
- if (SectionType::DdeLink == rData.GetType())
- {
- rData.SetType(SectionType::FileLink);
- pSectRepr->SetFile(OUString());
- rData.SetLinkFilePassword(OUString());
- m_xFileNameED->set_text(OUString());
- }
+ rData.SetType(SectionType::FileLink);
+ pSectRepr->SetFile(OUString());
+ rData.SetLinkFilePassword(OUString());
+ m_xFileNameED->set_text(OUString());
}
- m_xFilePB->set_sensitive(bFile && !bDDE);
}
+ m_xFilePB->set_sensitive(bFile && !bDDE);
}
void SwEditRegionDlg::ChangePasswd(bool bChange)
@@ -1301,29 +1301,29 @@ IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, v
IMPL_LINK_NOARG(SwEditRegionDlg, SubRegionEventHdl, weld::ComboBox&, void)
{
- if (!m_bSubRegionsFilled)
- {
- //if necessary fill the names bookmarks/sections/tables now
+ if (m_bSubRegionsFilled)
+ return;
- OUString sFileName = m_xFileNameED->get_text();
- if(!sFileName.isEmpty())
- {
- SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
- INetURLObject aAbs;
- if( pMedium )
- aAbs = pMedium->GetURLObject();
- sFileName = URIHelper::SmartRel2Abs(
- aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
+ //if necessary fill the names bookmarks/sections/tables now
- //load file and set the shell
- SfxMedium aMedium( sFileName, StreamMode::STD_READ );
- sFileName = aMedium.GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE );
- ::lcl_ReadSections(aMedium, *m_xSubRegionED);
- }
- else
- lcl_FillSubRegionList(rSh, *m_xSubRegionED, nullptr);
- m_bSubRegionsFilled = true;
+ OUString sFileName = m_xFileNameED->get_text();
+ if(!sFileName.isEmpty())
+ {
+ SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+ sFileName = URIHelper::SmartRel2Abs(
+ aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
+
+ //load file and set the shell
+ SfxMedium aMedium( sFileName, StreamMode::STD_READ );
+ sFileName = aMedium.GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE );
+ ::lcl_ReadSections(aMedium, *m_xSubRegionED);
}
+ else
+ lcl_FillSubRegionList(rSh, *m_xSubRegionED, nullptr);
+ m_bSubRegionsFilled = true;
}
// helper function - read section names from medium
@@ -1331,18 +1331,18 @@ static void lcl_ReadSections( SfxMedium& rMedium, weld::ComboBox& rBox )
{
rBox.clear();
uno::Reference < embed::XStorage > xStg;
- if( rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is() )
- {
- std::vector<OUString> aArr;
- SotClipboardFormatId nFormat = SotStorage::GetFormatID( xStg );
- if ( nFormat == SotClipboardFormatId::STARWRITER_60 || nFormat == SotClipboardFormatId::STARWRITERGLOB_60 ||
- nFormat == SotClipboardFormatId::STARWRITER_8 || nFormat == SotClipboardFormatId::STARWRITERGLOB_8)
- SwGetReaderXML()->GetSectionList( rMedium, aArr );
+ if( !(rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is()) )
+ return;
- for (auto const& it : aArr)
- {
- rBox.append_text(it);
- }
+ std::vector<OUString> aArr;
+ SotClipboardFormatId nFormat = SotStorage::GetFormatID( xStg );
+ if ( nFormat == SotClipboardFormatId::STARWRITER_60 || nFormat == SotClipboardFormatId::STARWRITERGLOB_60 ||
+ nFormat == SotClipboardFormatId::STARWRITER_8 || nFormat == SotClipboardFormatId::STARWRITERGLOB_8)
+ SwGetReaderXML()->GetSectionList( rMedium, aArr );
+
+ for (auto const& it : aArr)
+ {
+ rBox.append_text(it);
}
}