Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "ximpnote.hxx"
21 : #include <com/sun/star/presentation/XPresentationPage.hpp>
22 :
23 : using namespace ::com::sun::star;
24 :
25 0 : 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 0 : : SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
30 : {
31 0 : OUString sStyleName;
32 :
33 0 : const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
34 0 : for(sal_Int16 i=0; i < nAttrCount; i++)
35 : {
36 0 : OUString sAttrName = xAttrList->getNameByIndex( i );
37 0 : OUString aLocalName;
38 0 : sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
39 0 : OUString sValue = xAttrList->getValueByIndex( i );
40 0 : const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap();
41 :
42 0 : switch(rAttrTokenMap.Get(nPrefix, aLocalName))
43 : {
44 : case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME:
45 : {
46 0 : msPageMasterName = sValue;
47 0 : break;
48 : }
49 : case XML_TOK_MASTERPAGE_STYLE_NAME:
50 : {
51 0 : sStyleName = sValue;
52 0 : break;
53 : }
54 : case XML_TOK_MASTERPAGE_USE_HEADER_NAME:
55 : {
56 0 : maUseHeaderDeclName = sValue;
57 0 : break;
58 : }
59 : case XML_TOK_MASTERPAGE_USE_FOOTER_NAME:
60 : {
61 0 : maUseFooterDeclName = sValue;
62 0 : break;
63 : }
64 : case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME:
65 : {
66 0 : maUseDateTimeDeclName = sValue;
67 0 : break;
68 : }
69 :
70 : }
71 0 : }
72 :
73 0 : SetStyle( sStyleName );
74 :
75 : // now delete all up-to-now contained shapes from this notes page
76 0 : uno::Reference< drawing::XShape > xShape;
77 0 : while(rShapes->getCount())
78 : {
79 0 : rShapes->getByIndex(0L) >>= xShape;
80 0 : if(xShape.is())
81 0 : rShapes->remove(xShape);
82 : }
83 :
84 : // set page-master?
85 0 : if(!msPageMasterName.isEmpty())
86 : {
87 0 : SetPageMaster( msPageMasterName );
88 0 : }
89 0 : }
90 :
91 0 : SdXMLNotesContext::~SdXMLNotesContext()
92 : {
93 0 : }
94 :
95 0 : SvXMLImportContext *SdXMLNotesContext::CreateChildContext( sal_uInt16 nPrefix,
96 : const OUString& rLocalName,
97 : const uno::Reference< xml::sax::XAttributeList>& xAttrList )
98 : {
99 : // OK, notes page is set on base class, objects can be imported on notes page
100 0 : SvXMLImportContext *pContext = 0L;
101 :
102 : // some special objects inside presentation:notes context
103 :
104 :
105 : // call parent when no own context was created
106 0 : if(!pContext)
107 0 : pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
108 :
109 0 : return pContext;
110 : }
111 :
112 0 : void SdXMLNotesContext::EndElement()
113 : {
114 0 : SdXMLGenericPageContext::EndElement();
115 0 : }
116 :
117 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|