xref: /AOO41X/main/xmloff/source/draw/ximpbody.cxx (revision 63bba73cc51e0afb45f8a8d578158724bb5afee8)
1*63bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63bba73cSAndrew Rist  * distributed with this work for additional information
6*63bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
9*63bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*63bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*63bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63bba73cSAndrew Rist  * software distributed under the License is distributed on an
15*63bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63bba73cSAndrew Rist  * specific language governing permissions and limitations
18*63bba73cSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*63bba73cSAndrew Rist  *************************************************************/
21*63bba73cSAndrew Rist 
22*63bba73cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
26cdf0e10cSrcweir #include "ximpbody.hxx"
27cdf0e10cSrcweir #include <xmloff/prstylei.hxx>
28cdf0e10cSrcweir #include "ximpnote.hxx"
29cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp>
30cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPages.hpp>
31cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
32cdf0e10cSrcweir #include <com/sun/star/presentation/XPresentationPage.hpp>
33cdf0e10cSrcweir #include "ximpstyl.hxx"
34cdf0e10cSrcweir #include <com/sun/star/drawing/XMasterPageTarget.hpp>
35cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
36cdf0e10cSrcweir #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include "unointerfacetouniqueidentifiermapper.hxx"
39cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
40cdf0e10cSrcweir #include <xmloff/xmlprmap.hxx>
41cdf0e10cSrcweir #include <xmloff/families.hxx>
42cdf0e10cSrcweir #include "ximpshow.hxx"
43cdf0e10cSrcweir #include "PropertySetMerger.hxx"
44cdf0e10cSrcweir #include "animationimport.hxx"
45cdf0e10cSrcweir #include <tools/string.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir using ::rtl::OUString;
48cdf0e10cSrcweir using ::rtl::OUStringBuffer;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir using namespace ::com::sun::star;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
53cdf0e10cSrcweir 
SdXMLDrawPageContext(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)54cdf0e10cSrcweir SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport,
55cdf0e10cSrcweir 	sal_uInt16 nPrfx, const OUString& rLocalName,
56cdf0e10cSrcweir 	const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList,
57cdf0e10cSrcweir 	uno::Reference< drawing::XShapes >& rShapes)
58cdf0e10cSrcweir :	SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
59cdf0e10cSrcweir ,	mbHadSMILNodes( false )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir     bool bHaveXmlId( false );
62cdf0e10cSrcweir     OUString sXmlId;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	for(sal_Int16 i=0; i < nAttrCount; i++)
67cdf0e10cSrcweir 	{
68cdf0e10cSrcweir 		OUString sAttrName = xAttrList->getNameByIndex( i );
69cdf0e10cSrcweir 		OUString aLocalName;
70cdf0e10cSrcweir 		sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
71cdf0e10cSrcweir 		OUString sValue = xAttrList->getValueByIndex( i );
72cdf0e10cSrcweir 		const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetDrawPageAttrTokenMap();
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 		switch(rAttrTokenMap.Get(nPrefix, aLocalName))
75cdf0e10cSrcweir 		{
76cdf0e10cSrcweir 			case XML_TOK_DRAWPAGE_NAME:
77cdf0e10cSrcweir 			{
78cdf0e10cSrcweir 				maName = sValue;
79cdf0e10cSrcweir 				break;
80cdf0e10cSrcweir 			}
81cdf0e10cSrcweir 			case XML_TOK_DRAWPAGE_STYLE_NAME:
82cdf0e10cSrcweir 			{
83cdf0e10cSrcweir 				maStyleName = sValue;
84cdf0e10cSrcweir 				break;
85cdf0e10cSrcweir 			}
86cdf0e10cSrcweir 			case XML_TOK_DRAWPAGE_MASTER_PAGE_NAME:
87cdf0e10cSrcweir 			{
88cdf0e10cSrcweir 				maMasterPageName = sValue;
89cdf0e10cSrcweir 				break;
90cdf0e10cSrcweir 			}
91cdf0e10cSrcweir 			case XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME:
92cdf0e10cSrcweir 			{
93cdf0e10cSrcweir 				maPageLayoutName =  sValue;
94cdf0e10cSrcweir 				break;
95cdf0e10cSrcweir 			}
96cdf0e10cSrcweir 			case XML_TOK_DRAWPAGE_USE_HEADER_NAME:
97cdf0e10cSrcweir 			{
98cdf0e10cSrcweir 				maUseHeaderDeclName =  sValue;
99cdf0e10cSrcweir 				break;
100cdf0e10cSrcweir 			}
101cdf0e10cSrcweir 			case XML_TOK_DRAWPAGE_USE_FOOTER_NAME:
102cdf0e10cSrcweir 			{
103cdf0e10cSrcweir 				maUseFooterDeclName =  sValue;
104cdf0e10cSrcweir 				break;
105cdf0e10cSrcweir 			}
106cdf0e10cSrcweir 			case XML_TOK_DRAWPAGE_USE_DATE_TIME_NAME:
107cdf0e10cSrcweir 			{
108cdf0e10cSrcweir 				maUseDateTimeDeclName =  sValue;
109cdf0e10cSrcweir 				break;
110cdf0e10cSrcweir 			}
111cdf0e10cSrcweir             case XML_TOK_DRAWPAGE_DRAWID:
112cdf0e10cSrcweir             {
113cdf0e10cSrcweir                 if (!bHaveXmlId) { sXmlId = sValue; }
114cdf0e10cSrcweir             }
115cdf0e10cSrcweir             break;
116cdf0e10cSrcweir             case XML_TOK_DRAWPAGE_XMLID:
117cdf0e10cSrcweir             {
118cdf0e10cSrcweir                 sXmlId = sValue;
119cdf0e10cSrcweir                 bHaveXmlId = true;
120cdf0e10cSrcweir             }
121cdf0e10cSrcweir             break;
122cdf0e10cSrcweir 			case XML_TOK_DRAWPAGE_HREF:
123cdf0e10cSrcweir 			{
124cdf0e10cSrcweir 				maHREF = sValue;
125cdf0e10cSrcweir 				break;
126cdf0e10cSrcweir 			}
127cdf0e10cSrcweir 		}
128cdf0e10cSrcweir 	}
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     if (sXmlId.getLength())
131cdf0e10cSrcweir     {
132cdf0e10cSrcweir         uno::Reference< uno::XInterface > const xRef( rShapes.get() );
133cdf0e10cSrcweir         GetImport().getInterfaceToIdentifierMapper().registerReference(
134cdf0e10cSrcweir             sXmlId, xRef );
135cdf0e10cSrcweir     }
136cdf0e10cSrcweir 	GetImport().GetShapeImport()->startPage( rShapes );
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 	uno::Reference< drawing::XDrawPage > xShapeDrawPage(rShapes, uno::UNO_QUERY);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	// set PageName?
141cdf0e10cSrcweir 	if(maName.getLength())
142cdf0e10cSrcweir 	{
143cdf0e10cSrcweir 		if(xShapeDrawPage.is())
144cdf0e10cSrcweir 		{
145cdf0e10cSrcweir 			uno::Reference < container::XNamed > xNamed(xShapeDrawPage, uno::UNO_QUERY);
146cdf0e10cSrcweir 			if(xNamed.is())
147cdf0e10cSrcweir 				xNamed->setName(maName);
148cdf0e10cSrcweir 		}
149cdf0e10cSrcweir 	}
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 	// set MasterPage?
152cdf0e10cSrcweir 	if(maMasterPageName.getLength())
153cdf0e10cSrcweir 	{
154cdf0e10cSrcweir 		// #85906# Code for setting masterpage needs complete rework
155cdf0e10cSrcweir 		// since GetSdImport().GetMasterStylesContext() gives always ZERO
156cdf0e10cSrcweir 		// because of content/style file split. Now the nechanism is to
157cdf0e10cSrcweir 		// compare the wanted masterpage-name with the existing masterpages
158cdf0e10cSrcweir 		// which were loaded and created in the styles section loading.
159cdf0e10cSrcweir 		uno::Reference< drawing::XDrawPages > xMasterPages(GetSdImport().GetLocalMasterPages(), uno::UNO_QUERY);
160cdf0e10cSrcweir 		uno::Reference < drawing::XMasterPageTarget > xDrawPage(rShapes, uno::UNO_QUERY);
161cdf0e10cSrcweir 		uno::Reference< drawing::XDrawPage > xMasterPage;
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 		if(xDrawPage.is() && xMasterPages.is())
164cdf0e10cSrcweir 		{
165cdf0e10cSrcweir 			sal_Bool bDone(sal_False);
166cdf0e10cSrcweir 			OUString sDisplayName( rImport.GetStyleDisplayName(
167cdf0e10cSrcweir 							XML_STYLE_FAMILY_MASTER_PAGE, maMasterPageName ) );
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 			for(sal_Int32 a = 0; !bDone && a < xMasterPages->getCount(); a++)
170cdf0e10cSrcweir 			{
171cdf0e10cSrcweir 				uno::Any aAny(xMasterPages->getByIndex(a));
172cdf0e10cSrcweir 				aAny >>= xMasterPage;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 				if(xMasterPage.is())
175cdf0e10cSrcweir 				{
176cdf0e10cSrcweir 					uno::Reference < container::XNamed > xMasterNamed(xMasterPage, uno::UNO_QUERY);
177cdf0e10cSrcweir 					if(xMasterNamed.is())
178cdf0e10cSrcweir 					{
179cdf0e10cSrcweir 						OUString sMasterPageName = xMasterNamed->getName();
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 						if(sMasterPageName.getLength() &&
182cdf0e10cSrcweir 							sMasterPageName.equals(sDisplayName))
183cdf0e10cSrcweir 						{
184cdf0e10cSrcweir 							xDrawPage->setMasterPage(xMasterPage);
185cdf0e10cSrcweir 							bDone = sal_True;
186cdf0e10cSrcweir 						}
187cdf0e10cSrcweir 					}
188cdf0e10cSrcweir 				}
189cdf0e10cSrcweir 			}
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 			DBG_ASSERT( bDone, "xmloff::SdXMLDrawPageContext::SdXMLDrawPageContext(), could not find a slide master!" );
192cdf0e10cSrcweir 		}
193cdf0e10cSrcweir 	}
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 	SetStyle( maStyleName );
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	if( maHREF.getLength() )
198cdf0e10cSrcweir 	{
199cdf0e10cSrcweir 		uno::Reference< beans::XPropertySet > xProps( xShapeDrawPage, uno::UNO_QUERY );
200cdf0e10cSrcweir 		if( xProps.is() )
201cdf0e10cSrcweir 		{
202cdf0e10cSrcweir 			sal_Int32 nIndex = maHREF.lastIndexOf( (sal_Unicode)'#' );
203cdf0e10cSrcweir 			if( nIndex != -1 )
204cdf0e10cSrcweir 			{
205cdf0e10cSrcweir 				OUString aFileName( maHREF.copy( 0, nIndex ) );
206cdf0e10cSrcweir 				OUString aBookmarkName( maHREF.copy( nIndex+1 ) );
207cdf0e10cSrcweir 
208cdf0e10cSrcweir 				maHREF = GetImport().GetAbsoluteReference( aFileName );
209cdf0e10cSrcweir 				maHREF += String( (sal_Unicode)'#' );
210cdf0e10cSrcweir 				maHREF += aBookmarkName;
211cdf0e10cSrcweir 			}
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 			xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "BookmarkURL" ) ), uno::makeAny( maHREF ) );
214cdf0e10cSrcweir 		}
215cdf0e10cSrcweir 	}
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 	SetLayout();
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 	DeleteAllShapes();
220cdf0e10cSrcweir }
221cdf0e10cSrcweir 
222cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
223cdf0e10cSrcweir 
~SdXMLDrawPageContext()224cdf0e10cSrcweir SdXMLDrawPageContext::~SdXMLDrawPageContext()
225cdf0e10cSrcweir {
226cdf0e10cSrcweir }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
229cdf0e10cSrcweir 
CreateChildContext(sal_uInt16 nPrefix,const OUString & rLocalName,const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList> & xAttrList)230cdf0e10cSrcweir SvXMLImportContext *SdXMLDrawPageContext::CreateChildContext( sal_uInt16 nPrefix,
231cdf0e10cSrcweir 	const OUString& rLocalName,
232cdf0e10cSrcweir 	const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList )
233cdf0e10cSrcweir {
234cdf0e10cSrcweir 	SvXMLImportContext *pContext = 0L;
235cdf0e10cSrcweir 	const SvXMLTokenMap& rTokenMap = GetSdImport().GetDrawPageElemTokenMap();
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 	// some special objects inside draw:page context
238cdf0e10cSrcweir 	switch(rTokenMap.Get(nPrefix, rLocalName))
239cdf0e10cSrcweir 	{
240cdf0e10cSrcweir 		case XML_TOK_DRAWPAGE_NOTES:
241cdf0e10cSrcweir 		{
242cdf0e10cSrcweir 			if( GetSdImport().IsImpress() )
243cdf0e10cSrcweir 			{
244cdf0e10cSrcweir 				// get notes page
245cdf0e10cSrcweir 				uno::Reference< presentation::XPresentationPage > xPresPage(GetLocalShapesContext(), uno::UNO_QUERY);
246cdf0e10cSrcweir 				if(xPresPage.is())
247cdf0e10cSrcweir 				{
248cdf0e10cSrcweir 					uno::Reference< drawing::XDrawPage > xNotesDrawPage(xPresPage->getNotesPage(), uno::UNO_QUERY);
249cdf0e10cSrcweir 					if(xNotesDrawPage.is())
250cdf0e10cSrcweir 					{
251cdf0e10cSrcweir 						uno::Reference< drawing::XShapes > xNewShapes(xNotesDrawPage, uno::UNO_QUERY);
252cdf0e10cSrcweir 						if(xNewShapes.is())
253cdf0e10cSrcweir 						{
254cdf0e10cSrcweir 							// presentation:notes inside draw:page context
255cdf0e10cSrcweir 							pContext = new SdXMLNotesContext( GetSdImport(), nPrefix, rLocalName, xAttrList, xNewShapes);
256cdf0e10cSrcweir 						}
257cdf0e10cSrcweir 					}
258cdf0e10cSrcweir 				}
259cdf0e10cSrcweir 			}
260cdf0e10cSrcweir 			break;
261cdf0e10cSrcweir 		}
262cdf0e10cSrcweir 		case XML_TOK_DRAWPAGE_PAR:
263cdf0e10cSrcweir 		case XML_TOK_DRAWPAGE_SEQ:
264cdf0e10cSrcweir 		{
265cdf0e10cSrcweir 			if( GetSdImport().IsImpress() )
266cdf0e10cSrcweir 			{
267cdf0e10cSrcweir 				uno::Reference< animations::XAnimationNodeSupplier > xNodeSupplier(GetLocalShapesContext(), uno::UNO_QUERY);
268cdf0e10cSrcweir 				if(xNodeSupplier.is())
269cdf0e10cSrcweir 				{
270cdf0e10cSrcweir 					pContext = new xmloff::AnimationNodeContext( xNodeSupplier->getAnimationNode(), GetSdImport(), nPrefix, rLocalName, xAttrList );
271cdf0e10cSrcweir 					mbHadSMILNodes = true;
272cdf0e10cSrcweir 				}
273cdf0e10cSrcweir 			}
274cdf0e10cSrcweir 			break;
275cdf0e10cSrcweir 		}
276cdf0e10cSrcweir 	}
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	// call parent when no own context was created
279cdf0e10cSrcweir 	if(!pContext)
280cdf0e10cSrcweir 		pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 	return pContext;
283cdf0e10cSrcweir }
284cdf0e10cSrcweir 
EndElement()285cdf0e10cSrcweir void SdXMLDrawPageContext::EndElement()
286cdf0e10cSrcweir {
287cdf0e10cSrcweir 	SdXMLGenericPageContext::EndElement();
288cdf0e10cSrcweir 	GetImport().GetShapeImport()->endPage(GetLocalShapesContext());
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 	if( mbHadSMILNodes )
291cdf0e10cSrcweir 	{
292cdf0e10cSrcweir 		uno::Reference< animations::XAnimationNodeSupplier > xNodeSupplier(GetLocalShapesContext(), uno::UNO_QUERY);
293cdf0e10cSrcweir 		uno::Reference< beans::XPropertySet > xPageProps( GetLocalShapesContext(), uno::UNO_QUERY );
294cdf0e10cSrcweir 		if(xNodeSupplier.is())
295cdf0e10cSrcweir 			xmloff::AnimationNodeContext::postProcessRootNode( GetSdImport(), xNodeSupplier->getAnimationNode(), xPageProps );
296cdf0e10cSrcweir 	}
297cdf0e10cSrcweir }
298cdf0e10cSrcweir 
299cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
300cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
301cdf0e10cSrcweir 
SdXMLBodyContext(SdXMLImport & rImport,sal_uInt16 nPrfx,const OUString & rLocalName)302cdf0e10cSrcweir SdXMLBodyContext::SdXMLBodyContext( SdXMLImport& rImport,
303cdf0e10cSrcweir 	sal_uInt16 nPrfx, const OUString& rLocalName )
304cdf0e10cSrcweir :	SvXMLImportContext( rImport, nPrfx, rLocalName )
305cdf0e10cSrcweir {
306cdf0e10cSrcweir }
307cdf0e10cSrcweir 
308cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
309cdf0e10cSrcweir 
~SdXMLBodyContext()310cdf0e10cSrcweir SdXMLBodyContext::~SdXMLBodyContext()
311cdf0e10cSrcweir {
312cdf0e10cSrcweir }
313cdf0e10cSrcweir 
314cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
315cdf0e10cSrcweir 
CreateChildContext(sal_uInt16 nPrefix,const OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)316cdf0e10cSrcweir SvXMLImportContext *SdXMLBodyContext::CreateChildContext(
317cdf0e10cSrcweir 	sal_uInt16 nPrefix,
318cdf0e10cSrcweir 	const OUString& rLocalName,
319cdf0e10cSrcweir 	const uno::Reference< xml::sax::XAttributeList>& xAttrList )
320cdf0e10cSrcweir {
321cdf0e10cSrcweir 	SvXMLImportContext *pContext = 0L;
322cdf0e10cSrcweir 	const SvXMLTokenMap& rTokenMap = GetSdImport().GetBodyElemTokenMap();
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 	switch(rTokenMap.Get(nPrefix, rLocalName))
325cdf0e10cSrcweir 	{
326cdf0e10cSrcweir 		case XML_TOK_BODY_HEADER_DECL:
327cdf0e10cSrcweir 		case XML_TOK_BODY_FOOTER_DECL:
328cdf0e10cSrcweir 		case XML_TOK_BODY_DATE_TIME_DECL:
329cdf0e10cSrcweir 		{
330cdf0e10cSrcweir 			pContext = new SdXMLHeaderFooterDeclContext( GetImport(), nPrefix, rLocalName, xAttrList );
331cdf0e10cSrcweir 			break;
332cdf0e10cSrcweir 		}
333cdf0e10cSrcweir 		case XML_TOK_BODY_PAGE:
334cdf0e10cSrcweir 		{
335cdf0e10cSrcweir 			// only read the first page in preview mode
336cdf0e10cSrcweir 			if( (GetSdImport().GetNewPageCount() == 0) || !GetSdImport().IsPreview() )
337cdf0e10cSrcweir 			{
338cdf0e10cSrcweir 				// import this page
339cdf0e10cSrcweir 				uno::Reference< drawing::XDrawPage > xNewDrawPage;
340cdf0e10cSrcweir 				uno::Reference< drawing::XDrawPages > xDrawPages(GetSdImport().GetLocalDrawPages(), uno::UNO_QUERY);
341cdf0e10cSrcweir 
342cdf0e10cSrcweir 				if( !xDrawPages.is() )
343cdf0e10cSrcweir 					break;
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 				if(GetSdImport().GetNewPageCount() + 1 > xDrawPages->getCount())
346cdf0e10cSrcweir 				{
347cdf0e10cSrcweir 					// new page, create and insert
348cdf0e10cSrcweir 					xNewDrawPage = xDrawPages->insertNewByIndex(xDrawPages->getCount());
349cdf0e10cSrcweir 				}
350cdf0e10cSrcweir 				else
351cdf0e10cSrcweir 				{
352cdf0e10cSrcweir 					// existing page, use it
353cdf0e10cSrcweir 					uno::Any aAny(xDrawPages->getByIndex(GetSdImport().GetNewPageCount()));
354cdf0e10cSrcweir 					aAny >>= xNewDrawPage;
355cdf0e10cSrcweir 				}
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 				// increment global import page counter
358cdf0e10cSrcweir 				GetSdImport().IncrementNewPageCount();
359cdf0e10cSrcweir 
360cdf0e10cSrcweir 				if(xNewDrawPage.is())
361cdf0e10cSrcweir 				{
362cdf0e10cSrcweir 					uno::Reference< drawing::XShapes > xNewShapes(xNewDrawPage, uno::UNO_QUERY);
363cdf0e10cSrcweir 					if(xNewShapes.is())
364cdf0e10cSrcweir 					{
365cdf0e10cSrcweir 						// draw:page inside office:body context
366cdf0e10cSrcweir 						pContext = new SdXMLDrawPageContext(GetSdImport(), nPrefix, rLocalName, xAttrList,
367cdf0e10cSrcweir 							xNewShapes);
368cdf0e10cSrcweir 					}
369cdf0e10cSrcweir 				}
370cdf0e10cSrcweir 			}
371cdf0e10cSrcweir 			break;
372cdf0e10cSrcweir 		}
373cdf0e10cSrcweir 		case XML_TOK_BODY_SETTINGS:
374cdf0e10cSrcweir 		{
375cdf0e10cSrcweir 			pContext = new SdXMLShowsContext( GetSdImport(), nPrefix, rLocalName, xAttrList );
376cdf0e10cSrcweir 		}
377cdf0e10cSrcweir 	}
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 	// call parent when no own context was created
380cdf0e10cSrcweir 	if(!pContext)
381cdf0e10cSrcweir 		pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
382cdf0e10cSrcweir 
383cdf0e10cSrcweir 	return pContext;
384cdf0e10cSrcweir }
385