diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-11-30 18:51:55 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-11-30 22:15:38 +0100 |
commit | a0dcf961879ab644a52f801f65466756cb144b72 (patch) | |
tree | f99701fb10d080eb3eb337a0261702394b183077 /xmloff/source/style | |
parent | 316656755caabf4797391c46338c58945908837d (diff) |
Hidden styles: ODF import/export
Change-Id: I1138314eba33dc8cf8d1f60e77ac419b4550bbcc
Diffstat (limited to 'xmloff/source/style')
-rw-r--r-- | xmloff/source/style/XMLPageExport.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/style/prstylei.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/style/styleexp.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/style/xmlnume.cxx | 10 | ||||
-rw-r--r-- | xmloff/source/style/xmlstyle.cxx | 5 |
5 files changed, 20 insertions, 3 deletions
diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx index b187c404554a..2710bee2acf6 100644 --- a/xmloff/source/style/XMLPageExport.cxx +++ b/xmloff/source/style/XMLPageExport.cxx @@ -117,6 +117,9 @@ sal_Bool XMLPageExport::exportStyle( GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, GetExport().EncodeStyleName( sName, &bEncoded ) ); + if ( rStyle->isHidden( ) && GetExport( ).getDefaultVersion( ) == SvtSaveOptions::ODFVER_LATEST ) + GetExport( ).AddAttribute( XML_NAMESPACE_STYLE, XML_HIDDEN, "true" ); + if( bEncoded ) GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DISPLAY_NAME, sName); diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx index 278ff5799e49..9dac4827a4ab 100644 --- a/xmloff/source/style/prstylei.cxx +++ b/xmloff/source/style/prstylei.cxx @@ -341,6 +341,8 @@ void XMLPropStyleContext::Finish( sal_Bool bOverwrite ) if( !xFamilies.is() ) return; + mxStyle->setHidden( IsHidden( ) ); + // connect parent OUString sParent( GetParentName() ); if( !sParent.isEmpty() ) diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index 2970392078fa..0a9669eb1fdf 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -121,6 +121,9 @@ sal_Bool XMLStyleExport::exportStyle( if( !rXMLFamily.isEmpty() ) GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_FAMILY, rXMLFamily); + if ( rStyle->isHidden( ) && GetExport( ).getDefaultVersion( ) == SvtSaveOptions::ODFVER_LATEST ) + GetExport( ).AddAttribute( XML_NAMESPACE_STYLE, XML_HIDDEN, "true" ); + // style:parent-style-name="..." OUString sParentString(rStyle->getParentStyle()); OUString sParent; diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index 2efffc75d5fa..cd697eccdd5b 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -682,7 +682,7 @@ SvxXMLNumRuleExport::~SvxXMLNumRuleExport() } void SvxXMLNumRuleExport::exportNumberingRule( - const OUString& rName, + const OUString& rName, sal_Bool bIsHidden, const Reference< XIndexReplace >& rNumRule ) { Reference< XPropertySet > xPropSet( rNumRule, UNO_QUERY ); @@ -703,6 +703,10 @@ void SvxXMLNumRuleExport::exportNumberingRule( rName); } + // style:hidden="..." + if ( bIsHidden && GetExport( ).getDefaultVersion( ) == SvtSaveOptions::ODFVER_LATEST ) + GetExport( ).AddAttribute( XML_NAMESPACE_STYLE, XML_HIDDEN, "true" ); + // text:consecutive-numbering="..." sal_Bool bContNumbering = sal_False; if( xPropSetInfo.is() && @@ -747,7 +751,7 @@ sal_Bool SvxXMLNumRuleExport::exportStyle( const Reference< XStyle >& rStyle ) OUString sName = rStyle->getName(); - exportNumberingRule( sName, xNumRule ); + exportNumberingRule( sName, rStyle->isHidden(), xNumRule ); return sal_True; } @@ -784,7 +788,7 @@ void SvxXMLNumRuleExport::exportOutline() nODFVersion == SvtSaveOptions::ODFVER_011 ) && GetExport().writeOutlineStyleAsNormalListStyle() ) { - exportNumberingRule( sOutlineStyleName, xNumRule ); + exportNumberingRule( sOutlineStyleName, sal_False, xNumRule ); } else { diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index fe28e57d7bfe..433b1407e10c 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -138,6 +138,10 @@ void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey, (nTmp < 0L) ? 0U : ( (nTmp > USHRT_MAX) ? USHRT_MAX : (sal_uInt16)nTmp ); } + else if( IsXMLToken( rLocalName, XML_HIDDEN ) ) + { + mbHidden = rValue.toBoolean(); + } } } @@ -149,6 +153,7 @@ SvXMLStyleContext::SvXMLStyleContext( const uno::Reference< xml::sax::XAttributeList >&, sal_uInt16 nFam, sal_Bool bDefault ) : SvXMLImportContext( rImp, nPrfx, rLName ), + mbHidden( sal_False ), mnHelpId( UCHAR_MAX ), mnFamily( nFam ), mbValid( sal_True ), |