1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "ximpnote.hxx"
30 #include <com/sun/star/presentation/XPresentationPage.hpp>
32 using ::rtl::OUString
;
33 using ::rtl::OUStringBuffer
;
35 using namespace ::com::sun::star
;
37 //////////////////////////////////////////////////////////////////////////////
39 SdXMLNotesContext::SdXMLNotesContext( SdXMLImport
& rImport
,
40 sal_uInt16 nPrfx
, const OUString
& rLocalName
,
41 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
42 uno::Reference
< drawing::XShapes
>& rShapes
)
43 : SdXMLGenericPageContext( rImport
, nPrfx
, rLocalName
, xAttrList
, rShapes
)
47 const sal_Int16 nAttrCount
= xAttrList
.is() ? xAttrList
->getLength() : 0;
48 for(sal_Int16 i
=0; i
< nAttrCount
; i
++)
50 OUString sAttrName
= xAttrList
->getNameByIndex( i
);
52 sal_uInt16 nPrefix
= GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName
, &aLocalName
);
53 OUString sValue
= xAttrList
->getValueByIndex( i
);
54 const SvXMLTokenMap
& rAttrTokenMap
= GetSdImport().GetMasterPageAttrTokenMap();
56 switch(rAttrTokenMap
.Get(nPrefix
, aLocalName
))
58 case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME
:
60 msPageMasterName
= sValue
;
63 case XML_TOK_MASTERPAGE_STYLE_NAME
:
68 case XML_TOK_MASTERPAGE_USE_HEADER_NAME
:
70 maUseHeaderDeclName
= sValue
;
73 case XML_TOK_MASTERPAGE_USE_FOOTER_NAME
:
75 maUseFooterDeclName
= sValue
;
78 case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME
:
80 maUseDateTimeDeclName
= sValue
;
87 SetStyle( sStyleName
);
89 // now delete all up-to-now contained shapes from this notes page
90 uno::Reference
< drawing::XShape
> xShape
;
91 while(rShapes
->getCount())
93 rShapes
->getByIndex(0L) >>= xShape
;
95 rShapes
->remove(xShape
);
99 if(!msPageMasterName
.isEmpty())
101 SetPageMaster( msPageMasterName
);
105 //////////////////////////////////////////////////////////////////////////////
107 SdXMLNotesContext::~SdXMLNotesContext()
111 //////////////////////////////////////////////////////////////////////////////
113 SvXMLImportContext
*SdXMLNotesContext::CreateChildContext( sal_uInt16 nPrefix
,
114 const OUString
& rLocalName
,
115 const uno::Reference
< xml::sax::XAttributeList
>& xAttrList
)
117 // OK, notes page is set on base class, objects can be imported on notes page
118 SvXMLImportContext
*pContext
= 0L;
120 // some special objects inside presentation:notes context
129 // call parent when no own context was created
131 pContext
= SdXMLGenericPageContext::CreateChildContext(nPrefix
, rLocalName
, xAttrList
);
136 //////////////////////////////////////////////////////////////////////////////
138 void SdXMLNotesContext::EndElement()
140 SdXMLGenericPageContext::EndElement();
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */