1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: gdimtftools.hxx,v $
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>
50 // -----------------------------------------------------------------------------
56 /// meta file loading specialities:
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
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
77 struct MtfAnimationFrame
79 MtfAnimationFrame( const GDIMetaFileSharedPtr
& rMtf
,
82 mnDuration( nDuration
)
86 /// Enables STL algos to be used for duration extraction
87 double getDuration() const
92 GDIMetaFileSharedPtr mpMtf
;
96 typedef ::std::vector
< MtfAnimationFrame
> VectorOfMtfAnimationFrames
;
99 /** Retrieve a meta file for the given shape
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
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
,
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
126 sal_Int32
getNextActionOffset( MetaAction
* pCurrAct
);
128 /** Extract a vector of animation frames from given Graphic.
131 Resulting vector of animated metafiles
134 Number of times the bitmap animation shall be repeated
137 Repeat mode (normal, or ping-pong mode)
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
152 bool getRectanglesFromScrollMtf( ::basegfx::B2DRectangle
& o_rScrollRect
,
153 ::basegfx::B2DRectangle
& o_rPaintRect
,
154 const GDIMetaFileSharedPtr
& rMtf
);
158 #endif /* INCLUDED_SLIDESHOW_GDIMTFTOOLS_HXX */