LibreOffice Module xmloff (master) 1
txtparaimphint.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <rtl/ustring.hxx>
24#include <utility>
26
27enum class XMLHintType
28{
32 // There is no 4 defined here
35 // Core impl. of the unification of drawing objects and Writer fly frames (#i26791#)
37};
38
40{
41 css::uno::Reference < css::text::XTextRange > xStart;
42 css::uno::Reference < css::text::XTextRange > xEnd;
43
45
46public:
47
49 css::uno::Reference < css::text::XTextRange > xS,
50 css::uno::Reference < css::text::XTextRange > xE ) :
51 xStart(std::move( xS )),
52 xEnd(std::move( xE )),
53 nType( nTyp )
54 {
55 }
56
57 virtual ~XMLHint_Impl() {}
58
59 const css::uno::Reference < css::text::XTextRange > & GetStart() const { return xStart; }
60 const css::uno::Reference < css::text::XTextRange > & GetEnd() const { return xEnd; }
61 void SetEnd( const css::uno::Reference < css::text::XTextRange > & rPos ) { xEnd = rPos; }
62
63 // We don't use virtual methods to differ between the sub classes,
64 // because this seems to be too expensive if compared to inline methods.
65 XMLHintType GetType() const { return nType; }
67};
68
70{
71 OUString sStyleName;
72
73public:
74
75 XMLStyleHint_Impl( OUString aStyleName,
76 const css::uno::Reference < css::text::XTextRange > & rPos ) :
78 sStyleName(std::move( aStyleName ))
79 {
80 }
81
82 const OUString& GetStyleName() const { return sStyleName; }
83};
84
86{
87 OUString sRefName;
88
89public:
90
91 XMLReferenceHint_Impl( OUString aRefName,
92 const css::uno::Reference < css::text::XTextRange > & rPos ) :
94 sRefName(std::move( aRefName ))
95 {
96 }
97
98 const OUString& GetRefName() const { return sRefName; }
99};
100
102{
103 OUString sHRef;
104 OUString sName;
106 OUString sStyleName;
109
110public:
111
112 XMLHyperlinkHint_Impl( const css::uno::Reference < css::text::XTextRange > & rPos ) :
114 {
115 }
116
117 void SetHRef( const OUString& s ) { sHRef = s; }
118 const OUString& GetHRef() const { return sHRef; }
119 void SetName( const OUString& s ) { sName = s; }
120 const OUString& GetName() const { return sName; }
121 void SetTargetFrameName( const OUString& s ) { sTargetFrameName = s; }
122 const OUString& GetTargetFrameName() const { return sTargetFrameName; }
123 void SetStyleName( const OUString& s ) { sStyleName = s; }
124 const OUString& GetStyleName() const { return sStyleName; }
125 void SetVisitedStyleName( const OUString& s ) { sVisitedStyleName = s; }
126 const OUString& GetVisitedStyleName() const { return sVisitedStyleName; }
128 {
129 return mxEvents.get();
130 }
132 {
133 mxEvents.set(pCtxt);
134 }
135};
136
138{
139 const css::uno::Reference<css::beans::XPropertySet> xIndexMarkPropSet;
140
141 const OUString sID;
142
143public:
144
145 XMLIndexMarkHint_Impl( css::uno::Reference < css::beans::XPropertySet > xPropSet,
146 const css::uno::Reference < css::text::XTextRange > & rPos ) :
148 xIndexMarkPropSet(std::move( xPropSet )),
149 sID()
150 {
151 }
152
153 XMLIndexMarkHint_Impl( css::uno::Reference < css::beans::XPropertySet > xPropSet,
154 const css::uno::Reference < css::text::XTextRange > & rPos,
155 OUString sIDString) :
157 xIndexMarkPropSet(std::move( xPropSet )),
158 sID(std::move(sIDString))
159 {
160 }
161
162 const css::uno::Reference<css::beans::XPropertySet> & GetMark() const
163 { return xIndexMarkPropSet; }
164 const OUString& GetID() const { return sID; }
165};
166
168{
169 // OD 2004-04-20 #i26791#
171
172public:
173
175 const css::uno::Reference < css::text::XTextRange > & rPos ) :
177 xContext( pContext )
178 {
179 }
180
181 css::uno::Reference < css::text::XTextContent > GetTextContent() const
182 {
183 css::uno::Reference < css::text::XTextContent > xTxt;
184 SvXMLImportContext *pContext = xContext.get();
185 if (XMLTextFrameContext *pFrameContext = dynamic_cast<XMLTextFrameContext*>(pContext))
186 xTxt = pFrameContext->GetTextContent();
187 else if (XMLTextFrameHyperlinkContext *pLinkContext = dynamic_cast<XMLTextFrameHyperlinkContext*>(pContext))
188 xTxt = pLinkContext->GetTextContent();
189
190 return xTxt;
191 }
192
193 // Frame "to character": anchor moves from first to last char after saving (#i33242#)
194 css::uno::Reference < css::drawing::XShape > GetShape() const
195 {
196 css::uno::Reference < css::drawing::XShape > xShape;
197 SvXMLImportContext *pContext = xContext.get();
198 if (XMLTextFrameContext *pFrameContext = dynamic_cast<XMLTextFrameContext*>(pContext))
199 xShape = pFrameContext->GetShape();
200 else if(XMLTextFrameHyperlinkContext *pLinkContext = dynamic_cast<XMLTextFrameHyperlinkContext*>(pContext))
201 xShape = pLinkContext->GetShape();
202
203 return xShape;
204 }
205
206 bool IsBoundAtChar() const
207 {
208 bool bRet = false;
209 SvXMLImportContext *pContext = xContext.get();
210 if (XMLTextFrameContext *pFrameContext = dynamic_cast<XMLTextFrameContext*>(pContext))
211 bRet = css::text::TextContentAnchorType_AT_CHARACTER ==
212 pFrameContext->GetAnchorType();
213 else if (XMLTextFrameHyperlinkContext *pLinkContext = dynamic_cast<XMLTextFrameHyperlinkContext*>(pContext))
214 bRet = css::text::TextContentAnchorType_AT_CHARACTER ==
215 pLinkContext->GetAnchorType();
216 return bRet;
217 }
218};
219
220// Core impl. of the unification of drawing objects and Writer fly frames (#i26791#)
222{
224
225public:
226
228 const css::uno::Reference < css::text::XTextRange > & rPos ) :
229 XMLHint_Impl( XMLHintType::XML_HINT_DRAW, rPos, rPos ),
230 xContext( pContext )
231 {
232 }
233
234 // Frame "to character": anchor moves from first to last char after saving (#i33242#)
235 css::uno::Reference < css::drawing::XShape > const & GetShape() const
236 {
237 return static_cast<SvXMLShapeContext*>(xContext.get())->getShape();
238 }
239};
240
241/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class deliberately does not support XWeak, to improve performance when loading large documents.
Definition: xmlictxt.hxx:48
SvXMLImportContextRef xContext
css::uno::Reference< css::drawing::XShape > const & GetShape() const
XMLDrawHint_Impl(SvXMLShapeContext *pContext, const css::uno::Reference< css::text::XTextRange > &rPos)
Import <script:events> element.
css::uno::Reference< css::text::XTextRange > xStart
const css::uno::Reference< css::text::XTextRange > & GetStart() const
bool IsReference() const
void SetEnd(const css::uno::Reference< css::text::XTextRange > &rPos)
XMLHintType nType
const css::uno::Reference< css::text::XTextRange > & GetEnd() const
css::uno::Reference< css::text::XTextRange > xEnd
virtual ~XMLHint_Impl()
XMLHint_Impl(XMLHintType nTyp, css::uno::Reference< css::text::XTextRange > xS, css::uno::Reference< css::text::XTextRange > xE)
XMLHintType GetType() const
const OUString & GetTargetFrameName() const
XMLEventsImportContext * GetEventsContext() const
void SetTargetFrameName(const OUString &s)
void SetHRef(const OUString &s)
rtl::Reference< XMLEventsImportContext > mxEvents
void SetStyleName(const OUString &s)
const OUString & GetName() const
void SetName(const OUString &s)
void SetEventsContext(XMLEventsImportContext *pCtxt)
void SetVisitedStyleName(const OUString &s)
const OUString & GetHRef() const
XMLHyperlinkHint_Impl(const css::uno::Reference< css::text::XTextRange > &rPos)
const OUString & GetVisitedStyleName() const
const OUString & GetStyleName() const
const css::uno::Reference< css::beans::XPropertySet > & GetMark() const
const OUString & GetID() const
XMLIndexMarkHint_Impl(css::uno::Reference< css::beans::XPropertySet > xPropSet, const css::uno::Reference< css::text::XTextRange > &rPos)
XMLIndexMarkHint_Impl(css::uno::Reference< css::beans::XPropertySet > xPropSet, const css::uno::Reference< css::text::XTextRange > &rPos, OUString sIDString)
const css::uno::Reference< css::beans::XPropertySet > xIndexMarkPropSet
const OUString & GetRefName() const
XMLReferenceHint_Impl(OUString aRefName, const css::uno::Reference< css::text::XTextRange > &rPos)
const OUString & GetStyleName() const
XMLStyleHint_Impl(OUString aStyleName, const css::uno::Reference< css::text::XTextRange > &rPos)
SvXMLImportContextRef xContext
css::uno::Reference< css::text::XTextContent > GetTextContent() const
css::uno::Reference< css::drawing::XShape > GetShape() const
XMLTextFrameHint_Impl(SvXMLImportContext *pContext, const css::uno::Reference< css::text::XTextRange > &rPos)
Used for hyperlinks attached to objects (drawing objects, text boxes, Writer frames)
XMLHintType