Line data Source code
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 :
20 : #ifndef INCLUDED_SLIDESHOW_GDIMTFTOOLS_HXX
21 : #define INCLUDED_SLIDESHOW_GDIMTFTOOLS_HXX
22 :
23 : #include <com/sun/star/uno/Reference.hxx>
24 : #include <com/sun/star/uno/XComponentContext.hpp>
25 : #include <com/sun/star/lang/XComponent.hpp>
26 : #include <com/sun/star/drawing/XDrawPage.hpp>
27 :
28 : #include <basegfx/range/b2drectangle.hxx>
29 : #include <boost/shared_ptr.hpp>
30 :
31 : #include "tools.hxx"
32 :
33 : #include <vector>
34 :
35 : class MetaAction;
36 : class GDIMetaFile;
37 : class Graphic;
38 :
39 : // -----------------------------------------------------------------------------
40 :
41 : namespace slideshow
42 : {
43 : namespace internal
44 : {
45 : /// meta file loading specialities:
46 : enum mtf_load_flags {
47 : /// no flags
48 : MTF_LOAD_NONE = 0,
49 : /// the source of the metafile might be a foreign
50 : /// application. The metafile is checked against unsupported
51 : /// content, and, if necessary, returned as a pre-rendererd
52 : /// bitmap.
53 : MTF_LOAD_FOREIGN_SOURCE = 2,
54 : /// retrieve a meta file for the page background only
55 : MTF_LOAD_BACKGROUND_ONLY = 4,
56 : /// retrieve the drawing layer scroll text metafile
57 : MTF_LOAD_SCROLL_TEXT_MTF = 8
58 : };
59 :
60 : // Animation info
61 : // ==============
62 :
63 0 : struct MtfAnimationFrame
64 : {
65 0 : MtfAnimationFrame( const GDIMetaFileSharedPtr& rMtf,
66 : double nDuration ) :
67 : mpMtf( rMtf ),
68 0 : mnDuration( nDuration )
69 : {
70 0 : }
71 :
72 : /// Enables STL algos to be used for duration extraction
73 0 : double getDuration() const
74 : {
75 0 : return mnDuration;
76 : }
77 :
78 : GDIMetaFileSharedPtr mpMtf;
79 : double mnDuration;
80 : };
81 :
82 : typedef ::std::vector< MtfAnimationFrame > VectorOfMtfAnimationFrames;
83 :
84 :
85 : /** Retrieve a meta file for the given shape
86 :
87 : @param xShape
88 : XShape to retrieve a metafile for.
89 :
90 : @param xContainingPage
91 : The page that contains this shape. Needed for proper
92 : import (currently, the UnoGraphicExporter needs this
93 : information).
94 :
95 : @param o_rMtf
96 : Metafile to extract shape content into
97 : */
98 : bool getMetaFile( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xSource,
99 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xContainingPage,
100 : GDIMetaFile& o_rMtf,
101 : int mtfLoadFlags,
102 : const ::com::sun::star::uno::Reference<
103 : ::com::sun::star::uno::XComponentContext >& rxContext );
104 :
105 : /** Gets the next action offset for iterating meta actions which is most
106 : often returns 1.
107 : */
108 : sal_Int32 getNextActionOffset( MetaAction * pCurrAct );
109 :
110 : /** Extract a vector of animation frames from given Graphic.
111 :
112 : @param o_rFrames
113 : Resulting vector of animated metafiles
114 :
115 : @param o_rLoopCount
116 : Number of times the bitmap animation shall be repeated
117 :
118 : @param o_eCycleMode
119 : Repeat mode (normal, or ping-pong mode)
120 :
121 : @param rGraphic
122 : Input graphic object, to extract animations from
123 : */
124 : bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames,
125 : ::std::size_t& o_rLoopCount,
126 : CycleMode& o_eCycleMode,
127 : const Graphic& rGraphic );
128 :
129 : /** Retrieve scroll text animation rectangles from given metafile
130 :
131 : @return true, if both rectangles have been found, false
132 : otherwise.
133 : */
134 : bool getRectanglesFromScrollMtf( ::basegfx::B2DRectangle& o_rScrollRect,
135 : ::basegfx::B2DRectangle& o_rPaintRect,
136 : const GDIMetaFileSharedPtr& rMtf );
137 : }
138 : }
139 :
140 : #endif /* INCLUDED_SLIDESHOW_GDIMTFTOOLS_HXX */
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|