loplugin:flatten in scaddins..sd
Change-Id: I190323ce910224f883c4370b2c752644a5a35edd Reviewed-on: https://gerrit.libreoffice.org/42626 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -39,6 +39,7 @@ private:
|
||||
SourceRange ignoreMacroExpansions(SourceRange range);
|
||||
SourceRange extendOverComments(SourceRange range);
|
||||
std::string getSourceAsString(SourceRange range);
|
||||
std::string invertCondition(Expr const * condExpr, SourceRange conditionRange);
|
||||
};
|
||||
|
||||
static const Stmt * containsSingleThrowExpr(const Stmt * stmt)
|
||||
@@ -131,14 +132,7 @@ bool Flatten::rewrite(const IfStmt* ifStmt)
|
||||
|
||||
// in adjusting the formatting I assume that "{" starts on a new line
|
||||
|
||||
std::string conditionString = getSourceAsString(conditionRange);
|
||||
auto condExpr = ifStmt->getCond()->IgnoreImpCasts();
|
||||
if (auto exprWithCleanups = dyn_cast<ExprWithCleanups>(condExpr))
|
||||
condExpr = exprWithCleanups->getSubExpr()->IgnoreImpCasts();
|
||||
if (isa<DeclRefExpr>(condExpr) || isa<CallExpr>(condExpr) || isa<MemberExpr>(condExpr))
|
||||
conditionString = "!" + conditionString;
|
||||
else
|
||||
conditionString = "!(" + conditionString + ")";
|
||||
std::string conditionString = invertCondition(ifStmt->getCond(), conditionRange);
|
||||
|
||||
std::string thenString = getSourceAsString(thenRange);
|
||||
if (auto compoundStmt = dyn_cast<CompoundStmt>(ifStmt->getThen())) {
|
||||
@@ -166,6 +160,32 @@ bool Flatten::rewrite(const IfStmt* ifStmt)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string Flatten::invertCondition(Expr const * condExpr, SourceRange conditionRange)
|
||||
{
|
||||
std::string s = getSourceAsString(conditionRange);
|
||||
|
||||
condExpr = condExpr->IgnoreImpCasts();
|
||||
|
||||
if (auto exprWithCleanups = dyn_cast<ExprWithCleanups>(condExpr))
|
||||
condExpr = exprWithCleanups->getSubExpr()->IgnoreImpCasts();
|
||||
|
||||
if (auto unaryOp = dyn_cast<UnaryOperator>(condExpr))
|
||||
{
|
||||
if (unaryOp->getOpcode() != UO_LNot)
|
||||
return "!(" + s + ")";
|
||||
auto i = s.find("!");
|
||||
assert (i != std::string::npos);
|
||||
s = s.substr(i+1);
|
||||
}
|
||||
else if (isa<CXXOperatorCallExpr>(condExpr))
|
||||
s = "!(" + s + ")";
|
||||
else if (isa<DeclRefExpr>(condExpr) || isa<CallExpr>(condExpr) || isa<MemberExpr>(condExpr))
|
||||
s = "!" + s;
|
||||
else
|
||||
s = "!(" + s + ")";
|
||||
return s;
|
||||
}
|
||||
|
||||
std::string stripOpenAndCloseBrace(std::string s)
|
||||
{
|
||||
size_t i = s.find("{");
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#define CHK_Freq ( nFreq != 1 && nFreq != 2 && nFreq != 4 )
|
||||
#define CHK_FINITE(d) if( !::rtl::math::isFinite( d ) ) throw css::lang::IllegalArgumentException()
|
||||
#define RETURN_FINITE(d) if( ::rtl::math::isFinite( d ) ) return d; else throw css::lang::IllegalArgumentException()
|
||||
#define RETURN_FINITE(d) if( !::rtl::math::isFinite( d ) ) throw css::lang::IllegalArgumentException(); return d;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -686,18 +686,15 @@ double ConvertToDec( const OUString& aStr, sal_uInt16 nBase, sal_uInt16 nCharLim
|
||||
else
|
||||
n = nBase;
|
||||
|
||||
if( n < nBase )
|
||||
{
|
||||
if( n >= nBase )
|
||||
throw lang::IllegalArgumentException(); // illegal char!
|
||||
|
||||
if( bFirstDig )
|
||||
{
|
||||
bFirstDig = false;
|
||||
nFirstDig = n;
|
||||
}
|
||||
fVal = fVal * fBase + double( n );
|
||||
}
|
||||
else
|
||||
// illegal char!
|
||||
throw lang::IllegalArgumentException();
|
||||
|
||||
p++;
|
||||
|
||||
@@ -1504,8 +1501,9 @@ void SortedIndividualInt32List::InsertHolidayList(
|
||||
if( rHolAny.getValueTypeClass() == uno::TypeClass_SEQUENCE )
|
||||
{
|
||||
uno::Sequence< uno::Sequence< uno::Any > > aAnySeq;
|
||||
if( rHolAny >>= aAnySeq )
|
||||
{
|
||||
if( !(rHolAny >>= aAnySeq) )
|
||||
throw lang::IllegalArgumentException();
|
||||
|
||||
const uno::Sequence< uno::Any >* pSeqArray = aAnySeq.getConstArray();
|
||||
for( sal_Int32 nIndex1 = 0; nIndex1 < aAnySeq.getLength(); nIndex1++ )
|
||||
{
|
||||
@@ -1516,9 +1514,6 @@ void SortedIndividualInt32List::InsertHolidayList(
|
||||
InsertHolidayList( rAnyConv, pAnyArray[ nIndex2 ], nNullDate, false/*bInsertOnWeekend*/ );
|
||||
}
|
||||
}
|
||||
else
|
||||
throw lang::IllegalArgumentException();
|
||||
}
|
||||
else
|
||||
InsertHolidayList( rAnyConv, rHolAny, nNullDate, false/*bInsertOnWeekend*/ );
|
||||
}
|
||||
@@ -1751,14 +1746,11 @@ void Complex::Power( double fPower )
|
||||
{
|
||||
if( r == 0.0 && i == 0.0 )
|
||||
{
|
||||
if( fPower > 0 )
|
||||
{
|
||||
if( fPower <= 0 )
|
||||
throw lang::IllegalArgumentException();
|
||||
r = i = 0.0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
throw lang::IllegalArgumentException();
|
||||
}
|
||||
|
||||
double p, phi;
|
||||
|
||||
@@ -2102,16 +2094,14 @@ void ComplexList::Append( const uno::Sequence< uno::Any >& aMultPars, ComplListA
|
||||
case uno::TypeClass_SEQUENCE:
|
||||
{
|
||||
uno::Sequence< uno::Sequence< uno::Any > > aValArr;
|
||||
if( r >>= aValArr )
|
||||
{
|
||||
if( !(r >>= aValArr) )
|
||||
throw lang::IllegalArgumentException();
|
||||
|
||||
sal_Int32 nE = aValArr.getLength();
|
||||
const uno::Sequence< uno::Any >* pArr = aValArr.getConstArray();
|
||||
for( sal_Int32 n = 0 ; n < nE ; n++ )
|
||||
Append( pArr[ n ], eAH );
|
||||
}
|
||||
else
|
||||
throw lang::IllegalArgumentException();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw lang::IllegalArgumentException();
|
||||
@@ -2558,10 +2548,10 @@ double ConvertDataList::Convert( double fVal, const OUString& rFrom, const OUStr
|
||||
++it;
|
||||
}
|
||||
|
||||
if( pFrom && pTo )
|
||||
return pFrom->Convert( fVal, *pTo, nLevelFrom, nLevelTo );
|
||||
else
|
||||
if( !pFrom || !pTo )
|
||||
throw lang::IllegalArgumentException();
|
||||
|
||||
return pFrom->Convert( fVal, *pTo, nLevelFrom, nLevelTo );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -74,10 +74,9 @@ double BesselJ( double x, sal_Int32 N )
|
||||
bool bAsymptoticPossible = pow(fX,0.4) > N;
|
||||
if (fEstimateIteration > fMaxIteration)
|
||||
{
|
||||
if (bAsymptoticPossible)
|
||||
return fSign * sqrt(f_2_DIV_PI/fX)* cos(fX-N*f_PI_DIV_2-f_PI_DIV_4);
|
||||
else
|
||||
if (!bAsymptoticPossible)
|
||||
throw NoConvergenceException();
|
||||
return fSign * sqrt(f_2_DIV_PI/fX)* cos(fX-N*f_PI_DIV_2-f_PI_DIV_4);
|
||||
}
|
||||
|
||||
double const epsilon = 1.0e-15; // relative error
|
||||
@@ -148,10 +147,10 @@ double BesselJ( double x, sal_Int32 N )
|
||||
k = k + 1.0;
|
||||
}
|
||||
while (!bHasfound && k <= fMaxIteration);
|
||||
if (bHasfound)
|
||||
return u * fSign;
|
||||
else
|
||||
if (!bHasfound)
|
||||
throw NoConvergenceException(); // unlikely to happen
|
||||
|
||||
return u * fSign;
|
||||
}
|
||||
|
||||
|
||||
@@ -367,10 +366,9 @@ double Bessely0( double fX )
|
||||
k=k+1;
|
||||
}
|
||||
while (!bHasFound && k<fMaxIteration);
|
||||
if (bHasFound)
|
||||
return u*f_2_DIV_PI;
|
||||
else
|
||||
if (!bHasFound)
|
||||
throw NoConvergenceException(); // not likely to happen
|
||||
return u*f_2_DIV_PI;
|
||||
}
|
||||
|
||||
// See #i31656# for a commented version of this implementation, attachment #desc6
|
||||
@@ -423,10 +421,9 @@ double Bessely1( double fX )
|
||||
k=k+1;
|
||||
}
|
||||
while (!bHasFound && k<fMaxIteration);
|
||||
if (bHasFound)
|
||||
return -u*2.0/f_PI;
|
||||
else
|
||||
if (!bHasFound)
|
||||
throw NoConvergenceException();
|
||||
return -u*2.0/f_PI;
|
||||
}
|
||||
|
||||
double BesselY( double fNum, sal_Int32 nOrder )
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <com/sun/star/sheet/addin/XPricingFunctions.hpp>
|
||||
#include <cppuhelper/implbase.hxx>
|
||||
|
||||
#define RETURN_FINITE(d) if( ::rtl::math::isFinite( d ) ) return d; else throw css::lang::IllegalArgumentException()
|
||||
#define RETURN_FINITE(d) if( !::rtl::math::isFinite( d ) ) throw css::lang::IllegalArgumentException(); return d;
|
||||
|
||||
|
||||
namespace sca {
|
||||
|
||||
@@ -185,8 +185,13 @@ namespace basprov
|
||||
Any BasicMethodNodeImpl::invoke( const OUString& aFunctionName, const Sequence< Any >&,
|
||||
Sequence< sal_Int16 >&, Sequence< Any >& )
|
||||
{
|
||||
if ( aFunctionName == BASPROV_PROPERTY_EDITABLE )
|
||||
if ( aFunctionName != BASPROV_PROPERTY_EDITABLE )
|
||||
{
|
||||
throw IllegalArgumentException(
|
||||
"BasicMethodNodeImpl::invoke: function name not supported!",
|
||||
Reference< XInterface >(), 1 );
|
||||
}
|
||||
|
||||
OUString sDocURL, sLibName, sModName;
|
||||
sal_uInt16 nLine1 = 0, nLine2;
|
||||
|
||||
@@ -252,13 +257,7 @@ namespace basprov
|
||||
xHelper->executeDispatch( xProv, ".uno:BasicIDEAppear", OUString(), 0, aArgs );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw IllegalArgumentException(
|
||||
"BasicMethodNodeImpl::invoke: function name not supported!",
|
||||
Reference< XInterface >(), 1 );
|
||||
}
|
||||
|
||||
|
||||
return Any();
|
||||
}
|
||||
|
||||
@@ -335,20 +335,15 @@ namespace dlgprov
|
||||
if ( !m_xEventAttacher.is() )
|
||||
{
|
||||
Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
|
||||
if ( xSMgr.is() )
|
||||
{
|
||||
if ( !xSMgr.is() )
|
||||
throw RuntimeException();
|
||||
|
||||
m_xEventAttacher.set( xSMgr->createInstanceWithContext(
|
||||
"com.sun.star.script.EventAttacher", m_xContext ), UNO_QUERY );
|
||||
|
||||
if ( !m_xEventAttacher.is() )
|
||||
throw ServiceNotRegisteredException();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw RuntimeException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
OUString sDialogCodeName;
|
||||
sal_Int32 nObjCount = Objects.getLength();
|
||||
|
||||
@@ -300,8 +300,15 @@ MasterScriptProvider::getScript( const OUString& scriptURI )
|
||||
buf.append( "com.sun.star.script.provider.ScriptProviderFor");
|
||||
buf.append( language );
|
||||
OUString serviceName = buf.makeStringAndClear();
|
||||
if ( providerCache() )
|
||||
if ( !providerCache() )
|
||||
{
|
||||
throw provider::ScriptFrameworkErrorException(
|
||||
"No LanguageProviders detected",
|
||||
Reference< XInterface >(),
|
||||
sfUri->getName(), language,
|
||||
provider::ScriptFrameworkErrorType::NOTSUPPORTED );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
xScriptProvider.set(
|
||||
@@ -315,15 +322,7 @@ MasterScriptProvider::getScript( const OUString& scriptURI )
|
||||
sfUri->getName(), language,
|
||||
provider::ScriptFrameworkErrorType::NOTSUPPORTED );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw provider::ScriptFrameworkErrorException(
|
||||
"No LanguageProviders detected",
|
||||
Reference< XInterface >(),
|
||||
sfUri->getName(), language,
|
||||
provider::ScriptFrameworkErrorType::NOTSUPPORTED );
|
||||
}
|
||||
|
||||
xScript=xScriptProvider->getScript( scriptURI );
|
||||
}
|
||||
else
|
||||
@@ -457,16 +456,13 @@ MasterScriptProvider::insertByName( const OUString& aName, const Any& aElement )
|
||||
{
|
||||
if ( !m_bIsPkgMSP )
|
||||
{
|
||||
if ( m_xMSPPkg.is() )
|
||||
{
|
||||
Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW );
|
||||
xCont->insertByName( aName, aElement );
|
||||
}
|
||||
else
|
||||
if ( !m_xMSPPkg.is() )
|
||||
{
|
||||
throw RuntimeException( "PackageMasterScriptProvider is unitialised" );
|
||||
}
|
||||
|
||||
Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW );
|
||||
xCont->insertByName( aName, aElement );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -529,16 +525,13 @@ MasterScriptProvider::removeByName( const OUString& Name )
|
||||
{
|
||||
if ( !m_bIsPkgMSP )
|
||||
{
|
||||
if ( m_xMSPPkg.is() )
|
||||
{
|
||||
Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW );
|
||||
xCont->removeByName( Name );
|
||||
}
|
||||
else
|
||||
if ( !m_xMSPPkg.is() )
|
||||
{
|
||||
throw RuntimeException( "PackageMasterScriptProvider is unitialised" );
|
||||
}
|
||||
|
||||
Reference< container::XNameContainer > xCont( m_xMSPPkg, UNO_QUERY_THROW );
|
||||
xCont->removeByName( Name );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -485,8 +485,11 @@ void SdStyleFamily::setPropertyValue( const OUString& , const Any& )
|
||||
|
||||
Any SdStyleFamily::getPropertyValue( const OUString& PropertyName )
|
||||
{
|
||||
if ( PropertyName == "DisplayName" )
|
||||
if ( PropertyName != "DisplayName" )
|
||||
{
|
||||
throw UnknownPropertyException( "unknown property: " + PropertyName, static_cast<OWeakObject *>(this) );
|
||||
}
|
||||
|
||||
SolarMutexGuard aGuard;
|
||||
OUString sDisplayName;
|
||||
switch( mnFamily )
|
||||
@@ -496,11 +499,6 @@ Any SdStyleFamily::getPropertyValue( const OUString& PropertyName )
|
||||
default: sDisplayName = SdResId(STR_GRAPHICS_STYLE_FAMILY); break;
|
||||
}
|
||||
return Any( sDisplayName );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw UnknownPropertyException( "unknown property: " + PropertyName, static_cast<OWeakObject *>(this) );
|
||||
}
|
||||
}
|
||||
|
||||
void SdStyleFamily::addPropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& )
|
||||
|
||||
@@ -219,14 +219,12 @@ uno::Reference<XAccessible> SAL_CALL
|
||||
aGuard.clear();
|
||||
|
||||
// Forward request to children manager.
|
||||
if (pChildrenManager != nullptr)
|
||||
{
|
||||
return pChildrenManager->GetChild (nIndex);
|
||||
}
|
||||
else
|
||||
if (pChildrenManager == nullptr)
|
||||
throw lang::IndexOutOfBoundsException (
|
||||
"no accessible child with index " + OUString::number(nIndex),
|
||||
static_cast<uno::XWeak*>(this));
|
||||
|
||||
return pChildrenManager->GetChild (nIndex);
|
||||
}
|
||||
|
||||
OUString SAL_CALL
|
||||
|
||||
@@ -499,10 +499,10 @@ void SAL_CALL AccessibleSlideSorterView::selectAccessibleChild (sal_Int32 nChild
|
||||
const SolarMutexGuard aSolarGuard;
|
||||
|
||||
AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
|
||||
if (pChild != nullptr)
|
||||
mrSlideSorter.GetController().GetPageSelector().SelectPage(pChild->GetPageNumber());
|
||||
else
|
||||
if (pChild == nullptr)
|
||||
throw lang::IndexOutOfBoundsException();
|
||||
|
||||
mrSlideSorter.GetController().GetPageSelector().SelectPage(pChild->GetPageNumber());
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL AccessibleSlideSorterView::isAccessibleChildSelected (sal_Int32 nChildIndex)
|
||||
@@ -512,11 +512,11 @@ sal_Bool SAL_CALL AccessibleSlideSorterView::isAccessibleChildSelected (sal_Int3
|
||||
const SolarMutexGuard aSolarGuard;
|
||||
|
||||
AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
|
||||
if (pChild != nullptr)
|
||||
if (pChild == nullptr)
|
||||
throw lang::IndexOutOfBoundsException();
|
||||
|
||||
bIsSelected = mrSlideSorter.GetController().GetPageSelector().IsPageSelected(
|
||||
pChild->GetPageNumber());
|
||||
else
|
||||
throw lang::IndexOutOfBoundsException();
|
||||
|
||||
return bIsSelected;
|
||||
}
|
||||
@@ -578,10 +578,10 @@ void SAL_CALL AccessibleSlideSorterView::deselectAccessibleChild (sal_Int32 nChi
|
||||
const SolarMutexGuard aSolarGuard;
|
||||
|
||||
AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
|
||||
if (pChild != nullptr)
|
||||
mrSlideSorter.GetController().GetPageSelector().DeselectPage(pChild->GetPageNumber());
|
||||
else
|
||||
if (pChild == nullptr)
|
||||
throw lang::IndexOutOfBoundsException();
|
||||
|
||||
mrSlideSorter.GetController().GetPageSelector().DeselectPage(pChild->GetPageNumber());
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
|
||||
@@ -220,8 +220,15 @@ Reference<XResource> SAL_CALL BasicPaneFactory::createResource (
|
||||
return rPane.CompareURL(rxPaneId->getResourceURL());
|
||||
} ));
|
||||
|
||||
if (iDescriptor != mpPaneContainer->end())
|
||||
if (iDescriptor == mpPaneContainer->end())
|
||||
{
|
||||
// The requested pane can not be created by any of the factories
|
||||
// managed by the called BasicPaneFactory object.
|
||||
throw lang::IllegalArgumentException("BasicPaneFactory::createPane() called for unknown resource id",
|
||||
nullptr,
|
||||
0);
|
||||
}
|
||||
|
||||
if (iDescriptor->mxPane.is())
|
||||
{
|
||||
// The pane has already been created and is still active (has
|
||||
@@ -256,15 +263,7 @@ Reference<XResource> SAL_CALL BasicPaneFactory::createResource (
|
||||
xComponent->addEventListener(this);
|
||||
}
|
||||
iDescriptor->mbIsReleased = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The requested pane can not be created by any of the factories
|
||||
// managed by the called BasicPaneFactory object.
|
||||
throw lang::IllegalArgumentException("BasicPaneFactory::createPane() called for unknown resource id",
|
||||
nullptr,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
return xPane;
|
||||
}
|
||||
@@ -282,8 +281,16 @@ void SAL_CALL BasicPaneFactory::releaseResource (
|
||||
mpPaneContainer->end(),
|
||||
[&] (PaneDescriptor const& rPane) { return rPane.ComparePane(rxPane); } ));
|
||||
|
||||
if (iDescriptor != mpPaneContainer->end())
|
||||
if (iDescriptor == mpPaneContainer->end())
|
||||
{
|
||||
// The given XPane reference is either empty or the pane was not
|
||||
// created by any of the factories managed by the called
|
||||
// BasicPaneFactory object.
|
||||
throw lang::IllegalArgumentException("BasicPaneFactory::releasePane() called for pane that was not created by same factory.",
|
||||
nullptr,
|
||||
0);
|
||||
}
|
||||
|
||||
// The given pane was created by one of the factories. Child
|
||||
// windows are just hidden and will be reused when requested later.
|
||||
// Other windows are disposed and their reference is reset so that
|
||||
@@ -307,16 +314,7 @@ void SAL_CALL BasicPaneFactory::releaseResource (
|
||||
xComponent->dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The given XPane reference is either empty or the pane was not
|
||||
// created by any of the factories managed by the called
|
||||
// BasicPaneFactory object.
|
||||
throw lang::IllegalArgumentException("BasicPaneFactory::releasePane() called for pane that was not created by same factory.",
|
||||
nullptr,
|
||||
0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//===== XConfigurationChangeListener ==========================================
|
||||
|
||||
@@ -124,15 +124,10 @@ Reference<XResource> SAL_CALL BasicToolBarFactory::createResource (
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
Reference<XResource> xToolBar;
|
||||
|
||||
if (rxToolBarId->getResourceURL() == FrameworkHelper::msViewTabBarURL)
|
||||
{
|
||||
xToolBar = new ViewTabBar(rxToolBarId, mxController);
|
||||
}
|
||||
else
|
||||
if (rxToolBarId->getResourceURL() != FrameworkHelper::msViewTabBarURL)
|
||||
throw lang::IllegalArgumentException();
|
||||
|
||||
Reference<XResource> xToolBar = new ViewTabBar(rxToolBarId, mxController);;
|
||||
return xToolBar;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,8 +195,11 @@ void SAL_CALL BasicViewFactory::releaseResource (const Reference<XResource>& rxV
|
||||
[&] (std::shared_ptr<ViewDescriptor> const& pVD) {
|
||||
return ViewDescriptor::CompareView(pVD, rxView);
|
||||
} ));
|
||||
if (iViewShell != mpViewShellContainer->end())
|
||||
if (iViewShell == mpViewShellContainer->end())
|
||||
{
|
||||
throw lang::IllegalArgumentException();
|
||||
}
|
||||
|
||||
std::shared_ptr<ViewShell> pViewShell ((*iViewShell)->mpViewShell);
|
||||
|
||||
if ((*iViewShell)->mxViewId->isBoundToURL(
|
||||
@@ -226,11 +229,6 @@ void SAL_CALL BasicViewFactory::releaseResource (const Reference<XResource>& rxV
|
||||
|
||||
mpViewShellContainer->erase(iViewShell);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw lang::IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments)
|
||||
|
||||
@@ -190,8 +190,9 @@ IMPL_LINK(FullScreenPane, WindowEventHandler, VclWindowEvent&, rEvent, void)
|
||||
Reference<rendering::XCanvas> FullScreenPane::CreateCanvas()
|
||||
{
|
||||
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(mxWindow);
|
||||
if (pWindow)
|
||||
{
|
||||
if (!pWindow)
|
||||
throw RuntimeException();
|
||||
|
||||
Sequence<Any> aArg (5);
|
||||
|
||||
// common: first any is VCL pointer to window (for VCL canvas)
|
||||
@@ -207,9 +208,6 @@ Reference<rendering::XCanvas> FullScreenPane::CreateCanvas()
|
||||
xFactory->createInstanceWithArguments("com.sun.star.rendering.SpriteCanvas.VCL",
|
||||
aArg),
|
||||
UNO_QUERY);
|
||||
}
|
||||
else
|
||||
throw RuntimeException();
|
||||
}
|
||||
|
||||
void FullScreenPane::ExtractArguments (
|
||||
|
||||
@@ -142,8 +142,9 @@ Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createCanvas (
|
||||
// No shared window is given or an explicit canvas service name is
|
||||
// specified. Create a new canvas.
|
||||
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rxWindow);
|
||||
if (pWindow)
|
||||
{
|
||||
if (!pWindow)
|
||||
throw RuntimeException();
|
||||
|
||||
Sequence<Any> aArg (5);
|
||||
|
||||
// common: first any is VCL pointer to window (for VCL canvas)
|
||||
@@ -162,9 +163,6 @@ Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createCanvas (
|
||||
: OUString("com.sun.star.rendering.Canvas.VCL"),
|
||||
aArg),
|
||||
UNO_QUERY);
|
||||
}
|
||||
else
|
||||
throw RuntimeException();
|
||||
}
|
||||
|
||||
void SAL_CALL PresenterHelper::toTop (
|
||||
|
||||
@@ -68,8 +68,12 @@ void SAL_CALL SlideSorterService::initialize (const Sequence<Any>& rArguments)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
if (rArguments.getLength() == 3)
|
||||
if (rArguments.getLength() != 3)
|
||||
{
|
||||
throw RuntimeException("SlideSorterService: invalid number of arguments",
|
||||
static_cast<drawing::XDrawView*>(this));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
mxViewId.set(rArguments[0], UNO_QUERY_THROW);
|
||||
@@ -103,12 +107,7 @@ void SAL_CALL SlideSorterService::initialize (const Sequence<Any>& rArguments)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw RuntimeException("SlideSorterService: invalid number of arguments",
|
||||
static_cast<drawing::XDrawView*>(this));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//----- XView -----------------------------------------------------------------
|
||||
|
||||
@@ -104,14 +104,13 @@ void SAL_CALL PropertySet::removePropertyChangeListener (
|
||||
return listener.second == rxListener;
|
||||
}));
|
||||
|
||||
if (iListener != mpChangeListeners->end())
|
||||
{
|
||||
mpChangeListeners->erase(iListener);
|
||||
}
|
||||
else
|
||||
if (iListener == mpChangeListeners->end())
|
||||
{
|
||||
throw lang::IllegalArgumentException();
|
||||
}
|
||||
|
||||
mpChangeListeners->erase(iListener);
|
||||
|
||||
}
|
||||
|
||||
void SAL_CALL PropertySet::addVetoableChangeListener (
|
||||
|
||||
@@ -363,11 +363,11 @@ void SAL_CALL SdXCustomPresentationAccess::removeByName( const OUString& Name )
|
||||
SdCustomShow* pShow = getSdCustomShow(Name);
|
||||
|
||||
SdCustomShowList* pList = GetCustomShowList();
|
||||
if(pList && pShow)
|
||||
delete pList->Remove( pShow );
|
||||
else
|
||||
if(!pList || !pShow)
|
||||
throw container::NoSuchElementException();
|
||||
|
||||
delete pList->Remove( pShow );
|
||||
|
||||
mrModel.SetModified();
|
||||
}
|
||||
|
||||
@@ -383,20 +383,14 @@ uno::Any SAL_CALL SdXCustomPresentationAccess::getByName( const OUString& aName
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
|
||||
uno::Any aAny;
|
||||
|
||||
SdCustomShow* pShow = getSdCustomShow(aName);
|
||||
if(pShow)
|
||||
{
|
||||
uno::Reference< container::XIndexContainer > xRef( pShow->getUnoCustomShow(), uno::UNO_QUERY );
|
||||
aAny <<= xRef;
|
||||
}
|
||||
else
|
||||
if(!pShow)
|
||||
{
|
||||
throw container::NoSuchElementException();
|
||||
}
|
||||
|
||||
return aAny;
|
||||
uno::Reference< container::XIndexContainer > xRef( pShow->getUnoCustomShow(), uno::UNO_QUERY );
|
||||
return uno::Any(xRef);
|
||||
}
|
||||
|
||||
uno::Sequence< OUString > SAL_CALL SdXCustomPresentationAccess::getElementNames()
|
||||
|
||||
Reference in New Issue
Block a user