summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-10-21 12:31:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-10-21 14:58:51 +0200
commit29489b33b435683021b72cb2bce27aba8cb7a430 (patch)
tree8e4e1c59d56d5ed0d0ca4d088419067041e4553a /sfx2/source
parenta4244c0f05b95ded277a3a7ed217bf0451daa996 (diff)
loplugin:flatten
Change-Id: I3b4226a9d089ec9aedab95d96e50a068f57a76c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123991 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/workwin.cxx36
-rw-r--r--sfx2/source/commandpopup/CommandPopup.cxx46
-rw-r--r--sfx2/source/dialog/StyleList.cxx130
-rw-r--r--sfx2/source/doc/templatedlg.cxx68
-rw-r--r--sfx2/source/view/ipclient.cxx24
-rw-r--r--sfx2/source/view/viewfrm.cxx27
6 files changed, 165 insertions, 166 deletions
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index fadeeca7339a..4e44acf04908 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -2160,24 +2160,24 @@ void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl *pCW)
return;
pFact = pMod->GetChildWinFactoryById(pCW->nSaveId);
- if ( pFact )
- {
- pCW->aInfo = pFact->aInfo;
- pCW->aInfo.aModule = sModule;
- SfxChildWindow::InitializeChildWinFactory_Impl(
- pCW->nSaveId, pCW->aInfo);
- pCW->bCreate = pCW->aInfo.bVisible;
- SfxChildWindowFlags nFlags = pFact->aInfo.nFlags;
- if ( nFlags & SfxChildWindowFlags::TASK )
- pCW->aInfo.nFlags |= SfxChildWindowFlags::TASK;
- if ( nFlags & SfxChildWindowFlags::CANTGETFOCUS )
- pCW->aInfo.nFlags |= SfxChildWindowFlags::CANTGETFOCUS;
- if ( nFlags & SfxChildWindowFlags::FORCEDOCK )
- pCW->aInfo.nFlags |= SfxChildWindowFlags::FORCEDOCK;
- if ( nFlags & SfxChildWindowFlags::ALWAYSAVAILABLE )
- pCW->aInfo.nFlags |= SfxChildWindowFlags::ALWAYSAVAILABLE;
- pFact->aInfo = pCW->aInfo;
- }
+ if ( !pFact )
+ return;
+
+ pCW->aInfo = pFact->aInfo;
+ pCW->aInfo.aModule = sModule;
+ SfxChildWindow::InitializeChildWinFactory_Impl(
+ pCW->nSaveId, pCW->aInfo);
+ pCW->bCreate = pCW->aInfo.bVisible;
+ SfxChildWindowFlags nFlags = pFact->aInfo.nFlags;
+ if ( nFlags & SfxChildWindowFlags::TASK )
+ pCW->aInfo.nFlags |= SfxChildWindowFlags::TASK;
+ if ( nFlags & SfxChildWindowFlags::CANTGETFOCUS )
+ pCW->aInfo.nFlags |= SfxChildWindowFlags::CANTGETFOCUS;
+ if ( nFlags & SfxChildWindowFlags::FORCEDOCK )
+ pCW->aInfo.nFlags |= SfxChildWindowFlags::FORCEDOCK;
+ if ( nFlags & SfxChildWindowFlags::ALWAYSAVAILABLE )
+ pCW->aInfo.nFlags |= SfxChildWindowFlags::ALWAYSAVAILABLE;
+ pFact->aInfo = pCW->aInfo;
}
SfxSplitWindow* SfxWorkWindow::GetSplitWindow_Impl( SfxChildAlignment eAlign )
diff --git a/sfx2/source/commandpopup/CommandPopup.cxx b/sfx2/source/commandpopup/CommandPopup.cxx
index b13d474b975b..473155f89a00 100644
--- a/sfx2/source/commandpopup/CommandPopup.cxx
+++ b/sfx2/source/commandpopup/CommandPopup.cxx
@@ -152,31 +152,29 @@ void MenuContentHandler::addCommandIfPossible(
util::URL aCommandURL;
aCommandURL.Complete = sCommandURL;
- if (m_xURLTransformer->parseStrict(aCommandURL))
- {
- auto* pViewFrame = SfxViewFrame::Current();
+ if (!m_xURLTransformer->parseStrict(aCommandURL))
+ return;
- SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame);
- const SfxSlot* pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path);
- if (pSlot)
- {
- std::unique_ptr<SfxPoolItem> pState;
- SfxItemState eState = pViewFrame->GetBindings().QueryState(pSlot->GetSlotId(), pState);
-
- if (eState != SfxItemState::DISABLED)
- {
- auto xGraphic
- = vcl::CommandInfoProvider::GetXGraphicForCommand(sCommandURL, m_xFrame);
- rCommandList.emplace_back(sCommandURL, rMenuContent.m_aTooltip);
-
- auto pIter = rpCommandTreeView->make_iterator();
- rpCommandTreeView->insert(nullptr, -1, &rMenuContent.m_aFullLabelWithPath, nullptr,
- nullptr, nullptr, false, pIter.get());
- rpCommandTreeView->set_image(*pIter, xGraphic);
- m_aAdded.insert(rMenuContent.m_aFullLabelWithPath);
- }
- }
- }
+ auto* pViewFrame = SfxViewFrame::Current();
+
+ SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame);
+ const SfxSlot* pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path);
+ if (!pSlot)
+ return;
+
+ std::unique_ptr<SfxPoolItem> pState;
+ SfxItemState eState = pViewFrame->GetBindings().QueryState(pSlot->GetSlotId(), pState);
+ if (eState == SfxItemState::DISABLED)
+ return;
+
+ auto xGraphic = vcl::CommandInfoProvider::GetXGraphicForCommand(sCommandURL, m_xFrame);
+ rCommandList.emplace_back(sCommandURL, rMenuContent.m_aTooltip);
+
+ auto pIter = rpCommandTreeView->make_iterator();
+ rpCommandTreeView->insert(nullptr, -1, &rMenuContent.m_aFullLabelWithPath, nullptr, nullptr,
+ nullptr, false, pIter.get());
+ rpCommandTreeView->set_image(*pIter, xGraphic);
+ m_aAdded.insert(rMenuContent.m_aFullLabelWithPath);
}
OUString MenuContentHandler::toLower(OUString const& rString)
diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx
index 5d2b778ada92..691780df0863 100644
--- a/sfx2/source/dialog/StyleList.cxx
+++ b/sfx2/source/dialog/StyleList.cxx
@@ -530,28 +530,28 @@ IMPL_LINK(StyleList, ExecuteDrop, const ExecuteDropEvent&, rEvt, sal_Int8)
IMPL_LINK_NOARG(StyleList, NewMenuExecuteAction, void*, void)
{
- if (m_pStyleSheetPool && m_nActFamily != 0xffff)
- {
- const SfxStyleFamily eFam = GetFamilyItem()->GetFamily();
- const SfxStyleFamilyItem* pItem = GetFamilyItem();
- SfxStyleSearchBits nFilter(SfxStyleSearchBits::Auto);
- if (pItem && m_nActFilter != 0xffff)
- nFilter = pItem->GetFilterList()[m_nActFilter].nFlags;
- if (nFilter == SfxStyleSearchBits::Auto) // automatic
- nFilter = m_nAppFilter;
+ if (!m_pStyleSheetPool || m_nActFamily == 0xffff)
+ return;
- // why? : FloatingWindow must not be parent of a modal dialog
- SfxNewStyleDlg aDlg(m_pContainer, *m_pStyleSheetPool, eFam);
- auto nResult = aDlg.run();
- if (nResult == RET_OK)
- {
- const OUString aTemplName(aDlg.GetName());
- m_pParentDialog->Execute_Impl(SID_STYLE_NEW_BY_EXAMPLE, aTemplName, "",
- static_cast<sal_uInt16>(GetFamilyItem()->GetFamily()),
- *this, nFilter);
- UpdateFamily();
- m_aUpdateFamily.Call(*this);
- }
+ const SfxStyleFamily eFam = GetFamilyItem()->GetFamily();
+ const SfxStyleFamilyItem* pItem = GetFamilyItem();
+ SfxStyleSearchBits nFilter(SfxStyleSearchBits::Auto);
+ if (pItem && m_nActFilter != 0xffff)
+ nFilter = pItem->GetFilterList()[m_nActFilter].nFlags;
+ if (nFilter == SfxStyleSearchBits::Auto) // automatic
+ nFilter = m_nAppFilter;
+
+ // why? : FloatingWindow must not be parent of a modal dialog
+ SfxNewStyleDlg aDlg(m_pContainer, *m_pStyleSheetPool, eFam);
+ auto nResult = aDlg.run();
+ if (nResult == RET_OK)
+ {
+ const OUString aTemplName(aDlg.GetName());
+ m_pParentDialog->Execute_Impl(SID_STYLE_NEW_BY_EXAMPLE, aTemplName, "",
+ static_cast<sal_uInt16>(GetFamilyItem()->GetFamily()), *this,
+ nFilter);
+ UpdateFamily();
+ m_aUpdateFamily.Call(*this);
}
}
@@ -838,66 +838,66 @@ void StyleList::SelectStyle(const OUString& rStr, bool bIsCallback)
m_pParentDialog->EnableShow(false, this);
}
- if (!bIsCallback)
+ if (bIsCallback)
+ return;
+
+ if (m_xTreeBox->get_visible())
{
- if (m_xTreeBox->get_visible())
+ if (!rStr.isEmpty())
{
- if (!rStr.isEmpty())
- {
- std::unique_ptr<weld::TreeIter> xEntry = m_xTreeBox->make_iterator();
- bool bEntry = m_xTreeBox->get_iter_first(*xEntry);
- while (bEntry)
- {
- if (m_xTreeBox->get_text(*xEntry) == rStr)
- {
- m_xTreeBox->scroll_to_row(*xEntry);
- m_xTreeBox->select(*xEntry);
- break;
- }
- bEntry = m_xTreeBox->iter_next(*xEntry);
- }
- }
- else if (eFam == SfxStyleFamily::Pseudo)
+ std::unique_ptr<weld::TreeIter> xEntry = m_xTreeBox->make_iterator();
+ bool bEntry = m_xTreeBox->get_iter_first(*xEntry);
+ while (bEntry)
{
- std::unique_ptr<weld::TreeIter> xEntry = m_xTreeBox->make_iterator();
- if (m_xTreeBox->get_iter_first(*xEntry))
+ if (m_xTreeBox->get_text(*xEntry) == rStr)
{
m_xTreeBox->scroll_to_row(*xEntry);
m_xTreeBox->select(*xEntry);
+ break;
}
+ bEntry = m_xTreeBox->iter_next(*xEntry);
+ }
+ }
+ else if (eFam == SfxStyleFamily::Pseudo)
+ {
+ std::unique_ptr<weld::TreeIter> xEntry = m_xTreeBox->make_iterator();
+ if (m_xTreeBox->get_iter_first(*xEntry))
+ {
+ m_xTreeBox->scroll_to_row(*xEntry);
+ m_xTreeBox->select(*xEntry);
}
- else
- m_xTreeBox->unselect_all();
}
else
+ m_xTreeBox->unselect_all();
+ }
+ else
+ {
+ bool bSelect = !rStr.isEmpty();
+ if (bSelect)
{
- bool bSelect = !rStr.isEmpty();
- if (bSelect)
+ std::unique_ptr<weld::TreeIter> xEntry = m_xFmtLb->make_iterator();
+ bool bEntry = m_xFmtLb->get_iter_first(*xEntry);
+ while (bEntry && m_xFmtLb->get_text(*xEntry) != rStr)
+ bEntry = m_xFmtLb->iter_next(*xEntry);
+ if (!bEntry)
+ bSelect = false;
+ else
{
- std::unique_ptr<weld::TreeIter> xEntry = m_xFmtLb->make_iterator();
- bool bEntry = m_xFmtLb->get_iter_first(*xEntry);
- while (bEntry && m_xFmtLb->get_text(*xEntry) != rStr)
- bEntry = m_xFmtLb->iter_next(*xEntry);
- if (!bEntry)
- bSelect = false;
- else
+ if (!m_xFmtLb->is_selected(*xEntry))
{
- if (!m_xFmtLb->is_selected(*xEntry))
- {
- m_xFmtLb->unselect_all();
- m_xFmtLb->scroll_to_row(*xEntry);
- m_xFmtLb->select(*xEntry);
- }
+ m_xFmtLb->unselect_all();
+ m_xFmtLb->scroll_to_row(*xEntry);
+ m_xFmtLb->select(*xEntry);
}
}
+ }
- if (!bSelect)
- {
- m_xFmtLb->unselect_all();
- m_pParentDialog->EnableEdit(false, this);
- m_pParentDialog->EnableHide(false, this);
- m_pParentDialog->EnableShow(false, this);
- }
+ if (!bSelect)
+ {
+ m_xFmtLb->unselect_all();
+ m_pParentDialog->EnableEdit(false, this);
+ m_pParentDialog->EnableHide(false, this);
+ m_pParentDialog->EnableShow(false, this);
}
}
}
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 6efb8d87f2e6..dcfd3e53753a 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -578,30 +578,30 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, MoveTemplateHdl, void*, void)
size_t nItemId = 0;
- if (aDlg.run() == RET_OK)
- {
- const OUString& sCategory = aDlg.GetSelectedCategory();
- bool bIsNewCategory = aDlg.IsNewCategoryCreated();
- if(bIsNewCategory)
- {
- if (!sCategory.isEmpty())
- {
- nItemId = mxLocalView->createRegion(sCategory);
- if(nItemId)
- mxCBFolder->append_text(sCategory);
- }
- }
- else
- nItemId = mxLocalView->getRegionId(sCategory);
+ if (aDlg.run() != RET_OK)
+ return;
- if(nItemId)
+ const OUString& sCategory = aDlg.GetSelectedCategory();
+ bool bIsNewCategory = aDlg.IsNewCategoryCreated();
+ if(bIsNewCategory)
+ {
+ if (!sCategory.isEmpty())
{
- localMoveTo(nItemId);
+ nItemId = mxLocalView->createRegion(sCategory);
+ if(nItemId)
+ mxCBFolder->append_text(sCategory);
}
+ }
+ else
+ nItemId = mxLocalView->getRegionId(sCategory);
- mxLocalView->reload();
- SearchUpdate();
+ if(nItemId)
+ {
+ localMoveTo(nItemId);
}
+
+ mxLocalView->reload();
+ SearchUpdate();
}
IMPL_LINK_NOARG(SfxTemplateManagerDlg, ExportTemplateHdl, void*, void)
{
@@ -689,21 +689,21 @@ IMPL_LINK(SfxTemplateManagerDlg, CreateContextMenuHdl, ThumbnailViewItem*, pItem
}
}
- if (pViewItem)
- {
- bool bIsSingleSel = maSelTemplates.size() == 1;
- OUString aDefaultImg;
- INetURLObject aUrl(pViewItem->getPath());
- if (ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION::WRITER, aUrl.getExtension()))
- aDefaultImg = BMP_ACTION_DEFAULT_WRITER;
- else if (ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION::CALC, aUrl.getExtension()))
- aDefaultImg = BMP_ACTION_DEFAULT_CALC;
- else if (ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION::IMPRESS, aUrl.getExtension()))
- aDefaultImg = BMP_ACTION_DEFAULT_IMPRESS;
- else if (ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION::DRAW, aUrl.getExtension()))
- aDefaultImg = BMP_ACTION_DEFAULT_DRAW;
- mxLocalView->createContextMenu(bIsDefault, bIsInternal, bIsSingleSel, aDefaultImg);
- }
+ if (!pViewItem)
+ return;
+
+ bool bIsSingleSel = maSelTemplates.size() == 1;
+ OUString aDefaultImg;
+ INetURLObject aUrl(pViewItem->getPath());
+ if (ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION::WRITER, aUrl.getExtension()))
+ aDefaultImg = BMP_ACTION_DEFAULT_WRITER;
+ else if (ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION::CALC, aUrl.getExtension()))
+ aDefaultImg = BMP_ACTION_DEFAULT_CALC;
+ else if (ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION::IMPRESS, aUrl.getExtension()))
+ aDefaultImg = BMP_ACTION_DEFAULT_IMPRESS;
+ else if (ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION::DRAW, aUrl.getExtension()))
+ aDefaultImg = BMP_ACTION_DEFAULT_DRAW;
+ mxLocalView->createContextMenu(bIsDefault, bIsInternal, bIsSingleSel, aDefaultImg);
}
IMPL_LINK(SfxTemplateManagerDlg, OpenTemplateHdl, ThumbnailViewItem*, pItem, void)
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index 3b87e2be21bd..82b811bb94f5 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -333,21 +333,21 @@ void SAL_CALL SfxInPlaceClient_Impl::activatingInplace()
if ( !m_pClient || !m_pClient->GetViewShell() )
throw uno::RuntimeException();
- if ( comphelper::LibreOfficeKit::isActive() )
- {
- if ( SfxViewShell* pViewShell = m_pClient->GetViewShell() )
- {
- tools::Rectangle aRect(m_pClient->GetObjArea());
+ if ( !comphelper::LibreOfficeKit::isActive() )
+ return;
- if (m_pClient->GetEditWin())
- {
- if (m_pClient->GetEditWin()->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aRect = o3tl::convert(aRect, o3tl::Length::mm100, o3tl::Length::twip);
- }
+ if ( SfxViewShell* pViewShell = m_pClient->GetViewShell() )
+ {
+ tools::Rectangle aRect(m_pClient->GetObjArea());
- OString str = aRect.toString() + ", \"INPLACE\"";
- pViewShell->libreOfficeKitViewCallback( LOK_CALLBACK_GRAPHIC_SELECTION, str.getStr() );
+ if (m_pClient->GetEditWin())
+ {
+ if (m_pClient->GetEditWin()->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
+ aRect = o3tl::convert(aRect, o3tl::Length::mm100, o3tl::Length::twip);
}
+
+ OString str = aRect.toString() + ", \"INPLACE\"";
+ pViewShell->libreOfficeKitViewCallback( LOK_CALLBACK_GRAPHIC_SELECTION, str.getStr() );
}
}
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 4ba5bc852834..b4924dc4474c 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1662,20 +1662,21 @@ IMPL_LINK(SfxViewFrame, HiddenTrackChangesHandler, weld::Button&, rButton, void)
{
// enable Track Changes toolbar, if it is disabled.
// Otherwise disable the toolbar, and close the infobar
- if (auto xLayoutManager = getLayoutManager(GetFrame()))
+ auto xLayoutManager = getLayoutManager(GetFrame());
+ if (!xLayoutManager)
+ return;
+
+ if (!xLayoutManager->getElement(CHANGES_STR).is())
{
- if (!xLayoutManager->getElement(CHANGES_STR).is())
- {
- xLayoutManager->createElement(CHANGES_STR);
- xLayoutManager->showElement(CHANGES_STR);
- rButton.set_label(SfxResId(STR_TRACK_CHANGES_BUTTON_HIDE));
- }
- else
- {
- xLayoutManager->hideElement(CHANGES_STR);
- xLayoutManager->destroyElement(CHANGES_STR);
- RemoveInfoBar(u"hiddentrackchanges");
- }
+ xLayoutManager->createElement(CHANGES_STR);
+ xLayoutManager->showElement(CHANGES_STR);
+ rButton.set_label(SfxResId(STR_TRACK_CHANGES_BUTTON_HIDE));
+ }
+ else
+ {
+ xLayoutManager->hideElement(CHANGES_STR);
+ xLayoutManager->destroyElement(CHANGES_STR);
+ RemoveInfoBar(u"hiddentrackchanges");
}
}