xref: /trunk/main/xmloff/inc/xmloff/prstylei.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _XMLOFF_PRSTYLEI_HXX_
28 #define _XMLOFF_PRSTYLEI_HXX_
29 
30 #include "sal/config.h"
31 #include "xmloff/dllapi.h"
32 #include "sal/types.h"
33 #include <com/sun/star/style/XStyle.hpp>
34 #ifndef __SGI_STL_VECTOR
35 #include <vector>
36 #endif
37 #ifndef _XMLOFF_XMLSTYLE_HXX_
38 #include <xmloff/xmlstyle.hxx>
39 #endif
40 
41 struct XMLPropertyState;
42 class SvXMLStylesContext;
43 
44 namespace com { namespace sun { namespace star {
45     namespace beans { class XPropertySet; }
46 } } }
47 
48 class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext
49 {
50     const ::rtl::OUString msIsPhysical;
51     const ::rtl::OUString msFollowStyle;
52     ::std::vector< XMLPropertyState > maProperties;
53     ::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > mxStyle;
54     SvXMLImportContextRef               mxStyles;
55 
56     SAL_DLLPRIVATE XMLPropStyleContext(XMLPropStyleContext &); // not defined
57     SAL_DLLPRIVATE void operator =(XMLPropStyleContext &); // not defined
58 
59 protected:
60 
61     virtual void SetAttribute( sal_uInt16 nPrefixKey,
62                                const ::rtl::OUString& rLocalName,
63                                const ::rtl::OUString& rValue );
64     SvXMLStylesContext *GetStyles() { return (SvXMLStylesContext *)&mxStyles; }
65     ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; }
66 
67     // This methos my be overloaded to create a new style. Its called by
68     // CreateInsert to create a style if a style with the requested family and
69     // name couldn't be found. The st
70     virtual ::com::sun::star::uno::Reference <
71         ::com::sun::star::style::XStyle > Create();
72 
73 public:
74 
75     TYPEINFO();
76 
77     XMLPropStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
78             const ::rtl::OUString& rLName,
79             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
80             SvXMLStylesContext& rStyles, sal_uInt16 nFamily = 0,
81             sal_Bool bDefaultStyle=sal_False );
82     virtual ~XMLPropStyleContext();
83 
84     virtual SvXMLImportContext *CreateChildContext(
85             sal_uInt16 nPrefix,
86             const ::rtl::OUString& rLocalName,
87             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
88 
89     virtual void FillPropertySet(
90             const ::com::sun::star::uno::Reference<
91                 ::com::sun::star::beans::XPropertySet > & rPropSet );
92 
93     const SvXMLStylesContext *GetStyles() const { return (const SvXMLStylesContext *)&mxStyles; }
94     const ::std::vector< XMLPropertyState > & GetProperties() const { return maProperties; }
95 
96     const ::com::sun::star::uno::Reference <
97                 ::com::sun::star::style::XStyle >&
98             GetStyle() const { return mxStyle; }
99     void SetStyle(
100             const ::com::sun::star::uno::Reference<
101                 ::com::sun::star::style::XStyle >& xStl) { mxStyle = xStl; }
102 
103     virtual void SetDefaults();
104 
105     virtual void CreateAndInsert( sal_Bool bOverwrite );
106     virtual void Finish( sal_Bool bOverwrite );
107 };
108 
109 #endif
110