LibreOffice Module xmloff (master)  1
ximpnote.cxx
Go to the documentation of this file.
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 <xmloff/xmlnamespace.hxx>
22 
23 using namespace ::com::sun::star;
24 using namespace ::xmloff::token;
25 
27  SdXMLImport& rImport, const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
28  uno::Reference<drawing::XShapes> const& rShapes)
29  : SdXMLGenericPageContext(rImport, xAttrList, rShapes)
30 {
31  OUString sStyleName, sPageMasterName;
32 
33  for (auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
34  {
35  OUString sValue = aIter.toString();
36  switch (aIter.getToken())
37  {
39  {
40  sPageMasterName = sValue;
41  break;
42  }
44  {
45  sStyleName = sValue;
46  break;
47  }
48  case XML_ELEMENT(PRESENTATION, XML_USE_HEADER_NAME):
49  case XML_ELEMENT(PRESENTATION_SO52, XML_USE_HEADER_NAME):
50  case XML_ELEMENT(PRESENTATION_OOO, XML_USE_HEADER_NAME):
51  {
52  maUseHeaderDeclName = sValue;
53  break;
54  }
55  case XML_ELEMENT(PRESENTATION, XML_USE_FOOTER_NAME):
56  case XML_ELEMENT(PRESENTATION_SO52, XML_USE_FOOTER_NAME):
57  case XML_ELEMENT(PRESENTATION_OOO, XML_USE_FOOTER_NAME):
58  {
59  maUseFooterDeclName = sValue;
60  break;
61  }
62  case XML_ELEMENT(PRESENTATION, XML_USE_DATE_TIME_NAME):
63  case XML_ELEMENT(PRESENTATION_SO52, XML_USE_DATE_TIME_NAME):
64  case XML_ELEMENT(PRESENTATION_OOO, XML_USE_DATE_TIME_NAME):
65  {
66  maUseDateTimeDeclName = sValue;
67  break;
68  }
69  }
70  }
71 
72  SetStyle(sStyleName);
73 
74  // now delete all up-to-now contained shapes from this notes page
75  uno::Reference<drawing::XShape> xShape;
76  while (rShapes->getCount())
77  {
78  rShapes->getByIndex(0) >>= xShape;
79  if (xShape.is())
80  rShapes->remove(xShape);
81  }
82 
83  // set page-master?
84  if (!sPageMasterName.isEmpty())
85  {
86  SetPageMaster(sPageMasterName);
87  }
88 }
89 
91 
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdXMLNotesContext(SdXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximpnote.cxx:26
void SetPageMaster(OUString const &rsPageMasterName)
sets the properties from a page master style with the given name on this contexts page ...
Definition: ximppage.cxx:468
OUString maUseHeaderDeclName
Definition: ximppage.hxx:37
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
OUString maUseFooterDeclName
Definition: ximppage.hxx:38
DRAW
virtual ~SdXMLNotesContext() override
Definition: ximpnote.cxx:90
OUString maUseDateTimeDeclName
Definition: ximppage.hxx:39
Handling of tokens in XML:
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97
void SetStyle(OUString const &rStyleName)
sets the page style on this page
Definition: ximppage.cxx:349