1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_PRHDLFAC_HXX
21 #define INCLUDED_XMLOFF_PRHDLFAC_HXX
23 #include <xmloff/dllapi.h>
24 #include <sal/types.h>
26 #include <salhelper/simplereferenceobject.hxx>
28 class XMLPropertyHandler
;
31 This class is a base-class to create XMLPropertyHandler.
32 It creates PropertyHandler for given XML-types and store
33 them in an internal cache. They'll be deleted at destruction-
35 For create your own PropertyHandler for specific XML-types
36 you have to override the virtual method GetPropertyHandler
39 class XMLOFF_DLLPUBLIC XMLPropertyHandlerFactory
: public salhelper::SimpleReferenceObject
44 XMLPropertyHandlerFactory( const XMLPropertyHandlerFactory
& ) SAL_DELETED_FUNCTION
;
45 XMLPropertyHandlerFactory
& operator= ( const XMLPropertyHandlerFactory
& ) SAL_DELETED_FUNCTION
;
48 XMLPropertyHandlerFactory();
49 virtual ~XMLPropertyHandlerFactory();
52 This method retrieves a PropertyHandler for the given XML-type.
53 To extend this method for more XML-types override this method
54 like the example below. If you call the method of the base-class
55 you get propertyhandler for basic-XML-types ( e.g. for color, percent, ... ).
56 Afetr that you could create your new XML-types. After creating a new type
57 you have to put the pointer into the cache via the method
58 PutHdlCache( sal_Int32 , XMLPropertyHandler* ).
60 virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const
62 XMLPropertyHandler* pHdl = XMLPropertyHandlerFactory::GetPropertyHandler( nType );
69 pHdl = new XML_xyz_PropHdl;
77 PutHdlCache( nType, pHdl );
83 virtual const XMLPropertyHandler
* GetPropertyHandler( sal_Int32 nType
) const;
85 /** helper method to statically create a property handler; this will not
86 * use the handler cache. This method should only be called in special
87 * circumstances; calling GetPropertyHandler is almost always
89 static const XMLPropertyHandler
* CreatePropertyHandler( sal_Int32 nType
);
92 /** Retrieves a PropertyHandler from the internal cache */
93 const XMLPropertyHandler
* GetHdlCache( sal_Int32 nType
) const;
94 /** Puts a PropertyHandler into the internal cache */
95 void PutHdlCache( sal_Int32 nType
, const XMLPropertyHandler
* pHdl
) const;
98 /** Retrieves ( creates if necessary ) PropertyHandler for
100 SAL_DLLPRIVATE
const XMLPropertyHandler
* GetBasicHandler( sal_Int32 nType
) const;
103 #endif // INCLUDED_XMLOFF_PRHDLFAC_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */