You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2013/01/11 17:16:48 UTC
svn commit: r1432130 - in /openoffice/trunk/main/svx: inc/svx/svdxcgv.hxx
source/svdraw/svdxcgv.cxx
Author: alg
Date: Fri Jan 11 16:16:47 2013
New Revision: 1432130
URL: http://svn.apache.org/viewvc?rev=1432130&view=rev
Log:
#121609# Made conversion to bitmap more direct
Modified:
openoffice/trunk/main/svx/inc/svx/svdxcgv.hxx
openoffice/trunk/main/svx/source/svdraw/svdxcgv.cxx
Modified: openoffice/trunk/main/svx/inc/svx/svdxcgv.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/inc/svx/svdxcgv.hxx?rev=1432130&r1=1432129&r2=1432130&view=diff
==============================================================================
--- openoffice/trunk/main/svx/inc/svx/svdxcgv.hxx (original)
+++ openoffice/trunk/main/svx/inc/svx/svdxcgv.hxx Fri Jan 11 16:16:47 2013
@@ -65,6 +65,7 @@ protected:
public:
// Alle markierten Objekte auf dem angegebenen OutputDevice ausgeben.
+ ::std::vector< SdrObject* > GetMarkedObjects() const;
virtual void DrawMarkedObj(OutputDevice& rOut) const;
// Z.B. fuer's Clipboard, Drag&Drop, ...
Modified: openoffice/trunk/main/svx/source/svdraw/svdxcgv.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/svdraw/svdxcgv.cxx?rev=1432130&r1=1432129&r2=1432130&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/svdraw/svdxcgv.cxx (original)
+++ openoffice/trunk/main/svx/source/svdraw/svdxcgv.cxx Fri Jan 11 16:16:47 2013
@@ -54,6 +54,12 @@
#include <svl/style.hxx>
#include <fmobj.hxx>
#include <vcl/svgdata.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <svx/sdr/contact/viewcontact.hxx>
+#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
+#include <svx/sdr/contact/displayinfo.hxx>
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -553,14 +559,42 @@ BitmapEx SdrExchangeView::GetMarkedObjBi
if( !aBmp )
{
- const GDIMetaFile aGDIMetaFile(GetMarkedObjMetaFile(bNoVDevIfOneBmpMarked));
- const Rectangle aBound(GetMarkedObjBoundRect());
-
- aBmp = convertMetafileToBitmapEx(
- aGDIMetaFile,
- basegfx::B2DRange(
- aBound.Left(), aBound.Top(),
- aBound.Right(), aBound.Bottom()));
+ // choose conversion directly using primitives to bitmap to avoid
+ // rendering errors with tiled bitmap fills (these will be tiled in a
+ // in-between metafile, but tend to show 'gaps' since the target is *no*
+ // bitmap rendering)
+ ::std::vector< SdrObject* > aSdrObjects(GetMarkedObjects());
+ const sal_uInt32 nCount(aSdrObjects.size());
+
+ if(nCount)
+ {
+ // collect sub-primitives as group objects, thus no expensive append
+ // to existing sequence is needed
+ drawinglayer::primitive2d::Primitive2DSequence xPrimitives(nCount);
+
+ for(sal_uInt32 a(0); a < nCount; a++)
+ {
+ xPrimitives[a] = new drawinglayer::primitive2d::GroupPrimitive2D(
+ aSdrObjects[a]->GetViewContact().getViewIndependentPrimitive2DSequence());
+ }
+
+ // get logic range
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
+ const basegfx::B2DRange aRange(
+ drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(
+ xPrimitives,
+ aViewInformation2D));
+
+ if(!aRange.isEmpty())
+ {
+ // if we have geometry and it has a range, convert to BitmapEx using
+ // common tooling
+ aBmp = convertPrimitive2DSequenceToBitmapEx(
+ xPrimitives,
+ aRange,
+ 500000);
+ }
+ }
}
}
@@ -716,9 +750,10 @@ Graphic SdrExchangeView::GetObjGraphic(
// -----------------------------------------------------------------------------
-void SdrExchangeView::DrawMarkedObj(OutputDevice& rOut) const
+::std::vector< SdrObject* > SdrExchangeView::GetMarkedObjects() const
{
SortMarkedObjects();
+ ::std::vector< SdrObject* > aRetval;
::std::vector< ::std::vector< SdrMark* > > aObjVectors( 2 );
::std::vector< SdrMark* >& rObjVector1 = aObjVectors[ 0 ];
@@ -745,9 +780,27 @@ void SdrExchangeView::DrawMarkedObj(Outp
for( sal_uInt32 i = 0; i < rObjVector.size(); i++ )
{
SdrMark* pMark = rObjVector[ i ];
- pMark->GetMarkedSdrObj()->SingleObjectPainter( rOut ); // #110094#-17
+ aRetval.push_back(pMark->GetMarkedSdrObj());
}
}
+
+ return aRetval;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdrExchangeView::DrawMarkedObj(OutputDevice& rOut) const
+{
+ ::std::vector< SdrObject* > aSdrObjects(GetMarkedObjects());
+
+ if(aSdrObjects.size())
+ {
+ sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aSdrObjects, aSdrObjects[0]->GetPage());
+ sdr::contact::DisplayInfo aDisplayInfo;
+
+ // do processing
+ aPainter.ProcessDisplay(aDisplayInfo);
+ }
}
// -----------------------------------------------------------------------------
@@ -763,66 +816,45 @@ SdrModel* SdrExchangeView::GetMarkedObjM
if( !mxSelectionController.is() || !mxSelectionController->GetMarkedObjModel( pNeuPag ) )
{
- ::std::vector< ::std::vector< SdrMark* > > aObjVectors( 2 );
- ::std::vector< SdrMark* >& rObjVector1 = aObjVectors[ 0 ];
- ::std::vector< SdrMark* >& rObjVector2 = aObjVectors[ 1 ];
- const SdrLayerAdmin& rLayerAdmin = pMod->GetLayerAdmin();
- const sal_uInt32 nControlLayerId = rLayerAdmin.GetLayerID( rLayerAdmin.GetControlLayerName(), sal_False );
- sal_uInt32 n, nCount, nCloneErrCnt = 0;
-
- for( n = 0, nCount = GetMarkedObjectCount(); n < nCount; n++ )
- {
- SdrMark* pMark = GetSdrMarkByIndex( n );
-
- // paint objects on control layer on top of all otherobjects
- if( nControlLayerId == pMark->GetMarkedSdrObj()->GetLayer() )
- rObjVector2.push_back( pMark );
- else
- rObjVector1.push_back( pMark );
- }
+ ::std::vector< SdrObject* > aSdrObjects(GetMarkedObjects());
// #i13033#
// New mechanism to re-create the connections of cloned connectors
CloneList aCloneList;
+ sal_uInt32 nCloneErrCnt(0);
- for( n = 0, nCount = aObjVectors.size(); n < nCount; n++ )
+ for( sal_uInt32 i(0); i < aSdrObjects.size(); i++ )
{
- ::std::vector< SdrMark* >& rObjVector = aObjVectors[ n ];
+ const SdrObject* pObj = aSdrObjects[i];
+ SdrObject* pNeuObj;
- for( sal_uInt32 i = 0; i < rObjVector.size(); i++ )
+ if( pObj->ISA( SdrPageObj ) )
{
- const SdrMark* pMark = rObjVector[ i ];
- const SdrObject* pObj = pMark->GetMarkedSdrObj();
- SdrObject* pNeuObj;
-
- if( pObj->ISA( SdrPageObj ) )
- {
- // convert SdrPageObj's to a graphic representation, because
- // virtual connection to referenced page gets lost in new model
- pNeuObj = new SdrGrafObj( GetObjGraphic( pMod, pObj ), pObj->GetLogicRect() );
- pNeuObj->SetPage( pNeuPag );
- pNeuObj->SetModel( pNeuMod );
- }
- else
- {
- // #116235#
- // pNeuObj = pObj->Clone( pNeuPag, pNeuMod );
- pNeuObj = pObj->Clone();
- pNeuObj->SetPage( pNeuPag );
- pNeuObj->SetModel( pNeuMod );
- }
+ // convert SdrPageObj's to a graphic representation, because
+ // virtual connection to referenced page gets lost in new model
+ pNeuObj = new SdrGrafObj( GetObjGraphic( pMod, pObj ), pObj->GetLogicRect() );
+ pNeuObj->SetPage( pNeuPag );
+ pNeuObj->SetModel( pNeuMod );
+ }
+ else
+ {
+ // #116235#
+ // pNeuObj = pObj->Clone( pNeuPag, pNeuMod );
+ pNeuObj = pObj->Clone();
+ pNeuObj->SetPage( pNeuPag );
+ pNeuObj->SetModel( pNeuMod );
+ }
- if( pNeuObj )
- {
- SdrInsertReason aReason(SDRREASON_VIEWCALL);
- pNeuPag->InsertObject(pNeuObj,CONTAINER_APPEND,&aReason);
+ if( pNeuObj )
+ {
+ SdrInsertReason aReason(SDRREASON_VIEWCALL);
+ pNeuPag->InsertObject(pNeuObj,CONTAINER_APPEND,&aReason);
- // #i13033#
- aCloneList.AddPair(pObj, pNeuObj);
- }
- else
- nCloneErrCnt++;
+ // #i13033#
+ aCloneList.AddPair(pObj, pNeuObj);
}
+ else
+ nCloneErrCnt++;
}
// #i13033#