xref: /trunk/main/xmloff/inc/xmloff/prstylei.hxx (revision b5da552ccefc4034e06a43bfae43fb8a8b64a7ad)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _XMLOFF_PRSTYLEI_HXX_
24 #define _XMLOFF_PRSTYLEI_HXX_
25 
26 #include "sal/config.h"
27 #include "xmloff/dllapi.h"
28 #include "sal/types.h"
29 #include <com/sun/star/style/XStyle.hpp>
30 #ifndef __SGI_STL_VECTOR
31 #include <vector>
32 #endif
33 #ifndef _XMLOFF_XMLSTYLE_HXX_
34 #include <xmloff/xmlstyle.hxx>
35 #endif
36 
37 struct XMLPropertyState;
38 class SvXMLStylesContext;
39 
40 namespace com { namespace sun { namespace star {
41     namespace beans { class XPropertySet; }
42 } } }
43 
44 class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext
45 {
46     const ::rtl::OUString msIsPhysical;
47     const ::rtl::OUString msFollowStyle;
48     ::std::vector< XMLPropertyState > maProperties;
49     ::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > mxStyle;
50     SvXMLImportContextRef               mxStyles;
51 
52     SAL_DLLPRIVATE XMLPropStyleContext(XMLPropStyleContext &); // not defined
53     SAL_DLLPRIVATE void operator =(XMLPropStyleContext &); // not defined
54 
55 protected:
56 
57     virtual void SetAttribute( sal_uInt16 nPrefixKey,
58                                const ::rtl::OUString& rLocalName,
59                                const ::rtl::OUString& rValue );
60     SvXMLStylesContext *GetStyles() { return (SvXMLStylesContext *)&mxStyles; }
61     ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; }
62 
63     // This methos my be overloaded to create a new style. Its called by
64     // CreateInsert to create a style if a style with the requested family and
65     // name couldn't be found. The st
66     virtual ::com::sun::star::uno::Reference <
67         ::com::sun::star::style::XStyle > Create();
68 
69 public:
70 
71     TYPEINFO();
72 
73     XMLPropStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
74             const ::rtl::OUString& rLName,
75             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
76             SvXMLStylesContext& rStyles, sal_uInt16 nFamily = 0,
77             sal_Bool bDefaultStyle=sal_False );
78     virtual ~XMLPropStyleContext();
79 
80     virtual SvXMLImportContext *CreateChildContext(
81             sal_uInt16 nPrefix,
82             const ::rtl::OUString& rLocalName,
83             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
84 
85     virtual void FillPropertySet(
86             const ::com::sun::star::uno::Reference<
87                 ::com::sun::star::beans::XPropertySet > & rPropSet );
88 
89     const SvXMLStylesContext *GetStyles() const { return (const SvXMLStylesContext *)&mxStyles; }
90     const ::std::vector< XMLPropertyState > & GetProperties() const { return maProperties; }
91 
92     const ::com::sun::star::uno::Reference <
93                 ::com::sun::star::style::XStyle >&
94             GetStyle() const { return mxStyle; }
95     void SetStyle(
96             const ::com::sun::star::uno::Reference<
97                 ::com::sun::star::style::XStyle >& xStl) { mxStyle = xStl; }
98 
99     virtual void SetDefaults();
100 
101     virtual void CreateAndInsert( sal_Bool bOverwrite );
102     virtual void Finish( sal_Bool bOverwrite );
103 };
104 
105 #endif
106