merge the formfield patch from ooo-build
[ooovba.git] / slideshow / source / engine / shapes / gdimtftools.hxx
blob077e4768a45f11bafb5ff4d5101a05e05d4702b1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: gdimtftools.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_SLIDESHOW_GDIMTFTOOLS_HXX
32 #define INCLUDED_SLIDESHOW_GDIMTFTOOLS_HXX
34 #include <com/sun/star/uno/Reference.hxx>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <com/sun/star/lang/XComponent.hpp>
37 #include <com/sun/star/drawing/XDrawPage.hpp>
39 #include <basegfx/range/b2drectangle.hxx>
40 #include <boost/shared_ptr.hpp>
42 #include "tools.hxx"
44 #include <vector>
46 class MetaAction;
47 class GDIMetaFile;
48 class Graphic;
50 // -----------------------------------------------------------------------------
52 namespace slideshow
54 namespace internal
56 /// meta file loading specialities:
57 enum mtf_load_flags {
58 /// no flags
59 MTF_LOAD_NONE = 0,
60 /// annotate text actions with verbose comments,
61 /// denoting logical and physical text entities.
62 MTF_LOAD_VERBOSE_COMMENTS = 1,
63 /// the source of the metafile might be a foreign
64 /// application. The metafile is checked against unsupported
65 /// content, and, if necessary, returned as a pre-rendererd
66 /// bitmap.
67 MTF_LOAD_FOREIGN_SOURCE = 2,
68 /// retrieve a meta file for the page background only
69 MTF_LOAD_BACKGROUND_ONLY = 4,
70 /// retrieve the drawing layer scroll text metafile
71 MTF_LOAD_SCROLL_TEXT_MTF = 8
74 // Animation info
75 // ==============
77 struct MtfAnimationFrame
79 MtfAnimationFrame( const GDIMetaFileSharedPtr& rMtf,
80 double nDuration ) :
81 mpMtf( rMtf ),
82 mnDuration( nDuration )
86 /// Enables STL algos to be used for duration extraction
87 double getDuration() const
89 return mnDuration;
92 GDIMetaFileSharedPtr mpMtf;
93 double mnDuration;
96 typedef ::std::vector< MtfAnimationFrame > VectorOfMtfAnimationFrames;
99 /** Retrieve a meta file for the given shape
101 @param xShape
102 XShape to retrieve a metafile for.
104 @param xContainingPage
105 The page that contains this shape. Needed for proper
106 import (currently, the UnoGraphicExporter needs this
107 information).
109 @param o_rMtf
110 Metafile to extract shape content into
112 bool getMetaFile( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xSource,
113 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xContainingPage,
114 GDIMetaFile& o_rMtf,
115 int mtfLoadFlags,
116 const ::com::sun::star::uno::Reference<
117 ::com::sun::star::uno::XComponentContext >& rxContext );
119 /** Remove all text actions from the given metafile.
121 void removeTextActions( GDIMetaFile& io_rMtf );
123 /** Gets the next action offset for iterating meta actions which is most
124 often returns 1.
126 sal_Int32 getNextActionOffset( MetaAction * pCurrAct );
128 /** Extract a vector of animation frames from given Graphic.
130 @param o_rFrames
131 Resulting vector of animated metafiles
133 @param o_rLoopCount
134 Number of times the bitmap animation shall be repeated
136 @param o_eCycleMode
137 Repeat mode (normal, or ping-pong mode)
139 @param rGraphic
140 Input graphic object, to extract animations from
142 bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames,
143 ::std::size_t& o_rLoopCount,
144 CycleMode& o_eCycleMode,
145 const Graphic& rGraphic );
147 /** Retrieve scroll text animation rectangles from given metafile
149 @return true, if both rectangles have been found, false
150 otherwise.
152 bool getRectanglesFromScrollMtf( ::basegfx::B2DRectangle& o_rScrollRect,
153 ::basegfx::B2DRectangle& o_rPaintRect,
154 const GDIMetaFileSharedPtr& rMtf );
158 #endif /* INCLUDED_SLIDESHOW_GDIMTFTOOLS_HXX */