Line data Source code
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 : #ifndef INCLUDED_XMLOFF_PRSTYLEI_HXX
20 : #define INCLUDED_XMLOFF_PRSTYLEI_HXX
21 :
22 : #include <sal/config.h>
23 : #include <xmloff/dllapi.h>
24 : #include <sal/types.h>
25 : #include <com/sun/star/style/XStyle.hpp>
26 : #include <vector>
27 : #include <xmloff/xmlstyle.hxx>
28 :
29 : struct XMLPropertyState;
30 : class SvXMLStylesContext;
31 :
32 : namespace com { namespace sun { namespace star {
33 : namespace beans { class XPropertySet; }
34 : } } }
35 :
36 : class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext
37 : {
38 : const OUString msIsPhysical;
39 : const OUString msFollowStyle;
40 : ::std::vector< XMLPropertyState > maProperties;
41 : ::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > mxStyle;
42 : SvXMLImportContextRef mxStyles;
43 :
44 : SAL_DLLPRIVATE XMLPropStyleContext(XMLPropStyleContext &); // not defined
45 : SAL_DLLPRIVATE void operator =(XMLPropStyleContext &); // not defined
46 :
47 : protected:
48 :
49 : virtual void SetAttribute( sal_uInt16 nPrefixKey,
50 : const OUString& rLocalName,
51 : const OUString& rValue ) SAL_OVERRIDE;
52 0 : SvXMLStylesContext *GetStyles() { return (SvXMLStylesContext *)&mxStyles; }
53 0 : ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; }
54 :
55 : // This methos my be overloaded to create a new style. Its called by
56 : // CreateInsert to create a style if a style with the requested family and
57 : // name couldn't be found. The st
58 : virtual ::com::sun::star::uno::Reference <
59 : ::com::sun::star::style::XStyle > Create();
60 :
61 : public:
62 :
63 : TYPEINFO_OVERRIDE();
64 :
65 : XMLPropStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
66 : const OUString& rLName,
67 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
68 : SvXMLStylesContext& rStyles, sal_uInt16 nFamily = 0,
69 : bool bDefaultStyle=false );
70 : virtual ~XMLPropStyleContext();
71 :
72 : virtual SvXMLImportContext *CreateChildContext(
73 : sal_uInt16 nPrefix,
74 : const OUString& rLocalName,
75 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
76 :
77 : virtual void FillPropertySet(
78 : const ::com::sun::star::uno::Reference<
79 : ::com::sun::star::beans::XPropertySet > & rPropSet );
80 :
81 0 : const SvXMLStylesContext *GetStyles() const { return (const SvXMLStylesContext *)&mxStyles; }
82 0 : const ::std::vector< XMLPropertyState > & GetProperties() const { return maProperties; }
83 :
84 : const ::com::sun::star::uno::Reference <
85 : ::com::sun::star::style::XStyle >&
86 0 : GetStyle() const { return mxStyle; }
87 0 : void SetStyle(
88 : const ::com::sun::star::uno::Reference<
89 0 : ::com::sun::star::style::XStyle >& xStl) { mxStyle = xStl; }
90 :
91 : virtual void SetDefaults() SAL_OVERRIDE;
92 :
93 : virtual void CreateAndInsert( bool bOverwrite ) SAL_OVERRIDE;
94 : virtual void Finish( bool bOverwrite ) SAL_OVERRIDE;
95 : };
96 :
97 : #endif
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|