summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/ContentNode.hxx2
-rw-r--r--editeng/inc/outleeng.hxx8
-rw-r--r--editeng/source/accessibility/AccessibleEditableTextPara.cxx2
-rw-r--r--editeng/source/accessibility/AccessibleHyperlink.cxx25
-rw-r--r--editeng/source/editeng/ContentNode.cxx2
-rw-r--r--editeng/source/editeng/editdoc.cxx2
-rw-r--r--editeng/source/editeng/editobj.cxx4
-rw-r--r--editeng/source/editeng/editobj2.hxx2
-rw-r--r--editeng/source/editeng/impedit.cxx18
-rw-r--r--editeng/source/editeng/impedit3.cxx2
-rw-r--r--editeng/source/items/paraitem.cxx25
-rw-r--r--editeng/source/outliner/outlin2.cxx2
-rw-r--r--editeng/source/outliner/outliner.cxx12
-rw-r--r--editeng/source/uno/unoipset.cxx2
-rw-r--r--editeng/source/uno/unotext.cxx195
-rw-r--r--editeng/source/uno/unotext2.cxx8
16 files changed, 159 insertions, 152 deletions
diff --git a/editeng/inc/ContentNode.hxx b/editeng/inc/ContentNode.hxx
index 6b764ccbb524..b802be9c87a8 100644
--- a/editeng/inc/ContentNode.hxx
+++ b/editeng/inc/ContentNode.hxx
@@ -38,7 +38,7 @@ class ContentAttribs
{
private:
SfxStyleSheet* mpStyle = nullptr;
- SfxItemSetFixed<EE_PARA_START, EE_CHAR_END> maAttribSet;
+ SfxItemSet maAttribSet;
public:
ContentAttribs(SfxItemPool& rItemPool);
diff --git a/editeng/inc/outleeng.hxx b/editeng/inc/outleeng.hxx
index fe118d78ed92..892c336d3290 100644
--- a/editeng/inc/outleeng.hxx
+++ b/editeng/inc/outleeng.hxx
@@ -21,10 +21,6 @@
#include <editeng/outliner.hxx>
#include <editeng/editeng.hxx>
-enum class SdrCompatibilityFlag;
-
-typedef std::vector<EENotify> NotifyList;
-
class OutlinerEditEng : public EditEngine
{
Outliner* pOwner;
@@ -75,10 +71,6 @@ public:
std::optional<bool> GetCompatFlag(SdrCompatibilityFlag eFlag) const;
virtual void SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet ) override;
-
- // belongs into class Outliner, move there before incompatible update!
- Link<EENotify&,void> aOutlinerNotifyHdl;
- NotifyList aNotifyCache;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 887648433d36..81872f50a969 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -2510,7 +2510,7 @@ namespace accessibility
css::uno::Reference< css::accessibility::XAccessibleHyperlink > SAL_CALL AccessibleEditableTextPara::getHyperLink( ::sal_Int32 nLinkIndex )
{
- css::uno::Reference< css::accessibility::XAccessibleHyperlink > xRef;
+ rtl::Reference< AccessibleHyperlink > xRef;
SvxAccessibleTextAdapter& rT = GetTextForwarder();
const sal_Int32 nPara = GetParagraphIndex();
diff --git a/editeng/source/accessibility/AccessibleHyperlink.cxx b/editeng/source/accessibility/AccessibleHyperlink.cxx
index 25d9683fceff..52f45dc44ff3 100644
--- a/editeng/source/accessibility/AccessibleHyperlink.cxx
+++ b/editeng/source/accessibility/AccessibleHyperlink.cxx
@@ -78,22 +78,19 @@ namespace accessibility
uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL AccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex )
{
- uno::Reference< css::accessibility::XAccessibleKeyBinding > xKeyBinding;
+ if( !isValid() || ( nIndex != 0 ) )
+ return nullptr;
- if( isValid() && ( nIndex == 0 ) )
- {
- rtl::Reference<::comphelper::OAccessibleKeyBindingHelper> pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper();
- xKeyBinding = pKeyBindingHelper;
-
- awt::KeyStroke aKeyStroke;
- aKeyStroke.Modifiers = 0;
- aKeyStroke.KeyCode = KEY_RETURN;
- aKeyStroke.KeyChar = 0;
- aKeyStroke.KeyFunc = 0;
- pKeyBindingHelper->AddKeyBinding( aKeyStroke );
- }
+ rtl::Reference<::comphelper::OAccessibleKeyBindingHelper> pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper();
+
+ awt::KeyStroke aKeyStroke;
+ aKeyStroke.Modifiers = 0;
+ aKeyStroke.KeyCode = KEY_RETURN;
+ aKeyStroke.KeyChar = 0;
+ aKeyStroke.KeyFunc = 0;
+ pKeyBindingHelper->AddKeyBinding( aKeyStroke );
- return xKeyBinding;
+ return pKeyBindingHelper;
}
// XAccessibleHyperlink
diff --git a/editeng/source/editeng/ContentNode.cxx b/editeng/source/editeng/ContentNode.cxx
index 3721016db04c..8937b39002c7 100644
--- a/editeng/source/editeng/ContentNode.cxx
+++ b/editeng/source/editeng/ContentNode.cxx
@@ -649,7 +649,7 @@ void ContentNode::checkAndDeleteEmptyAttribs() const
}
ContentAttribs::ContentAttribs( SfxItemPool& rPool )
- : maAttribSet(rPool)
+ : maAttribSet(SfxItemSet::makeFixedSfxItemSet<EE_PARA_START, EE_CHAR_END>(rPool))
{
}
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index b2c83ccde7e7..a34ca78d810d 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -812,7 +812,7 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S
void EditDoc::CreateDefFont( bool bUseStyles )
{
- SfxItemSetFixed<EE_PARA_START, EE_CHAR_END> aTmpSet( GetItemPool() );
+ SfxItemSet aTmpSet(SfxItemSet::makeFixedSfxItemSet<EE_PARA_START, EE_CHAR_END>(GetItemPool()));
CreateFont(maDefFont, aTmpSet);
maDefFont.SetVertical( IsEffectivelyVertical() );
maDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? (IsTopToBottom() ? 2700 : 900) : 0) );
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 536d7c2c6acb..858dec873a9e 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -87,7 +87,7 @@ const XParaPortion& XParaPortionList::operator [](size_t i) const
ContentInfo::ContentInfo( SfxItemPool& rPool ) :
eFamily(SfxStyleFamily::Para),
- aParaAttribs(rPool)
+ aParaAttribs(SfxItemSet::makeFixedSfxItemSet<EE_PARA_START, EE_CHAR_END>(rPool))
{
}
@@ -96,7 +96,7 @@ ContentInfo::ContentInfo( const ContentInfo& rCopyFrom, SfxItemPool& rPoolToUse
maText(rCopyFrom.maText),
aStyle(rCopyFrom.aStyle),
eFamily(rCopyFrom.eFamily),
- aParaAttribs(rPoolToUse)
+ aParaAttribs(SfxItemSet::makeFixedSfxItemSet<EE_PARA_START, EE_CHAR_END>(rPoolToUse))
{
// this should ensure that the Items end up in the correct Pool!
aParaAttribs.Set( rCopyFrom.GetParaAttribs() );
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index 9cfe1c09f5e5..30797fb8f238 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -125,7 +125,7 @@ private:
std::vector<XEditAttribute> maCharAttribs;
SfxStyleFamily eFamily;
- SfxItemSetFixed<EE_PARA_START, EE_CHAR_END> aParaAttribs;
+ SfxItemSet aParaAttribs;
std::unique_ptr<WrongList>
mpWrongs;
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index f67073380470..337183d04ac3 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -858,11 +858,19 @@ weld::Widget* ImpEditView::GetPopupParent(tools::Rectangle& rRect) const
void ImpEditView::SetOutputArea( const tools::Rectangle& rRect )
{
- const OutputDevice& rOutDev = GetOutputDevice();
- // should be better be aligned on pixels!
- tools::Rectangle aNewRect(rOutDev.LogicToPixel(rRect));
- aNewRect = rOutDev.PixelToLogic(aNewRect);
- maOutputArea = aNewRect;
+ // Here a PixelSnap was used before using GetOutputDevice() and
+ // LogicToPixel/PixelToLogic (what was incorrect, would need
+ // to take care of 1/2 pixel in logic for rounding). We do not
+ // need that anymore, in fact it leads to text slightly
+ // 'jumping' around by up to 1 pixel (of course).
+ // We paint text nowadays using decomposed TextPrimitives
+ // with sub-pixel precision and similar (using a shortcut)
+ // for text in TextEdit on the Overlay, also using sub-pixel
+ // precision. Just remove this to avoid Text being displayed
+ // different in TextEdit and EditView paint visualizations
+ // and assign given value to OutputArea unchanged.
+ maOutputArea = rRect;
+
if (!maOutputArea.IsWidthEmpty() && maOutputArea.Right() < maOutputArea.Left())
maOutputArea.SetRight(maOutputArea.Left());
if (!maOutputArea.IsHeightEmpty() && maOutputArea.Bottom() < maOutputArea.Top())
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 699389cebbaa..6b86cbd0962b 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3931,7 +3931,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po
tools::Rectangle aRect(aTopLeft, rTextPortion.GetSize());
vcl::PDFExtOutDevBookmarkEntry aBookmark;
- aBookmark.nLinkId = pPDFExtOutDevData->CreateLink(aRect, pUrlField->GetRepresentation());
+ aBookmark.nLinkId = pPDFExtOutDevData->CreateLink(aRect, pUrlField->GetName());
aBookmark.aBookmark = pUrlField->GetURL();
std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks();
rBookmarks.push_back(aBookmark);
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index d06255ea3e89..91c30e5b55e1 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -594,6 +594,7 @@ SvxHyphenZoneItem::SvxHyphenZoneItem( const bool bHyph, const sal_uInt16 nId ) :
nMinWordLength(0),
nTextHyphenZone(0),
nKeepType(css::text::ParagraphHyphenationKeepType::COLUMN),
+ bKeepLine(false),
nCompoundMinLead(0)
{
}
@@ -634,6 +635,9 @@ bool SvxHyphenZoneItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) con
case MID_HYPHEN_KEEP_TYPE:
rVal <<= static_cast<sal_Int16>(nKeepType);
break;
+ case MID_HYPHEN_KEEP_LINE:
+ rVal <<= bKeepLine;
+ break;
case MID_HYPHEN_COMPOUND_MIN_LEAD:
rVal <<= static_cast<sal_Int16>(nCompoundMinLead);
break;
@@ -647,7 +651,8 @@ bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
sal_Int32 nNewVal = 0; // sal_Int32 needs for MID_HYPHEN_KEEP_TYPE
if( nMemberId != MID_IS_HYPHEN && nMemberId != MID_HYPHEN_NO_CAPS &&
- nMemberId != MID_HYPHEN_NO_LAST_WORD && nMemberId != MID_HYPHEN_KEEP )
+ nMemberId != MID_HYPHEN_NO_LAST_WORD && nMemberId != MID_HYPHEN_KEEP &&
+ nMemberId != MID_HYPHEN_KEEP_LINE )
{
if(!(rVal >>= nNewVal))
return false;
@@ -685,6 +690,9 @@ bool SvxHyphenZoneItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
case MID_HYPHEN_KEEP_TYPE:
nKeepType = static_cast<sal_uInt8>(nNewVal);
break;
+ case MID_HYPHEN_KEEP_LINE:
+ bKeepLine = Any2Bool(rVal);
+ break;
case MID_HYPHEN_COMPOUND_MIN_LEAD:
nCompoundMinLead = static_cast<sal_uInt8>(nNewVal);
break;
@@ -708,6 +716,7 @@ bool SvxHyphenZoneItem::operator==( const SfxPoolItem& rAttr ) const
&& rItem.nMaxHyphens == nMaxHyphens
&& rItem.nMinWordLength == nMinWordLength
&& rItem.nTextHyphenZone == nTextHyphenZone
+ && rItem.bKeepLine == bKeepLine
&& rItem.nKeepType == nKeepType );
}
@@ -748,10 +757,18 @@ bool SvxHyphenZoneItem::GetPresentation
rText += cpDelimTmp + EditResId(RID_SVXITEMS_HYPHEN_LAST_WORD_TRUE);
if ( bKeep )
+ {
rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_TRUE) +
cpDelimTmp + OUString::number( nKeepType );
+ if ( bKeepLine )
+ rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_LINE_TRUE);
+ else
+ rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_LINE_FALSE);
+ }
else
rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_FALSE);
+
+
return true;
}
case SfxItemPresentation::Complete:
@@ -788,6 +805,7 @@ bool SvxHyphenZoneItem::GetPresentation
if ( bKeep )
{
rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_TRUE) + cpDelimTmp;
+
switch ( nKeepType )
{
case 0:
@@ -806,6 +824,11 @@ bool SvxHyphenZoneItem::GetPresentation
rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_ALWAYS);
break;
}
+
+ if ( bKeepLine )
+ rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_LINE_TRUE);
+ else
+ rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_LINE_FALSE);
}
else
rText += EditResId(RID_SVXITEMS_HYPHEN_KEEP_FALSE);
diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx
index 18bf47edfe3f..eb9d54c849a9 100644
--- a/editeng/source/outliner/outlin2.cxx
+++ b/editeng/source/outliner/outlin2.cxx
@@ -110,7 +110,7 @@ void Outliner::SetModifyHdl( const Link<LinkParamNone*,void>& rLink )
void Outliner::SetNotifyHdl( const Link<EENotify&,void>& rLink )
{
- pEditEngine->aOutlinerNotifyHdl = rLink;
+ aOutlinerNotifyHdl = rLink;
if ( rLink.IsSet() )
pEditEngine->SetNotifyHdl( LINK( this, Outliner, EditEngineNotifyHdl ) );
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 4ff4c5a46751..b1e65c95219f 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -1903,12 +1903,12 @@ void Outliner::ImplBlockInsertionCallbacks( bool b )
if ( !nBlockInsCallback )
{
// Call blocked notify events...
- while(!pEditEngine->aNotifyCache.empty())
+ while(!aNotifyCache.empty())
{
- EENotify aNotify(pEditEngine->aNotifyCache.front());
+ EENotify aNotify(aNotifyCache.front());
// Remove from list before calling, maybe we enter LeaveBlockNotifications while calling the handler...
- pEditEngine->aNotifyCache.erase(pEditEngine->aNotifyCache.begin());
- pEditEngine->aOutlinerNotifyHdl.Call( aNotify );
+ aNotifyCache.erase(aNotifyCache.begin());
+ aOutlinerNotifyHdl.Call( aNotify );
}
}
}
@@ -1917,9 +1917,9 @@ void Outliner::ImplBlockInsertionCallbacks( bool b )
IMPL_LINK( Outliner, EditEngineNotifyHdl, EENotify&, rNotify, void )
{
if ( !nBlockInsCallback )
- pEditEngine->aOutlinerNotifyHdl.Call( rNotify );
+ aOutlinerNotifyHdl.Call( rNotify );
else
- pEditEngine->aNotifyCache.push_back(rNotify);
+ aNotifyCache.push_back(rNotify);
}
/** sets a link that is called at the beginning of a drag operation at an edit view */
diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx
index 43cb71aa0a86..60d73b7653fb 100644
--- a/editeng/source/uno/unoipset.cxx
+++ b/editeng/source/uno/unoipset.cxx
@@ -209,7 +209,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertyMapEntry* pMap,
}
-const SfxItemPropertyMapEntry* SvxItemPropertySet::getPropertyMapEntry(const OUString& rName) const
+const SfxItemPropertyMapEntry* SvxItemPropertySet::getPropertyMapEntry(std::u16string_view rName) const
{
return m_aPropertyMap.getByName( rName );
}
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index c80399609572..91efa5db50c0 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -300,53 +300,47 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart()
{
SolarMutexGuard aGuard;
- uno::Reference< text::XTextRange > xRange;
-
SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
- if( pForwarder )
- {
- CheckSelection( maSelection, pForwarder );
+ if( !pForwarder )
+ return nullptr;
- SvxUnoTextBase* pText = comphelper::getFromUnoTunnel<SvxUnoTextBase>( getText() );
+ CheckSelection( maSelection, pForwarder );
- if(pText == nullptr)
- throw uno::RuntimeException(u"Failed to retrieve a valid text base object from the Uno Tunnel"_ustr);
+ SvxUnoTextBase* pText = comphelper::getFromUnoTunnel<SvxUnoTextBase>( getText() );
- rtl::Reference<SvxUnoTextRange> pRange = new SvxUnoTextRange( *pText );
- xRange = pRange;
+ if(pText == nullptr)
+ throw uno::RuntimeException(u"Failed to retrieve a valid text base object from the Uno Tunnel"_ustr);
- ESelection aNewSel = maSelection;
- aNewSel.CollapseToStart();
- pRange->SetSelection( aNewSel );
- }
+ rtl::Reference<SvxUnoTextRange> pRange = new SvxUnoTextRange( *pText );
- return xRange;
+ ESelection aNewSel = maSelection;
+ aNewSel.CollapseToStart();
+ pRange->SetSelection( aNewSel );
+
+ return pRange;
}
uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd()
{
SolarMutexGuard aGuard;
- uno::Reference< text::XTextRange > xRet;
-
SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
- if( pForwarder )
- {
- CheckSelection( maSelection, pForwarder );
+ if( !pForwarder )
+ return nullptr;
- SvxUnoTextBase* pText = comphelper::getFromUnoTunnel<SvxUnoTextBase>( getText() );
+ CheckSelection( maSelection, pForwarder );
- if(pText == nullptr)
- throw uno::RuntimeException(u"Failed to retrieve a valid text base object from the Uno Tunnel"_ustr);
+ SvxUnoTextBase* pText = comphelper::getFromUnoTunnel<SvxUnoTextBase>( getText() );
- rtl::Reference<SvxUnoTextRange> pNew = new SvxUnoTextRange( *pText );
- xRet = pNew;
+ if(pText == nullptr)
+ throw uno::RuntimeException(u"Failed to retrieve a valid text base object from the Uno Tunnel"_ustr);
- ESelection aNewSel = maSelection;
- aNewSel.CollapseToEnd();
- pNew->SetSelection( aNewSel );
- }
- return xRet;
+ rtl::Reference<SvxUnoTextRange> pNew = new SvxUnoTextRange( *pText );
+
+ ESelection aNewSel = maSelection;
+ aNewSel.CollapseToEnd();
+ pNew->SetSelection( aNewSel );
+ return pNew;
}
OUString SAL_CALL SvxUnoTextRangeBase::getString()
@@ -1058,7 +1052,7 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert
throw beans::UnknownPropertyException();
}
-beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const OUString& PropertyName, sal_Int32 nPara /* = -1 */)
+beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(std::u16string_view PropertyName, sal_Int32 nPara /* = -1 */)
{
SolarMutexGuard aGuard;
@@ -1364,9 +1358,9 @@ void SAL_CALL SvxUnoTextRangeBase::setAllPropertiesToDefault()
if( pForwarder )
{
- for (auto const & rPair : mpPropSet->getPropertyMap().getPropertyEntries())
+ for (const SfxItemPropertyMapEntry* entry : mpPropSet->getPropertyMap().getPropertyEntries())
{
- _setPropertyToDefault( pForwarder, rPair.second, -1 );
+ _setPropertyToDefault( pForwarder, entry, -1 );
}
}
}
@@ -2071,28 +2065,26 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph(
{
SolarMutexGuard aGuard;
- uno::Reference< text::XTextRange > xRet;
SvxEditSource *pEditSource = GetEditSource();
SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : nullptr;
- if (pTextForwarder)
- {
- sal_Int32 nParaCount = pTextForwarder->GetParagraphCount();
- DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
- pTextForwarder->AppendParagraph();
-
- // set properties for the previously last paragraph
- sal_Int32 nPara = nParaCount - 1;
- ESelection aSel(nPara, 0);
- SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
- SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
- ImplGetSvxUnoOutlinerTextCursorSfxPropertySet(), pTextForwarder, nPara );
- pTextForwarder->QuickSetAttribs( aItemSet, aSel );
- pEditSource->UpdateData();
- rtl::Reference<SvxUnoTextRange> pRange = new SvxUnoTextRange( *this );
- xRet = pRange;
- pRange->SetSelection( aSel );
- }
- return xRet;
+ if (!pTextForwarder)
+ return nullptr;
+
+ sal_Int32 nParaCount = pTextForwarder->GetParagraphCount();
+ DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
+ pTextForwarder->AppendParagraph();
+
+ // set properties for the previously last paragraph
+ sal_Int32 nPara = nParaCount - 1;
+ ESelection aSel(nPara, 0);
+ SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
+ SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
+ ImplGetSvxUnoOutlinerTextCursorSfxPropertySet(), pTextForwarder, nPara );
+ pTextForwarder->QuickSetAttribs( aItemSet, aSel );
+ pEditSource->UpdateData();
+ rtl::Reference<SvxUnoTextRange> pRange = new SvxUnoTextRange( *this );
+ pRange->SetSelection( aSel );
+ return pRange;
}
uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::insertTextPortion(
@@ -2102,38 +2094,35 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::insertTextPortion(
{
SolarMutexGuard aGuard;
- uno::Reference< text::XTextRange > xRet;
-
if (!rTextRange.is())
- return xRet;
+ return nullptr;
SvxUnoTextRangeBase* pRange = comphelper::getFromUnoTunnel<SvxUnoTextRange>(rTextRange);
if (!pRange)
- return xRet;
+ return nullptr;
SvxEditSource *pEditSource = GetEditSource();
SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : nullptr;
- if (pTextForwarder)
- {
- pRange->setString(rText);
-
- ESelection aSelection(pRange->GetSelection());
-
- pTextForwarder->RemoveAttribs(aSelection);
- pEditSource->UpdateData();
-
- SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
- SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
- ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, aSelection.start.nPara );
- pTextForwarder->QuickSetAttribs( aItemSet, aSelection);
- rtl::Reference<SvxUnoTextRange> pNewRange = new SvxUnoTextRange( *this );
- xRet = pNewRange;
- pNewRange->SetSelection(aSelection);
- for( const beans::PropertyValue& rProp : rCharAndParaProps )
- pNewRange->setPropertyValue( rProp.Name, rProp.Value );
- }
- return xRet;
+ if (!pTextForwarder)
+ return nullptr;
+
+ pRange->setString(rText);
+
+ ESelection aSelection(pRange->GetSelection());
+
+ pTextForwarder->RemoveAttribs(aSelection);
+ pEditSource->UpdateData();
+
+ SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
+ SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
+ ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, aSelection.start.nPara );
+ pTextForwarder->QuickSetAttribs( aItemSet, aSelection);
+ rtl::Reference<SvxUnoTextRange> pNewRange = new SvxUnoTextRange( *this );
+ pNewRange->SetSelection(aSelection);
+ for( const beans::PropertyValue& rProp : rCharAndParaProps )
+ pNewRange->setPropertyValue( rProp.Name, rProp.Value );
+ return pNewRange;
}
// css::text::XTextPortionAppend (new import API)
@@ -2145,33 +2134,31 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion(
SvxEditSource *pEditSource = GetEditSource();
SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : nullptr;
- uno::Reference< text::XTextRange > xRet;
- if (pTextForwarder)
- {
- sal_Int32 nParaCount = pTextForwarder->GetParagraphCount();
- DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
- sal_Int32 nPara = nParaCount - 1;
- SfxItemSet aSet( pTextForwarder->GetParaAttribs( nPara ) );
- sal_Int32 nStart = pTextForwarder->AppendTextPortion( nPara, rText, aSet );
- pEditSource->UpdateData();
- sal_Int32 nEnd = pTextForwarder->GetTextLen( nPara );
-
- // set properties for the new text portion
- ESelection aSel( nPara, nStart, nPara, nEnd );
- pTextForwarder->RemoveAttribs( aSel );
- pEditSource->UpdateData();
-
- SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
- SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
- ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, nPara );
- pTextForwarder->QuickSetAttribs( aItemSet, aSel );
- rtl::Reference<SvxUnoTextRange> pRange = new SvxUnoTextRange( *this );
- xRet = pRange;
- pRange->SetSelection( aSel );
- for( const beans::PropertyValue& rProp : rCharAndParaProps )
- pRange->setPropertyValue( rProp.Name, rProp.Value );
- }
- return xRet;
+ if (!pTextForwarder)
+ return nullptr;
+
+ sal_Int32 nParaCount = pTextForwarder->GetParagraphCount();
+ DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
+ sal_Int32 nPara = nParaCount - 1;
+ SfxItemSet aSet( pTextForwarder->GetParaAttribs( nPara ) );
+ sal_Int32 nStart = pTextForwarder->AppendTextPortion( nPara, rText, aSet );
+ pEditSource->UpdateData();
+ sal_Int32 nEnd = pTextForwarder->GetTextLen( nPara );
+
+ // set properties for the new text portion
+ ESelection aSel( nPara, nStart, nPara, nEnd );
+ pTextForwarder->RemoveAttribs( aSel );
+ pEditSource->UpdateData();
+
+ SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
+ SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
+ ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, nPara );
+ pTextForwarder->QuickSetAttribs( aItemSet, aSel );
+ rtl::Reference<SvxUnoTextRange> pRange = new SvxUnoTextRange( *this );
+ pRange->SetSelection( aSel );
+ for( const beans::PropertyValue& rProp : rCharAndParaProps )
+ pRange->setPropertyValue( rProp.Name, rProp.Value );
+ return pRange;
}
void SvxUnoTextBase::copyText(
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index 5cfea9d63173..53fb94bfa23c 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -109,9 +109,9 @@ uno::Any SvxUnoTextContentEnumeration::nextElement()
if(!hasMoreElements())
throw container::NoSuchElementException();
- uno::Reference< text::XTextContent > xRef( maContents.at(mnNextParagraph) );
+ rtl::Reference< SvxUnoTextContent > xRef( maContents.at(mnNextParagraph) );
mnNextParagraph++;
- return uno::Any( xRef );
+ return uno::Any( uno::Reference< text::XTextContent >(xRef) );
}
@@ -433,9 +433,9 @@ uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement()
if( maPortions.empty() || mnNextPortion >= maPortions.size() )
throw container::NoSuchElementException();
- uno::Reference< text::XTextRange > xRange = maPortions.at(mnNextPortion);
+ rtl::Reference< SvxUnoTextRange > xRange = maPortions.at(mnNextPortion);
mnNextPortion++;
- return uno::Any( xRange );
+ return uno::Any( uno::Reference< text::XTextRange >(xRange) );
}
SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextBase& rText ) noexcept