LibreOffice Module slideshow (master) 1
drawshape.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
21
22#include <sal/log.hxx>
23#include <com/sun/star/beans/XPropertySet.hpp>
24#include <o3tl/safeint.hxx>
25
26#include <utility>
27#include <vcl/metaact.hxx>
28#include <vcl/gdimtf.hxx>
29#include <vcl/graph.hxx>
30
32
33#include <com/sun/star/drawing/TextAnimationKind.hpp>
34
36
37#include <algorithm>
38#include <iterator>
39#include <functional>
40
42#include "drawshape.hxx"
43#include <eventqueue.hxx>
44#include <wakeupevent.hxx>
47#include <tools.hxx>
48#include "gdimtftools.hxx"
50
51using namespace ::com::sun::star;
52
53
54namespace slideshow::internal
55{
56
57
58 // Private methods
59
60
62 {
64 {
65 // reload with added flags:
70
71 if (!mpCurrMtf)
72 mpCurrMtf = std::make_shared<GDIMetaFile>();
73
74 // TODO(F1): Currently, the scroll metafile will
75 // never contain any verbose text comments. Thus,
76 // can only display the full mtf content, no
77 // subsets.
79
80 // adapt maBounds. the requested scroll text metafile
81 // will typically have dimension different from the
82 // actual shape
83 ::basegfx::B2DRectangle aScrollRect, aPaintRect;
85 aPaintRect,
86 mpCurrMtf ),
87 "DrawShape::forceScrollTextMetaFile(): Could "
88 "not extract scroll anim rectangles from mtf" );
89
90 // take the larger one of the two rectangles (that
91 // should be the bound rect of the retrieved
92 // metafile)
93 if( aScrollRect.isInside( aPaintRect ) )
94 maBounds = aScrollRect;
95 else
96 maBounds = aPaintRect;
97 }
98 return mpCurrMtf;
99 }
100
102 {
103 // Update the states, we've just redrawn or created a new
104 // attribute layer.
105 if( mpAttributeLayer )
106 {
107 mnAttributeTransformationState = mpAttributeLayer->getTransformationState();
108 mnAttributeClipState = mpAttributeLayer->getClipState();
109 mnAttributeAlphaState = mpAttributeLayer->getAlphaState();
110 mnAttributePositionState = mpAttributeLayer->getPositionState();
111 mnAttributeContentState = mpAttributeLayer->getContentState();
112 mnAttributeVisibilityState = mpAttributeLayer->getVisibilityState();
113 }
114 }
115
117 {
119 maBounds,
121 getBounds(),
125 mnPriority);
126 }
127
128 bool DrawShape::implRender( UpdateFlags nUpdateFlags ) const
129 {
130 SAL_INFO( "slideshow", "::presentation::internal::DrawShape::implRender()" );
131 SAL_INFO( "slideshow", "::presentation::internal::DrawShape: 0x" << std::hex << this );
132
133 // will perform the update now, clear update-enforcing
134 // flags
135 mbForceUpdate = false;
137
139 "DrawShape::implRender(): render called on DrawShape without views" );
140
141 if( maBounds.isEmpty() )
142 {
143 // zero-sized shapes are effectively invisible,
144 // thus, we save us the rendering...
145 return true;
146 }
147
148 // redraw all view shapes, by calling their update() method
150 bool bVisible = isVisible();
151 if( o3tl::make_unsigned(::std::count_if( maViewShapes.begin(),
152 maViewShapes.end(),
153 [this, &bVisible, &renderArgs, &nUpdateFlags]
154 ( const ViewShapeSharedPtr& pShape )
155 { return pShape->update( this->mpCurrMtf,
156 renderArgs,
157 nUpdateFlags,
158 bVisible ); } ))
159 != maViewShapes.size() )
160 {
161 // at least one of the ViewShape::update() calls did return
162 // false - update failed on at least one ViewLayer
163 return false;
164 }
165
166 // successfully redrawn - update state IDs to detect next changes
168
169 return true;
170 }
171
173 {
174 // default: update nothing, unless ShapeAttributeStack
175 // tells us below, or if the attribute layer was revoked
176 UpdateFlags nUpdateFlags(UpdateFlags::NONE);
177
178 // possibly the whole shape content changed
180 nUpdateFlags = UpdateFlags::Content;
181
182
183 // determine what has to be updated
184
185
186 // do we have an attribute layer?
187 if( mpAttributeLayer )
188 {
189 // Prevent nUpdateFlags to be modified when the shape is not
190 // visible, except when it just was hidden.
191 if (mpAttributeLayer->getVisibility()
192 || mpAttributeLayer->getVisibilityState() != mnAttributeVisibilityState )
193 {
194 if (mpAttributeLayer->getVisibilityState() != mnAttributeVisibilityState )
195 {
196 // Change of the visibility state is mapped to
197 // content change because when the visibility
198 // changes then usually a sprite is shown or hidden
199 // and the background under has to be painted once.
200 nUpdateFlags |= UpdateFlags::Content;
201 }
202
203 // TODO(P1): This can be done without conditional branching.
204 // See HAKMEM.
205 if( mpAttributeLayer->getPositionState() != mnAttributePositionState )
206 {
207 nUpdateFlags |= UpdateFlags::Position;
208 }
209 if( mpAttributeLayer->getAlphaState() != mnAttributeAlphaState )
210 {
211 nUpdateFlags |= UpdateFlags::Alpha;
212 }
213 if( mpAttributeLayer->getClipState() != mnAttributeClipState )
214 {
215 nUpdateFlags |= UpdateFlags::Clip;
216 }
217 if( mpAttributeLayer->getTransformationState() != mnAttributeTransformationState )
218 {
219 nUpdateFlags |= UpdateFlags::Transformation;
220 }
221 if( mpAttributeLayer->getContentState() != mnAttributeContentState )
222 {
223 nUpdateFlags |= UpdateFlags::Content;
224 }
225 }
226 }
227
228 return nUpdateFlags;
229 }
230
232 {
234 "DrawShape::getActualUnitShapeBounds(): called on DrawShape without views" );
235
236 const VectorOfDocTreeNodes& rSubsets(
238
239 const ::basegfx::B2DRectangle aDefaultBounds( 0.0,0.0,1.0,1.0 );
240
241 // perform the cheapest check first
242 if( rSubsets.empty() )
243 {
244 // if subset contains the whole shape, no need to call
245 // the somewhat expensive bound calculation, since as
246 // long as the subset is empty, this branch will be
247 // taken.
248 return aDefaultBounds;
249 }
250 else
251 {
252 OSL_ENSURE( rSubsets.size() != 1 ||
253 !rSubsets.front().isEmpty(),
254 "DrawShape::getActualUnitShapeBounds() expects a "
255 "_non-empty_ subset vector for a subsetted shape!" );
256
257 // are the cached bounds still valid?
259 {
260 // no, (re)generate them
261 // =====================
262
263 // setup cached values to defaults (might fail to
264 // retrieve true bounds below)
265 maCurrentShapeUnitBounds = aDefaultBounds;
266
267 // TODO(P2): the subset of the master shape (that from
268 // which the subsets are subtracted) changes
269 // relatively often (every time a subset shape is
270 // added or removed). Maybe we should exclude it here,
271 // always assuming full bounds?
272
273 ::cppcanvas::CanvasSharedPtr pDestinationCanvas(
274 maViewShapes.front()->getViewLayer()->getCanvas() );
275
276 // TODO(Q2): Although this _is_ currently
277 // view-agnostic, it might not stay like
278 // that. Maybe this method should again be moved
279 // to the ViewShape
281 maViewShapes.front()->getRenderer(
282 pDestinationCanvas, mpCurrMtf, mpAttributeLayer ) );
283
284 // If we cannot not prefetch, be defensive and assume
285 // full shape size
286 if( pRenderer )
287 {
288 // temporarily, switch total transformation to identity
289 // (need the bounds in the [0,1]x[0,1] unit coordinate
290 // system.
291 ::basegfx::B2DHomMatrix aEmptyTransformation;
292
293 ::basegfx::B2DHomMatrix aOldTransform( pDestinationCanvas->getTransformation() );
294 pDestinationCanvas->setTransformation( aEmptyTransformation );
295 pRenderer->setTransformation( aEmptyTransformation );
296
297 // restore old transformation when leaving the scope
298 const ::comphelper::ScopeGuard aGuard(
299 [&pDestinationCanvas, &aOldTransform]()
300 { return pDestinationCanvas->setTransformation( aOldTransform ); } );
301
302
303 // retrieve bounds for subset of whole metafile
304
305
306 ::basegfx::B2DRange aTotalBounds;
307
308 // cannot use ::boost::bind, ::basegfx::B2DRange::expand()
309 // is overloaded.
310 for( const auto& rDocTreeNode : rSubsets )
311 aTotalBounds.expand( pRenderer->getSubsetArea(
312 rDocTreeNode.getStartIndex(),
313 rDocTreeNode.getEndIndex() ) );
314
315 OSL_ENSURE( aTotalBounds.getMinX() >= -0.1 &&
316 aTotalBounds.getMinY() >= -0.1 &&
317 aTotalBounds.getMaxX() <= 1.1 &&
318 aTotalBounds.getMaxY() <= 1.1,
319 "DrawShape::getActualUnitShapeBounds(): bounds noticeably larger than original shape - clipping!" );
320
321 // really make sure no shape appears larger than its
322 // original bounds (there _are_ some pathologic cases,
323 // especially when imported from PPT, that have
324 // e.g. obscenely large polygon bounds)
325 aTotalBounds.intersect(
326 ::basegfx::B2DRange( 0.0, 0.0,
327 1.0, 1.0 ));
328
329 maCurrentShapeUnitBounds = aTotalBounds;
330 }
331 }
332
334 }
335 }
336
338 const uno::Reference< drawing::XDrawPage >& xContainingPage,
339 double nPrio,
340 bool bForeignSource,
341 const SlideShowContext& rContext ) :
342 mxShape( xShape ),
343 mxPage( xContainingPage ),
344 maAnimationFrames(), // empty, we don't have no intrinsic animation
345 mnCurrFrame(0),
346 mpCurrMtf(),
347 mnCurrMtfLoadFlags( bForeignSource
349 maCurrentShapeUnitBounds(),
350 mnPriority( nPrio ), // TODO(F1): When ZOrder someday becomes usable: make this ( getAPIShapePrio( xShape ) ),
351 maBounds( getAPIShapeBounds( xShape ) ),
352 mpAttributeLayer(),
353 mpIntrinsicAnimationActivity(),
354 mnAttributeTransformationState(0),
355 mnAttributeClipState(0),
356 mnAttributeAlphaState(0),
357 mnAttributePositionState(0),
358 mnAttributeContentState(0),
359 mnAttributeVisibilityState(0),
360 maViewShapes(),
362 maHyperlinkIndices(),
363 maHyperlinkRegions(),
364 maSubsetting(),
365 mnIsAnimatedCount(0),
366 mnAnimationLoopCount(0),
367 mbIsVisible( true ),
368 mbForceUpdate( false ),
369 mbAttributeLayerRevoked( false ),
370 mbDrawingLayerAnim( false ),
371 mbContainsPageField( false )
372 {
373 ENSURE_OR_THROW( mxShape.is(), "DrawShape::DrawShape(): Invalid XShape" );
374 ENSURE_OR_THROW( mxPage.is(), "DrawShape::DrawShape(): Invalid containing page" );
375
376 // check for drawing layer animations:
377 drawing::TextAnimationKind eKind = drawing::TextAnimationKind_NONE;
379 uno::UNO_QUERY );
380 if( xPropSet.is() )
381 getPropertyValue( eKind, xPropSet,
382 "TextAnimationKind" );
383 mbDrawingLayerAnim = (eKind != drawing::TextAnimationKind_NONE);
384
385 // must NOT be called from within initializer list, uses
386 // state from mnCurrMtfLoadFlags!
388 xContainingPage, mnCurrMtfLoadFlags,
390 if (!mpCurrMtf)
391 mpCurrMtf = std::make_shared<GDIMetaFile>();
392
394
396
398 {
399 // tdf#150402 Use mbContainsPageField that gets set in prepareHyperlinkIndices
400 // which has to be run anyways, so this will cause no harm in execution speed.
401 // It lets us detect the potential error case that a PageField is contained in
402 // the Text of the Shape. That is a hint that maBounds contains the wrong Range
403 // and needs to be corrected. The correct size is in the PrefSize of the metafile.
404 // For more background information please refer to tdf#150402, Comment 16.
405 const double fWidthDiff(fabs(mpCurrMtf->GetPrefSize().Width() - maBounds.getWidth()));
406 const double fHeightDiff(fabs(mpCurrMtf->GetPrefSize().Height() - maBounds.getHeight()));
407
408 if(fWidthDiff > 1.0 || fHeightDiff > 1.0)
409 {
412 maBounds.getMinX() + mpCurrMtf->GetPrefSize().Width(),
413 maBounds.getMinY() + mpCurrMtf->GetPrefSize().Height());
414 }
415 }
416 }
417
418 DrawShape::DrawShape( const uno::Reference< drawing::XShape >& xShape,
419 uno::Reference< drawing::XDrawPage > xContainingPage,
420 double nPrio,
421 const Graphic& rGraphic,
422 const SlideShowContext& rContext ) :
423 mxShape( xShape ),
424 mxPage(std::move( xContainingPage )),
425 maAnimationFrames(),
426 mnCurrFrame(0),
427 mpCurrMtf(),
428 mnCurrMtfLoadFlags( MTF_LOAD_NONE ),
429 maCurrentShapeUnitBounds(),
430 mnPriority( nPrio ), // TODO(F1): When ZOrder someday becomes usable: make this ( getAPIShapePrio( xShape ) ),
431 maBounds( getAPIShapeBounds( xShape ) ),
432 mpAttributeLayer(),
433 mpIntrinsicAnimationActivity(),
434 mnAttributeTransformationState(0),
435 mnAttributeClipState(0),
436 mnAttributeAlphaState(0),
437 mnAttributePositionState(0),
438 mnAttributeContentState(0),
439 mnAttributeVisibilityState(0),
440 maViewShapes(),
442 maHyperlinkIndices(),
443 maHyperlinkRegions(),
444 maSubsetting(),
445 mnIsAnimatedCount(0),
446 mnAnimationLoopCount(0),
447 mbIsVisible( true ),
448 mbForceUpdate( false ),
449 mbAttributeLayerRevoked( false ),
450 mbDrawingLayerAnim( false ),
451 mbContainsPageField( false )
452 {
453 ENSURE_OR_THROW( rGraphic.IsAnimated(),
454 "DrawShape::DrawShape(): Graphic is no animation" );
455
458 rGraphic );
459
461 maAnimationFrames.front().mpMtf,
462 "DrawShape::DrawShape(): " );
463 mpCurrMtf = maAnimationFrames.front().mpMtf;
464
465 ENSURE_OR_THROW( mxShape.is(), "DrawShape::DrawShape(): Invalid XShape" );
466 ENSURE_OR_THROW( mxPage.is(), "DrawShape::DrawShape(): Invalid containing page" );
467 ENSURE_OR_THROW( mpCurrMtf, "DrawShape::DrawShape(): Invalid metafile" );
468 }
469
471 const DocTreeNode& rTreeNode,
472 double nPrio ) :
473 mxShape( rSrc.mxShape ),
474 mxPage( rSrc.mxPage ),
475 maAnimationFrames(), // don't copy animations for subsets,
476 // only the current frame!
477 mnCurrFrame(0),
478 mpCurrMtf( rSrc.mpCurrMtf ),
479 mnCurrMtfLoadFlags( rSrc.mnCurrMtfLoadFlags ),
480 maCurrentShapeUnitBounds(),
481 mnPriority( nPrio ),
482 maBounds( rSrc.maBounds ),
483 mpAttributeLayer(),
484 mpIntrinsicAnimationActivity(),
485 mnAttributeTransformationState(0),
486 mnAttributeClipState(0),
487 mnAttributeAlphaState(0),
488 mnAttributePositionState(0),
489 mnAttributeContentState(0),
490 mnAttributeVisibilityState(0),
491 maViewShapes(),
493 maHyperlinkIndices(),
494 maHyperlinkRegions(),
495 maSubsetting( rTreeNode, mpCurrMtf ),
496 mnIsAnimatedCount(0),
497 mnAnimationLoopCount(0),
498 mbIsVisible( rSrc.mbIsVisible ),
499 mbForceUpdate( false ),
500 mbAttributeLayerRevoked( false ),
501 mbDrawingLayerAnim( false ),
502 mbContainsPageField( false )
503 {
504 ENSURE_OR_THROW( mxShape.is(), "DrawShape::DrawShape(): Invalid XShape" );
505 ENSURE_OR_THROW( mpCurrMtf, "DrawShape::DrawShape(): Invalid metafile" );
506
507 // xxx todo: currently not implemented for subsetted shapes;
508 // would mean modifying set of hyperlink regions when
509 // subsetting text portions. N.B.: there's already an
510 // issue for this #i72828#
511 }
512
513
514 // Public methods
515
516
519 const uno::Reference< drawing::XDrawPage >& xContainingPage,
520 double nPrio,
521 bool bForeignSource,
522 const SlideShowContext& rContext )
523 {
524 DrawShapeSharedPtr pShape( new DrawShape(xShape,
525 xContainingPage,
526 nPrio,
527 bForeignSource,
528 rContext) );
529
530 if( pShape->hasIntrinsicAnimation() )
531 {
532 OSL_ASSERT( pShape->maAnimationFrames.empty() );
533 if( pShape->getNumberOfTreeNodes(
535 {
536 pShape->mpIntrinsicAnimationActivity =
538 rContext,
539 pShape);
540 }
541 }
542
543 if( pShape->hasHyperlinks() )
544 rContext.mpSubsettableShapeManager->addHyperlinkArea( pShape );
545
546 return pShape;
547 }
548
550 const uno::Reference< drawing::XShape >& xShape,
551 const uno::Reference< drawing::XDrawPage >& xContainingPage,
552 double nPrio,
553 const Graphic& rGraphic,
554 const SlideShowContext& rContext )
555 {
556 DrawShapeSharedPtr pShape( new DrawShape(xShape,
557 xContainingPage,
558 nPrio,
559 rGraphic,
560 rContext) );
561
562 if( pShape->hasIntrinsicAnimation() )
563 {
564 OSL_ASSERT( !pShape->maAnimationFrames.empty() );
565
566 std::vector<double> aTimeout;
567 std::transform(
568 pShape->maAnimationFrames.begin(),
569 pShape->maAnimationFrames.end(),
570 std::back_insert_iterator< std::vector<double> >( aTimeout ),
571 std::mem_fn(&MtfAnimationFrame::getDuration) );
572
573 WakeupEventSharedPtr pWakeupEvent =
574 std::make_shared<WakeupEvent>( rContext.mrEventQueue.getTimer(),
575 rContext.mrActivitiesQueue );
576
577 ActivitySharedPtr pActivity =
579 rContext,
580 pShape,
581 pWakeupEvent,
582 std::move(aTimeout),
583 pShape->mnAnimationLoopCount);
584
585 pWakeupEvent->setActivity( pActivity );
586 pShape->mpIntrinsicAnimationActivity = pActivity;
587 }
588
589 OSL_ENSURE( !pShape->hasHyperlinks(),
590 "DrawShape::create(): graphic-only shapes must not have hyperlinks!" );
591
592 return pShape;
593 }
594
596 {
597 try
598 {
599 // dispose intrinsic animation activity, else, it will
600 // linger forever
602 if( pActivity )
603 pActivity->dispose();
604 }
605 catch (uno::Exception const &)
606 {
607 DBG_UNHANDLED_EXCEPTION("slideshow");
608 }
609 }
610
612 {
613 return mxShape;
614 }
615
617 bool bRedrawLayer )
618 {
619 // already added?
620 if( ::std::any_of( maViewShapes.begin(),
621 maViewShapes.end(),
622 [&rNewLayer]
623 ( const ViewShapeSharedPtr& pShape )
624 { return rNewLayer == pShape->getViewLayer(); } ) )
625 {
626 // yes, nothing to do
627 return;
628 }
629
630 ViewShapeSharedPtr pNewShape = std::make_shared<ViewShape>( rNewLayer );
631
632 maViewShapes.push_back( pNewShape );
633
634 // pass on animation state
636 {
637 for( int i=0; i<mnIsAnimatedCount; ++i )
638 pNewShape->enterAnimationMode();
639 }
640
641 // render the Shape on the newly added ViewLayer
642 if( bRedrawLayer )
643 {
644 pNewShape->update( mpCurrMtf,
647 isVisible() );
648 }
649 }
650
652 {
653 const ViewShapeVector::iterator aEnd( maViewShapes.end() );
654
655 OSL_ENSURE( ::std::count_if(maViewShapes.begin(),
656 aEnd,
657 [&rLayer]
658 ( const ViewShapeSharedPtr& pShape )
659 { return rLayer == pShape->getViewLayer(); } ) < 2,
660 "DrawShape::removeViewLayer(): Duplicate ViewLayer entries!" );
661
662 ViewShapeVector::iterator aIter;
663
664 if( (aIter=::std::remove_if( maViewShapes.begin(),
665 aEnd,
666 [&rLayer]
667 ( const ViewShapeSharedPtr& pShape )
668 { return rLayer == pShape->getViewLayer(); } ) ) == aEnd )
669 {
670 // view layer seemingly was not added, failed
671 return false;
672 }
673
674 // actually erase from container
675 maViewShapes.erase( aIter, aEnd );
676
677 return true;
678 }
679
681 {
682 maViewShapes.clear();
683 }
684
685 bool DrawShape::update() const
686 {
687 if( mbForceUpdate )
688 {
689 return render();
690 }
691 else
692 {
693 return implRender( getUpdateFlags() );
694 }
695 }
696
697 bool DrawShape::render() const
698 {
699 // force redraw. Have to also pass on the update flags,
700 // because e.g. content update (regeneration of the
701 // metafile renderer) is normally not performed. A simple
702 // UpdateFlags::Force would only paint the metafile in its
703 // old state.
705 }
706
708 {
709 return mbForceUpdate ||
711 }
712
713
715 {
716 // little optimization: for non-modified shapes, we don't
717 // create an ShapeAttributeStack, and therefore also don't
718 // have to check it.
721 }
722
724 {
725 return maBounds;
726 }
727
729 {
731
732 // an already empty shape bound need no further
733 // treatment. In fact, any changes applied below would
734 // actually remove the special empty state, thus, don't
735 // change!
736 if( !maBounds.isEmpty() )
737 {
738 basegfx::B2DRectangle aUnitBounds(0.0,0.0,1.0,1.0);
739
740 if( !maViewShapes.empty() )
741 aUnitBounds = getActualUnitShapeBounds();
742
743 if( !aUnitBounds.isEmpty() )
744 {
745 if( mpAttributeLayer )
746 {
747 // calc actual shape area (in user coordinate
748 // space) from the transformation as given by the
749 // shape attribute layer
750 aBounds = getShapeUpdateArea( aUnitBounds,
754 }
755 else
756 {
757 // no attribute layer, thus, the true shape bounds
758 // can be directly derived from the XShape bound
759 // attribute
760 aBounds = getShapeUpdateArea( aUnitBounds,
761 maBounds );
762 }
763
764 if( !maViewShapes.empty() )
765 {
766 // determine border needed for antialiasing the shape
767 ::basegfx::B2DSize aAABorder(0.0,0.0);
768
769 // for every view, get AA border and 'expand' aAABorder
770 // appropriately.
771 for( const auto& rViewShape : maViewShapes )
772 {
773 const ::basegfx::B2DSize rShapeBorder( rViewShape->getAntialiasingBorder() );
774
775 aAABorder.setWidth( ::std::max(
776 rShapeBorder.getWidth(),
777 aAABorder.getWidth() ) );
778 aAABorder.setWidth( ::std::max(
779 rShapeBorder.getHeight(),
780 aAABorder.getHeight() ) );
781 }
782
783 // add calculated AA border to aBounds
784 aBounds = ::basegfx::B2DRectangle( aBounds.getMinX() - aAABorder.getWidth(),
785 aBounds.getMinY() - aAABorder.getHeight(),
786 aBounds.getMaxX() + aAABorder.getWidth(),
787 aBounds.getMaxY() + aAABorder.getHeight() );
788 }
789 }
790 }
791
792 return aBounds;
793 }
794
796 {
797 bool bIsVisible( mbIsVisible );
798
799 if( mpAttributeLayer )
800 {
801 // check whether visibility and alpha are not default
802 // (mpAttributeLayer->isVisibilityValid() returns true
803 // then): bVisible becomes true, if shape visibility
804 // is on and alpha is not 0.0 (fully transparent)
805 if( mpAttributeLayer->isVisibilityValid() )
806 bIsVisible = mpAttributeLayer->getVisibility();
807
808 // only touch bIsVisible, if the shape is still
809 // visible - if getVisibility already made us
810 // invisible, no alpha value will make us appear
811 // again.
812 if( bIsVisible && mpAttributeLayer->isAlphaValid() )
813 bIsVisible = !::basegfx::fTools::equalZero( mpAttributeLayer->getAlpha() );
814 }
815
816 return bIsVisible;
817 }
818
820 {
821 return mnPriority;
822 }
823
825 {
826 return mnIsAnimatedCount > 0;
827 }
828
830 {
831 return (!maAnimationFrames.empty() || mbDrawingLayerAnim);
832 }
833
834 void DrawShape::setIntrinsicAnimationFrame( ::std::size_t nCurrFrame )
835 {
836 ENSURE_OR_RETURN_VOID( nCurrFrame < maAnimationFrames.size(),
837 "DrawShape::setIntrinsicAnimationFrame(): frame index out of bounds" );
838
839 if( mnCurrFrame != nCurrFrame )
840 {
841 mnCurrFrame = nCurrFrame;
843 mbForceUpdate = true;
844 }
845 }
846
847 // hyperlink support
849 {
850 if ( !maHyperlinkIndices.empty())
851 {
852 maHyperlinkIndices.clear();
853 maHyperlinkRegions.clear();
854 }
855
856 sal_Int32 nIndex = 0;
857 for ( MetaAction * pCurrAct = mpCurrMtf->FirstAction();
858 pCurrAct != nullptr; pCurrAct = mpCurrMtf->NextAction() )
859 {
860 if (pCurrAct->GetType() == MetaActionType::COMMENT) {
861 MetaCommentAction * pAct =
862 static_cast<MetaCommentAction *>(pCurrAct);
863 // skip comment if not a special XTEXT comment
864 if (pAct->GetComment().equalsIgnoreAsciiCase("FIELD_SEQ_BEGIN") &&
865 // e.g. date field doesn't have data!
866 // currently assuming that only url field, this is
867 // somehow fragile! xxx todo if possible
868 pAct->GetData() != nullptr &&
869 pAct->GetDataSize() > 0)
870 {
871 if (!maHyperlinkIndices.empty() &&
872 maHyperlinkIndices.back().second == -1) {
873 SAL_WARN( "slideshow", "### pending FIELD_SEQ_END!" );
874 maHyperlinkIndices.pop_back();
875 maHyperlinkRegions.pop_back();
876 }
877 maHyperlinkIndices.emplace_back( nIndex + 1,
878 -1 /* to be filled below */ );
879 maHyperlinkRegions.emplace_back(
881 OUString(
882 reinterpret_cast<sal_Unicode const*>(
883 pAct->GetData()),
884 pAct->GetDataSize() / sizeof(sal_Unicode) )
885 );
886 }
887 else if (pAct->GetComment().equalsIgnoreAsciiCase("FIELD_SEQ_END") &&
888 // pending end is expected:
889 !maHyperlinkIndices.empty() &&
890 maHyperlinkIndices.back().second == -1)
891 {
892 maHyperlinkIndices.back().second = nIndex;
893 }
894 else if (pAct->GetComment().equalsIgnoreAsciiCase("FIELD_SEQ_BEGIN;PageField"))
895 {
896 mbContainsPageField = true;
897 }
898 ++nIndex;
899 }
900 else
901 nIndex += getNextActionOffset(pCurrAct);
902 }
903 if (!maHyperlinkIndices.empty() &&
904 maHyperlinkIndices.back().second == -1) {
905 SAL_WARN( "slideshow", "### pending FIELD_SEQ_END!" );
906 maHyperlinkIndices.pop_back();
907 maHyperlinkRegions.pop_back();
908 }
909 OSL_ASSERT( maHyperlinkIndices.size() == maHyperlinkRegions.size());
910 }
911
913 {
914 return ! maHyperlinkRegions.empty();
915 }
916
918 {
919 OSL_ASSERT( !maViewShapes.empty() );
920
921 if( !isVisible() )
923
924 // late init, determine regions:
925 if( !maHyperlinkRegions.empty() &&
926 !maViewShapes.empty() &&
927 // region already inited?
928 maHyperlinkRegions.front().first.getWidth() == 0 &&
929 maHyperlinkRegions.front().first.getHeight() == 0 &&
930 maHyperlinkRegions.size() == maHyperlinkIndices.size() )
931 {
932 // TODO(Q2): Although this _is_ currently
933 // view-agnostic, it might not stay like that.
934 ViewShapeSharedPtr const& pViewShape = maViewShapes.front();
935 cppcanvas::CanvasSharedPtr const pCanvas(
936 pViewShape->getViewLayer()->getCanvas() );
937
938 // reuse Renderer of first view shape:
939 cppcanvas::RendererSharedPtr const pRenderer(
940 pViewShape->getRenderer(
941 pCanvas, mpCurrMtf, mpAttributeLayer ) );
942
943 OSL_ASSERT( pRenderer );
944
945 if (pRenderer)
946 {
947 basegfx::B2DHomMatrix const aOldTransform(
948 pCanvas->getTransformation() );
949 basegfx::B2DHomMatrix aTransform;
950 pCanvas->setTransformation( aTransform /* empty */ );
951
952
953 ::cppcanvas::Canvas* pTmpCanvas = pCanvas.get();
954 comphelper::ScopeGuard const resetOldTransformation(
955 [&aOldTransform, &pTmpCanvas]()
956 { return pTmpCanvas->setTransformation( aOldTransform ); } );
957
958 aTransform.scale( maBounds.getWidth(),
960 pRenderer->setTransformation( aTransform );
961 pRenderer->setClip();
962
963 for( std::size_t pos = maHyperlinkRegions.size(); pos--; )
964 {
965 // get region:
966 HyperlinkIndexPair const& rIndices = maHyperlinkIndices[pos];
967 basegfx::B2DRectangle const region(
968 pRenderer->getSubsetArea( rIndices.first,
969 rIndices.second ));
970 maHyperlinkRegions[pos].first = region;
971 }
972 }
973 }
974
975 // shift shape-relative hyperlink regions to
976 // slide-absolute position
977
978 HyperlinkRegions aTranslatedRegions;
979
980 // increase capacity to same size as the container for
981 // shape-relative hyperlink regions to avoid reallocation
982 aTranslatedRegions.reserve( maHyperlinkRegions.size() );
983 const basegfx::B2DPoint& rOffset(getBounds().getMinimum());
984 for( const auto& cp : maHyperlinkRegions )
985 {
986 basegfx::B2DRange const& relRegion( cp.first );
987 aTranslatedRegions.emplace_back(
989 relRegion.getMinimum() + rOffset,
990 relRegion.getMaximum() + rOffset),
991 cp.second );
992 }
993
994 return aTranslatedRegions;
995 }
996
998 {
999 return getPriority();
1000 }
1001
1002
1003 // AnimatableShape methods
1004
1005
1007 {
1008 OSL_ENSURE( !maViewShapes.empty(),
1009 "DrawShape::enterAnimationMode(): called on DrawShape without views" );
1010
1011 if( mnIsAnimatedCount == 0 )
1012 {
1013 // notify all ViewShapes, by calling their enterAnimationMode method.
1014 // We're now entering animation mode
1015 for( const auto& rViewShape : maViewShapes )
1016 rViewShape->enterAnimationMode();
1017 }
1018
1020 }
1021
1023 {
1024 OSL_ENSURE( !maViewShapes.empty(),
1025 "DrawShape::leaveAnimationMode(): called on DrawShape without views" );
1026
1028
1029 if( mnIsAnimatedCount == 0 )
1030 {
1031 // notify all ViewShapes, by calling their leaveAnimationMode method.
1032 // we're now leaving animation mode
1033 for( const auto& rViewShape : maViewShapes )
1034 rViewShape->leaveAnimationMode();
1035 }
1036 }
1037
1038
1039 // AttributableShape methods
1040
1041
1043 {
1044 // create new layer, with last as its new child
1045 mpAttributeLayer = std::make_shared<ShapeAttributeLayer>( mpAttributeLayer );
1046
1047 // Update the local state ids to reflect those of the new layer.
1049
1050 return mpAttributeLayer;
1051 }
1052
1054 {
1055 if( !mpAttributeLayer )
1056 return false; // no layers
1057
1058 if( mpAttributeLayer == rLayer )
1059 {
1060 // it's the toplevel layer
1061 mpAttributeLayer = mpAttributeLayer->getChildLayer();
1062
1063 // force content redraw, all state variables have
1064 // possibly changed
1066
1067 return true;
1068 }
1069 else
1070 {
1071 // pass on to the layer, to try its children
1072 return mpAttributeLayer->revokeChildLayer( rLayer );
1073 }
1074 }
1075
1077 {
1078 return mpAttributeLayer;
1079 }
1080
1081 void DrawShape::setVisibility( bool bVisible )
1082 {
1083 if( mbIsVisible != bVisible )
1084 {
1086 mbForceUpdate = true;
1087 }
1088 }
1089
1091 {
1092 return *this;
1093 }
1094
1096 {
1097 return *this;
1098 }
1099
1101 {
1102 // forward to delegate
1103 return maSubsetting.getSubsetNode();
1104 }
1105
1107 {
1108 // forward to delegate
1109 return maSubsetting.getSubsetShape( rTreeNode );
1110 }
1111
1113 const DocTreeNode& rTreeNode )
1114 {
1115 // subset shape already created for this DocTreeNode?
1117
1118 // when true, this method has created a new subset
1119 // DrawShape
1120 bool bNewlyCreated( false );
1121
1122 if( pSubset )
1123 {
1124 o_rSubset = pSubset;
1125
1126 // reusing existing subset
1127 }
1128 else
1129 {
1130 // not yet created, init entry
1131 o_rSubset.reset( new DrawShape( *this,
1132 rTreeNode,
1133 // TODO(Q3): That's a
1134 // hack. We assume
1135 // that start and end
1136 // index will always
1137 // be less than 65535
1138 mnPriority +
1139 rTreeNode.getStartIndex()/double(SAL_MAX_INT16) ));
1140
1141 bNewlyCreated = true; // subset newly created
1142 }
1143
1144 // always register shape at DrawShapeSubsetting, to keep
1145 // refcount up-to-date
1146 maSubsetting.addSubsetShape( o_rSubset );
1147
1148 // flush bounds cache
1150
1151 return bNewlyCreated;
1152 }
1153
1155 {
1156 // flush bounds cache
1158
1159 // forward to delegate
1160 if( maSubsetting.revokeSubsetShape( rShape ) )
1161 {
1162 // force redraw, our content has possibly changed (as
1163 // one of the subsets now display within our shape
1164 // again).
1165 mbForceUpdate = true;
1166
1167 // #i47428# TEMP FIX: synchronize visibility of subset
1168 // with parent.
1169
1170 // TODO(F3): Remove here, and implement
1171 // TEXT_ONLY/BACKGROUND_ONLY with the proverbial
1172 // additional level of indirection: create a
1173 // persistent subset, containing all text/only the
1174 // background respectively. From _that_ object,
1175 // generate the temporary character subset shapes.
1176 const ShapeAttributeLayerSharedPtr& rAttrLayer(
1177 rShape->getTopmostAttributeLayer() );
1178 if( rAttrLayer &&
1179 rAttrLayer->isVisibilityValid() &&
1180 rAttrLayer->getVisibility() != isVisible() )
1181 {
1182 const bool bVisibility( rAttrLayer->getVisibility() );
1183
1184 // visibilities differ - adjust ours, then
1185 if( mpAttributeLayer )
1186 mpAttributeLayer->setVisibility( bVisibility );
1187 else
1188 mbIsVisible = bVisibility;
1189 }
1190
1191 // END TEMP FIX
1192
1193 return true;
1194 }
1195
1196 return false;
1197 }
1198
1199 sal_Int32 DrawShape::getNumberOfTreeNodes( DocTreeNode::NodeType eNodeType ) const // throw ShapeLoadFailedException
1200 {
1201 return maSubsetting.getNumberOfTreeNodes( eNodeType );
1202 }
1203
1205 DocTreeNode::NodeType eNodeType ) const // throw ShapeLoadFailedException
1206 {
1207 if ( hasHyperlinks())
1208 {
1209 prepareHyperlinkIndices();
1210 }
1211
1212 return maSubsetting.getTreeNode( nNodeIndex, eNodeType );
1213 }
1214
1216 DocTreeNode::NodeType eNodeType ) const // throw ShapeLoadFailedException
1217 {
1218 return maSubsetting.getNumberOfSubsetTreeNodes( rParentNode, eNodeType );
1219 }
1220
1222 sal_Int32 nNodeIndex,
1223 DocTreeNode::NodeType eNodeType ) const // throw ShapeLoadFailedException
1224 {
1225 return maSubsetting.getSubsetTreeNode( rParentNode, nNodeIndex, eNodeType );
1226 }
1227}
1228
1229/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
::basegfx::B2DRectangle maBounds
ViewBackgroundShapeVector maViewShapes
bool IsAnimated() const
const sal_uInt8 * GetData() const
const OString & GetComment() const
sal_uInt32 GetDataSize() const
void scale(double fX, double fY)
B2DPoint getMaximum() const
B2DPoint getMinimum() const
TYPE getMaxX() const
TYPE getWidth() const
TYPE getMinX() const
TYPE getMinY() const
void expand(const Tuple2D< TYPE > &rTuple)
TYPE getMaxY() const
bool isInside(const Tuple2D< TYPE > &rTuple) const
bool isEmpty() const
TYPE getHeight() const
TYPE getWidth() const
void setWidth(TYPE const &rWidth)
TYPE getHeight() const
virtual void setTransformation(const ::basegfx::B2DHomMatrix &rMatrix)=0
Interface to retrieve DocTreeNodes from subsettable shapes.
This class represents kind of a DOM tree node for shape text.
Definition: doctreenode.hxx:45
NodeType
Type of shape entity represented by this node.
Definition: doctreenode.hxx:49
@ LogicalParagraph
This node represents a paragraph.
void addSubsetShape(const AttributableShapeSharedPtr &rShape)
Add child subset shape (or increase use count, if already existent)
const DocTreeNode & getSubsetNode() const
Return subset node for this shape.
void reset(const ::std::shared_ptr< GDIMetaFile > &rMtf)
Reset metafile.
bool revokeSubsetShape(const AttributableShapeSharedPtr &rShape)
Revoke subset shape.
AttributableShapeSharedPtr getSubsetShape(const DocTreeNode &rTreeNode) const
Get subset shape for given node, if any.
const VectorOfDocTreeNodes & getActiveSubsets() const
Return a vector of currently active subsets.
This class is the representation of a draw document's XShape, and implements the Shape,...
Definition: drawshape.hxx:57
State::StateId mnAttributeClipState
Definition: drawshape.hxx:312
HyperlinkIndexPairVector maHyperlinkIndices
Definition: drawshape.hxx:328
virtual bool revokeSubset(const AttributableShapeSharedPtr &rShape) override
Revoke a previously generated shape subset.
Definition: drawshape.cxx:1154
css::uno::Reference< css::drawing::XDrawPage > mxPage
Definition: drawshape.hxx:276
::basegfx::B2DRectangle getActualUnitShapeBounds() const
Definition: drawshape.cxx:231
virtual bool isContentChanged() const override
Query whether shape content changed.
Definition: drawshape.cxx:707
virtual void addViewLayer(const ViewLayerSharedPtr &rNewLayer, bool bRedrawLayer) override
Add a new view layer.
Definition: drawshape.cxx:616
virtual void leaveAnimationMode() override
Notify the Shape that it is no longer animated.
Definition: drawshape.cxx:1022
void setIntrinsicAnimationFrame(::std::size_t nCurrFrame)
Display next frame of an intrinsic animation.
Definition: drawshape.cxx:834
sal_uInt32 mnAnimationLoopCount
Number of times the bitmap animation shall loop.
Definition: drawshape.hxx:338
bool mbDrawingLayerAnim
whether a drawing layer animation has to be performed
Definition: drawshape.hxx:350
int mnIsAnimatedCount
Whether this shape is currently in animation mode (value != 0)
Definition: drawshape.hxx:335
State::StateId mnAttributePositionState
Definition: drawshape.hxx:314
bool implRender(UpdateFlags nUpdateFlags) const
Definition: drawshape.cxx:128
virtual bool update() const override
Update the shape.
Definition: drawshape.cxx:685
static DrawShapeSharedPtr create(const css::uno::Reference< css::drawing::XShape > &xShape, const css::uno::Reference< css::drawing::XDrawPage > &xContainingPage, double nPrio, bool bForeignSource, const SlideShowContext &rContext)
Create a shape for the given XShape.
State::StateId mnAttributeAlphaState
Definition: drawshape.hxx:313
virtual bool isVisible() const override
Query whether the shape is visible at all.
Definition: drawshape.cxx:795
virtual double getPriority() const override
Get the shape priority.
Definition: drawshape.cxx:819
virtual void clearAllViewLayers() override
Withdraw all view layers at once.
Definition: drawshape.cxx:680
GDIMetaFileSharedPtr const & forceScrollTextMetaFile()
forces the drawshape to load and return a specially crafted metafile, usable to display drawing layer...
Definition: drawshape.cxx:61
virtual ShapeAttributeLayerSharedPtr createAttributeLayer() override
Create a new shape attribute layer.
Definition: drawshape.cxx:1042
virtual ::basegfx::B2DRectangle getUpdateArea() const override
Get the current shape update area.
Definition: drawshape.cxx:728
DrawShape(const css::uno::Reference< css::drawing::XShape > &xShape, const css::uno::Reference< css::drawing::XDrawPage > &xContainingPage, double nPrio, bool bForeignSource, const SlideShowContext &rContext)
Create a shape for the given XShape.
virtual DocTreeNode getTreeNode(sal_Int32 nNodeIndex, DocTreeNode::NodeType eNodeType) const override
Create DocTreeNode from shape.
Definition: drawshape.cxx:1204
mutable ::std::optional< basegfx::B2DRectangle > maCurrentShapeUnitBounds
Contains the current shape bounds, in unit rect space.
Definition: drawshape.hxx:293
::std::pair< sal_Int32, sal_Int32 > HyperlinkIndexPair
hyperlink support
Definition: drawshape.hxx:326
std::weak_ptr< Activity > mpIntrinsicAnimationActivity
Definition: drawshape.hxx:307
virtual ::basegfx::B2DRectangle getDomBounds() const override
Get the DOM position and size of the shape.
Definition: drawshape.cxx:723
GDIMetaFileSharedPtr mpCurrMtf
Metafile of currently active frame (static for shapes w/o intrinsic animation)
Definition: drawshape.hxx:287
virtual void enterAnimationMode() override
Notify the Shape that an animation starts now.
Definition: drawshape.cxx:1006
bool mbIsVisible
Whether shape is visible (without attribute layers)
Definition: drawshape.hxx:341
virtual double getHyperlinkPriority() const override
Retrieve priority of link area.
Definition: drawshape.cxx:997
virtual const DocTreeNodeSupplier & getTreeNodeSupplier() const override
Retrieve interface for DocTreeNode creation.
Definition: drawshape.cxx:1090
virtual bool render() const override
Render the shape.
Definition: drawshape.cxx:697
virtual DocTreeNode getSubsetTreeNode(const DocTreeNode &rParentNode, sal_Int32 nNodeIndex, DocTreeNode::NodeType eNodeType) const override
Create DocTreeNode from shape subset.
Definition: drawshape.cxx:1221
ShapeAttributeLayerSharedPtr mpAttributeLayer
Definition: drawshape.hxx:304
int mnCurrMtfLoadFlags
loadflags of current meta file
Definition: drawshape.hxx:290
bool mbAttributeLayerRevoked
Whether attribute layer was revoked (making a redraw necessary)
Definition: drawshape.hxx:347
UpdateFlags getUpdateFlags() const
Definition: drawshape.cxx:172
DrawShapeSubsetting maSubsetting
Delegated subset handling.
Definition: drawshape.hxx:332
virtual bool createSubset(AttributableShapeSharedPtr &o_rSubset, const DocTreeNode &rTreeNode) override
Create a subset Shape.
Definition: drawshape.cxx:1112
VectorOfMtfAnimationFrames maAnimationFrames
A vector of metafiles actually representing the Shape.
Definition: drawshape.hxx:283
State::StateId mnAttributeTransformationState
Definition: drawshape.hxx:311
virtual bool revokeAttributeLayer(const ShapeAttributeLayerSharedPtr &rLayer) override
Revoke a previously generated attribute layer.
Definition: drawshape.cxx:1053
virtual HyperlinkRegions getHyperlinkRegions() const override
Request hyperlink-sensitive areas.
Definition: drawshape.cxx:917
State::StateId mnAttributeVisibilityState
Definition: drawshape.hxx:316
virtual DocTreeNode getSubsetNode() const override
Query the subset this shape displays.
Definition: drawshape.cxx:1100
css::uno::Reference< css::drawing::XShape > mxShape
The associated XShape.
Definition: drawshape.hxx:275
virtual void setVisibility(bool bVisible) override
Change default shape visibility.
Definition: drawshape.cxx:1081
ViewShape::RenderArgs getViewRenderArgs() const
Definition: drawshape.cxx:116
virtual AttributableShapeSharedPtr getSubset(const DocTreeNode &rTreeNode) const override
Query a subset Shape, if already existent at this object.
Definition: drawshape.cxx:1106
::basegfx::B2DRectangle maBounds
Definition: drawshape.hxx:297
virtual css::uno::Reference< css::drawing::XShape > getXShape() const override
Get the associated XShape of this shape.
Definition: drawshape.cxx:611
HyperlinkRegions maHyperlinkRegions
Definition: drawshape.hxx:329
virtual bool isBackgroundDetached() const override
Query whether the Shape is currently detached from the background.
Definition: drawshape.cxx:824
virtual ShapeAttributeLayerSharedPtr getTopmostAttributeLayer() const override
Get the topmost shape attribute layer (if any).
Definition: drawshape.cxx:1076
State::StateId mnAttributeContentState
Definition: drawshape.hxx:315
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
Definition: drawshape.hxx:322
virtual sal_Int32 getNumberOfTreeNodes(DocTreeNode::NodeType eNodeType) const override
Query number of tree nodes of the given type this shape contains.
Definition: drawshape.cxx:1199
bool mbForceUpdate
Whether redraw is necessary, regardless of state ids.
Definition: drawshape.hxx:344
virtual bool removeViewLayer(const ViewLayerSharedPtr &rNewLayer) override
Withdraw the shape from a view layer.
Definition: drawshape.cxx:651
bool mbContainsPageField
tdf#150402 whether mpCurrMtf contains any Text with a PageField ("FIELD_SEQ_BEGIN;PageField")
Definition: drawshape.hxx:353
virtual ~DrawShape() override
Definition: drawshape.cxx:595
void prepareHyperlinkIndices() const
Definition: drawshape.cxx:848
virtual sal_Int32 getNumberOfSubsetTreeNodes(const DocTreeNode &rParentNode, DocTreeNode::NodeType eNodeType) const override
Query number of tree nodes of the given type this subset contains.
Definition: drawshape.cxx:1215
virtual ::basegfx::B2DRectangle getBounds() const override
Get the current shape position and size.
Definition: drawshape.cxx:714
std::vector< HyperlinkRegion > HyperlinkRegions
#define ENSURE_OR_RETURN_FALSE(c, m)
#define ENSURE_OR_THROW(c, m)
#define DBG_UNHANDLED_EXCEPTION(...)
#define ENSURE_OR_RETURN_VOID(c, m)
sal_Int32 nIndex
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
std::shared_ptr< ::cppcanvas::Renderer > RendererSharedPtr
std::shared_ptr< Canvas > CanvasSharedPtr
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
::basegfx::B2DRectangle getShapePosSize(const ::basegfx::B2DRectangle &rOrigBounds, const ShapeAttributeLayerSharedPtr &pAttr)
Definition: tools.cxx:591
@ MTF_LOAD_FOREIGN_SOURCE
the source of the metafile might be a foreign application.
Definition: gdimtftools.hxx:50
@ MTF_LOAD_NONE
no flags
Definition: gdimtftools.hxx:45
@ MTF_LOAD_SCROLL_TEXT_MTF
retrieve the drawing layer scroll text metafile
Definition: gdimtftools.hxx:54
::std::shared_ptr< ViewShape > ViewShapeSharedPtr
Definition: viewshape.hxx:313
::basegfx::B2DRectangle getShapeUpdateArea(const ::basegfx::B2DRectangle &rUnitBounds, const ::basegfx::B2DHomMatrix &rShapeTransform, const ShapeAttributeLayerSharedPtr &pAttr)
Definition: tools.cxx:541
::std::shared_ptr< ShapeAttributeLayer > ShapeAttributeLayerSharedPtr
ActivitySharedPtr createIntrinsicAnimationActivity(const SlideShowContext &rContext, const DrawShapeSharedPtr &rDrawShape, const WakeupEventSharedPtr &rWakeupEvent, ::std::vector< double > &&rTimeouts, sal_uInt32 nNumLoops)
Create an IntrinsicAnimationActivity.
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
Definition: tools.hxx:278
::std::vector< DocTreeNode > VectorOfDocTreeNodes
::std::shared_ptr< Activity > ActivitySharedPtr
Definition: activity.hxx:83
std::shared_ptr< ViewLayer > ViewLayerSharedPtr
Definition: viewlayer.hxx:168
::basegfx::B2DHomMatrix getShapeTransformation(const ::basegfx::B2DRectangle &rShapeBounds, const ShapeAttributeLayerSharedPtr &pAttr)
Definition: tools.cxx:456
::std::shared_ptr< DrawShape > DrawShapeSharedPtr
Definition: drawshape.hxx:43
std::shared_ptr< Activity > createDrawingLayerAnimActivity(SlideShowContext const &rContext, std::shared_ptr< DrawShape > const &pDrawShape)
::basegfx::B2DRectangle getAPIShapeBounds(const uno::Reference< drawing::XShape > &xShape)
Definition: tools.cxx:718
std::shared_ptr< GDIMetaFile > GDIMetaFileSharedPtr
Definition: tools.hxx:63
bool getRectanglesFromScrollMtf(::basegfx::B2DRectangle &o_rScrollRect, ::basegfx::B2DRectangle &o_rPaintRect, const GDIMetaFileSharedPtr &rMtf)
Retrieve scroll text animation rectangles from given metafile.
bool getAnimationFromGraphic(VectorOfMtfAnimationFrames &o_rFrames, sal_uInt32 &o_rLoopCount, const Graphic &rGraphic)
Extract a vector of animation frames from given Graphic.
GDIMetaFileSharedPtr getMetaFile(const uno::Reference< lang::XComponent > &xSource, const uno::Reference< drawing::XDrawPage > &xContainingPage, int mtfLoadFlags, const uno::Reference< uno::XComponentContext > &rxContext)
sal_Int32 getNextActionOffset(MetaAction *pCurrAct)
Gets the next action offset for iterating meta actions which is most often returns 1.
::std::shared_ptr< AttributableShape > AttributableShapeSharedPtr
::std::shared_ptr< WakeupEvent > WakeupEventSharedPtr
Definition: wakeupevent.hxx:77
uno::Reference< drawing::XShape > const mxShape
double mnPriority
Definition: slideview.cxx:86
double getDuration() const
Enables STL algos to be used for duration extraction.
Definition: gdimtftools.hxx:70
Common arguments for slideshow objects.
std::shared_ptr< SubsettableShapeManager > & mpSubsettableShapeManager
bool bVisible
#define SAL_MAX_INT16
sal_uInt16 sal_Unicode
UpdateFlags
Definition: viewshape.hxx:39
size_t pos