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