summaryrefslogtreecommitdiff
path: root/svx/source/unodraw
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-08-19 22:30:03 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-08-19 22:30:03 +0000
commit8f829ba1d9cc91ea219a0a6a83b363d4ec748342 (patch)
treed1764b676b796657ddb56d0ddc6e771564517bf9 /svx/source/unodraw
parentd8bbbfae4487e979b2b3c5cfd1b48902ef37f231 (diff)
INTEGRATION: CWS aw033 (1.23.12); FILE MERGED
2008/07/11 11:36:16 aw 1.23.12.25: RESYNC: (1.42-1.43); FILE MERGED 2008/07/10 13:00:59 aw 1.23.12.24: #i39532# XOutputDevice removed, PrepareDelete removed 2008/07/01 15:56:19 aw 1.23.12.23: #i39532# UnoGraphicExporter problems with MPBGO which has no size when not set. Anyways, the size for MPBGO has to be taken from the Page model 2008/06/03 13:41:13 aw 1.23.12.22: corrections 2008/05/27 14:50:05 aw 1.23.12.21: #i39532# changes DEV300 m12 resync corrections 2008/05/14 14:07:06 aw 1.23.12.20: RESYNC: (1.41-1.42); FILE MERGED 2008/05/14 09:55:16 aw 1.23.12.19: #i39532# aw033 progresses from git 2008/04/16 05:30:45 aw 1.23.12.18: diverse optimisations and fixes for primitives. Support for LazyInvalidation. 2008/03/18 07:15:25 aw 1.23.12.17: #i39532# changes after resync 2008/03/14 13:52:36 cl 1.23.12.16: RESYNC: (1.39-1.41); FILE MERGED 2008/01/29 10:27:34 aw 1.23.12.15: updated refresh for ActionChanged(), diverse removals 2008/01/22 12:29:34 aw 1.23.12.14: adaptions and 1st stripping 2007/08/09 19:13:09 aw 1.23.12.13: RESYNC: (1.37-1.39); FILE MERGED 2007/07/06 13:43:09 aw 1.23.12.12: #i39532# moved from Primitive2DReference to Primitive2DSequence where possible to avoid extra-group primitive creations and deeper hierarchies as necessary 2007/06/27 18:37:55 aw 1.23.12.11: RESYNC: (1.36-1.37); FILE MERGED 2007/05/23 21:18:33 aw 1.23.12.10: RESYNC: (1.35-1.36); FILE MERGED 2007/03/20 14:23:06 aw 1.23.12.9: RESYNC: (1.34-1.35); FILE MERGED 2006/12/12 14:51:36 aw 1.23.12.8: RESYNC: (1.33-1.34); FILE MERGED 2006/11/28 19:49:50 aw 1.23.12.7: RESYNC: (1.28-1.33); FILE MERGED 2006/10/19 11:04:31 aw 1.23.12.6: #i39532# primitive 2006/09/26 19:47:22 aw 1.23.12.5: RESYNC: (1.25-1.28); FILE MERGED 2006/08/09 17:18:34 aw 1.23.12.4: #i39532# 2006/06/02 14:17:54 aw 1.23.12.3: #i39532# adaptions to new primitives, error corrections 2006/05/12 16:15:20 aw 1.23.12.2: RESYNC: (1.23-1.25); FILE MERGED 2006/05/12 12:46:31 aw 1.23.12.1: code changes for primitive support
Diffstat (limited to 'svx/source/unodraw')
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx193
1 files changed, 59 insertions, 134 deletions
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index fa5d9a712d..2dcd3c1a89 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: UnoGraphicExporter.cxx,v $
- * $Revision: 1.43 $
+ * $Revision: 1.44 $
*
* This file is part of OpenOffice.org.
*
@@ -68,7 +68,6 @@
#include <svx/numitem.hxx>
#include <svx/svdpagv.hxx>
#include <svx/svdograf.hxx>
-#include <svx/xoutx.hxx>
#include "xoutbmp.hxx"
#include "impgrf.hxx"
#include "unoapi.hxx"
@@ -106,57 +105,6 @@ using namespace ::com::sun::star::task;
#include <svx/sdr/contact/viewcontact.hxx>
//////////////////////////////////////////////////////////////////////////////
-// #114389# use new redirector instead of pPaintProc
-
-class ImplLocalRedirector : public ::sdr::contact::ViewObjectContactRedirector
-{
-public:
- ImplLocalRedirector() : ViewObjectContactRedirector() {}
- virtual ~ImplLocalRedirector();
-
- // all default implementations just call the same methods at the original. To do something
- // different, overload the method and at least do what the method does.
- virtual void PaintObject(::sdr::contact::ViewObjectContact& rOriginal, ::sdr::contact::DisplayInfo& rDisplayInfo);
-};
-
-ImplLocalRedirector::~ImplLocalRedirector()
-{
-}
-
-void ImplLocalRedirector::PaintObject(::sdr::contact::ViewObjectContact& rOriginal, ::sdr::contact::DisplayInfo& rDisplayInfo)
-{
- SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
- sal_Bool bDoPaint(sal_False);
-
- if(pObject)
- {
- if(pObject->IsEmptyPresObj())
- {
- // do not paint empty PresObjs, but the background obejct.
- // SInce the new mechanism does not paint the background object
- // at all, it is not necessary to test for it here and the whole
- // method may be simplified soon. For testing for BackgroundObj
- // You may use pObject->IsMasterPageBackgroundObject().
- }
- else
- {
- // paint non-empty PresObjs
- bDoPaint = sal_True;
- }
- }
- else
- {
- // no SdrObject, may be SdrPage. Do paint.
- bDoPaint = sal_True;
- }
-
- if(bDoPaint)
- {
- rOriginal.PaintObject(rDisplayInfo);
- }
-}
-
-//////////////////////////////////////////////////////////////////////////////
namespace svx
{
@@ -270,37 +218,6 @@ namespace svx
return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.GraphicExporter" ) );
}
- GDIMetaFile& RemoveClipRegionActions( GDIMetaFile& o_rMtf, const GDIMetaFile& i_rMtf )
- {
- const ULONG nActionCount( i_rMtf.GetActionCount() );
-
- o_rMtf.Clear();
- o_rMtf.SetPrefSize( i_rMtf.GetPrefSize() );
- o_rMtf.SetPrefMapMode( i_rMtf.GetPrefMapMode() );
-
- // examine actions and remove ClipRegion-Actions.
- for ( ULONG nAction = 0; nAction < nActionCount; nAction++ )
- {
- MetaAction* pCopyAction = ( (GDIMetaFile&) i_rMtf ).CopyAction( nAction );
-
- if( pCopyAction )
- {
- switch( pCopyAction->GetType() )
- {
- case( META_CLIPREGION_ACTION ) :
- pCopyAction->Delete();
- break;
-
- default:
- o_rMtf.AddAction( pCopyAction );
- break;
- }
- }
- }
-
- return o_rMtf;
- }
-
/** creates a bitmap that is optionaly transparent from a metafile
*/
BitmapEx GetBitmapFromMetaFile( const GDIMetaFile& rMtf, BOOL bTransparent, const Size* pSize )
@@ -352,7 +269,9 @@ public:
ImplExportCheckVisisbilityRedirector( SdrPage* pCurrentPage );
virtual ~ImplExportCheckVisisbilityRedirector();
- virtual void PaintObject(::sdr::contact::ViewObjectContact& rOriginal, ::sdr::contact::DisplayInfo& rDisplayInfo);
+ virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo);
private:
SdrPage* mpCurrentPage;
@@ -367,7 +286,9 @@ ImplExportCheckVisisbilityRedirector::~ImplExportCheckVisisbilityRedirector()
{
}
-void ImplExportCheckVisisbilityRedirector::PaintObject(::sdr::contact::ViewObjectContact& rOriginal, ::sdr::contact::DisplayInfo& rDisplayInfo)
+drawinglayer::primitive2d::Primitive2DSequence ImplExportCheckVisisbilityRedirector::createRedirectedPrimitive2DSequence(
+ const sdr::contact::ViewObjectContact& rOriginal,
+ const sdr::contact::DisplayInfo& rDisplayInfo)
{
SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
@@ -379,13 +300,15 @@ void ImplExportCheckVisisbilityRedirector::PaintObject(::sdr::contact::ViewObjec
if( (pPage == 0) || pPage->checkVisibility(rOriginal, rDisplayInfo, false) )
{
- rOriginal.PaintObject(rDisplayInfo);
+ return ::sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
}
+
+ return drawinglayer::primitive2d::Primitive2DSequence();
}
else
{
// not an object, maybe a page
- rOriginal.PaintObject(rDisplayInfo);
+ return ::sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo);
}
}
@@ -503,7 +426,7 @@ VirtualDevice* GraphicExporter::CreatePageVDev( SdrPage* pPage, ULONG nWidthPixe
ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage );
- pView->CompleteRedraw(pVDev, aRegion, 0, &aRedirector);
+ pView->CompleteRedraw(pVDev, aRegion, &aRedirector);
delete pView;
return pVDev;
@@ -819,16 +742,10 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
aVDev.SetRelativeMapMode( aVMap );
aVDev.IntersectClipRegion( aClipRect );
- sal_uInt16 nPaintMode(0);
-
- // #110496# Enable verbose metafile comments
- if( rSettings.mbVerboseComments )
- nPaintMode|=SDRPAINTMODE_VERBOSE_MTF;
-
// Use new StandardCheckVisisbilityRedirector
ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage );
- pView->CompleteRedraw(&aVDev, Region(Rectangle(Point(), aNewSize)), 0, &aRedirector);
+ pView->CompleteRedraw(&aVDev, Region(Rectangle(Point(), aNewSize)), &aRedirector);
aVDev.Pop();
@@ -837,8 +754,15 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
aMtf.SetPrefMapMode( aMap );
aMtf.SetPrefSize( aNewSize );
- GDIMetaFile aMtf2;
- aGraphic = Graphic( RemoveClipRegionActions( aMtf2, aMtf ) );
+ // AW: Here the current version was filtering out the META_CLIPREGION_ACTIONs
+ // from the metafile. I asked some other developers why this was done, but no
+ // one knew a direct reason. Since it's in for long time, it may be an old
+ // piece of code. MetaFiles save and load ClipRegions with polygons with preserving
+ // the polygons, so a resolution-indepent roundtrip is supported. Removed this
+ // code since it destroys some MetaFiles where ClipRegions are used. Anyways,
+ // just filtering them out is a hack, at least the encapsulated content would need
+ // to be clipped geometrically.
+ aGraphic = Graphic(aMtf);
}
if( rSettings.mbTranslucent )
@@ -959,22 +883,32 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
{
// create a metafile for all shapes
VirtualDevice aOut;
- XOutputDevice aXOut( &aOut );
// calculate bound rect for all shapes
Rectangle aBound;
- std::vector< SdrObject* >::iterator aIter = aShapes.begin();
- const std::vector< SdrObject* >::iterator aEnd = aShapes.end();
-
- while( aIter != aEnd )
+ if(rSettings.mbExportOnlyBackground)
{
- SdrObject* pObj = (*aIter++);
- Rectangle aR1(pObj->GetCurrentBoundRect());
- if (aBound.IsEmpty())
- aBound=aR1;
- else
- aBound.Union(aR1);
+ // shape is MPBGO and if it's not yet set, it's size will
+ // be empty when using GetCurrentBoundRect(). Since anyways
+ // the page size is used by MPBGO and MPBGO is EOLd, get
+ // the wanted size from the page model directly
+ aBound = Rectangle(Point(0,0), pPage->GetSize());
+ }
+ else
+ {
+ std::vector< SdrObject* >::iterator aIter = aShapes.begin();
+ const std::vector< SdrObject* >::iterator aEnd = aShapes.end();
+
+ while( aIter != aEnd )
+ {
+ SdrObject* pObj = (*aIter++);
+ Rectangle aR1(pObj->GetCurrentBoundRect());
+ if (aBound.IsEmpty())
+ aBound=aR1;
+ else
+ aBound.Union(aR1);
+ }
}
aOut.EnableOutput( FALSE );
@@ -990,36 +924,27 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
aOutMap.SetOrigin( Point( -aBound.TopLeft().X(), -aBound.TopLeft().Y() ) );
aOut.SetRelativeMapMode( aOutMap );
- SdrPaintInfoRec aInfoRec;
- aInfoRec.nPaintMode|=SDRPAINTMODE_ANILIKEPRN;
-
- // #110496# Enable verbose metafile comments
- if( rSettings.mbVerboseComments )
- aInfoRec.nPaintMode|=SDRPAINTMODE_VERBOSE_MTF;
-
sdr::contact::DisplayInfo aDisplayInfo;
- aDisplayInfo.SetProcessedPage( mpCurrentPage );
- aDisplayInfo.SetMasterPagePainting( pPage->IsMasterPage() );
- if( mpCurrentPage && pPage->IsMasterPage() )
- aDisplayInfo.SetProcessLayers( mpCurrentPage->TRG_GetMasterPageVisibleLayers() );
- aIter = aShapes.begin();
- while( aIter != aEnd )
+ if(mpCurrentPage)
{
- SdrObject* pObj = (*aIter++);
-
- sdr::contact::ViewContactOfSdrObj aViewContact( *pObj );
- sdr::contact::ObjectContactOfPagePainter aObjectContact( pPage, false );
- sdr::contact::ViewObjectContact aOriginal( aObjectContact, aViewContact);
-
- // #i70852# why was this pObj->SdrObject::GetLayer()? This would not use the correct GetLayer()
- // for FmFormObj. Changed.
- if( aDisplayInfo.GetProcessLayers().IsSet(pObj->GetLayer()) )
- if( (pObj->GetPage() == 0) || pObj->GetPage()->checkVisibility(aOriginal, aDisplayInfo, false) )
- pObj->SingleObjectPainter(aXOut,aInfoRec); // #110094#-17
+ if(mpCurrentPage->TRG_HasMasterPage() && pPage->IsMasterPage())
+ {
+ // MasterPage is processed as another page's SubContent
+ aDisplayInfo.SetProcessLayers(mpCurrentPage->TRG_GetMasterPageVisibleLayers());
+ aDisplayInfo.SetSubContentActive(true);
+ }
+ }
+ if(aShapes.size())
+ {
+ // more effective way to paint a vector of SdrObjects. Hand over the processed page
+ // to have it in the
+ sdr::contact::ObjectContactOfObjListPainter aMultiObjectPainter(aOut, aShapes, mpCurrentPage);
+ ImplExportCheckVisisbilityRedirector aCheckVisibilityRedirector(mpCurrentPage);
+ aMultiObjectPainter.SetViewObjectContactRedirector(&aCheckVisibilityRedirector);
- aOriginal.PrepareDelete();
+ aMultiObjectPainter.ProcessDisplay(aDisplayInfo);
}
aMtf.Stop();