20#ifndef INCLUDED_SW_SOURCE_CORE_INC_WRONG_HXX
21#define INCLUDED_SW_SOURCE_CORE_INC_WRONG_HXX
23#include <com/sun/star/container/NoSuchElementException.hpp>
24#include <com/sun/star/container/XStringKeyMap.hpp>
26#include <com/sun/star/awt/FontUnderline.hpp>
27#include <com/sun/star/uno/Any.hxx>
79 css::uno::Reference< css::container::XStringKeyMap >
const & xPropertyBag,
84 css::uno::Reference< css::container::XStringKeyMap >
const & xPropertyBag,
94 if (xPropertyBag.is())
96 css::uno::Any aLineColor = xPropertyBag->getValue(
"LineColor");
99 if (aLineColor >>= lineColor)
105 catch(
const css::container::NoSuchElementException&)
108 catch(
const css::uno::RuntimeException&)
119 if (xPropertyBag.is())
121 css::uno::Any aLineType = xPropertyBag->getValue(
"LineType");
122 ::sal_Int16 lineType = 0;
124 if (!(aLineType >>= lineType))
128 if (css::awt::FontUnderline::BOLDWAVE == lineType)
132 if (css::awt::FontUnderline::BOLD == lineType)
136 if (css::awt::FontUnderline::DASH == lineType)
140 if (css::awt::FontUnderline::SMALLWAVE == lineType)
146 catch(
const css::container::NoSuchElementException&)
149 catch(
const css::uno::RuntimeException&)
156 static Color getSmartColor ( css::uno::Reference< css::container::XStringKeyMap >
const & xPropertyBag)
160 if (xPropertyBag.is())
162 css::uno::Any aLineColor = xPropertyBag->getValue(
"LineColor");
165 if (aLineColor >>= lineColor)
171 catch(
const css::container::NoSuchElementException&)
174 catch(
const css::uno::RuntimeException&)
185 if (xPropertyBag.is())
187 css::uno::Any aLineType = xPropertyBag->getValue(
"LineType");
188 ::sal_Int16 lineType = 0;
190 if (!(aLineType >>= lineType))
194 if (css::awt::FontUnderline::WAVE == lineType)
198 if (css::awt::FontUnderline::BOLDWAVE == lineType)
202 if (css::awt::FontUnderline::BOLD == lineType)
206 if (css::awt::FontUnderline::SMALLWAVE == lineType)
212 catch(
const css::container::NoSuchElementException&)
215 catch(
const css::uno::RuntimeException&)
223 css::uno::Reference< css::container::XStringKeyMap >
const & xPropertyBag )
242 css::uno::Reference< css::container::XStringKeyMap >
const & xPropertyBag )
270 static void ShiftLeft( sal_Int32 &rPos, sal_Int32 nStart, sal_Int32 nEnd )
271 {
if( rPos > nStart ) rPos = rPos > nEnd ? rPos - nEnd + nStart : nStart; }
272 void Invalidate_( sal_Int32 nBegin, sal_Int32 nEnd );
274 void Insert(sal_uInt16 nWhere, std::vector<SwWrongArea>::iterator startPos, std::vector<SwWrongArea>::iterator
const & endPos);
275 void Remove( sal_uInt16 nIdx, sal_uInt16 nLen );
290 void SetInvalid( sal_Int32 nBegin, sal_Int32 nEnd );
292 void Invalidate( sal_Int32 nBegin, sal_Int32 nEnd );
293 bool InvalidateWrong();
295 FreshState Fresh( sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nPos,
296 sal_Int32 nLen, sal_uInt16 nIndex, sal_Int32 nCursorPos );
297 sal_uInt16 GetWrongPos( sal_Int32 nValue )
const;
299 bool Check( sal_Int32 &rChk, sal_Int32 &rLn )
const;
300 bool InWrongWord( sal_Int32 &rChk, sal_Int32 &rLn )
const;
301 sal_Int32 NextWrong( sal_Int32 nChk )
const;
303 void Move( sal_Int32 nPos, sal_Int32 nDiff );
308 std::unique_ptr<SwWrongList> SplitList( sal_Int32 nSplitPos );
311 void JoinList(
SwWrongList* pNext, sal_Int32 nInsertPos );
313 sal_Int32
Len( sal_uInt16 nIdx )
const
315 return nIdx < maList.size() ? maList[nIdx].mnLen : 0;
318 sal_Int32
Pos( sal_uInt16 nIdx )
const
320 return nIdx < maList.size() ? maList[nIdx].mnPos : 0;
323 sal_uInt16
Count()
const {
return o3tl::narrowing<sal_uInt16>(maList.size()); }
326 css::uno::Reference< css::container::XStringKeyMap >
const & xPropertyBag,
327 sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere )
329 std::vector<SwWrongArea>::iterator
i = maList.begin();
330 if ( nWhere >= maList.size() )
338 void Insert(
const OUString& rType,
339 css::uno::Reference< css::container::XStringKeyMap >
const & xPropertyBag,
340 sal_Int32 nNewPos, sal_Int32 nNewLen );
344 return nIdx < maList.size() ? maList[nIdx].mpSubList :
nullptr;
347 void InsertSubList( sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere,
SwWrongList* pSubList );
351 return nIdx < maList.size() ? &maList[nIdx] :
nullptr;
353 void RemoveEntry( sal_Int32 nBegin, sal_Int32 nEnd );
354 bool LookForEntry( sal_Int32 nBegin, sal_Int32 nEnd );
406 std::optional<std::pair<TextFrameIndex, TextFrameIndex>>
GetElementAt(sal_uInt16
nIndex);
Represents the visualization of a paragraph.
SwTextNode is a paragraph in the document model.
static const SwViewOption & GetCurrentViewOptions()
const Color & GetSpellColor() const
const Color & GetGrammarColor() const
const Color & GetSmarttagColor() const
static Color getWrongAreaColor(WrongListType listType, css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
WrongAreaLineType mLineType
static WrongAreaLineType getSmartLineType(css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
static WrongAreaLineType getGrammarLineType(css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
SwWrongArea(OUString aType, WrongListType listType, css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag, sal_Int32 nPos, sal_Int32 nLen)
css::uno::Reference< css::container::XStringKeyMap > mxPropertyBag
static Color getSmartColor(css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
static Color getGrammarColor(css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
static WrongAreaLineType getWrongAreaLineType(WrongListType listType, css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
sal_Int32 GetEndInv() const
WrongListType GetWrongListType() const
const SwWrongArea * GetElement(sal_uInt16 nIdx) const
void Insert(const OUString &rType, css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag, sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere)
std::vector< SwWrongArea > maList
sal_Int32 Pos(sal_uInt16 nIdx) const
SwWrongList(const SwWrongList &rCpy)=delete
SwWrongList * SubList(sal_uInt16 nIdx) const
static void ShiftLeft(sal_Int32 &rPos, sal_Int32 nStart, sal_Int32 nEnd)
sal_Int32 GetBeginInv() const
sal_Int32 Len(sal_uInt16 nIdx) const
sw::MergedPara const *const m_pMergedPara
SwWrongList const *(SwTextNode::*const m_pGetWrongList)() const
WrongListIteratorBase(SwTextFrame const &rFrame, SwWrongList const *(SwTextNode::*pGetWrongList)() const)
for the text frame
SwWrongList const *const m_pWrongList
TextFrameIndex m_CurrentIndex
sal_uInt16 GetElementCount()
std::optional< std::pair< TextFrameIndex, TextFrameIndex > > GetElementAt(sal_uInt16 nIndex)
WrongListIteratorCounter(SwTextFrame const &rFrame, SwWrongList const *(SwTextNode::*pGetWrongList)() const)
bool Check(TextFrameIndex &rStart, TextFrameIndex &rLen)
WrongListIterator(SwTextFrame const &rFrame, SwWrongList const *(SwTextNode::*pGetWrongList)() const)
for the text frame
const SwWrongArea * GetWrongElement(TextFrameIndex nStart)
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName) override
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
Dialog to specify the properties of date form field.
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
constexpr sal_Int32 COMPLETE_STRING
@ WRONGLIST_CHANGETRACKING