26 #include <com/sun/star/text/TextMarkupType.hpp>
27 #include <com/sun/star/beans/PropertyAttribute.hpp>
34 #include <viewimp.hxx>
51 #include <com/sun/star/lang/XUnoTunnel.hpp>
52 #include <com/sun/star/text/XTextRange.hpp>
58 uno::Reference<text::XFlatParagraphIterator>
60 bool const bAutomatic)
69 , maExpandText(aExpandText)
79 uno::Reference< beans::XPropertySetInfo > SAL_CALL
85 { OUString(), -1, css::uno::Type(), 0, 0 }
93 throw lang::IllegalArgumentException(
"no values can be set",
94 static_cast< ::cppu::OWeakObject*>(
this), 0);
102 if (rPropertyName ==
"FieldPositions")
106 else if (rPropertyName ==
"FootnotePositions")
116 const uno::Reference< beans::XPropertyChangeListener >& )
119 "SwXFlatParagraph::addPropertyChangeListener(): not implemented");
125 const uno::Reference< beans::XPropertyChangeListener >& )
128 "SwXFlatParagraph::removePropertyChangeListener(): not implemented");
134 const uno::Reference< beans::XVetoableChangeListener >& )
137 "SwXFlatParagraph::addVetoableChangeListener(): not implemented");
143 const uno::Reference< beans::XVetoableChangeListener >& )
146 "SwXFlatParagraph::removeVetoableChangeListener(): not implemented");
156 const css::uno::Reference< css::container::XStringKeyMap > & xMarkupInfoContainer)
162 void SAL_CALL
SwXFlatParagraph::commitStringMarkup(::sal_Int32 nType,
const OUString & rIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength,
const css::uno::Reference< css::container::XStringKeyMap > & rxMarkupInfoContainer)
182 if ( text::TextMarkupType::SPELLCHECK == nType )
184 GetTextNode()->SetWrongDirty(
187 else if ( text::TextMarkupType::SMARTTAG == nType )
188 GetTextNode()->SetSmartTagDirty( !bVal );
189 else if( text::TextMarkupType::PROOFREADING == nType )
191 GetTextNode()->SetGrammarCheckDirty( !bVal );
203 if ( text::TextMarkupType::SPELLCHECK == nType )
204 return !GetTextNode()->IsWrongDirty();
205 else if ( text::TextMarkupType::PROOFREADING == nType )
206 return !GetTextNode()->IsGrammarCheckDirty();
207 else if ( text::TextMarkupType::SMARTTAG == nType )
208 return !GetTextNode()->IsSmartTagDirty();
218 return nullptr == GetTextNode();
228 const lang::Locale aLocale(
SW_BREAKITER()->GetLocale( GetTextNode()->GetLang(nPos, nLen) ) );
240 const lang::Locale aLocale(
SW_BREAKITER()->GetLocale( GetTextNode()->GetLang(nPos, nLen) ) );
245 void SAL_CALL
SwXFlatParagraph::changeText(::sal_Int32 nPos, ::sal_Int32 nLen,
const OUString & aNewText,
const css::uno::Sequence< css::beans::PropertyValue > & aAttributes)
252 SwTextNode *
const pOldTextNode = GetTextNode();
254 if (nPos < 0 || pOldTextNode->Len() < nPos || nLen < 0 ||
o3tl::make_unsigned(pOldTextNode->
Len()) < static_cast<sal_uInt32>(nPos) + nLen)
256 throw lang::IllegalArgumentException();
259 SwPaM aPaM( *GetTextNode(), nPos, *GetTextNode(), nPos+nLen );
263 const uno::Reference< text::XTextRange > xRange =
266 uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
269 for (
const auto& rAttribute : aAttributes )
270 xPropSet->setPropertyValue( rAttribute.Name, rAttribute.Value );
287 if (nPos < 0 || GetTextNode()->Len() < nPos || nLen < 0 ||
o3tl::make_unsigned(GetTextNode()->Len()) < static_cast<sal_uInt32>(nPos) + nLen)
289 throw lang::IllegalArgumentException();
292 SwPaM aPaM( *GetTextNode(), nPos, *GetTextNode(), nPos+nLen );
296 const uno::Reference< text::XTextRange > xRange =
299 uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
302 for (
const auto& rAttribute : aAttributes )
303 xPropSet->setPropertyValue( rAttribute.Name, rAttribute.Value );
312 return css::uno::Sequence< ::sal_Int32>();
315 const uno::Sequence< sal_Int8 >&
319 return theSwXFlatParagraphUnoTunnelId.
getSeq();
324 const uno::Sequence< sal_Int8 >& rId)
332 mbAutomatic( bAutomatic ),
334 mnEndNode( rDoc.GetNodes().
Count() )
350 if(rHint.
GetId() == SfxHintId::Dying)
366 uno::Reference< text::XFlatParagraph > xRet;
379 while ( pCurrentPage && pCurrentPage != pStopPage )
384 if ( (
mnType == text::TextMarkupType::PROOFREADING ||
mnType == text::TextMarkupType::SPELLCHECK )
391 while( pCnt && pCurrentPage->
IsAnLower( pCnt ) )
395 SwTextFrame const*
const pText(static_cast<SwTextFrame const*>(pCnt));
400 for (
auto const& e : pMergedPara->extents)
402 if (e.pNode != pTextNode)
405 if ((
mnType == text::TextMarkupType::SPELLCHECK
407 (
mnType == text::TextMarkupType::PROOFREADING
419 if ((
mnType == text::TextMarkupType::SPELLCHECK
420 && pTextNode->IsWrongDirty()) ||
421 (
mnType == text::TextMarkupType::PROOFREADING
422 && pTextNode->IsGrammarCheckDirty()))
449 if ( !pCurrentPage && !pStopPage )
451 pStopPage = pStartPage;
483 const OUString& aExpandText = aConversionMap.
getViewText();
502 uno::Reference< text::XFlatParagraph > xRet;
506 const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY);
507 SAL_WARN_IF(!xFPTunnel.is(),
"sw.core",
"invalid argument");
508 SwXFlatParagraph*
const pFlatParagraph(comphelper::getFromUnoTunnel<SwXFlatParagraph>(xFPTunnel));
510 if ( !pFlatParagraph )
523 SwNode* pNd = rNodes[ nCurrentNode ];
524 pNextTextNode =
dynamic_cast<SwTextNode*
>(pNd);
533 const OUString& aExpandText = aConversionMap.
getViewText();
547 uno::Reference< text::XFlatParagraph > xRet;
551 const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY);
553 SAL_WARN_IF(!xFPTunnel.is(),
"sw.core",
"invalid argument");
554 SwXFlatParagraph*
const pFlatParagraph(comphelper::getFromUnoTunnel<SwXFlatParagraph>(xFPTunnel));
556 if ( !pFlatParagraph )
569 SwNode* pNd = rNodes[ nCurrentNode ];
570 pPrevTextNode =
dynamic_cast<SwTextNode*
>(pNd);
579 const OUString& aExpandText = aConversionMap.
getViewText();
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
bool IsAnLower(const SwFrame *) const
vcl::RenderContext * GetOut() const
Represents the visualization of a paragraph.
SwContentFrame * GetNextContentFrame() const
uno::Reference< text::XFlatParagraphIterator > CreateFlatParagraphIterator(SwDoc &rDoc, sal_Int32 const nTextMarkupType, bool const bAutomatic)
virtual const SwRootFrame * GetCurrentLayout() const =0
bool IsWrongDirty() const
virtual OUString SAL_CALL getText() override
SwXFlatParagraphIterator(SwDoc &rDoc, sal_Int32 nType, bool bAutomatic)
void ValidateSpelling() const
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL changeText(::sal_Int32 nPos,::sal_Int32 nLen, const OUString &aNewText, const css::uno::Sequence< css::beans::PropertyValue > &aAttributes) override
virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getParaAfter(const css::uno::Reference< css::text::XFlatParagraph > &xPara) override
virtual sal_Int32 Len() const override
const SwPosition * GetMark() const
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
sw::MergedPara * GetMergedPara()
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual sal_Bool SAL_CALL isModified() override
virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() override
virtual void Notify(const SfxHint &) override
::cppu::ImplInheritanceHelper< SwXTextMarkup, css::beans::XPropertySet, css::text::XFlatParagraph, css::lang::XUnoTunnel > SwXFlatParagraph_Base
const SwPageFrame * GetFirstVisPage(OutputDevice const *pRenderContext) const
Management of the first visible Page.
virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getParaBefore(const css::uno::Reference< css::text::XFlatParagraph > &xPara) override
SwNodeOffset mnCurrentNode
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
std::set< css::uno::Reference< css::text::XFlatParagraph > > m_aFlatParaList
bool IsInvalidSpelling() const
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
virtual ~SwXFlatParagraphIterator() override
virtual void SAL_CALL changeAttributes(::sal_Int32 nPos,::sal_Int32 nLen, const css::uno::Sequence< css::beans::PropertyValue > &aAttributes) override
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
const css::uno::Sequence< sal_Int8 > & getSeq() const
PaM is Point and Mark: a selection of the document model.
SwTextNode * GetTextNodeFirst()
virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const OUString &aIdentifier, const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::container::XStringKeyMap > &xMarkupInfoContainer) override
const OUString & getViewText() const
const SwPosition * GetPoint() const
virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getLastPara() override
virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const OUString &aIdentifier,::sal_Int32 nStart,::sal_Int32 nLength, const css::uno::Reference< css::container::XStringKeyMap > &xMarkupInfoContainer) override
IDocumentContentOperations & getIDocumentContentOperations()
Provides access to the document content operations interface.
const SwFrame * Lower() const
SwNodeOffset GetIndex() const
virtual css::lang::Locale SAL_CALL getLanguageOfText(::sal_Int32 nPos,::sal_Int32 nLen) override
virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getFirstPara() override
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
virtual bool ReplaceRange(SwPaM &rPam, const OUString &rNewStr, const bool bRegExReplace)=0
Replace selected range in a TextNode with string.
bool IsOnlineSpell() const
Text operation/manipulation interface.
bool StartListening(SvtBroadcaster &rBroadcaster)
A page of the document layout.
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
virtual sal_Bool SAL_CALL isChecked(::sal_Int32 nType) override
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
SvtBroadcaster & GetNotifier()
SwTextNode is a paragraph in the document model.
#define SAL_WARN_IF(condition, area, stream)
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual void SAL_CALL commitTextRangeMarkup(::sal_Int32 nType, const OUString &aIdentifier, const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::container::XStringKeyMap > &xMarkupInfoContainer) override
const SwViewOption * GetViewOptions() const
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
SwXFlatParagraph(SwTextNode &rTextNode, const OUString &aExpandText, const ModelToViewHelper &rConversionMap)
virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getLanguagePortions() override
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
virtual css::lang::Locale SAL_CALL getPrimaryLanguageOfText(::sal_Int32 nPos,::sal_Int32 nLen) override
SwNodeOffset Count() const
virtual ~SwXFlatParagraph() override
#define SAL_WARN(area, stream)
virtual css::uno::Reference< css::container::XStringKeyMap > SAL_CALL getMarkupInfoContainer() override
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rId) override
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
SwRootFrame * GetLayout() const
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
virtual void SAL_CALL setChecked(::sal_Int32 nType, sal_Bool bVal) override
virtual css::uno::Reference< css::text::XFlatParagraph > SAL_CALL getNextPara() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
bool IsGrammarCheckDirty() const
virtual void SAL_CALL commitStringMarkup(::sal_Int32 nType, const OUString &aIdentifier,::sal_Int32 nStart,::sal_Int32 nLength, const css::uno::Reference< css::container::XStringKeyMap > &xMarkupInfoContainer) override
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
Base class of the Writer document model elements.