build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / xmloff / inc / XMLEventImportHelper.hxx
blob23b7358834f61973b0e8c7f820f204a750717f0a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_XMLOFF_INC_XMLEVENTIMPORTHELPER_HXX
21 #define INCLUDED_XMLOFF_INC_XMLEVENTIMPORTHELPER_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <xmloff/xmlevent.hxx>
26 #include <map>
27 #include <list>
30 namespace com { namespace sun { namespace star {
31 namespace xml { namespace sax { class XAttributeList; } }
32 } } }
33 class XMLEventContextFactory;
34 class XMLEventsImportContext;
35 struct XMLEventNameTranslation;
37 typedef ::std::map< OUString, XMLEventContextFactory* > FactoryMap;
38 typedef ::std::map< XMLEventName, OUString > NameMap;
41 /**
42 * Helps the XMLEventsImportContext.
44 * This class stores
45 * a) the translation from XML event names to API event names, and
46 * b) a mapping from script language names to XMLEventContextFactory objects
47 * (that handle particular languages).
49 * Event name translation tables may be added, i.e. they will be joined
50 * together. If different translations are needed (i.e., if the same XML name
51 * needs to be translated to different API names in different contexts), then
52 * translation tables may be saved on a translation table stack.
54 class XMLEventImportHelper
56 /// map of XMLEventContextFactory objects
57 FactoryMap aFactoryMap;
59 /// map from XML to API names
60 NameMap* pEventNameMap;
62 /// stack of previous aEventNameMap
63 std::list< NameMap* > aEventNameMapList;
65 public:
66 XMLEventImportHelper();
68 ~XMLEventImportHelper();
70 /// register a handler for a particular language type
71 void RegisterFactory( const OUString& rLanguage,
72 XMLEventContextFactory* aFactory );
74 /// add event name translation to the internal table
75 void AddTranslationTable( const XMLEventNameTranslation* pTransTable );
77 /// save the old translation table on a stack and install an empty table
78 void PushTranslationTable();
80 /// recover the top-most previously saved translation table
81 void PopTranslationTable();
83 /// create an appropriate import context for a particular event
84 SvXMLImportContext* CreateContext(
85 SvXMLImport& rImport,
86 sal_uInt16 nPrefix,
87 const OUString& rLocalName,
88 const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList,
89 XMLEventsImportContext* rEvents,
90 const OUString& rXmlEventName,
91 const OUString& rLanguage);
95 #endif
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */