summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2011-12-19 15:41:21 +0000
committerArmin Le Grand <alg@apache.org>2011-12-19 15:41:21 +0000
commite2e16715893229b5d0ad2da6c8e84464e0c43a2e (patch)
tree79d1c632784b3de16fc82c1dfc27c1796a9ef451 /sd
parentea4f454ed956e08be47783b3bddd7789f905e350 (diff)
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement to trunk, first version of Svg stable and done
Diffstat (limited to 'sd')
-rwxr-xr-xsd/source/ui/view/drviews2.cxx29
-rwxr-xr-xsd/source/ui/view/drviews6.cxx2
-rwxr-xr-xsd/source/ui/view/drviews7.cxx9
-rwxr-xr-xsd/source/ui/view/drviewsc.cxx19
-rwxr-xr-xsd/source/ui/view/drviewsj.cxx19
-rwxr-xr-xsd/source/ui/view/sdview.cxx11
-rwxr-xr-xsd/source/ui/view/sdview3.cxx1
-rwxr-xr-xsd/source/ui/view/sdview4.cxx4
8 files changed, 73 insertions, 21 deletions
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 732abf866dec..ba0afc2b0b57 100755
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -627,7 +627,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
else
{
if( mpDrawView->IsVectorizeAllowed() )
+ {
SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
+ }
else
{
WaitObject aWait( (Window*)GetActiveWindow() );
@@ -709,8 +711,31 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
break;
case SID_CONVERT_TO_BITMAP:
{
- Bitmap aBitmap (mpDrawView->GetAllMarkedBitmap ());
- aGraphic = Graphic(aBitmap);
+ bool bDone(false);
+
+ // I have to get the image here directly since GetAllMarkedBitmap works
+ // based on Bitmaps, but not on BitmapEx, thus throwing away the alpha
+ // channel. Argh! GetAllMarkedBitmap itself is too widely used to safely
+ // change that, e.g. in the exchange formats. For now I can only add this
+ // exception to get good results for Svgs. This is how the code gets more
+ // and more crowded, at last I made a remark for myself to change this
+ // as one of the next tasks.
+ if(1 == mpDrawView->GetMarkedObjectCount())
+ {
+ const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(mpDrawView->GetMarkedObjectByIndex(0));
+
+ if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg())
+ {
+ aGraphic = Graphic(pSdrGrafObj->GetGraphic().getSvgData()->getReplacement());
+ bDone = true;
+ }
+ }
+
+ if(!bDone)
+ {
+ Bitmap aBitmap (mpDrawView->GetAllMarkedBitmap ());
+ aGraphic = Graphic(aBitmap);
+ }
}
break;
}
diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx
index 4bedfdb69663..17ec4618c075 100755
--- a/sd/source/ui/view/drviews6.cxx
+++ b/sd/source/ui/view/drviews6.cxx
@@ -446,7 +446,7 @@ void DrawViewShell::GetBmpMaskState( SfxItemSet& rSet )
// valid graphic object?
if( pObj && pObj->ISA( SdrGrafObj ) &&
- !( ((SdrGrafObj*) pObj)->IsEPS() || ((SdrGrafObj*) pObj)->IsRenderGraphic() ) &&
+ !((SdrGrafObj*) pObj)->IsEPS() &&
!mpDrawView->IsTextEdit() )
{
bEnable = sal_True;
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index cc7ba64df08d..cb1423cc359d 100755
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -1426,11 +1426,17 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
bFoundMetafile = true;
break;
case OBJ_GRAF :
+ {
bSingleGraphicSelected = nMarkCount == 1;
- switch ( ((SdrGrafObj*)pObj)->GetGraphicType() )
+ const SdrGrafObj* pSdrGrafObj = static_cast< const SdrGrafObj* >(pObj);
+ switch(pSdrGrafObj->GetGraphicType())
{
case GRAPHIC_BITMAP :
bFoundBitmap = sal_True;
+ if(pSdrGrafObj->isEmbeddedSvg())
+ {
+ bFoundMetafile = true;
+ }
break;
case GRAPHIC_GDIMETAFILE :
bFoundMetafile = sal_True;
@@ -1442,6 +1448,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
// #i25616# bFoundObjNoLine = sal_True;
// #i25616# bFoundObjNoArea = sal_True;
break;
+ }
case OBJ_TABLE:
bFoundTable = true;
break;
diff --git a/sd/source/ui/view/drviewsc.cxx b/sd/source/ui/view/drviewsc.cxx
index b5dbab402d0d..e325dc721991 100755
--- a/sd/source/ui/view/drviewsc.cxx
+++ b/sd/source/ui/view/drviewsc.cxx
@@ -363,10 +363,23 @@ void DrawViewShell::FuTemp03(SfxRequest& rReq)
SdrObject* pObj=pM->GetMarkedSdrObj();
SdrGrafObj* pGraf=PTR_CAST(SdrGrafObj,pObj);
SdrOle2Obj* pOle2=PTR_CAST(SdrOle2Obj,pObj);
- if (pGraf!=NULL && pGraf->HasGDIMetaFile())
- nCount += pGraf->GetGraphic().GetGDIMetaFile().GetActionCount();
- if(pOle2!=NULL && pOle2->GetGraphic())
+
+ if(pGraf)
+ {
+ if(pGraf->HasGDIMetaFile())
+ {
+ nCount += pGraf->GetGraphic().GetGDIMetaFile().GetActionCount();
+ }
+ else if(pGraf->isEmbeddedSvg())
+ {
+ nCount += pGraf->getMetafileFromEmbeddedSvg().GetActionCount();
+ }
+ }
+
+ if(pOle2 && pOle2->GetGraphic())
+ {
nCount += pOle2->GetGraphic()->GetGDIMetaFile().GetActionCount();
+ }
}
// anhand der erm. Summe entscheiden ob mit
diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx
index 5992b678d7af..40366a4ee555 100755
--- a/sd/source/ui/view/drviewsj.cxx
+++ b/sd/source/ui/view/drviewsj.cxx
@@ -127,22 +127,22 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_TEXTATTR_DLG ) )
{
const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
+ const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj);
sal_uInt32 nInv = pObj->GetObjInventor();
sal_uInt16 nId = pObj->GetObjIdentifier();
SdrObjTransformInfoRec aInfoRec;
pObj->TakeObjInfo( aInfoRec );
-
// #91929#; don't show original size entry if not possible
- if ( pObj->ISA( SdrOle2Obj ) )
+ if(pSdrOle2Obj)
{
- SdrOle2Obj* pOleObj = PTR_CAST(SdrOle2Obj, pObj);
- if (pOleObj->GetObjRef().is() &&
- ((pOleObj->GetObjRef()->getStatus( pOleObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) ) )
+ if (pSdrOle2Obj->GetObjRef().is() &&
+ ((pSdrOle2Obj->GetObjRef()->getStatus( pSdrOle2Obj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) ) )
rSet.DisableItem(SID_ORIGINAL_SIZE);
}
- if ( !( pObj->ISA( SdrGrafObj ) ) )
+ if(!pSdrGrafObj)
{
rSet.DisableItem(SID_SAVEGRAPHIC);
}
@@ -167,9 +167,10 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet )
rSet.DisableItem( SID_NAME_GROUP );
}
*/
- if (!pObj->ISA(SdrGrafObj) ||
- ((SdrGrafObj*) pObj)->GetGraphicType() != GRAPHIC_BITMAP ||
- ((SdrGrafObj*) pObj)->IsLinkedGraphic())
+ if(!pSdrGrafObj ||
+ pSdrGrafObj->GetGraphicType() != GRAPHIC_BITMAP ||
+ pSdrGrafObj->IsLinkedGraphic() ||
+ pSdrGrafObj->isEmbeddedSvg())
{
rSet.DisableItem(SID_CONVERT_TO_1BIT_THRESHOLD);
rSet.DisableItem(SID_CONVERT_TO_1BIT_MATRIX);
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index ec4b371bf244..cf096a396b27 100755
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -1073,10 +1073,15 @@ sal_Bool View::IsVectorizeAllowed() const
if( rMarkList.GetMarkCount() == 1 )
{
- const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+ const SdrGrafObj* pObj = dynamic_cast< const SdrGrafObj* >(rMarkList.GetMark( 0 )->GetMarkedSdrObj());
- if( pObj->ISA( SdrGrafObj ) && ( (SdrGrafObj*) pObj )->GetGraphicType() == GRAPHIC_BITMAP )
- bRet = sal_True;
+ if(pObj)
+ {
+ if(GRAPHIC_BITMAP == pObj->GetGraphicType() && !pObj->isEmbeddedSvg())
+ {
+ bRet = sal_True;
+ }
+ }
}
return bRet;
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 3ed80ae038ed..7f95b212aabe 100755
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -219,7 +219,6 @@ if( aPreviewSizePixel.Width() && aPreviewSizePixel.Height() )
case META_GRADIENTEX_ACTION:
case META_BMPSCALEPART_ACTION:
case META_BMPEXSCALEPART_ACTION:
- case META_RENDERGRAPHIC_ACTION:
bVector = true;
break;
case META_BMP_ACTION:
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 6a34c5265f59..1f5e0f28f567 100755
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -395,8 +395,10 @@ IMPL_LINK( View, DropInsertFileHdl, Timer*, EMPTYARG )
const bool bLink = ( ( nTempAction & DND_ACTION_LINK ) != 0 );
SdrGrafObj* pGrafObj = InsertGraphic( aGraphic, nTempAction, maDropPos, NULL, NULL );
- if( pGrafObj && bLink )
+ if(pGrafObj && bLink)
+ {
pGrafObj->SetGraphicLink( aCurrentDropFile, String() );
+ }
// return action from first inserted graphic
if( aIter == maDropFileVector.begin() )