xref: /aoo41x/main/xmloff/source/draw/ximpnote.cxx (revision 63bba73c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmloff.hxx"
26 #include "ximpnote.hxx"
27 #include <com/sun/star/presentation/XPresentationPage.hpp>
28 
29 using ::rtl::OUString;
30 using ::rtl::OUStringBuffer;
31 
32 using namespace ::com::sun::star;
33 
34 //////////////////////////////////////////////////////////////////////////////
35 
SdXMLNotesContext(SdXMLImport & rImport,sal_uInt16 nPrfx,const OUString & rLocalName,const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList> & xAttrList,uno::Reference<drawing::XShapes> & rShapes)36 SdXMLNotesContext::SdXMLNotesContext( SdXMLImport& rImport,
37 	sal_uInt16 nPrfx, const OUString& rLocalName,
38 	const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
39 	uno::Reference< drawing::XShapes >& rShapes)
40 :	SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
41 {
42 	OUString sStyleName;
43 
44 	const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
45 	for(sal_Int16 i=0; i < nAttrCount; i++)
46 	{
47 		OUString sAttrName = xAttrList->getNameByIndex( i );
48 		OUString aLocalName;
49 		sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
50 		OUString sValue = xAttrList->getValueByIndex( i );
51 		const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap();
52 
53 		switch(rAttrTokenMap.Get(nPrefix, aLocalName))
54 		{
55 			case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME:
56 			{
57 				msPageMasterName = sValue;
58 				break;
59 			}
60 			case XML_TOK_MASTERPAGE_STYLE_NAME:
61 			{
62 				sStyleName = sValue;
63 				break;
64 			}
65 			case XML_TOK_MASTERPAGE_USE_HEADER_NAME:
66 			{
67 				maUseHeaderDeclName =  sValue;
68 				break;
69 			}
70 			case XML_TOK_MASTERPAGE_USE_FOOTER_NAME:
71 			{
72 				maUseFooterDeclName =  sValue;
73 				break;
74 			}
75 			case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME:
76 			{
77 				maUseDateTimeDeclName =  sValue;
78 				break;
79 			}
80 
81 		}
82 	}
83 
84 	SetStyle( sStyleName );
85 
86 	// now delete all up-to-now contained shapes from this notes page
87 	uno::Reference< drawing::XShape > xShape;
88 	while(rShapes->getCount())
89 	{
90 		rShapes->getByIndex(0L) >>= xShape;
91 		if(xShape.is())
92 			rShapes->remove(xShape);
93 	}
94 
95 	// set page-master?
96 	if(msPageMasterName.getLength())
97 	{
98 		SetPageMaster( msPageMasterName );
99 	}
100 }
101 
102 //////////////////////////////////////////////////////////////////////////////
103 
~SdXMLNotesContext()104 SdXMLNotesContext::~SdXMLNotesContext()
105 {
106 }
107 
108 //////////////////////////////////////////////////////////////////////////////
109 
CreateChildContext(sal_uInt16 nPrefix,const OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)110 SvXMLImportContext *SdXMLNotesContext::CreateChildContext( sal_uInt16 nPrefix,
111 	const OUString& rLocalName,
112 	const uno::Reference< xml::sax::XAttributeList>& xAttrList )
113 {
114 	// OK, notes page is set on base class, objects can be imported on notes page
115 	SvXMLImportContext *pContext = 0L;
116 
117 	// some special objects inside presentation:notes context
118 	// ...
119 
120 
121 
122 
123 
124 
125 
126 	// call parent when no own context was created
127 	if(!pContext)
128 		pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
129 
130 	return pContext;
131 }
132 
133 //////////////////////////////////////////////////////////////////////////////
134 
EndElement()135 void SdXMLNotesContext::EndElement()
136 {
137 	SdXMLGenericPageContext::EndElement();
138 }
139