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: ximpnote.cxx,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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include "ximpnote.hxx"
34 #include <com/sun/star/presentation/XPresentationPage.hpp>
36 using ::rtl::OUString
;
37 using ::rtl::OUStringBuffer
;
39 using namespace ::com::sun::star
;
41 //////////////////////////////////////////////////////////////////////////////
43 SdXMLNotesContext::SdXMLNotesContext( SdXMLImport
& rImport
,
44 USHORT nPrfx
, const OUString
& rLocalName
,
45 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
46 uno::Reference
< drawing::XShapes
>& rShapes
)
47 : SdXMLGenericPageContext( rImport
, nPrfx
, rLocalName
, xAttrList
, rShapes
)
51 const sal_Int16 nAttrCount
= xAttrList
.is() ? xAttrList
->getLength() : 0;
52 for(sal_Int16 i
=0; i
< nAttrCount
; i
++)
54 OUString sAttrName
= xAttrList
->getNameByIndex( i
);
56 sal_uInt16 nPrefix
= GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName
, &aLocalName
);
57 OUString sValue
= xAttrList
->getValueByIndex( i
);
58 const SvXMLTokenMap
& rAttrTokenMap
= GetSdImport().GetMasterPageAttrTokenMap();
60 switch(rAttrTokenMap
.Get(nPrefix
, aLocalName
))
62 case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME
:
64 msPageMasterName
= sValue
;
67 case XML_TOK_MASTERPAGE_STYLE_NAME
:
72 case XML_TOK_MASTERPAGE_USE_HEADER_NAME
:
74 maUseHeaderDeclName
= sValue
;
77 case XML_TOK_MASTERPAGE_USE_FOOTER_NAME
:
79 maUseFooterDeclName
= sValue
;
82 case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME
:
84 maUseDateTimeDeclName
= sValue
;
91 SetStyle( sStyleName
);
93 // now delete all up-to-now contained shapes from this notes page
94 uno::Reference
< drawing::XShape
> xShape
;
95 while(rShapes
->getCount())
97 rShapes
->getByIndex(0L) >>= xShape
;
99 rShapes
->remove(xShape
);
103 if(msPageMasterName
.getLength())
105 SetPageMaster( msPageMasterName
);
109 //////////////////////////////////////////////////////////////////////////////
111 SdXMLNotesContext::~SdXMLNotesContext()
115 //////////////////////////////////////////////////////////////////////////////
117 SvXMLImportContext
*SdXMLNotesContext::CreateChildContext( USHORT nPrefix
,
118 const OUString
& rLocalName
,
119 const uno::Reference
< xml::sax::XAttributeList
>& xAttrList
)
121 // OK, notes page is set on base class, objects can be imported on notes page
122 SvXMLImportContext
*pContext
= 0L;
124 // some special objects inside presentation:notes context
133 // call parent when no own context was created
135 pContext
= SdXMLGenericPageContext::CreateChildContext(nPrefix
, rLocalName
, xAttrList
);
140 //////////////////////////////////////////////////////////////////////////////
142 void SdXMLNotesContext::EndElement()
144 SdXMLGenericPageContext::EndElement();