summaryrefslogtreecommitdiff
path: root/xmloff/source/style/prstylei.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-15 10:03:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-15 13:06:13 +0100
commit5f4938d89d641681346001746f3762dffcb831b4 (patch)
tree5e5f8d5bbf505cc9dafd7e9b2358f874c6f41774 /xmloff/source/style/prstylei.cxx
parent5b74eb68113d3721e1a3f9fa40024bf9b2a15f0c (diff)
loplugin:flatten in xmloff
Change-Id: I782278b8a633094b96788f81ae7066a45d45b5fe Reviewed-on: https://gerrit.libreoffice.org/44750 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/style/prstylei.cxx')
-rw-r--r--xmloff/source/style/prstylei.cxx128
1 files changed, 64 insertions, 64 deletions
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index 51b3578029af..a3d4ca85292a 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -453,80 +453,80 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite )
void XMLPropStyleContext::Finish( bool bOverwrite )
{
- if( mxStyle.is() && (IsNew() || bOverwrite) )
+ if( !mxStyle.is() || !(IsNew() || bOverwrite) )
+ return;
+
+ // The families container must exist
+ Reference < XNameContainer > xFamilies =
+ static_cast<SvXMLStylesContext *>(mxStyles.get())->GetStylesContainer( GetFamily() );
+ SAL_WARN_IF( !xFamilies.is(), "xmloff", "Families lost" );
+ if( !xFamilies.is() )
+ return;
+
+ // connect parent
+ OUString sParent( GetParentName() );
+ if( !sParent.isEmpty() )
+ sParent = GetImport().GetStyleDisplayName( GetFamily(), sParent );
+ if( !sParent.isEmpty() && !xFamilies->hasByName( sParent ) )
+ sParent.clear();
+
+ if( sParent != mxStyle->getParentStyle() )
{
- // The families container must exist
- Reference < XNameContainer > xFamilies =
- static_cast<SvXMLStylesContext *>(mxStyles.get())->GetStylesContainer( GetFamily() );
- SAL_WARN_IF( !xFamilies.is(), "xmloff", "Families lost" );
- if( !xFamilies.is() )
- return;
-
- // connect parent
- OUString sParent( GetParentName() );
- if( !sParent.isEmpty() )
- sParent = GetImport().GetStyleDisplayName( GetFamily(), sParent );
- if( !sParent.isEmpty() && !xFamilies->hasByName( sParent ) )
- sParent.clear();
-
- if( sParent != mxStyle->getParentStyle() )
+ // this may except if setting the parent style forms a
+ // circle in the style dependencies; especially if the parent
+ // style is the same as the current style
+ try
{
- // this may except if setting the parent style forms a
- // circle in the style dependencies; especially if the parent
- // style is the same as the current style
- try
- {
- mxStyle->setParentStyle( sParent );
- }
- catch(const uno::Exception& e)
- {
- // according to the API definition, I would expect a
- // container::NoSuchElementException. But it throws an
- // uno::RuntimeException instead. I catch
- // uno::Exception in order to process both of them.
-
- // We can't set the parent style. For a proper
- // Error-Message, we should pass in the name of the
- // style, as well as the desired parent style.
- Sequence<OUString> aSequence(2);
-
- // getName() throws no non-Runtime exception:
- aSequence[0] = mxStyle->getName();
- aSequence[1] = sParent;
-
- GetImport().SetError(
- XMLERROR_FLAG_ERROR | XMLERROR_PARENT_STYLE_NOT_ALLOWED,
- aSequence, e.Message, nullptr );
- }
+ mxStyle->setParentStyle( sParent );
}
-
- // connect follow
- OUString sFollow( GetFollow() );
- if( !sFollow.isEmpty() )
- sFollow = GetImport().GetStyleDisplayName( GetFamily(), sFollow );
- if( sFollow.isEmpty() || !xFamilies->hasByName( sFollow ) )
- sFollow = mxStyle->getName();
-
- Reference < XPropertySet > xPropSet( mxStyle, UNO_QUERY );
- Reference< XPropertySetInfo > xPropSetInfo =
- xPropSet->getPropertySetInfo();
- if( xPropSetInfo->hasPropertyByName( msFollowStyle ) )
+ catch(const uno::Exception& e)
{
- Any aAny = xPropSet->getPropertyValue( msFollowStyle );
- OUString sCurrFollow;
- aAny >>= sCurrFollow;
- if( sCurrFollow != sFollow )
- {
- xPropSet->setPropertyValue( msFollowStyle, Any(sFollow) );
- }
+ // according to the API definition, I would expect a
+ // container::NoSuchElementException. But it throws an
+ // uno::RuntimeException instead. I catch
+ // uno::Exception in order to process both of them.
+
+ // We can't set the parent style. For a proper
+ // Error-Message, we should pass in the name of the
+ // style, as well as the desired parent style.
+ Sequence<OUString> aSequence(2);
+
+ // getName() throws no non-Runtime exception:
+ aSequence[0] = mxStyle->getName();
+ aSequence[1] = sParent;
+
+ GetImport().SetError(
+ XMLERROR_FLAG_ERROR | XMLERROR_PARENT_STYLE_NOT_ALLOWED,
+ aSequence, e.Message, nullptr );
}
+ }
- if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
+ // connect follow
+ OUString sFollow( GetFollow() );
+ if( !sFollow.isEmpty() )
+ sFollow = GetImport().GetStyleDisplayName( GetFamily(), sFollow );
+ if( sFollow.isEmpty() || !xFamilies->hasByName( sFollow ) )
+ sFollow = mxStyle->getName();
+
+ Reference < XPropertySet > xPropSet( mxStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( msFollowStyle ) )
+ {
+ Any aAny = xPropSet->getPropertyValue( msFollowStyle );
+ OUString sCurrFollow;
+ aAny >>= sCurrFollow;
+ if( sCurrFollow != sFollow )
{
- xPropSet->setPropertyValue( "Hidden", uno::makeAny( IsHidden( ) ) );
+ xPropSet->setPropertyValue( msFollowStyle, Any(sFollow) );
}
+ }
+ if ( xPropSetInfo->hasPropertyByName( "Hidden" ) )
+ {
+ xPropSet->setPropertyValue( "Hidden", uno::makeAny( IsHidden( ) ) );
}
+
}
bool XMLPropStyleContext::doNewDrawingLayerFillStyleDefinitionsExist(