viewcontactofsdrmediaobj.cxx (f6e50924) viewcontactofsdrmediaobj.cxx (672a9062)
1/**************************************************************
1/**************************************************************
2 *
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_svx.hxx"
26
27#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>

--- 54 unchanged lines hidden (view full) ---

82 // #i71805# Since we may have a whole bunch of VOCs here, make a loop
83 // return first useful size -> the size from the first which is visualized as a window
84 const sal_uInt32 nCount(getViewObjectContactCount());
85
86 for(sal_uInt32 a(0); a < nCount; a++)
87 {
88 ViewObjectContact* pCandidate = getViewObjectContact(a);
89 Size aSize(pCandidate ? static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->getPreferredSize() : Size());
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_svx.hxx"
26
27#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>

--- 54 unchanged lines hidden (view full) ---

82 // #i71805# Since we may have a whole bunch of VOCs here, make a loop
83 // return first useful size -> the size from the first which is visualized as a window
84 const sal_uInt32 nCount(getViewObjectContactCount());
85
86 for(sal_uInt32 a(0); a < nCount; a++)
87 {
88 ViewObjectContact* pCandidate = getViewObjectContact(a);
89 Size aSize(pCandidate ? static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->getPreferredSize() : Size());
90
90
91 if(0 != aSize.getWidth() || 0 != aSize.getHeight())
92 {
93 return aSize;
94 }
95 }
96
97 return Size();
98}
99
100// ------------------------------------------------------------------------------
91 if(0 != aSize.getWidth() || 0 != aSize.getHeight())
92 {
93 return aSize;
94 }
95 }
96
97 return Size();
98}
99
100// ------------------------------------------------------------------------------
101
101
102void ViewContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rItem ) const
103{
104 // #i71805# Since we may have a whole bunch of VOCs here, make a loop
105 const sal_uInt32 nCount(getViewObjectContactCount());
106
107 for(sal_uInt32 a(0); a < nCount; a++)
108 {
109 ViewObjectContact* pCandidate = getViewObjectContact(a);
110
111 if(pCandidate)
112 {
113 static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->updateMediaItem(rItem);
114 }
115 }
116}
117
118// ------------------------------------------------------------------------------
102void ViewContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rItem ) const
103{
104 // #i71805# Since we may have a whole bunch of VOCs here, make a loop
105 const sal_uInt32 nCount(getViewObjectContactCount());
106
107 for(sal_uInt32 a(0); a < nCount; a++)
108 {
109 ViewObjectContact* pCandidate = getViewObjectContact(a);
110
111 if(pCandidate)
112 {
113 static_cast< ViewObjectContactOfSdrMediaObj* >(pCandidate)->updateMediaItem(rItem);
114 }
115 }
116}
117
118// ------------------------------------------------------------------------------
119
119
120void ViewContactOfSdrMediaObj::executeMediaItem( const ::avmedia::MediaItem& rItem )
121{
122 const sal_uInt32 nCount(getViewObjectContactCount());
123
124 for(sal_uInt32 a(0); a < nCount; a++)
125 {
126 ViewObjectContact* pCandidate = getViewObjectContact(a);
127

--- 15 unchanged lines hidden (view full) ---

143
144namespace sdr
145{
146 namespace contact
147 {
148 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrMediaObj::createViewIndependentPrimitive2DSequence() const
149 {
150 // create range using the model data directly. This is in SdrTextObj::aRect which i will access using
120void ViewContactOfSdrMediaObj::executeMediaItem( const ::avmedia::MediaItem& rItem )
121{
122 const sal_uInt32 nCount(getViewObjectContactCount());
123
124 for(sal_uInt32 a(0); a < nCount; a++)
125 {
126 ViewObjectContact* pCandidate = getViewObjectContact(a);
127

--- 15 unchanged lines hidden (view full) ---

143
144namespace sdr
145{
146 namespace contact
147 {
148 drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrMediaObj::createViewIndependentPrimitive2DSequence() const
149 {
150 // create range using the model data directly. This is in SdrTextObj::aRect which i will access using
151 // GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM.
151 // GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM.
152 const Rectangle& rRectangle(GetSdrMediaObj().GetGeoRect());
153 const basegfx::B2DRange aRange(
152 const Rectangle& rRectangle(GetSdrMediaObj().GetGeoRect());
153 const basegfx::B2DRange aRange(
154 rRectangle.Left(), rRectangle.Top(),
155 rRectangle.Right(), rRectangle.Bottom());
154 rRectangle.Left(), rRectangle.Top(),
155 rRectangle.Right(), rRectangle.Bottom());
156
157 // create object transform
158 basegfx::B2DHomMatrix aTransform;
159 aTransform.set(0, 0, aRange.getWidth());
160 aTransform.set(1, 1, aRange.getHeight());
161 aTransform.set(0, 2, aRange.getMinX());
162 aTransform.set(1, 2, aRange.getMinY());
163
156
157 // create object transform
158 basegfx::B2DHomMatrix aTransform;
159 aTransform.set(0, 0, aRange.getWidth());
160 aTransform.set(1, 1, aRange.getHeight());
161 aTransform.set(0, 2, aRange.getMinX());
162 aTransform.set(1, 2, aRange.getMinY());
163
164 // create media primitive. Always create primitives to allow the
164 // create media primitive. Always create primitives to allow the
165 // decomposition of MediaPrimitive2D to create needed invisible elements for HitTest
166 // and/or BoundRect
167 const basegfx::BColor aBackgroundColor(67.0 / 255.0, 67.0 / 255.0, 67.0 / 255.0);
168 const rtl::OUString& rURL(GetSdrMediaObj().getURL());
169 const sal_uInt32 nPixelBorder(4L);
170 const drawinglayer::primitive2d::Primitive2DReference xRetval(
165 // decomposition of MediaPrimitive2D to create needed invisible elements for HitTest
166 // and/or BoundRect
167 const basegfx::BColor aBackgroundColor(67.0 / 255.0, 67.0 / 255.0, 67.0 / 255.0);
168 const rtl::OUString& rURL(GetSdrMediaObj().getURL());
169 const sal_uInt32 nPixelBorder(4L);
170 const drawinglayer::primitive2d::Primitive2DReference xRetval(
171 new drawinglayer::primitive2d::MediaPrimitive2D(
172 aTransform, rURL, aBackgroundColor, nPixelBorder));
171 new drawinglayer::primitive2d::MediaPrimitive2D(
172 aTransform, rURL, aBackgroundColor, nPixelBorder));
173
174 return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
175 }
176 } // end of namespace contact
177} // end of namespace sdr
178
179//////////////////////////////////////////////////////////////////////////////
180// eof
173
174 return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
175 }
176 } // end of namespace contact
177} // end of namespace sdr
178
179//////////////////////////////////////////////////////////////////////////////
180// eof