offapi/com/sun/star/style/XStyle.idl | 8 +++ offapi/type_reference/types.rdb |binary reportdesign/source/core/api/ReportDefinition.cxx | 3 + sc/inc/styleuno.hxx | 2 sc/source/ui/unoobj/styleuno.cxx | 17 ++++++ sd/inc/stlsheet.hxx | 2 sd/source/core/stlsheet.cxx | 16 ++++++ svx/source/table/tabledesign.cxx | 2 sw/inc/unostyle.hxx | 2 sw/source/core/unocore/unostyle.cxx | 35 ++++++++++++++ sw/source/ui/app/docstyle.cxx | 55 ++++++++++------------ xmloff/inc/xmloff/xmlnume.hxx | 2 xmloff/inc/xmloff/xmlstyle.hxx | 3 + xmloff/source/draw/sdpropls.cxx | 2 xmloff/source/style/XMLPageExport.cxx | 3 + xmloff/source/style/prstylei.cxx | 2 xmloff/source/style/styleexp.cxx | 3 + xmloff/source/style/xmlnume.cxx | 10 ++-- xmloff/source/style/xmlstyle.cxx | 5 ++ xmloff/source/text/XMLTextListAutoStylePool.cxx | 2 xmloff/source/text/txtstyli.cxx | 2 21 files changed, 141 insertions(+), 35 deletions(-)
New commits: commit a0dcf961879ab644a52f801f65466756cb144b72 Author: Cédric Bosdonnat <[email protected]> Date: Fri Nov 30 18:51:55 2012 +0100 Hidden styles: ODF import/export Change-Id: I1138314eba33dc8cf8d1f60e77ac419b4550bbcc diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx index cae4c50..c2228dc 100644 --- a/sw/source/ui/app/docstyle.cxx +++ b/sw/source/ui/app/docstyle.cxx @@ -523,39 +523,36 @@ sal_Bool SwDocStyleSheet::IsHidden( ) const { sal_Bool bRet = sal_False; - if(!bPhysical) + SwFmt* pFmt = 0; + switch(nFamily) { - SwFmt* pFmt = 0; - switch(nFamily) - { - case SFX_STYLE_FAMILY_CHAR: - pFmt = rDoc.FindCharFmtByName( aName ); - bRet = pFmt && pFmt->IsHidden( ); - break; + case SFX_STYLE_FAMILY_CHAR: + pFmt = rDoc.FindCharFmtByName( aName ); + bRet = pFmt && pFmt->IsHidden( ); + break; - case SFX_STYLE_FAMILY_PARA: - pFmt = rDoc.FindTxtFmtCollByName( aName ); - bRet = pFmt && pFmt->IsHidden( ); - break; + case SFX_STYLE_FAMILY_PARA: + pFmt = rDoc.FindTxtFmtCollByName( aName ); + bRet = pFmt && pFmt->IsHidden( ); + break; - case SFX_STYLE_FAMILY_FRAME: - pFmt = rDoc.FindFrmFmtByName( aName ); - bRet = pFmt && pFmt->IsHidden( ); - break; + case SFX_STYLE_FAMILY_FRAME: + pFmt = rDoc.FindFrmFmtByName( aName ); + bRet = pFmt && pFmt->IsHidden( ); + break; - case SFX_STYLE_FAMILY_PAGE: - { - SwPageDesc* pPgDesc = rDoc.FindPageDescByName( aName ); - bRet = pPgDesc && pPgDesc->IsHidden( ); - } - break; - case SFX_STYLE_FAMILY_PSEUDO: - { - SwNumRule* pRule = rDoc.FindNumRulePtr( aName ); - bRet = pRule && pRule->IsHidden( ); - } - default:; - } + case SFX_STYLE_FAMILY_PAGE: + { + SwPageDesc* pPgDesc = rDoc.FindPageDescByName( aName ); + bRet = pPgDesc && pPgDesc->IsHidden( ); + } + break; + case SFX_STYLE_FAMILY_PSEUDO: + { + SwNumRule* pRule = rDoc.FindNumRulePtr( aName ); + bRet = pRule && pRule->IsHidden( ); + } + default:; } return bRet; diff --git a/xmloff/inc/xmloff/xmlnume.hxx b/xmloff/inc/xmloff/xmlnume.hxx index e6406bd..dca651d 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 222ba26..8296b24 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 6f9f897..1ca236b 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 b187c40..2710bee 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 278ff57..9dac482 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 2970392..0a9669e 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 2efffc7..cd697ec 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 fe28e57..433b140 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 2bc446d..9e875a9 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 3497125..81ce15c 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(); commit 316656755caabf4797391c46338c58945908837d Author: Cédric Bosdonnat <[email protected]> Date: Fri Nov 30 17:39:51 2012 +0100 API CHANGE: Added XStyle::isHidden() and XStyle::setHidden() Change-Id: I44770c05d51104b45d94145db8263187205daa84 diff --git a/offapi/com/sun/star/style/XStyle.idl b/offapi/com/sun/star/style/XStyle.idl index 29932e4..4367c5c 100644 --- a/offapi/com/sun/star/style/XStyle.idl +++ b/offapi/com/sun/star/style/XStyle.idl @@ -55,6 +55,14 @@ published interface XStyle: com::sun::star::container::XNamed void setParentStyle( [in] string aParentStyle ) raises( com::sun::star::container::NoSuchElementException ); + + /** tells whether the style is hidden in the UI. + */ + boolean isHidden(); + + /** sets whether a style should be hidden in the UI. + */ + void setHidden( [in] boolean hidden ); }; diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb index ab70f67..68c5ee8 100644 Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 2588fbc..ea90e23 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -269,6 +269,9 @@ public: ::sal_Bool SAL_CALL isInUse( ) throw (uno::RuntimeException); ::rtl::OUString SAL_CALL getParentStyle( ) throw (uno::RuntimeException); void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) throw (container::NoSuchElementException, uno::RuntimeException); + ::sal_Bool SAL_CALL isHidden( ) throw (uno::RuntimeException) { return false; } + void SAL_CALL setHidden( ::sal_Bool ) throw (uno::RuntimeException) { }; + // XNamed ::rtl::OUString SAL_CALL getName( ) throw (uno::RuntimeException); void SAL_CALL setName( const ::rtl::OUString& aName ) throw (uno::RuntimeException); diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx index 1664052..00b90f1 100644 --- a/sc/inc/styleuno.hxx +++ b/sc/inc/styleuno.hxx @@ -256,6 +256,8 @@ public: virtual void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isHidden() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHidden( sal_Bool bHidden ) throw(::com::sun::star::uno::RuntimeException); // XNamed virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 360cb68..42bc2de 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -1246,6 +1246,23 @@ void SAL_CALL ScStyleObj::setParentStyle( const rtl::OUString& rParentStyle ) } } +sal_Bool SAL_CALL ScStyleObj::isHidden( ) throw (uno::RuntimeException) +{ + SolarMutexGuard aGuard; + SfxStyleSheetBase* pStyle = GetStyle_Impl(); + if (pStyle) + return pStyle->IsHidden(); + return false; +} + +void SAL_CALL ScStyleObj::setHidden( sal_Bool bHidden ) throw (uno::RuntimeException) +{ + SolarMutexGuard aGuard; + SfxStyleSheetBase* pStyle = GetStyle_Impl(); + if (pStyle) + pStyle->SetHidden( bHidden ); +} + // container::XNamed rtl::OUString SAL_CALL ScStyleObj::getName() throw(uno::RuntimeException) diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx index 191bcf9..11942bb 100644 --- a/sd/inc/stlsheet.hxx +++ b/sd/inc/stlsheet.hxx @@ -92,6 +92,8 @@ public: virtual sal_Bool SAL_CALL isInUse( ) throw(::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getParentStyle( ) throw(::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isHidden( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHidden( sal_Bool bHidden ) throw(::com::sun::star::uno::RuntimeException); // XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index ef25721..13d1a5e 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -1024,6 +1024,22 @@ void SAL_CALL SdStyleSheet::setParentStyle( const OUString& rParentName ) throw } } +sal_Bool SAL_CALL SdStyleSheet::isHidden() throw(RuntimeException) +{ + SolarMutexGuard aGuard; + throwIfDisposed(); + + return IsHidden(); +} + +void SAL_CALL SdStyleSheet::setHidden( sal_Bool bHidden ) throw(RuntimeException) +{ + SolarMutexGuard aGuard; + throwIfDisposed(); + + return SetHidden( bHidden ); +} + // -------------------------------------------------------------------- // XPropertySet // -------------------------------------------------------------------- diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx index f719d36..171b5e5 100644 --- a/svx/source/table/tabledesign.cxx +++ b/svx/source/table/tabledesign.cxx @@ -84,6 +84,8 @@ public: virtual ::sal_Bool SAL_CALL isInUse() throw (RuntimeException); virtual OUString SAL_CALL getParentStyle() throw (RuntimeException); virtual void SAL_CALL setParentStyle( const OUString& aParentStyle ) throw (NoSuchElementException, RuntimeException); + virtual ::sal_Bool SAL_CALL isHidden() throw (RuntimeException) { return false; }; + virtual void SAL_CALL setHidden( ::sal_Bool ) throw (RuntimeException) { }; // XNamed virtual OUString SAL_CALL getName() throw (RuntimeException); diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx index 76bbd50..95835b8 100644 --- a/sw/inc/unostyle.hxx +++ b/sw/inc/unostyle.hxx @@ -213,6 +213,8 @@ public: virtual sal_Bool SAL_CALL isInUse(void) throw( ::com::sun::star::uno::RuntimeException ); virtual rtl::OUString SAL_CALL getParentStyle(void) throw( ::com::sun::star::uno::RuntimeException ); virtual void SAL_CALL setParentStyle(const rtl::OUString& aParentStyle) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isHidden() throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setHidden(sal_Bool bHidden) throw( ::com::sun::star::uno::RuntimeException ); //XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 5e6f87f..f0ab26e 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1505,6 +1505,41 @@ void SwXStyle::setParentStyle(const OUString& rParentStyle) throw uno::RuntimeException(); } +sal_Bool SAL_CALL SwXStyle::isHidden( ) throw( uno::RuntimeException ) +{ + sal_Bool bHidden = sal_False; + SolarMutexGuard aGuard; + if( pBasePool ) + { + pBasePool->SetSearchMask( eFamily ); + SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName); + if(pBase) + { + rtl::Reference< SwDocStyleSheet > xBase( new SwDocStyleSheet(*(SwDocStyleSheet*)pBase) ); + bHidden = xBase->IsHidden(); + } + } + return bHidden; +} + +void SAL_CALL SwXStyle::setHidden( sal_Bool bHidden ) + throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + if( pBasePool ) + { + pBasePool->SetSearchMask( eFamily ); + SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName); + if(pBase) + { + rtl::Reference< SwDocStyleSheet > xBase( new SwDocStyleSheet(*(SwDocStyleSheet*)pBase) ); + //make it a 'real' style - necessary for pooled styles + xBase->GetItemSet(); + xBase->SetHidden( bHidden ); + } + } +} + static uno::Reference< beans::XPropertySetInfo > lcl_getPropertySetInfo( SfxStyleFamily eFamily, sal_Bool bIsConditional ) { uno::Reference< beans::XPropertySetInfo > xRet;
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
