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 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_xmloff.hxx" 30 #include "ximpnote.hxx" 31 #include <com/sun/star/presentation/XPresentationPage.hpp> 32 33 using ::rtl::OUString; 34 using ::rtl::OUStringBuffer; 35 36 using namespace ::com::sun::star; 37 38 ////////////////////////////////////////////////////////////////////////////// 39 40 SdXMLNotesContext::SdXMLNotesContext( SdXMLImport& rImport, 41 sal_uInt16 nPrfx, const OUString& rLocalName, 42 const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 43 uno::Reference< drawing::XShapes >& rShapes) 44 : SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ) 45 { 46 OUString sStyleName; 47 48 const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; 49 for(sal_Int16 i=0; i < nAttrCount; i++) 50 { 51 OUString sAttrName = xAttrList->getNameByIndex( i ); 52 OUString aLocalName; 53 sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); 54 OUString sValue = xAttrList->getValueByIndex( i ); 55 const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap(); 56 57 switch(rAttrTokenMap.Get(nPrefix, aLocalName)) 58 { 59 case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME: 60 { 61 msPageMasterName = sValue; 62 break; 63 } 64 case XML_TOK_MASTERPAGE_STYLE_NAME: 65 { 66 sStyleName = sValue; 67 break; 68 } 69 case XML_TOK_MASTERPAGE_USE_HEADER_NAME: 70 { 71 maUseHeaderDeclName = sValue; 72 break; 73 } 74 case XML_TOK_MASTERPAGE_USE_FOOTER_NAME: 75 { 76 maUseFooterDeclName = sValue; 77 break; 78 } 79 case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME: 80 { 81 maUseDateTimeDeclName = sValue; 82 break; 83 } 84 85 } 86 } 87 88 SetStyle( sStyleName ); 89 90 // now delete all up-to-now contained shapes from this notes page 91 uno::Reference< drawing::XShape > xShape; 92 while(rShapes->getCount()) 93 { 94 rShapes->getByIndex(0L) >>= xShape; 95 if(xShape.is()) 96 rShapes->remove(xShape); 97 } 98 99 // set page-master? 100 if(msPageMasterName.getLength()) 101 { 102 SetPageMaster( msPageMasterName ); 103 } 104 } 105 106 ////////////////////////////////////////////////////////////////////////////// 107 108 SdXMLNotesContext::~SdXMLNotesContext() 109 { 110 } 111 112 ////////////////////////////////////////////////////////////////////////////// 113 114 SvXMLImportContext *SdXMLNotesContext::CreateChildContext( sal_uInt16 nPrefix, 115 const OUString& rLocalName, 116 const uno::Reference< xml::sax::XAttributeList>& xAttrList ) 117 { 118 // OK, notes page is set on base class, objects can be imported on notes page 119 SvXMLImportContext *pContext = 0L; 120 121 // some special objects inside presentation:notes context 122 // ... 123 124 125 126 127 128 129 130 // call parent when no own context was created 131 if(!pContext) 132 pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList); 133 134 return pContext; 135 } 136 137 ////////////////////////////////////////////////////////////////////////////// 138 139 void SdXMLNotesContext::EndElement() 140 { 141 SdXMLGenericPageContext::EndElement(); 142 } 143