diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2011-03-29 15:25:13 +0200 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2011-03-29 15:25:13 +0200 |
commit | bf5f48db92815a2e275c55ef72bf694f18380dca (patch) | |
tree | 529fe7419eb817fd1afa006a78b39d3f0c247a0b /svx | |
parent | 3dd03a39a50834e7dac2b4371c385b1dd00525a3 (diff) | |
parent | c42564a7fdbe8a5e65eff768dca598ee96b8f88e (diff) |
CWS-TOOLING: integrate CWS ka102
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/svdograf.hxx | 3 | ||||
-rw-r--r-- | svx/source/dialog/_bmpmask.cxx | 3 | ||||
-rw-r--r-- | svx/source/gallery2/galtheme.cxx | 1 | ||||
-rw-r--r-- | svx/source/svdraw/svdedtv.cxx | 7 | ||||
-rw-r--r-- | svx/source/svdraw/svdfmtf.cxx | 25 | ||||
-rw-r--r-- | svx/source/svdraw/svdfmtf.hxx | 1 | ||||
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 23 | ||||
-rw-r--r-- | svx/source/tbxctrls/grafctrl.cxx | 148 | ||||
-rw-r--r-- | svx/source/xml/xmlgrhlp.cxx | 9 |
9 files changed, 150 insertions, 70 deletions
diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx index fa5b56e403e5..948115dff47e 100644 --- a/svx/inc/svx/svdograf.hxx +++ b/svx/inc/svx/svdograf.hxx @@ -148,6 +148,8 @@ public: // Keep ATM for SD. sal_Bool IsAnimated() const; sal_Bool IsEPS() const; + sal_Bool IsRenderGraphic() const; + sal_Bool HasRenderGraphic() const; sal_Bool IsSwappedOut() const; const MapMode& GetGrafPrefMapMode() const; @@ -225,4 +227,3 @@ public: }; #endif //_SVDOGRAF_HXX - diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index b6b8ca387969..006d288dfc47 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -1038,6 +1038,9 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf ) default: { + OSL_ENSURE( pAction->GetType() != META_RENDERGRAPHIC_ACTION, + "META_RENDERGRAPHIC_ACTION currently not supported at masking" ); + pAction->Duplicate(); aMtf.AddAction( pAction ); } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index bd1ae10cd746..71f2252fc731 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -901,6 +901,7 @@ sal_Bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInse case( GFX_LINK_TYPE_NATIVE_WMF ): nExportFormat = CVT_WMF; break; case( GFX_LINK_TYPE_NATIVE_MET ): nExportFormat = CVT_MET; break; case( GFX_LINK_TYPE_NATIVE_PCT ): nExportFormat = CVT_PCT; break; + case( GFX_LINK_TYPE_NATIVE_SVG ): nExportFormat = CVT_SVG; break; default: break; } diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index ec9fece55649..d8b31a9a0ccb 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -644,8 +644,12 @@ void SdrEditView::CheckPossibilities() sal_Bool bGraf=HAS_BASE(SdrGrafObj,pObj); sal_Bool bOle2=HAS_BASE(SdrOle2Obj,pObj); - if( bGraf && ((SdrGrafObj*)pObj)->HasGDIMetaFile() && !((SdrGrafObj*)pObj)->IsEPS() ) + if( bGraf && + ((SdrGrafObj*)pObj)->HasGDIMetaFile() && + !( ((SdrGrafObj*)pObj)->IsEPS() || ((SdrGrafObj*)pObj)->IsRenderGraphic() ) ) + { bImportMtfPossible = sal_True; + } if (bOle2) bImportMtfPossible=((SdrOle2Obj*)pObj)->GetObjRef().is(); @@ -1043,4 +1047,3 @@ bool SdrEditView::IsUndoEnabled() const { return pMod->IsUndoEnabled(); } - diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 6a207ca4cba4..0a4bc82e45f8 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -195,7 +195,7 @@ sal_uIntPtr ImpSdrGDIMetaFileImport::DoImport(const GDIMetaFile& rMtf, case META_POP_ACTION : DoAction((MetaPopAction &)*pAct); break; case META_HATCH_ACTION : DoAction((MetaHatchAction &)*pAct); break; case META_COMMENT_ACTION : DoAction((MetaCommentAction &)*pAct, pMtf); break; - + case META_RENDERGRAPHIC_ACTION : DoAction((MetaRenderGraphicAction &)*pAct); break; } if(pProgrInfo != NULL) @@ -272,7 +272,7 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, FASTBOOL bForceText { bNoLine = sal_False; bNoFill = sal_False; FASTBOOL bLine=sal_True && !bForceTextAttr; - FASTBOOL bFill=pObj==NULL || pObj->IsClosedObj() && !bForceTextAttr; + FASTBOOL bFill=pObj==NULL || ( pObj->IsClosedObj() && !bForceTextAttr ); FASTBOOL bText=bForceTextAttr || (pObj!=NULL && pObj->GetOutlinerParaObject()!=NULL); if ( bLine ) @@ -1025,4 +1025,25 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM } } +//////////////////////////////////////////////////////////////////////////////////////////////////// + +void ImpSdrGDIMetaFileImport::DoAction(MetaRenderGraphicAction& rAct) +{ + GDIMetaFile aMtf; + const ::vcl::RenderGraphic& rRenderGraphic = rAct.GetRenderGraphic(); + Rectangle aRect( rAct.GetPoint(), rAct.GetSize() ); + const Point aPos; + const Size aPrefSize( rRenderGraphic.GetPrefSize() ); + + aRect.Right()++; aRect.Bottom()++; + + aMtf.SetPrefMapMode( rRenderGraphic.GetPrefMapMode() ); + aMtf.SetPrefSize( aPrefSize ); + aMtf.AddAction( new MetaRenderGraphicAction( aPos, aPrefSize, rRenderGraphic ) ); + aMtf.WindStart(); + + SdrGrafObj* pGraf=new SdrGrafObj( aMtf, aRect ); + InsertObj( pGraf ); +} + // eof diff --git a/svx/source/svdraw/svdfmtf.hxx b/svx/source/svdraw/svdfmtf.hxx index abe434aa215b..463915d48096 100644 --- a/svx/source/svdraw/svdfmtf.hxx +++ b/svx/source/svdraw/svdfmtf.hxx @@ -140,6 +140,7 @@ protected: void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); } void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); } void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf); + void DoAction(MetaRenderGraphicAction& rAct); void ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct ); void SetAttributes(SdrObject* pObj, FASTBOOL bForceTextAttr=sal_False); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index adfc7d0ba991..5895eface327 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -504,6 +504,16 @@ sal_Bool SdrGrafObj::IsEPS() const return pGraphic->IsEPS(); } +sal_Bool SdrGrafObj::IsRenderGraphic() const +{ + return pGraphic->IsRenderGraphic(); +} + +sal_Bool SdrGrafObj::HasRenderGraphic() const +{ + return pGraphic->HasRenderGraphic(); +} + sal_Bool SdrGrafObj::IsSwappedOut() const { return mbIsPreview ? sal_True : pGraphic->IsSwappedOut(); @@ -658,6 +668,7 @@ void SdrGrafObj::ReleaseGraphicLink() void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const { FASTBOOL bAnim = pGraphic->IsAnimated(); + FASTBOOL bRenderGraphic = pGraphic->HasRenderGraphic(); FASTBOOL bNoPresGrf = ( pGraphic->GetType() != GRAPHIC_NONE ) && !bEmptyPresObj; rInfo.bResizeFreeAllowed = aGeo.nDrehWink % 9000 == 0 || @@ -665,11 +676,11 @@ void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const aGeo.nDrehWink % 27000 == 0; rInfo.bResizePropAllowed = sal_True; - rInfo.bRotateFreeAllowed = bNoPresGrf && !bAnim; - rInfo.bRotate90Allowed = bNoPresGrf && !bAnim; - rInfo.bMirrorFreeAllowed = bNoPresGrf && !bAnim; - rInfo.bMirror45Allowed = bNoPresGrf && !bAnim; - rInfo.bMirror90Allowed = !bEmptyPresObj; + rInfo.bRotateFreeAllowed = bNoPresGrf && !bAnim && !bRenderGraphic; + rInfo.bRotate90Allowed = bNoPresGrf && !bAnim && !bRenderGraphic; + rInfo.bMirrorFreeAllowed = bNoPresGrf && !bAnim && !bRenderGraphic; + rInfo.bMirror45Allowed = bNoPresGrf && !bAnim && !bRenderGraphic; + rInfo.bMirror90Allowed = !bEmptyPresObj && !bRenderGraphic; rInfo.bTransparenceAllowed = sal_False; rInfo.bGradientAllowed = sal_False; rInfo.bShearAllowed = sal_False; @@ -677,7 +688,7 @@ void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const rInfo.bCanConvToPath = sal_False; rInfo.bCanConvToPathLineToArea = sal_False; rInfo.bCanConvToPolyLineToArea = sal_False; - rInfo.bCanConvToPoly = !IsEPS(); + rInfo.bCanConvToPoly = !IsEPS() && !bRenderGraphic; rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary()); } diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index ebad78935d13..fb7c1330f88c 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -856,10 +856,8 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) { SfxItemPool& rPool = rView.GetModel()->GetItemPool(); SfxItemSet aSet( rPool, SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST ); - - const bool bUndo = rView.IsUndoEnabled(); - - String aUndoStr; + String aUndoStr; + const bool bUndo = rView.IsUndoEnabled(); if( bUndo ) { @@ -1139,7 +1137,29 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView ) SfxItemPool& rPool = rView.GetModel()->GetItemPool(); SfxItemSet aAttrSet( rPool ); SfxWhichIter aIter( rSet ); - sal_uInt16 nWhich = aIter.FirstWhich(); + sal_uInt16 nWhich = aIter.FirstWhich(); + const SdrMarkList& rMarkList = rView.GetMarkedObjectList(); + bool bEnableColors = true; + bool bEnableTransparency = true; + bool bEnableCrop = ( 1 == rMarkList.GetMarkCount() ); + + for( int i = 0, nCount = rMarkList.GetMarkCount(); i < nCount; ++i ) + { + SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >( rMarkList.GetMark( i )->GetMarkedSdrObj() ); + + if( !pGrafObj || + ( pGrafObj->GetGraphicType() == GRAPHIC_NONE ) || + ( pGrafObj->GetGraphicType() == GRAPHIC_DEFAULT ) || + pGrafObj->HasRenderGraphic() ) + { + bEnableColors = bEnableTransparency = bEnableCrop = false; + break; + } + else if( bEnableTransparency && ( pGrafObj->HasGDIMetaFile() || pGrafObj->IsAnimated() ) ) + { + bEnableTransparency = false; + } + } rView.GetAttributes( aAttrSet ); @@ -1153,8 +1173,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView ) { if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFMODE ) ) { - rSet.Put( SfxUInt16Item( nSlotId, - sal::static_int_cast< sal_uInt16 >( ITEMVALUE( aAttrSet, SDRATTR_GRAFMODE, SdrGrafModeItem ) ) ) ); + if( bEnableColors ) + { + rSet.Put( SfxUInt16Item( nSlotId, + sal::static_int_cast< sal_uInt16 >( ITEMVALUE( aAttrSet, SDRATTR_GRAFMODE, SdrGrafModeItem ) ) ) ); + } + else + { + rSet.DisableItem( SID_ATTR_GRAF_MODE ); + } } } break; @@ -1163,8 +1190,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView ) { if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFRED ) ) { - rSet.Put( SfxInt16Item( nSlotId, - ITEMVALUE( aAttrSet, SDRATTR_GRAFRED, SdrGrafRedItem ) ) ); + if( bEnableColors ) + { + rSet.Put( SfxInt16Item( nSlotId, + ITEMVALUE( aAttrSet, SDRATTR_GRAFRED, SdrGrafRedItem ) ) ); + } + else + { + rSet.DisableItem( SID_ATTR_GRAF_RED ); + } } } break; @@ -1173,8 +1207,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView ) { if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFGREEN ) ) { - rSet.Put( SfxInt16Item( nSlotId, - ITEMVALUE( aAttrSet, SDRATTR_GRAFGREEN, SdrGrafGreenItem ) ) ); + if( bEnableColors ) + { + rSet.Put( SfxInt16Item( nSlotId, + ITEMVALUE( aAttrSet, SDRATTR_GRAFGREEN, SdrGrafGreenItem ) ) ); + } + else + { + rSet.DisableItem( SID_ATTR_GRAF_GREEN ); + } } } break; @@ -1183,8 +1224,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView ) { if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFBLUE ) ) { - rSet.Put( SfxInt16Item( nSlotId, - ITEMVALUE( aAttrSet, SDRATTR_GRAFBLUE, SdrGrafBlueItem ) ) ); + if( bEnableColors ) + { + rSet.Put( SfxInt16Item( nSlotId, + ITEMVALUE( aAttrSet, SDRATTR_GRAFBLUE, SdrGrafBlueItem ) ) ); + } + else + { + rSet.DisableItem( SID_ATTR_GRAF_BLUE ); + } } } break; @@ -1193,8 +1241,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView ) { if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFLUMINANCE ) ) { - rSet.Put( SfxInt16Item( nSlotId, - ITEMVALUE( aAttrSet, SDRATTR_GRAFLUMINANCE, SdrGrafLuminanceItem ) ) ); + if( bEnableColors ) + { + rSet.Put( SfxInt16Item( nSlotId, + ITEMVALUE( aAttrSet, SDRATTR_GRAFLUMINANCE, SdrGrafLuminanceItem ) ) ); + } + else + { + rSet.DisableItem( SID_ATTR_GRAF_LUMINANCE ); + } } } break; @@ -1203,8 +1258,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView ) { if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFCONTRAST ) ) { - rSet.Put( SfxInt16Item( nSlotId, - ITEMVALUE( aAttrSet, SDRATTR_GRAFCONTRAST, SdrGrafContrastItem ) ) ); + if( bEnableColors ) + { + rSet.Put( SfxInt16Item( nSlotId, + ITEMVALUE( aAttrSet, SDRATTR_GRAFCONTRAST, SdrGrafContrastItem ) ) ); + } + else + { + rSet.DisableItem( SID_ATTR_GRAF_CONTRAST ); + } } } break; @@ -1213,8 +1275,15 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView ) { if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFGAMMA ) ) { - rSet.Put( SfxUInt32Item( nSlotId, - ITEMVALUE( aAttrSet, SDRATTR_GRAFGAMMA, SdrGrafGamma100Item ) ) ); + if( bEnableColors ) + { + rSet.Put( SfxUInt32Item( nSlotId, + ITEMVALUE( aAttrSet, SDRATTR_GRAFGAMMA, SdrGrafGamma100Item ) ) ); + } + else + { + rSet.DisableItem( SID_ATTR_GRAF_GAMMA ); + } } } break; @@ -1223,53 +1292,22 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView ) { if( SFX_ITEM_AVAILABLE <= aAttrSet.GetItemState( SDRATTR_GRAFTRANSPARENCE ) ) { - const SdrMarkList& rMarkList = rView.GetMarkedObjectList(); - sal_Bool bEnable = sal_True; - - for( sal_uInt16 i = 0, nCount = (sal_uInt16) rMarkList.GetMarkCount(); - ( i < nCount ) && bEnable; i++ ) + if( bEnableTransparency ) { - SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - - if( !pObj || !pObj->ISA( SdrGrafObj ) || - ( (SdrGrafObj*) pObj )->HasGDIMetaFile() || - ( (SdrGrafObj*) pObj )->IsAnimated() ) - { - bEnable = sal_False; - } - } - - if( bEnable ) rSet.Put( SfxUInt16Item( nSlotId, ITEMVALUE( aAttrSet, SDRATTR_GRAFTRANSPARENCE, SdrGrafTransparenceItem ) ) ); + } else + { rSet.DisableItem( SID_ATTR_GRAF_TRANSPARENCE ); + } } } break; case( SID_ATTR_GRAF_CROP ): { - const SdrMarkList& rMarkList = rView.GetMarkedObjectList(); - sal_Bool bDisable = sal_True; - - if( 1 == rMarkList.GetMarkCount() ) - { - SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); - - if( pObj && pObj->ISA( SdrGrafObj ) ) - { - SdrGrafObj* pGrafObj = (SdrGrafObj*) pObj; - - if( ( pGrafObj->GetGraphicType() != GRAPHIC_NONE ) && - ( pGrafObj->GetGraphicType() != GRAPHIC_DEFAULT ) ) - { - bDisable = sal_False; - } - } - } - - if( bDisable ) + if( !bEnableCrop ) rSet.DisableItem( nSlotId ); } break; diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 7889fcc0f5ff..5284e32f810e 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -153,7 +153,7 @@ SvXMLGraphicInputStream::SvXMLGraphicInputStream( const ::rtl::OUString& rGraphi { pStm->SetVersion( SOFFICE_FILEFORMAT_8 ); pStm->SetCompressMode( COMPRESSMODE_ZBITMAP ); - ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( *pStm ); + ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( *pStm, GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC ); bRet = ( pStm->GetError() == 0 ); } } @@ -543,7 +543,8 @@ String SvXMLGraphicHelper::ImplGetGraphicMimeType( const String& rFileName ) con { "gif", "image/gif" }, { "png", "image/png" }, { "jpg", "image/jpeg" }, - { "tif", "image/tiff" } + { "tif", "image/tiff" }, + { "svg", "image/svg+xml" } }; String aMimeType; @@ -648,7 +649,7 @@ sal_Bool SvXMLGraphicHelper::ImplWriteGraphic( const ::rtl::OUString& rPictureSt pStream->Write( rLink.GetData(), rLink.GetDataSize() ); } else - rMtf.Write( *pStream ); + rMtf.Write( *pStream, GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC ); bRet = ( pStream->GetError() == 0 ); } @@ -728,6 +729,7 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, s case( GFX_LINK_TYPE_NATIVE_WMF ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".wmf" ) ); break; case( GFX_LINK_TYPE_NATIVE_MET ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".met" ) ); break; case( GFX_LINK_TYPE_NATIVE_PCT ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".pct" ) ); break; + case( GFX_LINK_TYPE_NATIVE_SVG ): aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".svg" ) ); break; default: aExtension = String( RTL_CONSTASCII_USTRINGPARAM( ".grf" ) ); @@ -1160,4 +1162,3 @@ Sequence< ::rtl::OUString > SAL_CALL SvXMLGraphicExportHelper_getSupportedServic } } // namespace svx - |