summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-11-30 18:51:55 +0100
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-11-30 22:15:38 +0100
commita0dcf961879ab644a52f801f65466756cb144b72 (patch)
treef99701fb10d080eb3eb337a0261702394b183077 /xmloff
parent316656755caabf4797391c46338c58945908837d (diff)
Hidden styles: ODF import/export
Change-Id: I1138314eba33dc8cf8d1f60e77ac419b4550bbcc
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/xmloff/xmlnume.hxx2
-rw-r--r--xmloff/inc/xmloff/xmlstyle.hxx3
-rw-r--r--xmloff/source/draw/sdpropls.cxx2
-rw-r--r--xmloff/source/style/XMLPageExport.cxx3
-rw-r--r--xmloff/source/style/prstylei.cxx2
-rw-r--r--xmloff/source/style/styleexp.cxx3
-rw-r--r--xmloff/source/style/xmlnume.cxx10
-rw-r--r--xmloff/source/style/xmlstyle.cxx5
-rw-r--r--xmloff/source/text/XMLTextListAutoStylePool.cxx2
-rw-r--r--xmloff/source/text/txtstyli.cxx2
10 files changed, 28 insertions, 6 deletions
diff --git a/xmloff/inc/xmloff/xmlnume.hxx b/xmloff/inc/xmloff/xmlnume.hxx
index e6406bd02ad5..dca651db2bcc 100644
--- a/xmloff/inc/xmloff/xmlnume.hxx
+++ b/xmloff/inc/xmloff/xmlnume.hxx
@@ -86,7 +86,7 @@ public:
XMLTextListAutoStylePool *pPool,
sal_Bool bExportChapterNumbering = sal_True );
void exportNumberingRule(
- const ::rtl::OUString& rName,
+ const ::rtl::OUString& rName, sal_Bool bIsHidden,
const ::com::sun::star::uno::Reference<
::com::sun::star::container::XIndexReplace > & xNumRule );
};
diff --git a/xmloff/inc/xmloff/xmlstyle.hxx b/xmloff/inc/xmloff/xmlstyle.hxx
index 222ba2643689..8296b24799a0 100644
--- a/xmloff/inc/xmloff/xmlstyle.hxx
+++ b/xmloff/inc/xmloff/xmlstyle.hxx
@@ -65,6 +65,7 @@ class XMLOFF_DLLPUBLIC SvXMLStyleContext : public SvXMLImportContext
::rtl::OUString maAutoName;
::rtl::OUString maParentName;// Will be moved to XMLPropStyle soon!!!!
::rtl::OUString maFollow; // Will be moved to XMLPropStyle soon!!!!
+ sal_Bool mbHidden;
::rtl::OUString maHelpFile; // Will be removed very soon!!!!
@@ -125,6 +126,8 @@ public:
sal_Bool IsNew() const { return mbNew; }
void SetNew( sal_Bool b ) { mbNew = b; }
+ sal_Bool IsHidden() const { return mbHidden; }
+
// This method is called for every default style
virtual void SetDefaults();
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index 6f9f89701f81..1ca236b20f3a 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -1567,7 +1567,7 @@ void XMLShapeExportPropertyMapper::handleElementItem(
{
uno::Reference< container::XIndexReplace > xNumRule( rProperty.maValue, uno::UNO_QUERY );
if( xNumRule.is() )
- const_cast<XMLShapeExportPropertyMapper*>(this)->maNumRuleExp.exportNumberingRule( maStyleName, xNumRule );
+ const_cast<XMLShapeExportPropertyMapper*>(this)->maNumRuleExp.exportNumberingRule( maStyleName, sal_False, xNumRule );
}
}
break;
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 ),
diff --git a/xmloff/source/text/XMLTextListAutoStylePool.cxx b/xmloff/source/text/XMLTextListAutoStylePool.cxx
index 2bc446d41913..9e875a9a4b96 100644
--- a/xmloff/source/text/XMLTextListAutoStylePool.cxx
+++ b/xmloff/source/text/XMLTextListAutoStylePool.cxx
@@ -268,7 +268,7 @@ void XMLTextListAutoStylePool::exportXML() const
for( i=0; i < nCount; i++ )
{
XMLTextListAutoStylePoolEntry_Impl *pEntry = aExpEntries[i];
- aNumRuleExp.exportNumberingRule( pEntry->GetName(),
+ aNumRuleExp.exportNumberingRule( pEntry->GetName(), sal_False,
pEntry->GetNumRules() );
}
delete [] aExpEntries;
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
index 349712523e87..81ce15cc042f 100644
--- a/xmloff/source/text/txtstyli.cxx
+++ b/xmloff/source/text/txtstyli.cxx
@@ -280,6 +280,8 @@ void XMLTextStyleContext::Finish( sal_Bool bOverwrite )
!( bOverwrite || IsNew() ) )
return;
+ xStyle->setHidden( IsHidden( ) );
+
Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
Reference< XPropertySetInfo > xPropSetInfo =
xPropSet->getPropertySetInfo();