1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile: xmlfilterbase.hxx,v $
9 * last change: $Author: rt $ $Date: 2008-01-17 08:05:44 $
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 ************************************************************************/
36 #ifndef OOX_CORE_XMLFILTERBASE_HXX
37 #define OOX_CORE_XMLFILTERBASE_HXX
39 #include <rtl/ref.hxx>
40 #include "oox/vml/drawing.hxx"
41 #include "oox/core/filterbase.hxx"
42 #include "oox/core/recordinfoprovider.hxx"
43 #include "oox/core/relations.hxx"
45 namespace com
{ namespace sun
{ namespace star
{
46 namespace container
{ class XNameContainer
; }
47 namespace xml
{ namespace sax
{ class XLocator
; } }
48 namespace xml
{ namespace sax
{ class XFastDocumentHandler
; } }
54 class FragmentHandler
;
56 // ============================================================================
58 struct XmlFilterBaseImpl
;
60 class XmlFilterBase
: public FilterBase
63 explicit XmlFilterBase(
64 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& rxFactory
);
66 virtual ~XmlFilterBase();
68 /** Has to be implemented by each filter to resolve scheme colors. */
69 virtual sal_Int32
getSchemeClr( sal_Int32 nColorSchemeToken
) const = 0;
71 /** Has to be implemented by each filter to return drawings collection. */
72 virtual const ::oox::vml::DrawingPtr
getDrawings() = 0;
74 /** Has to be implemented by each filter that supports binary streams. */
75 virtual RecordInfoProviderRef
getRecordInfoProvider();
77 // ------------------------------------------------------------------------
79 /** Returns the fragment path for the passed type, used for fragments
80 referred by the root relations. */
81 ::rtl::OUString
getFragmentPathFromType( const ::rtl::OUString
& rType
);
83 /** Imports a fragment using the passed fragment handler, which contains
84 the full path to the fragment stream.
86 @return True, if the fragment could be imported.
88 bool importFragment( const ::rtl::Reference
< FragmentHandler
>& rxHandler
);
90 /** Imports the relations fragment associated with the specified fragment.
92 @return The relations collection of the specified fragment.
94 RelationsRef
importRelations( const ::rtl::OUString
& rFragmentPath
);
96 /** Copies the picture element specified with rPicturePath from the source
97 document to the target models picture substorage.
99 @return The URL of the picture in the target models storage.
101 ::rtl::OUString
copyPictureStream( const ::rtl::OUString
& rPicturePath
);
103 /** needs to be holded throughout the whole import, allows to create new arrow names... */
104 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
>&
105 getMarkerTable() const;
108 virtual StorageRef
implCreateStorage(
109 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& rxInStream
,
110 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
>& rxOutStream
) const;
113 ::std::auto_ptr
< XmlFilterBaseImpl
> mxImpl
;
116 typedef ::rtl::Reference
< XmlFilterBase
> XmlFilterRef
;
118 // ============================================================================