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: xmlexp.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 ************************************************************************/
34 #include <xmloff/xmlexp.hxx>
35 #include "xmlitmap.hxx"
36 #include <xmloff/uniref.hxx>
37 #include <xmloff/xmltoken.hxx>
42 class SvXMLUnitConverter
;
43 class SvXMLExportItemMapper
;
44 class SvXMLAutoStylePoolP
;
48 class SwXMLTableColumn_Impl
;
49 class SwXMLTableLines_Impl
;
50 class SwXMLTableLinesCache_Impl
;
51 class SwXMLTableColumnsSortByWidth_Impl
;
52 class SwXMLTableFrmFmtsSort_Impl
;
53 class SwXMLTableInfo_Impl
;
55 class XMLPropertySetMapper
;
57 class SwXMLExport
: public SvXMLExport
59 friend class SwXMLExpContext
;
62 SwPaM
*pCurPaM
; // the current PaM
63 SwPaM
*pOrigPaM
; // the original PaM
66 SvXMLUnitConverter
*pTwipUnitConv
;
68 SvXMLExportItemMapper
*pTableItemMapper
;
69 SwXMLTableLinesCache_Impl
*pTableLines
;
71 SvXMLItemMapEntriesRef xTableItemMap
;
72 SvXMLItemMapEntriesRef xTableRowItemMap
;
73 SvXMLItemMapEntriesRef xTableCellItemMap
;
74 UniReference
< XMLPropertySetMapper
> xParaPropMapper
;
76 sal_Bool bExportWholeDoc
: 1;// export whole document?
77 sal_Bool bBlock
: 1; // export text block?
78 sal_Bool bExportFirstTableOnly
: 1;
79 sal_Bool bShowProgress
: 1;
80 sal_Bool bSavedShowChanges
: 1;
82 void _InitItemExport();
83 void _FinitItemExport();
84 void ExportTableLinesAutoStyles( const SwTableLines
& rLines
,
86 sal_uInt32 nBaseWidth
,
87 const ::rtl::OUString
& rNamePrefix
,
88 SwXMLTableColumnsSortByWidth_Impl
& rExpCols
,
89 SwXMLTableFrmFmtsSort_Impl
& rExpRows
,
90 SwXMLTableFrmFmtsSort_Impl
& rExpCells
,
91 SwXMLTableInfo_Impl
& rTblInfo
,
92 sal_Bool bTop
=sal_False
);
95 void ExportFmt( const SwFmt
& rFmt
, enum ::xmloff::token::XMLTokenEnum eClass
= ::xmloff::token::XML_TOKEN_INVALID
);
96 void ExportTableFmt( const SwFrmFmt
& rFmt
, sal_uInt32 nAbsWidth
);
98 void ExportTableColumnStyle( const SwXMLTableColumn_Impl
& rCol
);
99 void ExportTableBox( const SwTableBox
& rBox
, sal_uInt16 nColSpan
, sal_uInt16 nRowSpan
,
100 SwXMLTableInfo_Impl
& rTblInfo
);
101 void ExportTableLine( const SwTableLine
& rLine
,
102 const SwXMLTableLines_Impl
& rLines
,
103 SwXMLTableInfo_Impl
& rTblInfo
);
104 void ExportTableLines( const SwTableLines
& rLines
,
105 SwXMLTableInfo_Impl
& rTblInfo
,
106 USHORT nHeaderRows
= 0 );
108 virtual void _ExportMeta();
109 virtual void _ExportFontDecls();
110 virtual void _ExportStyles( sal_Bool bUsed
);
111 virtual void _ExportAutoStyles();
112 virtual void _ExportMasterStyles();
113 virtual void SetBodyAttributes();
114 virtual void _ExportContent();
115 virtual void GetViewSettings(com::sun::star::uno::Sequence
<com::sun::star::beans::PropertyValue
>& aProps
);
116 virtual void GetConfigurationSettings(com::sun::star::uno::Sequence
<com::sun::star::beans::PropertyValue
>& aProps
);
117 virtual sal_Int32
GetDocumentSpecificSettings( ::std::list
< SettingsGroup
>& _out_rSettings
);
120 void SetCurPaM( SwPaM
& rPaM
, sal_Bool bWhole
, sal_Bool bTabOnly
);
123 // string constants for table cell export
124 const ::rtl::OUString sNumberFormat
;
125 const ::rtl::OUString sIsProtected
;
126 const ::rtl::OUString sCell
;
132 virtual XMLTextParagraphExport
* CreateTextParagraphExport();
133 virtual SvXMLAutoStylePoolP
* CreateAutoStylePool();
134 virtual XMLPageExport
* CreatePageExport();
135 virtual XMLShapeExport
* CreateShapeExport();
136 virtual XMLFontAutoStylePool
* CreateFontAutoStylePool();
142 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xServiceFactory
,
143 sal_uInt16 nExportFlags
= EXPORT_ALL
);
148 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xServiceFactory
,
149 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> & rModel
,
151 const ::rtl::OUString
& rFileName
,
152 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> & rHandler
,
153 const ::com::sun::star::uno::Reference
< ::com::sun::star::document::XGraphicObjectResolver
> &,
154 sal_Bool bExpWholeDoc
,
155 sal_Bool bExpFirstTableOnly
,
156 sal_Bool bShowProgr
);
158 virtual ~SwXMLExport();
160 virtual sal_uInt32
exportDoc( enum ::xmloff::token::XMLTokenEnum eClass
= ::xmloff::token::XML_TOKEN_INVALID
);
162 inline const SvXMLUnitConverter
& GetTwipUnitConverter() const;
164 void ExportTableAutoStyles( const SwTableNode
& rTblNd
);
165 void ExportTable( const SwTableNode
& rTblNd
);
167 SvXMLExportItemMapper
& GetTableItemMapper() { return *pTableItemMapper
; }
168 const UniReference
< XMLPropertySetMapper
>& GetParaPropMapper()
170 return xParaPropMapper
;
173 sal_Bool
IsShowProgress() const { return bShowProgress
; }
174 void SetShowProgress( sal_Bool b
) { bShowProgress
= b
; }
175 sal_Bool
IsBlockMode() const { return bBlock
; }
178 static const ::com::sun::star::uno::Sequence
< sal_Int8
> & getUnoTunnelId() throw();
179 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
181 // XServiceInfo (override parent method)
182 ::rtl::OUString SAL_CALL
getImplementationName()
183 throw( ::com::sun::star::uno::RuntimeException
);
186 inline const SvXMLUnitConverter
& SwXMLExport::GetTwipUnitConverter() const
188 return *pTwipUnitConv
;
192 #endif // _XMLEXP_HXX