1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SDXMLEXP_IMPL_HXX 29 #define _SDXMLEXP_IMPL_HXX 30 31 #include <xmloff/xmlexp.hxx> 32 33 34 #include <com/sun/star/frame/XModel.hpp> 35 #include <com/sun/star/task/XStatusIndicator.hpp> 36 #include <com/sun/star/container/XNameAccess.hpp> 37 #include <com/sun/star/drawing/XDrawPage.hpp> 38 #include <comphelper/stl_types.hxx> 39 40 ////////////////////////////////////////////////////////////////////////////// 41 42 class SvXMLUnitConverter; 43 class SvXMLExportItemMapper; 44 class SfxPoolItem; 45 class SfxItemSet; 46 class OUStrings_Impl; 47 class OUStringsSort_Impl; 48 class Rectangle; 49 50 class ImpPresPageDrawStylePropMapper; 51 class ImpXMLEXPPageMasterList; 52 class ImpXMLEXPPageMasterInfo; 53 class ImpXMLDrawPageInfoList; 54 class ImpXMLAutoLayoutInfoList; 55 class SvXMLAutoStylePoolP; 56 class XMLSdPropHdlFactory; 57 class ImpXMLShapeStyleInfo; 58 class XMLShapeExportPropertyMapper; 59 class XMLPageExportPropertyMapper; 60 61 ////////////////////////////////////////////////////////////////////////////// 62 63 enum XmlPlaceholder 64 { 65 XmlPlaceholderTitle, 66 XmlPlaceholderOutline, 67 XmlPlaceholderSubtitle, 68 XmlPlaceholderText, 69 XmlPlaceholderGraphic, 70 XmlPlaceholderObject, 71 XmlPlaceholderChart, 72 XmlPlaceholderOrgchart, 73 XmlPlaceholderTable, 74 XmlPlaceholderPage, 75 XmlPlaceholderNotes, 76 XmlPlaceholderHandout, 77 XmlPlaceholderVerticalTitle, 78 XmlPlaceholderVerticalOutline 79 }; 80 81 DECLARE_STL_STDKEY_SET( sal_Int32, SdXMLFormatMap ); 82 83 ////////////////////////////////////////////////////////////////////////////// 84 85 struct HeaderFooterPageSettingsImpl 86 { 87 rtl::OUString maStrHeaderDeclName; 88 rtl::OUString maStrFooterDeclName; 89 rtl::OUString maStrDateTimeDeclName; 90 }; 91 92 struct DateTimeDeclImpl 93 { 94 rtl::OUString maStrText; 95 sal_Bool mbFixed; 96 sal_Int32 mnFormat; 97 }; 98 99 100 ////////////////////////////////////////////////////////////////////////////// 101 102 class SdXMLExport : public SvXMLExport 103 { 104 com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxDocStyleFamilies; 105 com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocMasterPages; 106 com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocDrawPages; 107 sal_Int32 mnDocMasterPageCount; 108 sal_Int32 mnDocDrawPageCount; 109 sal_uInt32 mnShapeStyleInfoIndex; 110 sal_uInt32 mnObjectCount; 111 112 // temporary infos 113 ImpXMLEXPPageMasterList* mpPageMasterInfoList; 114 ImpXMLEXPPageMasterList* mpPageMasterUsageList; 115 ImpXMLEXPPageMasterList* mpNotesPageMasterUsageList; 116 ImpXMLEXPPageMasterInfo* mpHandoutPageMaster; 117 ImpXMLAutoLayoutInfoList* mpAutoLayoutInfoList; 118 119 com::sun::star::uno::Sequence< ::rtl::OUString > maDrawPagesAutoLayoutNames; 120 121 ::std::vector< ::rtl::OUString > maDrawPagesStyleNames; 122 ::std::vector< ::rtl::OUString > maDrawNotesPagesStyleNames; 123 ::std::vector< ::rtl::OUString > maMasterPagesStyleNames; 124 ::rtl::OUString maHandoutMasterStyleName; 125 ::std::vector< HeaderFooterPageSettingsImpl > maDrawPagesHeaderFooterSettings; 126 ::std::vector< HeaderFooterPageSettingsImpl > maDrawNotesPagesHeaderFooterSettings; 127 128 ::std::vector< ::rtl::OUString > maHeaderDeclsVector; 129 ::std::vector< ::rtl::OUString > maFooterDeclsVector; 130 ::std::vector< DateTimeDeclImpl > maDateTimeDeclsVector; 131 132 HeaderFooterPageSettingsImpl maHandoutPageHeaderFooterSettings; 133 134 XMLSdPropHdlFactory* mpSdPropHdlFactory; 135 XMLShapeExportPropertyMapper* mpPropertySetMapper; 136 XMLPageExportPropertyMapper* mpPresPagePropsMapper; 137 138 SdXMLFormatMap maUsedDateStyles; // this is a vector with the used formatings for date fields 139 SdXMLFormatMap maUsedTimeStyles; // this is a vector with the used formatings for time fields 140 141 sal_Bool mbIsDraw; 142 sal_Bool mbFamilyGraphicUsed; 143 sal_Bool mbFamilyPresentationUsed; 144 145 const rtl::OUString msZIndex; 146 const rtl::OUString msEmptyPres; 147 const rtl::OUString msModel; 148 const rtl::OUString msStartShape; 149 const rtl::OUString msEndShape; 150 const rtl::OUString msPageLayoutNames; 151 152 virtual void _ExportStyles(sal_Bool bUsed); 153 virtual void _ExportAutoStyles(); 154 virtual void _ExportMasterStyles(); 155 virtual void _ExportContent(); 156 // #82003# 157 virtual void _ExportMeta(); 158 159 ImpXMLEXPPageMasterInfo* ImpGetOrCreatePageMasterInfo( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xMasterPage ); 160 void ImpPrepPageMasterInfos(); 161 void ImpPrepDrawMasterInfos(); 162 void ImpWritePageMasterInfos(); 163 void ImpPrepAutoLayoutInfos(); 164 HeaderFooterPageSettingsImpl ImpPrepDrawPageHeaderFooterDecls( const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xDrawPage ); 165 ImpXMLEXPPageMasterInfo* ImpGetPageMasterInfoByName(const rtl::OUString& rName); 166 167 void ImpPrepDrawPageInfos(); 168 void ImpPrepMasterPageInfos(); 169 void ImpWritePresentationStyles(); 170 ::rtl::OUString ImpCreatePresPageStyleName( com::sun::star::uno::Reference<com::sun::star::drawing::XDrawPage> xDrawPage, bool bExportBackground = true ); 171 172 sal_Bool ImpPrepAutoLayoutInfo(const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xPage, rtl::OUString& rName); 173 void ImpWriteAutoLayoutInfos(); 174 void ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectangle& rRect); 175 void ImpWriteHeaderFooterDecls(); 176 void ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings ); 177 178 void exportFormsElement( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage ); 179 void exportPresentationSettings(); 180 181 // #82003# helper function for recursive object count 182 sal_uInt32 ImpRecursiveObjectCount( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xShapes); 183 184 rtl::OUString getNavigationOrder( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage ); 185 186 void collectAnnotationAutoStyles( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage ); 187 void exportAnnotations( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage ); 188 189 protected: 190 virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps); 191 virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps); 192 193 public: 194 // #110680# 195 SdXMLExport( 196 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, 197 sal_Bool bIsDraw, sal_uInt16 nExportFlags = EXPORT_ALL ); 198 virtual ~SdXMLExport(); 199 200 void SetProgress(sal_Int32 nProg); 201 202 // XExporter 203 virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 204 205 // get factories and mappers 206 XMLSdPropHdlFactory* GetSdPropHdlFactory() const { return mpSdPropHdlFactory; } 207 XMLShapeExportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper; } 208 XMLPageExportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper; } 209 210 sal_Bool IsDraw() const { return mbIsDraw; } 211 sal_Bool IsImpress() const { return !mbIsDraw; } 212 213 sal_Bool IsFamilyGraphicUsed() const { return mbFamilyGraphicUsed; } 214 void SetFamilyGraphicUsed() { mbFamilyGraphicUsed = sal_True; } 215 sal_Bool IsFamilyPresentationUsed() const { return mbFamilyPresentationUsed; } 216 void SetFamilyPresentationUsed() { mbFamilyPresentationUsed = sal_True; } 217 218 virtual void addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ); 219 virtual void exportDataStyles(); 220 virtual void exportAutoDataStyles(); 221 virtual rtl::OUString getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ) const; 222 223 // XServiceInfo ( : SvXMLExport ) 224 virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); 225 }; 226 227 #endif // _SDXMLEXP_HXX 228 229