summaryrefslogtreecommitdiff
path: root/svx/source/sdr
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-08-19 22:08:31 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-08-19 22:08:31 +0000
commit15fff924652f7839c03b59b0d043918070badbac (patch)
tree3e34eb8b15c56855ee044dc9f51b208308cb2771 /svx/source/sdr
parentf69828d8ae3c62e6d28af7332afb32ebbe4007a6 (diff)
INTEGRATION: CWS aw033 (1.4.14); FILE MERGED
2008/05/27 14:49:58 aw 1.4.14.16: #i39532# changes DEV300 m12 resync corrections 2008/05/14 14:00:15 aw 1.4.14.15: RESYNC: (1.10-1.11); FILE MERGED 2008/02/12 10:42:35 aw 1.4.14.14: CVS update from internal development GIT 2008/01/29 10:27:32 aw 1.4.14.13: updated refresh for ActionChanged(), diverse removals 2008/01/22 12:29:30 aw 1.4.14.12: adaptions and 1st stripping 2007/08/09 18:46:50 aw 1.4.14.11: RESYNC: (1.9-1.10); FILE MERGED 2007/07/06 13:43:07 aw 1.4.14.10: #i39532# moved from Primitive2DReference to Primitive2DSequence where possible to avoid extra-group primitive creations and deeper hierarchies as necessary 2007/03/20 14:15:51 aw 1.4.14.9: RESYNC: (1.8-1.9); FILE MERGED 2007/03/06 12:39:27 aw 1.4.14.8: #i39532# 2007/01/19 13:19:02 aw 1.4.14.7: RESYNC: (1.7-1.8); FILE MERGED 2006/12/12 10:14:26 aw 1.4.14.6: #i39532# changes after resync 2006/11/28 19:24:40 aw 1.4.14.5: RESYNC: (1.6-1.7); FILE MERGED 2006/10/19 10:59:14 aw 1.4.14.4: #i39532# primitive 2006/09/26 19:21:27 aw 1.4.14.3: RESYNC: (1.4-1.6); FILE MERGED 2006/08/09 17:12:24 aw 1.4.14.2: #i39532# 2006/05/12 12:46:23 aw 1.4.14.1: code changes for primitive support
Diffstat (limited to 'svx/source/sdr')
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx93
1 files changed, 62 insertions, 31 deletions
diff --git a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
index cd10d2ec8b84..96a2f65e32ee 100644
--- a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewcontactofsdrmediaobj.cxx,v $
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
* This file is part of OpenOffice.org.
*
@@ -34,6 +34,7 @@
#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
#include <svx/svdomedia.hxx>
#include <svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx>
+#include <drawinglayer/primitive2d/mediaprimitive2d.hxx>
namespace sdr { namespace contact {
@@ -54,13 +55,6 @@ ViewContactOfSdrMediaObj::~ViewContactOfSdrMediaObj()
// ------------------------------------------------------------------------------
-sal_Bool ViewContactOfSdrMediaObj::PaintObject(DisplayInfo& rDisplayInfo, Rectangle& rPaintRectangle, const ViewObjectContact& rAssociatedVOC)
-{
- return ViewContactOfSdrObj::PaintObject( rDisplayInfo, rPaintRectangle, rAssociatedVOC );
-}
-
-// ------------------------------------------------------------------------------
-
ViewObjectContact& ViewContactOfSdrMediaObj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
{
return *( new ViewObjectContactOfSdrMediaObj( rObjectContact, *this, static_cast< SdrMediaObj& >( GetSdrObject() ).getMediaProperties() ) );
@@ -72,11 +66,14 @@ bool ViewContactOfSdrMediaObj::hasPreferredSize() const
{
// #i71805# Since we may have a whole bunch of VOCs here, make a loop
// return true if all have their preferred size
+ const sal_uInt32 nCount(getViewObjectContactCount());
bool bRetval(true);
- for(sal_uInt32 a(0L); bRetval && a < maVOCList.Count(); a++)
+ for(sal_uInt32 a(0); bRetval && a < nCount; a++)
{
- if(!static_cast< ViewObjectContactOfSdrMediaObj* >( maVOCList.GetObject( 0 ) )->hasPreferredSize())
+ ViewObjectContact* pCandidate = getViewObjectContact(a);
+
+ if(pCandidate && !static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->hasPreferredSize())
{
bRetval = false;
}
@@ -91,9 +88,12 @@ Size ViewContactOfSdrMediaObj::getPreferredSize() const
{
// #i71805# Since we may have a whole bunch of VOCs here, make a loop
// return first useful size -> the size from the first which is visualized as a window
- for(sal_uInt32 a(0L); a < maVOCList.Count(); a++)
+ const sal_uInt32 nCount(getViewObjectContactCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
{
- Size aSize(static_cast< ViewObjectContactOfSdrMediaObj* >( maVOCList.GetObject( 0 ) )->getPreferredSize());
+ ViewObjectContact* pCandidate = getViewObjectContact(a);
+ Size aSize(pCandidate ? static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->getPreferredSize() : Size());
if(0 != aSize.getWidth() || 0 != aSize.getHeight())
{
@@ -109,9 +109,16 @@ Size ViewContactOfSdrMediaObj::getPreferredSize() const
void ViewContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rItem ) const
{
// #i71805# Since we may have a whole bunch of VOCs here, make a loop
- for(sal_uInt32 a(0L); a < maVOCList.Count(); a++)
+ const sal_uInt32 nCount(getViewObjectContactCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
{
- static_cast< ViewObjectContactOfSdrMediaObj* >(maVOCList.GetObject(a))->updateMediaItem(rItem);
+ ViewObjectContact* pCandidate = getViewObjectContact(a);
+
+ if(pCandidate)
+ {
+ static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->updateMediaItem(rItem);
+ }
}
}
@@ -119,9 +126,16 @@ void ViewContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rItem ) co
void ViewContactOfSdrMediaObj::executeMediaItem( const ::avmedia::MediaItem& rItem )
{
- for( sal_uInt32 n(0L); n < maVOCList.Count(); n++ )
+ const sal_uInt32 nCount(getViewObjectContactCount());
+
+ for(sal_uInt32 a(0); a < nCount; a++)
{
- static_cast< ViewObjectContactOfSdrMediaObj* >( maVOCList.GetObject( n ) )->executeMediaItem( rItem );
+ ViewObjectContact* pCandidate = getViewObjectContact(a);
+
+ if(pCandidate)
+ {
+ static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->executeMediaItem(rItem);
+ }
}
}
@@ -129,23 +143,40 @@ void ViewContactOfSdrMediaObj::executeMediaItem( const ::avmedia::MediaItem& rIt
void ViewContactOfSdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState )
{
- static_cast< SdrMediaObj& >( GetSdrObject() ).mediaPropertiesChanged( rNewState );
+ static_cast< SdrMediaObj& >(GetSdrObject()).mediaPropertiesChanged(rNewState);
}
-// ------------------------------------------------------------------------------
-// #i72701#
-sal_Bool ViewContactOfSdrMediaObj::ShouldPaintObject(DisplayInfo& rDisplayInfo, const ViewObjectContact& rAssociatedVOC)
-{
- // set pos/size of associated media window
- const ViewObjectContactOfSdrMediaObj& rVOC(dynamic_cast< const ViewObjectContactOfSdrMediaObj& >(rAssociatedVOC));
- rVOC.checkMediaWindowPosition(rDisplayInfo);
-
- // call parent
- return ViewContactOfSdrObj::ShouldPaintObject(rDisplayInfo, rAssociatedVOC);
-}
-
-// ------------------------------------------------------------------------------
-
}} // end of namespace sdr::contact
+namespace sdr
+{
+ namespace contact
+ {
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrMediaObj::createViewIndependentPrimitive2DSequence() const
+ {
+ // create range using the model data directly. This is in SdrTextObj::aRect which i will access using
+ // GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM.
+ const Rectangle& rRectangle(GetSdrMediaObj().GetGeoRect());
+ const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
+
+ // create object transform
+ basegfx::B2DHomMatrix aTransform;
+ aTransform.set(0, 0, aRange.getWidth());
+ aTransform.set(1, 1, aRange.getHeight());
+ aTransform.set(0, 2, aRange.getMinX());
+ aTransform.set(1, 2, aRange.getMinY());
+
+ // create media primitive
+ const basegfx::BColor aBackgroundColor(67.0 / 255.0, 67.0 / 255.0, 67.0 / 255.0);
+ const rtl::OUString& rURL(GetSdrMediaObj().getURL());
+ const sal_uInt32 nPixelBorder(4L);
+ const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::MediaPrimitive2D(
+ aTransform, rURL, aBackgroundColor, nPixelBorder));
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
+ }
+ } // end of namespace contact
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
// eof