[Libreoffice-commits] core.git: sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 30 14:20:12 UTC 2020
sw/source/uibase/app/docsh2.cxx | 139 ++++++++++----------
sw/source/uibase/app/docstyle.cxx | 34 ++---
sw/source/uibase/app/mainwn.cxx | 40 ++---
sw/source/uibase/app/swmodul1.cxx | 55 ++++----
sw/source/uibase/config/dbconfig.cxx | 22 +--
sw/source/uibase/config/fontcfg.cxx | 70 +++++-----
sw/source/uibase/config/uinums.cxx | 28 ++--
sw/source/uibase/config/usrpref.cxx | 237 +++++++++++++++++------------------
sw/source/uibase/config/viewopt.cxx | 88 ++++++------
9 files changed, 357 insertions(+), 356 deletions(-)
New commits:
commit 069c534f1da3b206f4e418e0a628a3482cd4a04a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 30 10:39:47 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 30 16:19:12 2020 +0200
loplugin:flatten in sw/uibase/app..sw/uibase/config
Change-Id: I903631568cc5285bf167ba3f0dadb95dbcd43a21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99792
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 69f4accadfad..fa2b9ac9d63e 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -208,19 +208,20 @@ void SwDocShell::DoFlushDocInfo()
static void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVBAEventProcessor >& xVbaEvents, const SfxHint& rHint )
{
using namespace com::sun::star::script::vba::VBAEventId;
- if ( const SfxEventHint* pSfxEventHint = dynamic_cast<const SfxEventHint*>(&rHint) )
+ const SfxEventHint* pSfxEventHint = dynamic_cast<const SfxEventHint*>(&rHint);
+ if ( !pSfxEventHint )
+ return;
+
+ uno::Sequence< uno::Any > aArgs;
+ switch( pSfxEventHint->GetEventId() )
{
- uno::Sequence< uno::Any > aArgs;
- switch( pSfxEventHint->GetEventId() )
- {
- case SfxEventHintId::CreateDoc:
- xVbaEvents->processVbaEvent( DOCUMENT_NEW, aArgs );
- break;
- case SfxEventHintId::OpenDoc:
- xVbaEvents->processVbaEvent( DOCUMENT_OPEN, aArgs );
- break;
- default: break;
- }
+ case SfxEventHintId::CreateDoc:
+ xVbaEvents->processVbaEvent( DOCUMENT_NEW, aArgs );
+ break;
+ case SfxEventHintId::OpenDoc:
+ xVbaEvents->processVbaEvent( DOCUMENT_OPEN, aArgs );
+ break;
+ default: break;
}
}
@@ -295,51 +296,51 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
}
- if( nAction )
+ if( !nAction )
+ return;
+
+ bool bUnlockView = true; //initializing prevents warning
+ if (m_pWrtShell)
{
- bool bUnlockView = true; //initializing prevents warning
- if (m_pWrtShell)
- {
- bUnlockView = !m_pWrtShell->IsViewLocked();
- m_pWrtShell->LockView( true ); //lock visible section
- m_pWrtShell->StartAllAction();
- }
- switch( nAction )
+ bUnlockView = !m_pWrtShell->IsViewLocked();
+ m_pWrtShell->LockView( true ); //lock visible section
+ m_pWrtShell->StartAllAction();
+ }
+ switch( nAction )
+ {
+ case 2:
+ m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Filename )->UpdateFields();
+ break;
+ // #i38126# - own action for event LOADFINISHED
+ // in order to avoid a modified document.
+ // #i41679# - Also for the instance of <SwDoc>
+ // it has to be assured, that it's not modified.
+ // Perform the same as for action id 1, but disable <SetModified>.
+ case 3:
{
- case 2:
- m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Filename )->UpdateFields();
- break;
- // #i38126# - own action for event LOADFINISHED
- // in order to avoid a modified document.
- // #i41679# - Also for the instance of <SwDoc>
- // it has to be assured, that it's not modified.
- // Perform the same as for action id 1, but disable <SetModified>.
- case 3:
- {
- const bool bResetModified = IsEnableSetModified();
- if ( bResetModified )
- EnableSetModified( false );
- // #i41679#
- const bool bIsDocModified = m_xDoc->getIDocumentState().IsModified();
- // TODO: is the ResetModified() below because of only the direct call from DocInfoChgd, or does UpdateFields() set it too?
-
- m_xDoc->getIDocumentStatistics().DocInfoChgd(false);
-
- // #i41679#
- if ( !bIsDocModified )
- m_xDoc->getIDocumentState().ResetModified();
- if ( bResetModified )
- EnableSetModified();
- }
- break;
- }
+ const bool bResetModified = IsEnableSetModified();
+ if ( bResetModified )
+ EnableSetModified( false );
+ // #i41679#
+ const bool bIsDocModified = m_xDoc->getIDocumentState().IsModified();
+ // TODO: is the ResetModified() below because of only the direct call from DocInfoChgd, or does UpdateFields() set it too?
- if (m_pWrtShell)
- {
- m_pWrtShell->EndAllAction();
- if( bUnlockView )
- m_pWrtShell->LockView( false );
+ m_xDoc->getIDocumentStatistics().DocInfoChgd(false);
+
+ // #i41679#
+ if ( !bIsDocModified )
+ m_xDoc->getIDocumentState().ResetModified();
+ if ( bResetModified )
+ EnableSetModified();
}
+ break;
+ }
+
+ if (m_pWrtShell)
+ {
+ m_pWrtShell->EndAllAction();
+ if( bUnlockView )
+ m_pWrtShell->LockView( false );
}
}
@@ -1379,29 +1380,29 @@ void SwDocShell::SetModified( bool bSet )
if (utl::ConfigManager::IsFuzzing())
return;
SfxObjectShell::SetModified( bSet );
- if( IsEnableSetModified())
+ if( !IsEnableSetModified())
+ return;
+
+ if (!m_xDoc->getIDocumentState().IsInCallModified())
{
- if (!m_xDoc->getIDocumentState().IsInCallModified())
+ EnableSetModified( false );
+ if( bSet )
{
- EnableSetModified( false );
- if( bSet )
+ bool const bOld = m_xDoc->getIDocumentState().IsModified();
+ m_xDoc->getIDocumentState().SetModified();
+ if( !bOld )
{
- bool const bOld = m_xDoc->getIDocumentState().IsModified();
- m_xDoc->getIDocumentState().SetModified();
- if( !bOld )
- {
- m_xDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
- }
+ m_xDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
}
- else
- m_xDoc->getIDocumentState().ResetModified();
-
- EnableSetModified();
}
+ else
+ m_xDoc->getIDocumentState().ResetModified();
- UpdateChildWindows();
- Broadcast(SfxHint(SfxHintId::DocChanged));
+ EnableSetModified();
}
+
+ UpdateChildWindows();
+ Broadcast(SfxHint(SfxHintId::DocChanged));
}
void SwDocShell::UpdateChildWindows()
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 3a933b50bdd3..a7aec918e91d 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -1417,25 +1417,25 @@ void SwDocStyleSheet::MergeIndentAttrsOfListStyle( SfxItemSet& rSet )
}
OSL_ENSURE( pColl, "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - missing paragraph style");
- if ( pColl->AreListLevelIndentsApplicable() )
+ if ( !pColl->AreListLevelIndentsApplicable() )
+ return;
+
+ OSL_ENSURE( pColl->GetItemState( RES_PARATR_NUMRULE ) == SfxItemState::SET,
+ "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - list level indents are applicable at paragraph style, but no list style found. Serious defect." );
+ const OUString sNumRule = pColl->GetNumRule().GetValue();
+ if (sNumRule.isEmpty())
+ return;
+
+ const SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
+ if( pRule )
{
- OSL_ENSURE( pColl->GetItemState( RES_PARATR_NUMRULE ) == SfxItemState::SET,
- "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - list level indents are applicable at paragraph style, but no list style found. Serious defect." );
- const OUString sNumRule = pColl->GetNumRule().GetValue();
- if (!sNumRule.isEmpty())
+ const SwNumFormat& rFormat = pRule->Get( 0 );
+ if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
{
- const SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
- if( pRule )
- {
- const SwNumFormat& rFormat = pRule->Get( 0 );
- if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
- {
- SvxLRSpaceItem aLR( RES_LR_SPACE );
- aLR.SetTextLeft( rFormat.GetIndentAt() );
- aLR.SetTextFirstLineOffset( static_cast<short>(rFormat.GetFirstLineIndent()) );
- rSet.Put( aLR );
- }
- }
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetTextLeft( rFormat.GetIndentAt() );
+ aLR.SetTextFirstLineOffset( static_cast<short>(rFormat.GetFirstLineIndent()) );
+ rSet.Put( aLR );
}
}
}
diff --git a/sw/source/uibase/app/mainwn.cxx b/sw/source/uibase/app/mainwn.cxx
index 9a01a8437958..347069d69bc4 100644
--- a/sw/source/uibase/app/mainwn.cxx
+++ b/sw/source/uibase/app/mainwn.cxx
@@ -91,31 +91,31 @@ void SetProgressState( long nPosition, SwDocShell const *pDocShell )
void EndProgress( SwDocShell const *pDocShell )
{
- if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() )
+ if( !(pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave()) )
+ return;
+
+ SwProgress *pProgress = nullptr;
+ std::vector<SwProgress *>::size_type i;
+ for ( i = 0; i < pProgressContainer->size(); ++i )
{
- SwProgress *pProgress = nullptr;
- std::vector<SwProgress *>::size_type i;
- for ( i = 0; i < pProgressContainer->size(); ++i )
+ SwProgress *pTmp = (*pProgressContainer)[i].get();
+ if ( pTmp->pDocShell == pDocShell )
{
- SwProgress *pTmp = (*pProgressContainer)[i].get();
- if ( pTmp->pDocShell == pDocShell )
- {
- pProgress = pTmp;
- break;
- }
+ pProgress = pTmp;
+ break;
}
+ }
- if ( pProgress && 0 == --pProgress->nStartCount )
+ if ( pProgress && 0 == --pProgress->nStartCount )
+ {
+ pProgress->pProgress->Stop();
+ pProgressContainer->erase( pProgressContainer->begin() + i );
+ //#112337# it may happen that the container has been removed
+ //while rescheduling
+ if ( pProgressContainer && pProgressContainer->empty() )
{
- pProgress->pProgress->Stop();
- pProgressContainer->erase( pProgressContainer->begin() + i );
- //#112337# it may happen that the container has been removed
- //while rescheduling
- if ( pProgressContainer && pProgressContainer->empty() )
- {
- delete pProgressContainer;
- pProgressContainer = nullptr;
- }
+ delete pProgressContainer;
+ pProgressContainer = nullptr;
}
}
}
diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx
index abe620c3bf07..53cbe772da6d 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -368,22 +368,23 @@ void SwModule::ShowDBObj(SwView const & rView, const SwDBData& rData)
Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
uno::Reference<XFrame> xBeamerFrame = xFrame->findFrame("_beamer", FrameSearchFlag::CHILDREN);
- if (xBeamerFrame.is())
- { // the beamer has been opened by the SfxViewFrame
- Reference<XController> xController = xBeamerFrame->getController();
- Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY);
- if (xControllerSelection.is())
- {
+ if (!xBeamerFrame.is())
+ return;
- ODataAccessDescriptor aSelection;
- aSelection.setDataSource(rData.sDataSource);
- aSelection[DataAccessDescriptorProperty::Command] <<= rData.sCommand;
- aSelection[DataAccessDescriptorProperty::CommandType] <<= rData.nCommandType;
- xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence()));
- }
- else {
- OSL_FAIL("no selection supplier in the beamer!");
- }
+// the beamer has been opened by the SfxViewFrame
+ Reference<XController> xController = xBeamerFrame->getController();
+ Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY);
+ if (xControllerSelection.is())
+ {
+
+ ODataAccessDescriptor aSelection;
+ aSelection.setDataSource(rData.sDataSource);
+ aSelection[DataAccessDescriptorProperty::Command] <<= rData.sCommand;
+ aSelection[DataAccessDescriptorProperty::CommandType] <<= rData.nCommandType;
+ xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence()));
+ }
+ else {
+ OSL_FAIL("no selection supplier in the beamer!");
}
}
@@ -632,20 +633,20 @@ void SwModule::CheckSpellChanges( bool bOnlineSpelling,
{
bool bOnlyWrong = bIsSpellWrongAgain && !bIsSpellAllAgain;
bool bInvalid = bOnlyWrong || bIsSpellAllAgain;
- if( bOnlineSpelling || bInvalid )
+ if( !(bOnlineSpelling || bInvalid) )
+ return;
+
+ for( SwDocShell *pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<SwDocShell>));
+ pDocSh;
+ pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetNext( *pDocSh, checkSfxObjectShell<SwDocShell> ) ) )
{
- for( SwDocShell *pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<SwDocShell>));
- pDocSh;
- pDocSh = static_cast<SwDocShell*>(SfxObjectShell::GetNext( *pDocSh, checkSfxObjectShell<SwDocShell> ) ) )
+ SwDoc* pTmp = pDocSh->GetDoc();
+ if ( pTmp->getIDocumentLayoutAccess().GetCurrentViewShell() )
{
- SwDoc* pTmp = pDocSh->GetDoc();
- if ( pTmp->getIDocumentLayoutAccess().GetCurrentViewShell() )
- {
- pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags );
- SwViewShell* pViewShell = pTmp->getIDocumentLayoutAccess().GetCurrentViewShell();
- if ( bSmartTags && pViewShell && pViewShell->GetWin() )
- pViewShell->GetWin()->Invalidate();
- }
+ pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags );
+ SwViewShell* pViewShell = pTmp->getIDocumentLayoutAccess().GetCurrentViewShell();
+ if ( bSmartTags && pViewShell && pViewShell->GetWin() )
+ pViewShell->GetWin()->Invalidate();
}
}
}
diff --git a/sw/source/uibase/config/dbconfig.cxx b/sw/source/uibase/config/dbconfig.cxx
index 8df0a7d49d4a..8c2f04f48a26 100644
--- a/sw/source/uibase/config/dbconfig.cxx
+++ b/sw/source/uibase/config/dbconfig.cxx
@@ -62,19 +62,19 @@ void SwDBConfig::Load()
Sequence<Any> aValues = GetProperties(rNames);
const Any* pValues = aValues.getConstArray();
OSL_ENSURE(aValues.getLength() == rNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == rNames.getLength())
+ if(aValues.getLength() != rNames.getLength())
+ return;
+
+ for(int nProp = 0; nProp < rNames.getLength(); nProp++)
{
- for(int nProp = 0; nProp < rNames.getLength(); nProp++)
+ switch(nProp)
{
- switch(nProp)
- {
- case 0: pValues[nProp] >>= pAdrImpl->sDataSource; break;
- case 1: pValues[nProp] >>= pAdrImpl->sCommand; break;
- case 2: pValues[nProp] >>= pAdrImpl->nCommandType; break;
- case 3: pValues[nProp] >>= pBibImpl->sDataSource; break;
- case 4: pValues[nProp] >>= pBibImpl->sCommand; break;
- case 5: pValues[nProp] >>= pBibImpl->nCommandType; break;
- }
+ case 0: pValues[nProp] >>= pAdrImpl->sDataSource; break;
+ case 1: pValues[nProp] >>= pAdrImpl->sCommand; break;
+ case 2: pValues[nProp] >>= pAdrImpl->nCommandType; break;
+ case 3: pValues[nProp] >>= pBibImpl->sDataSource; break;
+ case 4: pValues[nProp] >>= pBibImpl->sCommand; break;
+ case 5: pValues[nProp] >>= pBibImpl->nCommandType; break;
}
}
}
diff --git a/sw/source/uibase/config/fontcfg.cxx b/sw/source/uibase/config/fontcfg.cxx
index e58a42bb8163..9c81ea8e7588 100644
--- a/sw/source/uibase/config/fontcfg.cxx
+++ b/sw/source/uibase/config/fontcfg.cxx
@@ -96,23 +96,23 @@ SwStdFontConfig::SwStdFontConfig() :
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
+ if(aValues.getLength() != aNames.getLength())
+ return;
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ if(pValues[nProp].hasValue())
{
- if(pValues[nProp].hasValue())
+ if( nProp < DEF_FONT_COUNT)
+ {
+ OUString sVal;
+ pValues[nProp] >>= sVal;
+ sDefaultFonts[nProp] = sVal;
+ }
+ else
{
- if( nProp < DEF_FONT_COUNT)
- {
- OUString sVal;
- pValues[nProp] >>= sVal;
- sDefaultFonts[nProp] = sVal;
- }
- else
- {
- pValues[nProp] >>= nDefaultFontHeight[nProp - DEF_FONT_COUNT];
- nDefaultFontHeight[nProp - DEF_FONT_COUNT] = convertMm100ToTwip(nDefaultFontHeight[nProp - DEF_FONT_COUNT]);
- }
+ pValues[nProp] >>= nDefaultFontHeight[nProp - DEF_FONT_COUNT];
+ nDefaultFontHeight[nProp - DEF_FONT_COUNT] = convertMm100ToTwip(nDefaultFontHeight[nProp - DEF_FONT_COUNT]);
}
}
}
@@ -269,29 +269,29 @@ sal_Int32 SwStdFontConfig::GetDefaultHeightFor(sal_uInt16 nFontType, LanguageTyp
void SwStdFontConfig::ChangeInt( sal_uInt16 nFontType, sal_Int32 nHeight )
{
OSL_ENSURE( nFontType < DEF_FONT_COUNT, "invalid index in SwStdFontConfig::ChangeInt()");
- if( nFontType < DEF_FONT_COUNT && nDefaultFontHeight[nFontType] != nHeight)
- {
- SvtLinguOptions aLinguOpt;
- if (!utl::ConfigManager::IsFuzzing())
- SvtLinguConfig().GetOptions( aLinguOpt );
+ if( nFontType >= DEF_FONT_COUNT || nDefaultFontHeight[nFontType] == nHeight)
+ return;
- LanguageType eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, css::i18n::ScriptType::LATIN),
- eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, css::i18n::ScriptType::ASIAN),
- eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, css::i18n::ScriptType::COMPLEX);
+ SvtLinguOptions aLinguOpt;
+ if (!utl::ConfigManager::IsFuzzing())
+ SvtLinguConfig().GetOptions( aLinguOpt );
- // #i92090# default height value sets back to -1
- const sal_Int32 nDefaultHeight = GetDefaultHeightFor(nFontType, lcl_LanguageOfType(nFontType, eWestern, eCJK, eCTL));
- const bool bIsDefaultHeight = nHeight == nDefaultHeight;
- if( bIsDefaultHeight && nDefaultFontHeight[nFontType] > 0 )
- {
- SetModified();
- nDefaultFontHeight[nFontType] = -1;
- }
- else if( !bIsDefaultHeight && nHeight != nDefaultFontHeight[nFontType] )
- {
- SetModified();
- nDefaultFontHeight[nFontType] = nHeight;
- }
+ LanguageType eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, css::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, css::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, css::i18n::ScriptType::COMPLEX);
+
+ // #i92090# default height value sets back to -1
+ const sal_Int32 nDefaultHeight = GetDefaultHeightFor(nFontType, lcl_LanguageOfType(nFontType, eWestern, eCJK, eCTL));
+ const bool bIsDefaultHeight = nHeight == nDefaultHeight;
+ if( bIsDefaultHeight && nDefaultFontHeight[nFontType] > 0 )
+ {
+ SetModified();
+ nDefaultFontHeight[nFontType] = -1;
+ }
+ else if( !bIsDefaultHeight && nHeight != nDefaultFontHeight[nFontType] )
+ {
+ SetModified();
+ nDefaultFontHeight[nFontType] = nHeight;
}
}
diff --git a/sw/source/uibase/config/uinums.cxx b/sw/source/uibase/config/uinums.cxx
index 0ffee44376e2..261d097a32a1 100644
--- a/sw/source/uibase/config/uinums.cxx
+++ b/sw/source/uibase/config/uinums.cxx
@@ -180,23 +180,23 @@ SwNumRulesWithName::SwNumFormatGlobal::SwNumFormatGlobal( const SwNumFormat& rFo
// relative gaps?????
SwCharFormat* pFormat = rFormat.GetCharFormat();
- if( pFormat )
+ if( !pFormat )
+ return;
+
+ sCharFormatName = pFormat->GetName();
+ nCharPoolId = pFormat->GetPoolFormatId();
+ if( pFormat->GetAttrSet().Count() )
{
- sCharFormatName = pFormat->GetName();
- nCharPoolId = pFormat->GetPoolFormatId();
- if( pFormat->GetAttrSet().Count() )
+ SfxItemIter aIter( pFormat->GetAttrSet() );
+ const SfxPoolItem *pCurr = aIter.GetCurItem();
+ do
{
- SfxItemIter aIter( pFormat->GetAttrSet() );
- const SfxPoolItem *pCurr = aIter.GetCurItem();
- do
- {
- m_Items.push_back(std::unique_ptr<SfxPoolItem>(pCurr->Clone()));
- pCurr = aIter.NextItem();
- } while (pCurr);
- }
-
- aFormat.SetCharFormat( nullptr );
+ m_Items.push_back(std::unique_ptr<SfxPoolItem>(pCurr->Clone()));
+ pCurr = aIter.NextItem();
+ } while (pCurr);
}
+
+ aFormat.SetCharFormat( nullptr );
}
SwNumRulesWithName::SwNumFormatGlobal::SwNumFormatGlobal( const SwNumFormatGlobal& rFormat )
diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx
index f6eb03e818f4..e537b987b149 100644
--- a/sw/source/uibase/config/usrpref.cxx
+++ b/sw/source/uibase/config/usrpref.cxx
@@ -185,45 +185,45 @@ void SwContentViewConfig::Load()
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
+ if(aValues.getLength() != aNames.getLength())
+ return;
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ if(pValues[nProp].hasValue())
{
- if(pValues[nProp].hasValue())
+ bool bSet = nProp != g_UpdateLinkIndex && *o3tl::doAccess<bool>(pValues[nProp]);
+ switch(nProp)
{
- bool bSet = nProp != g_UpdateLinkIndex && *o3tl::doAccess<bool>(pValues[nProp]);
- switch(nProp)
+ case 0: rParent.SetGraphic(bSet); break;// "Display/GraphicObject",
+ case 1: rParent.SetTable(bSet); break;// "Display/Table",
+ case 2: rParent.SetDraw(bSet); break;// "Display/DrawingControl",
+ case 3: rParent.SetFieldName(bSet); break;// "Display/FieldCode",
+ case 4: rParent.SetPostIts(bSet); break;// "Display/Note",
+ case 5: rParent.SetShowContentTips(bSet); break;// "Display/ShowContentTips",
+ case 6: rParent.SetViewMetaChars(bSet); break; //"NonprintingCharacter/MetaCharacters"
+ case 7: rParent.SetParagraph(bSet); break;// "NonprintingCharacter/ParagraphEnd",
+ case 8: rParent.SetSoftHyph(bSet); break;// "NonprintingCharacter/OptionalHyphen",
+ case 9: rParent.SetBlank(bSet); break;// "NonprintingCharacter/Space",
+ case 10: rParent.SetLineBreak(bSet);break;// "NonprintingCharacter/Break",
+ case 11: rParent.SetHardBlank(bSet); break;// "NonprintingCharacter/ProtectedSpace",
+ case 12: rParent.SetTab(bSet); break;// "NonprintingCharacter/Tab",
+ case 13: rParent.SetShowHiddenField(bSet); break;// "NonprintingCharacter/Fields: HiddenText",
+ case 14: rParent.SetShowHiddenPara(bSet); break;// "NonprintingCharacter/Fields: HiddenParagraph",
+ case 15: rParent.SetShowHiddenChar(bSet); break;// "NonprintingCharacter/HiddenCharacter",
+ case 16: rParent.SetShowBookmarks(bSet); break;// "NonprintingCharacter/Bookmarks",
+ case 17:
{
- case 0: rParent.SetGraphic(bSet); break;// "Display/GraphicObject",
- case 1: rParent.SetTable(bSet); break;// "Display/Table",
- case 2: rParent.SetDraw(bSet); break;// "Display/DrawingControl",
- case 3: rParent.SetFieldName(bSet); break;// "Display/FieldCode",
- case 4: rParent.SetPostIts(bSet); break;// "Display/Note",
- case 5: rParent.SetShowContentTips(bSet); break;// "Display/ShowContentTips",
- case 6: rParent.SetViewMetaChars(bSet); break; //"NonprintingCharacter/MetaCharacters"
- case 7: rParent.SetParagraph(bSet); break;// "NonprintingCharacter/ParagraphEnd",
- case 8: rParent.SetSoftHyph(bSet); break;// "NonprintingCharacter/OptionalHyphen",
- case 9: rParent.SetBlank(bSet); break;// "NonprintingCharacter/Space",
- case 10: rParent.SetLineBreak(bSet);break;// "NonprintingCharacter/Break",
- case 11: rParent.SetHardBlank(bSet); break;// "NonprintingCharacter/ProtectedSpace",
- case 12: rParent.SetTab(bSet); break;// "NonprintingCharacter/Tab",
- case 13: rParent.SetShowHiddenField(bSet); break;// "NonprintingCharacter/Fields: HiddenText",
- case 14: rParent.SetShowHiddenPara(bSet); break;// "NonprintingCharacter/Fields: HiddenParagraph",
- case 15: rParent.SetShowHiddenChar(bSet); break;// "NonprintingCharacter/HiddenCharacter",
- case 16: rParent.SetShowBookmarks(bSet); break;// "NonprintingCharacter/Bookmarks",
- case 17:
- {
- sal_Int32 nSet = 0;
- pValues[nProp] >>= nSet;
- rParent.SetUpdateLinkMode(nSet, true);
- }
- break;// "Update/Link",
- case 18: rParent.SetUpdateFields(bSet); break;// "Update/Field",
- case 19: rParent.SetUpdateCharts(bSet); break;// "Update/Chart"
- case 20: rParent.SetShowInlineTooltips(bSet); break;// "Display/ShowInlineTooltips"
- case 21: rParent.SetUseHeaderFooterMenu(bSet); break;// "Display/UseHeaderFooterMenu"
- case 22: rParent.SetShowOutlineContentVisibilityButton(bSet); break;// "Display/ShowOutlineContententVisibilityButton"
+ sal_Int32 nSet = 0;
+ pValues[nProp] >>= nSet;
+ rParent.SetUpdateLinkMode(nSet, true);
}
+ break;// "Update/Link",
+ case 18: rParent.SetUpdateFields(bSet); break;// "Update/Field",
+ case 19: rParent.SetUpdateCharts(bSet); break;// "Update/Chart"
+ case 20: rParent.SetShowInlineTooltips(bSet); break;// "Display/ShowInlineTooltips"
+ case 21: rParent.SetUseHeaderFooterMenu(bSet); break;// "Display/UseHeaderFooterMenu"
+ case 22: rParent.SetShowOutlineContentVisibilityButton(bSet); break;// "Display/ShowOutlineContententVisibilityButton"
}
}
}
@@ -328,50 +328,50 @@ void SwLayoutViewConfig::Load()
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
+ if(aValues.getLength() != aNames.getLength())
+ return;
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ if(pValues[nProp].hasValue())
{
- if(pValues[nProp].hasValue())
- {
- sal_Int32 nInt32Val = 0;
- bool bSet = false;
- pValues[nProp] >>= nInt32Val;
- pValues[nProp] >>= bSet;
+ sal_Int32 nInt32Val = 0;
+ bool bSet = false;
+ pValues[nProp] >>= nInt32Val;
+ pValues[nProp] >>= bSet;
- switch(nProp)
+ switch(nProp)
+ {
+ case 0: rParent.SetCrossHair(bSet); break;// "Line/Guide",
+ case 1: rParent.SetViewHScrollBar(bSet); break;// "Window/HorizontalScroll",
+ case 2: rParent.SetViewVScrollBar(bSet); break;// "Window/VerticalScroll",
+ case 3: rParent.SetViewAnyRuler(bSet);break; // "Window/ShowRulers"
+ case 4: rParent.SetViewHRuler(bSet); break;// "Window/HorizontalRuler",
+ case 5: rParent.SetViewVRuler(bSet); break;// "Window/VerticalRuler",
+ case 6:
+ {
+ rParent.m_bIsHScrollMetricSet = true;
+ rParent.m_eHScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/HorizontalRulerUnit"
+ }
+ break;
+ case 7:
{
- case 0: rParent.SetCrossHair(bSet); break;// "Line/Guide",
- case 1: rParent.SetViewHScrollBar(bSet); break;// "Window/HorizontalScroll",
- case 2: rParent.SetViewVScrollBar(bSet); break;// "Window/VerticalScroll",
- case 3: rParent.SetViewAnyRuler(bSet);break; // "Window/ShowRulers"
- case 4: rParent.SetViewHRuler(bSet); break;// "Window/HorizontalRuler",
- case 5: rParent.SetViewVRuler(bSet); break;// "Window/VerticalRuler",
- case 6:
- {
- rParent.m_bIsHScrollMetricSet = true;
- rParent.m_eHScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/HorizontalRulerUnit"
- }
- break;
- case 7:
- {
- rParent.m_bIsVScrollMetricSet = true;
- rParent.m_eVScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/VerticalRulerUnit"
- }
- break;
- case 8: rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll",
- case 9: rParent.SetZoom( static_cast< sal_uInt16 >(nInt32Val) ); break;// "Zoom/Value",
- case 10: rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type",
- case 11: rParent.SetAlignMathObjectsToBaseline(bSet, true); break;// "Other/IsAlignMathObjectsToBaseline"
- case 12: rParent.SetMetric(static_cast<FieldUnit>(nInt32Val), true); break;// "Other/MeasureUnit",
- case 13: rParent.SetDefTabInMm100(nInt32Val, true); break;// "Other/TabStop",
- case 14: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight",
- case 15: rParent.SetViewLayoutColumns( static_cast<sal_uInt16>(nInt32Val) ); break;// "ViewLayout/Columns",
- case 16: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode",
- case 17: rParent.SetDefaultPageMode(bSet,true); break;// "Other/IsSquaredPageMode",
- case 18: rParent.SetApplyCharUnit(bSet, true); break;// "Other/ApplyUserChar"
- case 19: rParent.SetShowScrollBarTips(bSet); break;// "Window/ShowScrollBarTips",
+ rParent.m_bIsVScrollMetricSet = true;
+ rParent.m_eVScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/VerticalRulerUnit"
}
+ break;
+ case 8: rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll",
+ case 9: rParent.SetZoom( static_cast< sal_uInt16 >(nInt32Val) ); break;// "Zoom/Value",
+ case 10: rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type",
+ case 11: rParent.SetAlignMathObjectsToBaseline(bSet, true); break;// "Other/IsAlignMathObjectsToBaseline"
+ case 12: rParent.SetMetric(static_cast<FieldUnit>(nInt32Val), true); break;// "Other/MeasureUnit",
+ case 13: rParent.SetDefTabInMm100(nInt32Val, true); break;// "Other/TabStop",
+ case 14: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight",
+ case 15: rParent.SetViewLayoutColumns( static_cast<sal_uInt16>(nInt32Val) ); break;// "ViewLayout/Columns",
+ case 16: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode",
+ case 17: rParent.SetDefaultPageMode(bSet,true); break;// "Other/IsSquaredPageMode",
+ case 18: rParent.SetApplyCharUnit(bSet, true); break;// "Other/ApplyUserChar"
+ case 19: rParent.SetShowScrollBarTips(bSet); break;// "Window/ShowScrollBarTips",
}
}
}
@@ -441,31 +441,31 @@ void SwGridConfig::Load()
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
+ if(aValues.getLength() != aNames.getLength())
+ return;
+
+ Size aSnap(rParent.GetSnapSize());
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
- Size aSnap(rParent.GetSnapSize());
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ if(pValues[nProp].hasValue())
{
- if(pValues[nProp].hasValue())
+ bool bSet = nProp < 3 && *o3tl::doAccess<bool>(pValues[nProp]);
+ sal_Int32 nSet = 0;
+ if(nProp >= 3)
+ pValues[nProp] >>= nSet;
+ switch(nProp)
{
- bool bSet = nProp < 3 && *o3tl::doAccess<bool>(pValues[nProp]);
- sal_Int32 nSet = 0;
- if(nProp >= 3)
- pValues[nProp] >>= nSet;
- switch(nProp)
- {
- case 0: rParent.SetSnap(bSet); break;// "Option/SnapToGrid",
- case 1: rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid",
- case 2: rParent.SetSynchronize(bSet); break;// "Option/Synchronize",
- case 3: aSnap.setWidth( convertMm100ToTwip(nSet) ); break;// "Resolution/XAxis",
- case 4: aSnap.setHeight( convertMm100ToTwip(nSet) ); break;// "Resolution/YAxis",
- case 5: rParent.SetDivisionX(static_cast<short>(nSet)); break;// "Subdivision/XAxis",
- case 6: rParent.SetDivisionY(static_cast<short>(nSet)); break;// "Subdivision/YAxis"
- }
+ case 0: rParent.SetSnap(bSet); break;// "Option/SnapToGrid",
+ case 1: rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid",
+ case 2: rParent.SetSynchronize(bSet); break;// "Option/Synchronize",
+ case 3: aSnap.setWidth( convertMm100ToTwip(nSet) ); break;// "Resolution/XAxis",
+ case 4: aSnap.setHeight( convertMm100ToTwip(nSet) ); break;// "Resolution/YAxis",
+ case 5: rParent.SetDivisionX(static_cast<short>(nSet)); break;// "Subdivision/XAxis",
+ case 6: rParent.SetDivisionY(static_cast<short>(nSet)); break;// "Subdivision/YAxis"
}
}
- rParent.SetSnapSize(aSnap);
}
+ rParent.SetSnapSize(aSnap);
}
void SwGridConfig::Notify( const css::uno::Sequence< OUString >& ) {}
@@ -521,28 +521,27 @@ void SwCursorConfig::Load()
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
- {
+ if(aValues.getLength() != aNames.getLength())
+ return;
+
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
{
- if(pValues[nProp].hasValue())
+ bool bSet = false;
+ sal_Int32 nSet = 0;
+ if(nProp != 1 )
+ bSet = *o3tl::doAccess<bool>(pValues[nProp]);
+ else
+ pValues[nProp] >>= nSet;
+ switch(nProp)
{
- bool bSet = false;
- sal_Int32 nSet = 0;
- if(nProp != 1 )
- bSet = *o3tl::doAccess<bool>(pValues[nProp]);
- else
- pValues[nProp] >>= nSet;
- switch(nProp)
- {
- case 0: rParent.SetShadowCursor(bSet); break; // "DirectCursor/UseDirectCursor",
- case 1: rParent.SetShdwCursorFillMode(static_cast<SwFillMode>(nSet)); break; // "DirectCursor/Insert",
- case 2: rParent.SetCursorInProtectedArea(bSet); break; // "Option/ProtectedArea"
- }
+ case 0: rParent.SetShadowCursor(bSet); break; // "DirectCursor/UseDirectCursor",
+ case 1: rParent.SetShdwCursorFillMode(static_cast<SwFillMode>(nSet)); break; // "DirectCursor/Insert",
+ case 2: rParent.SetCursorInProtectedArea(bSet); break; // "Option/ProtectedArea"
}
}
-
}
}
@@ -581,19 +580,19 @@ void SwWebColorConfig::Load()
Sequence<Any> aValues = GetProperties(aPropNames);
const Any* pValues = aValues.getConstArray();
OSL_ENSURE(aValues.getLength() == aPropNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aPropNames.getLength())
+ if(aValues.getLength() != aPropNames.getLength())
+ return;
+
+ for(int nProp = 0; nProp < aPropNames.getLength(); nProp++)
{
- for(int nProp = 0; nProp < aPropNames.getLength(); nProp++)
+ if(pValues[nProp].hasValue())
{
- if(pValues[nProp].hasValue())
+ switch(nProp)
{
- switch(nProp)
- {
- case 0:
- Color nSet;
- pValues[nProp] >>= nSet; rParent.SetRetoucheColor(nSet);
- break;// "Color",
- }
+ case 0:
+ Color nSet;
+ pValues[nProp] >>= nSet; rParent.SetRetoucheColor(nSet);
+ break;// "Color",
}
}
}
diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx
index 194c89bbac51..654f9d51713e 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -130,20 +130,20 @@ sal_uInt16 SwViewOption::GetPostItsWidth( const OutputDevice *pOut )
void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, bool bIsScript )
{
- if( pOut && bIsScript )
- {
- Color aOldLineColor( pOut->GetLineColor() );
- pOut->SetLineColor( COL_GRAY );
- // to make it look nice, we subtract two pixels everywhere
- sal_uInt16 nPix = s_nPixelTwips * 2;
- if( rRect.Width() <= 2 * nPix || rRect.Height() <= 2 * nPix )
- nPix = 0;
- const Point aTopLeft( rRect.Left() + nPix, rRect.Top() + nPix );
- const Point aBotRight( rRect.Right() - nPix, rRect.Bottom() - nPix );
- const SwRect aRect( aTopLeft, aBotRight );
- DrawRect( pOut, aRect, s_aScriptIndicatorColor );
- pOut->SetLineColor( aOldLineColor );
- }
+ if( !(pOut && bIsScript) )
+ return;
+
+ Color aOldLineColor( pOut->GetLineColor() );
+ pOut->SetLineColor( COL_GRAY );
+ // to make it look nice, we subtract two pixels everywhere
+ sal_uInt16 nPix = s_nPixelTwips * 2;
+ if( rRect.Width() <= 2 * nPix || rRect.Height() <= 2 * nPix )
+ nPix = 0;
+ const Point aTopLeft( rRect.Left() + nPix, rRect.Top() + nPix );
+ const Point aBotRight( rRect.Right() - nPix, rRect.Bottom() - nPix );
+ const SwRect aRect( aTopLeft, aBotRight );
+ DrawRect( pOut, aRect, s_aScriptIndicatorColor );
+ pOut->SetLineColor( aOldLineColor );
}
SwViewOption::SwViewOption() :
@@ -524,39 +524,39 @@ void SwViewOption::SetAppearanceFlag(ViewOptFlags nFlag, bool bSet, bool bSaveIn
s_nAppearanceFlags |= nFlag;
else
s_nAppearanceFlags &= ~nFlag;
- if(bSaveInConfig)
+ if(!bSaveInConfig)
+ return;
+
+ //create an editable svtools::ColorConfig and store the change
+ svtools::EditableColorConfig aEditableConfig;
+ struct FlagToConfig_Impl
{
- //create an editable svtools::ColorConfig and store the change
- svtools::EditableColorConfig aEditableConfig;
- struct FlagToConfig_Impl
- {
- ViewOptFlags nFlag;
- svtools::ColorConfigEntry eEntry;
- };
- static const FlagToConfig_Impl aFlags[] =
- {
- { ViewOptFlags::DocBoundaries , svtools::DOCBOUNDARIES },
- { ViewOptFlags::ObjectBoundaries , svtools::OBJECTBOUNDARIES },
- { ViewOptFlags::TableBoundaries , svtools::TABLEBOUNDARIES },
- { ViewOptFlags::IndexShadings , svtools::WRITERIDXSHADINGS },
- { ViewOptFlags::Links , svtools::LINKS },
- { ViewOptFlags::VisitedLinks , svtools::LINKSVISITED },
- { ViewOptFlags::FieldShadings , svtools::WRITERFIELDSHADINGS },
- { ViewOptFlags::SectionBoundaries , svtools::WRITERSECTIONBOUNDARIES },
- { ViewOptFlags::Shadow , svtools::SHADOWCOLOR },
- { ViewOptFlags::NONE , svtools::ColorConfigEntryCount }
- };
- sal_uInt16 nPos = 0;
- while(aFlags[nPos].nFlag != ViewOptFlags::NONE)
+ ViewOptFlags nFlag;
+ svtools::ColorConfigEntry eEntry;
+ };
+ static const FlagToConfig_Impl aFlags[] =
+ {
+ { ViewOptFlags::DocBoundaries , svtools::DOCBOUNDARIES },
+ { ViewOptFlags::ObjectBoundaries , svtools::OBJECTBOUNDARIES },
+ { ViewOptFlags::TableBoundaries , svtools::TABLEBOUNDARIES },
+ { ViewOptFlags::IndexShadings , svtools::WRITERIDXSHADINGS },
+ { ViewOptFlags::Links , svtools::LINKS },
+ { ViewOptFlags::VisitedLinks , svtools::LINKSVISITED },
+ { ViewOptFlags::FieldShadings , svtools::WRITERFIELDSHADINGS },
+ { ViewOptFlags::SectionBoundaries , svtools::WRITERSECTIONBOUNDARIES },
+ { ViewOptFlags::Shadow , svtools::SHADOWCOLOR },
+ { ViewOptFlags::NONE , svtools::ColorConfigEntryCount }
+ };
+ sal_uInt16 nPos = 0;
+ while(aFlags[nPos].nFlag != ViewOptFlags::NONE)
+ {
+ if(nFlag & aFlags[nPos].nFlag)
{
- if(nFlag & aFlags[nPos].nFlag)
- {
- svtools::ColorConfigValue aValue = aEditableConfig.GetColorValue(aFlags[nPos].eEntry);
- aValue.bIsVisible = bSet;
- aEditableConfig.SetColorValue(aFlags[nPos].eEntry, aValue);
- }
- nPos++;
+ svtools::ColorConfigValue aValue = aEditableConfig.GetColorValue(aFlags[nPos].eEntry);
+ aValue.bIsVisible = bSet;
+ aEditableConfig.SetColorValue(aFlags[nPos].eEntry, aValue);
}
+ nPos++;
}
}
More information about the Libreoffice-commits
mailing list