1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "ximpnote.hxx"
21 #include <com/sun/star/presentation/XPresentationPage.hpp>
23 using namespace ::com::sun::star
;
25 SdXMLNotesContext::SdXMLNotesContext( SdXMLImport
& rImport
,
26 sal_uInt16 nPrfx
, const OUString
& rLocalName
,
27 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
28 uno::Reference
< drawing::XShapes
>& rShapes
)
29 : SdXMLGenericPageContext( rImport
, nPrfx
, rLocalName
, xAttrList
, rShapes
)
33 const sal_Int16 nAttrCount
= xAttrList
.is() ? xAttrList
->getLength() : 0;
34 for(sal_Int16 i
=0; i
< nAttrCount
; i
++)
36 OUString sAttrName
= xAttrList
->getNameByIndex( i
);
38 sal_uInt16 nPrefix
= GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName
, &aLocalName
);
39 OUString sValue
= xAttrList
->getValueByIndex( i
);
40 const SvXMLTokenMap
& rAttrTokenMap
= GetSdImport().GetMasterPageAttrTokenMap();
42 switch(rAttrTokenMap
.Get(nPrefix
, aLocalName
))
44 case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME
:
46 msPageMasterName
= sValue
;
49 case XML_TOK_MASTERPAGE_STYLE_NAME
:
54 case XML_TOK_MASTERPAGE_USE_HEADER_NAME
:
56 maUseHeaderDeclName
= sValue
;
59 case XML_TOK_MASTERPAGE_USE_FOOTER_NAME
:
61 maUseFooterDeclName
= sValue
;
64 case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME
:
66 maUseDateTimeDeclName
= sValue
;
73 SetStyle( sStyleName
);
75 // now delete all up-to-now contained shapes from this notes page
76 uno::Reference
< drawing::XShape
> xShape
;
77 while(rShapes
->getCount())
79 rShapes
->getByIndex(0L) >>= xShape
;
81 rShapes
->remove(xShape
);
85 if(!msPageMasterName
.isEmpty())
87 SetPageMaster( msPageMasterName
);
91 SdXMLNotesContext::~SdXMLNotesContext()
95 SvXMLImportContext
*SdXMLNotesContext::CreateChildContext( sal_uInt16 nPrefix
,
96 const OUString
& rLocalName
,
97 const uno::Reference
< xml::sax::XAttributeList
>& xAttrList
)
99 // OK, notes page is set on base class, objects can be imported on notes page
100 SvXMLImportContext
*pContext
= 0L;
102 // some special objects inside presentation:notes context
105 // call parent when no own context was created
107 pContext
= SdXMLGenericPageContext::CreateChildContext(nPrefix
, rLocalName
, xAttrList
);
112 void SdXMLNotesContext::EndElement()
114 SdXMLGenericPageContext::EndElement();
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */