summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-22 12:53:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-23 09:02:58 +0200
commita8622c77d26ca7a635afc95bba9a5054dc31eb7c (patch)
treeecb1ce71272291515dec10fc5fe94061f7231b78 /starmath
parent2684aefcf5d2804351bda01a2d2fe7bbbd351451 (diff)
loplugin:flatten in sdext..stoc
Change-Id: I460e813e20a691c53738373376d3363f553bbab2 Reviewed-on: https://gerrit.libreoffice.org/42636 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/unomodel.cxx108
1 files changed, 51 insertions, 57 deletions
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index ef5276b6512d..114662deaf15 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -584,19 +584,17 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
if (pPrinter)
{
OUString sPrinterName;
- if (*pValues >>= sPrinterName )
+ if ( !(*pValues >>= sPrinterName) )
+ throw IllegalArgumentException();
+
+ if ( !sPrinterName.isEmpty() )
{
- if ( !sPrinterName.isEmpty() )
- {
- VclPtrInstance<SfxPrinter> pNewPrinter( std::unique_ptr<SfxItemSet>(pPrinter->GetOptions().Clone()), sPrinterName );
- if (pNewPrinter->IsKnown())
- pDocSh->SetPrinter ( pNewPrinter );
- else
- pNewPrinter.disposeAndClear();
- }
+ VclPtrInstance<SfxPrinter> pNewPrinter( std::unique_ptr<SfxItemSet>(pPrinter->GetOptions().Clone()), sPrinterName );
+ if (pNewPrinter->IsKnown())
+ pDocSh->SetPrinter ( pNewPrinter );
+ else
+ pNewPrinter.disposeAndClear();
}
- else
- throw IllegalArgumentException();
}
}
}
@@ -604,61 +602,57 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
case HANDLE_PRINTER_SETUP:
{
Sequence < sal_Int8 > aSequence;
- if ( *pValues >>= aSequence )
- {
- sal_uInt32 nSize = aSequence.getLength();
- SvMemoryStream aStream ( aSequence.getArray(), nSize, StreamMode::READ );
- aStream.Seek ( STREAM_SEEK_TO_BEGIN );
- static sal_uInt16 const nRange[] =
- {
- SID_PRINTSIZE, SID_PRINTSIZE,
- SID_PRINTZOOM, SID_PRINTZOOM,
- SID_PRINTTITLE, SID_PRINTTITLE,
- SID_PRINTTEXT, SID_PRINTTEXT,
- SID_PRINTFRAME, SID_PRINTFRAME,
- SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES,
- SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS,
- SID_AUTO_CLOSE_BRACKETS, SID_AUTO_CLOSE_BRACKETS,
- 0
- };
- auto pItemSet = o3tl::make_unique<SfxItemSet>( SmDocShell::GetPool(), nRange );
- SmModule *pp = SM_MOD();
- pp->GetConfig()->ConfigToItemSet(*pItemSet);
- VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
-
- pDocSh->SetPrinter( pPrinter );
- }
- else
+ if ( !(*pValues >>= aSequence) )
throw IllegalArgumentException();
+
+ sal_uInt32 nSize = aSequence.getLength();
+ SvMemoryStream aStream ( aSequence.getArray(), nSize, StreamMode::READ );
+ aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+ static sal_uInt16 const nRange[] =
+ {
+ SID_PRINTSIZE, SID_PRINTSIZE,
+ SID_PRINTZOOM, SID_PRINTZOOM,
+ SID_PRINTTITLE, SID_PRINTTITLE,
+ SID_PRINTTEXT, SID_PRINTTEXT,
+ SID_PRINTFRAME, SID_PRINTFRAME,
+ SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES,
+ SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS,
+ SID_AUTO_CLOSE_BRACKETS, SID_AUTO_CLOSE_BRACKETS,
+ 0
+ };
+ auto pItemSet = o3tl::make_unique<SfxItemSet>( SmDocShell::GetPool(), nRange );
+ SmModule *pp = SM_MOD();
+ pp->GetConfig()->ConfigToItemSet(*pItemSet);
+ VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
+
+ pDocSh->SetPrinter( pPrinter );
}
break;
case HANDLE_SYMBOLS:
{
// this is set
Sequence < SymbolDescriptor > aSequence;
- if ( *pValues >>= aSequence )
+ if ( !(*pValues >>= aSequence) )
+ throw IllegalArgumentException();
+
+ sal_uInt32 nSize = aSequence.getLength();
+ SmModule *pp = SM_MOD();
+ SmSymbolManager &rManager = pp->GetSymbolManager();
+ SymbolDescriptor *pDescriptor = aSequence.getArray();
+ for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++)
{
- sal_uInt32 nSize = aSequence.getLength();
- SmModule *pp = SM_MOD();
- SmSymbolManager &rManager = pp->GetSymbolManager();
- SymbolDescriptor *pDescriptor = aSequence.getArray();
- for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++)
- {
- vcl::Font aFont;
- aFont.SetFamilyName ( pDescriptor->sFontName );
- aFont.SetCharSet ( static_cast < rtl_TextEncoding > (pDescriptor->nCharSet) );
- aFont.SetFamily ( static_cast < FontFamily > (pDescriptor->nFamily ) );
- aFont.SetPitch ( static_cast < FontPitch > (pDescriptor->nPitch ) );
- aFont.SetWeight ( static_cast < FontWeight > (pDescriptor->nWeight ) );
- aFont.SetItalic ( static_cast < FontItalic > (pDescriptor->nItalic ) );
- SmSym aSymbol ( pDescriptor->sName, aFont, static_cast < sal_Unicode > (pDescriptor->nCharacter),
- pDescriptor->sSymbolSet );
- aSymbol.SetExportName ( pDescriptor->sExportName );
- rManager.AddOrReplaceSymbol ( aSymbol );
- }
+ vcl::Font aFont;
+ aFont.SetFamilyName ( pDescriptor->sFontName );
+ aFont.SetCharSet ( static_cast < rtl_TextEncoding > (pDescriptor->nCharSet) );
+ aFont.SetFamily ( static_cast < FontFamily > (pDescriptor->nFamily ) );
+ aFont.SetPitch ( static_cast < FontPitch > (pDescriptor->nPitch ) );
+ aFont.SetWeight ( static_cast < FontWeight > (pDescriptor->nWeight ) );
+ aFont.SetItalic ( static_cast < FontItalic > (pDescriptor->nItalic ) );
+ SmSym aSymbol ( pDescriptor->sName, aFont, static_cast < sal_Unicode > (pDescriptor->nCharacter),
+ pDescriptor->sSymbolSet );
+ aSymbol.SetExportName ( pDescriptor->sExportName );
+ rManager.AddOrReplaceSymbol ( aSymbol );
}
- else
- throw IllegalArgumentException();
}
break;
// #i33095# Security Options