diff options
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/uibase/fldui/fldmgr.cxx | 146 | ||||
-rw-r--r-- | sw/source/uibase/frmdlg/colex.cxx | 136 | ||||
-rw-r--r-- | sw/source/uibase/frmdlg/frmmgr.cxx | 40 | ||||
-rw-r--r-- | sw/source/uibase/lingu/hhcwrp.cxx | 25 | ||||
-rw-r--r-- | sw/source/uibase/lingu/olmenu.cxx | 92 | ||||
-rw-r--r-- | sw/source/uibase/misc/glosdoc.cxx | 164 | ||||
-rw-r--r-- | sw/source/uibase/misc/glshell.cxx | 26 | ||||
-rw-r--r-- | sw/source/uibase/misc/numberingtypelistbox.cxx | 16 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 64 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/drawbase.cxx | 34 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/inputwin.cxx | 42 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.cxx | 44 |
12 files changed, 414 insertions, 415 deletions
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index e2cf3daaed45..d966dac4d490 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -568,97 +568,97 @@ void SwFieldMgr::GetSubTypes(SwFieldTypesEnum nTypeId, std::vector<OUString>& rT { SwWrtShell *pSh = m_pWrtShell ? m_pWrtShell : lcl_GetShell(); OSL_ENSURE(pSh, "no SwWrtShell found"); - if(pSh) - { - const sal_uInt16 nPos = GetPos(nTypeId); + if(!pSh) + return; + + const sal_uInt16 nPos = GetPos(nTypeId); - switch(nTypeId) + switch(nTypeId) + { + case SwFieldTypesEnum::SetRef: + case SwFieldTypesEnum::GetRef: + { + // references are no fields + pSh->GetRefMarks( &rToFill ); + break; + } + case SwFieldTypesEnum::Macro: + { + break; + } + case SwFieldTypesEnum::Input: + { + rToFill.push_back(SwResId(aSwFields[nPos].pSubTypeResIds[0])); + [[fallthrough]]; // move on at generic types + } + case SwFieldTypesEnum::DDE: + case SwFieldTypesEnum::Sequence: + case SwFieldTypesEnum::Formel: + case SwFieldTypesEnum::Get: + case SwFieldTypesEnum::Set: + case SwFieldTypesEnum::User: { - case SwFieldTypesEnum::SetRef: - case SwFieldTypesEnum::GetRef: - { - // references are no fields - pSh->GetRefMarks( &rToFill ); - break; - } - case SwFieldTypesEnum::Macro: - { - break; - } - case SwFieldTypesEnum::Input: - { - rToFill.push_back(SwResId(aSwFields[nPos].pSubTypeResIds[0])); - [[fallthrough]]; // move on at generic types - } - case SwFieldTypesEnum::DDE: - case SwFieldTypesEnum::Sequence: - case SwFieldTypesEnum::Formel: - case SwFieldTypesEnum::Get: - case SwFieldTypesEnum::Set: - case SwFieldTypesEnum::User: - { - const size_t nCount = pSh->GetFieldTypeCount(); - for(size_t i = 0; i < nCount; ++i) - { - SwFieldType* pFieldType = pSh->GetFieldType( i ); - const SwFieldIds nWhich = pFieldType->Which(); + const size_t nCount = pSh->GetFieldTypeCount(); + for(size_t i = 0; i < nCount; ++i) + { + SwFieldType* pFieldType = pSh->GetFieldType( i ); + const SwFieldIds nWhich = pFieldType->Which(); - if((nTypeId == SwFieldTypesEnum::DDE && pFieldType->Which() == SwFieldIds::Dde) || + if((nTypeId == SwFieldTypesEnum::DDE && pFieldType->Which() == SwFieldIds::Dde) || - (nTypeId == SwFieldTypesEnum::User && nWhich == SwFieldIds::User) || + (nTypeId == SwFieldTypesEnum::User && nWhich == SwFieldIds::User) || - (nTypeId == SwFieldTypesEnum::Get && nWhich == SwFieldIds::SetExp && - !(static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) || + (nTypeId == SwFieldTypesEnum::Get && nWhich == SwFieldIds::SetExp && + !(static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) || - (nTypeId == SwFieldTypesEnum::Set && nWhich == SwFieldIds::SetExp && - !(static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) || + (nTypeId == SwFieldTypesEnum::Set && nWhich == SwFieldIds::SetExp && + !(static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) || - (nTypeId == SwFieldTypesEnum::Sequence && nWhich == SwFieldIds::SetExp && - (static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) || + (nTypeId == SwFieldTypesEnum::Sequence && nWhich == SwFieldIds::SetExp && + (static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) || - ((nTypeId == SwFieldTypesEnum::Input || nTypeId == SwFieldTypesEnum::Formel) && - (nWhich == SwFieldIds::User || - (nWhich == SwFieldIds::SetExp && - !(static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ))) ) ) - { - rToFill.push_back(pFieldType->GetName()); - } + ((nTypeId == SwFieldTypesEnum::Input || nTypeId == SwFieldTypesEnum::Formel) && + (nWhich == SwFieldIds::User || + (nWhich == SwFieldIds::SetExp && + !(static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ))) ) ) + { + rToFill.push_back(pFieldType->GetName()); } - break; } - case SwFieldTypesEnum::DatabaseNextSet: - case SwFieldTypesEnum::DatabaseNumberSet: - case SwFieldTypesEnum::DatabaseName: - case SwFieldTypesEnum::DatabaseSetNumber: - break; + break; + } + case SwFieldTypesEnum::DatabaseNextSet: + case SwFieldTypesEnum::DatabaseNumberSet: + case SwFieldTypesEnum::DatabaseName: + case SwFieldTypesEnum::DatabaseSetNumber: + break; - default: + default: + { + // static SubTypes + if(nPos != USHRT_MAX) { - // static SubTypes - if(nPos != USHRT_MAX) + sal_uInt16 nCount; + if (nTypeId == SwFieldTypesEnum::DocumentInfo) + nCount = DI_SUBTYPE_END - DI_SUBTYPE_BEGIN; + else + nCount = aSwFields[nPos].nSubTypeLength; + + for(sal_uInt16 i = 0; i < nCount; ++i) { - sal_uInt16 nCount; + OUString sNew; if (nTypeId == SwFieldTypesEnum::DocumentInfo) - nCount = DI_SUBTYPE_END - DI_SUBTYPE_BEGIN; - else - nCount = aSwFields[nPos].nSubTypeLength; - - for(sal_uInt16 i = 0; i < nCount; ++i) { - OUString sNew; - if (nTypeId == SwFieldTypesEnum::DocumentInfo) - { - if ( i == DI_CUSTOM ) - sNew = SwResId(STR_CUSTOM_FIELD); - else - sNew = SwViewShell::GetShellRes()->aDocInfoLst[i]; - } + if ( i == DI_CUSTOM ) + sNew = SwResId(STR_CUSTOM_FIELD); else - sNew = SwResId(aSwFields[nPos].pSubTypeResIds[i]); - - rToFill.push_back(sNew); + sNew = SwViewShell::GetShellRes()->aDocInfoLst[i]; } + else + sNew = SwResId(aSwFields[nPos].pSubTypeResIds[i]); + + rToFill.push_back(sNew); } } } diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index 8d458f016806..583f5baad33b 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -260,65 +260,65 @@ void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOr aRect.SetTop( aRect.Bottom() + pColMgr->GetGutterWidth(i) ); } } - if (pColMgr->HasLine()) - { - Point aUp(rOrg.X() + nL, rOrg.Y() + GetTop()); - Point aDown(rOrg.X() + nL, - rOrg.Y() + GetSize().Height() - GetBottom() - GetFtHeight() - GetFtDist()); + if (!pColMgr->HasLine()) + return; + + Point aUp(rOrg.X() + nL, rOrg.Y() + GetTop()); + Point aDown(rOrg.X() + nL, + rOrg.Y() + GetSize().Height() - GetBottom() - GetFtHeight() - GetFtDist()); - if (pColMgr->GetLineHeightPercent() != 100) + if (pColMgr->GetLineHeightPercent() != 100) + { + long nLength = !m_bVertical ? aDown.Y() - aUp.Y() : aDown.X() - aUp.X(); + nLength -= nLength * pColMgr->GetLineHeightPercent() / 100; + switch (pColMgr->GetAdjust()) { - long nLength = !m_bVertical ? aDown.Y() - aUp.Y() : aDown.X() - aUp.X(); - nLength -= nLength * pColMgr->GetLineHeightPercent() / 100; - switch (pColMgr->GetAdjust()) - { - case COLADJ_BOTTOM: - if (!m_bVertical) - aUp.AdjustY(nLength ); - else - aUp.AdjustX(nLength ); - break; - case COLADJ_TOP: - if (!m_bVertical) - aDown.AdjustY( -nLength ); - else - aDown.AdjustX( -nLength ); - break; - case COLADJ_CENTER: - if (!m_bVertical) - { - aUp.AdjustY(nLength / 2 ); - aDown.AdjustY( -(nLength / 2) ); - } - else - { - aUp.AdjustX(nLength / 2 ); - aDown.AdjustX( -(nLength / 2) ); - } - break; - default: - break; // prevent warning - } + case COLADJ_BOTTOM: + if (!m_bVertical) + aUp.AdjustY(nLength ); + else + aUp.AdjustX(nLength ); + break; + case COLADJ_TOP: + if (!m_bVertical) + aDown.AdjustY( -nLength ); + else + aDown.AdjustX( -nLength ); + break; + case COLADJ_CENTER: + if (!m_bVertical) + { + aUp.AdjustY(nLength / 2 ); + aDown.AdjustY( -(nLength / 2) ); + } + else + { + aUp.AdjustX(nLength / 2 ); + aDown.AdjustX( -(nLength / 2) ); + } + break; + default: + break; // prevent warning } + } - for (sal_uInt16 i = 0; i < nColumnCount - 1; ++i) + for (sal_uInt16 i = 0; i < nColumnCount - 1; ++i) + { + int nGutter = pColMgr->GetGutterWidth(i); + int nDist = pColMgr->GetColWidth( i ) + nGutter; + nDist -= (i == 0) ? nGutter / 2 : 0; + if (!m_bVertical) { - int nGutter = pColMgr->GetGutterWidth(i); - int nDist = pColMgr->GetColWidth( i ) + nGutter; - nDist -= (i == 0) ? nGutter / 2 : 0; - if (!m_bVertical) - { - aUp.AdjustX(nDist ); - aDown.AdjustX(nDist ); - } - else - { - aUp.AdjustY(nDist ); - aDown.AdjustY(nDist ); - } - - rRenderContext.DrawLine(aUp, aDown); + aUp.AdjustX(nDist ); + aDown.AdjustX(nDist ); } + else + { + aUp.AdjustY(nDist ); + aDown.AdjustY(nDist ); + } + + rRenderContext.DrawLine(aUp, aDown); } } @@ -451,22 +451,22 @@ void SwColumnOnlyExample::SetColumns(const SwFormatCol& rCol) pCol->SetRight(static_cast<sal_uInt16>(nRight)); } // #97495# make sure that the automatic column width's are always equal - if(nColCount && m_aCols.IsOrtho()) + if(!(nColCount && m_aCols.IsOrtho())) + return; + + sal_Int32 nColumnWidthSum = 0; + sal_uInt16 i; + for(i = 0; i < nColCount; ++i) { - sal_Int32 nColumnWidthSum = 0; - sal_uInt16 i; - for(i = 0; i < nColCount; ++i) - { - SwColumn* pCol = &rCols[i]; - nColumnWidthSum += pCol->GetWishWidth(); - nColumnWidthSum -= (pCol->GetRight() + pCol->GetLeft()); - } - nColumnWidthSum /= nColCount; - for(i = 0; i < nColCount; ++i) - { - SwColumn* pCol = &rCols[i]; - pCol->SetWishWidth( static_cast< sal_uInt16 >(nColumnWidthSum + pCol->GetRight() + pCol->GetLeft())); - } + SwColumn* pCol = &rCols[i]; + nColumnWidthSum += pCol->GetWishWidth(); + nColumnWidthSum -= (pCol->GetRight() + pCol->GetLeft()); + } + nColumnWidthSum /= nColCount; + for(i = 0; i < nColCount; ++i) + { + SwColumn* pCol = &rCols[i]; + pCol->SetWishWidth( static_cast< sal_uInt16 >(nColumnWidthSum + pCol->GetRight() + pCol->GetLeft())); } } diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx b/sw/source/uibase/frmdlg/frmmgr.cxx index 926a949e2f98..146ab05384c8 100644 --- a/sw/source/uibase/frmdlg/frmmgr.cxx +++ b/sw/source/uibase/frmdlg/frmmgr.cxx @@ -148,28 +148,28 @@ void SwFlyFrameAttrMgr::UpdateFlyFrame() OSL_ENSURE( m_pOwnSh->IsFrameSelected(), "no frame selected or no shell, update not possible"); - if( m_pOwnSh->IsFrameSelected() ) + if( !m_pOwnSh->IsFrameSelected() ) + return; + + //JP 6.8.2001: set never an invalid anchor into the core. + const SfxPoolItem *pGItem, *pItem; + if( SfxItemState::SET == m_aSet.GetItemState( RES_ANCHOR, false, &pItem )) { - //JP 6.8.2001: set never an invalid anchor into the core. - const SfxPoolItem *pGItem, *pItem; - if( SfxItemState::SET == m_aSet.GetItemState( RES_ANCHOR, false, &pItem )) - { - SfxItemSet aGetSet( *m_aSet.GetPool(), svl::Items<RES_ANCHOR, RES_ANCHOR>{} ); - if( m_pOwnSh->GetFlyFrameAttr( aGetSet ) && 1 == aGetSet.Count() && - SfxItemState::SET == aGetSet.GetItemState( RES_ANCHOR, false, &pGItem ) - && static_cast<const SwFormatAnchor*>(pGItem)->GetAnchorId() == - static_cast<const SwFormatAnchor*>(pItem)->GetAnchorId() ) - m_aSet.ClearItem( RES_ANCHOR ); - } + SfxItemSet aGetSet( *m_aSet.GetPool(), svl::Items<RES_ANCHOR, RES_ANCHOR>{} ); + if( m_pOwnSh->GetFlyFrameAttr( aGetSet ) && 1 == aGetSet.Count() && + SfxItemState::SET == aGetSet.GetItemState( RES_ANCHOR, false, &pGItem ) + && static_cast<const SwFormatAnchor*>(pGItem)->GetAnchorId() == + static_cast<const SwFormatAnchor*>(pItem)->GetAnchorId() ) + m_aSet.ClearItem( RES_ANCHOR ); + } - // return wg. BASIC - if( m_aSet.Count() ) - { - m_pOwnSh->StartAllAction(); - m_pOwnSh->SetFlyFrameAttr( m_aSet ); - UpdateFlyFrame_(); - m_pOwnSh->EndAllAction(); - } + // return wg. BASIC + if( m_aSet.Count() ) + { + m_pOwnSh->StartAllAction(); + m_pOwnSh->SetFlyFrameAttr( m_aSet ); + UpdateFlyFrame_(); + m_pOwnSh->EndAllAction(); } } diff --git a/sw/source/uibase/lingu/hhcwrp.cxx b/sw/source/uibase/lingu/hhcwrp.cxx index 6cedaad79681..2d23fa468056 100644 --- a/sw/source/uibase/lingu/hhcwrp.cxx +++ b/sw/source/uibase/lingu/hhcwrp.cxx @@ -136,22 +136,21 @@ SwHHCWrapper::~SwHHCWrapper() // finally for chinese translation we need to change the documents // default language and font to the new ones to be used. LanguageType nTargetLang = GetTargetLanguage(); - if (IsChinese( nTargetLang )) - { - SwDoc *pDoc = m_pView->GetDocShell()->GetDoc(); + if (!IsChinese( nTargetLang )) + return; - //!! Note: This also effects the default language of text boxes (EditEngine/EditView) !! - pDoc->SetDefault( SvxLanguageItem( nTargetLang, RES_CHRATR_CJK_LANGUAGE ) ); + SwDoc *pDoc = m_pView->GetDocShell()->GetDoc(); - const vcl::Font *pFont = GetTargetFont(); - if (pFont) - { - SvxFontItem aFontItem( pFont->GetFamilyType(), pFont->GetFamilyName(), - pFont->GetStyleName(), pFont->GetPitch(), - pFont->GetCharSet(), RES_CHRATR_CJK_FONT ); - pDoc->SetDefault( aFontItem ); - } + //!! Note: This also effects the default language of text boxes (EditEngine/EditView) !! + pDoc->SetDefault( SvxLanguageItem( nTargetLang, RES_CHRATR_CJK_LANGUAGE ) ); + const vcl::Font *pFont = GetTargetFont(); + if (pFont) + { + SvxFontItem aFontItem( pFont->GetFamilyType(), pFont->GetFamilyName(), + pFont->GetStyleName(), pFont->GetPitch(), + pFont->GetCharSet(), RES_CHRATR_CJK_FONT ); + pDoc->SetDefault( aFontItem ); } } diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index 04dbb8cdad6a..c6e4b1349ef3 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -568,61 +568,61 @@ SwSpellPopup::~SwSpellPopup() {} void SwSpellPopup::InitItemCommands(const css::uno::Sequence< OUString >& aSuggestions) { - if (comphelper::LibreOfficeKit::isActive()) + if (!comphelper::LibreOfficeKit::isActive()) + return; + + // None is added only for LOK, it means there is no need to execute anything + m_xPopupMenu->SetItemCommand(MN_SHORT_COMMENT, ".uno:None"); + m_xPopupMenu->SetItemCommand(m_nSpellDialogId, ".uno:SpellingAndGrammarDialog"); + if(m_bGrammarResults) + m_xPopupMenu->SetItemCommand(m_nIgnoreWordId, ".uno:SpellCheckIgnoreAll?Type:string=Grammar"); + else + m_xPopupMenu->SetItemCommand(m_nIgnoreWordId, ".uno:SpellCheckIgnoreAll?Type:string=Spelling"); + if(m_bGrammarResults) + m_xPopupMenu->SetItemCommand(MN_IGNORE_SELECTION, ".uno:SpellCheckIgnore?Type:string=Grammar"); + else + m_xPopupMenu->SetItemCommand(MN_IGNORE_SELECTION, ".uno:SpellCheckIgnore?Type:string=Spelling"); + + for(int i = 0; i < aSuggestions.getLength(); ++i) { - // None is added only for LOK, it means there is no need to execute anything - m_xPopupMenu->SetItemCommand(MN_SHORT_COMMENT, ".uno:None"); - m_xPopupMenu->SetItemCommand(m_nSpellDialogId, ".uno:SpellingAndGrammarDialog"); - if(m_bGrammarResults) - m_xPopupMenu->SetItemCommand(m_nIgnoreWordId, ".uno:SpellCheckIgnoreAll?Type:string=Grammar"); - else - m_xPopupMenu->SetItemCommand(m_nIgnoreWordId, ".uno:SpellCheckIgnoreAll?Type:string=Spelling"); + sal_uInt16 nItemId = MN_SUGGESTION_START + i; + OUString sCommandString = ".uno:SpellCheckApplySuggestion?ApplyRule:string="; if(m_bGrammarResults) - m_xPopupMenu->SetItemCommand(MN_IGNORE_SELECTION, ".uno:SpellCheckIgnore?Type:string=Grammar"); - else - m_xPopupMenu->SetItemCommand(MN_IGNORE_SELECTION, ".uno:SpellCheckIgnore?Type:string=Spelling"); + sCommandString += "Grammar_"; + else if (m_xSpellAlt.is()) + sCommandString += "Spelling_"; + sCommandString += m_xPopupMenu->GetItemText(nItemId); + m_xPopupMenu->SetItemCommand(nItemId, sCommandString); + } - for(int i = 0; i < aSuggestions.getLength(); ++i) + PopupMenu *pMenu = m_xPopupMenu->GetPopupMenu(m_nLangSelectionMenuId); + m_xPopupMenu->SetItemCommand(m_nLangSelectionMenuId, ".uno:SetSelectionLanguageMenu"); + if(pMenu) + { + for (const auto& item : m_aLangTable_Text) { - sal_uInt16 nItemId = MN_SUGGESTION_START + i; - OUString sCommandString = ".uno:SpellCheckApplySuggestion?ApplyRule:string="; - if(m_bGrammarResults) - sCommandString += "Grammar_"; - else if (m_xSpellAlt.is()) - sCommandString += "Spelling_"; - sCommandString += m_xPopupMenu->GetItemText(nItemId); - m_xPopupMenu->SetItemCommand(nItemId, sCommandString); + OUString sCommandString = ".uno:LanguageStatus?Language:string=Current_" + item.second; + pMenu->SetItemCommand(item.first, sCommandString); } - PopupMenu *pMenu = m_xPopupMenu->GetPopupMenu(m_nLangSelectionMenuId); - m_xPopupMenu->SetItemCommand(m_nLangSelectionMenuId, ".uno:SetSelectionLanguageMenu"); - if(pMenu) - { - for (const auto& item : m_aLangTable_Text) - { - OUString sCommandString = ".uno:LanguageStatus?Language:string=Current_" + item.second; - pMenu->SetItemCommand(item.first, sCommandString); - } - - pMenu->SetItemCommand(MN_SET_SELECTION_NONE, ".uno:LanguageStatus?Language:string=Current_LANGUAGE_NONE"); - pMenu->SetItemCommand(MN_SET_SELECTION_RESET, ".uno:LanguageStatus?Language:string=Current_RESET_LANGUAGES"); - pMenu->SetItemCommand(MN_SET_SELECTION_MORE, ".uno:FontDialog?Page:string=font"); - } + pMenu->SetItemCommand(MN_SET_SELECTION_NONE, ".uno:LanguageStatus?Language:string=Current_LANGUAGE_NONE"); + pMenu->SetItemCommand(MN_SET_SELECTION_RESET, ".uno:LanguageStatus?Language:string=Current_RESET_LANGUAGES"); + pMenu->SetItemCommand(MN_SET_SELECTION_MORE, ".uno:FontDialog?Page:string=font"); + } - pMenu = m_xPopupMenu->GetPopupMenu(m_nLangParaMenuId); - m_xPopupMenu->SetItemCommand(m_nLangParaMenuId, ".uno:SetParagraphLanguageMenu"); - if(pMenu) + pMenu = m_xPopupMenu->GetPopupMenu(m_nLangParaMenuId); + m_xPopupMenu->SetItemCommand(m_nLangParaMenuId, ".uno:SetParagraphLanguageMenu"); + if(pMenu) + { + for (const auto& item : m_aLangTable_Paragraph) { - for (const auto& item : m_aLangTable_Paragraph) - { - OUString sCommandString = ".uno:LanguageStatus?Language:string=Paragraph_" + item.second; - pMenu->SetItemCommand(item.first, sCommandString); - } - - pMenu->SetItemCommand(MN_SET_PARA_NONE, ".uno:LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE"); - pMenu->SetItemCommand(MN_SET_PARA_RESET, ".uno:LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES"); - pMenu->SetItemCommand(MN_SET_PARA_MORE, ".uno:FontDialogForParagraph"); + OUString sCommandString = ".uno:LanguageStatus?Language:string=Paragraph_" + item.second; + pMenu->SetItemCommand(item.first, sCommandString); } + + pMenu->SetItemCommand(MN_SET_PARA_NONE, ".uno:LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE"); + pMenu->SetItemCommand(MN_SET_PARA_RESET, ".uno:LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES"); + pMenu->SetItemCommand(MN_SET_PARA_MORE, ".uno:FontDialogForParagraph"); } } diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index 868158732834..d0f6c2db9848 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -349,62 +349,62 @@ void SwGlossaries::UpdateGlosPath(bool bFull) SvtPathOptions aPathOpt; const OUString& aNewPath( aPathOpt.GetAutoTextPath() ); bool bPathChanged = m_aPath != aNewPath; - if (bFull || bPathChanged) - { - m_aPath = aNewPath; + if (!(bFull || bPathChanged)) + return; + + m_aPath = aNewPath; - m_PathArr.clear(); + m_PathArr.clear(); - std::vector<OUString> aDirArr; - std::vector<OUString> aInvalidPaths; - if (!m_aPath.isEmpty()) + std::vector<OUString> aDirArr; + std::vector<OUString> aInvalidPaths; + if (!m_aPath.isEmpty()) + { + sal_Int32 nIndex = 0; + do { - sal_Int32 nIndex = 0; - do + const OUString sPth = URIHelper::SmartRel2Abs( + INetURLObject(), + m_aPath.getToken(0, SVT_SEARCHPATH_DELIMITER, nIndex), + URIHelper::GetMaybeFileHdl()); + if (!aDirArr.empty() && + std::find(aDirArr.begin(), aDirArr.end(), sPth) != aDirArr.end()) { - const OUString sPth = URIHelper::SmartRel2Abs( - INetURLObject(), - m_aPath.getToken(0, SVT_SEARCHPATH_DELIMITER, nIndex), - URIHelper::GetMaybeFileHdl()); - if (!aDirArr.empty() && - std::find(aDirArr.begin(), aDirArr.end(), sPth) != aDirArr.end()) - { - continue; - } - aDirArr.push_back(sPth); - if( !FStatHelper::IsFolder( sPth ) ) - aInvalidPaths.push_back(sPth); - else - m_PathArr.push_back(sPth); + continue; } - while (nIndex>=0); + aDirArr.push_back(sPth); + if( !FStatHelper::IsFolder( sPth ) ) + aInvalidPaths.push_back(sPth); + else + m_PathArr.push_back(sPth); } + while (nIndex>=0); + } - if (m_aPath.isEmpty() || !aInvalidPaths.empty()) + if (m_aPath.isEmpty() || !aInvalidPaths.empty()) + { + std::sort(aInvalidPaths.begin(), aInvalidPaths.end()); + aInvalidPaths.erase(std::unique(aInvalidPaths.begin(), aInvalidPaths.end()), aInvalidPaths.end()); + if (bPathChanged || (m_aInvalidPaths != aInvalidPaths)) { - std::sort(aInvalidPaths.begin(), aInvalidPaths.end()); - aInvalidPaths.erase(std::unique(aInvalidPaths.begin(), aInvalidPaths.end()), aInvalidPaths.end()); - if (bPathChanged || (m_aInvalidPaths != aInvalidPaths)) - { - m_aInvalidPaths = aInvalidPaths; - // wrong path, that means AutoText directory doesn't exist + m_aInvalidPaths = aInvalidPaths; + // wrong path, that means AutoText directory doesn't exist - ErrorHandler::HandleError( *new StringErrorInfo( - ERR_AUTOPATH_ERROR, lcl_makePath(m_aInvalidPaths), - DialogMask::ButtonsOk | DialogMask::MessageError ) ); - m_bError = true; - } - else - m_bError = false; + ErrorHandler::HandleError( *new StringErrorInfo( + ERR_AUTOPATH_ERROR, lcl_makePath(m_aInvalidPaths), + DialogMask::ButtonsOk | DialogMask::MessageError ) ); + m_bError = true; } else m_bError = false; + } + else + m_bError = false; - if (!m_GlosArr.empty()) - { - m_GlosArr.clear(); - GetNameList(); - } + if (!m_GlosArr.empty()) + { + m_GlosArr.clear(); + GetNameList(); } } @@ -422,54 +422,54 @@ OUString SwGlossaries::GetExtension() void SwGlossaries::RemoveFileFromList( const OUString& rGroup ) { - if (!m_GlosArr.empty()) + if (m_GlosArr.empty()) + return; + + auto it = std::find(m_GlosArr.begin(), m_GlosArr.end(), rGroup); + if (it == m_GlosArr.end()) + return; + { - auto it = std::find(m_GlosArr.begin(), m_GlosArr.end(), rGroup); - if (it != m_GlosArr.end()) + // tell the UNO AutoTextGroup object that it's not valid anymore + for ( UnoAutoTextGroups::iterator aLoop = m_aGlossaryGroups.begin(); + aLoop != m_aGlossaryGroups.end(); + ) { + Reference< container::XNamed > xNamed( aLoop->get(), UNO_QUERY ); + if ( !xNamed.is() ) { - // tell the UNO AutoTextGroup object that it's not valid anymore - for ( UnoAutoTextGroups::iterator aLoop = m_aGlossaryGroups.begin(); - aLoop != m_aGlossaryGroups.end(); - ) - { - Reference< container::XNamed > xNamed( aLoop->get(), UNO_QUERY ); - if ( !xNamed.is() ) - { - aLoop = m_aGlossaryGroups.erase(aLoop); - } - else if ( xNamed->getName() == rGroup ) - { - static_cast< SwXAutoTextGroup* >( xNamed.get() )->Invalidate(); - // note that this static_cast works because we know that the array only - // contains SwXAutoTextGroup implementation - m_aGlossaryGroups.erase( aLoop ); - break; - } else - ++aLoop; - } + aLoop = m_aGlossaryGroups.erase(aLoop); } + else if ( xNamed->getName() == rGroup ) + { + static_cast< SwXAutoTextGroup* >( xNamed.get() )->Invalidate(); + // note that this static_cast works because we know that the array only + // contains SwXAutoTextGroup implementation + m_aGlossaryGroups.erase( aLoop ); + break; + } else + ++aLoop; + } + } + { + // tell all our UNO AutoTextEntry objects that they're not valid anymore + for ( UnoAutoTextEntries::iterator aLoop = m_aGlossaryEntries.begin(); + aLoop != m_aGlossaryEntries.end(); + ) + { + auto pEntry = comphelper::getUnoTunnelImplementation<SwXAutoTextEntry>(aLoop->get()); + if ( pEntry && ( pEntry->GetGroupName() == rGroup ) ) { - // tell all our UNO AutoTextEntry objects that they're not valid anymore - for ( UnoAutoTextEntries::iterator aLoop = m_aGlossaryEntries.begin(); - aLoop != m_aGlossaryEntries.end(); - ) - { - auto pEntry = comphelper::getUnoTunnelImplementation<SwXAutoTextEntry>(aLoop->get()); - if ( pEntry && ( pEntry->GetGroupName() == rGroup ) ) - { - pEntry->Invalidate(); - aLoop = m_aGlossaryEntries.erase( aLoop ); - } - else - ++aLoop; - } + pEntry->Invalidate(); + aLoop = m_aGlossaryEntries.erase( aLoop ); } - - m_GlosArr.erase(it); + else + ++aLoop; } } + + m_GlosArr.erase(it); } OUString SwGlossaries::GetCompleteGroupName( const OUString& rGroupName ) diff --git a/sw/source/uibase/misc/glshell.cxx b/sw/source/uibase/misc/glshell.cxx index 1e3c664f1592..4f1596f99f3d 100644 --- a/sw/source/uibase/misc/glshell.cxx +++ b/sw/source/uibase/misc/glshell.cxx @@ -69,20 +69,20 @@ void SwWebGlosDocShell::InitInterface_Impl() static void lcl_Execute( SwDocShell& rSh, SfxRequest& rReq ) { - if ( rReq.GetSlot() == SID_SAVEDOC ) + if ( rReq.GetSlot() != SID_SAVEDOC ) + return; + + if( !rSh.HasName() ) { - if( !rSh.HasName() ) - { - rReq.SetReturnValue( SfxBoolItem( 0, rSh.Save() ) ); - } - else - { - const SfxBoolItem* pRes = static_cast< const SfxBoolItem* >( - rSh.ExecuteSlot( rReq, - rSh.SfxObjectShell::GetInterface() )); - if( pRes->GetValue() ) - rSh.GetDoc()->getIDocumentState().ResetModified(); - } + rReq.SetReturnValue( SfxBoolItem( 0, rSh.Save() ) ); + } + else + { + const SfxBoolItem* pRes = static_cast< const SfxBoolItem* >( + rSh.ExecuteSlot( rReq, + rSh.SfxObjectShell::GetInterface() )); + if( pRes->GetValue() ) + rSh.GetDoc()->getIDocumentState().ResetModified(); } } diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx index d484cce5dd3a..f5df02d1b307 100644 --- a/sw/source/uibase/misc/numberingtypelistbox.cxx +++ b/sw/source/uibase/misc/numberingtypelistbox.cxx @@ -98,20 +98,20 @@ void SwNumberingTypeListBox::Reload(SwInsertNumTypes nTypeFlags) m_xWidget->insert(nPos, SvxNumberingTypeTable::GetString(i), &sId, nullptr, nullptr); } } - if (nTypeFlags & SwInsertNumTypes::Extended) + if (!(nTypeFlags & SwInsertNumTypes::Extended)) + return; + + for (sal_Int16 nCurrent : aTypes) { - for (sal_Int16 nCurrent : aTypes) + if (nCurrent > style::NumberingType::CHARS_LOWER_LETTER_N) { - if (nCurrent > style::NumberingType::CHARS_LOWER_LETTER_N) + if (m_xWidget->find_id(OUString::number(nCurrent)) == -1) { - if (m_xWidget->find_id(OUString::number(nCurrent)) == -1) - { - m_xWidget->append(OUString::number(nCurrent), m_xImpl->xInfo->getNumberingIdentifier(nCurrent)); - } + m_xWidget->append(OUString::number(nCurrent), m_xImpl->xInfo->getNumberingIdentifier(nCurrent)); } } - m_xWidget->set_active(0); } + m_xWidget->set_active(0); } SvxNumType SwNumberingTypeListBox::GetSelectedNumberingType() const diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 46866d4a87f7..1e0c58acd02f 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -1157,42 +1157,42 @@ namespace void SwRedlineAcceptDlg::Initialize(OUString& rExtraString) { - if (!rExtraString.isEmpty()) - { - OUString aStr = lcl_StripAcceptChgDat(rExtraString); - if (!aStr.isEmpty()) - { - int nCount = aStr.toInt32(); - if (nCount > 2) - { - std::vector<int> aEndPos; + if (rExtraString.isEmpty()) + return; - for (int i = 0; i < nCount; ++i) - { - sal_Int32 n1 = aStr.indexOf(';'); - aStr = aStr.copy( n1+1 ); - aEndPos.push_back(aStr.toInt32()); - } + OUString aStr = lcl_StripAcceptChgDat(rExtraString); + if (aStr.isEmpty()) + return; - bool bUseless = false; + int nCount = aStr.toInt32(); + if (nCount <= 2) + return; - std::vector<int> aWidths; - for (int i = 1; i < nCount; ++i) - { - aWidths.push_back(aEndPos[i] - aEndPos[i - 1]); - if (aWidths.back() <= 0) - bUseless = true; - } + std::vector<int> aEndPos; - if (!bUseless) - { - // turn column end points back to column widths, ignoring the small - // value used for the expander column - weld::TreeView& rTreeView = m_pTable->GetWidget(); - rTreeView.set_column_fixed_widths(aWidths); - } - } - } + for (int i = 0; i < nCount; ++i) + { + sal_Int32 n1 = aStr.indexOf(';'); + aStr = aStr.copy( n1+1 ); + aEndPos.push_back(aStr.toInt32()); + } + + bool bUseless = false; + + std::vector<int> aWidths; + for (int i = 1; i < nCount; ++i) + { + aWidths.push_back(aEndPos[i] - aEndPos[i - 1]); + if (aWidths.back() <= 0) + bUseless = true; + } + + if (!bUseless) + { + // turn column end points back to column widths, ignoring the small + // value used for the expander column + weld::TreeView& rTreeView = m_pTable->GetWidget(); + rTreeView.set_column_fixed_widths(aWidths); } } diff --git a/sw/source/uibase/ribbar/drawbase.cxx b/sw/source/uibase/ribbar/drawbase.cxx index f2b13d8d1372..7d835b54bd1a 100644 --- a/sw/source/uibase/ribbar/drawbase.cxx +++ b/sw/source/uibase/ribbar/drawbase.cxx @@ -485,28 +485,28 @@ void SwDrawBase::EnterSelectMode(const MouseEvent& rMEvt) { m_pWin->SetDrawAction(false); - if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction()) - { - Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel())); + if (m_pSh->IsObjSelected() || m_pWin->IsDrawAction()) + return; - if (m_pSh->IsObjSelectable(aPnt)) - { - m_pSh->SelectObj(aPnt); - if (rMEvt.GetModifier() == KEY_SHIFT || !m_pSh->IsObjSelected()) - { - m_pView->LeaveDrawCreate(); // Switch to selection mode + Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel())); - m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); - } - } - else + if (m_pSh->IsObjSelectable(aPnt)) + { + m_pSh->SelectObj(aPnt); + if (rMEvt.GetModifier() == KEY_SHIFT || !m_pSh->IsObjSelected()) { - m_pView->LeaveDrawCreate(); - if (m_pSh->IsSelFrameMode()) - m_pSh->LeaveSelFrameMode(); + m_pView->LeaveDrawCreate(); // Switch to selection mode + + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); } - m_pView->NoRotate(); } + else + { + m_pView->LeaveDrawCreate(); + if (m_pSh->IsSelFrameMode()) + m_pSh->LeaveSelFrameMode(); + } + m_pView->NoRotate(); } void SwDrawBase::CreateDefaultObject() diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index 8ae9fe5d087d..de00c7fc7108 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -155,19 +155,19 @@ void SwInputWindow::dispose() void SwInputWindow::CleanupUglyHackWithUndo() { - if (m_bResetUndo) + if (!m_bResetUndo) + return; + + if (pWrtShell) { - if (pWrtShell) + DelBoxContent(); + pWrtShell->DoUndo(m_bDoesUndo); + if (m_bCallUndo) { - DelBoxContent(); - pWrtShell->DoUndo(m_bDoesUndo); - if (m_bCallUndo) - { - pWrtShell->Undo(); - } + pWrtShell->Undo(); } - m_bResetUndo = false; // #i117122# once is enough :) } + m_bResetUndo = false; // #i117122# once is enough :) } void SwInputWindow::Resize() @@ -354,22 +354,22 @@ void SwInputWindow::ApplyFormula() void SwInputWindow::CancelFormula() { - if(pView) - { - pView->GetViewFrame()->GetDispatcher()->Lock( false ); - pView->GetEditWin().LockKeyInput(false); - CleanupUglyHackWithUndo(); - pWrtShell->Pop(SwCursorShell::PopMode::DeleteCurrent); + if(!pView) + return; - if( bDelSel ) - pWrtShell->EnterStdMode(); + pView->GetViewFrame()->GetDispatcher()->Lock( false ); + pView->GetEditWin().LockKeyInput(false); + CleanupUglyHackWithUndo(); + pWrtShell->Pop(SwCursorShell::PopMode::DeleteCurrent); - pWrtShell->EndSelTableCells(); + if( bDelSel ) + pWrtShell->EnterStdMode(); - pView->GetEditWin().GrabFocus(); + pWrtShell->EndSelTableCells(); - pView->GetViewFrame()->GetDispatcher()->Execute( FN_EDIT_FORMULA, SfxCallMode::ASYNCHRON); - } + pView->GetEditWin().GrabFocus(); + + pView->GetViewFrame()->GetDispatcher()->Execute( FN_EDIT_FORMULA, SfxCallMode::ASYNCHRON); } const sal_Unicode CH_LRE = 0x202a; diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index 53c2ae1c07dc..179d32f9a9de 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -708,22 +708,22 @@ void NavElementBox_Base::ReleaseFocus_Impl() IMPL_LINK(NavElementBox_Base, SelectHdl, weld::ComboBox&, rComboBox, void) { - if (rComboBox.changed_by_direct_pick()) // only when picked from the list - { - SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty ); + if (!rComboBox.changed_by_direct_pick()) // only when picked from the list + return; - sal_uInt16 nMoveType = rComboBox.get_active_id().toUInt32(); - SwView::SetMoveType( nMoveType ); + SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty ); - css::uno::Sequence< css::beans::PropertyValue > aArgs; + sal_uInt16 nMoveType = rComboBox.get_active_id().toUInt32(); + SwView::SetMoveType( nMoveType ); - /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. - This instance may be deleted in the meantime (i.e. when a dialog is opened - while in Dispatch()), accessing members will crash in this case. */ - ReleaseFocus_Impl(); + css::uno::Sequence< css::beans::PropertyValue > aArgs; - m_pCtrl->dispatchCommand( aArgs ); - } + /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. + This instance may be deleted in the meantime (i.e. when a dialog is opened + while in Dispatch()), accessing members will crash in this case. */ + ReleaseFocus_Impl(); + + m_pCtrl->dispatchCommand( aArgs ); } void NavElementBox_Base::UpdateBox() @@ -840,19 +840,19 @@ void SAL_CALL NavElementToolBoxControl::dispose() // XStatusListener void SAL_CALL NavElementToolBoxControl::statusChanged( const frame::FeatureStateEvent& rEvent ) { - if (m_pBox) + if (!m_pBox) + return; + + SolarMutexGuard aSolarMutexGuard; + if ( rEvent.FeatureURL.Path == "NavElement" ) { - SolarMutexGuard aSolarMutexGuard; - if ( rEvent.FeatureURL.Path == "NavElement" ) + 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); } } |