From b624b13b3d5a8e573c7de8158cadc66b1982d157 Mon Sep 17 00:00:00 2001 From: Noel Date: Fri, 26 Mar 2021 13:35:54 +0200 Subject: loplugin:flatten Change-Id: Ib7a895fba66f8dc9b6501e61631c02694053b7fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113157 Tested-by: Jenkins Reviewed-by: Noel Grandin --- UnoControls/source/base/multiplexer.cxx | 43 +++-- basic/source/uno/namecont.cxx | 31 ++-- comphelper/source/property/propertysethelper.cxx | 17 +- cui/source/options/treeopt.cxx | 28 ++-- cui/source/tabpages/tpbitmap.cxx | 24 +-- dbaccess/source/ui/app/AppDetailPageHelper.cxx | 20 +-- emfio/source/reader/mtftools.cxx | 150 +++++++++--------- extensions/source/bibliography/general.cxx | 30 ++-- .../source/uielement/resourcemenucontroller.cxx | 61 ++++--- lotuswordpro/source/filter/lwpfribsection.cxx | 22 +-- .../drawingml/diagram/diagramlayoutatoms.cxx | 18 +-- oox/source/export/chartexport.cxx | 176 ++++++++++----------- sc/source/filter/oox/autofilterbuffer.cxx | 90 +++++------ sc/source/filter/oox/querytablebuffer.cxx | 5 +- sc/source/ui/app/inputwin.cxx | 92 +++++------ sc/source/ui/cctrl/checklistmenu.cxx | 21 +-- sc/source/ui/dbgui/tpsubt.cxx | 22 +-- sc/source/ui/drawfunc/drawsh2.cxx | 124 +++++++-------- sc/source/ui/drawfunc/futext.cxx | 30 ++-- sd/source/ui/annotations/annotationtag.cxx | 60 +++---- sd/source/ui/app/scalectrl.cxx | 40 ++--- sd/source/ui/app/sdpopup.cxx | 24 +-- sdext/source/presenter/PresenterAccessibility.cxx | 21 ++- sfx2/source/control/recentdocsview.cxx | 52 +++--- .../source/devtools/ObjectInspectorTreeHandler.cxx | 64 ++++---- sfx2/source/doc/objserv.cxx | 28 ++-- sfx2/source/sidebar/DeckLayouter.cxx | 30 ++-- sfx2/source/sidebar/Sidebar.cxx | 31 ++-- slideshow/source/engine/animationfactory.cxx | 56 +++---- starmath/source/mathml/mathmlimport.cxx | 32 ++-- svtools/source/misc/sampletext.cxx | 12 +- svx/source/items/numfmtsh.cxx | 26 +-- svx/source/svdraw/svdobj.cxx | 30 ++-- svx/source/svdraw/svdoole2.cxx | 40 ++--- sw/source/core/access/AccessibilityCheck.cxx | 29 ++-- sw/source/core/doc/textboxhelper.cxx | 22 +-- sw/source/core/docnode/ndsect.cxx | 26 +-- sw/source/core/edit/ednumber.cxx | 28 ++-- sw/source/core/layout/fly.cxx | 26 +-- sw/source/core/layout/objectformattertxtfrm.cxx | 22 +-- sw/source/core/layout/pagechg.cxx | 26 +-- sw/source/core/layout/sectfrm.cxx | 26 +-- sw/source/core/layout/tabfrm.cxx | 26 +-- sw/source/core/layout/wsfrm.cxx | 26 +-- sw/source/core/text/porrst.cxx | 50 +++--- sw/source/filter/ww8/docxattributeoutput.cxx | 22 +-- sw/source/ui/dbui/dbtablepreviewdialog.cxx | 24 +-- sw/source/ui/table/instable.cxx | 26 +-- sw/source/uibase/app/appopt.cxx | 32 ++-- sw/source/uibase/docvw/SidebarTxtControl.cxx | 28 ++-- sw/source/uibase/ribbar/workctrl.cxx | 28 ++-- sw/source/uibase/utlui/content.cxx | 106 ++++++------- unoidl/source/legacyprovider.cxx | 25 +-- unoidl/source/unoidl-write.cxx | 45 +++--- 54 files changed, 1098 insertions(+), 1095 deletions(-) diff --git a/UnoControls/source/base/multiplexer.cxx b/UnoControls/source/base/multiplexer.cxx index 2e0f48dd75fb..a8322d845c43 100644 --- a/UnoControls/source/base/multiplexer.cxx +++ b/UnoControls/source/base/multiplexer.cxx @@ -40,29 +40,26 @@ namespace unocontrols { /* First get all interfaces from container with right type.*/ \ OInterfaceContainerHelper* pContainer = m_aListenerHolder.getContainer( cppu::UnoType::get() ); \ /* Do the follow only, if elements in container exist.*/ \ - if( pContainer != nullptr ) \ - { \ - OInterfaceIteratorHelper aIterator( *pContainer ); \ - EVENTTYP aLocalEvent = EVENT; \ - /* Remark: The control is the event source not the peer.*/ \ - /* We must change the source of the event. */ \ - aLocalEvent.Source = m_xControl; \ - /* Is the control not destroyed? */ \ - if( aLocalEvent.Source.is() ) \ - { \ - if( aIterator.hasMoreElements() ) \ - { \ - INTERFACE * pListener = static_cast(aIterator.next()); \ - try \ - { \ - pListener->METHOD( aLocalEvent ); \ - } \ - catch(const RuntimeException& ) \ - { \ - /* Ignore all system exceptions from the listener! */ \ - } \ - } \ - } \ + if( !pContainer ) \ + return; \ + OInterfaceIteratorHelper aIterator( *pContainer ); \ + EVENTTYP aLocalEvent = EVENT; \ + /* Remark: The control is the event source not the peer.*/ \ + /* We must change the source of the event. */ \ + aLocalEvent.Source = m_xControl; \ + /* Is the control not destroyed? */ \ + if( !aLocalEvent.Source ) \ + return; \ + if( !aIterator.hasMoreElements() ) \ + return; \ + INTERFACE * pListener = static_cast(aIterator.next()); \ + try \ + { \ + pListener->METHOD( aLocalEvent ); \ + } \ + catch(const RuntimeException& ) \ + { \ + /* Ignore all system exceptions from the listener! */ \ } // construct/destruct diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index d42b701a5405..25be6ca465af 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -2616,25 +2616,24 @@ void SAL_CALL SfxLibraryContainer::initialize( const Sequence< Any >& _rArgument { LibraryContainerMethodGuard aGuard( *this ); sal_Int32 nArgCount = _rArguments.getLength(); - if ( nArgCount == 1 ) + if ( nArgCount != 1 ) + throw IllegalArgumentException("too many args", static_cast(this), -1); + + OUString sInitialDocumentURL; + Reference< XStorageBasedDocument > xDocument; + if ( _rArguments[0] >>= sInitialDocumentURL ) { - OUString sInitialDocumentURL; - Reference< XStorageBasedDocument > xDocument; - if ( _rArguments[0] >>= sInitialDocumentURL ) - { - init( sInitialDocumentURL, nullptr ); - return; - } + init( sInitialDocumentURL, nullptr ); + return; + } - if ( _rArguments[0] >>= xDocument ) - { - initializeFromDocument( xDocument ); - return; - } - throw IllegalArgumentException("arg1 unknown type", static_cast(this), 1); + if ( _rArguments[0] >>= xDocument ) + { + initializeFromDocument( xDocument ); + return; } - else - throw IllegalArgumentException("too many args", static_cast(this), -1); + throw IllegalArgumentException("arg1 unknown type", static_cast(this), 1); + } void SfxLibraryContainer::initializeFromDocument( const Reference< XStorageBasedDocument >& _rxDocument ) diff --git a/comphelper/source/property/propertysethelper.cxx b/comphelper/source/property/propertysethelper.cxx index 2c319cd042f2..a8a6e6a964d5 100644 --- a/comphelper/source/property/propertysethelper.cxx +++ b/comphelper/source/property/propertysethelper.cxx @@ -153,16 +153,15 @@ Sequence< Any > SAL_CALL PropertySetHelper::getPropertyValues(const Sequence< OU bUnknown = nullptr == pEntries[n]; } - if( !bUnknown ) - { - pEntries[nCount] = nullptr; - Sequence< Any > aValues(nCount); - aValues.realloc(nCount); - _getPropertyValues( pEntries.get(), aValues.getArray() ); - return aValues; - } - else + if( bUnknown ) throw RuntimeException( *pNames, static_cast< XPropertySet* >( this ) ); + + pEntries[nCount] = nullptr; + Sequence< Any > aValues(nCount); + aValues.realloc(nCount); + _getPropertyValues( pEntries.get(), aValues.getArray() ); + return aValues; + } void SAL_CALL PropertySetHelper::addPropertiesChangeListener( const Sequence< OUString >&, const Reference< XPropertiesChangeListener >& ) diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index e254153ad4cc..e7bf078bcae4 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -746,22 +746,22 @@ IMPL_LINK(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button&, rButton, void) SelectHdl_Impl(); } - if (bNeedsRestart) + if (!bNeedsRestart) + return; + + SolarMutexGuard aGuard; + weld::Window* pParent; + if (!bOkPressed) + pParent = m_xDialog.get(); + else { - SolarMutexGuard aGuard; - weld::Window* pParent; - if (!bOkPressed) - pParent = m_xDialog.get(); - else - { - m_xDialog->hide(); - pParent = m_pParent; - } - bool bRestart = ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(), - pParent, eRestartReason); - if (bRestart && !bOkPressed) - m_xDialog->response(RET_OK); + m_xDialog->hide(); + pParent = m_pParent; } + bool bRestart = ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(), + pParent, eRestartReason); + if (bRestart && !bOkPressed) + m_xDialog->response(RET_OK); } void OfaTreeOptionsDialog::ApplyItemSets() diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 647bcaa105e3..f0a239775d13 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -563,21 +563,21 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickDeleteHdl, SvxPresetListBox*, void) std::unique_ptr xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletebitmapdialog.ui")); std::unique_ptr xQueryBox(xBuilder->weld_message_dialog("AskDelBitmapDialog")); - if (xQueryBox->run() == RET_YES) - { - sal_uInt16 nNextId = m_xBitmapLB->GetItemId(nPos + 1); - if (!nNextId) - nNextId = m_xBitmapLB->GetItemId(nPos - 1); + if (xQueryBox->run() != RET_YES) + return; - m_pBitmapList->Remove( static_cast(nPos) ); - m_xBitmapLB->RemoveItem( nId ); + sal_uInt16 nNextId = m_xBitmapLB->GetItemId(nPos + 1); + if (!nNextId) + nNextId = m_xBitmapLB->GetItemId(nPos - 1); - m_xBitmapLB->SelectItem(nNextId); + m_pBitmapList->Remove( static_cast(nPos) ); + m_xBitmapLB->RemoveItem( nId ); - m_aCtlBitmapPreview.Invalidate(); - ModifyBitmapHdl(m_xBitmapLB.get()); - *m_pnBitmapListState |= ChangeType::MODIFIED; - } + m_xBitmapLB->SelectItem(nNextId); + + m_aCtlBitmapPreview.Invalidate(); + ModifyBitmapHdl(m_xBitmapLB.get()); + *m_pnBitmapListState |= ChangeType::MODIFIED; } IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapSizeHdl, weld::MetricSpinButton&, void ) diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 4d6b88f79738..1ab3c0ad29bf 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -580,19 +580,19 @@ void OAppDetailPageHelper::createPage(ElementType _eType,const Reference< XNameA m_aLists[_eType] = createSimpleTree(sHelpId, _eType); } - if ( m_aLists[_eType] ) + if ( !m_aLists[_eType] ) + return; + + weld::TreeView& rTreeView = m_aLists[_eType]->GetWidget(); + if (!rTreeView.n_children() && _xContainer.is()) { - weld::TreeView& rTreeView = m_aLists[_eType]->GetWidget(); - if (!rTreeView.n_children() && _xContainer.is()) - { - rTreeView.make_unsorted(); - fillNames( _xContainer, _eType, sImageId, nullptr ); - rTreeView.make_sorted(); + rTreeView.make_unsorted(); + fillNames( _xContainer, _eType, sImageId, nullptr ); + rTreeView.make_sorted(); - rTreeView.unselect_all(); - } - setDetailPage(*m_aLists[_eType]); + rTreeView.unselect_all(); } + setDetailPage(*m_aLists[_eType]); } void OAppDetailPageHelper::setDetailPage(DBTreeViewBase& rTreeView) diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index 5a2f5d1ca806..3edf76e74357 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -356,97 +356,97 @@ namespace emfio maCurrentMetaFontAction.clear(); maAlternativeFontScales.clear(); - if(rNewMetaFontAction.is()) + if(!rNewMetaFontAction.is()) + return; + + // check 1st criteria for FontScale active. We usually write this, + // so this will already sort out most situations + const vcl::Font& rCandidate(rNewMetaFontAction->GetFont()); + + if(0 != rCandidate.GetAverageFontWidth()) { - // check 1st criteria for FontScale active. We usually write this, - // so this will already sort out most situations - const vcl::Font& rCandidate(rNewMetaFontAction->GetFont()); + const tools::Long nUnscaledAverageFontWidth(rCandidate.GetOrCalculateAverageFontWidth()); - if(0 != rCandidate.GetAverageFontWidth()) + // check 2nd (system-dependent) criteria for FontScale + if(nUnscaledAverageFontWidth != rCandidate.GetFontHeight()) { - const tools::Long nUnscaledAverageFontWidth(rCandidate.GetOrCalculateAverageFontWidth()); - - // check 2nd (system-dependent) criteria for FontScale - if(nUnscaledAverageFontWidth != rCandidate.GetFontHeight()) - { - // FontScale is active, remember and use as current - maCurrentMetaFontAction = rNewMetaFontAction; - } + // FontScale is active, remember and use as current + maCurrentMetaFontAction = rNewMetaFontAction; } } } void ScaledFontDetectCorrectHelper::evaluateAlternativeFontScale(OUString const & rText, tools::Long nImportedTextLength) { - if(maCurrentMetaFontAction.is()) - { - SolarMutexGuard aGuard; // VirtualDevice is not thread-safe - ScopedVclPtrInstance< VirtualDevice > pTempVirtualDevice; + if(!maCurrentMetaFontAction.is()) + return; - // calculate measured TextLength - const vcl::Font& rFontCandidate(maCurrentMetaFontAction->GetFont()); - pTempVirtualDevice->SetFont(rFontCandidate); - tools::Long nMeasuredTextLength(pTempVirtualDevice->GetTextWidth(rText)); - // on failure, use original length - if (!nMeasuredTextLength) - nMeasuredTextLength = nImportedTextLength; + SolarMutexGuard aGuard; // VirtualDevice is not thread-safe + ScopedVclPtrInstance< VirtualDevice > pTempVirtualDevice; - // compare expected and imported TextLengths - if (nImportedTextLength != nMeasuredTextLength) - { - const double fFactorText(static_cast(nImportedTextLength) / static_cast(nMeasuredTextLength)); - const double fFactorTextPercent(fabs(1.0 - fFactorText) * 100.0); + // calculate measured TextLength + const vcl::Font& rFontCandidate(maCurrentMetaFontAction->GetFont()); + pTempVirtualDevice->SetFont(rFontCandidate); + tools::Long nMeasuredTextLength(pTempVirtualDevice->GetTextWidth(rText)); + // on failure, use original length + if (!nMeasuredTextLength) + nMeasuredTextLength = nImportedTextLength; + + // compare expected and imported TextLengths + if (nImportedTextLength != nMeasuredTextLength) + { + const double fFactorText(static_cast(nImportedTextLength) / static_cast(nMeasuredTextLength)); + const double fFactorTextPercent(fabs(1.0 - fFactorText) * 100.0); - // if we assume that loaded file was written on old linux, we have to - // back-convert the scale value depending on which system we run + // if we assume that loaded file was written on old linux, we have to + // back-convert the scale value depending on which system we run #ifdef _WIN32 - // When running on Windows the value was not adapted at font import (see WinMtfFontStyle - // constructor), so it is still NormedFontScaling and we need to convert to Windows-style - // scaling + // When running on Windows the value was not adapted at font import (see WinMtfFontStyle + // constructor), so it is still NormedFontScaling and we need to convert to Windows-style + // scaling #else - // When running on unx (non-Windows) the value was already adapted at font import (see WinMtfFontStyle - // constructor). It was wrongly assumed to be Windows-style FontScaling, so we need to revert that - // to get back to the needed unx-style FontScale + // When running on unx (non-Windows) the value was already adapted at font import (see WinMtfFontStyle + // constructor). It was wrongly assumed to be Windows-style FontScaling, so we need to revert that + // to get back to the needed unx-style FontScale #endif - // Interestingly this leads to the *same* correction, so no need to make this - // system-dependent (!) - const tools::Long nUnscaledAverageFontWidth(rFontCandidate.GetOrCalculateAverageFontWidth()); - const tools::Long nScaledAverageFontWidth(rFontCandidate.GetAverageFontWidth()); - const double fScaleFactor(static_cast(nUnscaledAverageFontWidth) / static_cast(rFontCandidate.GetFontHeight())); - const double fCorrectedAverageFontWidth(static_cast(nScaledAverageFontWidth) * fScaleFactor); - tools::Long nCorrectedTextLength(0); - - { // do in own scope, only need nUnscaledAverageFontWidth - vcl::Font rFontCandidate2(rFontCandidate); - rFontCandidate2.SetAverageFontWidth(static_cast(fCorrectedAverageFontWidth)); - pTempVirtualDevice->SetFont(rFontCandidate2); - nCorrectedTextLength = pTempVirtualDevice->GetTextWidth(rText); - // on failure, use original length - if (!nCorrectedTextLength) - nCorrectedTextLength = nImportedTextLength; - } + // Interestingly this leads to the *same* correction, so no need to make this + // system-dependent (!) + const tools::Long nUnscaledAverageFontWidth(rFontCandidate.GetOrCalculateAverageFontWidth()); + const tools::Long nScaledAverageFontWidth(rFontCandidate.GetAverageFontWidth()); + const double fScaleFactor(static_cast(nUnscaledAverageFontWidth) / static_cast(rFontCandidate.GetFontHeight())); + const double fCorrectedAverageFontWidth(static_cast(nScaledAverageFontWidth) * fScaleFactor); + tools::Long nCorrectedTextLength(0); + + { // do in own scope, only need nUnscaledAverageFontWidth + vcl::Font rFontCandidate2(rFontCandidate); + rFontCandidate2.SetAverageFontWidth(static_cast(fCorrectedAverageFontWidth)); + pTempVirtualDevice->SetFont(rFontCandidate2); + nCorrectedTextLength = pTempVirtualDevice->GetTextWidth(rText); + // on failure, use original length + if (!nCorrectedTextLength) + nCorrectedTextLength = nImportedTextLength; + } - const double fFactorCorrectedText(static_cast(nImportedTextLength) / static_cast(nCorrectedTextLength)); - const double fFactorCorrectedTextPercent(fabs(1.0 - fFactorCorrectedText) * 100.0); - - // If FactorCorrectedText fits better than FactorText this is probably - // an import of an old EMF/WMF written by LibreOffice on a non-Windows (unx) system - // and should be corrected. - // Usually in tested cases this lies inside 5% of range, so detecting this just using - // fFactorTextPercent inside 5% -> no old file - // fFactorCorrectedTextPercent inside 5% -> is old file - // works not too bad, but there are some strange not so often used fonts where that - // values do deviate, so better just compare if old corrected would fit better than - // the uncorrected case, that is usually safe. - if(fFactorCorrectedTextPercent < fFactorTextPercent) - { - maAlternativeFontScales.push_back(fCorrectedAverageFontWidth); - } - else - { - // also push, but negative to remember non-fitting case - maAlternativeFontScales.push_back(-fCorrectedAverageFontWidth); - } + const double fFactorCorrectedText(static_cast(nImportedTextLength) / static_cast(nCorrectedTextLength)); + const double fFactorCorrectedTextPercent(fabs(1.0 - fFactorCorrectedText) * 100.0); + + // If FactorCorrectedText fits better than FactorText this is probably + // an import of an old EMF/WMF written by LibreOffice on a non-Windows (unx) system + // and should be corrected. + // Usually in tested cases this lies inside 5% of range, so detecting this just using + // fFactorTextPercent inside 5% -> no old file + // fFactorCorrectedTextPercent inside 5% -> is old file + // works not too bad, but there are some strange not so often used fonts where that + // values do deviate, so better just compare if old corrected would fit better than + // the uncorrected case, that is usually safe. + if(fFactorCorrectedTextPercent < fFactorTextPercent) + { + maAlternativeFontScales.push_back(fCorrectedAverageFontWidth); + } + else + { + // also push, but negative to remember non-fitting case + maAlternativeFontScales.push_back(-fCorrectedAverageFontWidth); } } } diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx index 1b712259f80a..f2517ed95515 100644 --- a/extensions/source/bibliography/general.cxx +++ b/extensions/source/bibliography/general.cxx @@ -304,24 +304,24 @@ void BibGeneralPage::SaveChanges() Reference< XForm > xForm = pDatMan->getForm(); Reference< beans::XPropertySet > xProps( xForm, UNO_QUERY ); Reference< sdbc::XResultSetUpdate > xResUpd( xProps, UNO_QUERY ); - if (xResUpd.is() ) + if (!xResUpd.is() ) + return; + + Any aModified = xProps->getPropertyValue( "IsModified" ); + bool bFlag = false; + if ( ( aModified >>= bFlag ) && bFlag ) { - Any aModified = xProps->getPropertyValue( "IsModified" ); - bool bFlag = false; - if ( ( aModified >>= bFlag ) && bFlag ) - { - try - { - Any aNew = xProps->getPropertyValue( "IsNew" ); - aNew >>= bFlag; - if ( bFlag ) - xResUpd->insertRow(); - else - xResUpd->updateRow(); - } - catch( const uno::Exception&) {} + try + { + Any aNew = xProps->getPropertyValue( "IsNew" ); + aNew >>= bFlag; + if ( bFlag ) + xResUpd->insertRow(); + else + xResUpd->updateRow(); } + catch( const uno::Exception&) {} } } diff --git a/framework/source/uielement/resourcemenucontroller.cxx b/framework/source/uielement/resourcemenucontroller.cxx index c56c91dc35e1..26198c0cf5f6 100644 --- a/framework/source/uielement/resourcemenucontroller.cxx +++ b/framework/source/uielement/resourcemenucontroller.cxx @@ -228,18 +228,18 @@ void ResourceMenuController::updatePopupMenu() framework::MenuBarManager::FillMenu( m_nNewMenuId, comphelper::getUnoTunnelImplementation( m_xPopupMenu )->GetMenu(), m_aModuleName, m_xMenuContainer, m_xDispatchProvider ); // For context menus, add object verbs. - if ( m_bContextMenu ) + if ( !m_bContextMenu ) + return; + + css::util::URL aObjectMenuURL; + aObjectMenuURL.Complete = ".uno:ObjectMenue"; + m_xURLTransformer->parseStrict( aObjectMenuURL ); + css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY ); + css::uno::Reference< css::frame::XDispatch > xDispatch( xDispatchProvider->queryDispatch( aObjectMenuURL, OUString(), 0 ) ); + if ( xDispatch.is() ) { - css::util::URL aObjectMenuURL; - aObjectMenuURL.Complete = ".uno:ObjectMenue"; - m_xURLTransformer->parseStrict( aObjectMenuURL ); - css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY ); - css::uno::Reference< css::frame::XDispatch > xDispatch( xDispatchProvider->queryDispatch( aObjectMenuURL, OUString(), 0 ) ); - if ( xDispatch.is() ) - { - xDispatch->addStatusListener( this, aObjectMenuURL ); - xDispatch->removeStatusListener( this, aObjectMenuURL ); - } + xDispatch->addStatusListener( this, aObjectMenuURL ); + xDispatch->removeStatusListener( this, aObjectMenuURL ); } } @@ -503,29 +503,28 @@ void WindowListMenuController::itemActivated( const css::awt::MenuEvent& rEvent void WindowListMenuController::itemSelected( const css::awt::MenuEvent& rEvent ) { - if ( rEvent.MenuId >= START_ITEMID_WINDOWLIST && - rEvent.MenuId <= END_ITEMID_WINDOWLIST ) - { - // window list menu item selected - css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext ); + if ( rEvent.MenuId < START_ITEMID_WINDOWLIST || rEvent.MenuId > END_ITEMID_WINDOWLIST ) + return; - sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; - css::uno::Reference< css::container::XIndexAccess > xList = xDesktop->getFrames(); - sal_Int32 nCount = xList->getCount(); - for ( sal_Int32 i=0; i xFrame; - xList->getByIndex(i) >>= xFrame; - if ( xFrame.is() && nTaskId == rEvent.MenuId ) - { - VclPtr pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - pWin->GrabFocus(); - pWin->ToTop( ToTopFlags::RestoreWhenMin ); - break; - } + // window list menu item selected + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext ); - nTaskId++; + sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; + css::uno::Reference< css::container::XIndexAccess > xList = xDesktop->getFrames(); + sal_Int32 nCount = xList->getCount(); + for ( sal_Int32 i=0; i xFrame; + xList->getByIndex(i) >>= xFrame; + if ( xFrame.is() && nTaskId == rEvent.MenuId ) + { + VclPtr pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + pWin->GrabFocus(); + pWin->ToTop( ToTopFlags::RestoreWhenMin ); + break; } + + nTaskId++; } } diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx index f411a8bbb957..a65763f38bd0 100644 --- a/lotuswordpro/source/filter/lwpfribsection.cxx +++ b/lotuswordpro/source/filter/lwpfribsection.cxx @@ -423,18 +423,18 @@ void LwpMasterPage::ParseSection(LwpFrib* pFrib) void LwpMasterPage::RegisterFillerPageStyle() { LwpLayout::UseWhenType eUserType = m_pLayout->GetUseWhenType(); - if (eUserType == LwpLayout::StartOnOddPage || eUserType == LwpLayout::StartOnEvenPage) + if (eUserType != LwpLayout::StartOnOddPage && eUserType != LwpLayout::StartOnEvenPage) + return; + + if (m_pLayout->HasFillerPageText(m_pPara->GetFoundry())) { - if (m_pLayout->HasFillerPageText(m_pPara->GetFoundry())) - { - std::unique_ptr pPagebreakStyle(new XFParaStyle); - *pPagebreakStyle = *(m_pPara->GetXFParaStyle()); - pPagebreakStyle->SetStyleName(""); - pPagebreakStyle->SetBreaks(enumXFBreakAftPage); - XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); - m_FillerPageStyleName - = pXFStyleManager->AddStyle(std::move(pPagebreakStyle)).m_pStyle->GetStyleName(); - } + std::unique_ptr pPagebreakStyle(new XFParaStyle); + *pPagebreakStyle = *(m_pPara->GetXFParaStyle()); + pPagebreakStyle->SetStyleName(""); + pPagebreakStyle->SetBreaks(enumXFBreakAftPage); + XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); + m_FillerPageStyleName + = pXFStyleManager->AddStyle(std::move(pPagebreakStyle)).m_pStyle->GetStyleName(); } } diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index bc24b0322059..f5191b54408a 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -712,17 +712,17 @@ void CompositeAlg::layoutShapeChildren(AlgAtom& rAlg, const ShapePtr& rShape, } // See if all vertical space is used or we have to center the content. - if (nVertMin >= 0 && nVertMin <= nVertMax && nVertMax <= rParent[XML_h]) + if (!(nVertMin >= 0 && nVertMin <= nVertMax && nVertMax <= rParent[XML_h])) + return; + + sal_Int32 nDiff = rParent[XML_h] - (nVertMax - nVertMin); + if (nDiff > 0) { - sal_Int32 nDiff = rParent[XML_h] - (nVertMax - nVertMin); - if (nDiff > 0) + for (auto& aCurrShape : rShape->getChildren()) { - for (auto& aCurrShape : rShape->getChildren()) - { - awt::Point aPosition = aCurrShape->getPosition(); - aPosition.Y += nDiff / 2; - aCurrShape->setPosition(aPosition); - } + awt::Point aPosition = aCurrShape->getPosition(); + aPosition.Y += nDiff / 2; + aCurrShape->setPosition(aPosition); } } } diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index e15e58a4f3ff..2b412d43430a 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -984,104 +984,104 @@ void ChartExport::exportExternalData( const Reference< css::chart::XChartDocumen void ChartExport::exportAdditionalShapes( const Reference< css::chart::XChartDocument >& xChartDoc ) { Reference< beans::XPropertySet > xDocPropSet(xChartDoc, uno::UNO_QUERY); - if (xDocPropSet.is()) + if (!xDocPropSet.is()) + return; + + css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes; + // get a sequence of non-chart shapes + try { - css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes; - // get a sequence of non-chart shapes - try + Any aShapesAny = xDocPropSet->getPropertyValue("AdditionalShapes"); + if( (aShapesAny >>= mxAdditionalShapes) && mxAdditionalShapes.is() ) { - Any aShapesAny = xDocPropSet->getPropertyValue("AdditionalShapes"); - if( (aShapesAny >>= mxAdditionalShapes) && mxAdditionalShapes.is() ) - { - OUString sId; - const char* sFullPath = nullptr; - const char* sRelativePath = nullptr; - sal_Int32 nDrawing = getNewDrawingUniqueId(); + OUString sId; + const char* sFullPath = nullptr; + const char* sRelativePath = nullptr; + sal_Int32 nDrawing = getNewDrawingUniqueId(); - switch (GetDocumentType()) + switch (GetDocumentType()) + { + case DOCUMENT_DOCX: { - case DOCUMENT_DOCX: - { - sFullPath = "word/drawings/drawing"; - sRelativePath = "../drawings/drawing"; - break; - } - case DOCUMENT_PPTX: - { - sFullPath = "ppt/drawings/drawing"; - sRelativePath = "../drawings/drawing"; - break; - } - case DOCUMENT_XLSX: - { - sFullPath = "xl/drawings/drawing"; - sRelativePath = "../drawings/drawing"; - break; - } - default: - { - sFullPath = "drawings/drawing"; - sRelativePath = "drawings/drawing"; - break; - } + sFullPath = "word/drawings/drawing"; + sRelativePath = "../drawings/drawing"; + break; } - OUString sFullStream = OUStringBuffer() - .appendAscii(sFullPath) - .append(nDrawing) - .append(".xml") - .makeStringAndClear(); - OUString sRelativeStream = OUStringBuffer() - .appendAscii(sRelativePath) - .append(nDrawing) - .append(".xml") - .makeStringAndClear(); - - sax_fastparser::FSHelperPtr pDrawing = CreateOutputStream( - sFullStream, - sRelativeStream, - GetFS()->getOutputStream(), - "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml", - OUStringToOString(oox::getRelationship(Relationship::CHARTUSERSHAPES), RTL_TEXTENCODING_UTF8).getStr(), - &sId); - - GetFS()->singleElementNS(XML_c, XML_userShapes, FSNS(XML_r, XML_id), sId); - - XmlFilterBase* pFB = GetFB(); - pDrawing->startElement(FSNS(XML_c, XML_userShapes), - FSNS(XML_xmlns, XML_cdr), pFB->getNamespaceURL(OOX_NS(dmlChartDr)), - FSNS(XML_xmlns, XML_a), pFB->getNamespaceURL(OOX_NS(dml)), - FSNS(XML_xmlns, XML_c), pFB->getNamespaceURL(OOX_NS(dmlChart))); - - const sal_Int32 nShapeCount(mxAdditionalShapes->getCount()); - for (sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++) + case DOCUMENT_PPTX: { - Reference< drawing::XShape > xShape; - mxAdditionalShapes->getByIndex(nShapeId) >>= xShape; - SAL_WARN_IF(!xShape.is(), "xmloff.chart", "Shape without an XShape?"); - if (!xShape.is()) - continue; - - // TODO: absSizeAnchor: we import both (absSizeAnchor and relSizeAnchor), but there is no essential difference between them. - pDrawing->startElement(FSNS(XML_cdr, XML_relSizeAnchor)); - uno::Reference< beans::XPropertySet > xShapeProperties(xShape, uno::UNO_QUERY); - if( xShapeProperties.is() ) - { - Reference xVisObject(mxChartModel, uno::UNO_QUERY); - awt::Size aPageSize = xVisObject->getVisualAreaSize(embed::Aspects::MSOLE_CONTENT); - WriteFromTo( xShape, aPageSize, pDrawing ); + sFullPath = "ppt/drawings/drawing"; + sRelativePath = "../drawings/drawing"; + break; + } + case DOCUMENT_XLSX: + { + sFullPath = "xl/drawings/drawing"; + sRelativePath = "../drawings/drawing"; + break; + } + default: + { + sFullPath = "drawings/drawing"; + sRelativePath = "drawings/drawing"; + break; + } + } + OUString sFullStream = OUStringBuffer() + .appendAscii(sFullPath) + .append(nDrawing) + .append(".xml") + .makeStringAndClear(); + OUString sRelativeStream = OUStringBuffer() + .appendAscii(sRelativePath) + .append(nDrawing) + .append(".xml") + .makeStringAndClear(); + + sax_fastparser::FSHelperPtr pDrawing = CreateOutputStream( + sFullStream, + sRelativeStream, + GetFS()->getOutputStream(), + "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml", + OUStringToOString(oox::getRelationship(Relationship::CHARTUSERSHAPES), RTL_TEXTENCODING_UTF8).getStr(), + &sId); + + GetFS()->singleElementNS(XML_c, XML_userShapes, FSNS(XML_r, XML_id), sId); + + XmlFilterBase* pFB = GetFB(); + pDrawing->startElement(FSNS(XML_c, XML_userShapes), + FSNS(XML_xmlns, XML_cdr), pFB->getNamespaceURL(OOX_NS(dmlChartDr)), + FSNS(XML_xmlns, XML_a), pFB->getNamespaceURL(OOX_NS(dml)), + FSNS(XML_xmlns, XML_c), pFB->getNamespaceURL(OOX_NS(dmlChart))); + + const sal_Int32 nShapeCount(mxAdditionalShapes->getCount()); + for (sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++) + { + Reference< drawing::XShape > xShape; + mxAdditionalShapes->getByIndex(nShapeId) >>= xShape; + SAL_WARN_IF(!xShape.is(), "xmloff.chart", "Shape without an XShape?"); + if (!xShape.is()) + continue; - ShapeExport aExport(XML_cdr, pDrawing, nullptr, GetFB(), GetDocumentType()); - aExport.WriteShape(xShape); - } - pDrawing->endElement(FSNS(XML_cdr, XML_relSizeAnchor)); + // TODO: absSizeAnchor: we import both (absSizeAnchor and relSizeAnchor), but there is no essential difference between them. + pDrawing->startElement(FSNS(XML_cdr, XML_relSizeAnchor)); + uno::Reference< beans::XPropertySet > xShapeProperties(xShape, uno::UNO_QUERY); + if( xShapeProperties.is() ) + { + Reference xVisObject(mxChartModel, uno::UNO_QUERY); + awt::Size aPageSize = xVisObject->getVisualAreaSize(embed::Aspects::MSOLE_CONTENT); + WriteFromTo( xShape, aPageSize, pDrawing ); + + ShapeExport aExport(XML_cdr, pDrawing, nullptr, GetFB(), GetDocumentType()); + aExport.WriteShape(xShape); } - pDrawing->endElement(FSNS(XML_c, XML_userShapes)); + pDrawing->endElement(FSNS(XML_cdr, XML_relSizeAnchor)); } + pDrawing->endElement(FSNS(XML_c, XML_userShapes)); } - catch (const uno::Exception&) - { - TOOLS_INFO_EXCEPTION("xmloff.chart", "AdditionalShapes not found"); - } + } + catch (const uno::Exception&) + { + TOOLS_INFO_EXCEPTION("xmloff.chart", "AdditionalShapes not found"); } } diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index e09bd084e7f3..464c7e4a51dd 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++ b/sc/source/filter/oox/autofilterbuffer.cxx @@ -725,63 +725,63 @@ void AutoFilter::finalizeImport( const Reference< XDatabaseRange >& rxDatabaseRa aDescProps.setProperty( PROP_UseRegularExpressions, bUseRegExp ); // sort - if (!maSortConditions.empty()) - { - const SortConditionVector::value_type& xSortConditionPointer = *maSortConditions.begin(); - const SortCondition& rSorConditionLoaded = *xSortConditionPointer; + if (maSortConditions.empty()) + return; + + const SortConditionVector::value_type& xSortConditionPointer = *maSortConditions.begin(); + const SortCondition& rSorConditionLoaded = *xSortConditionPointer; - ScSortParam aParam; - aParam.bUserDef = false; - aParam.nUserIndex = 0; - aParam.bByRow = false; + ScSortParam aParam; + aParam.bUserDef = false; + aParam.nUserIndex = 0; + aParam.bByRow = false; - ScUserList* pUserList = ScGlobal::GetUserList(); - if (!rSorConditionLoaded.maSortCustomList.isEmpty()) + ScUserList* pUserList = ScGlobal::GetUserList(); + if (!rSorConditionLoaded.maSortCustomList.isEmpty()) + { + for (size_t i=0; pUserList && i < pUserList->size(); i++) { - for (size_t i=0; pUserList && i < pUserList->size(); i++) + const OUString aEntry((*pUserList)[i].GetString()); + if (aEntry.equalsIgnoreAsciiCase(rSorConditionLoaded.maSortCustomList)) { - const OUString aEntry((*pUserList)[i].GetString()); - if (aEntry.equalsIgnoreAsciiCase(rSorConditionLoaded.maSortCustomList)) - { - aParam.bUserDef = true; - aParam.nUserIndex = i; - break; - } + aParam.bUserDef = true; + aParam.nUserIndex = i; + break; } } + } - if (!aParam.bUserDef) - { - pUserList->push_back(new ScUserListData(rSorConditionLoaded.maSortCustomList)); - aParam.bUserDef = true; - aParam.nUserIndex = pUserList->size()-1; - } + if (!aParam.bUserDef) + { + pUserList->push_back(new ScUserListData(rSorConditionLoaded.maSortCustomList)); + aParam.bUserDef = true; + aParam.nUserIndex = pUserList->size()-1; + } - // set sort parameter if we have detected it - if (aParam.bUserDef) + // set sort parameter if we have detected it + if (aParam.bUserDef) + { + SCCOLROW nStartPos = aParam.bByRow ? maRange.aStart.Col() : maRange.aStart.Row(); + if (rSorConditionLoaded.mbDescending) { - SCCOLROW nStartPos = aParam.bByRow ? maRange.aStart.Col() : maRange.aStart.Row(); - if (rSorConditionLoaded.mbDescending) - { - // descending sort - need to enable 1st SortParam slot - assert(aParam.GetSortKeyCount() == DEFSORT); + // descending sort - need to enable 1st SortParam slot + assert(aParam.GetSortKeyCount() == DEFSORT); - aParam.maKeyState[0].bDoSort = true; - aParam.maKeyState[0].bAscending = false; - aParam.maKeyState[0].nField += nStartPos; - } + aParam.maKeyState[0].bDoSort = true; + aParam.maKeyState[0].bAscending = false; + aParam.maKeyState[0].nField += nStartPos; + } - ScDocument& rDoc = getScDocument(); - ScDBData* pDBData = rDoc.GetDBAtArea( - nSheet, - maRange.aStart.Col(), maRange.aStart.Row(), - maRange.aEnd.Col(), maRange.aEnd.Row()); + ScDocument& rDoc = getScDocument(); + ScDBData* pDBData = rDoc.GetDBAtArea( + nSheet, + maRange.aStart.Col(), maRange.aStart.Row(), + maRange.aEnd.Col(), maRange.aEnd.Row()); - if (pDBData) - pDBData->SetSortParam(aParam); - else - OSL_FAIL("AutoFilter::finalizeImport(): cannot find matching DBData"); - } + if (pDBData) + pDBData->SetSortParam(aParam); + else + OSL_FAIL("AutoFilter::finalizeImport(): cannot find matching DBData"); } } diff --git a/sc/source/filter/oox/querytablebuffer.cxx b/sc/source/filter/oox/querytablebuffer.cxx index b6614068c2ff..0f561c5ab629 100644 --- a/sc/source/filter/oox/querytablebuffer.cxx +++ b/sc/source/filter/oox/querytablebuffer.cxx @@ -241,7 +241,10 @@ void QueryTable::finalizeImport() // find tables mode: entire document, all tables, or specific tables OUString aTables = pWebPr->mbHtmlTables ? lclBuildWebQueryTables( pWebPr->maTables ) : "HTML_all"; - if( !aTables.isEmpty() ) try + if( aTables.isEmpty() ) + return; + + try { PropertySet aDocProps( getDocument() ); Reference< XAreaLinks > xAreaLinks( aDocProps.getAnyProperty( PROP_AreaLinks ), UNO_QUERY_THROW ); diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 926157e71d83..c7beb52ed9e6 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -995,34 +995,34 @@ void ScInputBarGroup::DecrementVerticalSize() void ScInputWindow::MenuHdl(std::string_view command) { - if (!command.empty()) - { - bool bSubTotal = false; - bool bRangeFinder = false; - OpCode eCode = ocSum; - if ( command == "sum" ) - { - eCode = ocSum; - } - else if ( command == "average" ) - { - eCode = ocAverage; - } - else if ( command == "max" ) - { - eCode = ocMax; - } - else if ( command == "min" ) - { - eCode = ocMin; - } - else if ( command == "count" ) - { - eCode = ocCount; - } + if (command.empty()) + return; - AutoSum( bRangeFinder, bSubTotal, eCode ); + bool bSubTotal = false; + bool bRangeFinder = false; + OpCode eCode = ocSum; + if ( command == "sum" ) + { + eCode = ocSum; + } + else if ( command == "average" ) + { + eCode = ocAverage; } + else if ( command == "max" ) + { + eCode = ocMax; + } + else if ( command == "min" ) + { + eCode = ocMin; + } + else if ( command == "count" ) + { + eCode = ocCount; + } + + AutoSum( bRangeFinder, bSubTotal, eCode ); } IMPL_LINK_NOARG(ScInputWindow, DropdownClickHdl, ToolBox *, void) @@ -1340,31 +1340,31 @@ int ScTextWnd::GetEditEngTxtHeight() const void ScTextWnd::SetScrollBarRange() { - if (m_xEditView) - { - OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); - Size aOutputSize = rDevice.GetOutputSize(); + if (!m_xEditView) + return; - int nUpper = GetEditEngTxtHeight(); - int nCurrentDocPos = m_xEditView->GetVisArea().Top(); - int nStepIncrement = GetTextHeight(); - int nPageIncrement = aOutputSize.Height(); - int nPageSize = aOutputSize.Height(); + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + Size aOutputSize = rDevice.GetOutputSize(); - /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has - effectively... + int nUpper = GetEditEngTxtHeight(); + int nCurrentDocPos = m_xEditView->GetVisArea().Top(); + int nStepIncrement = GetTextHeight(); + int nPageIncrement = aOutputSize.Height(); + int nPageSize = aOutputSize.Height(); - lower = gtk_adjustment_get_lower - upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size + /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has + effectively... - and requires that upper > lower or the deceleration animation never ends - */ - nPageSize = std::min(nPageSize, nUpper); + lower = gtk_adjustment_get_lower + upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size - weld::ScrolledWindow& rVBar = mrGroupBar.GetScrollWin(); - rVBar.vadjustment_configure(nCurrentDocPos, 0, nUpper, - nStepIncrement, nPageIncrement, nPageSize); - } + and requires that upper > lower or the deceleration animation never ends + */ + nPageSize = std::min(nPageSize, nUpper); + + weld::ScrolledWindow& rVBar = mrGroupBar.GetScrollWin(); + rVBar.vadjustment_configure(nCurrentDocPos, 0, nUpper, + nStepIncrement, nPageIncrement, nPageSize); } void ScTextWnd::DoScroll() diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 44f64b8bc4a7..201313f0e41e 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1395,17 +1395,18 @@ void ScCheckListMenuControl::launch(const tools::Rectangle& rRect) void ScCheckListMenuControl::NotifyCloseLOK() { VclPtr aNotifierWindow = mxFrame->GetParentWithLOKNotifier(); - if (aNotifierWindow) { - const vcl::ILibreOfficeKitNotifier* pNotifier = aNotifierWindow->GetLOKNotifier(); - if (pNotifier) - { - tools::JsonWriter aJsonWriter; - aJsonWriter.put("jsontype", "autofilter"); - aJsonWriter.put("action", "close"); + if (!aNotifierWindow) + return; - const std::string message = aJsonWriter.extractAsStdString(); - pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); - } + const vcl::ILibreOfficeKitNotifier* pNotifier = aNotifierWindow->GetLOKNotifier(); + if (pNotifier) + { + tools::JsonWriter aJsonWriter; + aJsonWriter.put("jsontype", "autofilter"); + aJsonWriter.put("action", "close"); + + const std::string message = aJsonWriter.extractAsStdString(); + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); } } diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index b5acbc6cdb60..4b8c2e1396be 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -590,19 +590,19 @@ IMPL_LINK(ScTpSubTotalOptions, CheckHdl, weld::Button&, rBox, void) IMPL_LINK(ScTpSubTotalGroup, CheckBoxHdl, weld::Button&, rBox, void) { - if (&rBox == mxLbSelectAllColumns.get()) - { - bool bChecked = mxLbSelectAllColumns->get_active(); + if (&rBox != mxLbSelectAllColumns.get()) + return; - mxLbColumns->all_foreach([&](const weld::TreeIter& rEntry) { - if ( bChecked ) - mxLbColumns->set_toggle(rEntry, TRISTATE_TRUE); - else - mxLbColumns->set_toggle(rEntry, TRISTATE_FALSE); + bool bChecked = mxLbSelectAllColumns->get_active(); - return false; - }); - } + mxLbColumns->all_foreach([&](const weld::TreeIter& rEntry) { + if ( bChecked ) + mxLbColumns->set_toggle(rEntry, TRISTATE_TRUE); + else + mxLbColumns->set_toggle(rEntry, TRISTATE_FALSE); + + return false; + }); } ScTpSubTotalGroup1::~ScTpSubTotalGroup1() diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index 1b2ef3240c1e..22f28e52efe8 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -311,69 +311,69 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // disable functions static void setupFillColorForChart(SfxViewShell* pShell, SfxItemSet& rSet) { - if (pShell) + if (!pShell) + return; + + SfxInPlaceClient* pIPClient = pShell->GetIPClient(); + if (!pIPClient) + return; + + const css::uno::Reference<::css::embed::XEmbeddedObject>& xEmbObj = pIPClient->GetObject(); + if( !xEmbObj.is() ) + return; + + ::css::uno::Reference<::css::chart2::XChartDocument> xChart( xEmbObj->getComponent(), uno::UNO_QUERY ); + if( !xChart.is() ) + return; + + css::uno::Reference xPropSet = xChart->getPageBackground(); + if (!xPropSet.is()) + return; + + css::uno::Reference xInfo(xPropSet->getPropertySetInfo()); + if (!xInfo.is()) + return; + + if (xInfo->hasPropertyByName("FillColor")) { - SfxInPlaceClient* pIPClient = pShell->GetIPClient(); - if (pIPClient) - { - const css::uno::Reference<::css::embed::XEmbeddedObject>& xEmbObj = pIPClient->GetObject(); - if( xEmbObj.is() ) - { - ::css::uno::Reference<::css::chart2::XChartDocument> xChart( xEmbObj->getComponent(), uno::UNO_QUERY ); - if( xChart.is() ) - { - css::uno::Reference xPropSet = xChart->getPageBackground(); - if (xPropSet.is()) - { - css::uno::Reference xInfo(xPropSet->getPropertySetInfo()); - if (xInfo.is()) - { - if (xInfo->hasPropertyByName("FillColor")) - { - sal_uInt32 nFillColor = 0; - xPropSet->getPropertyValue("FillColor") >>= nFillColor; - - XFillColorItem aFillColorItem("", Color(ColorTransparency, nFillColor)); - rSet.Put(aFillColorItem); - - if (comphelper::LibreOfficeKit::isActive()) - pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, - (".uno:FillColor=" + std::to_string(nFillColor)).c_str()); - } - - if (comphelper::LibreOfficeKit::isActive() && xInfo->hasPropertyByName("FillGradientName")) - { - OUString aGradientName; - xPropSet->getPropertyValue("FillGradientName") >>= aGradientName; - - ::css::uno::Reference< ::css::frame::XController > xChartController = xChart->getCurrentController(); - if( xChartController.is() ) - { - css::uno::Reference xFact(xChartController->getModel(), css::uno::UNO_QUERY); - - if (xFact.is()) - { - css::uno::Reference xNameAccess( - xFact->createInstance("com.sun.star.drawing.GradientTable"), css::uno::UNO_QUERY); - - if (xNameAccess.is() && xNameAccess->hasByName(aGradientName)) - { - css::uno::Any aAny = xNameAccess->getByName(aGradientName); - - XFillGradientItem aItem; - aItem.SetName(aGradientName); - aItem.PutValue(aAny, MID_FILLGRADIENT); - - rSet.Put(aItem); - } - } - } - } - } - } - } - } - } + sal_uInt32 nFillColor = 0; + xPropSet->getPropertyValue("FillColor") >>= nFillColor; + + XFillColorItem aFillColorItem("", Color(ColorTransparency, nFillColor)); + rSet.Put(aFillColorItem); + + if (comphelper::LibreOfficeKit::isActive()) + pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, + (".uno:FillColor=" + std::to_string(nFillColor)).c_str()); + } + + if (!(comphelper::LibreOfficeKit::isActive() && xInfo->hasPropertyByName("FillGradientName"))) + return; + + OUString aGradientName; + xPropSet->getPropertyValue("FillGradientName") >>= aGradientName; + + ::css::uno::Reference< ::css::frame::XController > xChartController = xChart->getCurrentController(); + if( !xChartController.is() ) + return; + + css::uno::Reference xFact(xChartController->getModel(), css::uno::UNO_QUERY); + + if (!xFact.is()) + return; + + css::uno::Reference xNameAccess( + xFact->createInstance("com.sun.star.drawing.GradientTable"), css::uno::UNO_QUERY); + + if (xNameAccess.is() && xNameAccess->hasByName(aGradientName)) + { + css::uno::Any aAny = xNameAccess->getByName(aGradientName); + + XFillGradientItem aItem; + aItem.SetName(aGradientName); + aItem.PutValue(aAny, MID_FILLGRADIENT); + + rSet.Put(aItem); } } diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index 9e412449917c..30ab23371d2f 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -600,23 +600,23 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel, return; OutlinerView* pOLV = pView->GetTextEditOutlinerView(); - if (pOLV) - { - if ( pMousePixel ) - { - MouseEvent aEditEvt( *pMousePixel, 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0 ); - pOLV->MouseButtonDown(aEditEvt); - pOLV->MouseButtonUp(aEditEvt); - } - else if ( bCursorToEnd ) - { - ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND); - pOLV->SetSelection(aNewSelection); - } + if (!pOLV) + return; - if ( pInitialKey ) - pOLV->PostKeyEvent( *pInitialKey ); + if ( pMousePixel ) + { + MouseEvent aEditEvt( *pMousePixel, 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0 ); + pOLV->MouseButtonDown(aEditEvt); + pOLV->MouseButtonUp(aEditEvt); } + else if ( bCursorToEnd ) + { + ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND); + pOLV->SetSelection(aNewSelection); + } + + if ( pInitialKey ) + pOLV->PostKeyEvent( *pInitialKey ); } // Create default drawing objects via keyboard diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 4e79f8d337f9..052245ac15fd 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -616,43 +616,43 @@ IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent&, rEvent, void) if( !pWindow ) return; - if( pWindow == mpListenWindow ) + if( pWindow != mpListenWindow ) + return; + + switch( rEvent.GetId() ) { - switch( rEvent.GetId() ) + case VclEventId::WindowMouseButtonUp: { - case VclEventId::WindowMouseButtonUp: - { - // if we stop pressing the button without a mouse move we open the popup - mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler)); - mpListenWindow = nullptr; - if( !mpAnnotationWindow ) - OpenPopup(false); - } - break; - case VclEventId::WindowMouseMove: - { - // if we move the mouse after a button down we want to start dragging - mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler)); - mpListenWindow = nullptr; + // if we stop pressing the button without a mouse move we open the popup + mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler)); + mpListenWindow = nullptr; + if( !mpAnnotationWindow ) + OpenPopup(false); + } + break; + case VclEventId::WindowMouseMove: + { + // if we move the mouse after a button down we want to start dragging + mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler)); + mpListenWindow = nullptr; - SdrHdl* pHdl = mrView.PickHandle(maMouseDownPos); - if( pHdl ) - { - mrView.BrkAction(); - const sal_uInt16 nDrgLog = static_cast(pWindow->PixelToLogic(Size(DRGPIX,0)).Width()); + SdrHdl* pHdl = mrView.PickHandle(maMouseDownPos); + if( pHdl ) + { + mrView.BrkAction(); + const sal_uInt16 nDrgLog = static_cast(pWindow->PixelToLogic(Size(DRGPIX,0)).Width()); - rtl::Reference< AnnotationTag > xTag( this ); + rtl::Reference< AnnotationTag > xTag( this ); - SdrDragMethod* pDragMethod = new AnnotationDragMove( mrView, xTag ); - mrView.BegDragObj(maMouseDownPos, nullptr, pHdl, nDrgLog, pDragMethod ); - } + SdrDragMethod* pDragMethod = new AnnotationDragMove( mrView, xTag ); + mrView.BegDragObj(maMouseDownPos, nullptr, pHdl, nDrgLog, pDragMethod ); } - break; - case VclEventId::ObjectDying: - mpListenWindow = nullptr; - break; - default: break; } + break; + case VclEventId::ObjectDying: + mpListenWindow = nullptr; + break; + default: break; } } diff --git a/sd/source/ui/app/scalectrl.cxx b/sd/source/ui/app/scalectrl.cxx index 6ab069f8a1e4..d1b8dc277fce 100644 --- a/sd/source/ui/app/scalectrl.cxx +++ b/sd/source/ui/app/scalectrl.cxx @@ -83,26 +83,26 @@ void SdScaleControl::Command(const CommandEvent& rCEvt) ::tools::Rectangle aRect(rCEvt.GetMousePosPixel(), Size(1, 1)); weld::Window* pParent = weld::GetPopupParent(GetStatusBar(), aRect); OString sResult = xPopup->popup_at_rect(pParent, aRect); - if (!sResult.isEmpty()) - { - sal_Int32 i = sResult.toUInt32(); - sal_Int32 nX; - sal_Int32 nY; - if (i > 11) - nX = 1; - else - nX = aTable[(12 - i) % 12]; - if (i > 11) - nY = aTable[i % 12]; - else - nY = 1; - pDoc->SetUIScale(Fraction(nX, nY)); - - SfxBindings& pBindings = pViewFrame->GetBindings(); - pBindings.Invalidate(SID_SCALE); //update statusbar - pBindings.Invalidate(SID_ATTR_METRIC); //update sidebar - pViewShellBase->UpdateBorder(true); // update ruler - } + if (sResult.isEmpty()) + return; + + sal_Int32 i = sResult.toUInt32(); + sal_Int32 nX; + sal_Int32 nY; + if (i > 11) + nX = 1; + else + nX = aTable[(12 - i) % 12]; + if (i > 11) + nY = aTable[i % 12]; + else + nY = 1; + pDoc->SetUIScale(Fraction(nX, nY)); + + SfxBindings& pBindings = pViewFrame->GetBindings(); + pBindings.Invalidate(SID_SCALE); //update statusbar + pBindings.Invalidate(SID_ATTR_METRIC); //update sidebar + pViewShellBase->UpdateBorder(true); // update ruler } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/app/sdpopup.cxx b/sd/source/ui/app/sdpopup.cxx index ebccfe8cb4c9..52a0435351de 100644 --- a/sd/source/ui/app/sdpopup.cxx +++ b/sd/source/ui/app/sdpopup.cxx @@ -152,19 +152,19 @@ void SdFieldPopup::Fill( LanguageType eLanguage ) void SdFieldPopup::Execute(weld::Window* pParent, const tools::Rectangle& rRect) { OString sIdent = m_xPopup->popup_at_rect(pParent, rRect); - if (!sIdent.isEmpty()) + if (sIdent.isEmpty()) + return; + + if (sIdent == "1" || sIdent == "2") { - if (sIdent == "1" || sIdent == "2") - { - m_xPopup->set_active("1", sIdent == "1"); - m_xPopup->set_active("2", sIdent == "2"); - } - else - { - int nCount = m_xPopup->n_children(); - for (int i = 3; i < nCount; i++) - m_xPopup->set_active(OString::number(i), sIdent == OString::number(i)); - } + m_xPopup->set_active("1", sIdent == "1"); + m_xPopup->set_active("2", sIdent == "2"); + } + else + { + int nCount = m_xPopup->n_children(); + for (int i = 3; i < nCount; i++) + m_xPopup->set_active(OString::number(i), sIdent == OString::number(i)); } } diff --git a/sdext/source/presenter/PresenterAccessibility.cxx b/sdext/source/presenter/PresenterAccessibility.cxx index 768f4717a48d..c57cf61c946c 100644 --- a/sdext/source/presenter/PresenterAccessibility.cxx +++ b/sdext/source/presenter/PresenterAccessibility.cxx @@ -1105,18 +1105,17 @@ void PresenterAccessible::AccessibleObject::UpdateState( const bool bValue) { const sal_uInt32 nStateMask (AccessibleStateSet::GetStateMask(nState)); - if (((mnStateSet & nStateMask)!=0) != bValue) + if (((mnStateSet & nStateMask) != 0) == bValue) + return; + if (bValue) { - if (bValue) - { - mnStateSet |= nStateMask; - FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(), Any(nState)); - } - else - { - mnStateSet &= ~nStateMask; - FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(nState), Any()); - } + mnStateSet |= nStateMask; + FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(), Any(nState)); + } + else + { + mnStateSet &= ~nStateMask; + FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(nState), Any()); } } diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index ca822d0c3487..137591a43991 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -356,39 +356,39 @@ void RecentDocsView::Paint(vcl::RenderContext& rRenderContext, const tools::Rect { ThumbnailView::Paint(rRenderContext, aRect); - if (mItemList.empty()) + if (!mItemList.empty()) + return; + + if (maWelcomeImage.IsEmpty()) { - if (maWelcomeImage.IsEmpty()) - { - const tools::Long aWidth(aRect.GetWidth() > aRect.getHeight() ? aRect.GetHeight()/2 : aRect.GetWidth()/2); - maWelcomeImage = SfxApplication::GetApplicationLogo(aWidth); - } + const tools::Long aWidth(aRect.GetWidth() > aRect.getHeight() ? aRect.GetHeight()/2 : aRect.GetWidth()/2); + maWelcomeImage = SfxApplication::GetApplicationLogo(aWidth); + } - // No recent files to be shown yet. Show a welcome screen. - rRenderContext.Push(PushFlags::FONT | PushFlags::TEXTCOLOR); - SetMessageFont(rRenderContext); - rRenderContext.SetTextColor(maTextColor); + // No recent files to be shown yet. Show a welcome screen. + rRenderContext.Push(PushFlags::FONT | PushFlags::TEXTCOLOR); + SetMessageFont(rRenderContext); + rRenderContext.SetTextColor(maTextColor); - tools::Long nTextHeight = rRenderContext.GetTextHeight(); + tools::Long nTextHeight = rRenderContext.GetTextHeight(); - const Size& rImgSize = maWelcomeImage.GetSizePixel(); - const Size& rSize = GetOutputSizePixel(); + const Size& rImgSize = maWelcomeImage.GetSizePixel(); + const Size& rSize = GetOutputSizePixel(); - const int nX = (rSize.Width() - rImgSize.Width())/2; - int nY = (rSize.Height() - 3 * nTextHeight - rImgSize.Height())/2; - Point aImgPoint(nX, nY); - rRenderContext.DrawBitmapEx(aImgPoint, rImgSize, maWelcomeImage); + const int nX = (rSize.Width() - rImgSize.Width())/2; + int nY = (rSize.Height() - 3 * nTextHeight - rImgSize.Height())/2; + Point aImgPoint(nX, nY); + rRenderContext.DrawBitmapEx(aImgPoint, rImgSize, maWelcomeImage); - nY = nY + rImgSize.Height(); - rRenderContext.DrawText(tools::Rectangle(0, nY + 1 * nTextHeight, rSize.Width(), nY + nTextHeight), - maWelcomeLine1, - DrawTextFlags::Center); - rRenderContext.DrawText(tools::Rectangle(0, nY + 2 * nTextHeight, rSize.Width(), rSize.Height()), - maWelcomeLine2, - DrawTextFlags::MultiLine | DrawTextFlags::WordBreak | DrawTextFlags::Center); + nY = nY + rImgSize.Height(); + rRenderContext.DrawText(tools::Rectangle(0, nY + 1 * nTextHeight, rSize.Width(), nY + nTextHeight), + maWelcomeLine1, + DrawTextFlags::Center); + rRenderContext.DrawText(tools::Rectangle(0, nY + 2 * nTextHeight, rSize.Width(), rSize.Height()), + maWelcomeLine2, + DrawTextFlags::MultiLine | DrawTextFlags::WordBreak | DrawTextFlags::Center); - rRenderContext.Pop(); - } + rRenderContext.Pop(); } void RecentDocsView::LoseFocus() diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx index b56cb02cdb30..a57021b37a19 100644 --- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx +++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx @@ -1087,39 +1087,39 @@ IMPL_LINK(ObjectInspectorTreeHandler, NotebookEnterPage, const OString&, rPageId mpObjectInspectorWidgets->mpTextView->hide(); uno::Any aAny = maInspectionStack.back(); - if (aAny.hasValue()) + if (!aAny.hasValue()) + return; + + uno::Reference xInterface(aAny, uno::UNO_QUERY); + if (rPageId == "object_inspector_interfaces_tab") { - uno::Reference xInterface(aAny, uno::UNO_QUERY); - if (rPageId == "object_inspector_interfaces_tab") - { - mpObjectInspectorWidgets->mpInterfacesTreeView->freeze(); - clearAll(mpObjectInspectorWidgets->mpInterfacesTreeView); - appendInterfaces(xInterface); - mpObjectInspectorWidgets->mpInterfacesTreeView->thaw(); - } - else if (rPageId == "object_inspector_services_tab") - { - mpObjectInspectorWidgets->mpServicesTreeView->freeze(); - clearAll(mpObjectInspectorWidgets->mpServicesTreeView); - appendServices(xInterface); - mpObjectInspectorWidgets->mpServicesTreeView->thaw(); - } - else if (rPageId == "object_inspector_properties_tab") - { - mbPanedResetSize = true; - mpObjectInspectorWidgets->mpPropertiesTreeView->freeze(); - clearAll(mpObjectInspectorWidgets->mpPropertiesTreeView); - appendProperties(xInterface); - mpObjectInspectorWidgets->mpPropertiesTreeView->thaw(); - mpObjectInspectorWidgets->mpTextView->show(); - } - else if (rPageId == "object_inspector_methods_tab") - { - mpObjectInspectorWidgets->mpMethodsTreeView->freeze(); - clearAll(mpObjectInspectorWidgets->mpMethodsTreeView); - appendMethods(xInterface); - mpObjectInspectorWidgets->mpMethodsTreeView->thaw(); - } + mpObjectInspectorWidgets->mpInterfacesTreeView->freeze(); + clearAll(mpObjectInspectorWidgets->mpInterfacesTreeView); + appendInterfaces(xInterface); + mpObjectInspectorWidgets->mpInterfacesTreeView->thaw(); + } + else if (rPageId == "object_inspector_services_tab") + { + mpObjectInspectorWidgets->mpServicesTreeView->freeze(); + clearAll(mpObjectInspectorWidgets->mpServicesTreeView); + appendServices(xInterface); + mpObjectInspectorWidgets->mpServicesTreeView->thaw(); + } + else if (rPageId == "object_inspector_properties_tab") + { + mbPanedResetSize = true; + mpObjectInspectorWidgets->mpPropertiesTreeView->freeze(); + clearAll(mpObjectInspectorWidgets->mpPropertiesTreeView); + appendProperties(xInterface); + mpObjectInspectorWidgets->mpPropertiesTreeView->thaw(); + mpObjectInspectorWidgets->mpTextView->show(); + } + else if (rPageId == "object_inspector_methods_tab") + { + mpObjectInspectorWidgets->mpMethodsTreeView->freeze(); + clearAll(mpObjectInspectorWidgets->mpMethodsTreeView); + appendMethods(xInterface); + mpObjectInspectorWidgets->mpMethodsTreeView->thaw(); } } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index f5d5cd441831..8eaca3d639f2 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -448,23 +448,23 @@ uno::Reference SfxObjectShell::GetSignPDFCertificate() c static void sendErrorToLOK(ErrCode error) { - if (error.GetClass() != ErrCodeClass::NONE) - { - boost::property_tree::ptree aTree; - aTree.put("code", error); - aTree.put("kind", ""); - aTree.put("cmd", ""); + if (error.GetClass() == ErrCodeClass::NONE) + return; - std::unique_ptr pInfo = ErrorInfo::GetErrorInfo(error); - OUString aErr; - if (ErrorStringFactory::CreateString(pInfo.get(), aErr)) - aTree.put("message", aErr.toUtf8()); + boost::property_tree::ptree aTree; + aTree.put("code", error); + aTree.put("kind", ""); + aTree.put("cmd", ""); - std::stringstream aStream; - boost::property_tree::write_json(aStream, aTree); + std::unique_ptr pInfo = ErrorInfo::GetErrorInfo(error); + OUString aErr; + if (ErrorStringFactory::CreateString(pInfo.get(), aErr)) + aTree.put("message", aErr.toUtf8()); - SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, aStream.str().c_str()); - } + std::stringstream aStream; + boost::property_tree::write_json(aStream, aTree); + + SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, aStream.str().c_str()); } void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx index 3752e7df8fe4..aea8b9b651ee 100644 --- a/sfx2/source/sidebar/DeckLayouter.cxx +++ b/sfx2/source/sidebar/DeckLayouter.cxx @@ -116,22 +116,22 @@ void DeckLayouter::LayoutDeck ( return; tools::Rectangle aBox(PlaceDeckTitle(pDockingWindow, rDeckTitleBar, rContentArea)); - if ( ! rPanels.empty()) - { - // Prepare the layout item container. - ::std::vector aLayoutItems; - aLayoutItems.reserve(rPanels.size()); - for (auto& rPanel : rPanels) - aLayoutItems.emplace_back(rPanel); + if ( rPanels.empty()) + return; - LayoutPanels( - aBox, - rMinimalWidth, - rMinimalHeight, - aLayoutItems, - rVerticalScrollBar, - false); - } + // Prepare the layout item container. + ::std::vector aLayoutItems; + aLayoutItems.reserve(rPanels.size()); + for (auto& rPanel : rPanels) + aLayoutItems.emplace_back(rPanel); + + LayoutPanels( + aBox, + rMinimalWidth, + rMinimalHeight, + aLayoutItems, + rVerticalScrollBar, + false); } namespace { diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx index 2a59ad7ef163..ca48542d5403 100644 --- a/sfx2/source/sidebar/Sidebar.cxx +++ b/sfx2/source/sidebar/Sidebar.cxx @@ -41,22 +41,23 @@ void Sidebar::ToggleDeck(std::u16string_view rsDeckId, SfxViewFrame* pViewFrame) if (!bInitiallyVisible) pViewFrame->ShowChildWindow(SID_SIDEBAR); - if (SidebarController* pController = - SidebarController::GetSidebarControllerForFrame(pViewFrame->GetFrame().GetFrameInterface())) + SidebarController* pController = + SidebarController::GetSidebarControllerForFrame(pViewFrame->GetFrame().GetFrameInterface()); + if (!pController) + return; + + if (bInitiallyVisible && pController->IsDeckVisible(rsDeckId)) { - if (bInitiallyVisible && pController->IsDeckVisible(rsDeckId)) - { - // close the sidebar if it was already visible and showing this sidebar deck - const util::URL aURL(Tools::GetURL(".uno:Sidebar")); - css::uno::Reference xDispatch(Tools::GetDispatch(pViewFrame->GetFrame().GetFrameInterface(), aURL)); - if (xDispatch.is()) - xDispatch->dispatch(aURL, css::uno::Sequence()); - } - else - { - pController->OpenThenSwitchToDeck(rsDeckId); - pController->GetFocusManager().GrabFocusPanel(); - } + // close the sidebar if it was already visible and showing this sidebar deck + const util::URL aURL(Tools::GetURL(".uno:Sidebar")); + css::uno::Reference xDispatch(Tools::GetDispatch(pViewFrame->GetFrame().GetFrameInterface(), aURL)); + if (xDispatch.is()) + xDispatch->dispatch(aURL, css::uno::Sequence()); + } + else + { + pController->OpenThenSwitchToDeck(rsDeckId); + pController->GetFocusManager().GrabFocusPanel(); } } diff --git a/slideshow/source/engine/animationfactory.cxx b/slideshow/source/engine/animationfactory.cxx index e874b0924cd8..e5a7d3b9e74c 100644 --- a/slideshow/source/engine/animationfactory.cxx +++ b/slideshow/source/engine/animationfactory.cxx @@ -278,21 +278,21 @@ namespace slideshow::internal virtual void end() override { end_(); } void end_() { - if( mbAnimationStarted ) - { - mbAnimationStarted = false; + if( !mbAnimationStarted ) + return; - if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) ) - mpShapeManager->leaveAnimationMode( mpShape ); + mbAnimationStarted = false; - if( mpShape->isContentChanged() ) - mpShapeManager->notifyShapeUpdate( mpShape ); + if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) ) + mpShapeManager->leaveAnimationMode( mpShape ); - // if there is a physics animation going on report the animation ending - // and zero out the velocity of the shape - if( mpBox2DWorld->isInitialized() ) - mpBox2DWorld->queueLinearVelocityUpdate( mpShape->getXShape(), {0,0}); - } + if( mpShape->isContentChanged() ) + mpShapeManager->notifyShapeUpdate( mpShape ); + + // if there is a physics animation going on report the animation ending + // and zero out the velocity of the shape + if( mpBox2DWorld->isInitialized() ) + mpBox2DWorld->queueLinearVelocityUpdate( mpShape->getXShape(), {0,0}); } // NumberAnimation interface @@ -441,25 +441,25 @@ namespace slideshow::internal mpBox2DWorld->setHasWorldStepper(false); } - if( mbAnimationStarted ) - { - mbAnimationStarted = false; + if( !mbAnimationStarted ) + return; - if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) ) - mpShapeManager->leaveAnimationMode( mpShape ); + mbAnimationStarted = false; - if( mpShape->isContentChanged() ) - mpShapeManager->notifyShapeUpdate( mpShape ); + if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) ) + mpShapeManager->leaveAnimationMode( mpShape ); - mpBox2DWorld->alertPhysicsAnimationEnd(mpShape); - // if this was the only physics animation effect going on - // all box2d bodies were destroyed on alertPhysicsAnimationEnd - // except the one owned by the animation. - // Try to destroy the remaining body - if it is unique - // (it being unique means all physics animation effects have ended - // since otherwise mpBox2DWorld would own a copy of the shared_ptr ) - mpBox2DBody.reset(); - } + if( mpShape->isContentChanged() ) + mpShapeManager->notifyShapeUpdate( mpShape ); + + mpBox2DWorld->alertPhysicsAnimationEnd(mpShape); + // if this was the only physics animation effect going on + // all box2d bodies were destroyed on alertPhysicsAnimationEnd + // except the one owned by the animation. + // Try to destroy the remaining body - if it is unique + // (it being unique means all physics animation effects have ended + // since otherwise mpBox2DWorld would own a copy of the shared_ptr ) + mpBox2DBody.reset(); } diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx index 57787dc5404a..33eb25b9b8d7 100644 --- a/starmath/source/mathml/mathmlimport.cxx +++ b/starmath/source/mathml/mathmlimport.cxx @@ -694,23 +694,23 @@ void SmXMLContext_Helper::ApplyAttrs() } // If not known, not implemented yet. Giving up. } - if (!sFontFamily.isEmpty()) - { - if (sFontFamily.equalsIgnoreAsciiCase(GetXMLToken(XML_FIXED))) - aToken.eType = TFIXED; - else if (sFontFamily.equalsIgnoreAsciiCase("sans")) - aToken.eType = TSANS; - else if (sFontFamily.equalsIgnoreAsciiCase("serif")) - aToken.eType = TSERIF; - else //Just give up, we need to extend our font mechanism to be - //more general - return; + if (sFontFamily.isEmpty()) + return; - aToken.aText = sFontFamily; - std::unique_ptr pFontNode(new SmFontNode(aToken)); - pFontNode->SetSubNodes(nullptr, popOrZero(rNodeStack)); - rNodeStack.push_front(std::move(pFontNode)); - } + if (sFontFamily.equalsIgnoreAsciiCase(GetXMLToken(XML_FIXED))) + aToken.eType = TFIXED; + else if (sFontFamily.equalsIgnoreAsciiCase("sans")) + aToken.eType = TSANS; + else if (sFontFamily.equalsIgnoreAsciiCase("serif")) + aToken.eType = TSERIF; + else //Just give up, we need to extend our font mechanism to be + //more general + return; + + aToken.aText = sFontFamily; + std::unique_ptr pFontNode(new SmFontNode(aToken)); + pFontNode->SetSubNodes(nullptr, popOrZero(rNodeStack)); + rNodeStack.push_front(std::move(pFontNode)); } namespace diff --git a/svtools/source/misc/sampletext.cxx b/svtools/source/misc/sampletext.cxx index 13809a57eb12..c59f5a7a43ec 100644 --- a/svtools/source/misc/sampletext.cxx +++ b/svtools/source/misc/sampletext.cxx @@ -932,8 +932,10 @@ namespace SAL_INFO("svtools", "RESERVED3"); if (rIn[vcl::UnicodeCoverage::RESERVED4]) SAL_INFO("svtools", "RESERVED4"); - if (rIn[vcl::UnicodeCoverage::RESERVED5]) - SAL_INFO("svtools", "RESERVED5"); + if (!(rIn[vcl::UnicodeCoverage::RESERVED5])) + return; + + SAL_INFO("svtools", "RESERVED5"); } void lcl_dump_codepage_coverage(const std::optional> &roIn) @@ -1009,8 +1011,10 @@ namespace SAL_INFO("svtools", "CP780"); if (rIn[vcl::CodePageCoverage::CP850]) SAL_INFO("svtools", "CP850"); - if (rIn[vcl::CodePageCoverage::CP437]) - SAL_INFO("svtools", "CP437"); + if (!(rIn[vcl::CodePageCoverage::CP437])) + return; + + SAL_INFO("svtools", "CP437"); } #endif diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index 87fe7fa79b39..b38317f5c579 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -192,21 +192,21 @@ void SvxNumberFormatShell::LanguageChanged(LanguageType eLangType, short& rFmtSe void SvxNumberFormatShell::FormatChanged(sal_uInt16 nFmtLbPos, OUString& rPreviewStr, const Color*& rpFontColor) { - if (static_cast(nFmtLbPos) < aCurEntryList.size()) - { - nCurFormatKey = aCurEntryList[nFmtLbPos]; + if (static_cast(nFmtLbPos) >= aCurEntryList.size()) + return; - if (nCurFormatKey != NUMBERFORMAT_ENTRY_NOT_FOUND) - { - GetPreviewString_Impl(rPreviewStr, rpFontColor); - } - else if (nCurCategory == SvNumFormatType::CURRENCY) + nCurFormatKey = aCurEntryList[nFmtLbPos]; + + if (nCurFormatKey != NUMBERFORMAT_ENTRY_NOT_FOUND) + { + GetPreviewString_Impl(rPreviewStr, rpFontColor); + } + else if (nCurCategory == SvNumFormatType::CURRENCY) + { + if (static_cast(nFmtLbPos) < aCurrencyFormatList.size()) { - if (static_cast(nFmtLbPos) < aCurrencyFormatList.size()) - { - MakePrevStringFromVal(aCurrencyFormatList[nFmtLbPos], rPreviewStr, rpFontColor, - nValNum); - } + MakePrevStringFromVal(aCurrencyFormatList[nFmtLbPos], rPreviewStr, rpFontColor, + nValNum); } } } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 71272cb85a20..8b4dccd1c2e0 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1788,25 +1788,25 @@ void SdrObject::SetOutlinerParaObject(std::unique_ptr pTextO SendUserCall(SdrUserCallType::Resize,aBoundRect0); } - if (getSdrModelFromSdrObject().IsUndoEnabled()) + if (!getSdrModelFromSdrObject().IsUndoEnabled()) + return; + + // Don't do this during import. + SdrObject* pTopGroupObj = nullptr; + if (getParentSdrObjectFromSdrObject()) { - // Don't do this during import. - SdrObject* pTopGroupObj = nullptr; - if (getParentSdrObjectFromSdrObject()) - { - pTopGroupObj = getParentSdrObjectFromSdrObject(); - while (pTopGroupObj->getParentSdrObjectFromSdrObject()) - { - pTopGroupObj = pTopGroupObj->getParentSdrObjectFromSdrObject(); - } - } - if (pTopGroupObj) + pTopGroupObj = getParentSdrObjectFromSdrObject(); + while (pTopGroupObj->getParentSdrObjectFromSdrObject()) { - // A shape was modified, which is in a group shape. Empty the group shape's grab-bag, - // which potentially contains the old text of the shapes in case of diagrams. - pTopGroupObj->SetGrabBagItem(uno::makeAny(uno::Sequence())); + pTopGroupObj = pTopGroupObj->getParentSdrObjectFromSdrObject(); } } + if (pTopGroupObj) + { + // A shape was modified, which is in a group shape. Empty the group shape's grab-bag, + // which potentially contains the old text of the shapes in case of diagrams. + pTopGroupObj->SetGrabBagItem(uno::makeAny(uno::Sequence())); + } } void SdrObject::NbcSetOutlinerParaObject(std::unique_ptr /*pTextObject*/) diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 3e11292b40f1..15f612c1f4e7 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -726,28 +726,28 @@ SdrOle2Obj::SdrOle2Obj(SdrModel& rSdrModel, SdrOle2Obj const & rSource) mpImpl->mxGraphic.reset(new Graphic(*rSource.mpImpl->mxGraphic)); } - if( !IsEmptyPresObj() ) - { - ::comphelper::IEmbeddedHelper* pDestPers(getSdrModelFromSdrObject().GetPersist()); - ::comphelper::IEmbeddedHelper* pSrcPers(rSource.getSdrModelFromSdrObject().GetPersist()); - if( pDestPers && pSrcPers ) - { - DBG_ASSERT( !mpImpl->mxObjRef.is(), "Object already existing!" ); - comphelper::EmbeddedObjectContainer& rContainer = pSrcPers->getEmbeddedObjectContainer(); - uno::Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( mpImpl->aPersistName ); - if ( xObj.is() ) - { - OUString aTmp; - mpImpl->mxObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( - rContainer, xObj, aTmp, pSrcPers->getDocumentBaseURL(), pDestPers->getDocumentBaseURL()), rSource.GetAspect()); - mpImpl->mbTypeAsked = false; - mpImpl->aPersistName = aTmp; - CheckFileLink_Impl(); - } + if( IsEmptyPresObj() ) + return; - Connect(); - } + ::comphelper::IEmbeddedHelper* pDestPers(getSdrModelFromSdrObject().GetPersist()); + ::comphelper::IEmbeddedHelper* pSrcPers(rSource.getSdrModelFromSdrObject().GetPersist()); + if( !(pDestPers && pSrcPers) ) + return; + + DBG_ASSERT( !mpImpl->mxObjRef.is(), "Object already existing!" ); + comphelper::EmbeddedObjectContainer& rContainer = pSrcPers->getEmbeddedObjectContainer(); + uno::Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( mpImpl->aPersistName ); + if ( xObj.is() ) + { + OUString aTmp; + mpImpl->mxObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject( + rContainer, xObj, aTmp, pSrcPers->getDocumentBaseURL(), pDestPers->getDocumentBaseURL()), rSource.GetAspect()); + mpImpl->mbTypeAsked = false; + mpImpl->aPersistName = aTmp; + CheckFileLink_Impl(); } + + Connect(); } SdrOle2Obj::SdrOle2Obj( diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index 82589ef9f715..071b2baf06c1 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -744,24 +744,23 @@ public: // If outline level stands for heading level... const int currentLevel = pTextNode->GetAttrOutlineLevel(); - if (currentLevel) + if (!currentLevel) + return; + + // ... and if is bigger than previous by more than 1, warn. + if (currentLevel - m_prevLevel > 1) { - // ... and if is bigger than previous by more than 1, warn. - if (currentLevel - m_prevLevel > 1) - { - // Preparing and posting a warning. - OUString resultString = SwResId(STR_HEADING_ORDER); - resultString - = resultString.replaceAll("%LEVEL_CURRENT%", OUString::number(currentLevel)); - resultString - = resultString.replaceAll("%LEVEL_PREV%", OUString::number(m_prevLevel)); - - lclAddIssue(m_rIssueCollection, resultString); - } + // Preparing and posting a warning. + OUString resultString = SwResId(STR_HEADING_ORDER); + resultString + = resultString.replaceAll("%LEVEL_CURRENT%", OUString::number(currentLevel)); + resultString = resultString.replaceAll("%LEVEL_PREV%", OUString::number(m_prevLevel)); - // Updating previous level. - m_prevLevel = currentLevel; + lclAddIssue(m_rIssueCollection, resultString); } + + // Updating previous level. + m_prevLevel = currentLevel; } private: diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index abe8f38d2124..9bcd522e4277 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -168,21 +168,21 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, bool bCopyText) // TODO: Text dialog attr setting to frame // Check if the shape had text before and move it to the new textframe - if (bCopyText && !sCopyableText.isEmpty()) + if (!bCopyText || sCopyableText.isEmpty()) + return; + + auto pSdrShape = pShape->FindRealSdrObject(); + if (pSdrShape) { - auto pSdrShape = pShape->FindRealSdrObject(); - if (pSdrShape) - { - auto pSourceText = dynamic_cast(pSdrShape); - uno::Reference xDestText(xRealTextFrame, uno::UNO_QUERY); + auto pSourceText = dynamic_cast(pSdrShape); + uno::Reference xDestText(xRealTextFrame, uno::UNO_QUERY); - xDestText->setString(sCopyableText); + xDestText->setString(sCopyableText); - if (pSourceText) - pSourceText->SetText(OUString()); + if (pSourceText) + pSourceText->SetText(OUString()); - pShape->GetDoc()->getIDocumentState().SetModified(); - } + pShape->GetDoc()->getIDocumentState().SetModified(); } } diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index b13c8fe662ce..26647f2355cf 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -1197,22 +1197,22 @@ void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/, bool const // If the Area is within a Fly or TableBox, we can only hide it if // there is more Content which has Frames. // Or else the Fly/TableBox Frame does not have a Lower! - if (!bForce) + if (bForce) + return; + + SwNodeIndex aIdx( *this ); + if( !SwNodes::GoPrevSection( &aIdx, true, false ) || + !CheckNodesRange( *this, aIdx, true ) || + // #i21457# + !lcl_IsInSameTableBox( rNds, *this, true )) { - SwNodeIndex aIdx( *this ); - if( !SwNodes::GoPrevSection( &aIdx, true, false ) || - !CheckNodesRange( *this, aIdx, true ) || + aIdx = *EndOfSectionNode(); + if( !rNds.GoNextSection( &aIdx, true, false ) || + !CheckNodesRange( *EndOfSectionNode(), aIdx, true ) || // #i21457# - !lcl_IsInSameTableBox( rNds, *this, true )) + !lcl_IsInSameTableBox( rNds, *EndOfSectionNode(), false )) { - aIdx = *EndOfSectionNode(); - if( !rNds.GoNextSection( &aIdx, true, false ) || - !CheckNodesRange( *EndOfSectionNode(), aIdx, true ) || - // #i21457# - !lcl_IsInSameTableBox( rNds, *EndOfSectionNode(), false )) - { - m_pSection->m_Data.SetHiddenFlag(false); - } + m_pSection->m_Data.SetHiddenFlag(false); } } } diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 7d152920af9a..38582a4143e3 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -405,23 +405,23 @@ public: MakeAllOutlineContentTemporarilyVisibile(SwWrtShell* pShell) : pWrtShell(pShell) { - if (pWrtShell && pWrtShell->GetViewOptions() && pWrtShell->GetViewOptions()->IsShowOutlineContentVisibilityButton()) + if (!(pWrtShell && pWrtShell->GetViewOptions() && pWrtShell->GetViewOptions()->IsShowOutlineContentVisibilityButton())) + return; + + // make all outlines content visible and store outline nodes having + // content visible attribute value false + SwOutlineNodes rOutlineNds = pWrtShell->GetNodes().GetOutLineNds(); + for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNds.size(); ++nPos) { - // make all outlines content visible and store outline nodes having - // content visible attribute value false - SwOutlineNodes rOutlineNds = pWrtShell->GetNodes().GetOutLineNds(); - for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNds.size(); ++nPos) + SwNode* pNd = rOutlineNds[nPos]; + if (pNd->IsTextNode()) // should always be true { - SwNode* pNd = rOutlineNds[nPos]; - if (pNd->IsTextNode()) // should always be true + bool bOutlineContentVisibleAttr = true; + pNd->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); + if (!bOutlineContentVisibleAttr) { - bool bOutlineContentVisibleAttr = true; - pNd->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr); - if (!bOutlineContentVisibleAttr) - { - aOutlineNdsArray.push_back(pNd); - pWrtShell->ToggleOutlineContentVisibility(nPos); - } + aOutlineNdsArray.push_back(pNd); + pWrtShell->ToggleOutlineContentVisibility(nPos); } } } diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index ceb9a65a38a9..6dcf1b756ed4 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1048,20 +1048,20 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, default: bClear = false; } - if ( bClear ) + if ( !bClear ) + return; + + if ( pOldSet || pNewSet ) { - if ( pOldSet || pNewSet ) - { - if ( pOldSet ) - pOldSet->ClearItem( nWhich ); - if ( pNewSet ) - pNewSet->ClearItem( nWhich ); - } - else - { - SwModify aMod; - SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); - } + if ( pOldSet ) + pOldSet->ClearItem( nWhich ); + if ( pNewSet ) + pNewSet->ClearItem( nWhich ); + } + else + { + SwModify aMod; + SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); } } diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx index 1ea4a63fb56c..1036ea3f05c3 100644 --- a/sw/source/core/layout/objectformattertxtfrm.cxx +++ b/sw/source/core/layout/objectformattertxtfrm.cxx @@ -639,20 +639,20 @@ static void CleanupEmptyFootnoteFrame(SwFrame* pLowerFrame) // but now we have to clean up empty footnote frames to prevent crashes. // Note: check it at this level, not lower: both container and footnote // can be deleted at the same time! - if (pLowerFrame->IsFootnoteContFrame()) + if (!pLowerFrame->IsFootnoteContFrame()) + return; + + for (SwFrame * pFootnote = pLowerFrame->GetLower(); pFootnote; ) { - for (SwFrame * pFootnote = pLowerFrame->GetLower(); pFootnote; ) + assert(pFootnote->IsFootnoteFrame()); + SwFrame *const pNextNote = pFootnote->GetNext(); + if (!pFootnote->IsDeleteForbidden() && !pFootnote->GetLower() && !pFootnote->IsColLocked() && + !static_cast(pFootnote)->IsBackMoveLocked()) { - assert(pFootnote->IsFootnoteFrame()); - SwFrame *const pNextNote = pFootnote->GetNext(); - if (!pFootnote->IsDeleteForbidden() && !pFootnote->GetLower() && !pFootnote->IsColLocked() && - !static_cast(pFootnote)->IsBackMoveLocked()) - { - pFootnote->Cut(); - SwFrame::DestroyFrame(pFootnote); - } - pFootnote = pNextNote; + pFootnote->Cut(); + SwFrame::DestroyFrame(pFootnote); } + pFootnote = pNextNote; } } diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 1bc8d05a8167..76ffb60c89a2 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -698,20 +698,20 @@ void SwPageFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, default: bClear = false; } - if ( bClear ) + if ( !bClear ) + return; + + if ( pOldSet || pNewSet ) { - if ( pOldSet || pNewSet ) - { - if ( pOldSet ) - pOldSet->ClearItem( nWhich ); - if ( pNewSet ) - pNewSet->ClearItem( nWhich ); - } - else - { - SwModify aMod; - SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); - } + if ( pOldSet ) + pOldSet->ClearItem( nWhich ); + if ( pNewSet ) + pNewSet->ClearItem( nWhich ); + } + else + { + SwModify aMod; + SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); } } diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 0de0d2a5f296..7f738bbc3d5e 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -2715,20 +2715,20 @@ void SwSectionFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pN default: bClear = false; } - if ( bClear ) + if ( !bClear ) + return; + + if ( pOldSet || pNewSet ) { - if ( pOldSet || pNewSet ) - { - if ( pOldSet ) - pOldSet->ClearItem( nWhich ); - if ( pNewSet ) - pNewSet->ClearItem( nWhich ); - } - else - { - SwModify aMod; - SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); - } + if ( pOldSet ) + pOldSet->ClearItem( nWhich ); + if ( pNewSet ) + pNewSet->ClearItem( nWhich ); + } + else + { + SwModify aMod; + SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); } } diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index bbfaf327c96c..af675d8bd8b8 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3403,20 +3403,20 @@ void SwTabFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, default: bClear = false; } - if ( bClear ) + if ( !bClear ) + return; + + if ( pOldSet || pNewSet ) { - if ( pOldSet || pNewSet ) - { - if ( pOldSet ) - pOldSet->ClearItem( nWhich ); - if ( pNewSet ) - pNewSet->ClearItem( nWhich ); - } - else - { - SwModify aMod; - SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); - } + if ( pOldSet ) + pOldSet->ClearItem( nWhich ); + if ( pNewSet ) + pNewSet->ClearItem( nWhich ); + } + else + { + SwModify aMod; + SwLayoutFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); } } diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 10434529b67e..fccf94925187 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -2538,20 +2538,20 @@ void SwContentFrame::UpdateAttr_( const SfxPoolItem* pOld, const SfxPoolItem* pN default: bClear = false; } - if ( bClear ) + if ( !bClear ) + return; + + if ( pOldSet || pNewSet ) { - if ( pOldSet || pNewSet ) - { - if ( pOldSet ) - pOldSet->ClearItem( nWhich ); - if ( pNewSet ) - pNewSet->ClearItem( nWhich ); - } - else - { - SwModify aMod; - SwFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); - } + if ( pOldSet ) + pOldSet->ClearItem( nWhich ); + if ( pNewSet ) + pNewSet->ClearItem( nWhich ); + } + else + { + SwModify aMod; + SwFrame::SwClientNotify(aMod, sw::LegacyModifyHint(pOld, pNew)); } } diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 7097bcd90f9d..6f578e0744cd 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -114,39 +114,39 @@ SwLinePortion *SwBreakPortion::Compress() void SwBreakPortion::Paint( const SwTextPaintInfo &rInf ) const { - if( rInf.OnWin() && rInf.GetOpt().IsLineBreak() ) - { - rInf.DrawLineBreak( *this ); + if( !(rInf.OnWin() && rInf.GetOpt().IsLineBreak()) ) + return; - // paint redlining - if (m_eRedline != RedlineType::None) + rInf.DrawLineBreak( *this ); + + // paint redlining + if (m_eRedline != RedlineType::None) + { + sal_Int16 nNoBreakWidth = rInf.GetTextSize(S_NOBREAK_FOR_REDLINE).Width(); + if ( nNoBreakWidth > 0 ) { - sal_Int16 nNoBreakWidth = rInf.GetTextSize(S_NOBREAK_FOR_REDLINE).Width(); - if ( nNoBreakWidth > 0 ) - { - // approximate portion size with multiple no-break spaces - // and draw these spaces (at least a single one) by DrawText - // painting the requested redline underline/strikeout - sal_Int16 nSpaces = (LINE_BREAK_WIDTH + nNoBreakWidth/2) / nNoBreakWidth; - OUStringBuffer aBuf(S_NOBREAK_FOR_REDLINE); - for (sal_Int16 i = 1; i < nSpaces; ++i) - aBuf.append(S_NOBREAK_FOR_REDLINE); + // approximate portion size with multiple no-break spaces + // and draw these spaces (at least a single one) by DrawText + // painting the requested redline underline/strikeout + sal_Int16 nSpaces = (LINE_BREAK_WIDTH + nNoBreakWidth/2) / nNoBreakWidth; + OUStringBuffer aBuf(S_NOBREAK_FOR_REDLINE); + for (sal_Int16 i = 1; i < nSpaces; ++i) + aBuf.append(S_NOBREAK_FOR_REDLINE); - const SwFont* pOldFnt = rInf.GetFont(); + const SwFont* pOldFnt = rInf.GetFont(); - SwFont aFont(*pOldFnt); + SwFont aFont(*pOldFnt); - if (m_eRedline == RedlineType::Delete) - aFont.SetUnderline( LINESTYLE_NONE ); - else - aFont.SetStrikeout( STRIKEOUT_NONE ); + if (m_eRedline == RedlineType::Delete) + aFont.SetUnderline( LINESTYLE_NONE ); + else + aFont.SetStrikeout( STRIKEOUT_NONE ); - const_cast(rInf).SetFont(&aFont); + const_cast(rInf).SetFont(&aFont); - rInf.DrawText(aBuf.makeStringAndClear(), *this); + rInf.DrawText(aBuf.makeStringAndClear(), *this); - const_cast(rInf).SetFont(const_cast(pOldFnt)); - } + const_cast(rInf).SetFont(const_cast(pOldFnt)); } } } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 46d19f82cec0..4b9c72829c3b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7543,18 +7543,18 @@ void DocxAttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement ) if ( !sIss.isEmpty() ) m_pSerializer->singleElementNS(XML_w, XML_vertAlign, FSNS(XML_w, XML_val), sIss); - if (sIss.isEmpty() || sIss.match("baseline")) - { - const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE); - float fHeight = rItem.GetHeight(); - OString sPos = OString::number( round(( fHeight * nEsc ) / 1000) ); - m_pSerializer->singleElementNS(XML_w, XML_position, FSNS(XML_w, XML_val), sPos); + if (!(sIss.isEmpty() || sIss.match("baseline"))) + return; - if( ( 100 != nProp || sIss.match( "baseline" ) ) && !m_rExport.m_bFontSizeWritten ) - { - OString sSize = OString::number( round(( fHeight * nProp ) / 1000) ); - m_pSerializer->singleElementNS(XML_w, XML_sz, FSNS(XML_w, XML_val), sSize); - } + const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE); + float fHeight = rItem.GetHeight(); + OString sPos = OString::number( round(( fHeight * nEsc ) / 1000) ); + m_pSerializer->singleElementNS(XML_w, XML_position, FSNS(XML_w, XML_val), sPos); + + if( ( 100 != nProp || sIss.match( "baseline" ) ) && !m_rExport.m_bFontSizeWritten ) + { + OString sSize = OString::number( round(( fHeight * nProp ) / 1000) ); + m_pSerializer->singleElementNS(XML_w, XML_sz, FSNS(XML_w, XML_val), sSize); } } diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.cxx b/sw/source/ui/dbui/dbtablepreviewdialog.cxx index d716aefbb689..6a2f0e916a25 100644 --- a/sw/source/ui/dbui/dbtablepreviewdialog.cxx +++ b/sw/source/ui/dbui/dbtablepreviewdialog.cxx @@ -88,19 +88,19 @@ SwDBTablePreviewDialog::SwDBTablePreviewDialog(weld::Window* pParent, uno::Seque { xFrame.clear(); } - if (xFrame.is()) - { - m_xFrameListener.set(new DBTablePreviewFrame(xFrame)); - xFrame->addEventListener(m_xFrameListener); + if (!xFrame.is()) + return; - util::URL aURL; - aURL.Complete = ".component:DB/DataSourceBrowser"; - uno::Reference xD = xFrame->queryDispatch(aURL, "", 0x0C); - if (xD.is()) - { - xD->dispatch(aURL, rValues); - m_xBeamerWIN->show(); - } + m_xFrameListener.set(new DBTablePreviewFrame(xFrame)); + xFrame->addEventListener(m_xFrameListener); + + util::URL aURL; + aURL.Complete = ".component:DB/DataSourceBrowser"; + uno::Reference xD = xFrame->queryDispatch(aURL, "", 0x0C); + if (xD.is()) + { + xD->dispatch(aURL, rValues); + m_xBeamerWIN->show(); } } diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx index b700b85d53fc..6ba513c4f2fb 100644 --- a/sw/source/ui/table/instable.cxx +++ b/sw/source/ui/table/instable.cxx @@ -259,22 +259,22 @@ IMPL_LINK( SwInsTableDlg, ModifyRowCol, weld::Entry&, rEdit, void ) { m_xWarning->set_visible(false); } - if (&rEdit != m_xColSpinButton.get()) - { - if(!nRow) - nRow = 1; + if (&rEdit == m_xColSpinButton.get()) + return; - // adjust depending NF for repeated rows - sal_Int64 nMax = ( nRow == 1 )? 1 : nRow - 1 ; - sal_Int64 nActVal = m_xRepeatHeaderNF->get_value(); + if(!nRow) + nRow = 1; - m_xRepeatHeaderNF->set_max( nMax ); + // adjust depending NF for repeated rows + sal_Int64 nMax = ( nRow == 1 )? 1 : nRow - 1 ; + sal_Int64 nActVal = m_xRepeatHeaderNF->get_value(); - if( nActVal > nMax ) - m_xRepeatHeaderNF->set_value( nMax ); - else if( nActVal < nEnteredValRepeatHeaderNF ) - m_xRepeatHeaderNF->set_value(std::min(nEnteredValRepeatHeaderNF, nMax)); - } + m_xRepeatHeaderNF->set_max( nMax ); + + if( nActVal > nMax ) + m_xRepeatHeaderNF->set_value( nMax ); + else if( nActVal < nEnteredValRepeatHeaderNF ) + m_xRepeatHeaderNF->set_value(std::min(nEnteredValRepeatHeaderNF, nMax)); } IMPL_LINK_NOARG(SwInsTableDlg, CheckBoxHdl, weld::ToggleButton&, void) diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 1ab2a7823092..9862da388021 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -426,23 +426,23 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) ApplyUsrPref( aViewOpt, pAppView, bTextDialog? SvViewOpt::DestText : SvViewOpt::DestWeb); // must be done after ApplyUsrPref - if (SfxItemState::SET == rSet.GetItemState(FN_PARAM_ELEM, false)) + if (SfxItemState::SET != rSet.GetItemState(FN_PARAM_ELEM, false)) + return; + + if (!GetActiveWrtShell()->GetViewOptions()->IsShowOutlineContentVisibilityButton()) { - if (!GetActiveWrtShell()->GetViewOptions()->IsShowOutlineContentVisibilityButton()) - { - // outline mode is no longer active - // set outline content visible attribute to false for nodes in the array - for (SwNode* pNd : aFoldedOutlineNdsArray) - pNd->GetTextNode()->SetAttrOutlineContentVisible(false); - } - else if (bShow) - { - // outline mode remained active - // sub level treatment might have changed - // ToggleOutlineContentVisibility only knows sub level treatment after ApplyUserPref - for (SwNode* pNd : aFoldedOutlineNdsArray) - GetActiveWrtShell()->ToggleOutlineContentVisibility(pNd, true); - } + // outline mode is no longer active + // set outline content visible attribute to false for nodes in the array + for (SwNode* pNd : aFoldedOutlineNdsArray) + pNd->GetTextNode()->SetAttrOutlineContentVisible(false); + } + else if (bShow) + { + // outline mode remained active + // sub level treatment might have changed + // ToggleOutlineContentVisibility only knows sub level treatment after ApplyUserPref + for (SwNode* pNd : aFoldedOutlineNdsArray) + GetActiveWrtShell()->ToggleOutlineContentVisibility(pNd, true); } } diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index 3c5de1f2b8ee..2f0fe44a21e9 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -206,25 +206,25 @@ void SidebarTextControl::DrawForPage(OutputDevice* pDev, const Point& rPt) pOutlinerView->GetOutliner()->Draw(pDev, tools::Rectangle(rPt, aSize)); } - if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED ) - { - pDev->Push(PushFlags::LINECOLOR); + if ( mrSidebarWin.GetLayoutStatus()!=SwPostItHelper::DELETED ) + return; - pDev->SetLineColor(mrSidebarWin.GetChangeColor()); - Point aBottomRight(rPt); - aBottomRight.Move(aSize); - pDev->DrawLine(rPt, aBottomRight); + pDev->Push(PushFlags::LINECOLOR); - Point aTopRight(rPt); - aTopRight.Move(Size(aSize.Width(), 0)); + pDev->SetLineColor(mrSidebarWin.GetChangeColor()); + Point aBottomRight(rPt); + aBottomRight.Move(aSize); + pDev->DrawLine(rPt, aBottomRight); - Point aBottomLeft(rPt); - aBottomLeft.Move(Size(0, aSize.Height())); + Point aTopRight(rPt); + aTopRight.Move(Size(aSize.Width(), 0)); - pDev->DrawLine(aTopRight, aBottomLeft); + Point aBottomLeft(rPt); + aBottomLeft.Move(Size(0, aSize.Height())); - pDev->Pop(); - } + pDev->DrawLine(aTopRight, aBottomLeft); + + pDev->Pop(); } void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index 5fd2438c63a0..6a88d7c1a072 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -850,22 +850,22 @@ void SAL_CALL NavElementToolBoxControl::statusChanged( const frame::FeatureState return; SolarMutexGuard aSolarMutexGuard; - if ( rEvent.FeatureURL.Path == "NavElement" ) + if ( rEvent.FeatureURL.Path != "NavElement" ) + return; + + if ( rEvent.IsEnabled ) { - if ( rEvent.IsEnabled ) - { - m_pBox->set_sensitive(true); - m_pBox->UpdateBox(); - } - else - m_pBox->set_sensitive(true); + m_pBox->set_sensitive(true); + m_pBox->UpdateBox(); + } + else + m_pBox->set_sensitive(true); - SwView* pView = GetActiveView(); - if (pView && pView->GetViewFrame()) - { - pView->GetViewFrame()->GetBindings().Invalidate(FN_SCROLL_NEXT); - pView->GetViewFrame()->GetBindings().Invalidate(FN_SCROLL_PREV); - } + SwView* pView = GetActiveView(); + if (pView && pView->GetViewFrame()) + { + pView->GetViewFrame()->GetBindings().Invalidate(FN_SCROLL_NEXT); + pView->GetViewFrame()->GetBindings().Invalidate(FN_SCROLL_PREV); } } diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index fe9da9cfc0e1..265f2b28dc90 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3165,34 +3165,34 @@ void SwContentTree::HideTree() static void lcl_SelectByContentTypeAndName(SwContentTree* pThis, weld::TreeView& rContentTree, std::u16string_view rContentTypeName, std::u16string_view rName) { - if (!rName.empty()) + if (rName.empty()) + return; + + // find content type entry + std::unique_ptr xIter(rContentTree.make_iterator()); + bool bFoundEntry = rContentTree.get_iter_first(*xIter); + while (bFoundEntry && rContentTypeName != rContentTree.get_text(*xIter)) + bFoundEntry = rContentTree.iter_next_sibling(*xIter); + // find content type content entry and select it + if (bFoundEntry) { - // find content type entry - std::unique_ptr xIter(rContentTree.make_iterator()); - bool bFoundEntry = rContentTree.get_iter_first(*xIter); - while (bFoundEntry && rContentTypeName != rContentTree.get_text(*xIter)) - bFoundEntry = rContentTree.iter_next_sibling(*xIter); - // find content type content entry and select it - if (bFoundEntry) + rContentTree.expand_row(*xIter); // assure content type entry is expanded + while (rContentTree.iter_next(*xIter) && lcl_IsContent(*xIter, rContentTree)) { - rContentTree.expand_row(*xIter); // assure content type entry is expanded - while (rContentTree.iter_next(*xIter) && lcl_IsContent(*xIter, rContentTree)) + if (rName == rContentTree.get_text(*xIter)) { - if (rName == rContentTree.get_text(*xIter)) + // get first selected for comparison + std::unique_ptr xFirstSelected(rContentTree.make_iterator()); + if (!rContentTree.get_selected(xFirstSelected.get())) + xFirstSelected.reset(); + if (rContentTree.count_selected_rows() != 1 || + rContentTree.iter_compare(*xIter, *xFirstSelected) != 0) { - // get first selected for comparison - std::unique_ptr xFirstSelected(rContentTree.make_iterator()); - if (!rContentTree.get_selected(xFirstSelected.get())) - xFirstSelected.reset(); - if (rContentTree.count_selected_rows() != 1 || - rContentTree.iter_compare(*xIter, *xFirstSelected) != 0) - { - // unselect all entries and make passed entry visible and selected - rContentTree.set_cursor(*xIter); - pThis->Select(); - } - break; + // unselect all entries and make passed entry visible and selected + rContentTree.set_cursor(*xIter); + pThis->Select(); } + break; } } } @@ -3405,41 +3405,41 @@ void SwContentTree::SelectOutlinesWithSelection() } } while (pCursor && pCursor != pFirstCursor); - if (!aOutlinePositions.empty()) - { - // remove duplicates before selecting - aOutlinePositions.erase(std::unique(aOutlinePositions.begin(), aOutlinePositions.end()), - aOutlinePositions.end()); + if (aOutlinePositions.empty()) + return; - m_xTreeView->unselect_all(); + // remove duplicates before selecting + aOutlinePositions.erase(std::unique(aOutlinePositions.begin(), aOutlinePositions.end()), + aOutlinePositions.end()); - for (auto nOutlinePosition : aOutlinePositions) - { - m_xTreeView->all_foreach([this, nOutlinePosition](const weld::TreeIter& rEntry){ - if (lcl_IsContent(rEntry, *m_xTreeView) && - reinterpret_cast( - m_xTreeView->get_id(rEntry).toInt64())->GetParent()->GetType() == - ContentTypeId::OUTLINE) + m_xTreeView->unselect_all(); + + for (auto nOutlinePosition : aOutlinePositions) + { + m_xTreeView->all_foreach([this, nOutlinePosition](const weld::TreeIter& rEntry){ + if (lcl_IsContent(rEntry, *m_xTreeView) && + reinterpret_cast( + m_xTreeView->get_id(rEntry).toInt64())->GetParent()->GetType() == + ContentTypeId::OUTLINE) + { + if (reinterpret_cast( + m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos() == + nOutlinePosition) { - if (reinterpret_cast( - m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos() == - nOutlinePosition) - { - std::unique_ptr xParent = - m_xTreeView->make_iterator(&rEntry); - if (m_xTreeView->iter_parent(*xParent) && - !m_xTreeView->get_row_expanded(*xParent)) - m_xTreeView->expand_row(*xParent); - m_xTreeView->select(rEntry); - return true; - } + std::unique_ptr xParent = + m_xTreeView->make_iterator(&rEntry); + if (m_xTreeView->iter_parent(*xParent) && + !m_xTreeView->get_row_expanded(*xParent)) + m_xTreeView->expand_row(*xParent); + m_xTreeView->select(rEntry); + return true; } - return false; - }); - } - - Select(); + } + return false; + }); } + + Select(); } void SwContentTree::MoveOutline(SwOutlineNodes::size_type nTargetPos) diff --git a/unoidl/source/legacyprovider.cxx b/unoidl/source/legacyprovider.cxx index a5062cdeb8d0..cadd1b855b31 100644 --- a/unoidl/source/legacyprovider.cxx +++ b/unoidl/source/legacyprovider.cxx @@ -96,18 +96,19 @@ Cursor::Cursor( RegistryKey const & key): manager_(manager), ucr_(ucr), key_(key), index_(0) { - if (ucr_.isValid()) { - prefix_ = key_.getName(); - if (!prefix_.endsWith("/")) { - prefix_ += "/"; - } - RegError e = key_.getKeyNames("", names_); - if (e != RegError::NO_ERROR) { - throw FileFormatException( - key_.getRegistryName(), - ("legacy format: cannot get sub-key names of " + key_.getName() - + ": " + OUString::number(static_cast(e)))); - } + if (!ucr_.isValid()) + return; + + prefix_ = key_.getName(); + if (!prefix_.endsWith("/")) { + prefix_ += "/"; + } + RegError e = key_.getKeyNames("", names_); + if (e != RegError::NO_ERROR) { + throw FileFormatException( + key_.getRegistryName(), + ("legacy format: cannot get sub-key names of " + key_.getName() + + ": " + OUString::number(static_cast(e)))); } } diff --git a/unoidl/source/unoidl-write.cxx b/unoidl/source/unoidl-write.cxx index 8ffcaa040d7d..b0fbc31e5023 100644 --- a/unoidl/source/unoidl-write.cxx +++ b/unoidl/source/unoidl-write.cxx @@ -419,28 +419,29 @@ void mapCursor( rtl::Reference< unoidl::MapCursor > const & cursor, std::map< OUString, Item > & map) { - if (cursor.is()) { - for (;;) { - OUString name; - rtl::Reference< unoidl::Entity > ent(cursor->getNext(&name)); - if (!ent.is()) { - break; - } - std::pair< std::map< OUString, Item >::iterator, bool > i( - map.insert(std::make_pair(name, Item(ent)))); - if (!i.second) { - std::cout << "Duplicate name \"" << name << '"' << std::endl; - std::exit(EXIT_FAILURE); - } - if (i.first->second.entity->getSort() - == unoidl::Entity::SORT_MODULE) - { - mapCursor( - rtl::Reference< unoidl::ModuleEntity >( - static_cast< unoidl::ModuleEntity * >( - i.first->second.entity.get()))->createCursor(), - i.first->second.module); - } + if (!cursor.is()) + return; + + for (;;) { + OUString name; + rtl::Reference< unoidl::Entity > ent(cursor->getNext(&name)); + if (!ent.is()) { + break; + } + std::pair< std::map< OUString, Item >::iterator, bool > i( + map.insert(std::make_pair(name, Item(ent)))); + if (!i.second) { + std::cout << "Duplicate name \"" << name << '"' << std::endl; + std::exit(EXIT_FAILURE); + } + if (i.first->second.entity->getSort() + == unoidl::Entity::SORT_MODULE) + { + mapCursor( + rtl::Reference< unoidl::ModuleEntity >( + static_cast< unoidl::ModuleEntity * >( + i.first->second.entity.get()))->createCursor(), + i.first->second.module); } } } -- cgit v1.2.3