summaryrefslogtreecommitdiff
path: root/svx/source/sdr
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-08-19 22:05:15 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-08-19 22:05:15 +0000
commit685e674be7dce1a08069e145e6847fc15fa5bcc8 (patch)
tree2ce78f95302c43f2bee6bd6d30e378f998e30af0 /svx/source/sdr
parent61c5e99f14efa52a8bfa7ef7912f3be46ae6f5cd (diff)
INTEGRATION: CWS aw033 (1.5.14); FILE MERGED
2008/06/24 15:42:24 aw 1.5.14.20: #i39532# corrections 2008/06/03 13:41:11 aw 1.5.14.19: corrections 2008/05/27 14:49:57 aw 1.5.14.18: #i39532# changes DEV300 m12 resync corrections 2008/05/14 14:00:45 aw 1.5.14.17: RESYNC: (1.10-1.11); FILE MERGED 2008/04/16 05:30:44 aw 1.5.14.16: diverse optimisations and fixes for primitives. Support for LazyInvalidation. 2008/02/07 14:13:23 aw 1.5.14.15: stable version from working GIT repository for unxlngi6 build 2008/01/29 10:27:31 aw 1.5.14.14: updated refresh for ActionChanged(), diverse removals 2008/01/22 12:29:29 aw 1.5.14.13: adaptions and 1st stripping 2007/12/20 14:51:01 aw 1.5.14.12: #i39532# Added simple test-canvas-renderer 2007/08/09 18:45:55 aw 1.5.14.11: RESYNC: (1.8-1.10); FILE MERGED 2007/07/27 09:17:27 aw 1.5.14.10: #i39532# 2007/07/09 13:25:25 aw 1.5.14.9: #i39532# adaptions to splitted VCLProcessors for meta and pixel targets 2007/07/06 13:43:06 aw 1.5.14.8: #i39532# moved from Primitive2DReference to Primitive2DSequence where possible to avoid extra-group primitive creations and deeper hierarchies as necessary 2006/11/28 19:24:18 aw 1.5.14.7: RESYNC: (1.7-1.8); FILE MERGED 2006/11/28 11:17:54 aw 1.5.14.6: #i39532# 2006/10/19 10:59:12 aw 1.5.14.5: #i39532# primitive 2006/09/26 19:20:11 aw 1.5.14.4: RESYNC: (1.5-1.7); FILE MERGED 2006/08/09 17:12:22 aw 1.5.14.3: #i39532# 2006/06/02 14:17:47 aw 1.5.14.2: #i39532# adaptions to new primitives, error corrections 2006/05/12 12:46:22 aw 1.5.14.1: code changes for primitive support
Diffstat (limited to 'svx/source/sdr')
-rw-r--r--svx/source/sdr/contact/objectcontactofobjlistpainter.cxx204
1 files changed, 94 insertions, 110 deletions
diff --git a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
index 7df77fed97c0..af13b7b42307 100644
--- a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
+++ b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: objectcontactofobjlistpainter.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
* This file is part of OpenOffice.org.
*
@@ -37,6 +37,10 @@
#include <svx/svdobj.hxx>
#include <svx/sdr/contact/viewcontact.hxx>
#include <svx/svdmodel.hxx>
+#include <drawinglayer/processor2d/vclprocessor2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svx/sdr/contact/objectcontacttools.hxx>
+#include <unoapi.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -44,9 +48,7 @@ namespace sdr
{
namespace contact
{
- ObjectContactPainter::ObjectContactPainter(sal_Bool bBufferingAllowed)
- : mbIsInitialized(sal_False),
- mbBufferingAllowed(bBufferingAllowed)
+ ObjectContactPainter::ObjectContactPainter()
{
}
@@ -54,97 +56,6 @@ namespace sdr
ObjectContactPainter::~ObjectContactPainter()
{
}
-
- // Update Draw Hierarchy data
- void ObjectContactPainter::EnsureValidDrawHierarchy(DisplayInfo& /*rDisplayInfo*/)
- {
- const sal_uInt32 nCount(maDrawHierarchy.Count());
-
- // #i35614#
- if(mbIsInitialized && !nCount)
- {
- // DrawHierarchy is not only invalid, but also completely
- // removed. Thus, we need to change the mbIsInitialized flag
- // to express that state.
- mbIsInitialized = sal_False;
- }
-
- if(mbIsInitialized)
- {
- // no new StartPoint, is the invalid flag set which means
- // somewhere the sub-hierarchy is invalid?
- if(!IsDrawHierarchyValid())
- {
- // Yes, check the sub-hierarchies
-
- for(sal_uInt32 a(0L); a < nCount; a++)
- {
- ViewObjectContact& rVOContact = *(maDrawHierarchy.GetObject(a));
-
- rVOContact.CheckDrawHierarchy(*this);
- }
- }
- }
- else
- {
- // build new hierarchy
- const sal_uInt32 nCount2(GetPaintObjectCount());
-
- for(sal_uInt32 a(0L); a < nCount2; a++)
- {
- ViewContact& rViewContact = GetPaintObjectViewContact(a);
- ViewObjectContact& rViewObjectContact = rViewContact.GetViewObjectContact(*this);
-
- // set parent at ViewObjectContact
- rViewObjectContact.SetParent(0L);
-
- // build sub-hierarchy
- if(rViewContact.GetObjectCount())
- {
- rViewObjectContact.BuildDrawHierarchy(*this, rViewContact);
- }
-
- // Add to list
- maDrawHierarchy.Append(&rViewObjectContact);
- }
-
- // remember to be initialized
- mbIsInitialized = sal_True;
- }
-
- // set DrawHierarchy valid
- mbDrawHierarchyValid = sal_True;
- }
-
- // Process the whole displaying
- void ObjectContactPainter::ProcessDisplay(DisplayInfo& rDisplayInfo)
- {
- if(!IsDrawHierarchyValid())
- {
- // The default implementation ensures a valid draw hierarchy.
- EnsureValidDrawHierarchy(rDisplayInfo);
- }
-
- if( mbIsInitialized
- && IsDrawHierarchyValid()
- && rDisplayInfo.GetPaintInfoRec()
- && rDisplayInfo.GetOutputDevice()
- && GetPaintObjectCount())
- {
- // This class is normally used for producing a single output. Thus,
- // buffering makes no sense and is switched off here.
- rDisplayInfo.SetBufferingAllowed(mbBufferingAllowed);
-
- // Paint Hierarchy
- for(sal_uInt32 a(0L); a < maDrawHierarchy.Count(); a++)
- {
- ViewObjectContact& rViewObjectContact = *(maDrawHierarchy.GetObject(a));
-
- // paint Hierarchy
- rViewObjectContact.PaintObjectHierarchy(rDisplayInfo);
- }
- }
- }
} // end of namespace contact
} // end of namespace sdr
@@ -162,21 +73,91 @@ namespace sdr
ViewContact& ObjectContactOfObjListPainter::GetPaintObjectViewContact(sal_uInt32 nIndex) const
{
const SdrObject* pObj = maStartObjects[nIndex];
- DBG_ASSERT(pObj, "ObjectContactOfObjListPainter::EnsureValidDrawHierarchy: Corrupt SdrObjectVector (!)");
+ DBG_ASSERT(pObj, "ObjectContactOfObjListPainter: Corrupt SdrObjectVector (!)");
return pObj->GetViewContact();
}
ObjectContactOfObjListPainter::ObjectContactOfObjListPainter(
+ OutputDevice& rTargetDevice,
const SdrObjectVector& rObjects,
- sal_Bool bBufferingAllowed)
- : ObjectContactPainter(bBufferingAllowed),
- maStartObjects(rObjects)
+ const SdrPage* pProcessedPage)
+ : ObjectContactPainter(),
+ mrTargetOutputDevice(rTargetDevice),
+ maStartObjects(rObjects),
+ mpProcessedPage(pProcessedPage)
{
}
ObjectContactOfObjListPainter::~ObjectContactOfObjListPainter()
{
}
+
+ // Process the whole displaying
+ void ObjectContactOfObjListPainter::ProcessDisplay(DisplayInfo& rDisplayInfo)
+ {
+ const sal_uInt32 nCount(GetPaintObjectCount());
+
+ if(nCount)
+ {
+ OutputDevice* pTargetDevice = TryToGetOutputDevice();
+
+ if(pTargetDevice)
+ {
+ // update current ViewInformation2D at the ObjectContact
+ const GDIMetaFile* pMetaFile = pTargetDevice->GetConnectMetaFile();
+ const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
+ basegfx::B2DRange aViewRange;
+
+ // create ViewRange
+ if(!bOutputToRecordingMetaFile)
+ {
+ // use visible pixels, but transform to world coordinates
+ const Size aOutputSizePixel(pTargetDevice->GetOutputSizePixel());
+ aViewRange = ::basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
+ aViewRange.transform(pTargetDevice->GetInverseViewTransformation());
+ }
+
+ // upate local ViewInformation2D
+ const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
+ basegfx::B2DHomMatrix(),
+ pTargetDevice->GetViewTransformation(),
+ aViewRange,
+ GetXDrawPageForSdrPage(const_cast< SdrPage* >(mpProcessedPage)),
+ 0.0,
+ 0);
+ updateViewInformation2D(aNewViewInformation2D);
+
+ // collect primitive data in a sequence; this will already use the updated ViewInformation2D
+ drawinglayer::primitive2d::Primitive2DSequence xPrimitiveSequence;
+
+ for(sal_uInt32 a(0L); a < nCount; a++)
+ {
+ const ViewObjectContact& rViewObjectContact = GetPaintObjectViewContact(a).GetViewObjectContact(*this);
+
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xPrimitiveSequence,
+ rViewObjectContact.getPrimitive2DSequenceHierarchy(rDisplayInfo));
+ }
+
+ // if there is something to show, use a vclProcessor to render it
+ if(xPrimitiveSequence.hasElements())
+ {
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = createBaseProcessor2DFromOutputDevice(
+ *pTargetDevice, getViewInformation2D(), false);
+
+ if(pProcessor2D)
+ {
+ pProcessor2D->process(xPrimitiveSequence);
+ delete pProcessor2D;
+ }
+ }
+ }
+ }
+ }
+
+ OutputDevice* ObjectContactOfObjListPainter::TryToGetOutputDevice() const
+ {
+ return &mrTargetOutputDevice;
+ }
} // end of namespace contact
} // end of namespace sdr
@@ -188,21 +169,21 @@ namespace sdr
{
sal_uInt32 ObjectContactOfPagePainter::GetPaintObjectCount() const
{
- return 1L;
+ return (GetStartPage() ? 1L : 0L);
}
ViewContact& ObjectContactOfPagePainter::GetPaintObjectViewContact(sal_uInt32 /*nIndex*/) const
{
- DBG_ASSERT(mpStartPage,
- "ObjectContactOfPagePainter::GetPaintObjectViewContact: no mpStartPage set (!)");
- return mpStartPage->GetViewContact();
+ DBG_ASSERT(GetStartPage(), "ObjectContactOfPagePainter::GetPaintObjectViewContact: no StartPage set (!)");
+ return GetStartPage()->GetViewContact();
}
ObjectContactOfPagePainter::ObjectContactOfPagePainter(
const SdrPage* pPage,
- sal_Bool bBufferingAllowed)
- : ObjectContactPainter(bBufferingAllowed),
- mpStartPage(pPage)
+ ObjectContact& rOriginalObjectContact)
+ : ObjectContactPainter(),
+ mrOriginalObjectContact(rOriginalObjectContact),
+ mxStartPage(const_cast< SdrPage* >(pPage)) // no SdrPageWeakRef available to hold a const SdrPage*
{
}
@@ -212,13 +193,16 @@ namespace sdr
void ObjectContactOfPagePainter::SetStartPage(const SdrPage* pPage)
{
- if(pPage && pPage != mpStartPage)
+ if(pPage != GetStartPage())
{
- ClearDrawHierarchy();
- mpStartPage = pPage;
- mbIsInitialized = sal_False;
+ mxStartPage.reset(const_cast< SdrPage* >(pPage)); // no SdrPageWeakRef available to hold a const SdrPage*
}
}
+
+ OutputDevice* ObjectContactOfPagePainter::TryToGetOutputDevice() const
+ {
+ return mrOriginalObjectContact.TryToGetOutputDevice();
+ }
} // end of namespace contact
} // end of namespace sdr