summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-05-18 14:22:41 +0200
committerMichael Stahl <mstahl@redhat.com>2015-05-18 14:49:17 +0200
commitf7f48dd4bb8c20d9165b13f79df25da5f2e27bc8 (patch)
tree805b5c9d63d2d9e777237b9696ebbaa4080a650e /xmloff
parent9beae152a30baeab8d2d461410d83de1c7c1f7f2 (diff)
xmloff: convert legacy assertions in XMLStyleExport
Change-Id: I39146bc6005c43b034243d587dda17839b8e72e7
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/styleexp.cxx128
1 files changed, 59 insertions, 69 deletions
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index 43fbab803388..c6b62e886306 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -240,17 +240,13 @@ bool XMLStyleExport::exportStyle(
{
Reference< XIndexReplace > xNumRule
( xCNSupplier->getChapterNumberingRules() );
- DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
-
- if (xNumRule.is())
- {
- Reference< XPropertySet > xNumRulePropSet
- (xNumRule, UNO_QUERY);
- xNumRulePropSet->getPropertyValue(
- OUString("Name") )
- >>= sOutlineName;
- bSuppressListStyle = ( sListName == sOutlineName );
- }
+ assert(xNumRule.is());
+
+ Reference< XPropertySet > xNumRulePropSet
+ (xNumRule, UNO_QUERY);
+ xNumRulePropSet->getPropertyValue("Name")
+ >>= sOutlineName;
+ bSuppressListStyle = sListName == sOutlineName;
}
}
}
@@ -379,7 +375,7 @@ void XMLStyleExport::exportStyleFamily(
const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper,
bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix)
{
- DBG_ASSERT( GetExport().GetModel().is(), "There is the model?" );
+ assert(GetExport().GetModel().is());
Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
if( !xFamiliesSupp.is() )
return; // family not available in current model
@@ -418,38 +414,35 @@ void XMLStyleExport::exportStyleFamily(
continue;
}
- DBG_ASSERT( xStyle.is(), "Style not found for export!" );
- if( xStyle.is() )
+ assert(xStyle.is());
+ if (!bUsed || xStyle->isInUse())
{
- if( !bUsed || xStyle->isInUse() )
+ bool bExported = exportStyle( xStyle, rXMLFamily, rPropMapper,
+ xStyleCont,pPrefix );
+ if (bUsed && bFirstStyle && bExported)
{
- bool bExported = exportStyle( xStyle, rXMLFamily, rPropMapper,
- xStyleCont,pPrefix );
- if( bUsed && bFirstStyle && bExported )
- {
- // If this is the first style, find out whether next styles
- // are supported.
- Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
- Reference< XPropertySetInfo > xPropSetInfo =
- xPropSet->getPropertySetInfo();
-
- if( xPropSetInfo->hasPropertyByName( sFollowStyle ) )
- pExportedStyles.reset(new std::set<OUString>());
- bFirstStyle = false;
- }
+ // If this is the first style, find out whether next styles
+ // are supported.
+ Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
- if( pExportedStyles && bExported )
- {
- // If next styles are supported, remember this style's name.
- pExportedStyles->insert( xStyle->getName() );
- }
+ if (xPropSetInfo->hasPropertyByName( sFollowStyle ))
+ pExportedStyles.reset(new std::set<OUString>());
+ bFirstStyle = false;
}
- // if an auto style pool is given, remember this style's name as a
- // style name that must not be used by automatic styles.
- if( pAutoStylePool )
- pAutoStylePool->RegisterName( nFamily, xStyle->getName() );
+ if (pExportedStyles && bExported)
+ {
+ // If next styles are supported, remember this style's name.
+ pExportedStyles->insert( xStyle->getName() );
+ }
}
+
+ // if an auto style pool is given, remember this style's name as a
+ // style name that must not be used by automatic styles.
+ if (pAutoStylePool)
+ pAutoStylePool->RegisterName( nFamily, xStyle->getName() );
}
if( pExportedStyles )
@@ -462,43 +455,40 @@ void XMLStyleExport::exportStyleFamily(
Reference< XStyle > xStyle;
xStyleCont->getByName( *pIter ) >>= xStyle;
- DBG_ASSERT( xStyle.is(), "Style not found for export!" );
- if( xStyle.is() )
- {
- Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
- Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ assert(xStyle.is());
- // styles that aren't existing really are ignored.
- if( xPropSetInfo->hasPropertyByName( sIsPhysical ) )
- {
- Any aAny( xPropSet->getPropertyValue( sIsPhysical ) );
- if( !*static_cast<sal_Bool const *>(aAny.getValue()) )
- continue;
- }
+ Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
- if( !xStyle->isInUse() )
+ // styles that aren't existing really are ignored.
+ if (xPropSetInfo->hasPropertyByName( sIsPhysical ))
+ {
+ Any aAny( xPropSet->getPropertyValue( sIsPhysical ) );
+ if (!*static_cast<sal_Bool const *>(aAny.getValue()))
continue;
+ }
- if( !xPropSetInfo->hasPropertyByName( sFollowStyle ) )
- {
- DBG_ASSERT( sFollowStyle.isEmpty(), "no follow style???" );
- continue;
- }
+ if (!xStyle->isInUse())
+ continue;
- OUString sNextName;
- xPropSet->getPropertyValue( sFollowStyle ) >>= sNextName;
- OUString sTmp( sNextName );
- // if the next style hasn't been exported by now, export it now
- // and remember its name.
- if( xStyle->getName() != sNextName &&
- 0 == pExportedStyles->count( sTmp ) )
- {
- xStyleCont->getByName( sNextName ) >>= xStyle;
- DBG_ASSERT( xStyle.is(), "Style not found for export!" );
+ if (!xPropSetInfo->hasPropertyByName( sFollowStyle ))
+ {
+ continue;
+ }
- if( xStyle.is() && exportStyle( xStyle, rXMLFamily, rPropMapper, xStyleCont, pPrefix ) )
- pExportedStyles->insert( sTmp );
- }
+ OUString sNextName;
+ xPropSet->getPropertyValue( sFollowStyle ) >>= sNextName;
+ OUString sTmp( sNextName );
+ // if the next style hasn't been exported by now, export it now
+ // and remember its name.
+ if (xStyle->getName() != sNextName &&
+ 0 == pExportedStyles->count( sTmp ))
+ {
+ xStyleCont->getByName( sNextName ) >>= xStyle;
+ assert(xStyle.is());
+
+ if (exportStyle(xStyle, rXMLFamily, rPropMapper, xStyleCont, pPrefix))
+ pExportedStyles->insert( sTmp );
}
}
}