Return-Path: X-Original-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 43B0C9D4D for ; Fri, 11 May 2012 15:39:56 +0000 (UTC) Received: (qmail 69415 invoked by uid 500); 11 May 2012 15:39:56 -0000 Delivered-To: apmail-incubator-ooo-commits-archive@incubator.apache.org Received: (qmail 69367 invoked by uid 500); 11 May 2012 15:39:56 -0000 Mailing-List: contact ooo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-commits@incubator.apache.org Received: (qmail 69356 invoked by uid 99); 11 May 2012 15:39:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 May 2012 15:39:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 May 2012 15:39:51 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A1BF6238890B; Fri, 11 May 2012 15:39:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1337213 - in /incubator/ooo/trunk/main: drawinglayer/source/primitive2d/ svx/source/svdraw/ vcl/inc/vcl/ vcl/source/gdi/ Date: Fri, 11 May 2012 15:39:30 -0000 To: ooo-commits@incubator.apache.org From: alg@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120511153931.A1BF6238890B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: alg Date: Fri May 11 15:39:29 2012 New Revision: 1337213 URL: http://svn.apache.org/viewvc?rev=1337213&view=rev Log: #119125# Added MetaFloatTransparentAction handling using primitive renderer Modified: incubator/ooo/trunk/main/drawinglayer/source/primitive2d/metafileprimitive2d.cxx incubator/ooo/trunk/main/svx/source/svdraw/svdedtv2.cxx incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.cxx incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.hxx incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx incubator/ooo/trunk/main/vcl/inc/vcl/svgdata.hxx incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx incubator/ooo/trunk/main/vcl/source/gdi/svgdata.cxx Modified: incubator/ooo/trunk/main/drawinglayer/source/primitive2d/metafileprimitive2d.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/drawinglayer/source/primitive2d/metafileprimitive2d.cxx?rev=1337213&r1=1337212&r2=1337213&view=diff ============================================================================== --- incubator/ooo/trunk/main/drawinglayer/source/primitive2d/metafileprimitive2d.cxx (original) +++ incubator/ooo/trunk/main/drawinglayer/source/primitive2d/metafileprimitive2d.cxx Fri May 11 15:39:29 2012 @@ -2970,9 +2970,13 @@ namespace { /** CHECKED, WORKS WELL */ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*)pAction; - const Rectangle aTargetRectangle(pA->GetPoint(), pA->GetSize()); + const basegfx::B2DRange aTargetRange( + pA->GetPoint().X(), + pA->GetPoint().Y(), + pA->GetPoint().X() + pA->GetSize().Width(), + pA->GetPoint().Y() + pA->GetSize().Height()); - if(!aTargetRectangle.IsEmpty()) + if(!aTargetRange.isEmpty()) { const GDIMetaFile& rContent = pA->GetGDIMetaFile(); @@ -2993,6 +2997,32 @@ namespace if(xSubContent.hasElements()) { + // create SourceRange + const basegfx::B2DRange aSourceRange( + rContent.GetPrefMapMode().GetOrigin().X(), + rContent.GetPrefMapMode().GetOrigin().Y(), + rContent.GetPrefMapMode().GetOrigin().X() + rContent.GetPrefSize().Width(), + rContent.GetPrefMapMode().GetOrigin().Y() + rContent.GetPrefSize().Height()); + + // apply mapping if aTargetRange and aSourceRange are not equal + if(!aSourceRange.equal(aTargetRange)) + { + basegfx::B2DHomMatrix aTransform; + + aTransform.translate(-aSourceRange.getMinX(), -aSourceRange.getMinY()); + aTransform.scale( + aTargetRange.getWidth() / (basegfx::fTools::equalZero(aSourceRange.getWidth()) ? 1.0 : aSourceRange.getWidth()), + aTargetRange.getHeight() / (basegfx::fTools::equalZero(aSourceRange.getHeight()) ? 1.0 : aSourceRange.getHeight())); + aTransform.translate(aTargetRange.getMinX(), aTargetRange.getMinY()); + + const drawinglayer::primitive2d::Primitive2DReference aEmbeddedTransform( + new drawinglayer::primitive2d::TransformPrimitive2D( + aTransform, + xSubContent)); + + xSubContent = drawinglayer::primitive2d::Primitive2DSequence(&aEmbeddedTransform, 1); + } + // check if gradient is a real gradient const Gradient& rGradient = pA->GetGradient(); const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient)); @@ -3008,9 +3038,7 @@ namespace else { // really a gradient. Create gradient sub-content (with correct scaling) - basegfx::B2DRange aRange( - aTargetRectangle.Left(), aTargetRectangle.Top(), - aTargetRectangle.Right(), aTargetRectangle.Bottom()); + basegfx::B2DRange aRange(aTargetRange); aRange.transform(rPropertyHolders.Current().getTransformation()); // prepare gradient for transparent content Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdedtv2.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdedtv2.cxx?rev=1337213&r1=1337212&r2=1337213&view=diff ============================================================================== --- incubator/ooo/trunk/main/svx/source/svdraw/svdedtv2.cxx (original) +++ incubator/ooo/trunk/main/svx/source/svdraw/svdedtv2.cxx Fri May 11 15:39:29 2012 @@ -2079,8 +2079,7 @@ void SdrEditView::DoImportMarkedMtf(SvdP if(pGraf->HasGDIMetaFile()) { - aMetaFile = pGraf->GetTransformedGraphic( - SDRGRAFOBJ_TRANSFORMATTR_COLOR|SDRGRAFOBJ_TRANSFORMATTR_MIRROR).GetGDIMetaFile(); + aMetaFile = pGraf->GetTransformedGraphic(SDRGRAFOBJ_TRANSFORMATTR_COLOR|SDRGRAFOBJ_TRANSFORMATTR_MIRROR).GetGDIMetaFile(); } else if(pGraf->isEmbeddedSvg()) { @@ -2089,25 +2088,16 @@ void SdrEditView::DoImportMarkedMtf(SvdP if(aMetaFile.GetActionCount()) { - ImpSdrGDIMetaFileImport aFilter(*pMod); - aLogicRect = pGraf->GetLogicRect(); - aFilter.SetScaleRect(aLogicRect); - aFilter.SetLayer(pObj->GetLayer()); - + ImpSdrGDIMetaFileImport aFilter(*pMod, pObj->GetLayer(), aLogicRect); nInsAnz = aFilter.DoImport(aMetaFile, *pOL, nInsPos, pProgrInfo); } } if ( pOle2!=NULL && pOle2->GetGraphic() ) { - //const GDIMetaFile* pMtf=pOle2->GetGDIMetaFile(); - ImpSdrGDIMetaFileImport aFilter(*pMod); - aLogicRect = pOle2->GetLogicRect(); - aFilter.SetScaleRect(aLogicRect); - aFilter.SetLayer(pObj->GetLayer()); - - nInsAnz=aFilter.DoImport(pOle2->GetGraphic()->GetGDIMetaFile(),*pOL,nInsPos,pProgrInfo); + ImpSdrGDIMetaFileImport aFilter(*pMod, pObj->GetLayer(), aLogicRect); + nInsAnz = aFilter.DoImport(pOle2->GetGraphic()->GetGDIMetaFile(), *pOL, nInsPos, pProgrInfo); } if (nInsAnz!=0) { Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.cxx?rev=1337213&r1=1337212&r2=1337213&view=diff ============================================================================== --- incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.cxx (original) +++ incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.cxx Fri May 11 15:39:29 2012 @@ -70,98 +70,65 @@ #include #include #include +#include +#include +#include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// -ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel& rModel): - nMapScalingOfs(0), - pLineAttr(NULL),pFillAttr(NULL),pTextAttr(NULL), - pPage(NULL),pModel(NULL),nLayer(0), - nLineWidth(0), +ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport( + SdrModel& rModel, + SdrLayerID nLay, + const Rectangle& rRect) +: maTmpList(), + maVD(), + maScaleRect(rRect), + mnMapScalingOfs(0), + mpLineAttr(0), + mpFillAttr(0), + mpTextAttr(0), + mpModel(&rModel), + mnLayer(nLay), + maOldLineColor(), + mnLineWidth(0), maLineJoin(basegfx::B2DLINEJOIN_NONE), maLineCap(com::sun::star::drawing::LineCap_BUTT), maDash(XDASH_RECT, 0, 0, 0, 0, 0), - bFntDirty(sal_True), - bLastObjWasPolyWithoutLine(sal_False), - bNoLine(sal_False), - bNoFill(sal_False), - bLastObjWasLine(sal_False), + mbMov(false), + mbSize(false), + maOfs(0, 0), + mfScaleX(1.0), + mfScaleY(1.0), + maScaleX(1.0), + maScaleY(1.0), + mbFntDirty(true), + mbLastObjWasPolyWithoutLine(false), + mbNoLine(false), + mbNoFill(false), + mbLastObjWasLine(false), maClip() { - aVD.EnableOutput(sal_False); - - // #i111954# init to no fill and no line initially - aVD.SetLineColor(); - aVD.SetFillColor(); - - aOldLineColor.SetRed( aVD.GetLineColor().GetRed() + 1 ); // invalidate old line color - pLineAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_LINE_FIRST,XATTR_LINE_LAST); - pFillAttr=new SfxItemSet(rModel.GetItemPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST); - pTextAttr=new SfxItemSet(rModel.GetItemPool(),EE_ITEMS_START,EE_ITEMS_END); - pModel=&rModel; + maVD.EnableOutput(false); + maVD.SetLineColor(); + maVD.SetFillColor(); + maOldLineColor.SetRed( maVD.GetLineColor().GetRed() + 1 ); + mpLineAttr = new SfxItemSet(rModel.GetItemPool(), XATTR_LINE_FIRST, XATTR_LINE_LAST, 0, 0); + mpFillAttr = new SfxItemSet(rModel.GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0); + mpTextAttr = new SfxItemSet(rModel.GetItemPool(), EE_ITEMS_START, EE_ITEMS_END, 0, 0); checkClip(); } ImpSdrGDIMetaFileImport::~ImpSdrGDIMetaFileImport() { - delete pLineAttr; - delete pFillAttr; - delete pTextAttr; + delete mpLineAttr; + delete mpFillAttr; + delete mpTextAttr; } -sal_uIntPtr ImpSdrGDIMetaFileImport::DoImport(const GDIMetaFile& rMtf, - SdrObjList& rOL, - sal_uIntPtr nInsPos, - SvdProgressInfo *pProgrInfo) +void ImpSdrGDIMetaFileImport::DoLoopActions(GDIMetaFile& rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport) { - pPage = rOL.GetPage(); - GDIMetaFile* pTmpMtf=NULL; - GDIMetaFile* pMtf = (GDIMetaFile*) &rMtf; - sal_uIntPtr nActionAnz=pMtf->GetActionCount(); - sal_Bool bError = sal_False; - - - // setup some global scale parameter - // fScaleX, fScaleY, aScaleX, aScaleY, bMov, bSize - fScaleX = fScaleY = 1.0; - Size aMtfSize( pMtf->GetPrefSize() ); - if ( aMtfSize.Width() & aMtfSize.Height() && ( aScaleRect.IsEmpty() == sal_False ) ) - { - aOfs = aScaleRect.TopLeft(); - if ( aMtfSize.Width() != ( aScaleRect.GetWidth() - 1 ) ) - fScaleX = (double)( aScaleRect.GetWidth() - 1 ) / (double)aMtfSize.Width(); - if ( aMtfSize.Height() != ( aScaleRect.GetHeight() - 1 ) ) - fScaleY = (double)( aScaleRect.GetHeight() - 1 ) / (double)aMtfSize.Height(); - } - - bMov = aOfs.X()!=0 || aOfs.Y()!=0; - bSize = sal_False; - - aScaleX = Fraction( 1, 1 ); - aScaleY = Fraction( 1, 1 ); - if ( aMtfSize.Width() != ( aScaleRect.GetWidth() - 1 ) ) - { - aScaleX = Fraction( aScaleRect.GetWidth() - 1, aMtfSize.Width() ); - bSize = sal_True; - } - if ( aMtfSize.Height() != ( aScaleRect.GetHeight() - 1 ) ) - { - aScaleY = Fraction( aScaleRect.GetHeight() - 1, aMtfSize.Height() ); - bSize = sal_True; - } - - if(65000 < nActionAnz) - { - nActionAnz = 65000; - bError = sal_True; - } - - if(pProgrInfo) - pProgrInfo->SetActionCount(nActionAnz); - - sal_uIntPtr nActionsToReport = 0; - - for( MetaAction* pAct = pMtf->FirstAction(); pAct; pAct = pMtf->NextAction() ) + for( MetaAction* pAct = rMtf.FirstAction(); pAct; pAct = rMtf.NextAction() ) { switch (pAct->GetType()) { @@ -199,22 +166,98 @@ sal_uIntPtr ImpSdrGDIMetaFileImport::DoI case META_PUSH_ACTION : DoAction((MetaPushAction &)*pAct); break; 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_COMMENT_ACTION : DoAction((MetaCommentAction &)*pAct, &rMtf); break; + + // missing actions added + case META_TEXTRECT_ACTION : DoAction((MetaTextRectAction&)*pAct); break; + case META_BMPSCALEPART_ACTION : DoAction((MetaBmpScalePartAction&)*pAct); break; + case META_BMPEXSCALEPART_ACTION : DoAction((MetaBmpExScalePartAction&)*pAct); break; + case META_MASK_ACTION : DoAction((MetaMaskAction&)*pAct); break; + case META_MASKSCALE_ACTION : DoAction((MetaMaskScaleAction&)*pAct); break; + case META_MASKSCALEPART_ACTION : DoAction((MetaMaskScalePartAction&)*pAct); break; + case META_GRADIENT_ACTION : DoAction((MetaGradientAction&)*pAct); break; + case META_WALLPAPER_ACTION : DoAction((MetaWallpaperAction&)*pAct); break; + case META_TRANSPARENT_ACTION : DoAction((MetaTransparentAction&)*pAct); break; + case META_EPS_ACTION : DoAction((MetaEPSAction&)*pAct); break; + case META_REFPOINT_ACTION : DoAction((MetaRefPointAction&)*pAct); break; + case META_TEXTLINECOLOR_ACTION : DoAction((MetaTextLineColorAction&)*pAct); break; + case META_TEXTLINE_ACTION : DoAction((MetaTextLineAction&)*pAct); break; + case META_FLOATTRANSPARENT_ACTION : DoAction((MetaFloatTransparentAction&)*pAct); break; + case META_GRADIENTEX_ACTION : DoAction((MetaGradientExAction&)*pAct); break; + case META_LAYOUTMODE_ACTION : DoAction((MetaLayoutModeAction&)*pAct); break; + case META_TEXTLANGUAGE_ACTION : DoAction((MetaTextLanguageAction&)*pAct); break; + case META_OVERLINECOLOR_ACTION : DoAction((MetaOverlineColorAction&)*pAct); break; } - if(pProgrInfo != NULL) + if(pProgrInfo && pActionsToReport) { - nActionsToReport++; - if(nActionsToReport >= 16) // Alle 16 Action updaten - { - if(!pProgrInfo->ReportActions(nActionsToReport)) - break; - nActionsToReport = 0; - } + (*pActionsToReport)++; + + if(*pActionsToReport >= 16) // Alle 16 Action updaten + { + if(!pProgrInfo->ReportActions(*pActionsToReport)) + break; + + *pActionsToReport = 0; + } } } +} - if(pProgrInfo != NULL) +sal_uInt32 ImpSdrGDIMetaFileImport::DoImport( + const GDIMetaFile& rMtf, + SdrObjList& rOL, + sal_uInt32 nInsPos, + SvdProgressInfo* pProgrInfo) +{ + // setup some global scale parameter + // mfScaleX, mfScaleY, maScaleX, maScaleY, mbMov, mbSize + mfScaleX = mfScaleY = 1.0; + const Size aMtfSize(rMtf.GetPrefSize()); + + if(aMtfSize.Width() & aMtfSize.Height() && (!maScaleRect.IsEmpty())) + { + maOfs = maScaleRect.TopLeft(); + + if(aMtfSize.Width() != (maScaleRect.GetWidth() - 1)) + { + mfScaleX = (double)( maScaleRect.GetWidth() - 1 ) / (double)aMtfSize.Width(); + } + + if(aMtfSize.Height() != (maScaleRect.GetHeight() - 1)) + { + mfScaleY = (double)( maScaleRect.GetHeight() - 1 ) / (double)aMtfSize.Height(); + } + } + + mbMov = maOfs.X()!=0 || maOfs.Y()!=0; + mbSize = false; + maScaleX = Fraction( 1, 1 ); + maScaleY = Fraction( 1, 1 ); + + if(aMtfSize.Width() != (maScaleRect.GetWidth() - 1)) + { + maScaleX = Fraction(maScaleRect.GetWidth() - 1, aMtfSize.Width()); + mbSize = true; + } + + if(aMtfSize.Height() != (maScaleRect.GetHeight() - 1)) + { + maScaleY = Fraction(maScaleRect.GetHeight() - 1, aMtfSize.Height()); + mbSize = true; + } + + if(pProgrInfo) + { + pProgrInfo->SetActionCount(rMtf.GetActionCount()); + } + + sal_uInt32 nActionsToReport(0); + + // execute + DoLoopActions(const_cast< GDIMetaFile& >(rMtf), pProgrInfo, &nActionsToReport); + + if(pProgrInfo) { pProgrInfo->ReportActions(nActionsToReport); nActionsToReport = 0; @@ -222,177 +265,205 @@ sal_uIntPtr ImpSdrGDIMetaFileImport::DoI // MapMode-Scaling vornehmen MapScaling(); - // Objekte in vorgegebenes Rechteck hineinskalieren - sal_uIntPtr nAnz=aTmpList.GetObjCount(); // Beim berechnen der Fortschrittsanzeige wird GetActionCount()*3 benutzt. - // Da in aTmpList allerdings weniger eintraege als GetActionCount() + // Da in maTmpList allerdings weniger eintraege als GetActionCount() // existieren koennen, muessen hier die zuviel vermuteten Actionen wieder // hinzugefuegt werden. - nActionsToReport = (pMtf->GetActionCount() - nAnz)*2; - + nActionsToReport = (rMtf.GetActionCount() - maTmpList.size()) * 2; // Alle noch nicht gemeldeten Rescales melden if(pProgrInfo) { pProgrInfo->ReportRescales(nActionsToReport); - pProgrInfo->SetInsertCount(nAnz); + pProgrInfo->SetInsertCount(maTmpList.size()); } - nActionsToReport = 0; - // alle in aTmpList zwischengespeicherten Objekte nun in rOL ab der Position nInsPos einfuegen - if (nInsPos>rOL.GetObjCount()) nInsPos=rOL.GetObjCount(); + nActionsToReport = 0; + + // alle in maTmpList zwischengespeicherten Objekte nun in rOL ab der Position nInsPos einfuegen + if(nInsPos > rOL.GetObjCount()) + { + nInsPos = rOL.GetObjCount(); + } + SdrInsertReason aReason(SDRREASON_VIEWCALL); - for (sal_uIntPtr i=0; i= 32) // Alle 32 Action updaten + + if(nActionsToReport >= 32) // Alle 32 Action updaten { pProgrInfo->ReportInserts(nActionsToReport); nActionsToReport = 0; } } } - if (pTmpMtf!=NULL) delete pTmpMtf; // ein letztesmal alle verbliebennen Inserts reporten - if(pProgrInfo != NULL) + if(pProgrInfo) { pProgrInfo->ReportInserts(nActionsToReport); - if(bError) - pProgrInfo->ReportError(); } - return aTmpList.GetObjCount(); + return maTmpList.size(); } -void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, FASTBOOL bForceTextAttr) +void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr) { - bNoLine = sal_False; bNoFill = sal_False; - FASTBOOL bLine=sal_True && !bForceTextAttr; - FASTBOOL bFill=pObj==NULL || ( pObj->IsClosedObj() && !bForceTextAttr ); - FASTBOOL bText=bForceTextAttr || (pObj!=NULL && pObj->GetOutlinerParaObject()!=NULL); + mbNoLine = false; + mbNoFill = false; + bool bLine(!bForceTextAttr); + bool bFill(!pObj || (pObj->IsClosedObj() && !bForceTextAttr)); + bool bText(bForceTextAttr || (pObj && pObj->GetOutlinerParaObject())); - if ( bLine ) + if(bLine) { - if ( nLineWidth ) - pLineAttr->Put( XLineWidthItem( nLineWidth ) ); + if(mnLineWidth) + { + mpLineAttr->Put(XLineWidthItem(mnLineWidth)); + } else - pLineAttr->Put( XLineWidthItem( 0 ) ); + { + mpLineAttr->Put(XLineWidthItem(0)); + } + + maOldLineColor = maVD.GetLineColor(); - aOldLineColor = aVD.GetLineColor(); - if( aVD.IsLineColor() ) + if(maVD.IsLineColor()) { - pLineAttr->Put(XLineStyleItem(XLINE_SOLID)); - pLineAttr->Put(XLineColorItem(String(), aVD.GetLineColor())); + mpLineAttr->Put(XLineStyleItem(XLINE_SOLID)); + mpLineAttr->Put(XLineColorItem(String(), maVD.GetLineColor())); } else - pLineAttr->Put(XLineStyleItem(XLINE_NONE)); + { + mpLineAttr->Put(XLineStyleItem(XLINE_NONE)); + } switch(maLineJoin) { default : // basegfx::B2DLINEJOIN_NONE - pLineAttr->Put(XLineJointItem(XLINEJOINT_NONE)); + mpLineAttr->Put(XLineJointItem(XLINEJOINT_NONE)); break; case basegfx::B2DLINEJOIN_MIDDLE: - pLineAttr->Put(XLineJointItem(XLINEJOINT_MIDDLE)); + mpLineAttr->Put(XLineJointItem(XLINEJOINT_MIDDLE)); break; case basegfx::B2DLINEJOIN_BEVEL: - pLineAttr->Put(XLineJointItem(XLINEJOINT_BEVEL)); + mpLineAttr->Put(XLineJointItem(XLINEJOINT_BEVEL)); break; case basegfx::B2DLINEJOIN_MITER: - pLineAttr->Put(XLineJointItem(XLINEJOINT_MITER)); + mpLineAttr->Put(XLineJointItem(XLINEJOINT_MITER)); break; case basegfx::B2DLINEJOIN_ROUND: - pLineAttr->Put(XLineJointItem(XLINEJOINT_ROUND)); + mpLineAttr->Put(XLineJointItem(XLINEJOINT_ROUND)); break; } // Add LineCap support - pLineAttr->Put(XLineCapItem(maLineCap)); + mpLineAttr->Put(XLineCapItem(maLineCap)); if(((maDash.GetDots() && maDash.GetDotLen()) || (maDash.GetDashes() && maDash.GetDashLen())) && maDash.GetDistance()) { - pLineAttr->Put(XLineDashItem(String(), maDash)); + mpLineAttr->Put(XLineDashItem(String(), maDash)); } else { - pLineAttr->Put(XLineDashItem(String(), XDash(XDASH_RECT))); + mpLineAttr->Put(XLineDashItem(String(), XDash(XDASH_RECT))); } } else - bNoLine = sal_True; + { + mbNoLine = true; + } - if ( bFill ) + if(bFill) { - if( aVD.IsFillColor() ) + if(maVD.IsFillColor()) { - pFillAttr->Put(XFillStyleItem(XFILL_SOLID)); - pFillAttr->Put(XFillColorItem(String(), aVD.GetFillColor())); + mpFillAttr->Put(XFillStyleItem(XFILL_SOLID)); + mpFillAttr->Put(XFillColorItem(String(), maVD.GetFillColor())); } else - pFillAttr->Put(XFillStyleItem(XFILL_NONE)); + { + mpFillAttr->Put(XFillStyleItem(XFILL_NONE)); + } } else - bNoFill = sal_True; + { + mbNoFill = true; + } - if ( bText && bFntDirty ) + if(bText && mbFntDirty) { - Font aFnt(aVD.GetFont()); - pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), - aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) ); - pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), - aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK ) ); - pTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), - aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL ) ); - pTextAttr->Put(SvxPostureItem(aFnt.GetItalic(), EE_CHAR_ITALIC)); - pTextAttr->Put(SvxWeightItem(aFnt.GetWeight(), EE_CHAR_WEIGHT)); - sal_uInt32 nHeight = FRound(aFnt.GetSize().Height() * fScaleY); - pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) ); - pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) ); - pTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) ); - pTextAttr->Put(SvxCharScaleWidthItem(100, EE_CHAR_FONTWIDTH)); - pTextAttr->Put(SvxUnderlineItem(aFnt.GetUnderline(), EE_CHAR_UNDERLINE)); - pTextAttr->Put(SvxOverlineItem(aFnt.GetOverline(), EE_CHAR_OVERLINE)); - pTextAttr->Put(SvxCrossedOutItem(aFnt.GetStrikeout(), EE_CHAR_STRIKEOUT)); - pTextAttr->Put(SvxShadowedItem(aFnt.IsShadow(), EE_CHAR_SHADOW)); + Font aFnt(maVD.GetFont()); + const sal_uInt32 nHeight(FRound(aFnt.GetSize().Height() * mfScaleY)); + + mpTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO ) ); + mpTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK ) ); + mpTextAttr->Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), aFnt.GetStyleName(), aFnt.GetPitch(), aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL ) ); + mpTextAttr->Put(SvxPostureItem(aFnt.GetItalic(), EE_CHAR_ITALIC)); + mpTextAttr->Put(SvxWeightItem(aFnt.GetWeight(), EE_CHAR_WEIGHT)); + mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) ); + mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) ); + mpTextAttr->Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) ); + mpTextAttr->Put(SvxCharScaleWidthItem(100, EE_CHAR_FONTWIDTH)); + mpTextAttr->Put(SvxUnderlineItem(aFnt.GetUnderline(), EE_CHAR_UNDERLINE)); + mpTextAttr->Put(SvxOverlineItem(aFnt.GetOverline(), EE_CHAR_OVERLINE)); + mpTextAttr->Put(SvxCrossedOutItem(aFnt.GetStrikeout(), EE_CHAR_STRIKEOUT)); + mpTextAttr->Put(SvxShadowedItem(aFnt.IsShadow(), EE_CHAR_SHADOW)); // #i118485# Setting this item leads to problems (written #i118498# for this) - // pTextAttr->Put(SvxAutoKernItem(aFnt.IsKerning(), EE_CHAR_KERNING)); + // mpTextAttr->Put(SvxAutoKernItem(aFnt.IsKerning(), EE_CHAR_KERNING)); - pTextAttr->Put(SvxWordLineModeItem(aFnt.IsWordLineMode(), EE_CHAR_WLM)); - pTextAttr->Put(SvxContourItem(aFnt.IsOutline(), EE_CHAR_OUTLINE)); - pTextAttr->Put(SvxColorItem(aVD.GetTextColor(), EE_CHAR_COLOR)); + mpTextAttr->Put(SvxWordLineModeItem(aFnt.IsWordLineMode(), EE_CHAR_WLM)); + mpTextAttr->Put(SvxContourItem(aFnt.IsOutline(), EE_CHAR_OUTLINE)); + mpTextAttr->Put(SvxColorItem(maVD.GetTextColor(), EE_CHAR_COLOR)); //... svxfont textitem svditext - bFntDirty=sal_False; + mbFntDirty = false; } - if (pObj!=NULL) + + if(pObj) { - pObj->SetLayer(nLayer); - if (bLine) pObj->SetMergedItemSet(*pLineAttr); - if (bFill) pObj->SetMergedItemSet(*pFillAttr); - if (bText) + pObj->SetLayer(mnLayer); + + if(bLine) + { + pObj->SetMergedItemSet(*mpLineAttr); + } + + if(bFill) + { + pObj->SetMergedItemSet(*mpFillAttr); + } + + if(bText) { - pObj->SetMergedItemSet(*pTextAttr); - pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_LEFT ) ); + pObj->SetMergedItemSet(*mpTextAttr); + pObj->SetMergedItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); } } } -void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, sal_Bool bScale) +void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, bool bScale) { - if ( bScale && !aScaleRect.IsEmpty() ) + if(bScale && !maScaleRect.IsEmpty()) { - if ( bSize ) - pObj->NbcResize( Point(), aScaleX, aScaleY ); - if ( bMov ) - pObj->NbcMove( Size( aOfs.X(), aOfs.Y() ) ); + if(mbSize) + { + pObj->NbcResize(Point(), maScaleX, maScaleY); + } + + if(mbMov) + { + pObj->NbcMove(Size(maOfs.X(), maOfs.Y())); + } } if(isClip()) @@ -500,17 +571,19 @@ void ImpSdrGDIMetaFileImport::InsertObj( } else { - aTmpList.InsertObject( pObj ); - if ( HAS_BASE( SdrPathObj, pObj ) ) + maTmpList.push_back(pObj); + + if(dynamic_cast< SdrPathObj* >(pObj)) { - FASTBOOL bClosed=pObj->IsClosedObj(); - bLastObjWasPolyWithoutLine=bNoLine && bClosed; - bLastObjWasLine=!bClosed; + const bool bClosed(pObj->IsClosedObj()); + + mbLastObjWasPolyWithoutLine = mbNoLine && bClosed; + mbLastObjWasLine = !bClosed; } else { - bLastObjWasPolyWithoutLine = sal_False; - bLastObjWasLine = sal_False; + mbLastObjWasPolyWithoutLine = false; + mbLastObjWasLine = false; } } } @@ -535,7 +608,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M if(!aStart.equal(aEnd)) { basegfx::B2DPolygon aLine; - const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); aLine.append(aStart); aLine.append(aEnd); @@ -545,7 +618,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M const sal_Int32 nNewLineWidth(rLineInfo.GetWidth()); bool bCreateLineObject(true); - if(bLastObjWasLine && (nNewLineWidth == nLineWidth) && CheckLastLineMerge(aLine)) + if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aLine)) { bCreateLineObject = false; } @@ -553,7 +626,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M if(bCreateLineObject) { SdrPathObj* pPath = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aLine)); - nLineWidth = nNewLineWidth; + mnLineWidth = nNewLineWidth; maLineJoin = rLineInfo.GetLineJoin(); maLineCap = rLineInfo.GetLineCap(); maDash = XDash(XDASH_RECT, @@ -561,7 +634,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M rLineInfo.GetDashCount(), rLineInfo.GetDashLen(), rLineInfo.GetDistance()); SetAttributes(pPath); - nLineWidth = 0; + mnLineWidth = 0; maLineJoin = basegfx::B2DLINEJOIN_NONE; maDash = XDash(); InsertObj(pPath, false); @@ -582,7 +655,7 @@ void ImpSdrGDIMetaFileImport::DoAction(M SetAttributes(pRect); long nRad=(rAct.GetHorzRound()+rAct.GetVertRound())/2; if (nRad!=0) { - SfxItemSet aSet(*pLineAttr->GetPool(),SDRATTR_ECKENRADIUS,SDRATTR_ECKENRADIUS); + SfxItemSet aSet(*mpLineAttr->GetPool(), SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS, 0, 0); aSet.Put(SdrEckenradiusItem(nRad)); pRect->SetMergedItemSet(aSet); } @@ -639,10 +712,10 @@ bool ImpSdrGDIMetaFileImport::CheckLastL } // #i73407# reformulation to use new B2DPolygon classes - if(bLastObjWasLine && (aOldLineColor == aVD.GetLineColor()) && rSrcPoly.count()) + if(mbLastObjWasLine && (maOldLineColor == maVD.GetLineColor()) && rSrcPoly.count()) { - SdrObject* pTmpObj = aTmpList.GetObj(aTmpList.GetObjCount() - 1); - SdrPathObj* pLastPoly = PTR_CAST(SdrPathObj, pTmpObj); + SdrObject* pTmpObj = maTmpList.size() ? maTmpList[maTmpList.size() - 1] : 0; + SdrPathObj* pLastPoly = dynamic_cast< SdrPathObj* >(pTmpObj); if(pLastPoly) { @@ -705,10 +778,10 @@ bool ImpSdrGDIMetaFileImport::CheckLastL bool ImpSdrGDIMetaFileImport::CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon & rPolyPolygon) { // #i73407# reformulation to use new B2DPolygon classes - if(bLastObjWasPolyWithoutLine) + if(mbLastObjWasPolyWithoutLine) { - SdrObject* pTmpObj = aTmpList.GetObj(aTmpList.GetObjCount() - 1); - SdrPathObj* pLastPoly = PTR_CAST(SdrPathObj, pTmpObj); + SdrObject* pTmpObj = maTmpList.size() ? maTmpList[maTmpList.size() - 1] : 0; + SdrPathObj* pLastPoly = dynamic_cast< SdrPathObj* >(pTmpObj); if(pLastPoly) { @@ -716,9 +789,9 @@ bool ImpSdrGDIMetaFileImport::CheckLastP { SetAttributes(NULL); - if(!bNoLine && bNoFill) + if(!mbNoLine && mbNoFill) { - pLastPoly->SetMergedItemSet(*pLineAttr); + pLastPoly->SetMergedItemSet(*mpLineAttr); return true; } @@ -731,9 +804,9 @@ bool ImpSdrGDIMetaFileImport::CheckLastP void ImpSdrGDIMetaFileImport::checkClip() { - if(aVD.IsClipRegion()) + if(maVD.IsClipRegion()) { - Region aRegion(aVD.GetClipRegion()); + Region aRegion(maVD.GetClipRegion()); maClip = aRegion.ConvertToB2DPolyPolygon(); @@ -741,10 +814,10 @@ void ImpSdrGDIMetaFileImport::checkClip( { const basegfx::B2DHomMatrix aTransform( basegfx::tools::createScaleTranslateB2DHomMatrix( - fScaleX, - fScaleY, - aOfs.X(), - aOfs.Y())); + mfScaleX, + mfScaleY, + maOfs.X(), + maOfs.Y())); maClip.transform(aTransform); } @@ -763,7 +836,7 @@ void ImpSdrGDIMetaFileImport::DoAction( if(aSource.count()) { - const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); aSource.transform(aTransform); } @@ -771,11 +844,11 @@ void ImpSdrGDIMetaFileImport::DoAction( const sal_Int32 nNewLineWidth(rLineInfo.GetWidth()); bool bCreateLineObject(true); - if(bLastObjWasLine && (nNewLineWidth == nLineWidth) && CheckLastLineMerge(aSource)) + if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aSource)) { bCreateLineObject = false; } - else if(bLastObjWasPolyWithoutLine && CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource))) + else if(mbLastObjWasPolyWithoutLine && CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource))) { bCreateLineObject = false; } @@ -785,7 +858,7 @@ void ImpSdrGDIMetaFileImport::DoAction( SdrPathObj* pPath = new SdrPathObj( aSource.isClosed() ? OBJ_POLY : OBJ_PLIN, basegfx::B2DPolyPolygon(aSource)); - nLineWidth = nNewLineWidth; + mnLineWidth = nNewLineWidth; maLineJoin = rLineInfo.GetLineJoin(); maLineCap = rLineInfo.GetLineCap(); maDash = XDash(XDASH_RECT, @@ -793,7 +866,7 @@ void ImpSdrGDIMetaFileImport::DoAction( rLineInfo.GetDashCount(), rLineInfo.GetDashLen(), rLineInfo.GetDistance()); SetAttributes(pPath); - nLineWidth = 0; + mnLineWidth = 0; maLineJoin = basegfx::B2DLINEJOIN_NONE; maDash = XDash(); InsertObj(pPath, false); @@ -807,10 +880,10 @@ void ImpSdrGDIMetaFileImport::DoAction( if(aSource.count()) { - const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); aSource.transform(aTransform); - if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource))) + if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource))) { // #i73407# make sure polygon is closed, it's a filled primitive aSource.setClosed(true); @@ -828,10 +901,10 @@ void ImpSdrGDIMetaFileImport::DoAction(M if(aSource.count()) { - const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); aSource.transform(aTransform); - if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) + if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) { // #i73407# make sure polygon is closed, it's a filled primitive aSource.setClosed(true); @@ -848,20 +921,20 @@ void ImpSdrGDIMetaFileImport::ImportText { // calc text box size, add 5% to make it fit safely - FontMetric aFontMetric( aVD.GetFontMetric() ); - Font aFnt( aVD.GetFont() ); + FontMetric aFontMetric( maVD.GetFontMetric() ); + Font aFnt( maVD.GetFont() ); FontAlign eAlg( aFnt.GetAlign() ); - sal_Int32 nTextWidth = (sal_Int32)( aVD.GetTextWidth( rStr ) * fScaleX ); - sal_Int32 nTextHeight = (sal_Int32)( aVD.GetTextHeight() * fScaleY ); + sal_Int32 nTextWidth = (sal_Int32)( maVD.GetTextWidth( rStr ) * mfScaleX ); + sal_Int32 nTextHeight = (sal_Int32)( maVD.GetTextHeight() * mfScaleY ); //sal_Int32 nDxWidth = 0; //sal_Int32 nLen = rStr.Len(); - Point aPos( FRound(rPos.X() * fScaleX + aOfs.X()), FRound(rPos.Y() * fScaleY + aOfs.Y()) ); + Point aPos( FRound(rPos.X() * mfScaleX + maOfs.X()), FRound(rPos.Y() * mfScaleY + maOfs.Y()) ); Size aSize( nTextWidth, nTextHeight ); if ( eAlg == ALIGN_BASELINE ) - aPos.Y() -= FRound(aFontMetric.GetAscent() * fScaleY); + aPos.Y() -= FRound(aFontMetric.GetAscent() * mfScaleY); else if ( eAlg == ALIGN_BOTTOM ) aPos.Y() -= nTextHeight; @@ -871,7 +944,7 @@ void ImpSdrGDIMetaFileImport::ImportText if ( aFnt.GetWidth() || ( rAct.GetType() == META_STRETCHTEXT_ACTION ) ) { pText->ClearMergedItem( SDRATTR_TEXT_AUTOGROWWIDTH ); - pText->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) ); + pText->SetMergedItem( SdrTextAutoGrowHeightItem( false ) ); // don't let the margins eat the space needed for the text pText->SetMergedItem ( SdrTextUpperDistItem (0)); pText->SetMergedItem ( SdrTextLowerDistItem (0)); @@ -880,17 +953,17 @@ void ImpSdrGDIMetaFileImport::ImportText pText->SetMergedItem( SdrTextFitToSizeTypeItem( SDRTEXTFIT_ALLLINES ) ); } else - pText->SetMergedItem( SdrTextAutoGrowWidthItem( sal_True ) ); + pText->SetMergedItem( SdrTextAutoGrowWidthItem( true ) ); - pText->SetModel( pModel ); - pText->SetLayer( nLayer ); + pText->SetModel(mpModel); + pText->SetLayer(mnLayer); pText->NbcSetText( rStr ); - SetAttributes( pText, sal_True ); + SetAttributes( pText, true ); pText->SetSnapRect( aTextRect ); if (!aFnt.IsTransparent()) { - SfxItemSet aAttr(*pFillAttr->GetPool(),XATTR_FILL_FIRST,XATTR_FILL_LAST); + SfxItemSet aAttr(*mpFillAttr->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0); aAttr.Put(XFillStyleItem(XFILL_SOLID)); aAttr.Put(XFillColorItem(String(), aFnt.GetFillColor())); pText->SetMergedItemSet(aAttr); @@ -904,7 +977,7 @@ void ImpSdrGDIMetaFileImport::ImportText double nCos=cos(a); pText->NbcRotate(aPos,nWink,nSin,nCos); } - InsertObj( pText, sal_False ); + InsertObj( pText, false ); } void ImpSdrGDIMetaFileImport::DoAction(MetaTextAction& rAct) @@ -972,16 +1045,14 @@ void ImpSdrGDIMetaFileImport::DoAction( if(aSource.count()) { - const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, aOfs.X(), aOfs.Y())); + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); aSource.transform(aTransform); - if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) + if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) { const Hatch& rHatch = rAct.GetHatch(); SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); - SfxItemSet aHatchAttr(pModel->GetItemPool(), - XATTR_FILLSTYLE, XATTR_FILLSTYLE, - XATTR_FILLHATCH, XATTR_FILLHATCH, 0, 0 ); + SfxItemSet aHatchAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLHATCH, XATTR_FILLHATCH, 0, 0); XHatchStyle eStyle; switch(rHatch.GetStyle()) @@ -1007,7 +1078,7 @@ void ImpSdrGDIMetaFileImport::DoAction( SetAttributes(pPath); aHatchAttr.Put(XFillStyleItem(XFILL_HATCH)); - aHatchAttr.Put(XFillHatchItem(&pModel->GetItemPool(), XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle()))); + aHatchAttr.Put(XFillHatchItem(&mpModel->GetItemPool(), XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle()))); pPath->SetMergedItemSet(aHatchAttr); InsertObj(pPath, false); @@ -1019,33 +1090,36 @@ void ImpSdrGDIMetaFileImport::DoAction( void ImpSdrGDIMetaFileImport::DoAction(MetaLineColorAction& rAct) { - rAct.Execute(&aVD); + rAct.Execute(&maVD); } void ImpSdrGDIMetaFileImport::DoAction(MetaMapModeAction& rAct) { MapScaling(); - rAct.Execute(&aVD); - bLastObjWasPolyWithoutLine=sal_False; - bLastObjWasLine=sal_False; + rAct.Execute(&maVD); + mbLastObjWasPolyWithoutLine = false; + mbLastObjWasLine = false; } void ImpSdrGDIMetaFileImport::MapScaling() { - sal_uInt32 i, nAnz = aTmpList.GetObjCount(); - const MapMode& rMap = aVD.GetMapMode(); + const sal_uInt32 nAnz(maTmpList.size()); + sal_uInt32 i(0); + const MapMode& rMap = maVD.GetMapMode(); Point aMapOrg( rMap.GetOrigin() ); - sal_Bool bMov2 = aMapOrg.X() != 0 || aMapOrg.Y() != 0; - if ( bMov2 ) + bool bMov2(aMapOrg.X() != 0 || aMapOrg.Y() != 0); + + if(bMov2) { - for ( i = nMapScalingOfs; i < nAnz; i++ ) + for(i = mnMapScalingOfs; i < nAnz; i++) { - SdrObject* pObj = aTmpList.GetObj(i); - if ( bMov2 ) - pObj->NbcMove( Size( aMapOrg.X(), aMapOrg.Y() ) ); + SdrObject* pObj = maTmpList[i]; + + pObj->NbcMove(Size(aMapOrg.X(), aMapOrg.Y())); } } - nMapScalingOfs = nAnz; + + mnMapScalingOfs = nAnz; } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1065,13 +1139,11 @@ void ImpSdrGDIMetaFileImport::DoAction( if(aSource.count()) { - if(!bLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) + if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) { const Gradient& rGrad = pAct->GetGradient(); SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); - SfxItemSet aGradAttr(pModel->GetItemPool(), - XATTR_FILLSTYLE, XATTR_FILLSTYLE, - XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0 ); + SfxItemSet aGradAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0); XGradient aXGradient; aXGradient.SetGradientStyle((XGradientStyle)rGrad.GetStyle()); @@ -1085,14 +1157,14 @@ void ImpSdrGDIMetaFileImport::DoAction( aXGradient.SetEndIntens(rGrad.GetEndIntensity()); aXGradient.SetSteps(rGrad.GetSteps()); - if(aVD.IsLineColor()) + if(maVD.IsLineColor()) { // switch line off; when there was one there will be a // META_POLYLINE_ACTION following creating another object - const Color aLineColor(aVD.GetLineColor()); - aVD.SetLineColor(); + const Color aLineColor(maVD.GetLineColor()); + maVD.SetLineColor(); SetAttributes(pPath); - aVD.SetLineColor(aLineColor); + maVD.SetLineColor(aLineColor); } else { @@ -1100,7 +1172,7 @@ void ImpSdrGDIMetaFileImport::DoAction( } aGradAttr.Put(XFillStyleItem(XFILL_GRADIENT)); - aGradAttr.Put(XFillGradientItem(&pModel->GetItemPool(), aXGradient)); + aGradAttr.Put(XFillGradientItem(&mpModel->GetItemPool(), aXGradient)); pPath->SetMergedItemSet(aGradAttr); InsertObj(pPath); @@ -1125,4 +1197,366 @@ void ImpSdrGDIMetaFileImport::DoAction( } //////////////////////////////////////////////////////////////////////////////////////////////////// + +void ImpSdrGDIMetaFileImport::DoAction(MetaTextRectAction& rAct) +{ + GDIMetaFile aTemp; + + maVD.AddTextRectActions(rAct.GetRect(), rAct.GetText(), rAct.GetStyle(), aTemp); + DoLoopActions(aTemp, 0, 0); +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScalePartAction& rAct) +{ + Rectangle aRect(rAct.GetDestPoint(), rAct.GetDestSize()); + Bitmap aBitmap(rAct.GetBitmap()); + + aRect.Right()++; + aRect.Bottom()++; + aBitmap.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize())); + + SdrGrafObj* pGraf = new SdrGrafObj(aBitmap, aRect); + + InsertObj(pGraf); +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExScalePartAction& rAct) +{ + Rectangle aRect(rAct.GetDestPoint(),rAct.GetDestSize()); + BitmapEx aBitmapEx(rAct.GetBitmapEx()); + + aRect.Right()++; + aRect.Bottom()++; + aBitmapEx.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize())); + + SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect); + + InsertObj(pGraf); +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaMaskAction& rAct) +{ + Rectangle aRect(rAct.GetPoint(), rAct.GetBitmap().GetSizePixel()); + BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor()); + + aRect.Right()++; + aRect.Bottom()++; + + SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect); + + InsertObj(pGraf); +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaMaskScaleAction& rAct) +{ + Rectangle aRect(rAct.GetPoint(), rAct.GetSize()); + BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor()); + + aRect.Right()++; + aRect.Bottom()++; + + SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect); + + InsertObj(pGraf); +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaMaskScalePartAction& rAct) +{ + Rectangle aRect(rAct.GetDestPoint(), rAct.GetDestSize()); + BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor()); + + aRect.Right()++; + aRect.Bottom()++; + aBitmapEx.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize())); + + SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect); + + InsertObj(pGraf); +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction& rAct) +{ + basegfx::B2DRange aRange(rAct.GetRect().Left(), rAct.GetRect().Top(), rAct.GetRect().Right(), rAct.GetRect().Bottom()); + + if(!aRange.isEmpty()) + { + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); + aRange.transform(aTransform); + const Gradient& rGradient = rAct.GetGradient(); + SdrRectObj* pRect = new SdrRectObj( + Rectangle( + floor(aRange.getMinX()), + floor(aRange.getMinY()), + ceil(aRange.getMaxX()), + ceil(aRange.getMaxY()))); + SfxItemSet aGradientAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0); + XGradientStyle aXGradientStyle(XGRAD_LINEAR); + + switch(rGradient.GetStyle()) + { + case GRADIENT_LINEAR: aXGradientStyle = XGRAD_LINEAR; break; + case GRADIENT_AXIAL: aXGradientStyle = XGRAD_AXIAL; break; + case GRADIENT_RADIAL: aXGradientStyle = XGRAD_RADIAL; break; + case GRADIENT_ELLIPTICAL: aXGradientStyle = XGRAD_ELLIPTICAL; break; + case GRADIENT_SQUARE: aXGradientStyle = XGRAD_SQUARE; break; + case GRADIENT_RECT: aXGradientStyle = XGRAD_RECT; break; + } + + const XFillGradientItem aXFillGradientItem( + &mpModel->GetItemPool(), + XGradient( + rGradient.GetStartColor(), + rGradient.GetEndColor(), + aXGradientStyle, + rGradient.GetAngle(), + rGradient.GetOfsX(), + rGradient.GetOfsY(), + rGradient.GetBorder(), + rGradient.GetStartIntensity(), + rGradient.GetEndIntensity(), + rGradient.GetSteps())); + + SetAttributes(pRect); + aGradientAttr.Put(XFillStyleItem(XFILL_HATCH)); + aGradientAttr.Put(aXFillGradientItem); + pRect->SetMergedItemSet(aGradientAttr); + + InsertObj(pRect, false); + } +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaWallpaperAction& rAct) +{ + OSL_ENSURE(false, "Tried to construct SdrObject from MetaWallpaperAction: not supported (!)"); +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaTransparentAction& rAct) +{ + basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon()); + + if(aSource.count()) + { + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); + aSource.transform(aTransform); + aSource.setClosed(true); + + SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); + SetAttributes(pPath); + pPath->SetMergedItem(XFillTransparenceItem(rAct.GetTransparence())); + InsertObj(pPath, false); + } +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaEPSAction& rAct) +{ + OSL_ENSURE(false, "Tried to construct SdrObject from MetaEPSAction: not supported (!)"); +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaTextLineAction& rAct) +{ + OSL_ENSURE(false, "Tried to construct SdrObject from MetaTextLineAction: not supported (!)"); +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaGradientExAction& rAct) +{ + basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon()); + + if(aSource.count()) + { + const basegfx::B2DHomMatrix aTransform(basegfx::tools::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y())); + aSource.transform(aTransform); + + if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) + { + const Gradient& rGradient = rAct.GetGradient(); + SdrPathObj* pPath = new SdrPathObj(OBJ_POLY, aSource); + SfxItemSet aGradientAttr(mpModel->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0); + XGradientStyle aXGradientStyle(XGRAD_LINEAR); + + switch(rGradient.GetStyle()) + { + case GRADIENT_LINEAR: aXGradientStyle = XGRAD_LINEAR; break; + case GRADIENT_AXIAL: aXGradientStyle = XGRAD_AXIAL; break; + case GRADIENT_RADIAL: aXGradientStyle = XGRAD_RADIAL; break; + case GRADIENT_ELLIPTICAL: aXGradientStyle = XGRAD_ELLIPTICAL; break; + case GRADIENT_SQUARE: aXGradientStyle = XGRAD_SQUARE; break; + case GRADIENT_RECT: aXGradientStyle = XGRAD_RECT; break; + } + + const XFillGradientItem aXFillGradientItem( + &mpModel->GetItemPool(), + XGradient( + rGradient.GetStartColor(), + rGradient.GetEndColor(), + aXGradientStyle, + rGradient.GetAngle(), + rGradient.GetOfsX(), + rGradient.GetOfsY(), + rGradient.GetBorder(), + rGradient.GetStartIntensity(), + rGradient.GetEndIntensity(), + rGradient.GetSteps())); + + SetAttributes(pPath); + aGradientAttr.Put(XFillStyleItem(XFILL_HATCH)); + aGradientAttr.Put(aXFillGradientItem); + pPath->SetMergedItemSet(aGradientAttr); + + InsertObj(pPath, false); + } + } +} + +void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction& rAct) +{ + const GDIMetaFile& rMtf = rAct.GetGDIMetaFile(); + + if(rMtf.GetActionCount()) + { + Rectangle aRect(rAct.GetPoint(),rAct.GetSize()); + aRect.Right()++; aRect.Bottom()++; + + // get metafile content as bitmap + const basegfx::B2DRange aTargetRange( + aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); + const drawinglayer::primitive2d::Primitive2DReference aMtf( + new drawinglayer::primitive2d::MetafilePrimitive2D( + basegfx::tools::createScaleTranslateB2DHomMatrix( + aTargetRange.getRange(), + aTargetRange.getMinimum()), + rMtf)); + BitmapEx aBitmapEx(convertPrimitive2DSequenceToBitmapEx( + drawinglayer::primitive2d::Primitive2DSequence(&aMtf, 1), + aTargetRange)); + + // handle colors + const Gradient& rGradient = rAct.GetGradient(); + basegfx::BColor aStart(rGradient.GetStartColor().getBColor()); + basegfx::BColor aEnd(rGradient.GetEndColor().getBColor()); + + if(100 != rGradient.GetStartIntensity()) + { + aStart *= (double)rGradient.GetStartIntensity() / 100.0; + } + + if(100 != rGradient.GetEndIntensity()) + { + aEnd *= (double)rGradient.GetEndIntensity() / 100.0; + } + + const bool bEqualColors(aStart == aEnd); + const bool bNoSteps(1 == rGradient.GetSteps()); + bool bCreateObject(true); + bool bHasNewMask(false); + AlphaMask aNewMask; + + if(bEqualColors || bNoSteps) + { + // single transparence + const basegfx::BColor aMedium(basegfx::average(aStart, aEnd)); + const double fTransparence(aMedium.luminance()); + + if(basegfx::fTools::lessOrEqual(fTransparence, 0.0)) + { + // no transparence needed, all done + } + else if(basegfx::fTools::moreOrEqual(fTransparence, 1.0)) + { + // all transparent, no object + bCreateObject = false; + } + else + { + // 0.0 < transparence < 1.0, apply + sal_uInt8 aAlpha(basegfx::fround(fTransparence * 255.0)); + + aNewMask = AlphaMask(aBitmapEx.GetBitmap().GetSizePixel(), &aAlpha); + bHasNewMask = true; + } + } + else + { + // gradient transparence + VirtualDevice aVDev; + + aVDev.SetOutputSizePixel(aBitmapEx.GetBitmap().GetSizePixel()); + aVDev.DrawGradient(Rectangle(Point(0, 0), aVDev.GetOutputSizePixel()), rGradient); + + aNewMask = AlphaMask(aVDev.GetBitmap(Point(0, 0), aVDev.GetOutputSizePixel())); + bHasNewMask = true; + } + + if(bCreateObject) + { + if(bHasNewMask) + { + if(!aBitmapEx.IsAlpha() && !aBitmapEx.IsTransparent()) + { + // no transparence yet, apply new one + aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask); + } + else + { + // mix existing and new alpha mask + AlphaMask aOldMask; + + if(aBitmapEx.IsAlpha()) + { + aOldMask = aBitmapEx.GetAlpha(); + } + else if(TRANSPARENT_BITMAP == aBitmapEx.GetTransparentType()) + { + aOldMask = aBitmapEx.GetMask(); + } + else if(TRANSPARENT_COLOR == aBitmapEx.GetTransparentType()) + { + aOldMask = aBitmapEx.GetBitmap().CreateMask(aBitmapEx.GetTransparentColor()); + } + + BitmapReadAccess* pOld = aOldMask.AcquireReadAccess(); + BitmapWriteAccess* pNew = aNewMask.AcquireWriteAccess(); + + if(pOld && pNew) + { + if(pOld->Width() == pNew->Width() && pOld->Height() == pNew->Height()) + { + for(sal_uInt32 y(0); y < pNew->Height(); y++) + { + for(sal_uInt32 x(0); x < pNew->Width(); x++) + { + const BitmapColor aColOld(pOld->GetPixel(y, x)); + const BitmapColor aColNew(pNew->GetPixel(y, x)); + const sal_uInt16 aCombine(sal_uInt16(aColOld.GetIndex()) + sal_uInt16(aColNew.GetIndex())); + + pNew->SetPixel(y, x, BitmapColor(aCombine > 255 ? 255 : sal_uInt8(aCombine))); + } + } + } + else + { + OSL_ENSURE(false, "Alpha masks have different sizes (!)"); + } + + aOldMask.ReleaseAccess(pOld); + aNewMask.ReleaseAccess(pNew); + } + else + { + OSL_ENSURE(false, "Got no access to alpha bitmaps (!)"); + } + + // apply combined bitmap as mask + aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask); + } + } + + // create and add object + SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect); + + InsertObj(pGraf); + } + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////// // eof Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.hxx?rev=1337213&r1=1337212&r2=1337213&view=diff ============================================================================== --- incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.hxx (original) +++ incubator/ooo/trunk/main/svx/source/svdraw/svdfmtf.hxx Fri May 11 15:39:29 2012 @@ -40,66 +40,44 @@ class SdrObject; class SvdProgressInfo; //************************************************************ -// Hilfsklasse SdrObjRefList -//************************************************************ - -class SdrObjRefList -{ - Container aList; -public: - - SdrObjRefList() - : aList(1024,64,64) - {} - - void Clear() { aList.Clear(); } - sal_uLong GetObjCount() const { return aList.Count(); } - SdrObject* GetObj(sal_uLong nNum) const { return (SdrObject*)aList.GetObject(nNum); } - SdrObject* operator[](sal_uLong nNum) const { return (SdrObject*)aList.GetObject(nNum); } - void InsertObject(SdrObject* pObj, sal_uLong nPos=CONTAINER_APPEND) { aList.Insert(pObj,nPos); } - void RemoveObject(sal_uLong nPos) { aList.Remove(nPos); } -}; - -//************************************************************ // Hilfsklasse ImpSdrGDIMetaFileImport //************************************************************ class ImpSdrGDIMetaFileImport { protected: - SdrObjRefList aTmpList; - VirtualDevice aVD; - Rectangle aScaleRect; - sal_uLong nMapScalingOfs; // ab hier nocht nicht mit MapScaling bearbeitet - SfxItemSet* pLineAttr; - SfxItemSet* pFillAttr; - SfxItemSet* pTextAttr; - SdrPage* pPage; - SdrModel* pModel; - SdrLayerID nLayer; - Color aOldLineColor; - sal_Int32 nLineWidth; + ::std::vector< SdrObject* > maTmpList; + VirtualDevice maVD; + Rectangle maScaleRect; + sal_uLong mnMapScalingOfs; // ab hier nocht nicht mit MapScaling bearbeitet + SfxItemSet* mpLineAttr; + SfxItemSet* mpFillAttr; + SfxItemSet* mpTextAttr; + SdrModel* mpModel; + SdrLayerID mnLayer; + Color maOldLineColor; + sal_Int32 mnLineWidth; basegfx::B2DLineJoin maLineJoin; com::sun::star::drawing::LineCap maLineCap; XDash maDash; - sal_Bool bMov; - sal_Bool bSize; - Point aOfs; - double fScaleX; - double fScaleY; - Fraction aScaleX; - Fraction aScaleY; + bool mbMov; + bool mbSize; + Point maOfs; + double mfScaleX; + double mfScaleY; + Fraction maScaleX; + Fraction maScaleY; - sal_Bool bFntDirty; + bool mbFntDirty; // fuer Optimierung von (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> aus 2 mach ein - sal_Bool bLastObjWasPolyWithoutLine; - sal_Bool bNoLine; - sal_Bool bNoFill; + bool mbLastObjWasPolyWithoutLine; + bool mbNoLine; + bool mbNoFill; // fuer Optimierung mehrerer Linien zu einer Polyline - sal_Bool bLastObjWasLine; + bool mbLastObjWasLine; // clipregion basegfx::B2DPolyPolygon maClip; @@ -132,37 +110,63 @@ protected: void DoAction(MetaHatchAction & rAct); void DoAction(MetaLineColorAction & rAct); void DoAction(MetaMapModeAction & rAct); - void DoAction(MetaFillColorAction & rAct) { rAct.Execute(&aVD); } - void DoAction(MetaTextColorAction & rAct) { rAct.Execute(&aVD); } - void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(&aVD); } - void DoAction(MetaFontAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; } - void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; } - void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(&aVD); checkClip(); } - void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(&aVD); } - void DoAction(MetaPushAction & rAct) { rAct.Execute(&aVD); checkClip(); } - void DoAction(MetaPopAction & rAct) { rAct.Execute(&aVD); bFntDirty=sal_True; checkClip(); } - void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(&aVD); checkClip(); } - void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); checkClip(); } - void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); checkClip(); } + void DoAction(MetaFillColorAction & rAct) { rAct.Execute(&maVD); } + void DoAction(MetaTextColorAction & rAct) { rAct.Execute(&maVD); } + void DoAction(MetaTextFillColorAction & rAct) { rAct.Execute(&maVD); } + void DoAction(MetaFontAction & rAct) { rAct.Execute(&maVD); mbFntDirty = true; } + void DoAction(MetaTextAlignAction & rAct) { rAct.Execute(&maVD); mbFntDirty = true; } + void DoAction(MetaClipRegionAction & rAct) { rAct.Execute(&maVD); checkClip(); } + void DoAction(MetaRasterOpAction & rAct) { rAct.Execute(&maVD); } + void DoAction(MetaPushAction & rAct) { rAct.Execute(&maVD); checkClip(); } + void DoAction(MetaPopAction & rAct) { rAct.Execute(&maVD); mbFntDirty = true; checkClip(); } + void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(&maVD); checkClip(); } + void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&maVD); checkClip(); } + void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&maVD); checkClip(); } void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf); - void ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct ); - void SetAttributes(SdrObject* pObj, FASTBOOL bForceTextAttr=sal_False); - void InsertObj( SdrObject* pObj, sal_Bool bScale = sal_True ); + // missing actions added + void DoAction(MetaTextRectAction& rAct); + void DoAction(MetaBmpScalePartAction& rAct); + void DoAction(MetaBmpExScalePartAction& rAct); + void DoAction(MetaMaskAction& rAct); + void DoAction(MetaMaskScaleAction& rAct); + void DoAction(MetaMaskScalePartAction& rAct); + void DoAction(MetaGradientAction& rAct); + void DoAction(MetaWallpaperAction& rAct); + void DoAction(MetaTransparentAction& rAct); + void DoAction(MetaEPSAction& rAct); + void DoAction(MetaRefPointAction& rAct) { rAct.Execute(&maVD); } + void DoAction(MetaTextLineColorAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; } + void DoAction(MetaTextLineAction& rAct); + void DoAction(MetaFloatTransparentAction& rAct); + void DoAction(MetaGradientExAction& rAct); + void DoAction(MetaLayoutModeAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; } + void DoAction(MetaTextLanguageAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; } + void DoAction(MetaOverlineColorAction& rAct) { rAct.Execute(&maVD); mbFntDirty = true; } + + void ImportText(const Point& rPos, const XubString& rStr, const MetaAction& rAct); + void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false); + void InsertObj(SdrObject* pObj, bool bScale = true); void MapScaling(); // #i73407# reformulation to use new B2DPolygon classes bool CheckLastLineMerge(const basegfx::B2DPolygon& rSrcPoly); bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon); + + void DoLoopActions(GDIMetaFile& rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport); public: - ImpSdrGDIMetaFileImport(SdrModel& rModel); + ImpSdrGDIMetaFileImport( + SdrModel& rModel, + SdrLayerID nLay, + const Rectangle& rRect); ~ImpSdrGDIMetaFileImport(); - sal_uLong DoImport(const GDIMetaFile& rMtf, SdrObjList& rDestList, sal_uLong nInsPos=CONTAINER_APPEND, SvdProgressInfo *pProgrInfo = NULL); - void SetLayer(SdrLayerID nLay) { nLayer=nLay; } - SdrLayerID GetLayer() const { return nLayer; } - void SetScaleRect(const Rectangle& rRect) { aScaleRect=rRect; } - const Rectangle& GetScaleRect() const { return aScaleRect; } + + sal_uInt32 DoImport( + const GDIMetaFile& rMtf, + SdrObjList& rDestList, + sal_uInt32 nInsPos = CONTAINER_APPEND, + SvdProgressInfo* pProgrInfo = 0); }; //////////////////////////////////////////////////////////////////////////////////////////////////// Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx?rev=1337213&r1=1337212&r2=1337213&view=diff ============================================================================== --- incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx (original) +++ incubator/ooo/trunk/main/svx/source/svdraw/svdograf.cxx Fri May 11 15:39:29 2012 @@ -1145,10 +1145,7 @@ SdrObject* SdrGrafObj::DoConvertToPolyOb case GRAPHIC_GDIMETAFILE: { // NUR die aus dem MetaFile erzeugbaren Objekte in eine Gruppe packen und zurueckliefern - ImpSdrGDIMetaFileImport aFilter(*GetModel()); - aFilter.SetScaleRect(aRect); - aFilter.SetLayer(GetLayer()); - + ImpSdrGDIMetaFileImport aFilter(*GetModel(), GetLayer(), aRect); SdrObjGroup* pGrp = new SdrObjGroup(); sal_uInt32 nInsAnz = aFilter.DoImport(aMtf, *pGrp->GetSubList(), 0); Modified: incubator/ooo/trunk/main/vcl/inc/vcl/svgdata.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/inc/vcl/svgdata.hxx?rev=1337213&r1=1337212&r2=1337213&view=diff ============================================================================== --- incubator/ooo/trunk/main/vcl/inc/vcl/svgdata.hxx (original) +++ incubator/ooo/trunk/main/vcl/inc/vcl/svgdata.hxx Fri May 11 15:39:29 2012 @@ -36,6 +36,14 @@ typedef ::com::sun::star::uno::Reference typedef ::com::sun::star::uno::Sequence< Primitive2DReference > Primitive2DSequence; ////////////////////////////////////////////////////////////////////////////// +// helper to convert any Primitive2DSequence to a good quality BitmapEx, +// using default parameters and graphic::XPrimitive2DRenderer + +BitmapEx VCL_DLLPUBLIC convertPrimitive2DSequenceToBitmapEx( + const Primitive2DSequence& rSequence, + const basegfx::B2DRange& rTargetRange); + +////////////////////////////////////////////////////////////////////////////// class VCL_DLLPUBLIC SvgData : private boost::noncopyable { Modified: incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx?rev=1337213&r1=1337212&r2=1337213&view=diff ============================================================================== --- incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx (original) +++ incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx Fri May 11 15:39:29 2012 @@ -3816,9 +3816,6 @@ MetaAction* MetaFloatTransparentAction:: void MetaFloatTransparentAction::Move( long nHorzMove, long nVertMove ) { maPoint.Move( nHorzMove, nVertMove ); - - // also neeed to move the content metafile - maMtf.Move( nHorzMove, nVertMove ); } // ------------------------------------------------------------------------ Modified: incubator/ooo/trunk/main/vcl/source/gdi/svgdata.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/svgdata.cxx?rev=1337213&r1=1337212&r2=1337213&view=diff ============================================================================== --- incubator/ooo/trunk/main/vcl/source/gdi/svgdata.cxx (original) +++ incubator/ooo/trunk/main/vcl/source/gdi/svgdata.cxx Fri May 11 15:39:29 2012 @@ -39,11 +39,13 @@ using namespace ::com::sun::star; ////////////////////////////////////////////////////////////////////////////// -void SvgData::ensureReplacement() +BitmapEx VCL_DLLPUBLIC convertPrimitive2DSequenceToBitmapEx( + const Primitive2DSequence& rSequence, + const basegfx::B2DRange& rTargetRange) { - ensureSequenceAndRange(); + BitmapEx aRetval; - if(maReplacement.IsEmpty() && maSequence.hasElements()) + if(rSequence.hasElements()) { // create replacement graphic from maSequence // create XPrimitive2DRenderer @@ -57,20 +59,19 @@ void SvgData::ensureReplacement() if(xPrimitive2DRenderer.is()) { uno::Sequence< beans::PropertyValue > aViewParameters; - const basegfx::B2DRange& rRange(getRange()); geometry::RealRectangle2D aRealRect; - aRealRect.X1 = rRange.getMinX(); - aRealRect.Y1 = rRange.getMinY(); - aRealRect.X2 = rRange.getMaxX(); - aRealRect.Y2 = rRange.getMaxY(); + aRealRect.X1 = rTargetRange.getMinX(); + aRealRect.Y1 = rTargetRange.getMinY(); + aRealRect.X2 = rTargetRange.getMaxX(); + aRealRect.Y2 = rTargetRange.getMaxY(); // get system DPI const Size aDPI(Application::GetDefaultDevice()->LogicToPixel(Size(1, 1), MAP_INCH)); const uno::Reference< rendering::XBitmap > xBitmap( xPrimitive2DRenderer->rasterize( - maSequence, + rSequence, aViewParameters, aDPI.getWidth(), aDPI.getHeight(), @@ -83,7 +84,7 @@ void SvgData::ensureReplacement() if(xIntBmp.is()) { - maReplacement = vcl::unotools::bitmapExFromXBitmap(xIntBmp); + aRetval = vcl::unotools::bitmapExFromXBitmap(xIntBmp); } } } @@ -93,6 +94,20 @@ void SvgData::ensureReplacement() OSL_ENSURE(sal_False, "Got no graphic::XPrimitive2DRenderer (!)" ); } } + + return aRetval; +} + +////////////////////////////////////////////////////////////////////////////// + +void SvgData::ensureReplacement() +{ + ensureSequenceAndRange(); + + if(maReplacement.IsEmpty() && maSequence.hasElements()) + { + maReplacement = convertPrimitive2DSequenceToBitmapEx(maSequence, getRange()); + } } //////////////////////////////////////////////////////////////////////////////