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