sw/source/core/unocore/unoframe.cxx | 121 +++++++++++++++++++----------------- 1 file changed, 66 insertions(+), 55 deletions(-)
New commits: commit 4a76d7f700da112a553ec9d9811731e645581a7f Author: Oliver-Rainer Wittmann <o...@apache.org> Date: Tue Jun 10 14:49:06 2014 +0000 125072: method <SwGraphicProperties_Impl::AnyToItemSet(..)> - map given style name to corresponding UI name before searching for it. diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 8fd6b3f..0765c03 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -991,23 +991,24 @@ inline void lcl_FillMirror ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, } } -sal_Bool SwGraphicProperties_Impl::AnyToItemSet( - SwDoc* pDoc, - SfxItemSet& rFrmSet, - SfxItemSet& rGrSet, - sal_Bool& rSizeFound) -{ - //Properties fuer alle Frames - sal_Bool bRet; - const ::uno::Any *pStyleName; - SwDocStyleSheet* pStyle = NULL; +sal_Bool SwGraphicProperties_Impl::AnyToItemSet( + SwDoc* pDoc, + SfxItemSet& rFrmSet, + SfxItemSet& rGrSet, + sal_Bool& rSizeFound ) +{ + sal_Bool bRet = sal_False; - if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) ) + SwDocStyleSheet* pStyle = NULL; + const ::uno::Any *pStyleName; + if ( GetProperty( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) ) { - OUString sStyle; - *pStyleName >>= sStyle; - pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, - SFX_STYLE_FAMILY_FRAME); + OUString sTmpStylename; + *pStyleName >>= sTmpStylename; + String sStylename; + SwStyleNameMapper::FillUIName( String(sTmpStylename), sStylename, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, sal_True ); + pStyle = + (SwDocStyleSheet*) pDoc->GetDocShell()->GetStyleSheetPool()->Find( sStylename, SFX_STYLE_FAMILY_FRAME ); } const ::uno::Any* pHEvenMirror = 0; @@ -1017,24 +1018,22 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_ODD_PAGES, pHOddMirror); GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_VERT, pVMirror); - if ( pStyle ) + if ( pStyle != NULL ) { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet(*pStyle) ); const :: SfxItemSet *pItemSet = &xStyle->GetItemSet(); - //Begin Bug 119922 sal_Bool bOasis = sal_False; { const SfxMedium* pMedium = pDoc->GetDocShell()->GetMedium(); - const SfxFilter * pFilter = pMedium - ? pMedium->GetFilter() - : NULL; - if ( pMedium && pFilter ) + const SfxFilter * pFilter = pMedium != NULL + ? pMedium->GetFilter() + : NULL; + if ( pFilter != NULL ) { bOasis = pFilter->GetVersion() > SOFFICE_FILEFORMAT_60; } } bRet = FillBaseProperties( rFrmSet, *pItemSet, rSizeFound, bOasis ); - //End Bug 119922 lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet ); } else @@ -1044,8 +1043,7 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet ); } - - static const :: sal_uInt16 nIDs[] = + static const ::sal_uInt16 nIDs[] = { RES_GRFATR_CROPGRF, RES_GRFATR_ROTATION, @@ -1061,14 +1059,14 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( 0 }; const ::uno::Any* pAny; - for(sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++) + for ( sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++ ) { - sal_uInt8 nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0; - if(GetProperty(nIDs[nIndex], nMId, pAny )) + const sal_uInt8 nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0; + if ( GetProperty( nIDs[nIndex], nMId, pAny ) ) { SfxPoolItem* pItem = ::GetDfltAttr( nIDs[nIndex] )->Clone(); - bRet &= pItem->PutValue(*pAny, nMId ); - rGrSet.Put(*pItem); + bRet &= pItem->PutValue( *pAny, nMId ); + rGrSet.Put( *pItem ); delete pItem; } } @@ -1076,6 +1074,7 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( return bRet; } + class SwOLEProperties_Impl : public SwFrameProperties_Impl { public: @@ -1086,17 +1085,22 @@ public: virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound); }; -sal_Bool SwOLEProperties_Impl::AnyToItemSet( - SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound) + +sal_Bool SwOLEProperties_Impl::AnyToItemSet( + SwDoc* pDoc, + SfxItemSet& rFrmSet, + SfxItemSet& rSet, + sal_Bool& rSizeFound ) { const ::uno::Any* pTemp; - if(!GetProperty(FN_UNO_CLSID, 0, pTemp) && !GetProperty(FN_UNO_STREAM_NAME, 0, pTemp) ) + if ( !GetProperty( FN_UNO_CLSID, 0, pTemp ) && !GetProperty( FN_UNO_STREAM_NAME, 0, pTemp ) ) return sal_False; - SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrmSet, rSet, rSizeFound); - // + SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrmSet, rSet, rSizeFound ); + return sal_True; } + /****************************************************************** * SwXFrame ******************************************************************/ commit ba200f7255e3275044c0fa69219ad24aa3fd9d80 Author: Oliver-Rainer Wittmann <o...@apache.org> Date: Tue Jun 10 14:43:28 2014 +0000 125072: method <SwFrameProperties_Impl::AnyToItemSet(..)> - map given style name to corresponding UI name before searching for it. Patch by: Elie Roux - roux dot elie at gmail dot com diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 9dde595..8fd6b3f 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -912,43 +912,50 @@ inline void lcl_FillCol ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, con rToSet.Put(aCol); } } -sal_Bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItemSet&, sal_Bool& rSizeFound) +sal_Bool SwFrameProperties_Impl::AnyToItemSet( + SwDoc *pDoc, + SfxItemSet& rSet, + SfxItemSet&, + sal_Bool& rSizeFound ) { - //Properties fuer alle Frames - const ::uno::Any *pStyleName; - SwDocStyleSheet* pStyle = NULL; - sal_Bool bRet; + sal_Bool bRet = sal_False; - if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) ) + SwDocStyleSheet* pStyle = NULL; + const ::uno::Any *pStyleName; + if ( GetProperty( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) ) { - OUString sStyle; - *pStyleName >>= sStyle; - pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, - SFX_STYLE_FAMILY_FRAME); + OUString sTmpStylename; + *pStyleName >>= sTmpStylename; + String sStylename; + SwStyleNameMapper::FillUIName( String(sTmpStylename), sStylename, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, sal_True ); + pStyle = + (SwDocStyleSheet*) pDoc->GetDocShell()->GetStyleSheetPool()->Find( sStylename, SFX_STYLE_FAMILY_FRAME ); } const ::uno::Any* pColumns = NULL; - GetProperty (RES_COL, MID_COLUMNS, pColumns); - if ( pStyle ) + GetProperty( RES_COL, MID_COLUMNS, pColumns ); + if ( pStyle != NULL ) { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *pStyle ) ); - const :: SfxItemSet *pItemSet = &xStyle->GetItemSet(); - bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); - lcl_FillCol ( rSet, *pItemSet, pColumns ); + const ::SfxItemSet *pItemSet = &xStyle->GetItemSet(); + bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); + lcl_FillCol( rSet, *pItemSet, pColumns ); } else { - const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet(); - bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); - lcl_FillCol ( rSet, *pItemSet, pColumns ); + const ::SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet(); + bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); + lcl_FillCol( rSet, *pItemSet, pColumns ); } + const ::uno::Any* pEdit; - if(GetProperty(RES_EDIT_IN_READONLY, 0, pEdit)) + if ( GetProperty( RES_EDIT_IN_READONLY, 0, pEdit ) ) { - SfxBoolItem aBool(RES_EDIT_IN_READONLY); - ((SfxPoolItem&)aBool).PutValue(*pEdit, 0); - rSet.Put(aBool); + SfxBoolItem aBool( RES_EDIT_IN_READONLY ); + ( (SfxPoolItem&) aBool ).PutValue( *pEdit, 0 ); + rSet.Put( aBool ); } + return bRet; } /**************************************************************************** _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits