summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 15:58:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 20:45:59 +0200
commitd72f963c0de0c2e48f1dc999cd8687e13a1f676f (patch)
tree9f5e314e1f9e504706cc18675f9408fe3c8db8ea /editeng
parent1c3929a0a1645e802ee18f9c3d3d380375500c72 (diff)
loplugin:flatten in editeng
Change-Id: I5c83183d1f9d2d8f5a25b976ead1a7598a75c641 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92197 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/accessibility/AccessibleContextBase.cxx98
-rw-r--r--editeng/source/accessibility/AccessibleEditableTextPara.cxx106
-rw-r--r--editeng/source/accessibility/AccessibleImageBullet.cxx24
-rw-r--r--editeng/source/editeng/editdoc.cxx22
-rw-r--r--editeng/source/editeng/editeng.cxx150
-rw-r--r--editeng/source/editeng/editobj.cxx40
-rw-r--r--editeng/source/editeng/editview.cxx550
-rw-r--r--editeng/source/editeng/eehtml.cxx66
-rw-r--r--editeng/source/editeng/impedit.cxx649
-rw-r--r--editeng/source/editeng/impedit2.cxx354
-rw-r--r--editeng/source/editeng/impedit3.cxx256
-rw-r--r--editeng/source/editeng/impedit4.cxx355
-rw-r--r--editeng/source/editeng/impedit5.cxx68
-rw-r--r--editeng/source/items/legacyitem.cxx64
-rw-r--r--editeng/source/items/numitem.cxx48
-rw-r--r--editeng/source/items/svxfont.cxx28
-rw-r--r--editeng/source/misc/acorrcfg.cxx431
-rw-r--r--editeng/source/misc/hangulhanja.cxx158
-rw-r--r--editeng/source/misc/splwrap.cxx26
-rw-r--r--editeng/source/misc/svxacorr.cxx64
-rw-r--r--editeng/source/misc/txtrange.cxx55
-rw-r--r--editeng/source/misc/unolingu.cxx22
-rw-r--r--editeng/source/outliner/outleeng.cxx26
-rw-r--r--editeng/source/outliner/outliner.cxx414
-rw-r--r--editeng/source/outliner/outlvw.cxx44
-rw-r--r--editeng/source/rtf/rtfitem.cxx168
-rw-r--r--editeng/source/rtf/svxrtf.cxx276
-rw-r--r--editeng/source/uno/unoedhlp.cxx104
-rw-r--r--editeng/source/uno/unotext.cxx413
-rw-r--r--editeng/source/uno/unotext2.cxx86
30 files changed, 2580 insertions, 2585 deletions
diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx
index d99cfa031d76..72ac002c9940 100644
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ b/editeng/source/accessibility/AccessibleContextBase.cxx
@@ -347,19 +347,19 @@ lang::Locale SAL_CALL
void SAL_CALL AccessibleContextBase::addAccessibleEventListener (
const uno::Reference<XAccessibleEventListener >& rxListener)
{
- if (rxListener.is())
+ if (!rxListener.is())
+ return;
+
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
{
- if (rBHelper.bDisposed || rBHelper.bInDispose)
- {
- uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY);
- rxListener->disposing (lang::EventObject (x));
- }
- else
- {
- if (!mnClientId)
- mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
- comphelper::AccessibleEventNotifier::addEventListener( mnClientId, rxListener );
- }
+ uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY);
+ rxListener->disposing (lang::EventObject (x));
+ }
+ else
+ {
+ if (!mnClientId)
+ mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( mnClientId, rxListener );
}
}
@@ -368,18 +368,18 @@ void SAL_CALL AccessibleContextBase::removeAccessibleEventListener (
const uno::Reference<XAccessibleEventListener >& rxListener )
{
ThrowIfDisposed ();
- if (rxListener.is() && mnClientId)
+ if (!(rxListener.is() && mnClientId))
+ return;
+
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
+ if ( !nListenerCount )
{
- sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
- if ( !nListenerCount )
- {
- // no listeners anymore
- // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
- // and at least to us not firing any events anymore, in case somebody calls
- // NotifyAccessibleEvent, again
- comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
- mnClientId = 0;
- }
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
+ mnClientId = 0;
}
}
@@ -432,21 +432,21 @@ void AccessibleContextBase::SetAccessibleDescription (
const OUString& rDescription,
StringOrigin eDescriptionOrigin)
{
- if (eDescriptionOrigin < meDescriptionOrigin
- || (eDescriptionOrigin == meDescriptionOrigin && msDescription != rDescription))
- {
- uno::Any aOldValue, aNewValue;
- aOldValue <<= msDescription;
- aNewValue <<= rDescription;
+ if (!(eDescriptionOrigin < meDescriptionOrigin
+ || (eDescriptionOrigin == meDescriptionOrigin && msDescription != rDescription)))
+ return;
- msDescription = rDescription;
- meDescriptionOrigin = eDescriptionOrigin;
+ uno::Any aOldValue, aNewValue;
+ aOldValue <<= msDescription;
+ aNewValue <<= rDescription;
- CommitChange(
- AccessibleEventId::DESCRIPTION_CHANGED,
- aNewValue,
- aOldValue);
- }
+ msDescription = rDescription;
+ meDescriptionOrigin = eDescriptionOrigin;
+
+ CommitChange(
+ AccessibleEventId::DESCRIPTION_CHANGED,
+ aNewValue,
+ aOldValue);
}
@@ -454,21 +454,21 @@ void AccessibleContextBase::SetAccessibleName (
const OUString& rName,
StringOrigin eNameOrigin)
{
- if (eNameOrigin < meNameOrigin
- || (eNameOrigin == meNameOrigin && msName != rName))
- {
- uno::Any aOldValue, aNewValue;
- aOldValue <<= msName;
- aNewValue <<= rName;
+ if (!(eNameOrigin < meNameOrigin
+ || (eNameOrigin == meNameOrigin && msName != rName)))
+ return;
- msName = rName;
- meNameOrigin = eNameOrigin;
+ uno::Any aOldValue, aNewValue;
+ aOldValue <<= msName;
+ aNewValue <<= rName;
- CommitChange(
- AccessibleEventId::NAME_CHANGED,
- aNewValue,
- aOldValue);
- }
+ msName = rName;
+ meNameOrigin = eNameOrigin;
+
+ CommitChange(
+ AccessibleEventId::NAME_CHANGED,
+ aNewValue,
+ aOldValue);
}
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 55f7940e5b10..43e4f628b191 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -294,18 +294,18 @@ namespace accessibility
mpEditSource = nullptr;
// notify listeners
- if( nClientId != -1 )
+ if( nClientId == -1 )
+ return;
+
+ try
{
- try
- {
- uno::Reference < XAccessibleContext > xThis = getAccessibleContext();
+ uno::Reference < XAccessibleContext > xThis = getAccessibleContext();
- // #106234# Delegate to EventNotifier
- ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, xThis );
- }
- catch (const uno::Exception&)
- {
- }
+ // #106234# Delegate to EventNotifier
+ ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, xThis );
+ }
+ catch (const uno::Exception&)
+ {
}
}
@@ -976,19 +976,19 @@ namespace accessibility
void SAL_CALL AccessibleEditableTextPara::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
{
- if( getNotifierClientId() != -1 )
+ if( getNotifierClientId() == -1 )
+ return;
+
+ const sal_Int32 nListenerCount = ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener );
+ if ( !nListenerCount )
{
- const sal_Int32 nListenerCount = ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener );
- if ( !nListenerCount )
- {
- // no listeners anymore
- // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
- // and at least to us not firing any events anymore, in case somebody calls
- // NotifyAccessibleEvent, again
- ::comphelper::AccessibleEventNotifier::TClientId nId( getNotifierClientId() );
- mnNotifierClientId = -1;
- ::comphelper::AccessibleEventNotifier::revokeClient( nId );
- }
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ ::comphelper::AccessibleEventNotifier::TClientId nId( getNotifierClientId() );
+ mnNotifierClientId = -1;
+ ::comphelper::AccessibleEventNotifier::revokeClient( nId );
}
}
@@ -1636,39 +1636,39 @@ namespace accessibility
}
}
}
- if( nFoundFieldIndex >= 0 )
+ if( nFoundFieldIndex < 0 )
+ return;
+
+ bool bExtend = false;
+ if( Segment.SegmentEnd < reeEnd )
+ {
+ Segment.SegmentEnd = reeEnd;
+ bExtend = true;
+ }
+ if( Segment.SegmentStart > reeBegin )
{
- bool bExtend = false;
- if( Segment.SegmentEnd < reeEnd )
- {
- Segment.SegmentEnd = reeEnd;
- bExtend = true;
- }
- if( Segment.SegmentStart > reeBegin )
- {
- Segment.SegmentStart = reeBegin;
- bExtend = true;
- }
- if( bExtend )
- {
- //If there is a bullet before the field, should add the bullet length into the segment.
- EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(nParaIndex);
- sal_Int32 nBulletLen = aBulletInfo.aText.getLength();
- if (nBulletLen > 0)
- {
- Segment.SegmentEnd += nBulletLen;
- if (nFoundFieldIndex > 0)
- Segment.SegmentStart += nBulletLen;
- Segment.SegmentText = GetTextRange(Segment.SegmentStart, Segment.SegmentEnd);
- //After get the correct field name, should restore the offset value which don't contain the bullet.
- Segment.SegmentEnd -= nBulletLen;
- if (nFoundFieldIndex > 0)
- Segment.SegmentStart -= nBulletLen;
- }
- else
- Segment.SegmentText = GetTextRange(Segment.SegmentStart, Segment.SegmentEnd);
- }
+ Segment.SegmentStart = reeBegin;
+ bExtend = true;
}
+ if( !bExtend )
+ return;
+
+ //If there is a bullet before the field, should add the bullet length into the segment.
+ EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(nParaIndex);
+ sal_Int32 nBulletLen = aBulletInfo.aText.getLength();
+ if (nBulletLen > 0)
+ {
+ Segment.SegmentEnd += nBulletLen;
+ if (nFoundFieldIndex > 0)
+ Segment.SegmentStart += nBulletLen;
+ Segment.SegmentText = GetTextRange(Segment.SegmentStart, Segment.SegmentEnd);
+ //After get the correct field name, should restore the offset value which don't contain the bullet.
+ Segment.SegmentEnd -= nBulletLen;
+ if (nFoundFieldIndex > 0)
+ Segment.SegmentStart -= nBulletLen;
+ }
+ else
+ Segment.SegmentText = GetTextRange(Segment.SegmentStart, Segment.SegmentEnd);
}
css::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType )
diff --git a/editeng/source/accessibility/AccessibleImageBullet.cxx b/editeng/source/accessibility/AccessibleImageBullet.cxx
index 63120433f256..6d5b660aa26b 100644
--- a/editeng/source/accessibility/AccessibleImageBullet.cxx
+++ b/editeng/source/accessibility/AccessibleImageBullet.cxx
@@ -190,19 +190,19 @@ namespace accessibility
void SAL_CALL AccessibleImageBullet::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
{
- if( getNotifierClientId() != -1 )
+ if( getNotifierClientId() == -1 )
+ return;
+
+ const sal_Int32 nListenerCount = ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener );
+ if ( !nListenerCount )
{
- const sal_Int32 nListenerCount = ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener );
- if ( !nListenerCount )
- {
- // no listeners anymore
- // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
- // and at least to us not firing any events anymore, in case somebody calls
- // NotifyAccessibleEvent, again
- ::comphelper::AccessibleEventNotifier::TClientId nId( getNotifierClientId() );
- mnNotifierClientId = -1;
- ::comphelper::AccessibleEventNotifier::revokeClient( nId );
- }
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ ::comphelper::AccessibleEventNotifier::TClientId nId( getNotifierClientId() );
+ mnNotifierClientId = -1;
+ ::comphelper::AccessibleEventNotifier::revokeClient( nId );
}
}
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 9e9eb17e6177..6fa39bbddaf4 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1825,18 +1825,18 @@ void ContentAttribs::SetStyleSheet( SfxStyleSheet* pS )
bool bStyleChanged = ( pStyle != pS );
pStyle = pS;
// Only when other style sheet, not when current style sheet modified
- if ( pStyle && bStyleChanged )
+ if ( !(pStyle && bStyleChanged) )
+ return;
+
+ // Selectively remove the attributes from the paragraph formatting
+ // which are specified in the style, so that the attributes of the
+ // style can have an affect.
+ const SfxItemSet& rStyleAttribs = pStyle->GetItemSet();
+ for ( sal_uInt16 nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ )
{
- // Selectively remove the attributes from the paragraph formatting
- // which are specified in the style, so that the attributes of the
- // style can have an affect.
- const SfxItemSet& rStyleAttribs = pStyle->GetItemSet();
- for ( sal_uInt16 nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ )
- {
- // Don't change bullet on/off
- if ( ( nWhich != EE_PARA_BULLETSTATE ) && ( rStyleAttribs.GetItemState( nWhich ) == SfxItemState::SET ) )
- aAttribSet.ClearItem( nWhich );
- }
+ // Don't change bullet on/off
+ if ( ( nWhich != EE_PARA_BULLETSTATE ) && ( rStyleAttribs.GetItemState( nWhich ) == SfxItemState::SET ) )
+ aAttribSet.ClearItem( nWhich );
}
}
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 5a6aee022a80..1b76d967b3ba 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -385,31 +385,31 @@ void EditEngine::SetPaperSize( const Size& rNewSize )
Size aNewSize( pImpEditEngine->GetPaperSize() );
bool bAutoPageSize = pImpEditEngine->GetStatus().AutoPageSize();
- if ( bAutoPageSize || ( aNewSize.Width() != aOldSize.Width() ) )
+ if ( !(bAutoPageSize || ( aNewSize.Width() != aOldSize.Width() )) )
+ return;
+
+ for (EditView* pView : pImpEditEngine->aEditViews)
{
- for (EditView* pView : pImpEditEngine->aEditViews)
+ if ( bAutoPageSize )
+ pView->pImpEditView->RecalcOutputArea();
+ else if ( pView->pImpEditView->DoAutoSize() )
{
- if ( bAutoPageSize )
- pView->pImpEditView->RecalcOutputArea();
- else if ( pView->pImpEditView->DoAutoSize() )
- {
- pView->pImpEditView->ResetOutputArea( tools::Rectangle(
- pView->pImpEditView->GetOutputArea().TopLeft(), aNewSize ) );
- }
+ pView->pImpEditView->ResetOutputArea( tools::Rectangle(
+ pView->pImpEditView->GetOutputArea().TopLeft(), aNewSize ) );
}
+ }
- if ( bAutoPageSize || pImpEditEngine->IsFormatted() )
- {
- // Changing the width has no effect for AutoPageSize, as this is
- // determined by the text width.
- // Optimization first after Vobis delivery was enabled ...
- pImpEditEngine->FormatFullDoc();
+ if ( bAutoPageSize || pImpEditEngine->IsFormatted() )
+ {
+ // Changing the width has no effect for AutoPageSize, as this is
+ // determined by the text width.
+ // Optimization first after Vobis delivery was enabled ...
+ pImpEditEngine->FormatFullDoc();
- pImpEditEngine->UpdateViews( pImpEditEngine->GetActiveView() );
+ pImpEditEngine->UpdateViews( pImpEditEngine->GetActiveView() );
- if ( pImpEditEngine->GetUpdateMode() && pImpEditEngine->GetActiveView() )
- pImpEditEngine->pActiveView->ShowCursor( false, false );
- }
+ if ( pImpEditEngine->GetUpdateMode() && pImpEditEngine->GetActiveView() )
+ pImpEditEngine->pActiveView->ShowCursor( false, false );
}
}
@@ -1843,72 +1843,72 @@ bool EditEngine::IsFlatMode() const
void EditEngine::SetControlWord( EEControlBits nWord )
{
- if ( nWord != pImpEditEngine->aStatus.GetControlWord() )
- {
- EEControlBits nPrev = pImpEditEngine->aStatus.GetControlWord();
- pImpEditEngine->aStatus.GetControlWord() = nWord;
+ if ( nWord == pImpEditEngine->aStatus.GetControlWord() )
+ return;
- EEControlBits nChanges = nPrev ^ nWord;
- if ( pImpEditEngine->IsFormatted() )
+ EEControlBits nPrev = pImpEditEngine->aStatus.GetControlWord();
+ pImpEditEngine->aStatus.GetControlWord() = nWord;
+
+ EEControlBits nChanges = nPrev ^ nWord;
+ if ( pImpEditEngine->IsFormatted() )
+ {
+ // possibly reformat:
+ if ( ( nChanges & EEControlBits::USECHARATTRIBS ) ||
+ ( nChanges & EEControlBits::ONECHARPERLINE ) ||
+ ( nChanges & EEControlBits::STRETCHING ) ||
+ ( nChanges & EEControlBits::OUTLINER ) ||
+ ( nChanges & EEControlBits::NOCOLORS ) ||
+ ( nChanges & EEControlBits::OUTLINER2 ) )
{
- // possibly reformat:
- if ( ( nChanges & EEControlBits::USECHARATTRIBS ) ||
- ( nChanges & EEControlBits::ONECHARPERLINE ) ||
- ( nChanges & EEControlBits::STRETCHING ) ||
- ( nChanges & EEControlBits::OUTLINER ) ||
- ( nChanges & EEControlBits::NOCOLORS ) ||
- ( nChanges & EEControlBits::OUTLINER2 ) )
+ if ( nChanges & EEControlBits::USECHARATTRIBS )
{
- if ( nChanges & EEControlBits::USECHARATTRIBS )
- {
- pImpEditEngine->GetEditDoc().CreateDefFont( true );
- }
-
- pImpEditEngine->FormatFullDoc();
- pImpEditEngine->UpdateViews( pImpEditEngine->GetActiveView() );
+ pImpEditEngine->GetEditDoc().CreateDefFont( true );
}
+
+ pImpEditEngine->FormatFullDoc();
+ pImpEditEngine->UpdateViews( pImpEditEngine->GetActiveView() );
}
+ }
- bool bSpellingChanged = bool(nChanges & EEControlBits::ONLINESPELLING);
+ bool bSpellingChanged = bool(nChanges & EEControlBits::ONLINESPELLING);
+
+ if ( !bSpellingChanged )
+ return;
- if ( bSpellingChanged )
+ pImpEditEngine->StopOnlineSpellTimer();
+ if (nWord & EEControlBits::ONLINESPELLING)
+ {
+ // Create WrongList, start timer...
+ sal_Int32 nNodes = pImpEditEngine->GetEditDoc().Count();
+ for ( sal_Int32 n = 0; n < nNodes; n++ )
{
- pImpEditEngine->StopOnlineSpellTimer();
- if (nWord & EEControlBits::ONLINESPELLING)
- {
- // Create WrongList, start timer...
- sal_Int32 nNodes = pImpEditEngine->GetEditDoc().Count();
- for ( sal_Int32 n = 0; n < nNodes; n++ )
- {
- ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n );
- pNode->CreateWrongList();
- }
- if (pImpEditEngine->IsFormatted())
- pImpEditEngine->StartOnlineSpellTimer();
- }
- else
+ ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n );
+ pNode->CreateWrongList();
+ }
+ if (pImpEditEngine->IsFormatted())
+ pImpEditEngine->StartOnlineSpellTimer();
+ }
+ else
+ {
+ long nY = 0;
+ sal_Int32 nNodes = pImpEditEngine->GetEditDoc().Count();
+ for ( sal_Int32 n = 0; n < nNodes; n++ )
+ {
+ ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n );
+ const ParaPortion* pPortion = pImpEditEngine->GetParaPortions()[n];
+ bool bWrongs = false;
+ if (pNode->GetWrongList() != nullptr)
+ bWrongs = !pNode->GetWrongList()->empty();
+ pNode->DestroyWrongList();
+ if ( bWrongs )
{
- long nY = 0;
- sal_Int32 nNodes = pImpEditEngine->GetEditDoc().Count();
- for ( sal_Int32 n = 0; n < nNodes; n++ )
- {
- ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n );
- const ParaPortion* pPortion = pImpEditEngine->GetParaPortions()[n];
- bool bWrongs = false;
- if (pNode->GetWrongList() != nullptr)
- bWrongs = !pNode->GetWrongList()->empty();
- pNode->DestroyWrongList();
- if ( bWrongs )
- {
- pImpEditEngine->aInvalidRect.SetLeft( 0 );
- pImpEditEngine->aInvalidRect.SetRight( pImpEditEngine->GetPaperSize().Width() );
- pImpEditEngine->aInvalidRect.SetTop( nY+1 );
- pImpEditEngine->aInvalidRect.SetBottom( nY+pPortion->GetHeight()-1 );
- pImpEditEngine->UpdateViews( pImpEditEngine->pActiveView );
- }
- nY += pPortion->GetHeight();
- }
+ pImpEditEngine->aInvalidRect.SetLeft( 0 );
+ pImpEditEngine->aInvalidRect.SetRight( pImpEditEngine->GetPaperSize().Width() );
+ pImpEditEngine->aInvalidRect.SetTop( nY+1 );
+ pImpEditEngine->aInvalidRect.SetBottom( nY+pPortion->GetHeight()-1 );
+ pImpEditEngine->UpdateViews( pImpEditEngine->pActiveView );
}
+ nY += pPortion->GetHeight();
}
}
}
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index ec4e964f83fd..f93d4a6205ad 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -444,26 +444,26 @@ void EditTextObject::dumpAsXml(xmlTextWriterPtr pWriter) const
// from SfxItemPoolUser
void EditTextObjectImpl::ObjectInDestruction(const SfxItemPool& rSfxItemPool)
{
- if(!bOwnerOfPool && pPool == &rSfxItemPool)
- {
- // The pool we are based on gets destructed; get owner of pool by creating own one.
- // No need to call RemoveSfxItemPoolUser(), this is done from the pool's destructor
- // Base new pool on EditEnginePool; it would also be possible to clone the used
- // pool if needed, but only text attributes should be used.
- SfxItemPool* pNewPool = EditEngine::CreatePool();
-
- pNewPool->SetDefaultMetric(pPool->GetMetric(DEF_METRIC));
-
- ContentInfosType aReplaced;
- aReplaced.reserve(aContents.size());
- for (auto const& content : aContents)
- aReplaced.push_back(std::unique_ptr<ContentInfo>(new ContentInfo(*content, *pNewPool)));
- aReplaced.swap(aContents);
-
- // set local variables
- pPool = pNewPool;
- bOwnerOfPool = true;
- }
+ if(!(!bOwnerOfPool && pPool == &rSfxItemPool))
+ return;
+
+ // The pool we are based on gets destructed; get owner of pool by creating own one.
+ // No need to call RemoveSfxItemPoolUser(), this is done from the pool's destructor
+ // Base new pool on EditEnginePool; it would also be possible to clone the used
+ // pool if needed, but only text attributes should be used.
+ SfxItemPool* pNewPool = EditEngine::CreatePool();
+
+ pNewPool->SetDefaultMetric(pPool->GetMetric(DEF_METRIC));
+
+ ContentInfosType aReplaced;
+ aReplaced.reserve(aContents.size());
+ for (auto const& content : aContents)
+ aReplaced.push_back(std::unique_ptr<ContentInfo>(new ContentInfo(*content, *pNewPool)));
+ aReplaced.swap(aContents);
+
+ // set local variables
+ pPool = pNewPool;
+ bOwnerOfPool = true;
}
#if DEBUG_EDIT_ENGINE
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 71f13298f511..531fad3e12c2 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -472,23 +472,23 @@ void EditView::Command( const CommandEvent& rCEvt )
void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bActivate )
{
- if ( pImpEditView->pEditEngine->HasView( this ) )
- {
- // The control word is more important:
- if ( !pImpEditView->DoAutoScroll() )
- bGotoCursor = false;
- pImpEditView->ShowCursor( bGotoCursor, bForceVisCursor );
+ if ( !pImpEditView->pEditEngine->HasView( this ) )
+ return;
- if (pImpEditView->mpViewShell && !bActivate)
- {
- VclPtr<vcl::Window> pParent = pImpEditView->pOutWin->GetParentWithLOKNotifier();
- if (pParent && pParent->GetLOKWindowId() != 0)
- return;
+ // The control word is more important:
+ if ( !pImpEditView->DoAutoScroll() )
+ bGotoCursor = false;
+ pImpEditView->ShowCursor( bGotoCursor, bForceVisCursor );
- static const OString aPayload = OString::boolean(true);
- pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload.getStr());
- pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", aPayload);
- }
+ if (pImpEditView->mpViewShell && !bActivate)
+ {
+ VclPtr<vcl::Window> pParent = pImpEditView->pOutWin->GetParentWithLOKNotifier();
+ if (pParent && pParent->GetLOKWindowId() != 0)
+ return;
+
+ static const OString aPayload = OString::boolean(true);
+ pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload.getStr());
+ pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", aPayload);
}
}
@@ -893,308 +893,308 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aPos, false);
Reference< linguistic2::XSpellChecker1 > xSpeller( pImpEditView->pEditEngine->pImpEditEngine->GetSpeller() );
ESelection aOldSel = GetSelection();
- if ( xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, true ) )
+ if ( !(xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, true )) )
+ return;
+
+ VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "editeng/ui/spellmenu.ui", "");
+ VclPtr<PopupMenu> aPopupMenu(aBuilder.get_menu("menu"));
+ const sal_uInt16 nAutoCorrId = aPopupMenu->GetItemId("autocorrect");
+ PopupMenu *pAutoMenu = aPopupMenu->GetPopupMenu(nAutoCorrId);
+ const sal_uInt16 nInsertId = aPopupMenu->GetItemId("insert");
+ PopupMenu *pInsertMenu = aPopupMenu->GetPopupMenu(nInsertId); // add word to user-dictionaries
+ pInsertMenu->SetMenuFlags( MenuFlags::NoAutoMnemonics ); //! necessary to retrieve the correct dictionary names later
+ const sal_uInt16 nAddId = aPopupMenu->GetItemId("add");
+ const sal_uInt16 nIgnoreId = aPopupMenu->GetItemId("ignore");
+ const sal_uInt16 nCheckId = aPopupMenu->GetItemId("check");
+ const sal_uInt16 nAutoCorrectDlgId = aPopupMenu->GetItemId("autocorrectdlg");
+
+ EditPaM aPaM2( aPaM );
+ aPaM2.SetIndex( aPaM2.GetIndex()+1 );
+
+ // Are there any replace suggestions?
+ OUString aSelected( GetSelected() );
+
+ // restrict the maximal number of suggestions displayed
+ // in the context menu.
+ // Note: That could of course be done by clipping the
+ // resulting sequence but the current third party
+ // implementations result differs greatly if the number of
+ // suggestions to be returned gets changed. Statistically
+ // it gets much better if told to return e.g. only 7 strings
+ // than returning e.g. 16 suggestions and using only the
+ // first 7. Thus we hand down the value to use to that
+ // implementation here by providing an additional parameter.
+ Sequence< PropertyValue > aPropVals(1);
+ PropertyValue &rVal = aPropVals.getArray()[0];
+ rVal.Name = UPN_MAX_NUMBER_OF_SUGGESTIONS;
+ rVal.Value <<= sal_Int16(7);
+
+ // Are there any replace suggestions?
+ Reference< linguistic2::XSpellAlternatives > xSpellAlt =
+ xSpeller->spell( aSelected, static_cast<sal_uInt16>(pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 )), aPropVals );
+
+ Reference< linguistic2::XLanguageGuessing > xLangGuesser( EditDLL::Get().GetGlobalData()->GetLanguageGuesser() );
+
+ // check if text might belong to a different language...
+ LanguageType nGuessLangWord = LANGUAGE_NONE;
+ LanguageType nGuessLangPara = LANGUAGE_NONE;
+ if (xSpellAlt.is() && xLangGuesser.is())
{
- VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "editeng/ui/spellmenu.ui", "");
- VclPtr<PopupMenu> aPopupMenu(aBuilder.get_menu("menu"));
- const sal_uInt16 nAutoCorrId = aPopupMenu->GetItemId("autocorrect");
- PopupMenu *pAutoMenu = aPopupMenu->GetPopupMenu(nAutoCorrId);
- const sal_uInt16 nInsertId = aPopupMenu->GetItemId("insert");
- PopupMenu *pInsertMenu = aPopupMenu->GetPopupMenu(nInsertId); // add word to user-dictionaries
- pInsertMenu->SetMenuFlags( MenuFlags::NoAutoMnemonics ); //! necessary to retrieve the correct dictionary names later
- const sal_uInt16 nAddId = aPopupMenu->GetItemId("add");
- const sal_uInt16 nIgnoreId = aPopupMenu->GetItemId("ignore");
- const sal_uInt16 nCheckId = aPopupMenu->GetItemId("check");
- const sal_uInt16 nAutoCorrectDlgId = aPopupMenu->GetItemId("autocorrectdlg");
-
- EditPaM aPaM2( aPaM );
- aPaM2.SetIndex( aPaM2.GetIndex()+1 );
-
- // Are there any replace suggestions?
- OUString aSelected( GetSelected() );
-
- // restrict the maximal number of suggestions displayed
- // in the context menu.
- // Note: That could of course be done by clipping the
- // resulting sequence but the current third party
- // implementations result differs greatly if the number of
- // suggestions to be returned gets changed. Statistically
- // it gets much better if told to return e.g. only 7 strings
- // than returning e.g. 16 suggestions and using only the
- // first 7. Thus we hand down the value to use to that
- // implementation here by providing an additional parameter.
- Sequence< PropertyValue > aPropVals(1);
- PropertyValue &rVal = aPropVals.getArray()[0];
- rVal.Name = UPN_MAX_NUMBER_OF_SUGGESTIONS;
- rVal.Value <<= sal_Int16(7);
-
- // Are there any replace suggestions?
- Reference< linguistic2::XSpellAlternatives > xSpellAlt =
- xSpeller->spell( aSelected, static_cast<sal_uInt16>(pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 )), aPropVals );
-
- Reference< linguistic2::XLanguageGuessing > xLangGuesser( EditDLL::Get().GetGlobalData()->GetLanguageGuesser() );
-
- // check if text might belong to a different language...
- LanguageType nGuessLangWord = LANGUAGE_NONE;
- LanguageType nGuessLangPara = LANGUAGE_NONE;
- if (xSpellAlt.is() && xLangGuesser.is())
+ OUString aParaText;
+ ContentNode *pNode = aPaM.GetNode();
+ if (pNode)
{
- OUString aParaText;
- ContentNode *pNode = aPaM.GetNode();
- if (pNode)
- {
- aParaText = pNode->GetString();
- }
- else
- {
- OSL_FAIL( "content node is NULL" );
- }
-
- nGuessLangWord = CheckLanguage( xSpellAlt->getWord(), xSpeller, xLangGuesser, false );
- nGuessLangPara = CheckLanguage( aParaText, xSpeller, xLangGuesser, true );
+ aParaText = pNode->GetString();
}
- if (nGuessLangWord != LANGUAGE_NONE || nGuessLangPara != LANGUAGE_NONE)
+ else
{
- // make sure LANGUAGE_NONE gets not used as menu entry
- if (nGuessLangWord == LANGUAGE_NONE)
- nGuessLangWord = nGuessLangPara;
- if (nGuessLangPara == LANGUAGE_NONE)
- nGuessLangPara = nGuessLangWord;
-
- aPopupMenu->InsertSeparator();
- OUString aTmpWord( SvtLanguageTable::GetLanguageString( nGuessLangWord ) );
- OUString aTmpPara( SvtLanguageTable::GetLanguageString( nGuessLangPara ) );
- OUString aWordStr( EditResId( RID_STR_WORD ) );
- aWordStr = aWordStr.replaceFirst( "%x", aTmpWord );
- OUString aParaStr( EditResId( RID_STR_PARAGRAPH ) );
- aParaStr = aParaStr.replaceFirst( "%x", aTmpPara );
- aPopupMenu->InsertItem( MN_WORDLANGUAGE, aWordStr );
- aPopupMenu->SetHelpId( MN_WORDLANGUAGE, HID_EDITENG_SPELLER_WORDLANGUAGE );
- aPopupMenu->InsertItem( MN_PARALANGUAGE, aParaStr );
- aPopupMenu->SetHelpId( MN_PARALANGUAGE, HID_EDITENG_SPELLER_PARALANGUAGE );
+ OSL_FAIL( "content node is NULL" );
}
- // ## Create mnemonics here
- aPopupMenu->CreateAutoMnemonics();
- aPopupMenu->SetMenuFlags(aPopupMenu->GetMenuFlags() | MenuFlags::NoAutoMnemonics);
-
- // Replace suggestions...
- Sequence< OUString > aAlt;
- if (xSpellAlt.is())
- aAlt = xSpellAlt->getAlternatives();
- const OUString *pAlt = aAlt.getConstArray();
- sal_uInt16 nWords = static_cast<sal_uInt16>(aAlt.getLength());
- if ( nWords )
+ nGuessLangWord = CheckLanguage( xSpellAlt->getWord(), xSpeller, xLangGuesser, false );
+ nGuessLangPara = CheckLanguage( aParaText, xSpeller, xLangGuesser, true );
+ }
+ if (nGuessLangWord != LANGUAGE_NONE || nGuessLangPara != LANGUAGE_NONE)
+ {
+ // make sure LANGUAGE_NONE gets not used as menu entry
+ if (nGuessLangWord == LANGUAGE_NONE)
+ nGuessLangWord = nGuessLangPara;
+ if (nGuessLangPara == LANGUAGE_NONE)
+ nGuessLangPara = nGuessLangWord;
+
+ aPopupMenu->InsertSeparator();
+ OUString aTmpWord( SvtLanguageTable::GetLanguageString( nGuessLangWord ) );
+ OUString aTmpPara( SvtLanguageTable::GetLanguageString( nGuessLangPara ) );
+ OUString aWordStr( EditResId( RID_STR_WORD ) );
+ aWordStr = aWordStr.replaceFirst( "%x", aTmpWord );
+ OUString aParaStr( EditResId( RID_STR_PARAGRAPH ) );
+ aParaStr = aParaStr.replaceFirst( "%x", aTmpPara );
+ aPopupMenu->InsertItem( MN_WORDLANGUAGE, aWordStr );
+ aPopupMenu->SetHelpId( MN_WORDLANGUAGE, HID_EDITENG_SPELLER_WORDLANGUAGE );
+ aPopupMenu->InsertItem( MN_PARALANGUAGE, aParaStr );
+ aPopupMenu->SetHelpId( MN_PARALANGUAGE, HID_EDITENG_SPELLER_PARALANGUAGE );
+ }
+
+ // ## Create mnemonics here
+ aPopupMenu->CreateAutoMnemonics();
+ aPopupMenu->SetMenuFlags(aPopupMenu->GetMenuFlags() | MenuFlags::NoAutoMnemonics);
+
+ // Replace suggestions...
+ Sequence< OUString > aAlt;
+ if (xSpellAlt.is())
+ aAlt = xSpellAlt->getAlternatives();
+ const OUString *pAlt = aAlt.getConstArray();
+ sal_uInt16 nWords = static_cast<sal_uInt16>(aAlt.getLength());
+ if ( nWords )
+ {
+ for ( sal_uInt16 nW = 0; nW < nWords; nW++ )
{
- for ( sal_uInt16 nW = 0; nW < nWords; nW++ )
- {
- OUString aAlternate( pAlt[nW] );
- aPopupMenu->InsertItem( MN_ALTSTART+nW, aAlternate, MenuItemBits::NONE, OString(), nW );
- pAutoMenu->InsertItem( MN_AUTOSTART+nW, aAlternate, MenuItemBits::NONE, OString(), nW );
- }
- aPopupMenu->InsertSeparator(OString(), nWords);
+ OUString aAlternate( pAlt[nW] );
+ aPopupMenu->InsertItem( MN_ALTSTART+nW, aAlternate, MenuItemBits::NONE, OString(), nW );
+ pAutoMenu->InsertItem( MN_AUTOSTART+nW, aAlternate, MenuItemBits::NONE, OString(), nW );
}
- else
- aPopupMenu->RemoveItem(nAutoCorrId); // delete?
+ aPopupMenu->InsertSeparator(OString(), nWords);
+ }
+ else
+ aPopupMenu->RemoveItem(nAutoCorrId); // delete?
- SvtLinguConfig aCfg;
+ SvtLinguConfig aCfg;
- Reference< linguistic2::XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() );
- Sequence< Reference< linguistic2::XDictionary > > aDics;
- if (xDicList.is())
+ Reference< linguistic2::XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() );
+ Sequence< Reference< linguistic2::XDictionary > > aDics;
+ if (xDicList.is())
+ {
+ const Reference< linguistic2::XDictionary > *pDic = nullptr;
+ // add the default positive dictionary to dic-list (if not already done).
+ // This is to ensure that there is at least one dictionary to which
+ // words could be added.
+ uno::Reference< linguistic2::XDictionary > xDic( LinguMgr::GetStandardDic() );
+ if (xDic.is())
+ xDic->setActive( true );
+
+ aDics = xDicList->getDictionaries();
+ pDic = aDics.getConstArray();
+ LanguageType nCheckedLanguage = pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 );
+ sal_uInt16 nDicCount = static_cast<sal_uInt16>(aDics.getLength());
+ for (sal_uInt16 i = 0; i < nDicCount; i++)
{
- const Reference< linguistic2::XDictionary > *pDic = nullptr;
- // add the default positive dictionary to dic-list (if not already done).
- // This is to ensure that there is at least one dictionary to which
- // words could be added.
- uno::Reference< linguistic2::XDictionary > xDic( LinguMgr::GetStandardDic() );
- if (xDic.is())
- xDic->setActive( true );
-
- aDics = xDicList->getDictionaries();
- pDic = aDics.getConstArray();
- LanguageType nCheckedLanguage = pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 );
- sal_uInt16 nDicCount = static_cast<sal_uInt16>(aDics.getLength());
- for (sal_uInt16 i = 0; i < nDicCount; i++)
+ uno::Reference< linguistic2::XDictionary > xDicTmp = pDic[i];
+ if (!xDicTmp.is() || LinguMgr::GetIgnoreAllList() == xDicTmp)
+ continue;
+
+ uno::Reference< frame::XStorable > xStor( xDicTmp, uno::UNO_QUERY );
+ LanguageType nActLanguage = LanguageTag( xDicTmp->getLocale() ).getLanguageType();
+ if( xDicTmp->isActive()
+ && xDicTmp->getDictionaryType() != linguistic2::DictionaryType_NEGATIVE
+ && (nCheckedLanguage == nActLanguage || LANGUAGE_NONE == nActLanguage )
+ && (!xStor.is() || !xStor->isReadonly()) )
{
- uno::Reference< linguistic2::XDictionary > xDicTmp = pDic[i];
- if (!xDicTmp.is() || LinguMgr::GetIgnoreAllList() == xDicTmp)
- continue;
-
- uno::Reference< frame::XStorable > xStor( xDicTmp, uno::UNO_QUERY );
- LanguageType nActLanguage = LanguageTag( xDicTmp->getLocale() ).getLanguageType();
- if( xDicTmp->isActive()
- && xDicTmp->getDictionaryType() != linguistic2::DictionaryType_NEGATIVE
- && (nCheckedLanguage == nActLanguage || LANGUAGE_NONE == nActLanguage )
- && (!xStor.is() || !xStor->isReadonly()) )
+ // the extra 1 is because of the (possible) external
+ // linguistic entry above
+ sal_uInt16 nPos = MN_DICTSTART + i;
+ pInsertMenu->InsertItem( nPos, xDicTmp->getName() );
+ aDicNameSingle = xDicTmp->getName();
+
+ uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY );
+ if (xSvcInfo.is())
{
- // the extra 1 is because of the (possible) external
- // linguistic entry above
- sal_uInt16 nPos = MN_DICTSTART + i;
- pInsertMenu->InsertItem( nPos, xDicTmp->getName() );
- aDicNameSingle = xDicTmp->getName();
-
- uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY );
- if (xSvcInfo.is())
+ OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage(
+ xSvcInfo->getImplementationName()) );
+ if (!aDictionaryImageUrl.isEmpty() )
{
- OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage(
- xSvcInfo->getImplementationName()) );
- if (!aDictionaryImageUrl.isEmpty() )
- {
- Image aImage( aDictionaryImageUrl );
- pInsertMenu->SetItemImage( nPos, aImage );
- }
+ Image aImage( aDictionaryImageUrl );
+ pInsertMenu->SetItemImage( nPos, aImage );
}
}
}
}
+ }
- if (pInsertMenu->GetItemCount() != 1)
- aPopupMenu->EnableItem(nAddId, false);
- if (pInsertMenu->GetItemCount() < 2)
- aPopupMenu->EnableItem(nInsertId, false);
+ if (pInsertMenu->GetItemCount() != 1)
+ aPopupMenu->EnableItem(nAddId, false);
+ if (pInsertMenu->GetItemCount() < 2)
+ aPopupMenu->EnableItem(nInsertId, false);
- aPopupMenu->RemoveDisabledEntries( true, true );
+ aPopupMenu->RemoveDisabledEntries( true, true );
- tools::Rectangle aTempRect = pImpEditView->pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly );
- Point aScreenPos = pImpEditView->GetWindowPos( aTempRect.TopLeft() );
- aScreenPos = pImpEditView->GetWindow()->OutputToScreenPixel( aScreenPos );
- aTempRect = pImpEditView->GetWindow()->LogicToPixel( tools::Rectangle(aScreenPos, aTempRect.GetSize() ));
+ tools::Rectangle aTempRect = pImpEditView->pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly );
+ Point aScreenPos = pImpEditView->GetWindowPos( aTempRect.TopLeft() );
+ aScreenPos = pImpEditView->GetWindow()->OutputToScreenPixel( aScreenPos );
+ aTempRect = pImpEditView->GetWindow()->LogicToPixel( tools::Rectangle(aScreenPos, aTempRect.GetSize() ));
- //tdf#106123 store and restore the EditPaM around the menu Execute
- //because the loss of focus in the current editeng causes writer
- //annotations to save their contents, making the pContent of the
- //current EditPams invalid
- EPaM aP = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM);
- EPaM aP2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM2);
+ //tdf#106123 store and restore the EditPaM around the menu Execute
+ //because the loss of focus in the current editeng causes writer
+ //annotations to save their contents, making the pContent of the
+ //current EditPams invalid
+ EPaM aP = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM);
+ EPaM aP2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM2);
- if (comphelper::LibreOfficeKit::isActive())
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ // For mobile phones, send the context menu structure
+ if (comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
{
- // For mobile phones, send the context menu structure
- if (comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
- {
- LOKSendSpellPopupMenu(aPopupMenu, nGuessLangWord, nGuessLangPara, nWords);
- return;
- }
- else // For desktop and tablets, we use the tunneled dialog
- aPopupMenu->SetLOKNotifier(SfxViewShell::Current());
+ LOKSendSpellPopupMenu(aPopupMenu, nGuessLangWord, nGuessLangPara, nWords);
+ return;
}
- sal_uInt16 nId = aPopupMenu->Execute(pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose);
+ else // For desktop and tablets, we use the tunneled dialog
+ aPopupMenu->SetLOKNotifier(SfxViewShell::Current());
+ }
+ sal_uInt16 nId = aPopupMenu->Execute(pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose);
- aPaM2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP2);
- aPaM = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP);
+ aPaM2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP2);
+ aPaM = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP);
- if (nId == nIgnoreId)
- {
- OUString aWord = pImpEditView->SpellIgnoreWord();
- if ( pCallBack )
- {
- SpellCallbackInfo aInf( SpellCallbackCommand::IGNOREWORD, aWord );
- pCallBack->Call( aInf );
- }
- SetSelection( aOldSel );
- }
- else if ( ( nId == MN_WORDLANGUAGE ) || ( nId == MN_PARALANGUAGE ) )
+ if (nId == nIgnoreId)
+ {
+ OUString aWord = pImpEditView->SpellIgnoreWord();
+ if ( pCallBack )
{
- LanguageType nLangToUse = (nId == MN_WORDLANGUAGE) ? nGuessLangWord : nGuessLangPara;
- SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse );
-
- SfxItemSet aAttrs = GetEditEngine()->GetEmptyItemSet();
- if (nScriptType == SvtScriptType::LATIN)
- aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE ) );
- if (nScriptType == SvtScriptType::COMPLEX)
- aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE_CTL ) );
- if (nScriptType == SvtScriptType::ASIAN)
- aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE_CJK ) );
- if ( nId == MN_PARALANGUAGE )
- {
- ESelection aSel = GetSelection();
- aSel.nStartPos = 0;
- aSel.nEndPos = EE_TEXTPOS_ALL;
- SetSelection( aSel );
- }
- SetAttribs( aAttrs );
- pImpEditView->pEditEngine->pImpEditEngine->StartOnlineSpellTimer();
-
- if ( pCallBack )
- {
- SpellCallbackInfo aInf( ( nId == MN_WORDLANGUAGE ) ? SpellCallbackCommand::WORDLANGUAGE : SpellCallbackCommand::PARALANGUAGE );
- pCallBack->Call( aInf );
- }
- SetSelection( aOldSel );
+ SpellCallbackInfo aInf( SpellCallbackCommand::IGNOREWORD, aWord );
+ pCallBack->Call( aInf );
}
- else if (nId == nCheckId)
+ SetSelection( aOldSel );
+ }
+ else if ( ( nId == MN_WORDLANGUAGE ) || ( nId == MN_PARALANGUAGE ) )
+ {
+ LanguageType nLangToUse = (nId == MN_WORDLANGUAGE) ? nGuessLangWord : nGuessLangPara;
+ SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse );
+
+ SfxItemSet aAttrs = GetEditEngine()->GetEmptyItemSet();
+ if (nScriptType == SvtScriptType::LATIN)
+ aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE ) );
+ if (nScriptType == SvtScriptType::COMPLEX)
+ aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE_CTL ) );
+ if (nScriptType == SvtScriptType::ASIAN)
+ aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE_CJK ) );
+ if ( nId == MN_PARALANGUAGE )
{
- if ( !pCallBack )
- {
- // Set Cursor before word...
- EditPaM aCursor = pImpEditView->GetEditSelection().Min();
- pImpEditView->DrawSelectionXOR();
- pImpEditView->SetEditSelection( EditSelection( aCursor, aCursor ) );
- pImpEditView->DrawSelectionXOR();
- // Crashes when no SfxApp
- pImpEditView->pEditEngine->pImpEditEngine->Spell( this, false );
- }
- else
- {
- SpellCallbackInfo aInf( SpellCallbackCommand::STARTSPELLDLG, OUString() );
- pCallBack->Call( aInf );
- }
+ ESelection aSel = GetSelection();
+ aSel.nStartPos = 0;
+ aSel.nEndPos = EE_TEXTPOS_ALL;
+ SetSelection( aSel );
}
- else if (nId == nAutoCorrectDlgId && pCallBack)
+ SetAttribs( aAttrs );
+ pImpEditView->pEditEngine->pImpEditEngine->StartOnlineSpellTimer();
+
+ if ( pCallBack )
{
- SpellCallbackInfo aInf( SpellCallbackCommand::AUTOCORRECT_OPTIONS, OUString() );
+ SpellCallbackInfo aInf( ( nId == MN_WORDLANGUAGE ) ? SpellCallbackCommand::WORDLANGUAGE : SpellCallbackCommand::PARALANGUAGE );
pCallBack->Call( aInf );
}
- else if ( nId >= MN_DICTSTART || nId == nAddId)
- {
- OUString aDicName;
- if (nId >= MN_DICTSTART)
- aDicName = pInsertMenu->GetItemText(nId);
- else
- aDicName = aDicNameSingle;
-
- uno::Reference< linguistic2::XDictionary > xDic;
- if (xDicList.is())
- xDic = xDicList->getDictionaryByName( aDicName );
-
- if (xDic.is())
- xDic->add( aSelected, false, OUString() );
- // save modified user-dictionary if it is persistent
- Reference< frame::XStorable > xSavDic( xDic, UNO_QUERY );
- if (xSavDic.is())
- xSavDic->store();
-
- aPaM.GetNode()->GetWrongList()->ResetInvalidRange(0, aPaM.GetNode()->Len());
- pImpEditView->pEditEngine->pImpEditEngine->StartOnlineSpellTimer();
-
- if ( pCallBack )
- {
- SpellCallbackInfo aInf( SpellCallbackCommand::ADDTODICTIONARY, aSelected );
- pCallBack->Call( aInf );
- }
- SetSelection( aOldSel );
- }
- else if ( nId >= MN_AUTOSTART )
+ SetSelection( aOldSel );
+ }
+ else if (nId == nCheckId)
+ {
+ if ( !pCallBack )
{
- DBG_ASSERT(nId - MN_AUTOSTART < aAlt.getLength(), "index out of range");
- OUString aWord = pAlt[nId - MN_AUTOSTART];
- SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
- if ( pAutoCorrect )
- pAutoCorrect->PutText( aSelected, aWord, pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 ) );
- InsertText( aWord );
+ // Set Cursor before word...
+ EditPaM aCursor = pImpEditView->GetEditSelection().Min();
+ pImpEditView->DrawSelectionXOR();
+ pImpEditView->SetEditSelection( EditSelection( aCursor, aCursor ) );
+ pImpEditView->DrawSelectionXOR();
+ // Crashes when no SfxApp
+ pImpEditView->pEditEngine->pImpEditEngine->Spell( this, false );
}
- else if ( nId >= MN_ALTSTART ) // Replace
+ else
{
- DBG_ASSERT(nId - MN_ALTSTART < aAlt.getLength(), "index out of range");
- OUString aWord = pAlt[nId - MN_ALTSTART];
- InsertText( aWord );
+ SpellCallbackInfo aInf( SpellCallbackCommand::STARTSPELLDLG, OUString() );
+ pCallBack->Call( aInf );
}
+ }
+ else if (nId == nAutoCorrectDlgId && pCallBack)
+ {
+ SpellCallbackInfo aInf( SpellCallbackCommand::AUTOCORRECT_OPTIONS, OUString() );
+ pCallBack->Call( aInf );
+ }
+ else if ( nId >= MN_DICTSTART || nId == nAddId)
+ {
+ OUString aDicName;
+ if (nId >= MN_DICTSTART)
+ aDicName = pInsertMenu->GetItemText(nId);
else
+ aDicName = aDicNameSingle;
+
+ uno::Reference< linguistic2::XDictionary > xDic;
+ if (xDicList.is())
+ xDic = xDicList->getDictionaryByName( aDicName );
+
+ if (xDic.is())
+ xDic->add( aSelected, false, OUString() );
+ // save modified user-dictionary if it is persistent
+ Reference< frame::XStorable > xSavDic( xDic, UNO_QUERY );
+ if (xSavDic.is())
+ xSavDic->store();
+
+ aPaM.GetNode()->GetWrongList()->ResetInvalidRange(0, aPaM.GetNode()->Len());
+ pImpEditView->pEditEngine->pImpEditEngine->StartOnlineSpellTimer();
+
+ if ( pCallBack )
{
- SetSelection( aOldSel );
+ SpellCallbackInfo aInf( SpellCallbackCommand::ADDTODICTIONARY, aSelected );
+ pCallBack->Call( aInf );
}
+ SetSelection( aOldSel );
+ }
+ else if ( nId >= MN_AUTOSTART )
+ {
+ DBG_ASSERT(nId - MN_AUTOSTART < aAlt.getLength(), "index out of range");
+ OUString aWord = pAlt[nId - MN_AUTOSTART];
+ SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
+ if ( pAutoCorrect )
+ pAutoCorrect->PutText( aSelected, aWord, pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 ) );
+ InsertText( aWord );
+ }
+ else if ( nId >= MN_ALTSTART ) // Replace
+ {
+ DBG_ASSERT(nId - MN_ALTSTART < aAlt.getLength(), "index out of range");
+ OUString aWord = pAlt[nId - MN_ALTSTART];
+ InsertText( aWord );
+ }
+ else
+ {
+ SetSelection( aOldSel );
}
}
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx
index 39fbbb7aa221..ff84bfe4a260 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -742,48 +742,48 @@ bool EditHTMLParser::HasTextInCurrentPara()
void EditHTMLParser::AnchorStart()
{
// ignore anchor in anchor
- if ( !pCurAnchor )
+ if ( pCurAnchor )
+ return;
+
+ const HTMLOptions& aOptions = GetOptions();
+ OUString aRef;
+
+ for (const auto & aOption : aOptions)
{
- const HTMLOptions& aOptions = GetOptions();
- OUString aRef;
+ if( aOption.GetToken() == HtmlOptionId::HREF)
+ aRef = aOption.GetString();
+ }
- for (const auto & aOption : aOptions)
- {
- if( aOption.GetToken() == HtmlOptionId::HREF)
- aRef = aOption.GetString();
- }
+ if ( aRef.isEmpty() )
+ return;
- if ( !aRef.isEmpty() )
- {
- OUString aURL = aRef;
- if ( !aURL.isEmpty() && ( aURL[ 0 ] != '#' ) )
- {
- INetURLObject aTargetURL;
- INetURLObject aRootURL( aBaseURL );
- aRootURL.GetNewAbsURL( aRef, &aTargetURL );
- aURL = aTargetURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri );
- }
- pCurAnchor.reset( new AnchorInfo );
- pCurAnchor->aHRef = aURL;
- }
+ OUString aURL = aRef;
+ if ( !aURL.isEmpty() && ( aURL[ 0 ] != '#' ) )
+ {
+ INetURLObject aTargetURL;
+ INetURLObject aRootURL( aBaseURL );
+ aRootURL.GetNewAbsURL( aRef, &aTargetURL );
+ aURL = aTargetURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri );
}
+ pCurAnchor.reset( new AnchorInfo );
+ pCurAnchor->aHRef = aURL;
}
void EditHTMLParser::AnchorEnd()
{
- if ( pCurAnchor )
- {
- // Insert as URL-Field...
- SvxFieldItem aFld( SvxURLField( pCurAnchor->aHRef, pCurAnchor->aText, SvxURLFormat::Repr ), EE_FEATURE_FIELD );
- aCurSel = mpEditEngine->InsertField(aCurSel, aFld);
- bFieldsInserted = true;
- pCurAnchor.reset();
+ if ( !pCurAnchor )
+ return;
- if (mpEditEngine->IsHtmlImportHandlerSet())
- {
- HtmlImportInfo aImportInfo(HtmlImportState::InsertField, this, mpEditEngine->CreateESelection(aCurSel));
- mpEditEngine->CallHtmlImportHandler(aImportInfo);
- }
+ // Insert as URL-Field...
+ SvxFieldItem aFld( SvxURLField( pCurAnchor->aHRef, pCurAnchor->aText, SvxURLFormat::Repr ), EE_FEATURE_FIELD );
+ aCurSel = mpEditEngine->InsertField(aCurSel, aFld);
+ bFieldsInserted = true;
+ pCurAnchor.reset();
+
+ if (mpEditEngine->IsHtmlImportHandlerSet())
+ {
+ HtmlImportInfo aImportInfo(HtmlImportState::InsertField, this, mpEditEngine->CreateESelection(aCurSel));
+ mpEditEngine->CallHtmlImportHandler(aImportInfo);
}
}
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 7616a6dc9ae7..e0ee7a52b24d 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -160,26 +160,26 @@ static void lcl_translateTwips(vcl::Window const & rParent, vcl::Window& rChild)
// This prevents multiple translate calls that negate
// one another.
const Point aOrigin = rChild.GetMapMode().GetOrigin();
- if (aOrigin.getX() == 0 && aOrigin.getY() == 0)
+ if (!(aOrigin.getX() == 0 && aOrigin.getY() == 0))
+ return;
+
+ // Set map mode, so that callback payloads will contain absolute coordinates instead of relative ones.
+ Point aOffset(rChild.GetOutOffXPixel() - rParent.GetOutOffXPixel(), rChild.GetOutOffYPixel() - rParent.GetOutOffYPixel());
+ if (!rChild.IsMapModeEnabled())
{
- // Set map mode, so that callback payloads will contain absolute coordinates instead of relative ones.
- Point aOffset(rChild.GetOutOffXPixel() - rParent.GetOutOffXPixel(), rChild.GetOutOffYPixel() - rParent.GetOutOffYPixel());
- if (!rChild.IsMapModeEnabled())
- {
- MapMode aMapMode(rChild.GetMapMode());
- aMapMode.SetMapUnit(MapUnit::MapTwip);
- aMapMode.SetScaleX(rParent.GetMapMode().GetScaleX());
- aMapMode.SetScaleY(rParent.GetMapMode().GetScaleY());
- rChild.SetMapMode(aMapMode);
- rChild.EnableMapMode();
- }
- aOffset = rChild.PixelToLogic(aOffset);
MapMode aMapMode(rChild.GetMapMode());
- aMapMode.SetOrigin(aOffset);
- aMapMode.SetMapUnit(rParent.GetMapMode().GetMapUnit());
+ aMapMode.SetMapUnit(MapUnit::MapTwip);
+ aMapMode.SetScaleX(rParent.GetMapMode().GetScaleX());
+ aMapMode.SetScaleY(rParent.GetMapMode().GetScaleY());
rChild.SetMapMode(aMapMode);
- rChild.EnableMapMode(false);
- }
+ rChild.EnableMapMode();
+ }
+ aOffset = rChild.PixelToLogic(aOffset);
+ MapMode aMapMode(rChild.GetMapMode());
+ aMapMode.SetOrigin(aOffset);
+ aMapMode.SetMapUnit(rParent.GetMapMode().GetMapUnit());
+ rChild.SetMapMode(aMapMode);
+ rChild.EnableMapMode(false);
}
// EditView never had a central/secure place to react on SelectionChange since
@@ -524,51 +524,51 @@ void ImpEditView::GetSelectionRectangles(EditSelection aTmpSel, std::vector<tool
void ImpEditView::ImplDrawHighlightRect( OutputDevice* _pTarget, const Point& rDocPosTopLeft, const Point& rDocPosBottomRight, tools::PolyPolygon* pPolyPoly )
{
- if ( rDocPosTopLeft.X() != rDocPosBottomRight.X() )
- {
- bool bPixelMode = _pTarget->GetMapMode().GetMapUnit() == MapUnit::MapPixel;
+ if ( rDocPosTopLeft.X() == rDocPosBottomRight.X() )
+ return;
- Point aPnt1( GetWindowPos( rDocPosTopLeft ) );
- Point aPnt2( GetWindowPos( rDocPosBottomRight ) );
+ bool bPixelMode = _pTarget->GetMapMode().GetMapUnit() == MapUnit::MapPixel;
- if ( !IsVertical() )
- {
- lcl_AllignToPixel( aPnt1, _pTarget, +1, 0 );
- lcl_AllignToPixel( aPnt2, _pTarget, 0, ( bPixelMode ? 0 : -1 ) );
- }
- else
- {
- lcl_AllignToPixel( aPnt1, _pTarget, 0, +1 );
- lcl_AllignToPixel( aPnt2, _pTarget, ( bPixelMode ? 0 : +1 ), 0 );
- }
+ Point aPnt1( GetWindowPos( rDocPosTopLeft ) );
+ Point aPnt2( GetWindowPos( rDocPosBottomRight ) );
+
+ if ( !IsVertical() )
+ {
+ lcl_AllignToPixel( aPnt1, _pTarget, +1, 0 );
+ lcl_AllignToPixel( aPnt2, _pTarget, 0, ( bPixelMode ? 0 : -1 ) );
+ }
+ else
+ {
+ lcl_AllignToPixel( aPnt1, _pTarget, 0, +1 );
+ lcl_AllignToPixel( aPnt2, _pTarget, ( bPixelMode ? 0 : +1 ), 0 );
+ }
- tools::Rectangle aRect( aPnt1, aPnt2 );
- if ( pPolyPoly )
+ tools::Rectangle aRect( aPnt1, aPnt2 );
+ if ( pPolyPoly )
+ {
+ tools::Polygon aTmpPoly( 4 );
+ aTmpPoly[0] = aRect.TopLeft();
+ aTmpPoly[1] = aRect.TopRight();
+ aTmpPoly[2] = aRect.BottomRight();
+ aTmpPoly[3] = aRect.BottomLeft();
+ pPolyPoly->Insert( aTmpPoly );
+ }
+ else
+ {
+ vcl::Window* pWindow = dynamic_cast< vcl::Window* >(_pTarget);
+
+ if(pWindow)
{
- tools::Polygon aTmpPoly( 4 );
- aTmpPoly[0] = aRect.TopLeft();
- aTmpPoly[1] = aRect.TopRight();
- aTmpPoly[2] = aRect.BottomRight();
- aTmpPoly[3] = aRect.BottomLeft();
- pPolyPoly->Insert( aTmpPoly );
+ pWindow->Invert( aRect );
}
else
{
- vcl::Window* pWindow = dynamic_cast< vcl::Window* >(_pTarget);
-
- if(pWindow)
- {
- pWindow->Invert( aRect );
- }
- else
- {
- _pTarget->Push(PushFlags::LINECOLOR|PushFlags::FILLCOLOR|PushFlags::RASTEROP);
- _pTarget->SetLineColor();
- _pTarget->SetFillColor(COL_BLACK);
- _pTarget->SetRasterOp(RasterOp::Invert);
- _pTarget->DrawRect(aRect);
- _pTarget->Pop();
- }
+ _pTarget->Push(PushFlags::LINECOLOR|PushFlags::FILLCOLOR|PushFlags::RASTEROP);
+ _pTarget->SetLineColor();
+ _pTarget->SetFillColor(COL_BLACK);
+ _pTarget->SetRasterOp(RasterOp::Invert);
+ _pTarget->DrawRect(aRect);
+ _pTarget->Pop();
}
}
}
@@ -713,54 +713,54 @@ void ImpEditView::ResetOutputArea( const tools::Rectangle& rRect )
SetOutputArea(rRect);
// invalidate surrounding areas if update is true
- if(!aOldArea.IsEmpty() && pEditEngine->pImpEditEngine->GetUpdateMode())
- {
- // #i119885# use grown area if needed; do when getting bigger OR smaller
- const sal_Int32 nMore(DoInvalidateMore() ? GetWindow()->PixelToLogic(Size(nInvMore, 0)).Width() : 0);
+ if(!(!aOldArea.IsEmpty() && pEditEngine->pImpEditEngine->GetUpdateMode()))
+ return;
- if(aOldArea.Left() > aOutArea.Left())
- {
- const tools::Rectangle aRect(aOutArea.Left() - nMore, aOldArea.Top() - nMore, aOldArea.Left(), aOldArea.Bottom() + nMore);
- InvalidateAtWindow(aRect);
- }
- else if(aOldArea.Left() < aOutArea.Left())
- {
- const tools::Rectangle aRect(aOldArea.Left() - nMore, aOldArea.Top() - nMore, aOutArea.Left(), aOldArea.Bottom() + nMore);
- InvalidateAtWindow(aRect);
- }
+ // #i119885# use grown area if needed; do when getting bigger OR smaller
+ const sal_Int32 nMore(DoInvalidateMore() ? GetWindow()->PixelToLogic(Size(nInvMore, 0)).Width() : 0);
- if(aOldArea.Right() > aOutArea.Right())
- {
- const tools::Rectangle aRect(aOutArea.Right(), aOldArea.Top() - nMore, aOldArea.Right() + nMore, aOldArea.Bottom() + nMore);
- InvalidateAtWindow(aRect);
- }
- else if(aOldArea.Right() < aOutArea.Right())
- {
- const tools::Rectangle aRect(aOldArea.Right(), aOldArea.Top() - nMore, aOutArea.Right() + nMore, aOldArea.Bottom() + nMore);
- InvalidateAtWindow(aRect);
- }
+ if(aOldArea.Left() > aOutArea.Left())
+ {
+ const tools::Rectangle aRect(aOutArea.Left() - nMore, aOldArea.Top() - nMore, aOldArea.Left(), aOldArea.Bottom() + nMore);
+ InvalidateAtWindow(aRect);
+ }
+ else if(aOldArea.Left() < aOutArea.Left())
+ {
+ const tools::Rectangle aRect(aOldArea.Left() - nMore, aOldArea.Top() - nMore, aOutArea.Left(), aOldArea.Bottom() + nMore);
+ InvalidateAtWindow(aRect);
+ }
- if(aOldArea.Top() > aOutArea.Top())
- {
- const tools::Rectangle aRect(aOldArea.Left() - nMore, aOutArea.Top() - nMore, aOldArea.Right() + nMore, aOldArea.Top());
- InvalidateAtWindow(aRect);
- }
- else if(aOldArea.Top() < aOutArea.Top())
- {
- const tools::Rectangle aRect(aOldArea.Left() - nMore, aOldArea.Top() - nMore, aOldArea.Right() + nMore, aOutArea.Top());
- InvalidateAtWindow(aRect);
- }
+ if(aOldArea.Right() > aOutArea.Right())
+ {
+ const tools::Rectangle aRect(aOutArea.Right(), aOldArea.Top() - nMore, aOldArea.Right() + nMore, aOldArea.Bottom() + nMore);
+ InvalidateAtWindow(aRect);
+ }
+ else if(aOldArea.Right() < aOutArea.Right())
+ {
+ const tools::Rectangle aRect(aOldArea.Right(), aOldArea.Top() - nMore, aOutArea.Right() + nMore, aOldArea.Bottom() + nMore);
+ InvalidateAtWindow(aRect);
+ }
- if(aOldArea.Bottom() > aOutArea.Bottom())
- {
- const tools::Rectangle aRect(aOldArea.Left() - nMore, aOutArea.Bottom(), aOldArea.Right() + nMore, aOldArea.Bottom() + nMore);
- InvalidateAtWindow(aRect);
- }
- else if(aOldArea.Bottom() < aOutArea.Bottom())
- {
- const tools::Rectangle aRect(aOldArea.Left() - nMore, aOldArea.Bottom(), aOldArea.Right() + nMore, aOutArea.Bottom() + nMore);
- InvalidateAtWindow(aRect);
- }
+ if(aOldArea.Top() > aOutArea.Top())
+ {
+ const tools::Rectangle aRect(aOldArea.Left() - nMore, aOutArea.Top() - nMore, aOldArea.Right() + nMore, aOldArea.Top());
+ InvalidateAtWindow(aRect);
+ }
+ else if(aOldArea.Top() < aOutArea.Top())
+ {
+ const tools::Rectangle aRect(aOldArea.Left() - nMore, aOldArea.Top() - nMore, aOldArea.Right() + nMore, aOutArea.Top());
+ InvalidateAtWindow(aRect);
+ }
+
+ if(aOldArea.Bottom() > aOutArea.Bottom())
+ {
+ const tools::Rectangle aRect(aOldArea.Left() - nMore, aOutArea.Bottom(), aOldArea.Right() + nMore, aOldArea.Bottom() + nMore);
+ InvalidateAtWindow(aRect);
+ }
+ else if(aOldArea.Bottom() < aOutArea.Bottom())
+ {
+ const tools::Rectangle aRect(aOldArea.Left() - nMore, aOldArea.Bottom(), aOldArea.Right() + nMore, aOutArea.Bottom() + nMore);
+ InvalidateAtWindow(aRect);
}
}
@@ -1619,34 +1619,34 @@ bool ImpEditView::IsBulletArea( const Point& rPos, sal_Int32* pPara )
void ImpEditView::CutCopy( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bCut )
{
- if ( rxClipboard.is() && HasSelection() )
- {
- uno::Reference<datatransfer::XTransferable> xData = pEditEngine->CreateTransferable( GetEditSelection() );
+ if ( !(rxClipboard.is() && HasSelection()) )
+ return;
- {
- SolarMutexReleaser aReleaser;
+ uno::Reference<datatransfer::XTransferable> xData = pEditEngine->CreateTransferable( GetEditSelection() );
- try
- {
- rxClipboard->setContents( xData, nullptr );
+ {
+ SolarMutexReleaser aReleaser;
- // #87756# FlushClipboard, but it would be better to become a TerminateListener to the Desktop and flush on demand...
- uno::Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( rxClipboard, uno::UNO_QUERY );
- if( xFlushableClipboard.is() )
- xFlushableClipboard->flushClipboard();
- }
- catch( const css::uno::Exception& )
- {
- }
+ try
+ {
+ rxClipboard->setContents( xData, nullptr );
- }
+ // #87756# FlushClipboard, but it would be better to become a TerminateListener to the Desktop and flush on demand...
+ uno::Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( rxClipboard, uno::UNO_QUERY );
+ if( xFlushableClipboard.is() )
+ xFlushableClipboard->flushClipboard();
+ }
+ catch( const css::uno::Exception& )
+ {
+ }
- if (bCut)
- {
- pEditEngine->pImpEditEngine->UndoActionStart(EDITUNDO_CUT);
- DeleteSelected();
- pEditEngine->pImpEditEngine->UndoActionEnd();
- }
+ }
+
+ if (bCut)
+ {
+ pEditEngine->pImpEditEngine->UndoActionStart(EDITUNDO_CUT);
+ DeleteSelected();
+ pEditEngine->pImpEditEngine->UndoActionEnd();
}
}
@@ -1870,56 +1870,56 @@ void ImpEditView::HideDDCursor()
void ImpEditView::ShowDDCursor( const tools::Rectangle& rRect )
{
- if ( pDragAndDropInfo && !pDragAndDropInfo->bVisCursor )
- {
- if (pOutWin && pOutWin->GetCursor())
- pOutWin->GetCursor()->Hide();
+ if ( !(pDragAndDropInfo && !pDragAndDropInfo->bVisCursor) )
+ return;
- OutputDevice& rOutDev = getEditViewCallbacks() ? getEditViewCallbacks()->EditViewOutputDevice() : *GetWindow();
- Color aOldFillColor = rOutDev.GetFillColor();
- rOutDev.SetFillColor( Color(4210752) ); // GRAY BRUSH_50, OLDSV, change to DDCursor!
+ if (pOutWin && pOutWin->GetCursor())
+ pOutWin->GetCursor()->Hide();
+
+ OutputDevice& rOutDev = getEditViewCallbacks() ? getEditViewCallbacks()->EditViewOutputDevice() : *GetWindow();
+ Color aOldFillColor = rOutDev.GetFillColor();
+ rOutDev.SetFillColor( Color(4210752) ); // GRAY BRUSH_50, OLDSV, change to DDCursor!
- // Save background ...
- tools::Rectangle aSaveRect( rOutDev.LogicToPixel( rRect ) );
- // prefer to save some more ...
- aSaveRect.AdjustRight(1 );
- aSaveRect.AdjustBottom(1 );
+ // Save background ...
+ tools::Rectangle aSaveRect( rOutDev.LogicToPixel( rRect ) );
+ // prefer to save some more ...
+ aSaveRect.AdjustRight(1 );
+ aSaveRect.AdjustBottom(1 );
#ifdef DBG_UTIL
- Size aNewSzPx( aSaveRect.GetSize() );
+ Size aNewSzPx( aSaveRect.GetSize() );
#endif
- if ( !pDragAndDropInfo->pBackground )
- {
- pDragAndDropInfo->pBackground = VclPtr<VirtualDevice>::Create(rOutDev);
- MapMode aMapMode( rOutDev.GetMapMode() );
- aMapMode.SetOrigin( Point( 0, 0 ) );
- pDragAndDropInfo->pBackground->SetMapMode( aMapMode );
+ if ( !pDragAndDropInfo->pBackground )
+ {
+ pDragAndDropInfo->pBackground = VclPtr<VirtualDevice>::Create(rOutDev);
+ MapMode aMapMode( rOutDev.GetMapMode() );
+ aMapMode.SetOrigin( Point( 0, 0 ) );
+ pDragAndDropInfo->pBackground->SetMapMode( aMapMode );
- }
+ }
#ifdef DBG_UTIL
- Size aCurSzPx( pDragAndDropInfo->pBackground->GetOutputSizePixel() );
- if ( ( aCurSzPx.Width() < aNewSzPx.Width() ) ||( aCurSzPx.Height() < aNewSzPx.Height() ) )
- {
- bool bDone = pDragAndDropInfo->pBackground->SetOutputSizePixel( aNewSzPx );
- DBG_ASSERT( bDone, "Virtual Device broken?" );
- }
+ Size aCurSzPx( pDragAndDropInfo->pBackground->GetOutputSizePixel() );
+ if ( ( aCurSzPx.Width() < aNewSzPx.Width() ) ||( aCurSzPx.Height() < aNewSzPx.Height() ) )
+ {
+ bool bDone = pDragAndDropInfo->pBackground->SetOutputSizePixel( aNewSzPx );
+ DBG_ASSERT( bDone, "Virtual Device broken?" );
+ }
#endif
- aSaveRect = rOutDev.PixelToLogic( aSaveRect );
+ aSaveRect = rOutDev.PixelToLogic( aSaveRect );
- pDragAndDropInfo->pBackground->DrawOutDev( Point(0,0), aSaveRect.GetSize(),
- aSaveRect.TopLeft(), aSaveRect.GetSize(), rOutDev );
- pDragAndDropInfo->aCurSavedCursor = aSaveRect;
+ pDragAndDropInfo->pBackground->DrawOutDev( Point(0,0), aSaveRect.GetSize(),
+ aSaveRect.TopLeft(), aSaveRect.GetSize(), rOutDev );
+ pDragAndDropInfo->aCurSavedCursor = aSaveRect;
- // Draw Cursor...
- rOutDev.DrawRect( rRect );
+ // Draw Cursor...
+ rOutDev.DrawRect( rRect );
- pDragAndDropInfo->bVisCursor = true;
- pDragAndDropInfo->aCurCursor = rRect;
+ pDragAndDropInfo->bVisCursor = true;
+ pDragAndDropInfo->aCurCursor = rRect;
- rOutDev.SetFillColor( aOldFillColor );
- }
+ rOutDev.SetFillColor( aOldFillColor );
}
void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestureEvent& rDGE)
@@ -1981,27 +1981,26 @@ void ImpEditView::dragGestureRecognized(const css::datatransfer::dnd::DragGestur
}
}
- if ( pDragAndDropInfo )
- {
+ if ( !pDragAndDropInfo )
+ return;
- pDragAndDropInfo->bStarterOfDD = true;
- // Sensitive area to be scrolled.
- Size aSz( 5, 0 );
- aSz = GetWindow()->PixelToLogic( aSz );
- pDragAndDropInfo->nSensibleRange = static_cast<sal_uInt16>(aSz.Width());
- pDragAndDropInfo->nCursorWidth = static_cast<sal_uInt16>(aSz.Width()) / 2;
- pDragAndDropInfo->aBeginDragSel = pEditEngine->pImpEditEngine->CreateESel( aCopySel );
+ pDragAndDropInfo->bStarterOfDD = true;
- uno::Reference<datatransfer::XTransferable> xData = pEditEngine->CreateTransferable(aCopySel);
+ // Sensitive area to be scrolled.
+ Size aSz( 5, 0 );
+ aSz = GetWindow()->PixelToLogic( aSz );
+ pDragAndDropInfo->nSensibleRange = static_cast<sal_uInt16>(aSz.Width());
+ pDragAndDropInfo->nCursorWidth = static_cast<sal_uInt16>(aSz.Width()) / 2;
+ pDragAndDropInfo->aBeginDragSel = pEditEngine->pImpEditEngine->CreateESel( aCopySel );
- sal_Int8 nActions = bReadOnly ? datatransfer::dnd::DNDConstants::ACTION_COPY : datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE;
+ uno::Reference<datatransfer::XTransferable> xData = pEditEngine->CreateTransferable(aCopySel);
- rDGE.DragSource->startDrag( rDGE, nActions, 0 /*cursor*/, 0 /*image*/, xData, mxDnDListener );
- // If Drag&Move in an Engine, then Copy&Del has to be optional!
- GetCursor()->Hide();
+ sal_Int8 nActions = bReadOnly ? datatransfer::dnd::DNDConstants::ACTION_COPY : datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE;
- }
+ rDGE.DragSource->startDrag( rDGE, nActions, 0 /*cursor*/, 0 /*image*/, xData, mxDnDListener );
+ // If Drag&Move in an Engine, then Copy&Del has to be optional!
+ GetCursor()->Hide();
}
void ImpEditView::dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent& rDSDE )
@@ -2011,89 +2010,89 @@ void ImpEditView::dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent
DBG_ASSERT( pDragAndDropInfo, "ImpEditView::dragDropEnd: pDragAndDropInfo is NULL!" );
// #123688# Shouldn't happen, but seems to happen...
- if ( pDragAndDropInfo )
+ if ( !pDragAndDropInfo )
+ return;
+
+ if ( !bReadOnly && rDSDE.DropSuccess && !pDragAndDropInfo->bOutlinerMode && ( rDSDE.DropAction & datatransfer::dnd::DNDConstants::ACTION_MOVE ) )
{
- if ( !bReadOnly && rDSDE.DropSuccess && !pDragAndDropInfo->bOutlinerMode && ( rDSDE.DropAction & datatransfer::dnd::DNDConstants::ACTION_MOVE ) )
+ if ( pDragAndDropInfo->bStarterOfDD && pDragAndDropInfo->bDroppedInMe )
{
- if ( pDragAndDropInfo->bStarterOfDD && pDragAndDropInfo->bDroppedInMe )
+ // DropPos: Where was it dropped, irrespective of length.
+ ESelection aDropPos( pDragAndDropInfo->aDropSel.nStartPara, pDragAndDropInfo->aDropSel.nStartPos, pDragAndDropInfo->aDropSel.nStartPara, pDragAndDropInfo->aDropSel.nStartPos );
+ ESelection aToBeDelSel = pDragAndDropInfo->aBeginDragSel;
+ ESelection aNewSel( pDragAndDropInfo->aDropSel.nEndPara, pDragAndDropInfo->aDropSel.nEndPos,
+ pDragAndDropInfo->aDropSel.nEndPara, pDragAndDropInfo->aDropSel.nEndPos );
+ bool bBeforeSelection = aDropPos < pDragAndDropInfo->aBeginDragSel;
+ sal_Int32 nParaDiff = pDragAndDropInfo->aBeginDragSel.nEndPara - pDragAndDropInfo->aBeginDragSel.nStartPara;
+ if ( bBeforeSelection )
{
- // DropPos: Where was it dropped, irrespective of length.
- ESelection aDropPos( pDragAndDropInfo->aDropSel.nStartPara, pDragAndDropInfo->aDropSel.nStartPos, pDragAndDropInfo->aDropSel.nStartPara, pDragAndDropInfo->aDropSel.nStartPos );
- ESelection aToBeDelSel = pDragAndDropInfo->aBeginDragSel;
- ESelection aNewSel( pDragAndDropInfo->aDropSel.nEndPara, pDragAndDropInfo->aDropSel.nEndPos,
- pDragAndDropInfo->aDropSel.nEndPara, pDragAndDropInfo->aDropSel.nEndPos );
- bool bBeforeSelection = aDropPos < pDragAndDropInfo->aBeginDragSel;
- sal_Int32 nParaDiff = pDragAndDropInfo->aBeginDragSel.nEndPara - pDragAndDropInfo->aBeginDragSel.nStartPara;
- if ( bBeforeSelection )
- {
- // Adjust aToBeDelSel.
- DBG_ASSERT( pDragAndDropInfo->aBeginDragSel.nStartPara >= pDragAndDropInfo->aDropSel.nStartPara, "But not before? ");
- aToBeDelSel.nStartPara = aToBeDelSel.nStartPara + nParaDiff;
- aToBeDelSel.nEndPara = aToBeDelSel.nEndPara + nParaDiff;
- // To correct the character?
- if ( aToBeDelSel.nStartPara == pDragAndDropInfo->aDropSel.nEndPara )
- {
- sal_uInt16 nMoreChars;
- if ( pDragAndDropInfo->aDropSel.nStartPara == pDragAndDropInfo->aDropSel.nEndPara )
- nMoreChars = pDragAndDropInfo->aDropSel.nEndPos - pDragAndDropInfo->aDropSel.nStartPos;
- else
- nMoreChars = pDragAndDropInfo->aDropSel.nEndPos;
- aToBeDelSel.nStartPos =
- aToBeDelSel.nStartPos + nMoreChars;
- if ( aToBeDelSel.nStartPara == aToBeDelSel.nEndPara )
- aToBeDelSel.nEndPos =
- aToBeDelSel.nEndPos + nMoreChars;
- }
- }
- else
+ // Adjust aToBeDelSel.
+ DBG_ASSERT( pDragAndDropInfo->aBeginDragSel.nStartPara >= pDragAndDropInfo->aDropSel.nStartPara, "But not before? ");
+ aToBeDelSel.nStartPara = aToBeDelSel.nStartPara + nParaDiff;
+ aToBeDelSel.nEndPara = aToBeDelSel.nEndPara + nParaDiff;
+ // To correct the character?
+ if ( aToBeDelSel.nStartPara == pDragAndDropInfo->aDropSel.nEndPara )
{
- // aToBeDelSel is ok, but the selection of the View
- // has to be adapted, if it was deleted before!
- DBG_ASSERT( pDragAndDropInfo->aBeginDragSel.nStartPara <= pDragAndDropInfo->aDropSel.nStartPara, "But not before? ");
- aNewSel.nStartPara = aNewSel.nStartPara - nParaDiff;
- aNewSel.nEndPara = aNewSel.nEndPara - nParaDiff;
- // To correct the character?
- if ( pDragAndDropInfo->aBeginDragSel.nEndPara == pDragAndDropInfo->aDropSel.nStartPara )
- {
- sal_uInt16 nLessChars;
- if ( pDragAndDropInfo->aBeginDragSel.nStartPara == pDragAndDropInfo->aBeginDragSel.nEndPara )
- nLessChars = pDragAndDropInfo->aBeginDragSel.nEndPos - pDragAndDropInfo->aBeginDragSel.nStartPos;
- else
- nLessChars = pDragAndDropInfo->aBeginDragSel.nEndPos;
- aNewSel.nStartPos = aNewSel.nStartPos - nLessChars;
- if ( aNewSel.nStartPara == aNewSel.nEndPara )
- aNewSel.nEndPos = aNewSel.nEndPos - nLessChars;
- }
+ sal_uInt16 nMoreChars;
+ if ( pDragAndDropInfo->aDropSel.nStartPara == pDragAndDropInfo->aDropSel.nEndPara )
+ nMoreChars = pDragAndDropInfo->aDropSel.nEndPos - pDragAndDropInfo->aDropSel.nStartPos;
+ else
+ nMoreChars = pDragAndDropInfo->aDropSel.nEndPos;
+ aToBeDelSel.nStartPos =
+ aToBeDelSel.nStartPos + nMoreChars;
+ if ( aToBeDelSel.nStartPara == aToBeDelSel.nEndPara )
+ aToBeDelSel.nEndPos =
+ aToBeDelSel.nEndPos + nMoreChars;
}
-
- DrawSelectionXOR();
- EditSelection aDelSel( pEditEngine->pImpEditEngine->CreateSel( aToBeDelSel ) );
- DBG_ASSERT( !aDelSel.DbgIsBuggy( pEditEngine->GetEditDoc() ), "ToBeDel is buggy!" );
- pEditEngine->DeleteSelection(aDelSel);
- if ( !bBeforeSelection )
+ }
+ else
+ {
+ // aToBeDelSel is ok, but the selection of the View
+ // has to be adapted, if it was deleted before!
+ DBG_ASSERT( pDragAndDropInfo->aBeginDragSel.nStartPara <= pDragAndDropInfo->aDropSel.nStartPara, "But not before? ");
+ aNewSel.nStartPara = aNewSel.nStartPara - nParaDiff;
+ aNewSel.nEndPara = aNewSel.nEndPara - nParaDiff;
+ // To correct the character?
+ if ( pDragAndDropInfo->aBeginDragSel.nEndPara == pDragAndDropInfo->aDropSel.nStartPara )
{
- DBG_ASSERT( !pEditEngine->pImpEditEngine->CreateSel( aNewSel ).DbgIsBuggy(pEditEngine->GetEditDoc()), "Bad" );
- SetEditSelection( pEditEngine->pImpEditEngine->CreateSel( aNewSel ) );
+ sal_uInt16 nLessChars;
+ if ( pDragAndDropInfo->aBeginDragSel.nStartPara == pDragAndDropInfo->aBeginDragSel.nEndPara )
+ nLessChars = pDragAndDropInfo->aBeginDragSel.nEndPos - pDragAndDropInfo->aBeginDragSel.nStartPos;
+ else
+ nLessChars = pDragAndDropInfo->aBeginDragSel.nEndPos;
+ aNewSel.nStartPos = aNewSel.nStartPos - nLessChars;
+ if ( aNewSel.nStartPara == aNewSel.nEndPara )
+ aNewSel.nEndPos = aNewSel.nEndPos - nLessChars;
}
- pEditEngine->pImpEditEngine->FormatAndUpdate( pEditEngine->pImpEditEngine->GetActiveView() );
- DrawSelectionXOR();
}
- else
+
+ DrawSelectionXOR();
+ EditSelection aDelSel( pEditEngine->pImpEditEngine->CreateSel( aToBeDelSel ) );
+ DBG_ASSERT( !aDelSel.DbgIsBuggy( pEditEngine->GetEditDoc() ), "ToBeDel is buggy!" );
+ pEditEngine->DeleteSelection(aDelSel);
+ if ( !bBeforeSelection )
{
- // other EditEngine ...
- if (pEditEngine->HasText()) // #88630# SC is removing the content when switching the task
- DeleteSelected();
+ DBG_ASSERT( !pEditEngine->pImpEditEngine->CreateSel( aNewSel ).DbgIsBuggy(pEditEngine->GetEditDoc()), "Bad" );
+ SetEditSelection( pEditEngine->pImpEditEngine->CreateSel( aNewSel ) );
}
+ pEditEngine->pImpEditEngine->FormatAndUpdate( pEditEngine->pImpEditEngine->GetActiveView() );
+ DrawSelectionXOR();
+ }
+ else
+ {
+ // other EditEngine ...
+ if (pEditEngine->HasText()) // #88630# SC is removing the content when switching the task
+ DeleteSelected();
}
+ }
- if ( pDragAndDropInfo->bUndoAction )
- pEditEngine->pImpEditEngine->UndoActionEnd();
+ if ( pDragAndDropInfo->bUndoAction )
+ pEditEngine->pImpEditEngine->UndoActionEnd();
- HideDDCursor();
- ShowCursor( DoAutoScroll(), true );
- pDragAndDropInfo.reset();
- pEditEngine->GetEndDropHdl().Call(GetEditViewPtr());
- }
+ HideDDCursor();
+ ShowCursor( DoAutoScroll(), true );
+ pDragAndDropInfo.reset();
+ pEditEngine->GetEndDropHdl().Call(GetEditViewPtr());
}
void ImpEditView::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE )
@@ -2102,70 +2101,70 @@ void ImpEditView::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE
DBG_ASSERT( pDragAndDropInfo, "Drop - No Drag&Drop info?!" );
- if ( pDragAndDropInfo && pDragAndDropInfo->bDragAccepted )
- {
- pEditEngine->GetBeginDropHdl().Call(GetEditViewPtr());
- bool bChanges = false;
+ if ( !(pDragAndDropInfo && pDragAndDropInfo->bDragAccepted) )
+ return;
- HideDDCursor();
+ pEditEngine->GetBeginDropHdl().Call(GetEditViewPtr());
+ bool bChanges = false;
- if ( pDragAndDropInfo->bStarterOfDD )
- {
- pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_DRAGANDDROP );
- pDragAndDropInfo->bUndoAction = true;
- }
+ HideDDCursor();
+
+ if ( pDragAndDropInfo->bStarterOfDD )
+ {
+ pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_DRAGANDDROP );
+ pDragAndDropInfo->bUndoAction = true;
+ }
- if ( pDragAndDropInfo->bOutlinerMode )
+ if ( pDragAndDropInfo->bOutlinerMode )
+ {
+ bChanges = true;
+ GetEditViewPtr()->MoveParagraphs( Range( pDragAndDropInfo->aBeginDragSel.nStartPara, pDragAndDropInfo->aBeginDragSel.nEndPara ), pDragAndDropInfo->nOutlinerDropDest );
+ }
+ else
+ {
+ uno::Reference< datatransfer::XTransferable > xDataObj = rDTDE.Transferable;
+ if ( xDataObj.is() )
{
bChanges = true;
- GetEditViewPtr()->MoveParagraphs( Range( pDragAndDropInfo->aBeginDragSel.nStartPara, pDragAndDropInfo->aBeginDragSel.nEndPara ), pDragAndDropInfo->nOutlinerDropDest );
- }
- else
- {
- uno::Reference< datatransfer::XTransferable > xDataObj = rDTDE.Transferable;
- if ( xDataObj.is() )
- {
- bChanges = true;
- // remove Selection ...
- DrawSelectionXOR();
- EditPaM aPaM( pDragAndDropInfo->aDropDest );
+ // remove Selection ...
+ DrawSelectionXOR();
+ EditPaM aPaM( pDragAndDropInfo->aDropDest );
- PasteOrDropInfos aPasteOrDropInfos;
- aPasteOrDropInfos.nStartPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
- pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos);
+ PasteOrDropInfos aPasteOrDropInfos;
+ aPasteOrDropInfos.nStartPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
+ pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos);
- EditSelection aNewSel = pEditEngine->InsertText(
- xDataObj, OUString(), aPaM, pEditEngine->GetInternalEditStatus().AllowPasteSpecial());
+ EditSelection aNewSel = pEditEngine->InsertText(
+ xDataObj, OUString(), aPaM, pEditEngine->GetInternalEditStatus().AllowPasteSpecial());
- aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() );
- pEditEngine->HandleEndPasteOrDrop(aPasteOrDropInfos);
+ aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() );
+ pEditEngine->HandleEndPasteOrDrop(aPasteOrDropInfos);
- SetEditSelection( aNewSel );
- pEditEngine->pImpEditEngine->FormatAndUpdate( pEditEngine->pImpEditEngine->GetActiveView() );
- if ( pDragAndDropInfo->bStarterOfDD )
- {
- // Only set if the same engine!
- pDragAndDropInfo->aDropSel.nStartPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
- pDragAndDropInfo->aDropSel.nStartPos = aPaM.GetIndex();
- pDragAndDropInfo->aDropSel.nEndPara = pEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() );
- pDragAndDropInfo->aDropSel.nEndPos = aNewSel.Max().GetIndex();
- pDragAndDropInfo->bDroppedInMe = true;
- }
+ SetEditSelection( aNewSel );
+ pEditEngine->pImpEditEngine->FormatAndUpdate( pEditEngine->pImpEditEngine->GetActiveView() );
+ if ( pDragAndDropInfo->bStarterOfDD )
+ {
+ // Only set if the same engine!
+ pDragAndDropInfo->aDropSel.nStartPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
+ pDragAndDropInfo->aDropSel.nStartPos = aPaM.GetIndex();
+ pDragAndDropInfo->aDropSel.nEndPara = pEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() );
+ pDragAndDropInfo->aDropSel.nEndPos = aNewSel.Max().GetIndex();
+ pDragAndDropInfo->bDroppedInMe = true;
}
}
+ }
- if ( bChanges )
- {
- rDTDE.Context->acceptDrop( rDTDE.DropAction );
- }
-
- if ( !pDragAndDropInfo->bStarterOfDD )
- {
- pDragAndDropInfo.reset();
- }
+ if ( bChanges )
+ {
+ rDTDE.Context->acceptDrop( rDTDE.DropAction );
+ }
- rDTDE.Context->dropComplete( bChanges );
+ if ( !pDragAndDropInfo->bStarterOfDD )
+ {
+ pDragAndDropInfo.reset();
}
+
+ rDTDE.Context->dropComplete( bChanges );
}
void ImpEditView::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& rDTDEE )
@@ -2369,25 +2368,25 @@ void ImpEditView::AddDragAndDropListeners()
else if (GetWindow())
xDropTarget = GetWindow()->GetDropTarget();
- if (xDropTarget.is())
- {
- vcl::unohelper::DragAndDropWrapper* pDnDWrapper = new vcl::unohelper::DragAndDropWrapper(this);
- mxDnDListener = pDnDWrapper;
-
- css::uno::Reference<css::datatransfer::dnd::XDragGestureRecognizer> xDragGestureRecognizer(xDropTarget, uno::UNO_QUERY);
- if (xDragGestureRecognizer.is())
- {
- uno::Reference<datatransfer::dnd::XDragGestureListener> xDGL(mxDnDListener, uno::UNO_QUERY);
- xDragGestureRecognizer->addDragGestureListener(xDGL);
- }
+ if (!xDropTarget.is())
+ return;
- uno::Reference<datatransfer::dnd::XDropTargetListener> xDTL(mxDnDListener, uno::UNO_QUERY);
- xDropTarget->addDropTargetListener(xDTL);
- xDropTarget->setActive(true);
- xDropTarget->setDefaultActions(datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE);
+ vcl::unohelper::DragAndDropWrapper* pDnDWrapper = new vcl::unohelper::DragAndDropWrapper(this);
+ mxDnDListener = pDnDWrapper;
- bActiveDragAndDropListener = true;
+ css::uno::Reference<css::datatransfer::dnd::XDragGestureRecognizer> xDragGestureRecognizer(xDropTarget, uno::UNO_QUERY);
+ if (xDragGestureRecognizer.is())
+ {
+ uno::Reference<datatransfer::dnd::XDragGestureListener> xDGL(mxDnDListener, uno::UNO_QUERY);
+ xDragGestureRecognizer->addDragGestureListener(xDGL);
}
+
+ uno::Reference<datatransfer::dnd::XDropTargetListener> xDTL(mxDnDListener, uno::UNO_QUERY);
+ xDropTarget->addDropTargetListener(xDTL);
+ xDropTarget->setActive(true);
+ xDropTarget->setDefaultActions(datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE);
+
+ bActiveDragAndDropListener = true;
}
void ImpEditView::RemoveDragAndDropListeners()
@@ -2401,26 +2400,26 @@ void ImpEditView::RemoveDragAndDropListeners()
else if (GetWindow())
xDropTarget = GetWindow()->GetDropTarget();
- if (xDropTarget.is())
- {
- css::uno::Reference<css::datatransfer::dnd::XDragGestureRecognizer> xDragGestureRecognizer(xDropTarget, uno::UNO_QUERY);
- if (xDragGestureRecognizer.is())
- {
- uno::Reference<datatransfer::dnd::XDragGestureListener> xDGL(mxDnDListener, uno::UNO_QUERY);
- xDragGestureRecognizer->removeDragGestureListener(xDGL);
- }
+ if (!xDropTarget.is())
+ return;
- uno::Reference<datatransfer::dnd::XDropTargetListener> xDTL(mxDnDListener, uno::UNO_QUERY);
- xDropTarget->removeDropTargetListener(xDTL);
+ css::uno::Reference<css::datatransfer::dnd::XDragGestureRecognizer> xDragGestureRecognizer(xDropTarget, uno::UNO_QUERY);
+ if (xDragGestureRecognizer.is())
+ {
+ uno::Reference<datatransfer::dnd::XDragGestureListener> xDGL(mxDnDListener, uno::UNO_QUERY);
+ xDragGestureRecognizer->removeDragGestureListener(xDGL);
+ }
- if ( mxDnDListener.is() )
- {
- mxDnDListener->disposing( lang::EventObject() ); // #95154# Empty Source means it's the Client
- mxDnDListener.clear();
- }
+ uno::Reference<datatransfer::dnd::XDropTargetListener> xDTL(mxDnDListener, uno::UNO_QUERY);
+ xDropTarget->removeDropTargetListener(xDTL);
- bActiveDragAndDropListener = false;
+ if ( mxDnDListener.is() )
+ {
+ mxDnDListener->disposing( lang::EventObject() ); // #95154# Empty Source means it's the Client
+ mxDnDListener.clear();
}
+
+ bActiveDragAndDropListener = false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 9c04370d9f08..ffa93a144efd 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1613,131 +1613,131 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara )
rTypes.clear();
ContentNode* pNode = pParaPortion->GetNode();
- if ( pNode->Len() )
- {
- uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
+ if ( !pNode->Len() )
+ return;
- OUString aText = pNode->GetString();
+ uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
+
+ OUString aText = pNode->GetString();
- // To handle fields put the character from the field in the string,
- // because endOfScript( ... ) will skip the CH_FEATURE, because this is WEAK
- const EditCharAttrib* pField = pNode->GetCharAttribs().FindNextAttrib( EE_FEATURE_FIELD, 0 );
- while ( pField )
+ // To handle fields put the character from the field in the string,
+ // because endOfScript( ... ) will skip the CH_FEATURE, because this is WEAK
+ const EditCharAttrib* pField = pNode->GetCharAttribs().FindNextAttrib( EE_FEATURE_FIELD, 0 );
+ while ( pField )
+ {
+ const OUString aFldText = static_cast<const EditCharAttribField*>(pField)->GetFieldValue();
+ if ( !aFldText.isEmpty() )
{
- const OUString aFldText = static_cast<const EditCharAttribField*>(pField)->GetFieldValue();
- if ( !aFldText.isEmpty() )
+ aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(0,1) );
+ short nFldScriptType = _xBI->getScriptType( aFldText, 0 );
+
+ for ( sal_Int32 nCharInField = 1; nCharInField < aFldText.getLength(); nCharInField++ )
{
- aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(0,1) );
- short nFldScriptType = _xBI->getScriptType( aFldText, 0 );
+ short nTmpType = _xBI->getScriptType( aFldText, nCharInField );
- for ( sal_Int32 nCharInField = 1; nCharInField < aFldText.getLength(); nCharInField++ )
+ // First char from field wins...
+ if ( nFldScriptType == i18n::ScriptType::WEAK )
{
- short nTmpType = _xBI->getScriptType( aFldText, nCharInField );
-
- // First char from field wins...
- if ( nFldScriptType == i18n::ScriptType::WEAK )
- {
- nFldScriptType = nTmpType;
- aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(nCharInField,1) );
- }
+ nFldScriptType = nTmpType;
+ aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(nCharInField,1) );
+ }
- // ... but if the first one is LATIN, and there are CJK or CTL chars too,
- // we prefer that ScriptType because we need another font.
- if ( ( nTmpType == i18n::ScriptType::ASIAN ) || ( nTmpType == i18n::ScriptType::COMPLEX ) )
- {
- aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(nCharInField,1) );
- break;
- }
+ // ... but if the first one is LATIN, and there are CJK or CTL chars too,
+ // we prefer that ScriptType because we need another font.
+ if ( ( nTmpType == i18n::ScriptType::ASIAN ) || ( nTmpType == i18n::ScriptType::COMPLEX ) )
+ {
+ aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(nCharInField,1) );
+ break;
}
}
- // #112831# Last Field might go from 0xffff to 0x0000
- pField = pField->GetEnd() ? pNode->GetCharAttribs().FindNextAttrib( EE_FEATURE_FIELD, pField->GetEnd() ) : nullptr;
}
+ // #112831# Last Field might go from 0xffff to 0x0000
+ pField = pField->GetEnd() ? pNode->GetCharAttribs().FindNextAttrib( EE_FEATURE_FIELD, pField->GetEnd() ) : nullptr;
+ }
- sal_Int32 nTextLen = aText.getLength();
+ sal_Int32 nTextLen = aText.getLength();
- sal_Int32 nPos = 0;
- short nScriptType = _xBI->getScriptType( aText, nPos );
- rTypes.emplace_back( nScriptType, nPos, nTextLen );
- nPos = _xBI->endOfScript( aText, nPos, nScriptType );
- while ( ( nPos != -1 ) && ( nPos < nTextLen ) )
- {
- rTypes.back().nEndPos = nPos;
+ sal_Int32 nPos = 0;
+ short nScriptType = _xBI->getScriptType( aText, nPos );
+ rTypes.emplace_back( nScriptType, nPos, nTextLen );
+ nPos = _xBI->endOfScript( aText, nPos, nScriptType );
+ while ( ( nPos != -1 ) && ( nPos < nTextLen ) )
+ {
+ rTypes.back().nEndPos = nPos;
- nScriptType = _xBI->getScriptType( aText, nPos );
- long nEndPos = _xBI->endOfScript( aText, nPos, nScriptType );
+ nScriptType = _xBI->getScriptType( aText, nPos );
+ long nEndPos = _xBI->endOfScript( aText, nPos, nScriptType );
- if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == rTypes.back().nScriptType ) )
- {
- // Expand last ScriptTypePosInfo, don't create weak or unnecessary portions
- rTypes.back().nEndPos = nEndPos;
- }
- else
+ if ( ( nScriptType == i18n::ScriptType::WEAK ) || ( nScriptType == rTypes.back().nScriptType ) )
+ {
+ // Expand last ScriptTypePosInfo, don't create weak or unnecessary portions
+ rTypes.back().nEndPos = nEndPos;
+ }
+ else
+ {
+ if ( _xBI->getScriptType( aText, nPos - 1 ) == i18n::ScriptType::WEAK )
{
- if ( _xBI->getScriptType( aText, nPos - 1 ) == i18n::ScriptType::WEAK )
- {
- switch ( u_charType(aText.iterateCodePoints(&nPos, 0) ) ) {
- case U_NON_SPACING_MARK:
- case U_ENCLOSING_MARK:
- case U_COMBINING_SPACING_MARK:
- --nPos;
- rTypes.back().nEndPos--;
- break;
- }
+ switch ( u_charType(aText.iterateCodePoints(&nPos, 0) ) ) {
+ case U_NON_SPACING_MARK:
+ case U_ENCLOSING_MARK:
+ case U_COMBINING_SPACING_MARK:
+ --nPos;
+ rTypes.back().nEndPos--;
+ break;
}
- rTypes.emplace_back( nScriptType, nPos, nTextLen );
}
-
- nPos = nEndPos;
+ rTypes.emplace_back( nScriptType, nPos, nTextLen );
}
- if ( rTypes[0].nScriptType == i18n::ScriptType::WEAK )
- rTypes[0].nScriptType = ( rTypes.size() > 1 ) ? rTypes[1].nScriptType : SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetDefaultLanguage() );
+ nPos = nEndPos;
+ }
- // create writing direction information:
- if ( pParaPortion->aWritingDirectionInfos.empty() )
- InitWritingDirections( nPara );
+ if ( rTypes[0].nScriptType == i18n::ScriptType::WEAK )
+ rTypes[0].nScriptType = ( rTypes.size() > 1 ) ? rTypes[1].nScriptType : SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetDefaultLanguage() );
- // i89825: Use CTL font for numbers embedded into an RTL run:
- WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos;
- for (const WritingDirectionInfo & rDirInfo : rDirInfos)
- {
- const sal_Int32 nStart = rDirInfo.nStartPos;
- const sal_Int32 nEnd = rDirInfo.nEndPos;
- const sal_uInt8 nCurrDirType = rDirInfo.nType;
+ // create writing direction information:
+ if ( pParaPortion->aWritingDirectionInfos.empty() )
+ InitWritingDirections( nPara );
- if ( nCurrDirType % 2 == UBIDI_RTL || // text in RTL run
- ( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( aText, nStart, nEnd ) ) ) // non-strong text in embedded LTR run
- {
- size_t nIdx = 0;
+ // i89825: Use CTL font for numbers embedded into an RTL run:
+ WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos;
+ for (const WritingDirectionInfo & rDirInfo : rDirInfos)
+ {
+ const sal_Int32 nStart = rDirInfo.nStartPos;
+ const sal_Int32 nEnd = rDirInfo.nEndPos;
+ const sal_uInt8 nCurrDirType = rDirInfo.nType;
+
+ if ( nCurrDirType % 2 == UBIDI_RTL || // text in RTL run
+ ( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( aText, nStart, nEnd ) ) ) // non-strong text in embedded LTR run
+ {
+ size_t nIdx = 0;
- // Skip entries in ScriptArray which are not inside the RTL run:
- while ( nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart )
- ++nIdx;
+ // Skip entries in ScriptArray which are not inside the RTL run:
+ while ( nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart )
+ ++nIdx;
- // Remove any entries *inside* the current run:
- while (nIdx < rTypes.size() && rTypes[nIdx].nEndPos <= nEnd)
- {
- // coverity[use_iterator] - we're protected from a bad iterator by the above condition
- rTypes.erase(rTypes.begin() + nIdx);
- }
+ // Remove any entries *inside* the current run:
+ while (nIdx < rTypes.size() && rTypes[nIdx].nEndPos <= nEnd)
+ {
+ // coverity[use_iterator] - we're protected from a bad iterator by the above condition
+ rTypes.erase(rTypes.begin() + nIdx);
+ }
- // special case:
- if(nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart && rTypes[nIdx].nEndPos > nEnd)
- {
- rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( rTypes[nIdx].nScriptType, nEnd, rTypes[nIdx].nEndPos ) );
- rTypes[nIdx].nEndPos = nStart;
- }
+ // special case:
+ if(nIdx < rTypes.size() && rTypes[nIdx].nStartPos < nStart && rTypes[nIdx].nEndPos > nEnd)
+ {
+ rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( rTypes[nIdx].nScriptType, nEnd, rTypes[nIdx].nEndPos ) );
+ rTypes[nIdx].nEndPos = nStart;
+ }
- if( nIdx )
- rTypes[nIdx - 1].nEndPos = nStart;
+ if( nIdx )
+ rTypes[nIdx - 1].nEndPos = nStart;
- rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( i18n::ScriptType::COMPLEX, nStart, nEnd) );
- ++nIdx;
+ rTypes.insert( rTypes.begin()+nIdx, ScriptTypePosInfo( i18n::ScriptType::COMPLEX, nStart, nEnd) );
+ ++nIdx;
- if( nIdx < rTypes.size() )
- rTypes[nIdx].nStartPos = nEnd;
- }
+ if( nIdx < rTypes.size() )
+ rTypes[nIdx].nStartPos = nEnd;
}
}
}
@@ -4091,97 +4091,97 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion )
pPortion->nHeight = 0;
pPortion->nFirstLineOffset = 0;
- if ( pPortion->IsVisible() )
+ if ( !pPortion->IsVisible() )
+ return;
+
+ OSL_ENSURE( pPortion->GetLines().Count(), "Paragraph with no lines in ParaPortion::CalcHeight" );
+ for (sal_Int32 nLine = 0; nLine < pPortion->GetLines().Count(); ++nLine)
+ pPortion->nHeight += pPortion->GetLines()[nLine].GetHeight();
+
+ if ( aStatus.IsOutliner() )
+ return;
+
+ const SvxULSpaceItem& rULItem = pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE );
+ const SvxLineSpacingItem& rLSItem = pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL );
+ sal_Int32 nSBL = ( rLSItem.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Fix ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0;
+
+ if ( nSBL )
{
- OSL_ENSURE( pPortion->GetLines().Count(), "Paragraph with no lines in ParaPortion::CalcHeight" );
- for (sal_Int32 nLine = 0; nLine < pPortion->GetLines().Count(); ++nLine)
- pPortion->nHeight += pPortion->GetLines()[nLine].GetHeight();
+ if ( pPortion->GetLines().Count() > 1 )
+ pPortion->nHeight += ( pPortion->GetLines().Count() - 1 ) * nSBL;
+ if ( aStatus.ULSpaceSummation() )
+ pPortion->nHeight += nSBL;
+ }
- if ( !aStatus.IsOutliner() )
- {
- const SvxULSpaceItem& rULItem = pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE );
- const SvxLineSpacingItem& rLSItem = pPortion->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL );
- sal_Int32 nSBL = ( rLSItem.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Fix ) ? GetYValue( rLSItem.GetInterLineSpace() ) : 0;
+ sal_Int32 nPortion = GetParaPortions().GetPos( pPortion );
+ if ( nPortion )
+ {
+ sal_uInt16 nUpper = GetYValue( rULItem.GetUpper() );
+ pPortion->nHeight += nUpper;
+ pPortion->nFirstLineOffset = nUpper;
+ }
- if ( nSBL )
- {
- if ( pPortion->GetLines().Count() > 1 )
- pPortion->nHeight += ( pPortion->GetLines().Count() - 1 ) * nSBL;
- if ( aStatus.ULSpaceSummation() )
- pPortion->nHeight += nSBL;
- }
+ if ( nPortion != (GetParaPortions().Count()-1) )
+ {
+ pPortion->nHeight += GetYValue( rULItem.GetLower() ); // not in the last
+ }
- sal_Int32 nPortion = GetParaPortions().GetPos( pPortion );
- if ( nPortion )
- {
- sal_uInt16 nUpper = GetYValue( rULItem.GetUpper() );
- pPortion->nHeight += nUpper;
- pPortion->nFirstLineOffset = nUpper;
- }
- if ( nPortion != (GetParaPortions().Count()-1) )
- {
- pPortion->nHeight += GetYValue( rULItem.GetLower() ); // not in the last
- }
+ if ( !(nPortion && !aStatus.ULSpaceSummation()) )
+ return;
+ ParaPortion* pPrev = GetParaPortions().SafeGetObject( nPortion-1 );
+ if (!pPrev)
+ return;
- if ( nPortion && !aStatus.ULSpaceSummation() )
- {
- ParaPortion* pPrev = GetParaPortions().SafeGetObject( nPortion-1 );
- if (pPrev)
- {
- const SvxULSpaceItem& rPrevULItem = pPrev->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE );
- const SvxLineSpacingItem& rPrevLSItem = pPrev->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL );
+ const SvxULSpaceItem& rPrevULItem = pPrev->GetNode()->GetContentAttribs().GetItem( EE_PARA_ULSPACE );
+ const SvxLineSpacingItem& rPrevLSItem = pPrev->GetNode()->GetContentAttribs().GetItem( EE_PARA_SBL );
- // In relation between WinWord6/Writer3:
- // With a proportional line spacing the paragraph spacing is
- // also manipulated.
- // Only Writer3: Do not add up, but minimum distance.
+ // In relation between WinWord6/Writer3:
+ // With a proportional line spacing the paragraph spacing is
+ // also manipulated.
+ // Only Writer3: Do not add up, but minimum distance.
- // check if distance by LineSpacing > Upper:
- sal_uInt16 nExtraSpace = GetYValue( lcl_CalcExtraSpace( rLSItem ) );
- if ( nExtraSpace > pPortion->nFirstLineOffset )
- {
- // Paragraph becomes 'bigger':
- pPortion->nHeight += ( nExtraSpace - pPortion->nFirstLineOffset );
- pPortion->nFirstLineOffset = nExtraSpace;
- }
+ // check if distance by LineSpacing > Upper:
+ sal_uInt16 nExtraSpace = GetYValue( lcl_CalcExtraSpace( rLSItem ) );
+ if ( nExtraSpace > pPortion->nFirstLineOffset )
+ {
+ // Paragraph becomes 'bigger':
+ pPortion->nHeight += ( nExtraSpace - pPortion->nFirstLineOffset );
+ pPortion->nFirstLineOffset = nExtraSpace;
+ }
- // Determine nFirstLineOffset now f(pNode) => now f(pNode, pPrev):
- sal_uInt16 nPrevLower = GetYValue( rPrevULItem.GetLower() );
+ // Determine nFirstLineOffset now f(pNode) => now f(pNode, pPrev):
+ sal_uInt16 nPrevLower = GetYValue( rPrevULItem.GetLower() );
- // This PrevLower is still in the height of PrevPortion ...
- if ( nPrevLower > pPortion->nFirstLineOffset )
- {
- // Paragraph is 'small':
- pPortion->nHeight -= pPortion->nFirstLineOffset;
- pPortion->nFirstLineOffset = 0;
- }
- else if ( nPrevLower )
- {
- // Paragraph becomes 'somewhat smaller':
- pPortion->nHeight -= nPrevLower;
- pPortion->nFirstLineOffset =
- pPortion->nFirstLineOffset - nPrevLower;
- }
- // I find it not so good, but Writer3 feature:
- // Check if distance by LineSpacing > Lower: this value is not
- // stuck in the height of PrevPortion.
- if ( !pPrev->IsInvalid() )
- {
- nExtraSpace = GetYValue( lcl_CalcExtraSpace( rPrevLSItem ) );
- if ( nExtraSpace > nPrevLower )
- {
- sal_uInt16 nMoreLower = nExtraSpace - nPrevLower;
- // Paragraph becomes 'bigger', 'grows' downwards:
- if ( nMoreLower > pPortion->nFirstLineOffset )
- {
- pPortion->nHeight += ( nMoreLower - pPortion->nFirstLineOffset );
- pPortion->nFirstLineOffset = nMoreLower;
- }
- }
- }
- }
+ // This PrevLower is still in the height of PrevPortion ...
+ if ( nPrevLower > pPortion->nFirstLineOffset )
+ {
+ // Paragraph is 'small':
+ pPortion->nHeight -= pPortion->nFirstLineOffset;
+ pPortion->nFirstLineOffset = 0;
+ }
+ else if ( nPrevLower )
+ {
+ // Paragraph becomes 'somewhat smaller':
+ pPortion->nHeight -= nPrevLower;
+ pPortion->nFirstLineOffset =
+ pPortion->nFirstLineOffset - nPrevLower;
+ }
+ // I find it not so good, but Writer3 feature:
+ // Check if distance by LineSpacing > Lower: this value is not
+ // stuck in the height of PrevPortion.
+ if ( !pPrev->IsInvalid() )
+ {
+ nExtraSpace = GetYValue( lcl_CalcExtraSpace( rPrevLSItem ) );
+ if ( nExtraSpace > nPrevLower )
+ {
+ sal_uInt16 nMoreLower = nExtraSpace - nPrevLower;
+ // Paragraph becomes 'bigger', 'grows' downwards:
+ if ( nMoreLower > pPortion->nFirstLineOffset )
+ {
+ pPortion->nHeight += ( nMoreLower - pPortion->nFirstLineOffset );
+ pPortion->nFirstLineOffset = nMoreLower;
}
}
}
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index b9a33ceec64d..0d00c5197184 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -512,46 +512,46 @@ void ImpEditEngine::CheckAutoPageSize()
SetValidPaperSize( aPaperSize ); // consider Min, Max
- if ( aPaperSize != aPrevPaperSize )
+ if ( aPaperSize == aPrevPaperSize )
+ return;
+
+ if ( ( !IsVertical() && ( aPaperSize.Width() != aPrevPaperSize.Width() ) )
+ || ( IsVertical() && ( aPaperSize.Height() != aPrevPaperSize.Height() ) ) )
{
- if ( ( !IsVertical() && ( aPaperSize.Width() != aPrevPaperSize.Width() ) )
- || ( IsVertical() && ( aPaperSize.Height() != aPrevPaperSize.Height() ) ) )
+ // If ahead is centered / right or tabs...
+ aStatus.GetStatusWord() |= !IsVertical() ? EditStatusFlags::TEXTWIDTHCHANGED : EditStatusFlags::TextHeightChanged;
+ for ( sal_Int32 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
{
- // If ahead is centered / right or tabs...
- aStatus.GetStatusWord() |= !IsVertical() ? EditStatusFlags::TEXTWIDTHCHANGED : EditStatusFlags::TextHeightChanged;
- for ( sal_Int32 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
+ // Only paragraphs which are not aligned to the left need to be
+ // reformatted, the height can not be changed here anymore.
+ ParaPortion* pParaPortion = GetParaPortions()[nPara];
+ SvxAdjust eJustification = GetJustification( nPara );
+ if ( eJustification != SvxAdjust::Left )
{
- // Only paragraphs which are not aligned to the left need to be
- // reformatted, the height can not be changed here anymore.
- ParaPortion* pParaPortion = GetParaPortions()[nPara];
- SvxAdjust eJustification = GetJustification( nPara );
- if ( eJustification != SvxAdjust::Left )
- {
- pParaPortion->MarkSelectionInvalid( 0 );
- CreateLines( nPara, 0 ); // 0: For AutoPageSize no TextRange!
- }
+ pParaPortion->MarkSelectionInvalid( 0 );
+ CreateLines( nPara, 0 ); // 0: For AutoPageSize no TextRange!
}
}
+ }
- Size aInvSize = aPaperSize;
- if ( aPaperSize.Width() < aPrevPaperSize.Width() )
- aInvSize.setWidth( aPrevPaperSize.Width() );
- if ( aPaperSize.Height() < aPrevPaperSize.Height() )
- aInvSize.setHeight( aPrevPaperSize.Height() );
+ Size aInvSize = aPaperSize;
+ if ( aPaperSize.Width() < aPrevPaperSize.Width() )
+ aInvSize.setWidth( aPrevPaperSize.Width() );
+ if ( aPaperSize.Height() < aPrevPaperSize.Height() )
+ aInvSize.setHeight( aPrevPaperSize.Height() );
- Size aSz( aInvSize );
- if ( IsVertical() )
- {
- aSz.setWidth( aInvSize.Height() );
- aSz.setHeight( aInvSize.Width() );
- }
- aInvalidRect = tools::Rectangle( Point(), aSz );
+ Size aSz( aInvSize );
+ if ( IsVertical() )
+ {
+ aSz.setWidth( aInvSize.Height() );
+ aSz.setHeight( aInvSize.Width() );
+ }
+ aInvalidRect = tools::Rectangle( Point(), aSz );
- for (EditView* pView : aEditViews)
- {
- pView->pImpEditView->RecalcOutputArea();
- }
+ for (EditView* pView : aEditViews)
+ {
+ pView->pImpEditView->RecalcOutputArea();
}
}
@@ -2846,35 +2846,35 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo
}
}
- if ( mpIMEInfos && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetNode() == pNode ) &&
- ( nPos > mpIMEInfos->aPos.GetIndex() ) && ( nPos <= ( mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen ) ) )
+ if ( !(mpIMEInfos && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetNode() == pNode ) &&
+ ( nPos > mpIMEInfos->aPos.GetIndex() ) && ( nPos <= ( mpIMEInfos->aPos.GetIndex() + mpIMEInfos->nLen ) )) )
+ return;
+
+ ExtTextInputAttr nAttr = mpIMEInfos->pAttribs[ nPos - mpIMEInfos->aPos.GetIndex() - 1 ];
+ if ( nAttr & ExtTextInputAttr::Underline )
+ rFont.SetUnderline( LINESTYLE_SINGLE );
+ else if ( nAttr & ExtTextInputAttr::BoldUnderline )
+ rFont.SetUnderline( LINESTYLE_BOLD );
+ else if ( nAttr & ExtTextInputAttr::DottedUnderline )
+ rFont.SetUnderline( LINESTYLE_DOTTED );
+ else if ( nAttr & ExtTextInputAttr::DashDotUnderline )
+ rFont.SetUnderline( LINESTYLE_DOTTED );
+ else if ( nAttr & ExtTextInputAttr::RedText )
+ rFont.SetColor( COL_RED );
+ else if ( nAttr & ExtTextInputAttr::HalfToneText )
+ rFont.SetColor( COL_LIGHTGRAY );
+ if ( nAttr & ExtTextInputAttr::Highlight )
{
- ExtTextInputAttr nAttr = mpIMEInfos->pAttribs[ nPos - mpIMEInfos->aPos.GetIndex() - 1 ];
- if ( nAttr & ExtTextInputAttr::Underline )
- rFont.SetUnderline( LINESTYLE_SINGLE );
- else if ( nAttr & ExtTextInputAttr::BoldUnderline )
- rFont.SetUnderline( LINESTYLE_BOLD );
- else if ( nAttr & ExtTextInputAttr::DottedUnderline )
- rFont.SetUnderline( LINESTYLE_DOTTED );
- else if ( nAttr & ExtTextInputAttr::DashDotUnderline )
- rFont.SetUnderline( LINESTYLE_DOTTED );
- else if ( nAttr & ExtTextInputAttr::RedText )
- rFont.SetColor( COL_RED );
- else if ( nAttr & ExtTextInputAttr::HalfToneText )
- rFont.SetColor( COL_LIGHTGRAY );
- if ( nAttr & ExtTextInputAttr::Highlight )
- {
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- rFont.SetColor( rStyleSettings.GetHighlightTextColor() );
- rFont.SetFillColor( rStyleSettings.GetHighlightColor() );
- rFont.SetTransparent( false );
- }
- else if ( nAttr & ExtTextInputAttr::GrayWaveline )
- {
- rFont.SetUnderline( LINESTYLE_WAVE );
- if( pOut )
- pOut->SetTextLineColor( COL_LIGHTGRAY );
- }
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ rFont.SetColor( rStyleSettings.GetHighlightTextColor() );
+ rFont.SetFillColor( rStyleSettings.GetHighlightColor() );
+ rFont.SetTransparent( false );
+ }
+ else if ( nAttr & ExtTextInputAttr::GrayWaveline )
+ {
+ rFont.SetUnderline( LINESTYLE_WAVE );
+ if( pOut )
+ pOut->SetTextLineColor( COL_LIGHTGRAY );
}
}
@@ -2924,23 +2924,23 @@ void ImpEditEngine::RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics
if ( nDescent > rCurMetrics.nMaxDescent )
rCurMetrics.nMaxDescent= nDescent;
// Special treatment of high/low:
- if ( rFont.GetEscapement() )
+ if ( !rFont.GetEscapement() )
+ return;
+
+ // Now in consideration of Escape/Propr
+ // possibly enlarge Ascent or Descent
+ short nDiff = static_cast<short>(rFont.GetFontSize().Height()*rFont.GetEscapement()/100);
+ if ( rFont.GetEscapement() > 0 )
{
- // Now in consideration of Escape/Propr
- // possibly enlarge Ascent or Descent
- short nDiff = static_cast<short>(rFont.GetFontSize().Height()*rFont.GetEscapement()/100);
- if ( rFont.GetEscapement() > 0 )
- {
- nAscent = static_cast<sal_uInt16>(static_cast<long>(nAscent)*nPropr/100 + nDiff);
- if ( nAscent > rCurMetrics.nMaxAscent )
- rCurMetrics.nMaxAscent = nAscent;
- }
- else // has to be < 0
- {
- nDescent = static_cast<sal_uInt16>(static_cast<long>(nDescent)*nPropr/100 - nDiff);
- if ( nDescent > rCurMetrics.nMaxDescent )
- rCurMetrics.nMaxDescent= nDescent;
- }
+ nAscent = static_cast<sal_uInt16>(static_cast<long>(nAscent)*nPropr/100 + nDiff);
+ if ( nAscent > rCurMetrics.nMaxAscent )
+ rCurMetrics.nMaxAscent = nAscent;
+ }
+ else // has to be < 0
+ {
+ nDescent = static_cast<sal_uInt16>(static_cast<long>(nDescent)*nPropr/100 - nDiff);
+ if ( nDescent > rCurMetrics.nMaxDescent )
+ rCurMetrics.nMaxDescent= nDescent;
}
}
@@ -3956,48 +3956,48 @@ void ImpEditEngine::ShowParagraph( sal_Int32 nParagraph, bool bShow )
{
ParaPortion* pPPortion = GetParaPortions().SafeGetObject( nParagraph );
DBG_ASSERT( pPPortion, "ShowParagraph: Paragraph does not exist! ");
- if ( pPPortion && ( pPPortion->IsVisible() != bShow ) )
- {
- pPPortion->SetVisible( bShow );
+ if ( !(pPPortion && ( pPPortion->IsVisible() != bShow )) )
+ return;
- if ( !bShow )
- {
- // Mark as deleted, so that no selection will end or begin at
- // this paragraph...
- aDeletedNodes.push_back(std::make_unique<DeletedNodeInfo>( pPPortion->GetNode(), nParagraph ));
- UpdateSelections();
- // The region below will not be invalidated if UpdateMode = sal_False!
- // If anyway, then save as sal_False before SetVisible !
- }
+ pPPortion->SetVisible( bShow );
+
+ if ( !bShow )
+ {
+ // Mark as deleted, so that no selection will end or begin at
+ // this paragraph...
+ aDeletedNodes.push_back(std::make_unique<DeletedNodeInfo>( pPPortion->GetNode(), nParagraph ));
+ UpdateSelections();
+ // The region below will not be invalidated if UpdateMode = sal_False!
+ // If anyway, then save as sal_False before SetVisible !
+ }
- if ( bShow && ( pPPortion->IsInvalid() || !pPPortion->nHeight ) )
+ if ( bShow && ( pPPortion->IsInvalid() || !pPPortion->nHeight ) )
+ {
+ if ( !GetTextRanger() )
{
- if ( !GetTextRanger() )
+ if ( pPPortion->IsInvalid() )
{
- if ( pPPortion->IsInvalid() )
- {
- CreateLines( nParagraph, 0 ); // 0: No TextRanger
- }
- else
- {
- CalcHeight( pPPortion );
- }
- nCurTextHeight += pPPortion->GetHeight();
+ CreateLines( nParagraph, 0 ); // 0: No TextRanger
}
else
{
- nCurTextHeight = 0x7fffffff;
+ CalcHeight( pPPortion );
}
+ nCurTextHeight += pPPortion->GetHeight();
}
-
- pPPortion->SetMustRepaint( true );
- if ( GetUpdateMode() && !IsInUndo() && !GetTextRanger() )
+ else
{
- aInvalidRect = tools::Rectangle( Point( 0, GetParaPortions().GetYOffset( pPPortion ) ),
- Point( GetPaperSize().Width(), nCurTextHeight ) );
- UpdateViews( GetActiveView() );
+ nCurTextHeight = 0x7fffffff;
}
}
+
+ pPPortion->SetMustRepaint( true );
+ if ( GetUpdateMode() && !IsInUndo() && !GetTextRanger() )
+ {
+ aInvalidRect = tools::Rectangle( Point( 0, GetParaPortions().GetYOffset( pPPortion ) ),
+ Point( GetPaperSize().Width(), nCurTextHeight ) );
+ UpdateViews( GetActiveView() );
+ }
}
EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_Int32 nNewPos, EditView* pCurView )
@@ -4601,32 +4601,32 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion*
pTP = ( nPortion > pLine->GetStartPortion() ) ? &pParaPortion->GetTextPortions()[ --nPortion ] : nullptr;
}
- if ( bFoundCompressedPortion )
+ if ( !bFoundCompressedPortion )
+ return;
+
+ long nCompressPercent = 0;
+ if ( nCompressed > nRemainingWidth )
{
- long nCompressPercent = 0;
- if ( nCompressed > nRemainingWidth )
- {
- nCompressPercent = nCompressed - nRemainingWidth;
- DBG_ASSERT( nCompressPercent < 200000, "ImplExpandCompressedPortions - Overflow!" );
- nCompressPercent *= 10000;
- nCompressPercent /= nCompressed;
- }
+ nCompressPercent = nCompressed - nRemainingWidth;
+ DBG_ASSERT( nCompressPercent < 200000, "ImplExpandCompressedPortions - Overflow!" );
+ nCompressPercent *= 10000;
+ nCompressPercent /= nCompressed;
+ }
- for (TextPortion* pTP2 : aCompressedPortions)
+ for (TextPortion* pTP2 : aCompressedPortions)
+ {
+ pTP = pTP2;
+ pTP->GetExtraInfos()->bCompressed = false;
+ pTP->GetSize().setWidth( pTP->GetExtraInfos()->nOrgWidth );
+ if ( nCompressPercent )
{
- pTP = pTP2;
- pTP->GetExtraInfos()->bCompressed = false;
- pTP->GetSize().setWidth( pTP->GetExtraInfos()->nOrgWidth );
- if ( nCompressPercent )
- {
- sal_Int32 nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP );
- sal_Int32 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion );
- DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" );
- long* pDXArray = pLine->GetCharPosArray().data() + (nTxtPortionStart - pLine->GetStart());
- if ( pTP->GetExtraInfos()->pOrgDXArray )
- memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray.get(), (pTP->GetLen()-1)*sizeof(sal_Int32) );
- ImplCalcAsianCompression( pParaPortion->GetNode(), pTP, nTxtPortionStart, pDXArray, static_cast<sal_uInt16>(nCompressPercent), true );
- }
+ sal_Int32 nTxtPortion = pParaPortion->GetTextPortions().GetPos( pTP );
+ sal_Int32 nTxtPortionStart = pParaPortion->GetTextPortions().GetStartPos( nTxtPortion );
+ DBG_ASSERT( nTxtPortionStart >= pLine->GetStart(), "Portion doesn't belong to the line!!!" );
+ long* pDXArray = pLine->GetCharPosArray().data() + (nTxtPortionStart - pLine->GetStart());
+ if ( pTP->GetExtraInfos()->pOrgDXArray )
+ memcpy( pDXArray, pTP->GetExtraInfos()->pOrgDXArray.get(), (pTP->GetLen()-1)*sizeof(sal_Int32) );
+ ImplCalcAsianCompression( pParaPortion->GetNode(), pTP, nTxtPortionStart, pDXArray, static_cast<sal_uInt16>(nCompressPercent), true );
}
}
}
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 050eed8667f4..00a999a5abac 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -185,20 +185,20 @@ void ImpEditEngine::Write(SvStream& rOutput, EETextFormat eFormat, const EditSel
if ( !rOutput.IsWritable() )
rOutput.SetError( SVSTREAM_WRITE_ERROR );
- if ( !rOutput.GetError() )
+ if ( rOutput.GetError() )
+ return;
+
+ if ( eFormat == EETextFormat::Text )
+ WriteText( rOutput, rSel );
+ else if ( eFormat == EETextFormat::Rtf )
+ WriteRTF( rOutput, rSel );
+ else if ( eFormat == EETextFormat::Xml )
+ WriteXML( rOutput, rSel );
+ else if ( eFormat == EETextFormat::Html )
+ ;
+ else
{
- if ( eFormat == EETextFormat::Text )
- WriteText( rOutput, rSel );
- else if ( eFormat == EETextFormat::Rtf )
- WriteRTF( rOutput, rSel );
- else if ( eFormat == EETextFormat::Xml )
- WriteXML( rOutput, rSel );
- else if ( eFormat == EETextFormat::Html )
- ;
- else
- {
- OSL_FAIL( "Write: Unknown Format" );
- }
+ OSL_FAIL( "Write: Unknown Format" );
}
}
@@ -1976,20 +1976,19 @@ void ImpEditEngine::AddPortion(
svx::SpellPortions& rToFill,
bool bIsField)
{
- if(rSel.HasRange())
- {
- svx::SpellPortion aPortion;
- aPortion.sText = GetSelected( rSel );
- aPortion.eLanguage = GetLanguage( rSel.Min() );
- aPortion.xAlternatives = xAlt;
- aPortion.bIsField = bIsField;
- rToFill.push_back(aPortion);
+ if(!rSel.HasRange())
+ return;
- //save the spelled portions for later use
- pSpellInfo->aLastSpellPortions.push_back(aPortion);
- pSpellInfo->aLastSpellContentSelections.push_back(rSel);
+ svx::SpellPortion aPortion;
+ aPortion.sText = GetSelected( rSel );
+ aPortion.eLanguage = GetLanguage( rSel.Min() );
+ aPortion.xAlternatives = xAlt;
+ aPortion.bIsField = bIsField;
+ rToFill.push_back(aPortion);
- }
+ //save the spelled portions for later use
+ pSpellInfo->aLastSpellPortions.push_back(aPortion);
+ pSpellInfo->aLastSpellContentSelections.push_back(rSel);
}
// Adds one or more portions of text to the SpellPortions depending on language changes
@@ -1999,65 +1998,65 @@ void ImpEditEngine::AddPortionIterated(
const Reference< XSpellAlternatives >& xAlt,
svx::SpellPortions& rToFill)
{
- if (rSel.HasRange())
+ if (!rSel.HasRange())
+ return;
+
+ if(xAlt.is())
{
- if(xAlt.is())
- {
- AddPortion(rSel, xAlt, rToFill, false);
- }
- else
+ AddPortion(rSel, xAlt, rToFill, false);
+ }
+ else
+ {
+ //iterate and search for language attribute changes
+ //save the start and end positions
+ bool bTest = rSel.Min().GetIndex() <= rSel.Max().GetIndex();
+ EditPaM aStart(bTest ? rSel.Min() : rSel.Max());
+ EditPaM aEnd(bTest ? rSel.Max() : rSel.Min());
+ //iterate over the text to find changes in language
+ //set the mark equal to the point
+ EditPaM aCursor(aStart);
+ rEditView.pImpEditView->SetEditSelection( aCursor );
+ LanguageType eStartLanguage = GetLanguage( aCursor );
+ //search for a field attribute at the beginning - only the end position
+ //of this field is kept to end a portion at that position
+ const EditCharAttrib* pFieldAttr = aCursor.GetNode()->GetCharAttribs().
+ FindFeature( aCursor.GetIndex() );
+ bool bIsField = pFieldAttr &&
+ pFieldAttr->GetStart() == aCursor.GetIndex() &&
+ pFieldAttr->GetStart() != pFieldAttr->GetEnd() &&
+ pFieldAttr->Which() == EE_FEATURE_FIELD;
+ sal_Int32 nEndField = bIsField ? pFieldAttr->GetEnd() : -1;
+ do
{
- //iterate and search for language attribute changes
- //save the start and end positions
- bool bTest = rSel.Min().GetIndex() <= rSel.Max().GetIndex();
- EditPaM aStart(bTest ? rSel.Min() : rSel.Max());
- EditPaM aEnd(bTest ? rSel.Max() : rSel.Min());
- //iterate over the text to find changes in language
- //set the mark equal to the point
- EditPaM aCursor(aStart);
- rEditView.pImpEditView->SetEditSelection( aCursor );
- LanguageType eStartLanguage = GetLanguage( aCursor );
- //search for a field attribute at the beginning - only the end position
- //of this field is kept to end a portion at that position
- const EditCharAttrib* pFieldAttr = aCursor.GetNode()->GetCharAttribs().
+ aCursor = CursorRight( aCursor);
+ //determine whether a field and has been reached
+ bool bIsEndField = nEndField == aCursor.GetIndex();
+ //search for a new field attribute
+ const EditCharAttrib* _pFieldAttr = aCursor.GetNode()->GetCharAttribs().
FindFeature( aCursor.GetIndex() );
- bool bIsField = pFieldAttr &&
- pFieldAttr->GetStart() == aCursor.GetIndex() &&
- pFieldAttr->GetStart() != pFieldAttr->GetEnd() &&
- pFieldAttr->Which() == EE_FEATURE_FIELD;
- sal_Int32 nEndField = bIsField ? pFieldAttr->GetEnd() : -1;
- do
+ bIsField = _pFieldAttr &&
+ _pFieldAttr->GetStart() == aCursor.GetIndex() &&
+ _pFieldAttr->GetStart() != _pFieldAttr->GetEnd() &&
+ _pFieldAttr->Which() == EE_FEATURE_FIELD;
+ //on every new field move the end position
+ if (bIsField)
+ nEndField = _pFieldAttr->GetEnd();
+
+ LanguageType eCurLanguage = GetLanguage( aCursor );
+ if(eCurLanguage != eStartLanguage || bIsField || bIsEndField)
{
- aCursor = CursorRight( aCursor);
- //determine whether a field and has been reached
- bool bIsEndField = nEndField == aCursor.GetIndex();
- //search for a new field attribute
- const EditCharAttrib* _pFieldAttr = aCursor.GetNode()->GetCharAttribs().
- FindFeature( aCursor.GetIndex() );
- bIsField = _pFieldAttr &&
- _pFieldAttr->GetStart() == aCursor.GetIndex() &&
- _pFieldAttr->GetStart() != _pFieldAttr->GetEnd() &&
- _pFieldAttr->Which() == EE_FEATURE_FIELD;
- //on every new field move the end position
- if (bIsField)
- nEndField = _pFieldAttr->GetEnd();
-
- LanguageType eCurLanguage = GetLanguage( aCursor );
- if(eCurLanguage != eStartLanguage || bIsField || bIsEndField)
- {
- eStartLanguage = eCurLanguage;
- //go one step back - the cursor currently selects the first character
- //with a different language
- //create a selection from start to the current Cursor
- EditSelection aSelection(aStart, aCursor);
- AddPortion(aSelection, xAlt, rToFill, bIsEndField);
- aStart = aCursor;
- }
+ eStartLanguage = eCurLanguage;
+ //go one step back - the cursor currently selects the first character
+ //with a different language
+ //create a selection from start to the current Cursor
+ EditSelection aSelection(aStart, aCursor);
+ AddPortion(aSelection, xAlt, rToFill, bIsEndField);
+ aStart = aCursor;
}
- while(aCursor.GetIndex() < aEnd.GetIndex());
- EditSelection aSelection(aStart, aCursor);
- AddPortion(aSelection, xAlt, rToFill, bIsField);
}
+ while(aCursor.GetIndex() < aEnd.GetIndex());
+ EditSelection aSelection(aStart, aCursor);
+ AddPortion(aSelection, xAlt, rToFill, bIsField);
}
}
@@ -2069,41 +2068,87 @@ void ImpEditEngine::ApplyChangedSentence(EditView const & rEditView,
// sentence got removed in the dialog
DBG_ASSERT(pSpellInfo, "pSpellInfo not initialized");
- if (pSpellInfo &&
- !pSpellInfo->aLastSpellPortions.empty()) // no portions -> no text to be changed
+ if (!(pSpellInfo &&
+ !pSpellInfo->aLastSpellPortions.empty())) // no portions -> no text to be changed
+ return;
+
+ // get current paragraph length to calculate later on how the sentence length changed,
+ // in order to place the cursor at the end of the sentence again
+ EditSelection aOldSel( rEditView.pImpEditView->GetEditSelection() );
+ sal_Int32 nOldLen = aOldSel.Max().GetNode()->Len();
+
+ UndoActionStart( EDITUNDO_INSERT );
+ if(pSpellInfo->aLastSpellPortions.size() == rNewPortions.size())
{
- // get current paragraph length to calculate later on how the sentence length changed,
- // in order to place the cursor at the end of the sentence again
- EditSelection aOldSel( rEditView.pImpEditView->GetEditSelection() );
- sal_Int32 nOldLen = aOldSel.Max().GetNode()->Len();
-
- UndoActionStart( EDITUNDO_INSERT );
- if(pSpellInfo->aLastSpellPortions.size() == rNewPortions.size())
- {
- DBG_ASSERT( !rNewPortions.empty(), "rNewPortions should not be empty here" );
- DBG_ASSERT( pSpellInfo->aLastSpellPortions.size() == pSpellInfo->aLastSpellContentSelections.size(),
- "aLastSpellPortions and aLastSpellContentSelections size mismatch" );
-
- //the simple case: the same number of elements on both sides
- //each changed element has to be applied to the corresponding source element
- svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.end();
- svx::SpellPortions::const_iterator aCurrentOldPortion = pSpellInfo->aLastSpellPortions.end();
- SpellContentSelections::const_iterator aCurrentOldPosition = pSpellInfo->aLastSpellContentSelections.end();
- bool bSetToEnd = false;
- do
+ DBG_ASSERT( !rNewPortions.empty(), "rNewPortions should not be empty here" );
+ DBG_ASSERT( pSpellInfo->aLastSpellPortions.size() == pSpellInfo->aLastSpellContentSelections.size(),
+ "aLastSpellPortions and aLastSpellContentSelections size mismatch" );
+
+ //the simple case: the same number of elements on both sides
+ //each changed element has to be applied to the corresponding source element
+ svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.end();
+ svx::SpellPortions::const_iterator aCurrentOldPortion = pSpellInfo->aLastSpellPortions.end();
+ SpellContentSelections::const_iterator aCurrentOldPosition = pSpellInfo->aLastSpellContentSelections.end();
+ bool bSetToEnd = false;
+ do
+ {
+ --aCurrentNewPortion;
+ --aCurrentOldPortion;
+ --aCurrentOldPosition;
+ //set the cursor to the end of the sentence - necessary to
+ //resume there at the next step
+ if(!bSetToEnd)
{
- --aCurrentNewPortion;
- --aCurrentOldPortion;
- --aCurrentOldPosition;
- //set the cursor to the end of the sentence - necessary to
- //resume there at the next step
- if(!bSetToEnd)
- {
- bSetToEnd = true;
- rEditView.pImpEditView->SetEditSelection( aCurrentOldPosition->Max() );
- }
+ bSetToEnd = true;
+ rEditView.pImpEditView->SetEditSelection( aCurrentOldPosition->Max() );
+ }
- SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
+ SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
+ sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE;
+ switch(nScriptType)
+ {
+ case SvtScriptType::ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
+ case SvtScriptType::COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+ default: break;
+ }
+ if(aCurrentNewPortion->sText != aCurrentOldPortion->sText)
+ {
+ //change text and apply language
+ SfxItemSet aSet( aEditDoc.GetItemPool(), {{nLangWhichId, nLangWhichId}});
+ aSet.Put(SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId));
+ SetAttribs( *aCurrentOldPosition, aSet );
+ ImpInsertText( *aCurrentOldPosition, aCurrentNewPortion->sText );
+ }
+ else if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
+ {
+ //apply language
+ SfxItemSet aSet( aEditDoc.GetItemPool(), {{nLangWhichId, nLangWhichId}});
+ aSet.Put(SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId));
+ SetAttribs( *aCurrentOldPosition, aSet );
+ }
+ }
+ while(aCurrentNewPortion != rNewPortions.begin());
+ }
+ else
+ {
+ DBG_ASSERT( !pSpellInfo->aLastSpellContentSelections.empty(), "aLastSpellContentSelections should not be empty here" );
+
+ //select the complete sentence
+ SpellContentSelections::const_iterator aCurrentEndPosition = pSpellInfo->aLastSpellContentSelections.end();
+ --aCurrentEndPosition;
+ SpellContentSelections::const_iterator aCurrentStartPosition = pSpellInfo->aLastSpellContentSelections.begin();
+ EditSelection aAllSentence(aCurrentStartPosition->Min(), aCurrentEndPosition->Max());
+
+ //delete the sentence completely
+ ImpDeleteSelection( aAllSentence );
+ EditPaM aCurrentPaM = aAllSentence.Min();
+ for(const auto& rCurrentNewPortion : rNewPortions)
+ {
+ //set the language attribute
+ LanguageType eCurLanguage = GetLanguage( aCurrentPaM );
+ if(eCurLanguage != rCurrentNewPortion.eLanguage)
+ {
+ SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( rCurrentNewPortion.eLanguage );
sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE;
switch(nScriptType)
{
@@ -2111,78 +2156,32 @@ void ImpEditEngine::ApplyChangedSentence(EditView const & rEditView,
case SvtScriptType::COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
default: break;
}
- if(aCurrentNewPortion->sText != aCurrentOldPortion->sText)
- {
- //change text and apply language
- SfxItemSet aSet( aEditDoc.GetItemPool(), {{nLangWhichId, nLangWhichId}});
- aSet.Put(SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId));
- SetAttribs( *aCurrentOldPosition, aSet );
- ImpInsertText( *aCurrentOldPosition, aCurrentNewPortion->sText );
- }
- else if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
- {
- //apply language
- SfxItemSet aSet( aEditDoc.GetItemPool(), {{nLangWhichId, nLangWhichId}});
- aSet.Put(SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId));
- SetAttribs( *aCurrentOldPosition, aSet );
- }
- }
- while(aCurrentNewPortion != rNewPortions.begin());
- }
- else
- {
- DBG_ASSERT( !pSpellInfo->aLastSpellContentSelections.empty(), "aLastSpellContentSelections should not be empty here" );
-
- //select the complete sentence
- SpellContentSelections::const_iterator aCurrentEndPosition = pSpellInfo->aLastSpellContentSelections.end();
- --aCurrentEndPosition;
- SpellContentSelections::const_iterator aCurrentStartPosition = pSpellInfo->aLastSpellContentSelections.begin();
- EditSelection aAllSentence(aCurrentStartPosition->Min(), aCurrentEndPosition->Max());
-
- //delete the sentence completely
- ImpDeleteSelection( aAllSentence );
- EditPaM aCurrentPaM = aAllSentence.Min();
- for(const auto& rCurrentNewPortion : rNewPortions)
- {
- //set the language attribute
- LanguageType eCurLanguage = GetLanguage( aCurrentPaM );
- if(eCurLanguage != rCurrentNewPortion.eLanguage)
- {
- SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( rCurrentNewPortion.eLanguage );
- sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE;
- switch(nScriptType)
- {
- case SvtScriptType::ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
- case SvtScriptType::COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
- default: break;
- }
- SfxItemSet aSet( aEditDoc.GetItemPool(), {{nLangWhichId, nLangWhichId}});
- aSet.Put(SvxLanguageItem(rCurrentNewPortion.eLanguage, nLangWhichId));
- SetAttribs( aCurrentPaM, aSet );
- }
- //insert the new string and set the cursor to the end of the inserted string
- aCurrentPaM = ImpInsertText( aCurrentPaM , rCurrentNewPortion.sText );
+ SfxItemSet aSet( aEditDoc.GetItemPool(), {{nLangWhichId, nLangWhichId}});
+ aSet.Put(SvxLanguageItem(rCurrentNewPortion.eLanguage, nLangWhichId));
+ SetAttribs( aCurrentPaM, aSet );
}
+ //insert the new string and set the cursor to the end of the inserted string
+ aCurrentPaM = ImpInsertText( aCurrentPaM , rCurrentNewPortion.sText );
}
- UndoActionEnd();
-
- EditPaM aNext;
- if (bRecheck)
- aNext = pSpellInfo->aCurSentenceStart;
- else
- {
- // restore cursor position to the end of the modified sentence.
- // (This will define the continuation position for spell/grammar checking)
- // First: check if the sentence/para length changed
- const sal_Int32 nDelta = rEditView.pImpEditView->GetEditSelection().Max().GetNode()->Len() - nOldLen;
- const sal_Int32 nEndOfSentence = aOldSel.Max().GetIndex() + nDelta;
- aNext = EditPaM( aOldSel.Max().GetNode(), nEndOfSentence );
- }
- rEditView.pImpEditView->SetEditSelection( aNext );
+ }
+ UndoActionEnd();
- FormatAndUpdate();
- aEditDoc.SetModified(true);
+ EditPaM aNext;
+ if (bRecheck)
+ aNext = pSpellInfo->aCurSentenceStart;
+ else
+ {
+ // restore cursor position to the end of the modified sentence.
+ // (This will define the continuation position for spell/grammar checking)
+ // First: check if the sentence/para length changed
+ const sal_Int32 nDelta = rEditView.pImpEditView->GetEditSelection().Max().GetNode()->Len() - nOldLen;
+ const sal_Int32 nEndOfSentence = aOldSel.Max().GetIndex() + nDelta;
+ aNext = EditPaM( aOldSel.Max().GetNode(), nEndOfSentence );
}
+ rEditView.pImpEditView->SetEditSelection( aNext );
+
+ FormatAndUpdate();
+ aEditDoc.SetModified(true);
}
void ImpEditEngine::PutSpellingToSentenceStart( EditView const & rEditView )
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index 0e6b6af722fa..0e5a294e0149 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -680,36 +680,36 @@ void ImpEditEngine::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
if ( !pNode )
return;
- if ( !( pNode->GetContentAttribs().GetItems() == rSet ) )
+ if ( pNode->GetContentAttribs().GetItems() == rSet )
+ return;
+
+ if ( IsUndoEnabled() && !IsInUndo() && aStatus.DoUndoAttribs() )
{
- if ( IsUndoEnabled() && !IsInUndo() && aStatus.DoUndoAttribs() )
+ if ( rSet.GetPool() != &aEditDoc.GetItemPool() )
{
- if ( rSet.GetPool() != &aEditDoc.GetItemPool() )
- {
- SfxItemSet aTmpSet( GetEmptyItemSet() );
- aTmpSet.Put( rSet );
- InsertUndo(std::make_unique<EditUndoSetParaAttribs>(pEditEngine, nPara, pNode->GetContentAttribs().GetItems(), aTmpSet));
- }
- else
- {
- InsertUndo(std::make_unique<EditUndoSetParaAttribs>(pEditEngine, nPara, pNode->GetContentAttribs().GetItems(), rSet));
- }
+ SfxItemSet aTmpSet( GetEmptyItemSet() );
+ aTmpSet.Put( rSet );
+ InsertUndo(std::make_unique<EditUndoSetParaAttribs>(pEditEngine, nPara, pNode->GetContentAttribs().GetItems(), aTmpSet));
+ }
+ else
+ {
+ InsertUndo(std::make_unique<EditUndoSetParaAttribs>(pEditEngine, nPara, pNode->GetContentAttribs().GetItems(), rSet));
}
+ }
- bool bCheckLanguage = ( rSet.GetItemState( EE_CHAR_LANGUAGE ) == SfxItemState::SET ) ||
- ( rSet.GetItemState( EE_CHAR_LANGUAGE_CJK ) == SfxItemState::SET ) ||
- ( rSet.GetItemState( EE_CHAR_LANGUAGE_CTL ) == SfxItemState::SET );
+ bool bCheckLanguage = ( rSet.GetItemState( EE_CHAR_LANGUAGE ) == SfxItemState::SET ) ||
+ ( rSet.GetItemState( EE_CHAR_LANGUAGE_CJK ) == SfxItemState::SET ) ||
+ ( rSet.GetItemState( EE_CHAR_LANGUAGE_CTL ) == SfxItemState::SET );
- pNode->GetContentAttribs().GetItems().Set( rSet );
+ pNode->GetContentAttribs().GetItems().Set( rSet );
- if ( bCheckLanguage && pNode->GetWrongList() )
- pNode->GetWrongList()->ResetInvalidRange(0, pNode->Len());
+ if ( bCheckLanguage && pNode->GetWrongList() )
+ pNode->GetWrongList()->ResetInvalidRange(0, pNode->Len());
- if ( aStatus.UseCharAttribs() )
- pNode->CreateDefFont();
+ if ( aStatus.UseCharAttribs() )
+ pNode->CreateDefFont();
- ParaAttribsChanged( pNode );
- }
+ ParaAttribsChanged( pNode );
}
const SfxItemSet& ImpEditEngine::GetParaAttribs( sal_Int32 nPara ) const
@@ -737,19 +737,19 @@ void ImpEditEngine::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>&
{
rLst.clear();
const ContentNode* pNode = aEditDoc.GetObject( nPara );
- if ( pNode )
+ if ( !pNode )
+ return;
+
+ rLst.reserve(pNode->GetCharAttribs().Count());
+ const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs();
+ for (const auto & i : rAttrs)
{
- rLst.reserve(pNode->GetCharAttribs().Count());
- const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs();
- for (const auto & i : rAttrs)
- {
- const EditCharAttrib& rAttr = *i;
- EECharAttrib aEEAttr;
- aEEAttr.pAttr = rAttr.GetItem();
- aEEAttr.nStart = rAttr.GetStart();
- aEEAttr.nEnd = rAttr.GetEnd();
- rLst.push_back(aEEAttr);
- }
+ const EditCharAttrib& rAttr = *i;
+ EECharAttrib aEEAttr;
+ aEEAttr.pAttr = rAttr.GetItem();
+ aEEAttr.nStart = rAttr.GetStart();
+ aEEAttr.nEnd = rAttr.GetEnd();
+ rLst.push_back(aEEAttr);
}
}
diff --git a/editeng/source/items/legacyitem.cxx b/editeng/source/items/legacyitem.cxx
index f3a0ba2f6d0f..af41980b2d2c 100644
--- a/editeng/source/items/legacyitem.cxx
+++ b/editeng/source/items/legacyitem.cxx
@@ -544,49 +544,49 @@ namespace legacy
rItem.SetColor(aTempColor);
}
- if ( nItemVersion >= BRUSH_GRAPHIC_VERSION )
- {
- sal_uInt16 nDoLoad = 0;
- sal_Int8 nPos;
+ if ( nItemVersion < BRUSH_GRAPHIC_VERSION )
+ return;
- rStrm.ReadUInt16( nDoLoad );
+ sal_uInt16 nDoLoad = 0;
+ sal_Int8 nPos;
- if ( nDoLoad & LOAD_GRAPHIC )
- {
- Graphic aGraphic;
+ rStrm.ReadUInt16( nDoLoad );
- ReadGraphic( rStrm, aGraphic );
- rItem.SetGraphicObject(GraphicObject(aGraphic));
+ if ( nDoLoad & LOAD_GRAPHIC )
+ {
+ Graphic aGraphic;
- if( SVSTREAM_FILEFORMAT_ERROR == rStrm.GetError() )
- {
- rStrm.ResetError();
- rStrm.SetError( ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT.MakeWarning() );
- }
- }
+ ReadGraphic( rStrm, aGraphic );
+ rItem.SetGraphicObject(GraphicObject(aGraphic));
- if ( nDoLoad & LOAD_LINK )
+ if( SVSTREAM_FILEFORMAT_ERROR == rStrm.GetError() )
{
- // UNICODE: rStrm >> aRel;
- OUString aRel = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
-
- // TODO/MBA: how can we get a BaseURL here?!
- OSL_FAIL("No BaseURL!");
- OUString aAbs = INetURLObject::GetAbsURL( "", aRel );
- DBG_ASSERT( !aAbs.isEmpty(), "Invalid URL!" );
- rItem.SetGraphicLink(aAbs);
+ rStrm.ResetError();
+ rStrm.SetError( ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT.MakeWarning() );
}
+ }
- if ( nDoLoad & LOAD_FILTER )
- {
- // UNICODE: rStrm >> maStrFilter;
- rItem.SetGraphicFilter(rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet()));
- }
+ if ( nDoLoad & LOAD_LINK )
+ {
+ // UNICODE: rStrm >> aRel;
+ OUString aRel = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
- rStrm.ReadSChar( nPos );
+ // TODO/MBA: how can we get a BaseURL here?!
+ OSL_FAIL("No BaseURL!");
+ OUString aAbs = INetURLObject::GetAbsURL( "", aRel );
+ DBG_ASSERT( !aAbs.isEmpty(), "Invalid URL!" );
+ rItem.SetGraphicLink(aAbs);
+ }
- rItem.SetGraphicPos(static_cast<SvxGraphicPosition>(nPos));
+ if ( nDoLoad & LOAD_FILTER )
+ {
+ // UNICODE: rStrm >> maStrFilter;
+ rItem.SetGraphicFilter(rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet()));
}
+
+ rStrm.ReadSChar( nPos );
+
+ rItem.SetGraphicPos(static_cast<SvxGraphicPosition>(nPos));
}
SvStream& Store(const SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16)
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 00af4303064a..ca26e800f9f0 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -68,18 +68,18 @@ sal_Int32 SvxNumberType::nRefCount = 0;
css::uno::Reference<css::text::XNumberingFormatter> SvxNumberType::xFormatter;
static void lcl_getFormatter(css::uno::Reference<css::text::XNumberingFormatter>& _xFormatter)
{
- if(!_xFormatter.is())
- {
- try
- {
- Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
- Reference<XDefaultNumberingProvider> xRet = text::DefaultNumberingProvider::create(xContext);
- _xFormatter.set(xRet, UNO_QUERY);
- }
- catch(const Exception&)
- {
- SAL_WARN("editeng", "service missing: \"com.sun.star.text.DefaultNumberingProvider\"");
- }
+ if(_xFormatter.is())
+ return;
+
+ try
+ {
+ Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+ Reference<XDefaultNumberingProvider> xRet = text::DefaultNumberingProvider::create(xContext);
+ _xFormatter.set(xRet, UNO_QUERY);
+ }
+ catch(const Exception&)
+ {
+ SAL_WARN("editeng", "service missing: \"com.sun.star.text.DefaultNumberingProvider\"");
}
}
@@ -797,20 +797,20 @@ void SvxNumRule::SetLevel( sal_uInt16 i, const SvxNumberFormat& rNumFmt, bool bI
{
DBG_ASSERT(i < SVX_MAX_NUM, "Wrong Level" );
- if( i < SVX_MAX_NUM )
+ if( i >= SVX_MAX_NUM )
+ return;
+
+ bool bReplace = !aFmtsSet[i];
+ if (!bReplace)
{
- bool bReplace = !aFmtsSet[i];
- if (!bReplace)
- {
- const SvxNumberFormat *pFmt = Get(i);
- bReplace = pFmt == nullptr || rNumFmt != *pFmt;
- }
+ const SvxNumberFormat *pFmt = Get(i);
+ bReplace = pFmt == nullptr || rNumFmt != *pFmt;
+ }
- if (bReplace)
- {
- aFmts[i].reset( new SvxNumberFormat(rNumFmt) );
- aFmtsSet[i] = bIsValid;
- }
+ if (bReplace)
+ {
+ aFmts[i].reset( new SvxNumberFormat(rNumFmt) );
+ aFmtsSet[i] = bIsValid;
}
}
diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index f6ff6cf92681..234331b7a490 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -704,21 +704,21 @@ public:
void SvxDoDrawCapital::DoSpace( const bool bDraw )
{
- if ( bDraw || pFont->IsWordLineMode() )
+ if ( !(bDraw || pFont->IsWordLineMode()) )
+ return;
+
+ sal_uLong nDiff = static_cast<sal_uLong>(aPos.X() - aSpacePos.X());
+ if ( nDiff )
{
- sal_uLong nDiff = static_cast<sal_uLong>(aPos.X() - aSpacePos.X());
- if ( nDiff )
- {
- bool bWordWise = pFont->IsWordLineMode();
- bool bTrans = pFont->IsTransparent();
- pFont->SetWordLineMode( false );
- pFont->SetTransparent( true );
- pFont->SetPhysFont( pOut );
- pOut->DrawStretchText( aSpacePos, nDiff, " ", 0, 2 );
- pFont->SetWordLineMode( bWordWise );
- pFont->SetTransparent( bTrans );
- pFont->SetPhysFont( pOut );
- }
+ bool bWordWise = pFont->IsWordLineMode();
+ bool bTrans = pFont->IsTransparent();
+ pFont->SetWordLineMode( false );
+ pFont->SetTransparent( true );
+ pFont->SetPhysFont( pOut );
+ pOut->DrawStretchText( aSpacePos, nDiff, " ", 0, 2 );
+ pFont->SetWordLineMode( bWordWise );
+ pFont->SetTransparent( bTrans );
+ pFont->SetPhysFont( pOut );
}
}
diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index 1d9d38da3066..20648438d16a 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -127,100 +127,99 @@ void SvxBaseAutoCorrCfg::Load(bool bInit)
EnableNotification(aNames);
const Any* pValues = aValues.getConstArray();
DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
+ if(aValues.getLength() != aNames.getLength())
+ return;
+
+ ACFlags nFlags = ACFlags::NONE; // default all off
+ sal_Int32 nTemp = 0;
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
- ACFlags nFlags = ACFlags::NONE; // default all off
- sal_Int32 nTemp = 0;
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ if(pValues[nProp].hasValue())
{
- if(pValues[nProp].hasValue())
+ switch(nProp)
{
- switch(nProp)
- {
- case 0:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::SaveWordCplSttLst;
- break;//"Exceptions/TwoCapitalsAtStart",
- case 1:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::SaveWordWrdSttLst;
- break;//"Exceptions/CapitalAtStartSentence",
- case 2:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::Autocorrect;
- break;//"UseReplacementTable",
- case 3:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::CapitalStartWord;
- break;//"TwoCapitalsAtStart",
- case 4:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::CapitalStartSentence;
- break;//"CapitalAtStartSentence",
- case 5:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::ChgWeightUnderl;
- break;//"ChangeUnderlineWeight",
- case 6:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::SetINetAttr;
- break;//"SetInetAttribute",
- case 7:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::ChgOrdinalNumber;
- break;//"ChangeOrdinalNumber",
- case 8:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::AddNonBrkSpace;
- break;//"AddNonBreakingSpace"
- case 9:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::ChgToEnEmDash;
- break;//"ChangeDash",
- case 10:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::IgnoreDoubleSpace;
- break;//"RemoveDoubleSpaces",
- case 11:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::ChgSglQuotes;
- break;//"ReplaceSingleQuote",
- case 12:
- pValues[nProp] >>= nTemp;
- rParent.pAutoCorrect->SetStartSingleQuote(
- sal::static_int_cast< sal_Unicode >( nTemp ) );
- break;//"SingleQuoteAtStart",
- case 13:
- pValues[nProp] >>= nTemp;
- rParent.pAutoCorrect->SetEndSingleQuote(
- sal::static_int_cast< sal_Unicode >( nTemp ) );
- break;//"SingleQuoteAtEnd",
- case 14:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::ChgQuotes;
- break;//"ReplaceDoubleQuote",
- case 15:
- pValues[nProp] >>= nTemp;
- rParent.pAutoCorrect->SetStartDoubleQuote(
- sal::static_int_cast< sal_Unicode >( nTemp ) );
- break;//"DoubleQuoteAtStart",
- case 16:
- pValues[nProp] >>= nTemp;
- rParent.pAutoCorrect->SetEndDoubleQuote(
- sal::static_int_cast< sal_Unicode >( nTemp ) );
- break;//"DoubleQuoteAtEnd"
- case 17:
- if(*o3tl::doAccess<bool>(pValues[nProp]))
- nFlags |= ACFlags::CorrectCapsLock;
- break;//"CorrectAccidentalCapsLock"
- }
+ case 0:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::SaveWordCplSttLst;
+ break;//"Exceptions/TwoCapitalsAtStart",
+ case 1:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::SaveWordWrdSttLst;
+ break;//"Exceptions/CapitalAtStartSentence",
+ case 2:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::Autocorrect;
+ break;//"UseReplacementTable",
+ case 3:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::CapitalStartWord;
+ break;//"TwoCapitalsAtStart",
+ case 4:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::CapitalStartSentence;
+ break;//"CapitalAtStartSentence",
+ case 5:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::ChgWeightUnderl;
+ break;//"ChangeUnderlineWeight",
+ case 6:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::SetINetAttr;
+ break;//"SetInetAttribute",
+ case 7:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::ChgOrdinalNumber;
+ break;//"ChangeOrdinalNumber",
+ case 8:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::AddNonBrkSpace;
+ break;//"AddNonBreakingSpace"
+ case 9:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::ChgToEnEmDash;
+ break;//"ChangeDash",
+ case 10:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::IgnoreDoubleSpace;
+ break;//"RemoveDoubleSpaces",
+ case 11:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::ChgSglQuotes;
+ break;//"ReplaceSingleQuote",
+ case 12:
+ pValues[nProp] >>= nTemp;
+ rParent.pAutoCorrect->SetStartSingleQuote(
+ sal::static_int_cast< sal_Unicode >( nTemp ) );
+ break;//"SingleQuoteAtStart",
+ case 13:
+ pValues[nProp] >>= nTemp;
+ rParent.pAutoCorrect->SetEndSingleQuote(
+ sal::static_int_cast< sal_Unicode >( nTemp ) );
+ break;//"SingleQuoteAtEnd",
+ case 14:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::ChgQuotes;
+ break;//"ReplaceDoubleQuote",
+ case 15:
+ pValues[nProp] >>= nTemp;
+ rParent.pAutoCorrect->SetStartDoubleQuote(
+ sal::static_int_cast< sal_Unicode >( nTemp ) );
+ break;//"DoubleQuoteAtStart",
+ case 16:
+ pValues[nProp] >>= nTemp;
+ rParent.pAutoCorrect->SetEndDoubleQuote(
+ sal::static_int_cast< sal_Unicode >( nTemp ) );
+ break;//"DoubleQuoteAtEnd"
+ case 17:
+ if(*o3tl::doAccess<bool>(pValues[nProp]))
+ nFlags |= ACFlags::CorrectCapsLock;
+ break;//"CorrectAccidentalCapsLock"
}
}
- if( nFlags != ACFlags::NONE )
- rParent.pAutoCorrect->SetAutoCorrFlag( nFlags );
- rParent.pAutoCorrect->SetAutoCorrFlag( ( static_cast<ACFlags>(0x3fff) & ~nFlags ), false );
-
}
+ if( nFlags != ACFlags::NONE )
+ rParent.pAutoCorrect->SetAutoCorrFlag( nFlags );
+ rParent.pAutoCorrect->SetAutoCorrFlag( ( static_cast<ACFlags>(0x3fff) & ~nFlags ), false );
}
SvxBaseAutoCorrCfg::SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rPar) :
@@ -343,140 +342,140 @@ void SvxSwAutoCorrCfg::Load(bool bInit)
EnableNotification(aNames);
const Any* pValues = aValues.getConstArray();
DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
+ if(aValues.getLength() != aNames.getLength())
+ return;
+
+ SvxSwAutoFormatFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags();
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
- SvxSwAutoFormatFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags();
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ if(pValues[nProp].hasValue())
{
- if(pValues[nProp].hasValue())
+ switch(nProp)
{
- switch(nProp)
- {
- case 0: rParent.bFileRel = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/FileLinks",
- case 1: rParent.bNetRel = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/InternetLinks",
- case 2: rParent.bAutoTextPreview = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/ShowPreview",
- case 3: rParent.bAutoTextTip = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/ShowToolTip",
- case 4: rParent.bSearchInAllCategories = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Text/SearchInAllCategories"
- case 5: rSwFlags.bAutoCorrect = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/UseReplacementTable",
- case 6: rSwFlags.bCapitalStartSentence = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/TwoCapitalsAtStart",
- case 7: rSwFlags.bCapitalStartWord = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/CapitalAtStartSentence",
- case 8: rSwFlags.bChgWeightUnderl = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeUnderlineWeight",
- case 9: rSwFlags.bSetINetAttr = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/SetInetAttribute",
- case 10: rSwFlags.bChgOrdinalNumber = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeOrdinalNumber",
- case 11: rSwFlags.bAddNonBrkSpace = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/AddNonBreakingSpace",
+ case 0: rParent.bFileRel = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/FileLinks",
+ case 1: rParent.bNetRel = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/InternetLinks",
+ case 2: rParent.bAutoTextPreview = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/ShowPreview",
+ case 3: rParent.bAutoTextTip = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/ShowToolTip",
+ case 4: rParent.bSearchInAllCategories = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Text/SearchInAllCategories"
+ case 5: rSwFlags.bAutoCorrect = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/UseReplacementTable",
+ case 6: rSwFlags.bCapitalStartSentence = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/TwoCapitalsAtStart",
+ case 7: rSwFlags.bCapitalStartWord = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/CapitalAtStartSentence",
+ case 8: rSwFlags.bChgWeightUnderl = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeUnderlineWeight",
+ case 9: rSwFlags.bSetINetAttr = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/SetInetAttribute",
+ case 10: rSwFlags.bChgOrdinalNumber = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeOrdinalNumber",
+ case 11: rSwFlags.bAddNonBrkSpace = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/AddNonBreakingSpace",
// it doesn't exist here - the common flags are used for that -> LM
// case 12: rSwFlags.bChgToEnEmDash = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeDash",
- case 13: rSwFlags.bDelEmptyNode = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelEmptyParagraphs",
- case 14: rSwFlags.bChgUserColl = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ReplaceUserStyle",
- case 15: rSwFlags.bChgEnumNum = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeToBullets/Enable",
- case 16:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.cBullet =
- sal::static_int_cast< sal_Unicode >(nVal);
- }
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
- case 17:
- {
- OUString sTemp; pValues[nProp] >>= sTemp;
- rSwFlags.aBulletFont.SetFamilyName(sTemp);
- }
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
- case 18:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aBulletFont.SetFamily(FontFamily(nVal));
- }
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
- case 19:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aBulletFont.SetCharSet(rtl_TextEncoding(nVal));
- }
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
- case 20:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aBulletFont.SetPitch(FontPitch(nVal));
- }
- break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
- case 21: rSwFlags.bRightMargin = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/CombineParagraphs",
- case 22:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.nRightMargin =
- sal::static_int_cast< sal_uInt8 >(nVal);
- }
- break; // "Format/Option/CombineValue",
- case 23: rSwFlags.bAFormatDelSpacesAtSttEnd = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelSpacesAtStartEnd",
- case 24: rSwFlags.bAFormatDelSpacesBetweenLines = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelSpacesBetween",
- case 25: rParent.bAutoFmtByInput = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/Enable",
- case 26: rSwFlags.bChgToEnEmDash = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeDash",
- case 27: rSwFlags.bSetNumRule = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ApplyNumbering/Enable",
- case 28: rSwFlags.bSetBorder = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeToBorders",
- case 29: rSwFlags.bCreateTable = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeToTable",
- case 30: rSwFlags.bReplaceStyles = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ReplaceStyle",
- case 31: rSwFlags.bAFormatByInpDelSpacesAtSttEnd = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/DelSpacesAtStartEnd",
- case 32: rSwFlags.bAFormatByInpDelSpacesBetweenLines = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/DelSpacesBetween",
- case 33: rSwFlags.bAutoCompleteWords = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/Enable",
- case 34:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.nAutoCmpltWordLen =
- sal::static_int_cast< sal_uInt16 >(nVal);
- }
- break; // "Completion/MinWordLen",
- case 35:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.nAutoCmpltListLen =
- sal::static_int_cast< sal_uInt16 >(nVal);
- }
- break; // "Completion/MaxListLen",
- case 36: rSwFlags.bAutoCmpltCollectWords = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/CollectWords",
- case 37: rSwFlags.bAutoCmpltEndless = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/EndlessList",
- case 38: rSwFlags.bAutoCmpltAppendBlanc = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/AppendBlank",
- case 39: rSwFlags.bAutoCmpltShowAsTip = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/ShowAsTip",
- case 40:
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.nAutoCmpltExpandKey =
- sal::static_int_cast< sal_uInt16 >(nVal);
- }
- break; // "Completion/AcceptKey"
- case 41 :rSwFlags.bAutoCmpltKeepList = *o3tl::doAccess<bool>(pValues[nProp]); break;//"Completion/KeepList"
- case 42 :
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.cByInputBullet =
- sal::static_int_cast< sal_Unicode >(nVal);
- }
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
- case 43 :
- {
- OUString sTemp; pValues[nProp] >>= sTemp;
- rSwFlags.aByInputBulletFont.SetFamilyName(sTemp);
- }
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
- case 44 :
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aByInputBulletFont.SetFamily(FontFamily(nVal));
- }
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
- case 45 :
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aByInputBulletFont.SetCharSet(rtl_TextEncoding(nVal));
- }
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
- case 46 :
- {
- sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
- rSwFlags.aByInputBulletFont.SetPitch(FontPitch(nVal));
- }
- break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
+ case 13: rSwFlags.bDelEmptyNode = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelEmptyParagraphs",
+ case 14: rSwFlags.bChgUserColl = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ReplaceUserStyle",
+ case 15: rSwFlags.bChgEnumNum = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeToBullets/Enable",
+ case 16:
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.cBullet =
+ sal::static_int_cast< sal_Unicode >(nVal);
+ }
+ break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char",
+ case 17:
+ {
+ OUString sTemp; pValues[nProp] >>= sTemp;
+ rSwFlags.aBulletFont.SetFamilyName(sTemp);
+ }
+ break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font",
+ case 18:
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.aBulletFont.SetFamily(FontFamily(nVal));
+ }
+ break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily",
+ case 19:
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.aBulletFont.SetCharSet(rtl_TextEncoding(nVal));
+ }
+ break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset",
+ case 20:
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.aBulletFont.SetPitch(FontPitch(nVal));
+ }
+ break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch",
+ case 21: rSwFlags.bRightMargin = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/CombineParagraphs",
+ case 22:
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.nRightMargin =
+ sal::static_int_cast< sal_uInt8 >(nVal);
+ }
+ break; // "Format/Option/CombineValue",
+ case 23: rSwFlags.bAFormatDelSpacesAtSttEnd = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelSpacesAtStartEnd",
+ case 24: rSwFlags.bAFormatDelSpacesBetweenLines = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelSpacesBetween",
+ case 25: rParent.bAutoFmtByInput = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/Enable",
+ case 26: rSwFlags.bChgToEnEmDash = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeDash",
+ case 27: rSwFlags.bSetNumRule = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ApplyNumbering/Enable",
+ case 28: rSwFlags.bSetBorder = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeToBorders",
+ case 29: rSwFlags.bCreateTable = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeToTable",
+ case 30: rSwFlags.bReplaceStyles = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ReplaceStyle",
+ case 31: rSwFlags.bAFormatByInpDelSpacesAtSttEnd = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/DelSpacesAtStartEnd",
+ case 32: rSwFlags.bAFormatByInpDelSpacesBetweenLines = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/DelSpacesBetween",
+ case 33: rSwFlags.bAutoCompleteWords = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/Enable",
+ case 34:
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.nAutoCmpltWordLen =
+ sal::static_int_cast< sal_uInt16 >(nVal);
+ }
+ break; // "Completion/MinWordLen",
+ case 35:
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.nAutoCmpltListLen =
+ sal::static_int_cast< sal_uInt16 >(nVal);
+ }
+ break; // "Completion/MaxListLen",
+ case 36: rSwFlags.bAutoCmpltCollectWords = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/CollectWords",
+ case 37: rSwFlags.bAutoCmpltEndless = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/EndlessList",
+ case 38: rSwFlags.bAutoCmpltAppendBlanc = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/AppendBlank",
+ case 39: rSwFlags.bAutoCmpltShowAsTip = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/ShowAsTip",
+ case 40:
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.nAutoCmpltExpandKey =
+ sal::static_int_cast< sal_uInt16 >(nVal);
+ }
+ break; // "Completion/AcceptKey"
+ case 41 :rSwFlags.bAutoCmpltKeepList = *o3tl::doAccess<bool>(pValues[nProp]); break;//"Completion/KeepList"
+ case 42 :
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.cByInputBullet =
+ sal::static_int_cast< sal_Unicode >(nVal);
+ }
+ break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char",
+ case 43 :
+ {
+ OUString sTemp; pValues[nProp] >>= sTemp;
+ rSwFlags.aByInputBulletFont.SetFamilyName(sTemp);
+ }
+ break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font",
+ case 44 :
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.aByInputBulletFont.SetFamily(FontFamily(nVal));
+ }
+ break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily",
+ case 45 :
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.aByInputBulletFont.SetCharSet(rtl_TextEncoding(nVal));
+ }
+ break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset",
+ case 46 :
+ {
+ sal_Int32 nVal = 0; pValues[nProp] >>= nVal;
+ rSwFlags.aByInputBulletFont.SetPitch(FontPitch(nVal));
}
+ break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch",
}
}
}
diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx
index c56ce846a57b..840868edbd00 100644
--- a/editeng/source/misc/hangulhanja.cxx
+++ b/editeng/source/misc/hangulhanja.cxx
@@ -277,27 +277,27 @@ namespace editeng
void HangulHanjaConversion_Impl::createDialog()
{
DBG_ASSERT( m_bIsInteractive, "createDialog when the conversion should not be interactive?" );
- if ( m_bIsInteractive && !m_pConversionDialog )
- {
- EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
- m_pConversionDialog = pFact->CreateHangulHanjaConversionDialog(m_pUIParent);
-
- m_pConversionDialog->EnableRubySupport( m_pAntiImpl->HasRubySupport() );
-
- m_pConversionDialog->SetByCharacter( m_bByCharacter );
- m_pConversionDialog->SetConversionFormat( m_eConversionFormat );
- m_pConversionDialog->SetConversionDirectionState( m_bTryBothDirections, m_ePrimaryConversionDirection );
-
- // the handlers
- m_pConversionDialog->SetOptionsChangedHdl( LINK( this, HangulHanjaConversion_Impl, OnOptionsChanged ) );
- m_pConversionDialog->SetIgnoreHdl( LINK( this, HangulHanjaConversion_Impl, OnIgnore ) );
- m_pConversionDialog->SetIgnoreAllHdl( LINK( this, HangulHanjaConversion_Impl, OnIgnoreAll ) );
- m_pConversionDialog->SetChangeHdl( LINK( this, HangulHanjaConversion_Impl, OnChange ) );
- m_pConversionDialog->SetChangeAllHdl( LINK( this, HangulHanjaConversion_Impl, OnChangeAll ) );
- m_pConversionDialog->SetClickByCharacterHdl( LINK( this, HangulHanjaConversion_Impl, OnByCharClicked ) );
- m_pConversionDialog->SetConversionFormatChangedHdl( LINK( this, HangulHanjaConversion_Impl, OnConversionTypeChanged ) );
- m_pConversionDialog->SetFindHdl( LINK( this, HangulHanjaConversion_Impl, OnFind ) );
- }
+ if ( !(m_bIsInteractive && !m_pConversionDialog) )
+ return;
+
+ EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
+ m_pConversionDialog = pFact->CreateHangulHanjaConversionDialog(m_pUIParent);
+
+ m_pConversionDialog->EnableRubySupport( m_pAntiImpl->HasRubySupport() );
+
+ m_pConversionDialog->SetByCharacter( m_bByCharacter );
+ m_pConversionDialog->SetConversionFormat( m_eConversionFormat );
+ m_pConversionDialog->SetConversionDirectionState( m_bTryBothDirections, m_ePrimaryConversionDirection );
+
+ // the handlers
+ m_pConversionDialog->SetOptionsChangedHdl( LINK( this, HangulHanjaConversion_Impl, OnOptionsChanged ) );
+ m_pConversionDialog->SetIgnoreHdl( LINK( this, HangulHanjaConversion_Impl, OnIgnore ) );
+ m_pConversionDialog->SetIgnoreAllHdl( LINK( this, HangulHanjaConversion_Impl, OnIgnoreAll ) );
+ m_pConversionDialog->SetChangeHdl( LINK( this, HangulHanjaConversion_Impl, OnChange ) );
+ m_pConversionDialog->SetChangeAllHdl( LINK( this, HangulHanjaConversion_Impl, OnChangeAll ) );
+ m_pConversionDialog->SetClickByCharacterHdl( LINK( this, HangulHanjaConversion_Impl, OnByCharClicked ) );
+ m_pConversionDialog->SetConversionFormatChangedHdl( LINK( this, HangulHanjaConversion_Impl, OnConversionTypeChanged ) );
+ m_pConversionDialog->SetFindHdl( LINK( this, HangulHanjaConversion_Impl, OnFind ) );
}
sal_Int16 HangulHanjaConversion_Impl::implGetConversionType( bool bSwitchDirection ) const
@@ -844,23 +844,23 @@ namespace editeng
IMPL_LINK_NOARG(HangulHanjaConversion_Impl, OnChangeAll, weld::Button&, void)
{
DBG_ASSERT( m_pConversionDialog, "HangulHanjaConversion_Impl::OnChangeAll: no dialog! How this?" );
- if ( m_pConversionDialog )
- {
- OUString sCurrentUnit( m_pConversionDialog->GetCurrentString() );
- OUString sChangeInto( m_pConversionDialog->GetCurrentSuggestion( ) );
+ if ( !m_pConversionDialog )
+ return;
- if( !sChangeInto.isEmpty() )
- {
- // change the current occurrence
- implChange( sChangeInto );
+ OUString sCurrentUnit( m_pConversionDialog->GetCurrentString() );
+ OUString sChangeInto( m_pConversionDialog->GetCurrentSuggestion( ) );
- // put into the "change all" list
- m_aChangeList.emplace( sCurrentUnit, sChangeInto );
- }
+ if( !sChangeInto.isEmpty() )
+ {
+ // change the current occurrence
+ implChange( sChangeInto );
- // and proceed
- implProceed( false );
+ // put into the "change all" list
+ m_aChangeList.emplace( sCurrentUnit, sChangeInto );
}
+
+ // and proceed
+ implProceed( false );
}
IMPL_LINK(HangulHanjaConversion_Impl, OnByCharClicked, weld::ToggleButton&, rBox, void)
@@ -881,58 +881,58 @@ namespace editeng
IMPL_LINK_NOARG(HangulHanjaConversion_Impl, OnFind, weld::Button&, void)
{
DBG_ASSERT( m_pConversionDialog, "HangulHanjaConversion_Impl::OnFind: where did this come from?" );
- if ( m_pConversionDialog )
+ if ( !m_pConversionDialog )
+ return;
+
+ try
{
- try
- {
- OUString sNewOriginal( m_pConversionDialog->GetCurrentSuggestion( ) );
- Sequence< OUString > aSuggestions;
+ OUString sNewOriginal( m_pConversionDialog->GetCurrentSuggestion( ) );
+ Sequence< OUString > aSuggestions;
- DBG_ASSERT( m_xConverter.is(), "HangulHanjaConversion_Impl::OnFind: no converter!" );
- TextConversionResult aToHanja = m_xConverter->getConversions(
- sNewOriginal,
- 0, sNewOriginal.getLength(),
- m_aSourceLocale,
- TextConversionType::TO_HANJA,
- TextConversionOption::NONE
- );
- TextConversionResult aToHangul = m_xConverter->getConversions(
- sNewOriginal,
- 0, sNewOriginal.getLength(),
- m_aSourceLocale,
- TextConversionType::TO_HANGUL,
- TextConversionOption::NONE
- );
+ DBG_ASSERT( m_xConverter.is(), "HangulHanjaConversion_Impl::OnFind: no converter!" );
+ TextConversionResult aToHanja = m_xConverter->getConversions(
+ sNewOriginal,
+ 0, sNewOriginal.getLength(),
+ m_aSourceLocale,
+ TextConversionType::TO_HANJA,
+ TextConversionOption::NONE
+ );
+ TextConversionResult aToHangul = m_xConverter->getConversions(
+ sNewOriginal,
+ 0, sNewOriginal.getLength(),
+ m_aSourceLocale,
+ TextConversionType::TO_HANGUL,
+ TextConversionOption::NONE
+ );
- bool bHaveToHanja = ( aToHanja.Boundary.startPos < aToHanja.Boundary.endPos );
- bool bHaveToHangul = ( aToHangul.Boundary.startPos < aToHangul.Boundary.endPos );
+ bool bHaveToHanja = ( aToHanja.Boundary.startPos < aToHanja.Boundary.endPos );
+ bool bHaveToHangul = ( aToHangul.Boundary.startPos < aToHangul.Boundary.endPos );
- TextConversionResult* pResult = nullptr;
- if ( bHaveToHanja && bHaveToHangul )
- { // it found convertibles in both directions -> use the first
- if ( aToHangul.Boundary.startPos < aToHanja.Boundary.startPos )
- pResult = &aToHangul;
- else
- pResult = &aToHanja;
- }
- else if ( bHaveToHanja )
- { // only found toHanja
- pResult = &aToHanja;
- }
- else
- { // only found toHangul
+ TextConversionResult* pResult = nullptr;
+ if ( bHaveToHanja && bHaveToHangul )
+ { // it found convertibles in both directions -> use the first
+ if ( aToHangul.Boundary.startPos < aToHanja.Boundary.startPos )
pResult = &aToHangul;
- }
- if ( pResult )
- aSuggestions = pResult->Candidates;
-
- m_pConversionDialog->SetCurrentString( sNewOriginal, aSuggestions, false );
- m_pConversionDialog->FocusSuggestion();
+ else
+ pResult = &aToHanja;
}
- catch( const Exception& )
- {
- TOOLS_WARN_EXCEPTION( "editeng", "HangulHanjaConversion_Impl::OnFind" );
+ else if ( bHaveToHanja )
+ { // only found toHanja
+ pResult = &aToHanja;
+ }
+ else
+ { // only found toHangul
+ pResult = &aToHangul;
}
+ if ( pResult )
+ aSuggestions = pResult->Candidates;
+
+ m_pConversionDialog->SetCurrentString( sNewOriginal, aSuggestions, false );
+ m_pConversionDialog->FocusSuggestion();
+ }
+ catch( const Exception& )
+ {
+ TOOLS_WARN_EXCEPTION( "editeng", "HangulHanjaConversion_Impl::OnFind" );
}
}
diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx
index 3fabd235f3b9..fe6704b9513f 100644
--- a/editeng/source/misc/splwrap.cxx
+++ b/editeng/source/misc/splwrap.cxx
@@ -260,20 +260,20 @@ void SvxSpellWrapper::SpellDocument( )
SpellStart( bReverse ? SvxSpellArea::BodyStart : SvxSpellArea::BodyEnd );
}
- if ( FindSpellError() )
- {
- Reference< XHyphenatedWord > xHyphWord( GetLast(), UNO_QUERY );
+ if ( !FindSpellError() )
+ return;
- if (xHyphWord.is())
- {
- EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractHyphenWordDialog> pDlg(pFact->CreateHyphenWordDialog(
- pWin,
- xHyphWord->getWord(),
- LanguageTag( xHyphWord->getLocale() ).getLanguageType(),
- xHyph, this ));
- pDlg->Execute();
- }
+ Reference< XHyphenatedWord > xHyphWord( GetLast(), UNO_QUERY );
+
+ if (xHyphWord.is())
+ {
+ EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create();
+ ScopedVclPtr<AbstractHyphenWordDialog> pDlg(pFact->CreateHyphenWordDialog(
+ pWin,
+ xHyphWord->getWord(),
+ LanguageTag( xHyphWord->getLocale() ).getLanguageType(),
+ xHyph, this ));
+ pDlg->Execute();
}
}
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 724902d31120..4ea7eb901a97 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2106,49 +2106,49 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp(
tools::SvRef<SotStorage> const &rStg,
bool bConvert )
{
- if( rStg.is() )
+ if( !rStg.is() )
+ return;
+
+ OUString sStrmName( pStrmName, strlen(pStrmName), RTL_TEXTENCODING_MS_1252 );
+ if( rLst.empty() )
{
- OUString sStrmName( pStrmName, strlen(pStrmName), RTL_TEXTENCODING_MS_1252 );
- if( rLst.empty() )
- {
- rStg->Remove( sStrmName );
- rStg->Commit();
- }
- else
+ rStg->Remove( sStrmName );
+ rStg->Commit();
+ }
+ else
+ {
+ tools::SvRef<SotStorageStream> xStrm = rStg->OpenSotStream( sStrmName,
+ ( StreamMode::READ | StreamMode::WRITE | StreamMode::SHARE_DENYWRITE ) );
+ if( xStrm.is() )
{
- tools::SvRef<SotStorageStream> xStrm = rStg->OpenSotStream( sStrmName,
- ( StreamMode::READ | StreamMode::WRITE | StreamMode::SHARE_DENYWRITE ) );
- if( xStrm.is() )
- {
- xStrm->SetSize( 0 );
- xStrm->SetBufferSize( 8192 );
- xStrm->SetProperty( "MediaType", Any(OUString( "text/xml" )) );
+ xStrm->SetSize( 0 );
+ xStrm->SetBufferSize( 8192 );
+ xStrm->SetProperty( "MediaType", Any(OUString( "text/xml" )) );
- uno::Reference< uno::XComponentContext > xContext =
- comphelper::getProcessComponentContext();
+ uno::Reference< uno::XComponentContext > xContext =
+ comphelper::getProcessComponentContext();
- uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
- uno::Reference < io::XOutputStream> xOut = new utl::OOutputStreamWrapper( *xStrm );
- xWriter->setOutputStream(xOut);
+ uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext);
+ uno::Reference < io::XOutputStream> xOut = new utl::OOutputStreamWrapper( *xStrm );
+ xWriter->setOutputStream(xOut);
- uno::Reference < xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
- rtl::Reference< SvXMLExceptionListExport > xExp( new SvXMLExceptionListExport( xContext, rLst, sStrmName, xHandler ) );
+ uno::Reference < xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
+ rtl::Reference< SvXMLExceptionListExport > xExp( new SvXMLExceptionListExport( xContext, rLst, sStrmName, xHandler ) );
- xExp->exportDoc( XML_BLOCK_LIST );
+ xExp->exportDoc( XML_BLOCK_LIST );
- xStrm->Commit();
- if( xStrm->GetError() == ERRCODE_NONE )
+ xStrm->Commit();
+ if( xStrm->GetError() == ERRCODE_NONE )
+ {
+ xStrm.clear();
+ if (!bConvert)
{
- xStrm.clear();
- if (!bConvert)
+ rStg->Commit();
+ if( ERRCODE_NONE != rStg->GetError() )
{
+ rStg->Remove( sStrmName );
rStg->Commit();
- if( ERRCODE_NONE != rStg->GetError() )
- {
- rStg->Remove( sStrmName );
- rStg->Commit();
- }
}
}
}
diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx
index 42d674c42780..925c218424c0 100644
--- a/editeng/source/misc/txtrange.cxx
+++ b/editeng/source/misc/txtrange.cxx
@@ -212,21 +212,21 @@ void SvxBoundArgs::CheckCut( const Point& rLst, const Point& rNxt )
NotePoint( Cut( nBottom, rLst, rNxt ) );
if( nCut & 2 )
NotePoint( Cut( nTop, rLst, rNxt ) );
- if( rLst.X() != rNxt.X() && rLst.Y() != rNxt.Y() )
+ if( rLst.X() == rNxt.X() || rLst.Y() == rNxt.Y() )
+ return;
+
+ long nYps;
+ if( nLowDiff && ( ( nCut & 1 ) || nLast == 1 || nNext == 1 ) )
{
- long nYps;
- if( nLowDiff && ( ( nCut & 1 ) || nLast == 1 || nNext == 1 ) )
- {
- nYps = CalcMax( rLst, rNxt, nBottom, nLower );
- if( nYps )
- NoteFarPoint_( Cut( nYps, rLst, rNxt ), nLower-nYps, nLowDiff );
- }
- if( nUpDiff && ( ( nCut & 2 ) || nLast == 2 || nNext == 2 ) )
- {
- nYps = CalcMax( rLst, rNxt, nTop, nUpper );
- if( nYps )
- NoteFarPoint_( Cut( nYps, rLst, rNxt ), nYps-nUpper, nUpDiff );
- }
+ nYps = CalcMax( rLst, rNxt, nBottom, nLower );
+ if( nYps )
+ NoteFarPoint_( Cut( nYps, rLst, rNxt ), nLower-nYps, nLowDiff );
+ }
+ if( nUpDiff && ( ( nCut & 2 ) || nLast == 2 || nNext == 2 ) )
+ {
+ nYps = CalcMax( rLst, rNxt, nTop, nUpper );
+ if( nYps )
+ NoteFarPoint_( Cut( nYps, rLst, rNxt ), nYps-nUpper, nUpDiff );
}
}
@@ -467,22 +467,21 @@ void SvxBoundArgs::Add()
"BoundArgs: Array-Count: Confusion" );
}
}
- if( !pLongArr->empty() )
- {
- if( bInner )
- {
- pLongArr->pop_front();
- pLongArr->pop_back();
+ if( pLongArr->empty() )
+ return;
- // Here the line is held inside a large rectangle for "simple"
- // contour wrap. Currently (April 1999) the EditEngine evaluates
- // only the first rectangle. If it one day is able to output a line
- // in several parts, it may be advisable to delete the following lines.
- if( pTextRanger->IsSimple() && pLongArr->size() > 2 )
- pLongArr->erase( pLongArr->begin() + 1, pLongArr->end() - 1 );
+ if( !bInner )
+ return;
- }
- }
+ pLongArr->pop_front();
+ pLongArr->pop_back();
+
+ // Here the line is held inside a large rectangle for "simple"
+ // contour wrap. Currently (April 1999) the EditEngine evaluates
+ // only the first rectangle. If it one day is able to output a line
+ // in several parts, it may be advisable to delete the following lines.
+ if( pTextRanger->IsSimple() && pLongArr->size() > 2 )
+ pLongArr->erase( pLongArr->begin() + 1, pLongArr->end() - 1 );
}
void SvxBoundArgs::Concat( const tools::PolyPolygon* pPoly )
diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx
index 8352e431ba5f..af32538f9702 100644
--- a/editeng/source/misc/unolingu.cxx
+++ b/editeng/source/misc/unolingu.cxx
@@ -97,18 +97,18 @@ public:
void ThesDummy_Impl::GetCfgLocales()
{
- if (!pLocaleSeq)
+ if (pLocaleSeq)
+ return;
+
+ SvtLinguConfig aCfg;
+ Sequence < OUString > aNodeNames( aCfg.GetNodeNames( "ServiceManager/ThesaurusList" ) );
+ const OUString *pNodeNames = aNodeNames.getConstArray();
+ sal_Int32 nLen = aNodeNames.getLength();
+ pLocaleSeq.reset( new Sequence< lang::Locale >( nLen ) );
+ lang::Locale *pLocale = pLocaleSeq->getArray();
+ for (sal_Int32 i = 0; i < nLen; ++i)
{
- SvtLinguConfig aCfg;
- Sequence < OUString > aNodeNames( aCfg.GetNodeNames( "ServiceManager/ThesaurusList" ) );
- const OUString *pNodeNames = aNodeNames.getConstArray();
- sal_Int32 nLen = aNodeNames.getLength();
- pLocaleSeq.reset( new Sequence< lang::Locale >( nLen ) );
- lang::Locale *pLocale = pLocaleSeq->getArray();
- for (sal_Int32 i = 0; i < nLen; ++i)
- {
- pLocale[i] = LanguageTag::convertToLocaleWithFallback( pNodeNames[i] );
- }
+ pLocale[i] = LanguageTag::convertToLocaleWithFallback( pNodeNames[i] );
}
}
diff --git a/editeng/source/outliner/outleeng.cxx b/editeng/source/outliner/outleeng.cxx
index b873bd2ab963..7358a7c6ad9d 100644
--- a/editeng/source/outliner/outleeng.cxx
+++ b/editeng/source/outliner/outleeng.cxx
@@ -171,22 +171,22 @@ OUString OutlinerEditEng::CalcFieldValue( const SvxFieldItem& rField, sal_Int32
void OutlinerEditEng::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
{
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
- if( pPara )
- {
- if ( !IsInUndo() && IsUndoEnabled() )
- pOwner->UndoActionStart( OLUNDO_ATTR );
+ if( !pPara )
+ return;
- EditEngine::SetParaAttribs( nPara, rSet );
+ if ( !IsInUndo() && IsUndoEnabled() )
+ pOwner->UndoActionStart( OLUNDO_ATTR );
- pOwner->ImplCheckNumBulletItem( nPara );
- // #i100014#
- // It is not a good idea to subtract 1 from a count and cast the result
- // to sal_uInt16 without check, if the count is 0.
- pOwner->ImplCheckParagraphs( nPara, pOwner->pParaList->GetParagraphCount() );
+ EditEngine::SetParaAttribs( nPara, rSet );
- if ( !IsInUndo() && IsUndoEnabled() )
- pOwner->UndoActionEnd();
- }
+ pOwner->ImplCheckNumBulletItem( nPara );
+ // #i100014#
+ // It is not a good idea to subtract 1 from a count and cast the result
+ // to sal_uInt16 without check, if the count is 0.
+ pOwner->ImplCheckParagraphs( nPara, pOwner->pParaList->GetParagraphCount() );
+
+ if ( !IsInUndo() && IsUndoEnabled() )
+ pOwner->UndoActionEnd();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index f7f8cc316ad1..8cf7132c5a6b 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -167,20 +167,20 @@ void Outliner::ParagraphDeleted( sal_Int32 nPara )
pParaList->Remove( nPara );
- if( !pEditEngine->IsInUndo() && !bPasting )
- {
- pPara = pParaList->GetParagraph( nPara );
- if ( pPara && ( pPara->GetDepth() > nDepth ) )
- {
- ImplCalcBulletText( nPara, true, false );
- // Search for next on the this level ...
- while ( pPara && pPara->GetDepth() > nDepth )
- pPara = pParaList->GetParagraph( ++nPara );
- }
+ if( pEditEngine->IsInUndo() || bPasting )
+ return;
- if ( pPara && ( pPara->GetDepth() == nDepth ) )
- ImplCalcBulletText( nPara, true, false );
+ pPara = pParaList->GetParagraph( nPara );
+ if ( pPara && ( pPara->GetDepth() > nDepth ) )
+ {
+ ImplCalcBulletText( nPara, true, false );
+ // Search for next on the this level ...
+ while ( pPara && pPara->GetDepth() > nDepth )
+ pPara = pParaList->GetParagraph( ++nPara );
}
+
+ if ( pPara && ( pPara->GetDepth() == nDepth ) )
+ ImplCalcBulletText( nPara, true, false );
}
void Outliner::Init( OutlinerMode nMode )
@@ -239,20 +239,20 @@ void Outliner::SetDepth( Paragraph* pPara, sal_Int16 nNewDepth )
ImplCheckDepth( nNewDepth );
- if ( nNewDepth != pPara->GetDepth() )
- {
- nDepthChangedHdlPrevDepth = pPara->GetDepth();
- ParaFlag nPrevFlags = pPara->nFlags;
+ if ( nNewDepth == pPara->GetDepth() )
+ return;
- sal_Int32 nPara = GetAbsPos( pPara );
- ImplInitDepth( nPara, nNewDepth, true );
- ImplCalcBulletText( nPara, false, false );
+ nDepthChangedHdlPrevDepth = pPara->GetDepth();
+ ParaFlag nPrevFlags = pPara->nFlags;
- if ( ImplGetOutlinerMode() == OutlinerMode::OutlineObject )
- ImplSetLevelDependentStyleSheet( nPara );
+ sal_Int32 nPara = GetAbsPos( pPara );
+ ImplInitDepth( nPara, nNewDepth, true );
+ ImplCalcBulletText( nPara, false, false );
- DepthChangedHdl(pPara, nPrevFlags);
- }
+ if ( ImplGetOutlinerMode() == OutlinerMode::OutlineObject )
+ ImplSetLevelDependentStyleSheet( nPara );
+
+ DepthChangedHdl(pPara, nPrevFlags);
}
sal_Int16 Outliner::GetNumberingStartValue( sal_Int32 nPara )
@@ -690,27 +690,27 @@ void Outliner::ImplSetLevelDependentStyleSheet( sal_Int32 nPara )
SfxStyleSheet* pStyle = GetStyleSheet( nPara );
- if ( pStyle )
- {
- sal_Int16 nDepth = GetDepth( nPara );
- if( nDepth < 0 )
- nDepth = 0;
+ if ( !pStyle )
+ return;
- OUString aNewStyleSheetName( pStyle->GetName() );
- aNewStyleSheetName = aNewStyleSheetName.copy( 0, aNewStyleSheetName.getLength()-1 ) +
- OUString::number( nDepth+1 );
- SfxStyleSheet* pNewStyle = static_cast<SfxStyleSheet*>(GetStyleSheetPool()->Find( aNewStyleSheetName, pStyle->GetFamily() ));
- DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );
- if ( pNewStyle && ( pNewStyle != GetStyleSheet( nPara ) ) )
+ sal_Int16 nDepth = GetDepth( nPara );
+ if( nDepth < 0 )
+ nDepth = 0;
+
+ OUString aNewStyleSheetName( pStyle->GetName() );
+ aNewStyleSheetName = aNewStyleSheetName.copy( 0, aNewStyleSheetName.getLength()-1 ) +
+ OUString::number( nDepth+1 );
+ SfxStyleSheet* pNewStyle = static_cast<SfxStyleSheet*>(GetStyleSheetPool()->Find( aNewStyleSheetName, pStyle->GetFamily() ));
+ DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );
+ if ( pNewStyle && ( pNewStyle != GetStyleSheet( nPara ) ) )
+ {
+ SfxItemSet aOldAttrs( GetParaAttribs( nPara ) );
+ SetStyleSheet( nPara, pNewStyle );
+ if ( aOldAttrs.GetItemState( EE_PARA_NUMBULLET ) == SfxItemState::SET )
{
- SfxItemSet aOldAttrs( GetParaAttribs( nPara ) );
- SetStyleSheet( nPara, pNewStyle );
- if ( aOldAttrs.GetItemState( EE_PARA_NUMBULLET ) == SfxItemState::SET )
- {
- SfxItemSet aAttrs( GetParaAttribs( nPara ) );
- aAttrs.Put( aOldAttrs.Get( EE_PARA_NUMBULLET ) );
- SetParaAttribs( nPara, aAttrs );
- }
+ SfxItemSet aAttrs( GetParaAttribs( nPara ) );
+ aAttrs.Put( aOldAttrs.Get( EE_PARA_NUMBULLET ) );
+ SetParaAttribs( nPara, aAttrs );
}
}
}
@@ -728,26 +728,26 @@ void Outliner::ImplInitDepth( sal_Int32 nPara, sal_Int16 nDepth, bool bCreateUnd
// For IsInUndo attributes and style do not have to be set, there
// the old values are restored by the EditEngine.
- if( !IsInUndo() )
- {
- bool bUpdate = pEditEngine->GetUpdateMode();
- pEditEngine->SetUpdateMode( false );
+ if( IsInUndo() )
+ return;
- bool bUndo = bCreateUndo && IsUndoEnabled();
+ bool bUpdate = pEditEngine->GetUpdateMode();
+ pEditEngine->SetUpdateMode( false );
- SfxItemSet aAttrs( pEditEngine->GetParaAttribs( nPara ) );
- aAttrs.Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nDepth ) );
- pEditEngine->SetParaAttribs( nPara, aAttrs );
- ImplCheckNumBulletItem( nPara );
- ImplCalcBulletText( nPara, false, false );
+ bool bUndo = bCreateUndo && IsUndoEnabled();
- if ( bUndo )
- {
- InsertUndo( std::make_unique<OutlinerUndoChangeDepth>( this, nPara, nOldDepth, nDepth ) );
- }
+ SfxItemSet aAttrs( pEditEngine->GetParaAttribs( nPara ) );
+ aAttrs.Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nDepth ) );
+ pEditEngine->SetParaAttribs( nPara, aAttrs );
+ ImplCheckNumBulletItem( nPara );
+ ImplCalcBulletText( nPara, false, false );
- pEditEngine->SetUpdateMode( bUpdate );
+ if ( bUndo )
+ {
+ InsertUndo( std::make_unique<OutlinerUndoChangeDepth>( this, nPara, nOldDepth, nDepth ) );
}
+
+ pEditEngine->SetUpdateMode( bUpdate );
}
void Outliner::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
@@ -890,194 +890,194 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
bDrawBullet = rBulletState.GetValue();
}
- if (bDrawBullet && ImplHasNumberFormat(nPara))
- {
- bool bVertical = IsVertical();
- bool bTopToBottom = IsTopToBottom();
+ if (!(bDrawBullet && ImplHasNumberFormat(nPara)))
+ return;
- bool bRightToLeftPara = pEditEngine->IsRightToLeft( nPara );
+ bool bVertical = IsVertical();
+ bool bTopToBottom = IsTopToBottom();
- tools::Rectangle aBulletArea( ImpCalcBulletArea( nPara, true, false ) );
- sal_uInt16 nStretchX, nStretchY;
- GetGlobalCharStretching(nStretchX, nStretchY);
- aBulletArea = tools::Rectangle( Point(aBulletArea.Left()*nStretchX/100,
- aBulletArea.Top()),
- Size(aBulletArea.GetWidth()*nStretchX/100,
- aBulletArea.GetHeight()) );
+ bool bRightToLeftPara = pEditEngine->IsRightToLeft( nPara );
- Paragraph* pPara = pParaList->GetParagraph( nPara );
- const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
- if ( pFmt && ( pFmt->GetNumberingType() != SVX_NUM_NUMBER_NONE ) )
+ tools::Rectangle aBulletArea( ImpCalcBulletArea( nPara, true, false ) );
+ sal_uInt16 nStretchX, nStretchY;
+ GetGlobalCharStretching(nStretchX, nStretchY);
+ aBulletArea = tools::Rectangle( Point(aBulletArea.Left()*nStretchX/100,
+ aBulletArea.Top()),
+ Size(aBulletArea.GetWidth()*nStretchX/100,
+ aBulletArea.GetHeight()) );
+
+ Paragraph* pPara = pParaList->GetParagraph( nPara );
+ const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
+ if ( pFmt && ( pFmt->GetNumberingType() != SVX_NUM_NUMBER_NONE ) )
+ {
+ if( pFmt->GetNumberingType() != SVX_NUM_BITMAP )
{
- if( pFmt->GetNumberingType() != SVX_NUM_BITMAP )
+ vcl::Font aBulletFont( ImpCalcBulletFont( nPara ) );
+ // Use baseline
+ bool bSymbol = pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
+ aBulletFont.SetAlignment( bSymbol ? ALIGN_BOTTOM : ALIGN_BASELINE );
+ vcl::Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( aBulletFont );
+
+ ParagraphInfos aParaInfos = pEditEngine->GetParagraphInfos( nPara );
+ Point aTextPos;
+ if ( !bVertical )
{
- vcl::Font aBulletFont( ImpCalcBulletFont( nPara ) );
- // Use baseline
- bool bSymbol = pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
- aBulletFont.SetAlignment( bSymbol ? ALIGN_BOTTOM : ALIGN_BASELINE );
- vcl::Font aOldFont = pOutDev->GetFont();
- pOutDev->SetFont( aBulletFont );
-
- ParagraphInfos aParaInfos = pEditEngine->GetParagraphInfos( nPara );
- Point aTextPos;
- if ( !bVertical )
- {
// aTextPos.Y() = rStartPos.Y() + aBulletArea.Bottom();
- aTextPos.setY( rStartPos.Y() + ( bSymbol ? aBulletArea.Bottom() : aParaInfos.nFirstLineMaxAscent ) );
- if ( !bRightToLeftPara )
- aTextPos.setX( rStartPos.X() + aBulletArea.Left() );
- else
- aTextPos.setX( rStartPos.X() + GetPaperSize().Width() - aBulletArea.Right() );
- }
+ aTextPos.setY( rStartPos.Y() + ( bSymbol ? aBulletArea.Bottom() : aParaInfos.nFirstLineMaxAscent ) );
+ if ( !bRightToLeftPara )
+ aTextPos.setX( rStartPos.X() + aBulletArea.Left() );
else
+ aTextPos.setX( rStartPos.X() + GetPaperSize().Width() - aBulletArea.Right() );
+ }
+ else
+ {
+ if (bTopToBottom)
{
- if (bTopToBottom)
- {
// aTextPos.X() = rStartPos.X() - aBulletArea.Bottom();
- aTextPos.setX( rStartPos.X() - (bSymbol ? aBulletArea.Bottom() : aParaInfos.nFirstLineMaxAscent) );
- aTextPos.setY( rStartPos.Y() + aBulletArea.Left() );
- }
- else
- {
- aTextPos.setX( rStartPos.X() + (bSymbol ? aBulletArea.Bottom() : aParaInfos.nFirstLineMaxAscent) );
- aTextPos.setY( rStartPos.Y() + aBulletArea.Left() );
- }
+ aTextPos.setX( rStartPos.X() - (bSymbol ? aBulletArea.Bottom() : aParaInfos.nFirstLineMaxAscent) );
+ aTextPos.setY( rStartPos.Y() + aBulletArea.Left() );
}
-
- if ( nOrientation )
+ else
{
- // Both TopLeft and bottom left is not quite correct,
- // since in EditEngine baseline ...
- double nRealOrientation = nOrientation*F_PI1800;
- double nCos = cos( nRealOrientation );
- double nSin = sin( nRealOrientation );
- Point aRotatedPos;
- // Translation...
- aTextPos -= rOrigin;
- // Rotation...
- aRotatedPos.setX(static_cast<long>(nCos*aTextPos.X() + nSin*aTextPos.Y()) );
- aRotatedPos.setY(static_cast<long>(- (nSin*aTextPos.X() - nCos*aTextPos.Y())) );
- aTextPos = aRotatedPos;
- // Translation...
- aTextPos += rOrigin;
- vcl::Font aRotatedFont( aBulletFont );
- aRotatedFont.SetOrientation( nOrientation );
- pOutDev->SetFont( aRotatedFont );
+ aTextPos.setX( rStartPos.X() + (bSymbol ? aBulletArea.Bottom() : aParaInfos.nFirstLineMaxAscent) );
+ aTextPos.setY( rStartPos.Y() + aBulletArea.Left() );
}
+ }
- // VCL will take care of brackets and so on...
- ComplexTextLayoutFlags nLayoutMode = pOutDev->GetLayoutMode();
- nLayoutMode &= ~ComplexTextLayoutFlags(ComplexTextLayoutFlags::BiDiRtl|ComplexTextLayoutFlags::BiDiStrong);
- if ( bRightToLeftPara )
- nLayoutMode |= ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft | ComplexTextLayoutFlags::BiDiStrong;
- pOutDev->SetLayoutMode( nLayoutMode );
+ if ( nOrientation )
+ {
+ // Both TopLeft and bottom left is not quite correct,
+ // since in EditEngine baseline ...
+ double nRealOrientation = nOrientation*F_PI1800;
+ double nCos = cos( nRealOrientation );
+ double nSin = sin( nRealOrientation );
+ Point aRotatedPos;
+ // Translation...
+ aTextPos -= rOrigin;
+ // Rotation...
+ aRotatedPos.setX(static_cast<long>(nCos*aTextPos.X() + nSin*aTextPos.Y()) );
+ aRotatedPos.setY(static_cast<long>(- (nSin*aTextPos.X() - nCos*aTextPos.Y())) );
+ aTextPos = aRotatedPos;
+ // Translation...
+ aTextPos += rOrigin;
+ vcl::Font aRotatedFont( aBulletFont );
+ aRotatedFont.SetOrientation( nOrientation );
+ pOutDev->SetFont( aRotatedFont );
+ }
- if(bStrippingPortions)
- {
- const vcl::Font& aSvxFont(pOutDev->GetFont());
- std::unique_ptr<long[]> pBuf(new long[ pPara->GetText().getLength() ]);
- pOutDev->GetTextArray( pPara->GetText(), pBuf.get() );
+ // VCL will take care of brackets and so on...
+ ComplexTextLayoutFlags nLayoutMode = pOutDev->GetLayoutMode();
+ nLayoutMode &= ~ComplexTextLayoutFlags(ComplexTextLayoutFlags::BiDiRtl|ComplexTextLayoutFlags::BiDiStrong);
+ if ( bRightToLeftPara )
+ nLayoutMode |= ComplexTextLayoutFlags::BiDiRtl | ComplexTextLayoutFlags::TextOriginLeft | ComplexTextLayoutFlags::BiDiStrong;
+ pOutDev->SetLayoutMode( nLayoutMode );
- if(bSymbol)
- {
- // aTextPos is Bottom, go to Baseline
- FontMetric aMetric(pOutDev->GetFontMetric());
- aTextPos.AdjustY( -(aMetric.GetDescent()) );
- }
+ if(bStrippingPortions)
+ {
+ const vcl::Font& aSvxFont(pOutDev->GetFont());
+ std::unique_ptr<long[]> pBuf(new long[ pPara->GetText().getLength() ]);
+ pOutDev->GetTextArray( pPara->GetText(), pBuf.get() );
- DrawingText(aTextPos, pPara->GetText(), 0, pPara->GetText().getLength(), pBuf.get(),
- aSvxFont, nPara, bRightToLeftPara ? 1 : 0, nullptr, nullptr, false, false, true, nullptr, Color(), Color());
- }
- else
+ if(bSymbol)
{
- pOutDev->DrawText( aTextPos, pPara->GetText() );
+ // aTextPos is Bottom, go to Baseline
+ FontMetric aMetric(pOutDev->GetFontMetric());
+ aTextPos.AdjustY( -(aMetric.GetDescent()) );
}
- pOutDev->SetFont( aOldFont );
+ DrawingText(aTextPos, pPara->GetText(), 0, pPara->GetText().getLength(), pBuf.get(),
+ aSvxFont, nPara, bRightToLeftPara ? 1 : 0, nullptr, nullptr, false, false, true, nullptr, Color(), Color());
}
else
{
- if ( pFmt->GetBrush()->GetGraphicObject() )
+ pOutDev->DrawText( aTextPos, pPara->GetText() );
+ }
+
+ pOutDev->SetFont( aOldFont );
+ }
+ else
+ {
+ if ( pFmt->GetBrush()->GetGraphicObject() )
+ {
+ Point aBulletPos;
+ if ( !bVertical )
+ {
+ aBulletPos.setY( rStartPos.Y() + aBulletArea.Top() );
+ if ( !bRightToLeftPara )
+ aBulletPos.setX( rStartPos.X() + aBulletArea.Left() );
+ else
+ aBulletPos.setX( rStartPos.X() + GetPaperSize().Width() - aBulletArea.Right() );
+ }
+ else
{
- Point aBulletPos;
- if ( !bVertical )
+ if (bTopToBottom)
{
- aBulletPos.setY( rStartPos.Y() + aBulletArea.Top() );
- if ( !bRightToLeftPara )
- aBulletPos.setX( rStartPos.X() + aBulletArea.Left() );
- else
- aBulletPos.setX( rStartPos.X() + GetPaperSize().Width() - aBulletArea.Right() );
+ aBulletPos.setX( rStartPos.X() - aBulletArea.Bottom() );
+ aBulletPos.setY( rStartPos.Y() + aBulletArea.Left() );
}
else
{
- if (bTopToBottom)
- {
- aBulletPos.setX( rStartPos.X() - aBulletArea.Bottom() );
- aBulletPos.setY( rStartPos.Y() + aBulletArea.Left() );
- }
- else
- {
- aBulletPos.setX( rStartPos.X() + aBulletArea.Top() );
- aBulletPos.setY( rStartPos.Y() - aBulletArea.Right() );
- }
+ aBulletPos.setX( rStartPos.X() + aBulletArea.Top() );
+ aBulletPos.setY( rStartPos.Y() - aBulletArea.Right() );
}
+ }
- if(bStrippingPortions)
- {
- if(aDrawBulletHdl.IsSet())
- {
- // call something analog to aDrawPortionHdl (if set) and feed it something
- // analog to DrawPortionInfo...
- // created aDrawBulletHdl, Set/GetDrawBulletHdl.
- // created DrawBulletInfo and added handling to sdrtextdecomposition.cxx
- DrawBulletInfo aDrawBulletInfo(
- *pFmt->GetBrush()->GetGraphicObject(),
- aBulletPos,
- pPara->aBulSize);
-
- aDrawBulletHdl.Call(&aDrawBulletInfo);
- }
- }
- else
+ if(bStrippingPortions)
+ {
+ if(aDrawBulletHdl.IsSet())
{
- // Remove CAST when KA made the Draw-Method const
- const_cast<GraphicObject*>(pFmt->GetBrush()->GetGraphicObject())->Draw( pOutDev, aBulletPos, pPara->aBulSize );
+ // call something analog to aDrawPortionHdl (if set) and feed it something
+ // analog to DrawPortionInfo...
+ // created aDrawBulletHdl, Set/GetDrawBulletHdl.
+ // created DrawBulletInfo and added handling to sdrtextdecomposition.cxx
+ DrawBulletInfo aDrawBulletInfo(
+ *pFmt->GetBrush()->GetGraphicObject(),
+ aBulletPos,
+ pPara->aBulSize);
+
+ aDrawBulletHdl.Call(&aDrawBulletInfo);
}
}
+ else
+ {
+ // Remove CAST when KA made the Draw-Method const
+ const_cast<GraphicObject*>(pFmt->GetBrush()->GetGraphicObject())->Draw( pOutDev, aBulletPos, pPara->aBulSize );
+ }
}
}
+ }
- // In case of collapsed subparagraphs paint a line before the text.
- if( pParaList->HasChildren(pPara) && !pParaList->HasVisibleChildren(pPara) &&
- !bStrippingPortions && !nOrientation )
- {
- long nWidth = pOutDev->PixelToLogic( Size( 10, 0 ) ).Width();
+ // In case of collapsed subparagraphs paint a line before the text.
+ if( !(pParaList->HasChildren(pPara) && !pParaList->HasVisibleChildren(pPara) &&
+ !bStrippingPortions && !nOrientation) )
+ return;
- Point aStartPos, aEndPos;
- if ( !bVertical )
- {
- aStartPos.setY( rStartPos.Y() + aBulletArea.Bottom() );
- if ( !bRightToLeftPara )
- aStartPos.setX( rStartPos.X() + aBulletArea.Right() );
- else
- aStartPos.setX( rStartPos.X() + GetPaperSize().Width() - aBulletArea.Left() );
- aEndPos = aStartPos;
- aEndPos.AdjustX(nWidth );
- }
- else
- {
- aStartPos.setX( rStartPos.X() - aBulletArea.Bottom() );
- aStartPos.setY( rStartPos.Y() + aBulletArea.Right() );
- aEndPos = aStartPos;
- aEndPos.AdjustY(nWidth );
- }
+ long nWidth = pOutDev->PixelToLogic( Size( 10, 0 ) ).Width();
- const Color& rOldLineColor = pOutDev->GetLineColor();
- pOutDev->SetLineColor( COL_BLACK );
- pOutDev->DrawLine( aStartPos, aEndPos );
- pOutDev->SetLineColor( rOldLineColor );
- }
+ Point aStartPos, aEndPos;
+ if ( !bVertical )
+ {
+ aStartPos.setY( rStartPos.Y() + aBulletArea.Bottom() );
+ if ( !bRightToLeftPara )
+ aStartPos.setX( rStartPos.X() + aBulletArea.Right() );
+ else
+ aStartPos.setX( rStartPos.X() + GetPaperSize().Width() - aBulletArea.Left() );
+ aEndPos = aStartPos;
+ aEndPos.AdjustX(nWidth );
}
+ else
+ {
+ aStartPos.setX( rStartPos.X() - aBulletArea.Bottom() );
+ aStartPos.setY( rStartPos.Y() + aBulletArea.Right() );
+ aEndPos = aStartPos;
+ aEndPos.AdjustY(nWidth );
+ }
+
+ const Color& rOldLineColor = pOutDev->GetLineColor();
+ pOutDev->SetLineColor( COL_BLACK );
+ pOutDev->DrawLine( aStartPos, aEndPos );
+ pOutDev->SetLineColor( rOldLineColor );
}
void Outliner::InvalidateBullet(sal_Int32 nPara)
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 1f2fe9867304..8d1127e15ba8 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -677,34 +677,34 @@ void OutlinerView::PasteSpecial()
void OutlinerView::Paste( bool bUseSpecial )
{
- if ( !ImpCalcSelectedPages( false ) || pOwner->ImpCanDeleteSelectedPages( this ) )
- {
- pOwner->UndoActionStart( OLUNDO_INSERT );
-
- pOwner->pEditEngine->SetUpdateMode( false );
- pOwner->bPasting = true;
+ if ( !(!ImpCalcSelectedPages( false ) || pOwner->ImpCanDeleteSelectedPages( this )) )
+ return;
- if ( bUseSpecial )
- pEditView->PasteSpecial();
- else
- pEditView->Paste();
+ pOwner->UndoActionStart( OLUNDO_INSERT );
- if ( pOwner->ImplGetOutlinerMode() == OutlinerMode::OutlineObject )
- {
- const sal_Int32 nParaCount = pOwner->pEditEngine->GetParagraphCount();
+ pOwner->pEditEngine->SetUpdateMode( false );
+ pOwner->bPasting = true;
- for( sal_Int32 nPara = 0; nPara < nParaCount; nPara++ )
- pOwner->ImplSetLevelDependentStyleSheet( nPara );
- }
+ if ( bUseSpecial )
+ pEditView->PasteSpecial();
+ else
+ pEditView->Paste();
- pEditView->SetEditEngineUpdateMode( true );
- pOwner->UndoActionEnd();
- pEditView->ShowCursor();
+ if ( pOwner->ImplGetOutlinerMode() == OutlinerMode::OutlineObject )
+ {
+ const sal_Int32 nParaCount = pOwner->pEditEngine->GetParagraphCount();
- // Chaining handling
- // NOTE: We need to do this last because it pEditView may be deleted if a switch of box occurs
- aEndCutPasteLink.Call(nullptr);
+ for( sal_Int32 nPara = 0; nPara < nParaCount; nPara++ )
+ pOwner->ImplSetLevelDependentStyleSheet( nPara );
}
+
+ pEditView->SetEditEngineUpdateMode( true );
+ pOwner->UndoActionEnd();
+ pEditView->ShowCursor();
+
+ // Chaining handling
+ // NOTE: We need to do this last because it pEditView may be deleted if a switch of box occurs
+ aEndCutPasteLink.Call(nullptr);
}
void OutlinerView::CreateSelectionList (std::vector<Paragraph*> &aSelList)
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 45a579d6e301..dab691d39f6c 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -1690,107 +1690,107 @@ void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet,
// pard / plain handling
void SvxRTFParser::RTFPardPlain( bool const bPard, SfxItemSet** ppSet )
{
- if( !bNewGroup && !aAttrStack.empty() ) // not at the beginning of a new group
+ if( bNewGroup || aAttrStack.empty() ) // not at the beginning of a new group
+ return;
+
+ SvxRTFItemStackType* pCurrent = aAttrStack.back().get();
+
+ int nLastToken = GetStackPtr(-1)->nTokenId;
+ bool bNewStkEntry = true;
+ if( RTF_PARD != nLastToken &&
+ RTF_PLAIN != nLastToken &&
+ BRACELEFT != nLastToken )
{
- SvxRTFItemStackType* pCurrent = aAttrStack.back().get();
+ if (pCurrent->aAttrSet.Count() || pCurrent->m_pChildList || pCurrent->nStyleNo)
+ {
+ // open a new group
+ std::unique_ptr<SvxRTFItemStackType> pNew(new SvxRTFItemStackType( *pCurrent, *pInsPos, true ));
+ pNew->SetRTFDefaults( GetRTFDefaults() );
+
+ // Set all until here valid attributes
+ AttrGroupEnd();
+ pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get(); // can be changed after AttrGroupEnd!
+ pNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr );
+ aAttrStack.push_back( std::move(pNew) );
+ pCurrent = aAttrStack.back().get();
+ }
+ else
+ {
+ // continue to use this entry as new
+ pCurrent->SetStartPos( *pInsPos );
+ bNewStkEntry = false;
+ }
+ }
- int nLastToken = GetStackPtr(-1)->nTokenId;
- bool bNewStkEntry = true;
- if( RTF_PARD != nLastToken &&
- RTF_PLAIN != nLastToken &&
- BRACELEFT != nLastToken )
+ // now reset all to default
+ if( bNewStkEntry &&
+ ( pCurrent->aAttrSet.GetParent() || pCurrent->aAttrSet.Count() ))
+ {
+ const SfxPoolItem *pItem, *pDef;
+ const sal_uInt16* pPtr;
+ sal_uInt16 nCnt;
+ const SfxItemSet* pDfltSet = &GetRTFDefaults();
+ if( bPard )
{
- if (pCurrent->aAttrSet.Count() || pCurrent->m_pChildList || pCurrent->nStyleNo)
- {
- // open a new group
- std::unique_ptr<SvxRTFItemStackType> pNew(new SvxRTFItemStackType( *pCurrent, *pInsPos, true ));
- pNew->SetRTFDefaults( GetRTFDefaults() );
-
- // Set all until here valid attributes
- AttrGroupEnd();
- pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get(); // can be changed after AttrGroupEnd!
- pNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr );
- aAttrStack.push_back( std::move(pNew) );
- pCurrent = aAttrStack.back().get();
- }
- else
- {
- // continue to use this entry as new
- pCurrent->SetStartPos( *pInsPos );
- bNewStkEntry = false;
- }
+ pCurrent->nStyleNo = 0;
+ pPtr = reinterpret_cast<sal_uInt16*>(&aPardMap);
+ nCnt = sizeof(aPardMap) / sizeof(sal_uInt16);
+ }
+ else
+ {
+ pPtr = reinterpret_cast<sal_uInt16*>(&aPlainMap);
+ nCnt = sizeof(aPlainMap) / sizeof(sal_uInt16);
}
- // now reset all to default
- if( bNewStkEntry &&
- ( pCurrent->aAttrSet.GetParent() || pCurrent->aAttrSet.Count() ))
+ for( sal_uInt16 n = 0; n < nCnt; ++n, ++pPtr )
{
- const SfxPoolItem *pItem, *pDef;
- const sal_uInt16* pPtr;
- sal_uInt16 nCnt;
- const SfxItemSet* pDfltSet = &GetRTFDefaults();
- if( bPard )
+ // Item set and different -> Set the Default Pool
+ if( !*pPtr )
+ ;
+ else if (SfxItemPool::IsSlot(*pPtr))
+ pCurrent->aAttrSet.ClearItem( *pPtr );
+ else if( IsChkStyleAttr() )
+ pCurrent->aAttrSet.Put( pDfltSet->Get( *pPtr ) );
+ else if( !pCurrent->aAttrSet.GetParent() )
{
- pCurrent->nStyleNo = 0;
- pPtr = reinterpret_cast<sal_uInt16*>(&aPardMap);
- nCnt = sizeof(aPardMap) / sizeof(sal_uInt16);
+ if( SfxItemState::SET ==
+ pDfltSet->GetItemState( *pPtr, false, &pDef ))
+ pCurrent->aAttrSet.Put( *pDef );
+ else
+ pCurrent->aAttrSet.ClearItem( *pPtr );
}
+ else if( SfxItemState::SET == pCurrent->aAttrSet.GetParent()->
+ GetItemState( *pPtr, true, &pItem ) &&
+ *( pDef = &pDfltSet->Get( *pPtr )) != *pItem )
+ pCurrent->aAttrSet.Put( *pDef );
else
{
- pPtr = reinterpret_cast<sal_uInt16*>(&aPlainMap);
- nCnt = sizeof(aPlainMap) / sizeof(sal_uInt16);
- }
-
- for( sal_uInt16 n = 0; n < nCnt; ++n, ++pPtr )
- {
- // Item set and different -> Set the Default Pool
- if( !*pPtr )
- ;
- else if (SfxItemPool::IsSlot(*pPtr))
- pCurrent->aAttrSet.ClearItem( *pPtr );
- else if( IsChkStyleAttr() )
- pCurrent->aAttrSet.Put( pDfltSet->Get( *pPtr ) );
- else if( !pCurrent->aAttrSet.GetParent() )
- {
- if( SfxItemState::SET ==
- pDfltSet->GetItemState( *pPtr, false, &pDef ))
- pCurrent->aAttrSet.Put( *pDef );
- else
- pCurrent->aAttrSet.ClearItem( *pPtr );
- }
- else if( SfxItemState::SET == pCurrent->aAttrSet.GetParent()->
- GetItemState( *pPtr, true, &pItem ) &&
- *( pDef = &pDfltSet->Get( *pPtr )) != *pItem )
+ if( SfxItemState::SET ==
+ pDfltSet->GetItemState( *pPtr, false, &pDef ))
pCurrent->aAttrSet.Put( *pDef );
else
- {
- if( SfxItemState::SET ==
- pDfltSet->GetItemState( *pPtr, false, &pDef ))
- pCurrent->aAttrSet.Put( *pDef );
- else
- pCurrent->aAttrSet.ClearItem( *pPtr );
- }
+ pCurrent->aAttrSet.ClearItem( *pPtr );
}
}
- else if( bPard )
- pCurrent->nStyleNo = 0; // reset Style number
+ }
+ else if( bPard )
+ pCurrent->nStyleNo = 0; // reset Style number
- *ppSet = &pCurrent->aAttrSet;
+ *ppSet = &pCurrent->aAttrSet;
- if (!bPard)
- {
- //Once we have a default font, then any text without a font specifier is
- //in the default font, and thus has the default font charset, otherwise
- //we can fall back to the ansicpg set codeset
- if (nDfltFont != -1)
- {
- const vcl::Font& rSVFont = GetFont(sal_uInt16(nDfltFont));
- SetEncoding(rSVFont.GetCharSet());
- }
- else
- SetEncoding(GetCodeSet());
- }
+ if (bPard)
+ return;
+
+ //Once we have a default font, then any text without a font specifier is
+ //in the default font, and thus has the default font charset, otherwise
+ //we can fall back to the ansicpg set codeset
+ if (nDfltFont != -1)
+ {
+ const vcl::Font& rSVFont = GetFont(sal_uInt16(nDfltFont));
+ SetEncoding(rSVFont.GetCharSet());
}
+ else
+ SetEncoding(GetCodeSet());
}
void SvxRTFParser::SetDefault( int nToken, int nValue )
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 6f57a5ddd29e..b766f4acc304 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -677,169 +677,169 @@ void SvxRTFParser::ClearStyleAttr_( SvxRTFItemStackType& rStkType )
void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack
{
- if( !aAttrStack.empty() )
- {
- std::unique_ptr<SvxRTFItemStackType> pOld = std::move(aAttrStack.back());
- aAttrStack.pop_back();
- SvxRTFItemStackType *pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get();
-
- do { // middle check loop
- sal_Int32 nOldSttNdIdx = pOld->pSttNd->GetIdx();
- if (!pOld->m_pChildList &&
- ((!pOld->aAttrSet.Count() && !pOld->nStyleNo ) ||
- (nOldSttNdIdx == pInsPos->GetNodeIdx() &&
- pOld->nSttCnt == pInsPos->GetCntIdx() )))
- break; // no attributes or Area
-
- // set only the attributes that are different from the parent
- if( pCurrent && pOld->aAttrSet.Count() )
- {
- SfxItemIter aIter( pOld->aAttrSet );
- const SfxPoolItem* pItem = aIter.GetCurItem(), *pGet;
- do
- {
- if( SfxItemState::SET == pCurrent->aAttrSet.GetItemState(
- pItem->Which(), false, &pGet ) &&
- *pItem == *pGet )
- pOld->aAttrSet.ClearItem( pItem->Which() );
+ if( aAttrStack.empty() )
+ return;
- pItem = aIter.NextItem();
- } while (pItem);
+ std::unique_ptr<SvxRTFItemStackType> pOld = std::move(aAttrStack.back());
+ aAttrStack.pop_back();
+ SvxRTFItemStackType *pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get();
- if (!pOld->aAttrSet.Count() && !pOld->m_pChildList &&
- !pOld->nStyleNo )
- break;
- }
+ do { // middle check loop
+ sal_Int32 nOldSttNdIdx = pOld->pSttNd->GetIdx();
+ if (!pOld->m_pChildList &&
+ ((!pOld->aAttrSet.Count() && !pOld->nStyleNo ) ||
+ (nOldSttNdIdx == pInsPos->GetNodeIdx() &&
+ pOld->nSttCnt == pInsPos->GetCntIdx() )))
+ break; // no attributes or Area
- // Set all attributes which have been defined from start until here
- bool bCrsrBack = !pInsPos->GetCntIdx();
- if( bCrsrBack )
+ // set only the attributes that are different from the parent
+ if( pCurrent && pOld->aAttrSet.Count() )
+ {
+ SfxItemIter aIter( pOld->aAttrSet );
+ const SfxPoolItem* pItem = aIter.GetCurItem(), *pGet;
+ do
{
- // at the beginning of a paragraph? Move back one position
- sal_Int32 nNd = pInsPos->GetNodeIdx();
- MovePos(false);
- // if can not move backward then later don't move forward !
- bCrsrBack = nNd != pInsPos->GetNodeIdx();
- }
+ if( SfxItemState::SET == pCurrent->aAttrSet.GetItemState(
+ pItem->Which(), false, &pGet ) &&
+ *pItem == *pGet )
+ pOld->aAttrSet.ClearItem( pItem->Which() );
+
+ pItem = aIter.NextItem();
+ } while (pItem);
- if( pOld->pSttNd->GetIdx() < pInsPos->GetNodeIdx() ||
- ( pOld->pSttNd->GetIdx() == pInsPos->GetNodeIdx() &&
- pOld->nSttCnt <= pInsPos->GetCntIdx() ) )
+ if (!pOld->aAttrSet.Count() && !pOld->m_pChildList &&
+ !pOld->nStyleNo )
+ break;
+ }
+
+ // Set all attributes which have been defined from start until here
+ bool bCrsrBack = !pInsPos->GetCntIdx();
+ if( bCrsrBack )
+ {
+ // at the beginning of a paragraph? Move back one position
+ sal_Int32 nNd = pInsPos->GetNodeIdx();
+ MovePos(false);
+ // if can not move backward then later don't move forward !
+ bCrsrBack = nNd != pInsPos->GetNodeIdx();
+ }
+
+ if( pOld->pSttNd->GetIdx() < pInsPos->GetNodeIdx() ||
+ ( pOld->pSttNd->GetIdx() == pInsPos->GetNodeIdx() &&
+ pOld->nSttCnt <= pInsPos->GetCntIdx() ) )
+ {
+ if( !bCrsrBack )
{
- if( !bCrsrBack )
+ // all pard attributes are only valid until the previous
+ // paragraph !!
+ if( nOldSttNdIdx == pInsPos->GetNodeIdx() )
+ {
+ }
+ else
{
- // all pard attributes are only valid until the previous
- // paragraph !!
- if( nOldSttNdIdx == pInsPos->GetNodeIdx() )
+ // Now it gets complicated:
+ // - all character attributes sre keep the area
+ // - all paragraph attributes to get the area
+ // up to the previous paragraph
+ std::unique_ptr<SvxRTFItemStackType> pNew(
+ new SvxRTFItemStackType(*pOld, *pInsPos, true));
+ pNew->aAttrSet.SetParent( pOld->aAttrSet.GetParent() );
+
+ // Delete all paragraph attributes from pNew
+ for( sal_uInt16 n = 0; n < (sizeof(aPardMap) / sizeof(sal_uInt16)) &&
+ pNew->aAttrSet.Count(); ++n )
+ if( reinterpret_cast<sal_uInt16*>(&aPardMap)[n] )
+ pNew->aAttrSet.ClearItem( reinterpret_cast<sal_uInt16*>(&aPardMap)[n] );
+ pNew->SetRTFDefaults( GetRTFDefaults() );
+
+ // Were there any?
+ if( pNew->aAttrSet.Count() == pOld->aAttrSet.Count() )
{
+ pNew.reset();
}
else
{
- // Now it gets complicated:
- // - all character attributes sre keep the area
- // - all paragraph attributes to get the area
- // up to the previous paragraph
- std::unique_ptr<SvxRTFItemStackType> pNew(
- new SvxRTFItemStackType(*pOld, *pInsPos, true));
- pNew->aAttrSet.SetParent( pOld->aAttrSet.GetParent() );
-
- // Delete all paragraph attributes from pNew
- for( sal_uInt16 n = 0; n < (sizeof(aPardMap) / sizeof(sal_uInt16)) &&
- pNew->aAttrSet.Count(); ++n )
- if( reinterpret_cast<sal_uInt16*>(&aPardMap)[n] )
- pNew->aAttrSet.ClearItem( reinterpret_cast<sal_uInt16*>(&aPardMap)[n] );
- pNew->SetRTFDefaults( GetRTFDefaults() );
-
- // Were there any?
- if( pNew->aAttrSet.Count() == pOld->aAttrSet.Count() )
+ pNew->nStyleNo = 0;
+
+ // Now span the real area of pNew from old
+ SetEndPrevPara( pOld->pEndNd, pOld->nEndCnt );
+ pNew->nSttCnt = 0;
+
+ if( IsChkStyleAttr() )
+ {
+ ClearStyleAttr_( *pOld );
+ ClearStyleAttr_( *pNew ); //#i10381#, methinks.
+ }
+
+ if( pCurrent )
{
- pNew.reset();
+ pCurrent->Add(std::move(pOld));
+ pCurrent->Add(std::move(pNew));
}
else
{
- pNew->nStyleNo = 0;
-
- // Now span the real area of pNew from old
- SetEndPrevPara( pOld->pEndNd, pOld->nEndCnt );
- pNew->nSttCnt = 0;
-
- if( IsChkStyleAttr() )
- {
- ClearStyleAttr_( *pOld );
- ClearStyleAttr_( *pNew ); //#i10381#, methinks.
- }
-
- if( pCurrent )
- {
- pCurrent->Add(std::move(pOld));
- pCurrent->Add(std::move(pNew));
- }
- else
- {
- // Last off the stack, thus cache it until the next text was
- // read. (Span no attributes!)
-
- m_AttrSetList.push_back(std::move(pOld));
- m_AttrSetList.push_back(std::move(pNew));
- }
- break;
+ // Last off the stack, thus cache it until the next text was
+ // read. (Span no attributes!)
+
+ m_AttrSetList.push_back(std::move(pOld));
+ m_AttrSetList.push_back(std::move(pNew));
}
+ break;
}
}
+ }
- pOld->pEndNd = pInsPos->MakeNodeIdx().release();
- pOld->nEndCnt = pInsPos->GetCntIdx();
-
- /*
- #i21422#
- If the parent (pCurrent) sets something e.g. , and the child (pOld)
- unsets it and the style both are based on has it unset then
- clearing the pOld by looking at the style is clearly a disaster
- as the text ends up with pCurrents bold and not pOlds no bold, this
- should be rethought out. For the moment its safest to just do
- the clean if we have no parent, all we suffer is too many
- redundant properties.
- */
- if (IsChkStyleAttr() && !pCurrent)
- ClearStyleAttr_( *pOld );
-
- if( pCurrent )
+ pOld->pEndNd = pInsPos->MakeNodeIdx().release();
+ pOld->nEndCnt = pInsPos->GetCntIdx();
+
+ /*
+ #i21422#
+ If the parent (pCurrent) sets something e.g. , and the child (pOld)
+ unsets it and the style both are based on has it unset then
+ clearing the pOld by looking at the style is clearly a disaster
+ as the text ends up with pCurrents bold and not pOlds no bold, this
+ should be rethought out. For the moment its safest to just do
+ the clean if we have no parent, all we suffer is too many
+ redundant properties.
+ */
+ if (IsChkStyleAttr() && !pCurrent)
+ ClearStyleAttr_( *pOld );
+
+ if( pCurrent )
+ {
+ pCurrent->Add(std::move(pOld));
+ // split up and create new entry, because it makes no sense
+ // to create a "so long" depend list. Bug 95010
+ if (bCrsrBack && 50 < pCurrent->m_pChildList->size())
{
- pCurrent->Add(std::move(pOld));
- // split up and create new entry, because it makes no sense
- // to create a "so long" depend list. Bug 95010
- if (bCrsrBack && 50 < pCurrent->m_pChildList->size())
- {
- // at the beginning of a paragraph? Move back one position
- MovePos();
- bCrsrBack = false;
-
- // Open a new Group.
- std::unique_ptr<SvxRTFItemStackType> pNew(new SvxRTFItemStackType(
- *pCurrent, *pInsPos, true ));
- pNew->SetRTFDefaults( GetRTFDefaults() );
-
- // Set all until here valid Attributes
- AttrGroupEnd();
- pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get(); // can be changed after AttrGroupEnd!
- pNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr );
- aAttrStack.push_back( std::move(pNew) );
- }
+ // at the beginning of a paragraph? Move back one position
+ MovePos();
+ bCrsrBack = false;
+
+ // Open a new Group.
+ std::unique_ptr<SvxRTFItemStackType> pNew(new SvxRTFItemStackType(
+ *pCurrent, *pInsPos, true ));
+ pNew->SetRTFDefaults( GetRTFDefaults() );
+
+ // Set all until here valid Attributes
+ AttrGroupEnd();
+ pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get(); // can be changed after AttrGroupEnd!
+ pNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr );
+ aAttrStack.push_back( std::move(pNew) );
}
- else
- // Last off the stack, thus cache it until the next text was
- // read. (Span no attributes!)
- m_AttrSetList.push_back(std::move(pOld));
}
+ else
+ // Last off the stack, thus cache it until the next text was
+ // read. (Span no attributes!)
+ m_AttrSetList.push_back(std::move(pOld));
+ }
- if( bCrsrBack )
- // at the beginning of a paragraph? Move back one position
- MovePos();
+ if( bCrsrBack )
+ // at the beginning of a paragraph? Move back one position
+ MovePos();
- } while( false );
+ } while( false );
- bNewGroup = false;
- }
+ bNewGroup = false;
}
void SvxRTFParser::SetAllAttrOfStk() // end all Attr. and set it into doc
diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx
index efc60ef66bd6..19e14fcfc50a 100644
--- a/editeng/source/uno/unoedhlp.cxx
+++ b/editeng/source/uno/unoedhlp.cxx
@@ -161,78 +161,78 @@ void SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE
nStartIndex = nClosestStartIndex;
nEndIndex = nClosestEndIndex;
- if ( bInCell )
+ if ( !bInCell )
+ return;
+
+ EPosition aStartPos( nPara, nStartIndex ), aEndPos( nPara, nEndIndex );
+ sal_Int32 nParaCount = rEE.GetParagraphCount();
+ sal_Int32 nCrrntParaLen = rEE.GetTextLen(nPara);
+ //need to find closest index in front of nIndex in the previous paragraphs
+ if ( aStartPos.nIndex == 0 )
{
- EPosition aStartPos( nPara, nStartIndex ), aEndPos( nPara, nEndIndex );
- sal_Int32 nParaCount = rEE.GetParagraphCount();
- sal_Int32 nCrrntParaLen = rEE.GetTextLen(nPara);
- //need to find closest index in front of nIndex in the previous paragraphs
- if ( aStartPos.nIndex == 0 )
+ SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, 0, 1, GetAttribsFlags::CHARATTRIBS );
+ for ( sal_Int32 nParaIdx = nPara-1; nParaIdx >= 0; nParaIdx-- )
{
- SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, 0, 1, GetAttribsFlags::CHARATTRIBS );
- for ( sal_Int32 nParaIdx = nPara-1; nParaIdx >= 0; nParaIdx-- )
+ sal_uInt32 nLen = rEE.GetTextLen(nParaIdx);
+ if ( nLen )
{
- sal_uInt32 nLen = rEE.GetTextLen(nParaIdx);
- if ( nLen )
+ sal_Int32 nStartIdx, nEndIdx;
+ GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, nLen );
+ SfxItemSet aSet = rEE.GetAttribs( nParaIdx, nLen-1, nLen, GetAttribsFlags::CHARATTRIBS );
+ if ( aSet == aCrrntSet )
{
- sal_Int32 nStartIdx, nEndIdx;
- GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, nLen );
- SfxItemSet aSet = rEE.GetAttribs( nParaIdx, nLen-1, nLen, GetAttribsFlags::CHARATTRIBS );
- if ( aSet == aCrrntSet )
+ aStartPos.nPara = nParaIdx;
+ aStartPos.nIndex = nStartIdx;
+ if ( aStartPos.nIndex != 0 )
{
- aStartPos.nPara = nParaIdx;
- aStartPos.nIndex = nStartIdx;
- if ( aStartPos.nIndex != 0 )
- {
- break;
- }
+ break;
}
}
}
}
- //need find closest index behind nIndex in the following paragraphs
- if ( aEndPos.nIndex == nCrrntParaLen )
+ }
+ //need find closest index behind nIndex in the following paragraphs
+ if ( aEndPos.nIndex == nCrrntParaLen )
+ {
+ SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, nCrrntParaLen-1, nCrrntParaLen, GetAttribsFlags::CHARATTRIBS );
+ for ( sal_Int32 nParaIdx = nPara+1; nParaIdx < nParaCount; nParaIdx++ )
{
- SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, nCrrntParaLen-1, nCrrntParaLen, GetAttribsFlags::CHARATTRIBS );
- for ( sal_Int32 nParaIdx = nPara+1; nParaIdx < nParaCount; nParaIdx++ )
+ sal_Int32 nLen = rEE.GetTextLen( nParaIdx );
+ if ( nLen )
{
- sal_Int32 nLen = rEE.GetTextLen( nParaIdx );
- if ( nLen )
+ sal_Int32 nStartIdx, nEndIdx;
+ GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, 0 );
+ SfxItemSet aSet = rEE.GetAttribs( nParaIdx, 0, 1, GetAttribsFlags::CHARATTRIBS );
+ if ( aSet == aCrrntSet )
{
- sal_Int32 nStartIdx, nEndIdx;
- GetAttributeRun( nStartIdx, nEndIdx, rEE, nParaIdx, 0 );
- SfxItemSet aSet = rEE.GetAttribs( nParaIdx, 0, 1, GetAttribsFlags::CHARATTRIBS );
- if ( aSet == aCrrntSet )
+ aEndPos.nPara = nParaIdx;
+ aEndPos.nIndex = nEndIdx;
+ if ( aEndPos.nIndex != nLen )
{
- aEndPos.nPara = nParaIdx;
- aEndPos.nIndex = nEndIdx;
- if ( aEndPos.nIndex != nLen )
- {
- break;
- }
+ break;
}
}
}
}
- nStartIndex = 0;
- if ( aStartPos.nPara > 0 )
- {
- for ( sal_Int32 i = 0; i < aStartPos.nPara; i++ )
- {
- nStartIndex += rEE.GetTextLen(i)+1;
- }
- }
- nStartIndex += aStartPos.nIndex;
- nEndIndex = 0;
- if ( aEndPos.nPara > 0 )
+ }
+ nStartIndex = 0;
+ if ( aStartPos.nPara > 0 )
+ {
+ for ( sal_Int32 i = 0; i < aStartPos.nPara; i++ )
{
- for ( sal_Int32 i = 0; i < aEndPos.nPara; i++ )
- {
- nEndIndex += rEE.GetTextLen(i)+1;
- }
+ nStartIndex += rEE.GetTextLen(i)+1;
}
- nEndIndex += aEndPos.nIndex;
}
+ nStartIndex += aStartPos.nIndex;
+ nEndIndex = 0;
+ if ( aEndPos.nPara > 0 )
+ {
+ for ( sal_Int32 i = 0; i < aEndPos.nPara; i++ )
+ {
+ nEndIndex += rEE.GetTextLen(i)+1;
+ }
+ }
+ nEndIndex += aEndPos.nIndex;
}
Point SvxEditSourceHelper::EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical )
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index ad5b26429e1d..53f3088b19be 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -151,48 +151,48 @@ void GetSelection( struct ESelection& rSel, SvxTextForwarder const * pForwarder
void CheckSelection( struct ESelection& rSel, SvxTextForwarder const * pForwarder ) throw()
{
DBG_ASSERT( pForwarder, "I need a valid SvxTextForwarder!" );
- if( pForwarder )
+ if( !pForwarder )
+ return;
+
+ if( rSel.nStartPara == EE_PARA_MAX_COUNT )
+ {
+ ::GetSelection( rSel, pForwarder );
+ }
+ else
{
- if( rSel.nStartPara == EE_PARA_MAX_COUNT )
+ ESelection aMaxSelection;
+ GetSelection( aMaxSelection, pForwarder );
+
+ // check start position
+ if( rSel.nStartPara < aMaxSelection.nStartPara )
{
- ::GetSelection( rSel, pForwarder );
+ rSel.nStartPara = aMaxSelection.nStartPara;
+ rSel.nStartPos = aMaxSelection.nStartPos;
}
- else
+ else if( rSel.nStartPara > aMaxSelection.nEndPara )
{
- ESelection aMaxSelection;
- GetSelection( aMaxSelection, pForwarder );
-
- // check start position
- if( rSel.nStartPara < aMaxSelection.nStartPara )
- {
- rSel.nStartPara = aMaxSelection.nStartPara;
- rSel.nStartPos = aMaxSelection.nStartPos;
- }
- else if( rSel.nStartPara > aMaxSelection.nEndPara )
- {
- rSel.nStartPara = aMaxSelection.nEndPara;
- rSel.nStartPos = aMaxSelection.nEndPos;
- }
- else if( rSel.nStartPos > pForwarder->GetTextLen( rSel.nStartPara ) )
- {
- rSel.nStartPos = pForwarder->GetTextLen( rSel.nStartPara );
- }
+ rSel.nStartPara = aMaxSelection.nEndPara;
+ rSel.nStartPos = aMaxSelection.nEndPos;
+ }
+ else if( rSel.nStartPos > pForwarder->GetTextLen( rSel.nStartPara ) )
+ {
+ rSel.nStartPos = pForwarder->GetTextLen( rSel.nStartPara );
+ }
- // check end position
- if( rSel.nEndPara < aMaxSelection.nStartPara )
- {
- rSel.nEndPara = aMaxSelection.nStartPara;
- rSel.nEndPos = aMaxSelection.nStartPos;
- }
- else if( rSel.nEndPara > aMaxSelection.nEndPara )
- {
- rSel.nEndPara = aMaxSelection.nEndPara;
- rSel.nEndPos = aMaxSelection.nEndPos;
- }
- else if( rSel.nEndPos > pForwarder->GetTextLen( rSel.nEndPara ) )
- {
- rSel.nEndPos = pForwarder->GetTextLen( rSel.nEndPara );
- }
+ // check end position
+ if( rSel.nEndPara < aMaxSelection.nStartPara )
+ {
+ rSel.nEndPara = aMaxSelection.nStartPara;
+ rSel.nEndPos = aMaxSelection.nStartPos;
+ }
+ else if( rSel.nEndPara > aMaxSelection.nEndPara )
+ {
+ rSel.nEndPara = aMaxSelection.nEndPara;
+ rSel.nEndPos = aMaxSelection.nEndPos;
+ }
+ else if( rSel.nEndPos > pForwarder->GetTextLen( rSel.nEndPara ) )
+ {
+ rSel.nEndPos = pForwarder->GetTextLen( rSel.nEndPara );
}
}
}
@@ -380,24 +380,24 @@ void SAL_CALL SvxUnoTextRangeBase::setString(const OUString& aString)
SolarMutexGuard aGuard;
SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
- if( pForwarder )
- {
- CheckSelection( maSelection, pForwarder );
+ if( !pForwarder )
+ return;
- OUString aConverted(convertLineEnd(aString, LINEEND_LF)); // Simply count the number of line endings
+ CheckSelection( maSelection, pForwarder );
- pForwarder->QuickInsertText( aConverted, maSelection );
- mpEditSource->UpdateData();
+ OUString aConverted(convertLineEnd(aString, LINEEND_LF)); // Simply count the number of line endings
- // Adapt selection
- //! It would be easier if the EditEngine would return the selection
- //! on QuickInsertText...
- CollapseToStart();
+ pForwarder->QuickInsertText( aConverted, maSelection );
+ mpEditSource->UpdateData();
- sal_Int32 nLen = aConverted.getLength();
- if (nLen)
- GoRight( nLen, true );
- }
+ // Adapt selection
+ //! It would be easier if the EditEngine would return the selection
+ //! on QuickInsertText...
+ CollapseToStart();
+
+ sal_Int32 nLen = aConverted.getLength();
+ if (nLen)
+ GoRight( nLen, true );
}
// Interface beans::XPropertySet
@@ -751,117 +751,117 @@ void SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< OUString >& a
SolarMutexGuard aGuard;
SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
- if( pForwarder )
- {
- CheckSelection( maSelection, pForwarder );
+ if( !pForwarder )
+ return;
- ESelection aSel( GetSelection() );
+ CheckSelection( maSelection, pForwarder );
- const OUString* pPropertyNames = aPropertyNames.getConstArray();
- const uno::Any* pValues = aValues.getConstArray();
- sal_Int32 nCount = aPropertyNames.getLength();
+ ESelection aSel( GetSelection() );
- sal_Int32 nEndPara = nPara;
- sal_Int32 nTempPara = nPara;
+ const OUString* pPropertyNames = aPropertyNames.getConstArray();
+ const uno::Any* pValues = aValues.getConstArray();
+ sal_Int32 nCount = aPropertyNames.getLength();
- if( nTempPara == -1 )
- {
- nTempPara = aSel.nStartPara;
- nEndPara = aSel.nEndPara;
- }
+ sal_Int32 nEndPara = nPara;
+ sal_Int32 nTempPara = nPara;
+
+ if( nTempPara == -1 )
+ {
+ nTempPara = aSel.nStartPara;
+ nEndPara = aSel.nEndPara;
+ }
- std::unique_ptr<SfxItemSet> pOldAttrSet;
- std::unique_ptr<SfxItemSet> pNewAttrSet;
+ std::unique_ptr<SfxItemSet> pOldAttrSet;
+ std::unique_ptr<SfxItemSet> pNewAttrSet;
- std::unique_ptr<SfxItemSet> pOldParaSet;
- std::unique_ptr<SfxItemSet> pNewParaSet;
+ std::unique_ptr<SfxItemSet> pOldParaSet;
+ std::unique_ptr<SfxItemSet> pNewParaSet;
- for( ; nCount; nCount--, pPropertyNames++, pValues++ )
+ for( ; nCount; nCount--, pPropertyNames++, pValues++ )
+ {
+ const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
+
+ if( pMap )
{
- const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
+ bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
- if( pMap )
+ if( (nPara == -1) && !bParaAttrib )
{
- bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
-
- if( (nPara == -1) && !bParaAttrib )
+ if( nullptr == pNewAttrSet )
{
- if( nullptr == pNewAttrSet )
- {
- const SfxItemSet aSet( pForwarder->GetAttribs( aSel ) );
- pOldAttrSet.reset(new SfxItemSet( aSet ));
- pNewAttrSet.reset(new SfxItemSet( *pOldAttrSet->GetPool(), pOldAttrSet->GetRanges() ));
- }
+ const SfxItemSet aSet( pForwarder->GetAttribs( aSel ) );
+ pOldAttrSet.reset(new SfxItemSet( aSet ));
+ pNewAttrSet.reset(new SfxItemSet( *pOldAttrSet->GetPool(), pOldAttrSet->GetRanges() ));
+ }
- setPropertyValue( pMap, *pValues, GetSelection(), *pOldAttrSet, *pNewAttrSet );
+ setPropertyValue( pMap, *pValues, GetSelection(), *pOldAttrSet, *pNewAttrSet );
- if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
+ if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
+ {
+ const SfxPoolItem* pItem;
+ if( pNewAttrSet->GetItemState( pMap->nWID, true, &pItem ) == SfxItemState::SET )
{
- const SfxPoolItem* pItem;
- if( pNewAttrSet->GetItemState( pMap->nWID, true, &pItem ) == SfxItemState::SET )
- {
- pOldAttrSet->Put( *pItem );
- }
+ pOldAttrSet->Put( *pItem );
}
}
- else
+ }
+ else
+ {
+ if( nullptr == pNewParaSet )
{
- if( nullptr == pNewParaSet )
- {
- const SfxItemSet & rSet = pForwarder->GetParaAttribs( nTempPara );
- pOldParaSet.reset(new SfxItemSet( rSet ));
- pNewParaSet.reset(new SfxItemSet( *pOldParaSet->GetPool(), pOldParaSet->GetRanges() ));
- }
+ const SfxItemSet & rSet = pForwarder->GetParaAttribs( nTempPara );
+ pOldParaSet.reset(new SfxItemSet( rSet ));
+ pNewParaSet.reset(new SfxItemSet( *pOldParaSet->GetPool(), pOldParaSet->GetRanges() ));
+ }
- setPropertyValue( pMap, *pValues, GetSelection(), *pOldParaSet, *pNewParaSet );
+ setPropertyValue( pMap, *pValues, GetSelection(), *pOldParaSet, *pNewParaSet );
- if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
+ if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
+ {
+ const SfxPoolItem* pItem;
+ if( pNewParaSet->GetItemState( pMap->nWID, true, &pItem ) == SfxItemState::SET )
{
- const SfxPoolItem* pItem;
- if( pNewParaSet->GetItemState( pMap->nWID, true, &pItem ) == SfxItemState::SET )
- {
- pOldParaSet->Put( *pItem );
- }
+ pOldParaSet->Put( *pItem );
}
-
}
+
}
}
+ }
- bool bNeedsUpdate = false;
+ bool bNeedsUpdate = false;
- if( pNewParaSet )
+ if( pNewParaSet )
+ {
+ if( pNewParaSet->Count() )
{
- if( pNewParaSet->Count() )
+ while( nTempPara <= nEndPara )
{
- while( nTempPara <= nEndPara )
- {
- SfxItemSet aSet( pForwarder->GetParaAttribs( nTempPara ) );
- aSet.Put( *pNewParaSet );
- pForwarder->SetParaAttribs( nTempPara, aSet );
- nTempPara++;
- }
- bNeedsUpdate = true;
+ SfxItemSet aSet( pForwarder->GetParaAttribs( nTempPara ) );
+ aSet.Put( *pNewParaSet );
+ pForwarder->SetParaAttribs( nTempPara, aSet );
+ nTempPara++;
}
-
- pNewParaSet.reset();
- pOldParaSet.reset();
+ bNeedsUpdate = true;
}
- if( pNewAttrSet )
+ pNewParaSet.reset();
+ pOldParaSet.reset();
+ }
+
+ if( pNewAttrSet )
+ {
+ if( pNewAttrSet->Count() )
{
- if( pNewAttrSet->Count() )
- {
- pForwarder->QuickSetAttribs( *pNewAttrSet, GetSelection() );
- bNeedsUpdate = true;
- }
- pNewAttrSet.reset();
- pOldAttrSet.reset();
+ pForwarder->QuickSetAttribs( *pNewAttrSet, GetSelection() );
+ bNeedsUpdate = true;
}
-
- if( bNeedsUpdate )
- GetEditSource()->UpdateData();
+ pNewAttrSet.reset();
+ pOldAttrSet.reset();
}
+
+ if( bNeedsUpdate )
+ GetEditSource()->UpdateData();
}
uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::getPropertyValues( const uno::Sequence< OUString >& aPropertyNames )
@@ -1413,19 +1413,18 @@ void SvxUnoTextRangeBase::GotoEnd(bool Expand) throw()
CheckSelection( maSelection, mpEditSource.get() );
SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
- if( pForwarder )
- {
+ if( !pForwarder )
+ return;
- sal_Int32 nPar = pForwarder->GetParagraphCount();
- if (nPar)
- --nPar;
+ sal_Int32 nPar = pForwarder->GetParagraphCount();
+ if (nPar)
+ --nPar;
- maSelection.nEndPara = nPar;
- maSelection.nEndPos = pForwarder->GetTextLen( nPar );
+ maSelection.nEndPara = nPar;
+ maSelection.nEndPos = pForwarder->GetTextLen( nPar );
- if (!Expand)
- CollapseToEnd();
- }
+ if (!Expand)
+ CollapseToEnd();
}
// lang::XServiceInfo
@@ -1742,20 +1741,20 @@ void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRan
}
SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange );
- if(pRange)
- {
- // setString on SvxUnoTextRangeBase instead of itself QuickInsertText
- // and UpdateData, so that the selection will be adjusted to
- // SvxUnoTextRangeBase. Actually all cursor objects of this Text must
- // to be statement to be adapted!
-
- if (!bAbsorb) // do not replace -> append on tail
- pRange->CollapseToEnd();
+ if(!pRange)
+ return;
- pRange->setString( aString );
+ // setString on SvxUnoTextRangeBase instead of itself QuickInsertText
+ // and UpdateData, so that the selection will be adjusted to
+ // SvxUnoTextRangeBase. Actually all cursor objects of this Text must
+ // to be statement to be adapted!
+ if (!bAbsorb) // do not replace -> append on tail
pRange->CollapseToEnd();
- }
+
+ pRange->setString( aString );
+
+ pRange->CollapseToEnd();
}
void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb )
@@ -1764,83 +1763,83 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text
SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : nullptr;
- if( pForwarder )
+ if( !pForwarder )
+ return;
+
+ ESelection aSelection;
+ ::GetSelection( aSelection, pForwarder );
+ SetSelection( aSelection );
+
+ switch( nControlCharacter )
{
- ESelection aSelection;
- ::GetSelection( aSelection, pForwarder );
- SetSelection( aSelection );
+ case text::ControlCharacter::PARAGRAPH_BREAK:
+ {
+ const OUString aText( u'\x000D' ); // '\r' does not work on Mac
+ insertString( xRange, aText, bAbsorb );
- switch( nControlCharacter )
- {
- case text::ControlCharacter::PARAGRAPH_BREAK:
+ return;
+ }
+ case text::ControlCharacter::LINE_BREAK:
+ {
+ SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange );
+ if(pRange)
{
- const OUString aText( u'\x000D' ); // '\r' does not work on Mac
- insertString( xRange, aText, bAbsorb );
+ ESelection aRange = pRange->GetSelection();
- return;
- }
- case text::ControlCharacter::LINE_BREAK:
- {
- SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange );
- if(pRange)
+ if( bAbsorb )
{
- ESelection aRange = pRange->GetSelection();
+ pForwarder->QuickInsertText( "", aRange );
- if( bAbsorb )
- {
- pForwarder->QuickInsertText( "", aRange );
-
- aRange.nEndPos = aRange.nStartPos;
- aRange.nEndPara = aRange.nStartPara;
- }
- else
- {
- aRange.nStartPara = aRange.nEndPara;
- aRange.nStartPos = aRange.nEndPos;
- }
+ aRange.nEndPos = aRange.nStartPos;
+ aRange.nEndPara = aRange.nStartPara;
+ }
+ else
+ {
+ aRange.nStartPara = aRange.nEndPara;
+ aRange.nStartPos = aRange.nEndPos;
+ }
- pForwarder->QuickInsertLineBreak( aRange );
- GetEditSource()->UpdateData();
+ pForwarder->QuickInsertLineBreak( aRange );
+ GetEditSource()->UpdateData();
- aRange.nEndPos += 1;
- if( !bAbsorb )
- aRange.nStartPos += 1;
+ aRange.nEndPos += 1;
+ if( !bAbsorb )
+ aRange.nStartPos += 1;
- pRange->SetSelection( aRange );
- }
- return;
+ pRange->SetSelection( aRange );
}
- case text::ControlCharacter::APPEND_PARAGRAPH:
+ return;
+ }
+ case text::ControlCharacter::APPEND_PARAGRAPH:
+ {
+ SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange );
+ if(pRange)
{
- SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange );
- if(pRange)
- {
- ESelection aRange = pRange->GetSelection();
+ ESelection aRange = pRange->GetSelection();
// ESelection aOldSelection = aRange;
- aRange.nStartPos = pForwarder->GetTextLen( aRange.nStartPara );
+ aRange.nStartPos = pForwarder->GetTextLen( aRange.nStartPara );
- aRange.nEndPara = aRange.nStartPara;
- aRange.nEndPos = aRange.nStartPos;
+ aRange.nEndPara = aRange.nStartPara;
+ aRange.nEndPos = aRange.nStartPos;
- pRange->SetSelection( aRange );
- const OUString aText( u'\x000D' ); // '\r' does not work on Mac
- pRange->setString( aText );
+ pRange->SetSelection( aRange );
+ const OUString aText( u'\x000D' ); // '\r' does not work on Mac
+ pRange->setString( aText );
- aRange.nStartPos = 0;
- aRange.nStartPara += 1;
- aRange.nEndPos = 0;
- aRange.nEndPara += 1;
+ aRange.nStartPos = 0;
+ aRange.nStartPara += 1;
+ aRange.nEndPos = 0;
+ aRange.nEndPara += 1;
- pRange->SetSelection( aRange );
+ pRange->SetSelection( aRange );
- return;
- }
- [[fallthrough]];
- }
- default:
- throw lang::IllegalArgumentException();
+ return;
}
+ [[fallthrough]];
+ }
+ default:
+ throw lang::IllegalArgumentException();
}
}
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index 933c95002513..eb0d377140c8 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -382,42 +382,42 @@ SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration(const SvxUnoTextBase& rPa
if (rParentText.GetEditSource())
mpEditSource = rParentText.GetEditSource()->Clone();
- if( mpEditSource && mpEditSource->GetTextForwarder() && (nParagraph == rSel.nStartPara && nParagraph == rSel.nEndPara) )
+ if( !(mpEditSource && mpEditSource->GetTextForwarder() && (nParagraph == rSel.nStartPara && nParagraph == rSel.nEndPara)) )
+ return;
+
+ std::vector<sal_Int32> aPortions;
+ mpEditSource->GetTextForwarder()->GetPortions( nParagraph, aPortions );
+ for( size_t aPortionIndex = 0; aPortionIndex < aPortions.size(); aPortionIndex++ )
{
- std::vector<sal_Int32> aPortions;
- mpEditSource->GetTextForwarder()->GetPortions( nParagraph, aPortions );
- for( size_t aPortionIndex = 0; aPortionIndex < aPortions.size(); aPortionIndex++ )
+ sal_uInt16 nStartPos = 0;
+ if ( aPortionIndex > 0 )
+ nStartPos = aPortions.at( aPortionIndex - 1 );
+ if( nStartPos > rSel.nEndPos )
+ continue;
+ sal_uInt16 nEndPos = aPortions.at( aPortionIndex );
+ if( nEndPos < rSel.nStartPos )
+ continue;
+
+ nStartPos = std::max<int>(nStartPos, rSel.nStartPos);
+ nEndPos = std::min<sal_uInt16>(nEndPos, rSel.nEndPos);
+ ESelection aSel( nParagraph, nStartPos, nParagraph, nEndPos );
+
+ const SvxUnoTextRangeBaseVec& rRanges( mpEditSource->getRanges() );
+ SvxUnoTextRange* pRange = nullptr;
+ for (auto const& elemRange : rRanges)
{
- sal_uInt16 nStartPos = 0;
- if ( aPortionIndex > 0 )
- nStartPos = aPortions.at( aPortionIndex - 1 );
- if( nStartPos > rSel.nEndPos )
- continue;
- sal_uInt16 nEndPos = aPortions.at( aPortionIndex );
- if( nEndPos < rSel.nStartPos )
- continue;
-
- nStartPos = std::max<int>(nStartPos, rSel.nStartPos);
- nEndPos = std::min<sal_uInt16>(nEndPos, rSel.nEndPos);
- ESelection aSel( nParagraph, nStartPos, nParagraph, nEndPos );
-
- const SvxUnoTextRangeBaseVec& rRanges( mpEditSource->getRanges() );
- SvxUnoTextRange* pRange = nullptr;
- for (auto const& elemRange : rRanges)
- {
- if (pRange)
- break;
- SvxUnoTextRange* pIterRange = dynamic_cast< SvxUnoTextRange* >( elemRange );
- if( pIterRange && pIterRange->mbPortion && (aSel == pIterRange->maSelection) )
- pRange = pIterRange;
- }
- if( pRange == nullptr )
- {
- pRange = new SvxUnoTextRange( rParentText, true );
- pRange->SetSelection( aSel );
- }
- maPortions.emplace_back(pRange );
+ if (pRange)
+ break;
+ SvxUnoTextRange* pIterRange = dynamic_cast< SvxUnoTextRange* >( elemRange );
+ if( pIterRange && pIterRange->mbPortion && (aSel == pIterRange->maSelection) )
+ pRange = pIterRange;
+ }
+ if( pRange == nullptr )
+ {
+ pRange = new SvxUnoTextRange( rParentText, true );
+ pRange->SetSelection( aSel );
}
+ maPortions.emplace_back(pRange );
}
}
@@ -589,19 +589,19 @@ void SAL_CALL SvxUnoTextCursor::gotoRange( const uno::Reference< text::XTextRang
SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( xRange );
- if( pRange )
- {
- ESelection aNewSel = pRange->GetSelection();
+ if( !pRange )
+ return;
- if( bExpand )
- {
- const ESelection& rOldSel = GetSelection();
- aNewSel.nStartPara = rOldSel.nStartPara;
- aNewSel.nStartPos = rOldSel.nStartPos;
- }
+ ESelection aNewSel = pRange->GetSelection();
- SetSelection( aNewSel );
+ if( bExpand )
+ {
+ const ESelection& rOldSel = GetSelection();
+ aNewSel.nStartPara = rOldSel.nStartPara;
+ aNewSel.nStartPos = rOldSel.nStartPos;
}
+
+ SetSelection( aNewSel );
}
// text::XTextRange (rest in SvxTextRange)