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 
24 #ifndef _XMLTEXTFRAMECONTEXT_HXX
25 #define _XMLTEXTFRAMECONTEXT_HXX
26 
27 #ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP
28 #include <com/sun/star/text/TextContentAnchorType.hpp>
29 #endif
30 #include <xmloff/xmlictxt.hxx>
31 #include <xmloff/xmlmultiimagehelper.hxx>
32 
33 namespace com { namespace sun { namespace star {
34 	namespace text { class XTextCursor; class XTextContent; }
35 } } }
36 
37 class SvXMLAttributeList;
38 class XMLTextFrameContextHyperlink_Impl;
39 
40 class XMLTextFrameContext : public SvXMLImportContext, public multiImageImportHelper
41 {
42 	::com::sun::star::uno::Reference<
43 		::com::sun::star::xml::sax::XAttributeList > m_xAttrList;
44 
45     SvXMLImportContextRef m_xImplContext;
46     SvXMLImportContextRef m_xReplImplContext;
47 	SvXMLAttributeList *m_pAttrList;
48 
49 	XMLTextFrameContextHyperlink_Impl	*m_pHyperlink;
50     // --> OD 2009-07-22 #i73249#
51     ::rtl::OUString m_sTitle;
52     // <--
53 	::rtl::OUString	m_sDesc;
54 
55 	::com::sun::star::text::TextContentAnchorType 	m_eDefaultAnchorType;
56 
57     // --> OD 2006-03-10 #i51726#
58     // The <draw:name> can longer be used to distinguish Writer graphic/text box
59     // objects and Draw graphic/text box objects.
60     // The new distinguish attribute is the parent style of the automatic style
61     // of the object. All Draw objects have an automatic style without a parent style.
62     sal_Bool m_HasAutomaticStyleWithoutParentStyle;
63     // <--
64 	sal_Bool m_bSupportsReplacement;
65 
66 	sal_Bool CreateIfNotThere();
67 	sal_Bool CreateIfNotThere( ::com::sun::star::uno::Reference <
68 		::com::sun::star::beans::XPropertySet >& rPropSet );
69 
70 protected:
71     /// helper to get the created xShape instance, needs to be overloaded
72     virtual rtl::OUString getGraphicURLFromImportContext(const SvXMLImportContext& rContext) const;
73     virtual void removeGraphicFromImportContext(const SvXMLImportContext& rContext) const;
74 
75 public:
76 
77 	TYPEINFO();
78 
79 	XMLTextFrameContext( SvXMLImport& rImport,
80 			sal_uInt16 nPrfx,
81 			const ::rtl::OUString& rLName,
82 			const ::com::sun::star::uno::Reference<
83 				::com::sun::star::xml::sax::XAttributeList > & xAttrList,
84 			::com::sun::star::text::TextContentAnchorType eDfltAnchorType );
85 	virtual ~XMLTextFrameContext();
86 
87 	virtual void EndElement();
88 
89 	SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
90 				const ::rtl::OUString& rLocalName,
91 			 	const ::com::sun::star::uno::Reference<
92 					::com::sun::star::xml::sax::XAttributeList > & xAttrList );
93 
94 	void SetHyperlink( const ::rtl::OUString& rHRef,
95 					   const ::rtl::OUString& rName,
96 					   const ::rtl::OUString& rTargetFrameName,
97 					   sal_Bool bMap );
98 
99 	::com::sun::star::text::TextContentAnchorType GetAnchorType() const;
100 
101 	::com::sun::star::uno::Reference <
102 		::com::sun::star::text::XTextContent > GetTextContent() const;
103     // --> OD 2004-08-24 #i33242#
104     ::com::sun::star::uno::Reference <
105         ::com::sun::star::drawing::XShape > GetShape() const;
106     // <--
107 };
108 
109 
110 #endif
111