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/util/Color.hpp>
27 #include <com/sun/star/awt/FontUnderline.hpp>
28 #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 );
296 sal_Int32 nLen, sal_uInt16 nIndex, sal_Int32 nCursorPos );
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 );
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 static_cast<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() )
335 maList.insert(i,
SwWrongArea( rType, meType, xPropertyBag, nNewPos, nNewLen) );
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;
351 return nIdx < maList.size() ? &maList[nIdx] :
nullptr;
353 void RemoveEntry( sal_Int32 nBegin, sal_Int32 nEnd );
406 std::optional<std::pair<TextFrameIndex, TextFrameIndex>>
GetElementAt(sal_uInt16
nIndex);
sal_Int32 Pos(sal_uInt16 nIdx) const
Represents the visualization of a paragraph.
const SwWrongArea * GetWrongElement(TextFrameIndex nStart)
void Invalidate_(sal_Int32 nBegin, sal_Int32 nEnd)
FreshState Fresh(sal_Int32 &rStart, sal_Int32 &rEnd, sal_Int32 nPos, sal_Int32 nLen, sal_uInt16 nIndex, sal_Int32 nCursorPos)
Remove given range of entries.
void Move(sal_Int32 nPos, sal_Int32 nDiff)
Change all values after the given position.
void Insert(const OUString &rType, css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag, sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere)
SwWrongList const *const m_pWrongList
void InsertSubList(sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere, SwWrongList *pSubList)
WrongAreaLineType mLineType
Dialog to specify the properties of date form field.
static Color & GetSmarttagColor()
static WrongAreaLineType getWrongAreaLineType(WrongListType listType, css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
WrongListIteratorBase(SwTextFrame const &rFrame, SwWrongList const *(SwTextNode::*pGetWrongList)() const)
for the text frame
void RemoveEntry(sal_Int32 nBegin, sal_Int32 nEnd)
SwWrongList * SubList(sal_uInt16 nIdx) const
static WrongAreaLineType getGrammarLineType(css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
virtual void CopyFrom(const SwWrongList &rCopy)
void Remove(sal_uInt16 nIdx, sal_uInt16 nLen)
void JoinList(SwWrongList *pNext, sal_Int32 nInsertPos)
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
virtual SwWrongList * Clone()
sal_Int32 NextWrong(sal_Int32 nChk) const
Find next incorrectly selected position.
static Color getWrongAreaColor(WrongListType listType, css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
SwWrongList const *(SwTextNode::*const m_pGetWrongList)() const
SwWrongList * SplitList(sal_Int32 nSplitPos)
sw::MergedPara const *const m_pMergedPara
sal_Int32 Len(sal_uInt16 nIdx) const
bool LookForEntry(sal_Int32 nBegin, sal_Int32 nEnd)
void Invalidate(sal_Int32 nBegin, sal_Int32 nEnd)
static WrongAreaLineType getSmartLineType(css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
bool Check(sal_Int32 &rChk, sal_Int32 &rLn) const
Calculate first incorrectly selected area.
sal_Int32 GetEndInv() const
WrongListIteratorCounter(SwTextFrame const &rFrame, SwWrongList const *(SwTextNode::*pGetWrongList)() const)
bool Check(TextFrameIndex &rStart, TextFrameIndex &rLen)
SwTextNode is a paragraph in the document model.
WrongListType GetWrongListType() const
sal_Int32 GetBeginInv() const
WrongListIterator(SwTextFrame const &rFrame, SwWrongList const *(SwTextNode::*pGetWrongList)() const)
for the text frame
sal_uInt16 GetWrongPos(sal_Int32 nValue) const
Find the first position that is greater or equal to the given value.
bool InWrongWord(sal_Int32 &rChk, sal_Int32 &rLn) const
If a word is incorrectly selected, this method returns begin and length of it.
static void ShiftLeft(sal_Int32 &rPos, sal_Int32 nStart, sal_Int32 nEnd)
const SwWrongArea * GetElement(sal_uInt16 nIdx) const
SwWrongList(const SwWrongList &rCpy)=delete
std::optional< std::pair< TextFrameIndex, TextFrameIndex > > GetElementAt(sal_uInt16 nIndex)
sal_uInt16 GetElementCount()
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTBLUE
static Color & GetSpellColor()
SwWrongArea(const OUString &rType, WrongListType listType, css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag, sal_Int32 nPos, sal_Int32 nLen)
std::vector< SwWrongArea > maList
TextFrameIndex m_CurrentIndex
static Color getGrammarColor(css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
void Insert(sal_uInt16 nWhere, std::vector< SwWrongArea >::iterator startPos, std::vector< SwWrongArea >::iterator const &endPos)
static Color getSmartColor(css::uno::Reference< css::container::XStringKeyMap > const &xPropertyBag)
const sal_Int32 COMPLETE_STRING
SwWrongList & operator=(const SwWrongList &)=delete
void SetInvalid(sal_Int32 nBegin, sal_Int32 nEnd)