summaryrefslogtreecommitdiff
path: root/editeng/source/uno
diff options
context:
space:
mode:
Diffstat (limited to 'editeng/source/uno')
-rw-r--r--editeng/source/uno/UnoForbiddenCharsTable.cxx5
-rw-r--r--editeng/source/uno/unoedprx.cxx62
-rw-r--r--editeng/source/uno/unofdesc.cxx20
-rw-r--r--editeng/source/uno/unofield.cxx127
-rw-r--r--editeng/source/uno/unofored.cxx40
-rw-r--r--editeng/source/uno/unofored_internal.hxx1
-rw-r--r--editeng/source/uno/unoforou.cxx46
-rw-r--r--editeng/source/uno/unoipset.cxx93
-rw-r--r--editeng/source/uno/unonrule.cxx86
-rw-r--r--editeng/source/uno/unotext.cxx654
-rw-r--r--editeng/source/uno/unotext2.cxx114
-rw-r--r--editeng/source/uno/unoviwou.cxx2
12 files changed, 651 insertions, 599 deletions
diff --git a/editeng/source/uno/UnoForbiddenCharsTable.cxx b/editeng/source/uno/UnoForbiddenCharsTable.cxx
index 474180f2585d..5e77a9252fe0 100644
--- a/editeng/source/uno/UnoForbiddenCharsTable.cxx
+++ b/editeng/source/uno/UnoForbiddenCharsTable.cxx
@@ -23,6 +23,7 @@
#include <editeng/UnoForbiddenCharsTable.hxx>
#include <editeng/forbiddencharacterstable.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
using namespace ::com::sun::star;
@@ -32,8 +33,8 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::i18n;
using namespace ::cppu;
-SvxUnoForbiddenCharsTable::SvxUnoForbiddenCharsTable(std::shared_ptr<SvxForbiddenCharactersTable> const & xForbiddenChars)
- : mxForbiddenChars(xForbiddenChars)
+SvxUnoForbiddenCharsTable::SvxUnoForbiddenCharsTable(std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenChars)
+ : mxForbiddenChars(std::move(xForbiddenChars))
{
}
diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx
index 8cf7d8e62417..20d5df281bce 100644
--- a/editeng/source/uno/unoedprx.cxx
+++ b/editeng/source/uno/unoedprx.cxx
@@ -52,9 +52,9 @@ public:
mnEEIndex(0),
mnFieldOffset(0),
mnFieldLen(0),
- mbInField(false),
mnBulletOffset(0),
mnBulletLen(0),
+ mbInField(false),
mbInBullet(false) {};
// Get/Set current paragraph
@@ -111,9 +111,9 @@ private:
sal_Int32 mnEEIndex;
sal_Int32 mnFieldOffset;
sal_Int32 mnFieldLen;
- bool mbInField;
sal_Int32 mnBulletOffset;
sal_Int32 mnBulletLen;
+ bool mbInField;
bool mbInBullet;
};
@@ -530,6 +530,20 @@ void SvxAccessibleTextAdapter::GetPortions( sal_Int32 nPara, std::vector<sal_Int
mpTextForwarder->GetPortions( nPara, rList );
}
+OUString SvxAccessibleTextAdapter::GetStyleSheet(sal_Int32 nPara) const
+{
+ assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
+
+ return mpTextForwarder->GetStyleSheet(nPara);
+}
+
+void SvxAccessibleTextAdapter::SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName)
+{
+ assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
+
+ mpTextForwarder->SetStyleSheet(nPara, rStyleName);
+}
+
SfxItemState SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
@@ -613,11 +627,11 @@ SfxItemPool* SvxAccessibleTextAdapter::GetPool() const
return mpTextForwarder->GetPool();
}
-OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor )
+OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
- return mpTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
+ return mpTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle );
}
void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField )
@@ -793,7 +807,7 @@ bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int32&
aBulletInfo.bVisible &&
aBulletInfo.nType != SVX_NUM_BITMAP )
{
- if( aBulletInfo.aBounds.IsInside( rPoint) )
+ if( aBulletInfo.aBounds.Contains( rPoint) )
{
OutputDevice* pOutDev = GetRefDevice();
@@ -815,32 +829,30 @@ bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int32&
}
}
- if( aIndex.InField() )
- {
- OutputDevice* pOutDev = GetRefDevice();
+ if( !aIndex.InField() )
+ return true;
- DBG_ASSERT(pOutDev!=nullptr, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
+ OutputDevice* pOutDev = GetRefDevice();
- if( !pOutDev )
- return false;
+ DBG_ASSERT(pOutDev!=nullptr, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
- ESelection aSelection = MakeEESelection( aIndex );
- SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mpTextForwarder->GetAttribs( aSelection ) );
- AccessibleStringWrap aStringWrap( *pOutDev,
- aFont,
- mpTextForwarder->GetText( aSelection ) );
+ if( !pOutDev )
+ return false;
- tools::Rectangle aRect = mpTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
- Point aPoint = rPoint;
- aPoint.Move( -aRect.Left(), -aRect.Top() );
+ ESelection aSelection = MakeEESelection( aIndex );
+ SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mpTextForwarder->GetAttribs( aSelection ) );
+ AccessibleStringWrap aStringWrap( *pOutDev,
+ aFont,
+ mpTextForwarder->GetText( aSelection ) );
- DBG_ASSERT(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) >= 0,
- "SvxAccessibleTextIndex::SetIndex: index value overflow");
+ tools::Rectangle aRect = mpTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
+ Point aPoint = rPoint;
+ aPoint.Move( -aRect.Left(), -aRect.Top() );
- nIndex = (aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint ));
- return true;
- }
+ DBG_ASSERT(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) >= 0,
+ "SvxAccessibleTextIndex::SetIndex: index value overflow");
+ nIndex = (aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint ));
return true;
}
@@ -1055,7 +1067,7 @@ bool SvxAccessibleTextAdapter::HaveTextBullet( sal_Int32 nPara ) const
aBulletInfo.nType != SVX_NUM_BITMAP );
}
-bool SvxAccessibleTextAdapter::IsEditable( const ESelection& rSel )
+bool SvxAccessibleTextAdapter::IsEditable( const ESelection& rSel ) const
{
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
diff --git a/editeng/source/uno/unofdesc.cxx b/editeng/source/uno/unofdesc.cxx
index 0cfd7a710dcf..0022e16597af 100644
--- a/editeng/source/uno/unofdesc.cxx
+++ b/editeng/source/uno/unofdesc.cxx
@@ -192,12 +192,10 @@ void SvxUnoFontDescriptor::setPropertyToDefault( SfxItemSet& rSet )
uno::Any SvxUnoFontDescriptor::getPropertyDefault( SfxItemPool* pPool )
{
- SfxItemSet aSet(
- *pPool,
- svl::Items<
+ SfxItemSetFixed<
EE_CHAR_FONTINFO, EE_CHAR_FONTHEIGHT,
EE_CHAR_WEIGHT, EE_CHAR_ITALIC,
- EE_CHAR_WLM, EE_CHAR_WLM>{});
+ EE_CHAR_WLM, EE_CHAR_WLM> aSet(*pPool);
uno::Any aAny;
@@ -210,13 +208,13 @@ uno::Any SvxUnoFontDescriptor::getPropertyDefault( SfxItemPool* pPool )
!SfxItemPool::IsWhich(EE_CHAR_WLM))
return aAny;
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_FONTINFO));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_FONTHEIGHT));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_ITALIC));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_UNDERLINE));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_WEIGHT));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_STRIKEOUT));
- aSet.Put(pPool->GetDefaultItem(EE_CHAR_WLM));
+ aSet.Put(pPool->GetUserOrPoolDefaultItem(EE_CHAR_FONTINFO));
+ aSet.Put(pPool->GetUserOrPoolDefaultItem(EE_CHAR_FONTHEIGHT));
+ aSet.Put(pPool->GetUserOrPoolDefaultItem(EE_CHAR_ITALIC));
+ aSet.Put(pPool->GetUserOrPoolDefaultItem(EE_CHAR_UNDERLINE));
+ aSet.Put(pPool->GetUserOrPoolDefaultItem(EE_CHAR_WEIGHT));
+ aSet.Put(pPool->GetUserOrPoolDefaultItem(EE_CHAR_STRIKEOUT));
+ aSet.Put(pPool->GetUserOrPoolDefaultItem(EE_CHAR_WLM));
awt::FontDescriptor aDesc;
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index c2b0aa5bdd8d..6f2e84a9577d 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -17,8 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <string_view>
+
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/text/FilenameDisplayFormat.hpp>
+#include <o3tl/string_view.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <tools/debug.hxx>
#include <svl/itemprop.hxx>
@@ -71,73 +77,61 @@ static const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
{
static const SfxItemPropertyMapEntry aExDateTimeFieldPropertyMap_Impl[] =
{
- { u"" UNO_TC_PROP_DATE_TIME, WID_DATE, ::cppu::UnoType<util::DateTime>::get(), 0, 0 },
- { u"" UNO_TC_PROP_IS_FIXED, WID_BOOL1, cppu::UnoType<bool>::get(), 0, 0 },
- { u"" UNO_TC_PROP_IS_DATE, WID_BOOL2, cppu::UnoType<bool>::get(), 0, 0 },
- { u"" UNO_TC_PROP_NUMFORMAT, WID_INT32, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
- { u"", 0, css::uno::Type(), 0, 0 }
+ { UNO_TC_PROP_DATE_TIME, WID_DATE, ::cppu::UnoType<util::DateTime>::get(), 0, 0 },
+ { UNO_TC_PROP_IS_FIXED, WID_BOOL1, cppu::UnoType<bool>::get(), 0, 0 },
+ { UNO_TC_PROP_IS_DATE, WID_BOOL2, cppu::UnoType<bool>::get(), 0, 0 },
+ { UNO_TC_PROP_NUMFORMAT, WID_INT32, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
};
static const SfxItemPropertySet aExDateTimeFieldPropertySet_Impl(aExDateTimeFieldPropertyMap_Impl);
static const SfxItemPropertyMapEntry aDateTimeFieldPropertyMap_Impl[] =
{
- { u"" UNO_TC_PROP_IS_DATE, WID_BOOL2, cppu::UnoType<bool>::get(), 0, 0 },
- { u"", 0, css::uno::Type(), 0, 0 }
+ { UNO_TC_PROP_IS_DATE, WID_BOOL2, cppu::UnoType<bool>::get(), 0, 0 },
};
static const SfxItemPropertySet aDateTimeFieldPropertySet_Impl(aDateTimeFieldPropertyMap_Impl);
static const SfxItemPropertyMapEntry aUrlFieldPropertyMap_Impl[] =
{
-
- { u"" UNO_TC_PROP_URL_FORMAT, WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
- { u"" UNO_TC_PROP_URL_REPRESENTATION, WID_STRING1, ::cppu::UnoType<OUString>::get(), 0, 0 },
- { u"" UNO_TC_PROP_URL_TARGET, WID_STRING2, ::cppu::UnoType<OUString>::get(), 0, 0 },
- { u"" UNO_TC_PROP_URL, WID_STRING3, ::cppu::UnoType<OUString>::get(), 0, 0 },
- { u"", 0, css::uno::Type(), 0, 0 }
+ { UNO_TC_PROP_URL_FORMAT, WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
+ { UNO_TC_PROP_URL_REPRESENTATION, WID_STRING1, ::cppu::UnoType<OUString>::get(), 0, 0 },
+ { UNO_TC_PROP_URL_TARGET, WID_STRING2, ::cppu::UnoType<OUString>::get(), 0, 0 },
+ { UNO_TC_PROP_URL, WID_STRING3, ::cppu::UnoType<OUString>::get(), 0, 0 },
};
static const SfxItemPropertySet aUrlFieldPropertySet_Impl(aUrlFieldPropertyMap_Impl);
- static const SfxItemPropertyMapEntry aEmptyPropertyMap_Impl[] =
- {
- { u"", 0, css::uno::Type(), 0, 0 }
- };
- static const SfxItemPropertySet aEmptyPropertySet_Impl(aEmptyPropertyMap_Impl);
+ static const SfxItemPropertySet aEmptyPropertySet_Impl({});
static const SfxItemPropertyMapEntry aExtFileFieldPropertyMap_Impl[] =
{
- { u"" UNO_TC_PROP_IS_FIXED, WID_BOOL1, cppu::UnoType<bool>::get(), 0, 0 },
- { u"" UNO_TC_PROP_FILE_FORMAT, WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
- { u"" UNO_TC_PROP_CURRENT_PRESENTATION, WID_STRING1, ::cppu::UnoType<OUString>::get(), 0, 0 },
- { u"", 0, css::uno::Type(), 0, 0 }
+ { UNO_TC_PROP_IS_FIXED, WID_BOOL1, cppu::UnoType<bool>::get(), 0, 0 },
+ { UNO_TC_PROP_FILE_FORMAT, WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
+ { UNO_TC_PROP_CURRENT_PRESENTATION, WID_STRING1, ::cppu::UnoType<OUString>::get(), 0, 0 },
};
static const SfxItemPropertySet aExtFileFieldPropertySet_Impl(aExtFileFieldPropertyMap_Impl);
static const SfxItemPropertyMapEntry aAuthorFieldPropertyMap_Impl[] =
{
- { u"" UNO_TC_PROP_IS_FIXED, WID_BOOL1, cppu::UnoType<bool>::get(), 0, 0 },
- { u"" UNO_TC_PROP_CURRENT_PRESENTATION, WID_STRING1,::cppu::UnoType<OUString>::get(), 0, 0 },
- { u"" UNO_TC_PROP_AUTHOR_CONTENT, WID_STRING2,::cppu::UnoType<OUString>::get(), 0, 0 },
- { u"" UNO_TC_PROP_AUTHOR_FORMAT, WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
- { u"" UNO_TC_PROP_AUTHOR_FULLNAME, WID_BOOL2, cppu::UnoType<bool>::get(), 0, 0 },
- { u"", 0, css::uno::Type(), 0, 0 }
+ { UNO_TC_PROP_IS_FIXED, WID_BOOL1, cppu::UnoType<bool>::get(), 0, 0 },
+ { UNO_TC_PROP_CURRENT_PRESENTATION, WID_STRING1,::cppu::UnoType<OUString>::get(), 0, 0 },
+ { UNO_TC_PROP_AUTHOR_CONTENT, WID_STRING2,::cppu::UnoType<OUString>::get(), 0, 0 },
+ { UNO_TC_PROP_AUTHOR_FORMAT, WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
+ { UNO_TC_PROP_AUTHOR_FULLNAME, WID_BOOL2, cppu::UnoType<bool>::get(), 0, 0 },
};
static const SfxItemPropertySet aAuthorFieldPropertySet_Impl(aAuthorFieldPropertyMap_Impl);
static const SfxItemPropertyMapEntry aMeasureFieldPropertyMap_Impl[] =
{
- { u"" UNO_TC_PROP_MEASURE_KIND, WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
- { u"", 0, css::uno::Type(), 0, 0 }
+ { UNO_TC_PROP_MEASURE_KIND, WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
};
static const SfxItemPropertySet aMeasureFieldPropertySet_Impl(aMeasureFieldPropertyMap_Impl);
static const SfxItemPropertyMapEntry aDocInfoCustomFieldPropertyMap_Impl[] =
{
- { u"" UNO_TC_PROP_NAME, WID_STRING1, cppu::UnoType<OUString>::get(), 0, 0 },
- { u"" UNO_TC_PROP_CURRENT_PRESENTATION, WID_STRING2, cppu::UnoType<OUString>::get(), 0, 0 },
- { u"" UNO_TC_PROP_IS_FIXED, WID_BOOL1, cppu::UnoType<bool>::get(), 0, 0 },
- { u"" UNO_TC_PROP_NUMFORMAT, WID_INT32, cppu::UnoType<sal_Int32>::get(), 0, 0 },
- { u"" UNO_TC_PROP_IS_FIXED_LANGUAGE, WID_BOOL2, cppu::UnoType<bool>::get(), 0, 0 },
- { u"", 0, css::uno::Type(), 0, 0 }
+ { UNO_TC_PROP_NAME, WID_STRING1, cppu::UnoType<OUString>::get(), 0, 0 },
+ { UNO_TC_PROP_CURRENT_PRESENTATION, WID_STRING2, cppu::UnoType<OUString>::get(), 0, 0 },
+ { UNO_TC_PROP_IS_FIXED, WID_BOOL1, cppu::UnoType<bool>::get(), 0, 0 },
+ { UNO_TC_PROP_NUMFORMAT, WID_INT32, cppu::UnoType<sal_Int32>::get(), 0, 0 },
+ { UNO_TC_PROP_IS_FIXED_LANGUAGE, WID_BOOL2, cppu::UnoType<bool>::get(), 0, 0 },
};
static const SfxItemPropertySet aDocInfoCustomFieldPropertySet_Impl(aDocInfoCustomFieldPropertyMap_Impl);
@@ -229,21 +223,6 @@ static tools::Time setTime( util::DateTime const & rDate )
-const css::uno::Sequence< sal_Int8 > & SvxUnoTextField::getUnoTunnelId() noexcept
-{
- static const UnoTunnelIdInit theSvxUnoTextFieldUnoTunnelId;
- return theSvxUnoTextFieldUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL SvxUnoTextField::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
-{
- if( isUnoTunnelId<SvxUnoTextField>(rId) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
- }
- return 0;
-}
-
SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) noexcept
: OComponentHelper( m_aMutex )
, mpPropSet(nullptr)
@@ -310,9 +289,9 @@ SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) noexcept
}
}
-SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > const & xAnchor, const OUString& rPresentation, const SvxFieldData* pData ) noexcept
+SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, const OUString& rPresentation, const SvxFieldData* pData ) noexcept
: OComponentHelper( m_aMutex )
-, mxAnchor( xAnchor )
+, mxAnchor(std::move( xAnchor ))
, mpPropSet(nullptr)
, mnServiceId(text::textfield::Type::UNSPECIFIED)
, mpImpl( new SvxUnoFieldData_Impl )
@@ -393,7 +372,7 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > const & xAn
break;
default:
- SAL_WARN("editeng", "Id service unknown: " << mnServiceId);
+ SAL_INFO("editeng", "Id service unknown: " << mnServiceId);
break;
}
}
@@ -557,7 +536,6 @@ uno::Any SAL_CALL SvxUnoTextField::queryAggregation( const uno::Type & rType )
else QUERYINT( text::XTextContent );
else QUERYINT( text::XTextField );
else QUERYINT( lang::XServiceInfo );
- else QUERYINT( lang::XUnoTunnel );
else
return OComponentHelper::queryAggregation( rType );
@@ -654,7 +632,7 @@ OUString SAL_CALL SvxUnoTextField::getPresentation( sal_Bool bShowCommand )
// Interface text::XTextContent
void SAL_CALL SvxUnoTextField::attach( const uno::Reference< text::XTextRange >& xTextRange )
{
- SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xTextRange );
+ SvxUnoTextRangeBase* pRange = comphelper::getFromUnoTunnel<SvxUnoTextRange>( xTextRange );
if(pRange == nullptr)
throw lang::IllegalArgumentException();
@@ -672,6 +650,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextField::getAnchor()
void SAL_CALL SvxUnoTextField::dispose()
{
OComponentHelper::dispose();
+ mxAnchor.clear();
}
void SAL_CALL SvxUnoTextField::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
@@ -753,10 +732,10 @@ uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyNam
SolarMutexGuard aGuard;
if (PropertyName == UNO_TC_PROP_ANCHOR)
- return uno::makeAny(mxAnchor);
+ return uno::Any(mxAnchor);
if (PropertyName == UNO_TC_PROP_TEXTFIELD_TYPE)
- return uno::makeAny(mnServiceId);
+ return uno::Any(mnServiceId);
uno::Any aValue;
@@ -897,63 +876,63 @@ sal_Bool SAL_CALL SvxUnoTextField::supportsService( const OUString& ServiceName
return cppu::supportsService( this, ServiceName );
}
-uno::Reference< uno::XInterface > SvxUnoTextCreateTextField( const OUString& ServiceSpecifier )
+uno::Reference< uno::XInterface > SvxUnoTextCreateTextField( std::u16string_view ServiceSpecifier )
{
uno::Reference< uno::XInterface > xRet;
// #i93308# up to OOo 3.2 we used this wrong namespace name with the capital T & F. This is
// fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation.
- OUString aFieldType;
- if( (ServiceSpecifier.startsWith( "com.sun.star.text.textfield.", &aFieldType )) ||
- (ServiceSpecifier.startsWith( "com.sun.star.text.TextField.", &aFieldType )) )
+ std::u16string_view aFieldType;
+ if( (o3tl::starts_with( ServiceSpecifier, u"com.sun.star.text.textfield.", &aFieldType )) ||
+ (o3tl::starts_with( ServiceSpecifier, u"com.sun.star.text.TextField.", &aFieldType )) )
{
sal_Int32 nId = text::textfield::Type::UNSPECIFIED;
- if ( aFieldType == "DateTime" )
+ if ( aFieldType == u"DateTime" )
{
nId = text::textfield::Type::DATE;
}
- else if ( aFieldType == "URL" )
+ else if ( aFieldType == u"URL" )
{
nId = text::textfield::Type::URL;
}
- else if ( aFieldType == "PageNumber" )
+ else if ( aFieldType == u"PageNumber" )
{
nId = text::textfield::Type::PAGE;
}
- else if ( aFieldType == "PageCount" )
+ else if ( aFieldType == u"PageCount" )
{
nId = text::textfield::Type::PAGES;
}
- else if ( aFieldType == "SheetName" )
+ else if ( aFieldType == u"SheetName" )
{
nId = text::textfield::Type::TABLE;
}
- else if ( aFieldType == "FileName" )
+ else if ( aFieldType == u"FileName" )
{
nId = text::textfield::Type::EXTENDED_FILE;
}
- else if (aFieldType == "docinfo.Title" ||
- aFieldType == "DocInfo.Title" )
+ else if (aFieldType == u"docinfo.Title" ||
+ aFieldType == u"DocInfo.Title" )
{
nId = text::textfield::Type::DOCINFO_TITLE;
}
- else if ( aFieldType == "Author" )
+ else if ( aFieldType == u"Author" )
{
nId = text::textfield::Type::AUTHOR;
}
- else if ( aFieldType == "Measure" )
+ else if ( aFieldType == u"Measure" )
{
nId = text::textfield::Type::MEASURE;
}
- else if (aFieldType == "DocInfo.Custom")
+ else if (aFieldType == u"DocInfo.Custom")
{
nId = text::textfield::Type::DOCINFO_CUSTOM;
}
if (nId != text::textfield::Type::UNSPECIFIED)
- xRet = static_cast<cppu::OWeakObject *>(new SvxUnoTextField( nId ));
+ xRet = getXWeak(new SvxUnoTextField( nId ));
}
return xRet;
diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx
index de8cab5ef060..fa2fa96118bf 100644
--- a/editeng/source/uno/unofored.cxx
+++ b/editeng/source/uno/unofored.cxx
@@ -124,6 +124,20 @@ void SvxEditEngineForwarder::GetPortions( sal_Int32 nPara, std::vector<sal_Int32
rEditEngine.GetPortions( nPara, rList );
}
+OUString SvxEditEngineForwarder::GetStyleSheet(sal_Int32 nPara) const
+{
+ if (auto pStyle = rEditEngine.GetStyleSheet(nPara))
+ return pStyle->GetName();
+ return OUString();
+}
+
+void SvxEditEngineForwarder::SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName)
+{
+ auto pStyleSheetPool = rEditEngine.GetStyleSheetPool();
+ if (auto pStyle = pStyleSheetPool ? pStyleSheetPool->Find(rStyleName, SfxStyleFamily::Para) : nullptr)
+ rEditEngine.SetStyleSheet(nPara, static_cast<SfxStyleSheet*>(pStyle));
+}
+
void SvxEditEngineForwarder::QuickInsertText( const OUString& rText, const ESelection& rSel )
{
rEditEngine.QuickInsertText( rText, rSel );
@@ -148,12 +162,12 @@ bool SvxEditEngineForwarder::IsValid() const
{
// cannot reliably query EditEngine state
// while in the middle of an update
- return rEditEngine.GetUpdateMode();
+ return rEditEngine.IsUpdateLayout();
}
-OUString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor )
+OUString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle )
{
- return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
+ return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle );
}
void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField )
@@ -214,7 +228,7 @@ SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, const ES
{
// ... and its different to this one than the state is don't care
if(*pParaItem != *(attrib.pAttr))
- return SfxItemState::DONTCARE;
+ return SfxItemState::INVALID;
}
else
pParaItem = attrib.pAttr;
@@ -234,7 +248,7 @@ SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, const ES
if( bEmpty )
eParaState = SfxItemState::DEFAULT;
else if( bGaps )
- eParaState = SfxItemState::DONTCARE;
+ eParaState = SfxItemState::INVALID;
else
eParaState = SfxItemState::SET;
@@ -242,7 +256,7 @@ SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, const ES
if( pLastItem )
{
if( (pParaItem == nullptr) || (*pLastItem != *pParaItem) )
- return SfxItemState::DONTCARE;
+ return SfxItemState::INVALID;
}
else
{
@@ -267,7 +281,7 @@ SfxItemState SvxEditEngineForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 n
LanguageType SvxEditEngineForwarder::GetLanguage( sal_Int32 nPara, sal_Int32 nIndex ) const
{
- return rEditEngine.GetLanguage(nPara, nIndex);
+ return rEditEngine.GetLanguage(nPara, nIndex).nLang;
}
sal_Int32 SvxEditEngineForwarder::GetFieldCount( sal_Int32 nPara ) const
@@ -294,7 +308,7 @@ tools::Rectangle SvxEditEngineForwarder::GetCharBounds( sal_Int32 nPara, sal_Int
tools::Long tmp = aSize.Width();
aSize.setWidth(aSize.Height());
aSize.setHeight(tmp);
- bool bIsVertical( rEditEngine.IsVertical() );
+ bool bIsVertical( rEditEngine.IsEffectivelyVertical() );
// #108900# Handle virtual position one-past-the end of the string
if( nIndex >= rEditEngine.GetTextLen(nPara) )
@@ -338,17 +352,17 @@ tools::Rectangle SvxEditEngineForwarder::GetCharBounds( sal_Int32 nPara, sal_Int
tools::Rectangle SvxEditEngineForwarder::GetParaBounds( sal_Int32 nPara ) const
{
const Point aPnt = rEditEngine.GetDocPosTopLeft( nPara );
- sal_uLong nWidth;
- sal_uLong nHeight;
+ sal_uInt32 nWidth;
+ sal_uInt32 nHeight;
- if( rEditEngine.IsVertical() )
+ if( rEditEngine.IsEffectivelyVertical() )
{
// Hargl. EditEngine's 'external' methods return the rotated
// dimensions, 'internal' methods like GetTextHeight( n )
// don't rotate.
nWidth = rEditEngine.GetTextHeight( nPara );
nHeight = rEditEngine.GetTextHeight();
- sal_uLong nTextWidth = rEditEngine.GetTextHeight();
+ sal_uInt32 nTextWidth = rEditEngine.GetTextHeight();
return tools::Rectangle( nTextWidth - aPnt.Y() - nWidth, 0, nTextWidth - aPnt.Y(), nHeight );
}
@@ -380,7 +394,7 @@ bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nPar
aSize.setHeight(tmp);
Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos,
aSize,
- rEditEngine.IsVertical() ));
+ rEditEngine.IsEffectivelyVertical() ));
EPosition aDocPos = rEditEngine.FindDocPosition( aEEPos );
diff --git a/editeng/source/uno/unofored_internal.hxx b/editeng/source/uno/unofored_internal.hxx
index f58b8aa98b55..cadb19415951 100644
--- a/editeng/source/uno/unofored_internal.hxx
+++ b/editeng/source/uno/unofored_internal.hxx
@@ -20,6 +20,7 @@
#pragma once
#include <editeng/editeng.hxx>
+#include <svl/poolitem.hxx>
SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, const ESelection& rSel, sal_uInt16 nWhich );
diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx
index 144126d25e08..8772ff9a77fa 100644
--- a/editeng/source/uno/unoforou.cxx
+++ b/editeng/source/uno/unoforou.cxx
@@ -94,18 +94,18 @@ static SfxItemSet ImplOutlinerForwarderGetAttribs( const ESelection& rSel, EditE
SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib ) const
{
- if( mpAttribsCache && ( EditEngineAttribs::All == nOnlyHardAttrib ) )
+ if( moAttribsCache && ( EditEngineAttribs::All == nOnlyHardAttrib ) )
{
// have we the correct set in cache?
if( maAttribCacheSelection == rSel )
{
// yes! just return the cache
- return *mpAttribsCache;
+ return *moAttribsCache;
}
else
{
// no, we need delete the old cache
- mpAttribsCache.reset();
+ moAttribsCache.reset();
}
}
@@ -117,7 +117,7 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineA
if( EditEngineAttribs::All == nOnlyHardAttrib )
{
- mpAttribsCache.reset(new SfxItemSet( aSet ));
+ moAttribsCache.emplace( aSet );
maAttribCacheSelection = rSel;
}
@@ -130,31 +130,31 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineA
SfxItemSet SvxOutlinerForwarder::GetParaAttribs( sal_Int32 nPara ) const
{
- if( mpParaAttribsCache )
+ if( moParaAttribsCache )
{
// have we the correct set in cache?
if( nPara == mnParaAttribsCache )
{
// yes! just return the cache
- return *mpParaAttribsCache;
+ return *moParaAttribsCache;
}
else
{
// no, we need delete the old cache
- mpParaAttribsCache.reset();
+ moParaAttribsCache.reset();
}
}
- mpParaAttribsCache.reset(new SfxItemSet( rOutliner.GetParaAttribs( nPara ) ));
+ moParaAttribsCache.emplace( rOutliner.GetParaAttribs( nPara ) );
mnParaAttribsCache = nPara;
EditEngine& rEditEngine = const_cast<EditEngine&>(rOutliner.GetEditEngine());
SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( nPara );
if( pStyle )
- mpParaAttribsCache->SetParent( &(pStyle->GetItemSet() ) );
+ moParaAttribsCache->SetParent( &(pStyle->GetItemSet() ) );
- return *mpParaAttribsCache;
+ return *moParaAttribsCache;
}
void SvxOutlinerForwarder::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
@@ -186,6 +186,20 @@ void SvxOutlinerForwarder::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>&
const_cast<EditEngine&>(rOutliner.GetEditEngine()).GetPortions( nPara, rList );
}
+OUString SvxOutlinerForwarder::GetStyleSheet(sal_Int32 nPara) const
+{
+ if (auto pStyle = rOutliner.GetStyleSheet(nPara))
+ return pStyle->GetName();
+ return OUString();
+}
+
+void SvxOutlinerForwarder::SetStyleSheet(sal_Int32 nPara, const OUString& rStyleName)
+{
+ auto pStyleSheetPool = rOutliner.GetStyleSheetPool();
+ if (auto pStyle = pStyleSheetPool ? pStyleSheetPool->Find(rStyleName, SfxStyleFamily::Para) : nullptr)
+ rOutliner.SetStyleSheet(nPara, static_cast<SfxStyleSheet*>(pStyle));
+}
+
void SvxOutlinerForwarder::QuickInsertText( const OUString& rText, const ESelection& rSel )
{
flushCache();
@@ -217,9 +231,9 @@ void SvxOutlinerForwarder::QuickSetAttribs( const SfxItemSet& rSet, const ESelec
rOutliner.QuickSetAttribs( rSet, rSel );
}
-OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor )
+OUString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle )
{
- return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
+ return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor, rpFldLineStyle );
}
void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& /*rField*/ )
@@ -230,7 +244,7 @@ bool SvxOutlinerForwarder::IsValid() const
{
// cannot reliably query outliner state
// while in the middle of an update
- return rOutliner.GetUpdateMode();
+ return rOutliner.IsUpdateLayout();
}
SfxItemState SvxOutlinerForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
@@ -247,8 +261,8 @@ SfxItemState SvxOutlinerForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWh
void SvxOutlinerForwarder::flushCache()
{
- mpAttribsCache.reset();
- mpParaAttribsCache.reset();
+ moAttribsCache.reset();
+ moParaAttribsCache.reset();
}
LanguageType SvxOutlinerForwarder::GetLanguage( sal_Int32 nPara, sal_Int32 nIndex ) const
@@ -541,7 +555,7 @@ void SvxOutlinerForwarder::CopyText(const SvxTextForwarder& rSource)
const SvxOutlinerForwarder* pSourceForwarder = dynamic_cast< const SvxOutlinerForwarder* >( &rSource );
if( !pSourceForwarder )
return;
- std::unique_ptr<OutlinerParaObject> pNewOutlinerParaObject = pSourceForwarder->rOutliner.CreateParaObject();
+ std::optional<OutlinerParaObject> pNewOutlinerParaObject = pSourceForwarder->rOutliner.CreateParaObject();
rOutliner.SetText( *pNewOutlinerParaObject );
}
diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx
index cdc1bac825df..8782217fd394 100644
--- a/editeng/source/uno/unoipset.cxx
+++ b/editeng/source/uno/unoipset.cxx
@@ -31,15 +31,7 @@
using namespace ::com::sun::star;
-struct SvxIDPropertyCombine
-{
- sal_uInt16 nWID;
- sal_uInt8 memberId;
- uno::Any aAny;
-};
-
-
-SvxItemPropertySet::SvxItemPropertySet( const SfxItemPropertyMapEntry* pMap, SfxItemPool& rItemPool )
+SvxItemPropertySet::SvxItemPropertySet( std::span<const SfxItemPropertyMapEntry> pMap, SfxItemPool& rItemPool )
: m_aPropertyMap( pMap ),
mrItemPool( rItemPool )
{
@@ -48,35 +40,6 @@ SvxItemPropertySet::SvxItemPropertySet( const SfxItemPropertyMapEntry* pMap, Sfx
SvxItemPropertySet::~SvxItemPropertySet()
{
- ClearAllUsrAny();
-}
-
-
-uno::Any* SvxItemPropertySet::GetUsrAnyForID(SfxItemPropertyMapEntry const & entry) const
-{
- for (auto const & rActual : aCombineList)
- {
- if( rActual.nWID == entry.nWID && rActual.memberId == entry.nMemberId )
- return const_cast<uno::Any*>(&rActual.aAny);
- }
- return nullptr;
-}
-
-
-void SvxItemPropertySet::AddUsrAnyForID(
- const uno::Any& rAny, SfxItemPropertyMapEntry const & entry)
-{
- SvxIDPropertyCombine aNew;
- aNew.nWID = entry.nWID;
- aNew.memberId = entry.nMemberId;
- aNew.aAny = rAny;
- aCombineList.push_back( std::move(aNew) );
-}
-
-
-void SvxItemPropertySet::ClearAllUsrAny()
-{
- aCombineList.clear();
}
@@ -100,7 +63,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertyMapEntry* pM
SfxItemPool* pPool = rSet.GetPool();
(void)rSet.GetItemState( pMap->nWID, bSearchInParent, &pItem );
if( nullptr == pItem && pPool )
- pItem = &(pPool->GetDefaultItem( pMap->nWID ));
+ pItem = &(pPool->GetUserOrPoolDefaultItem( pMap->nWID ));
const MapUnit eMapUnit = pPool ? pPool->GetMetric(pMap->nWID) : MapUnit::Map100thMM;
sal_uInt8 nMemberId = pMap->nMemberId;
@@ -155,7 +118,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertyMapEntry* pMap,
return;
}
- pItem = &pPool->GetDefaultItem( pMap->nWID );
+ pItem = &pPool->GetUserOrPoolDefaultItem( pMap->nWID );
}
uno::Any aValue(rVal);
@@ -179,15 +142,15 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertyMapEntry* pMap,
{
// Set new item in item set
pNewItem->SetWhich(pMap->nWID);
- rSet.Put(*pNewItem);
+ rSet.Put(std::move(pNewItem));
}
}
-uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertyMapEntry* pMap ) const
+uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertyMapEntry* pMap, SvxItemPropertySetUsrAnys& rAnys ) const
{
// Already entered a value? Then finish quickly
- uno::Any* pUsrAny = GetUsrAnyForID(*pMap);
+ uno::Any* pUsrAny = rAnys.GetUsrAnyForID(*pMap);
if(pUsrAny)
return *pUsrAny;
@@ -197,13 +160,13 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertyMapEntry* pM
if( eMapUnit == MapUnit::Map100thMM )
nMemberId &= (~CONVERT_TWIPS);
uno::Any aVal;
- SfxItemSet aSet( mrItemPool, {{pMap->nWID, pMap->nWID}});
+ SfxItemSet aSet( mrItemPool, pMap->nWID, pMap->nWID);
if( (pMap->nWID < OWN_ATTR_VALUE_START) || (pMap->nWID > OWN_ATTR_VALUE_END ) )
{
// Get Default from ItemPool
if(SfxItemPool::IsWhich(pMap->nWID))
- aSet.Put(mrItemPool.GetDefaultItem(pMap->nWID));
+ aSet.Put(mrItemPool.GetUserOrPoolDefaultItem(pMap->nWID));
}
if(aSet.Count())
@@ -213,7 +176,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertyMapEntry* pM
if(eState >= SfxItemState::DEFAULT && pItem)
{
pItem->QueryValue( aVal, nMemberId );
- const_cast<SvxItemPropertySet*>(this)->AddUsrAnyForID(aVal, *pMap);
+ rAnys.AddUsrAnyForID(aVal, *pMap);
}
}
@@ -236,11 +199,11 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertyMapEntry* pM
}
-void SvxItemPropertySet::setPropertyValue( const SfxItemPropertyMapEntry* pMap, const uno::Any& rVal ) const
+void SvxItemPropertySet::setPropertyValue( const SfxItemPropertyMapEntry* pMap, const uno::Any& rVal, SvxItemPropertySetUsrAnys& rAnys )
{
- uno::Any* pUsrAny = GetUsrAnyForID(*pMap);
+ uno::Any* pUsrAny = rAnys.GetUsrAnyForID(*pMap);
if(!pUsrAny)
- const_cast<SvxItemPropertySet*>(this)->AddUsrAnyForID(rVal, *pMap);
+ rAnys.AddUsrAnyForID(rVal, *pMap);
else
*pUsrAny = rVal;
}
@@ -335,4 +298,36 @@ void SvxUnoConvertFromMM( const MapUnit eDestinationMapUnit, uno::Any & rMetric
}
}
+SvxItemPropertySetUsrAnys::SvxItemPropertySetUsrAnys() = default;
+
+SvxItemPropertySetUsrAnys::~SvxItemPropertySetUsrAnys()
+{
+ ClearAllUsrAny();
+}
+
+uno::Any* SvxItemPropertySetUsrAnys::GetUsrAnyForID(SfxItemPropertyMapEntry const & entry) const
+{
+ for (auto const & rActual : aCombineList)
+ {
+ if( rActual.nWID == entry.nWID && rActual.memberId == entry.nMemberId )
+ return const_cast<uno::Any*>(&rActual.aAny);
+ }
+ return nullptr;
+}
+
+void SvxItemPropertySetUsrAnys::AddUsrAnyForID(
+ const uno::Any& rAny, SfxItemPropertyMapEntry const & entry)
+{
+ SvxIDPropertyCombine aNew;
+ aNew.nWID = entry.nWID;
+ aNew.memberId = entry.nMemberId;
+ aNew.aAny = rAny;
+ aCombineList.push_back( std::move(aNew) );
+}
+
+void SvxItemPropertySetUsrAnys::ClearAllUsrAny()
+{
+ aCombineList.clear();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index 9f861b7f9c2a..8a5518567053 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/graphic/XGraphic.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/implbase1.hxx>
+#include <utility>
#include <vcl/font.hxx>
#include <vcl/svapp.hxx>
#include <vcl/graph.hxx>
@@ -41,7 +42,6 @@
#include <editeng/unofdesc.hxx>
#include <editeng/unonrule.hxx>
#include <editeng/editids.hrc>
-#include <editeng/numdef.hxx>
#include <o3tl/enumarray.hxx>
#include <o3tl/temporary.hxx>
#include <memory>
@@ -50,7 +50,6 @@ using ::com::sun::star::util::XCloneable;
using ::com::sun::star::ucb::XAnyCompare;
-using namespace ::std;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -67,7 +66,7 @@ const SvxAdjust aUnoToSvxAdjust[] =
SvxAdjust::Block
};
-const o3tl::enumarray<SvxAdjust, unsigned short> aSvxToUnoAdjust
+const o3tl::enumarray<SvxAdjust, sal_Int16> aSvxToUnoAdjust
{
text::HoriOrientation::LEFT,
text::HoriOrientation::RIGHT,
@@ -89,10 +88,8 @@ static unsigned short ConvertUnoAdjust( SvxAdjust eAdjust )
return aSvxToUnoAdjust[eAdjust];
}
-UNO3_GETIMPLEMENTATION_IMPL( SvxUnoNumberingRules );
-
-SvxUnoNumberingRules::SvxUnoNumberingRules(const SvxNumRule& rRule)
-: maRule( rRule )
+SvxUnoNumberingRules::SvxUnoNumberingRules(SvxNumRule aRule)
+: maRule(std::move( aRule ))
{
}
@@ -183,26 +180,23 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex(sal
Any aVal;
{
aVal <<= static_cast<sal_uInt16>(rFmt.GetNumberingType());
- beans::PropertyValue aAlignProp( UNO_NAME_NRULE_NUMBERINGTYPE, -1, aVal, beans::PropertyState_DIRECT_VALUE);
- pArray[nIdx++] = aAlignProp;
+ pArray[nIdx++] = beans::PropertyValue(UNO_NAME_NRULE_NUMBERINGTYPE, -1, aVal, beans::PropertyState_DIRECT_VALUE);
}
{
SvxAdjust eAdj = rFmt.GetNumAdjust();
aVal <<= ConvertUnoAdjust(eAdj);
- pArray[nIdx++] = beans::PropertyValue( UNO_NAME_NRULE_ADJUST, -1, aVal, beans::PropertyState_DIRECT_VALUE);
+ pArray[nIdx++] = beans::PropertyValue(UNO_NAME_NRULE_ADJUST, -1, aVal, beans::PropertyState_DIRECT_VALUE);
}
{
aVal <<= rFmt.GetPrefix();
- beans::PropertyValue aPrefixProp( UNO_NAME_NRULE_PREFIX, -1, aVal, beans::PropertyState_DIRECT_VALUE);
- pArray[nIdx++] = aPrefixProp;
+ pArray[nIdx++] = beans::PropertyValue(UNO_NAME_NRULE_PREFIX, -1, aVal, beans::PropertyState_DIRECT_VALUE);
}
{
aVal <<= rFmt.GetSuffix();
- beans::PropertyValue aSuffixProp( UNO_NAME_NRULE_SUFFIX, -1, aVal, beans::PropertyState_DIRECT_VALUE);
- pArray[nIdx++] = aSuffixProp;
+ pArray[nIdx++] = beans::PropertyValue(UNO_NAME_NRULE_SUFFIX, -1, aVal, beans::PropertyState_DIRECT_VALUE);
}
if(SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
@@ -210,8 +204,7 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex(sal
sal_UCS4 nCode = rFmt.GetBulletChar();
OUString aStr( &nCode, 1 );
aVal <<= aStr;
- beans::PropertyValue aBulletProp( "BulletChar", -1, aVal, beans::PropertyState_DIRECT_VALUE);
- pArray[nIdx++] = aBulletProp;
+ pArray[nIdx++] = beans::PropertyValue("BulletChar", -1, aVal, beans::PropertyState_DIRECT_VALUE);
}
if( rFmt.GetBulletFont() )
@@ -219,7 +212,7 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex(sal
awt::FontDescriptor aDesc;
SvxUnoFontDescriptor::ConvertFromFont( *rFmt.GetBulletFont(), aDesc );
aVal <<= aDesc;
- pArray[nIdx++] = beans::PropertyValue( UNO_NAME_NRULE_BULLET_FONT, -1, aVal, beans::PropertyState_DIRECT_VALUE);
+ pArray[nIdx++] = beans::PropertyValue(UNO_NAME_NRULE_BULLET_FONT, -1, aVal, beans::PropertyState_DIRECT_VALUE);
}
{
@@ -232,8 +225,7 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex(sal
uno::Reference<awt::XBitmap> xBitmap(pGraphic->GetXGraphic(), uno::UNO_QUERY);
aVal <<= xBitmap;
- const beans::PropertyValue aGraphicProp("GraphicBitmap", -1, aVal, beans::PropertyState_DIRECT_VALUE);
- pArray[nIdx++] = aGraphicProp;
+ pArray[nIdx++] = beans::PropertyValue("GraphicBitmap", -1, aVal, beans::PropertyState_DIRECT_VALUE);
}
}
@@ -241,8 +233,7 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex(sal
const Size aSize( rFmt.GetGraphicSize() );
const awt::Size aUnoSize( aSize.Width(), aSize.Height() );
aVal <<= aUnoSize;
- const beans::PropertyValue aGraphicSizeProp("GraphicSize", -1, aVal, beans::PropertyState_DIRECT_VALUE );
- pArray[nIdx++] = aGraphicSizeProp;
+ pArray[nIdx++] = beans::PropertyValue("GraphicSize", -1, aVal, beans::PropertyState_DIRECT_VALUE);
}
aVal <<= static_cast<sal_Int16>(rFmt.GetStart());
@@ -474,7 +465,7 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex(const Sequence<beans::Propert
const SvxNumRule& SvxGetNumRule( Reference< XIndexReplace > const & xRule )
{
- SvxUnoNumberingRules* pRule = comphelper::getUnoTunnelImplementation<SvxUnoNumberingRules>( xRule );
+ SvxUnoNumberingRules* pRule = dynamic_cast<SvxUnoNumberingRules*>( xRule.get() );
if( pRule == nullptr )
throw IllegalArgumentException();
@@ -488,7 +479,7 @@ css::uno::Reference< css::container::XIndexReplace > SvxCreateNumRule(const SvxN
namespace {
-class SvxUnoNumberingRulesCompare : public ::cppu::WeakAggImplHelper1< XAnyCompare >
+class SvxUnoNumberingRulesCompare : public ::cppu::WeakImplHelper< XAnyCompare >
{
public:
virtual sal_Int16 SAL_CALL compare( const Any& Any1, const Any& Any2 ) override;
@@ -504,37 +495,34 @@ sal_Int16 SAL_CALL SvxUnoNumberingRulesCompare::compare( const Any& Any1, const
sal_Int16 SvxUnoNumberingRules::Compare( const Any& Any1, const Any& Any2 )
{
Reference< XIndexReplace > x1( Any1, UNO_QUERY ), x2( Any2, UNO_QUERY );
- if( x1.is() && x2.is() )
- {
- if( x1.get() == x2.get() )
- return 0;
+ if( !x1 || !x2 )
+ return -1;
- SvxUnoNumberingRules* pRule1 = comphelper::getUnoTunnelImplementation<SvxUnoNumberingRules>( x1 );
- if( pRule1 )
- {
- SvxUnoNumberingRules* pRule2 = comphelper::getUnoTunnelImplementation<SvxUnoNumberingRules>( x2 );
- if( pRule2 )
- {
- const SvxNumRule& rRule1 = pRule1->getNumRule();
- const SvxNumRule& rRule2 = pRule2->getNumRule();
+ if( x1.get() == x2.get() )
+ return 0;
- const sal_uInt16 nLevelCount1 = rRule1.GetLevelCount();
- const sal_uInt16 nLevelCount2 = rRule2.GetLevelCount();
+ SvxUnoNumberingRules* pRule1 = dynamic_cast<SvxUnoNumberingRules*>( x1.get() );
+ if( !pRule1 )
+ return -1;
+ SvxUnoNumberingRules* pRule2 = dynamic_cast<SvxUnoNumberingRules*>( x2.get() );
+ if( !pRule2 )
+ return -1;
- if( nLevelCount1 == 0 || nLevelCount2 == 0 )
- return -1;
+ const SvxNumRule& rRule1 = pRule1->getNumRule();
+ const SvxNumRule& rRule2 = pRule2->getNumRule();
- for( sal_uInt16 i = 0; (i < nLevelCount1) && (i < nLevelCount2); i++ )
- {
- if( rRule1.GetLevel(i) != rRule2.GetLevel(i) )
- return -1;
- }
- return 0;
- }
- }
- }
+ const sal_uInt16 nLevelCount1 = rRule1.GetLevelCount();
+ const sal_uInt16 nLevelCount2 = rRule2.GetLevelCount();
- return -1;
+ if( nLevelCount1 == 0 || nLevelCount2 == 0 )
+ return -1;
+
+ for( sal_uInt16 i = 0; (i < nLevelCount1) && (i < nLevelCount2); i++ )
+ {
+ if( rRule1.GetLevel(i) != rRule2.GetLevel(i) )
+ return -1;
+ }
+ return 0;
}
Reference< XAnyCompare > SvxCreateNumRuleCompare() noexcept
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 20d901e0d300..b5f329e62050 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -28,7 +28,6 @@
#include <svl/itemset.hxx>
#include <svl/itempool.hxx>
#include <svl/eitem.hxx>
-#include <rtl/instance.hxx>
#include <tools/debug.hxx>
#include <editeng/unoprnms.hxx>
@@ -42,6 +41,7 @@
#include <editeng/editeng.hxx>
#include <editeng/outliner.hxx>
#include <editeng/unoipset.hxx>
+#include <editeng/colritem.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -71,7 +71,7 @@ ESelection toESelection(const text::TextRangeSelection& rSel)
#define QUERYINT( xint ) \
if( rType == cppu::UnoType<xint>::get() ) \
- return uno::makeAny(uno::Reference< xint >(this))
+ return uno::Any(uno::Reference< xint >(this))
const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet()
{
@@ -79,7 +79,7 @@ const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet()
return &aTextCursorSvxPropertySet;
}
-const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap()
+std::span<const SfxItemPropertyMapEntry> ImplGetSvxTextPortionPropertyMap()
{
// Propertymap for an Outliner Text
static const SfxItemPropertyMapEntry aSvxTextPortionPropertyMap[] =
@@ -88,11 +88,10 @@ const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap()
SVX_UNOEDIT_FONT_PROPERTIES,
SVX_UNOEDIT_OUTLINER_PROPERTIES,
SVX_UNOEDIT_PARA_PROPERTIES,
- { u"TextField", EE_FEATURE_FIELD, cppu::UnoType<text::XTextField>::get(), beans::PropertyAttribute::READONLY, 0 },
- { u"TextPortionType", WID_PORTIONTYPE, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 },
- { u"TextUserDefinedAttributes", EE_CHAR_XMLATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
- { u"ParaUserDefinedAttributes", EE_PARA_XMLATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
- { u"", 0, css::uno::Type(), 0, 0 }
+ { u"TextField"_ustr, EE_FEATURE_FIELD, cppu::UnoType<text::XTextField>::get(), beans::PropertyAttribute::READONLY, 0 },
+ { u"TextPortionType"_ustr, WID_PORTIONTYPE, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 },
+ { u"TextUserDefinedAttributes"_ustr, EE_CHAR_XMLATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
+ { u"ParaUserDefinedAttributes"_ustr, EE_PARA_XMLATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
};
return aSvxTextPortionPropertyMap;
}
@@ -108,7 +107,7 @@ static const SfxItemPropertySet* ImplGetSvxTextPortionSfxPropertySet()
return &aSvxTextPortionSfxPropertySet;
}
-const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap()
+std::span<const SfxItemPropertyMapEntry> ImplGetSvxUnoOutlinerTextCursorPropertyMap()
{
// Propertymap for an Outliner Text
static const SfxItemPropertyMapEntry aSvxUnoOutlinerTextCursorPropertyMap[] =
@@ -117,9 +116,8 @@ const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap()
SVX_UNOEDIT_FONT_PROPERTIES,
SVX_UNOEDIT_OUTLINER_PROPERTIES,
SVX_UNOEDIT_PARA_PROPERTIES,
- { u"TextUserDefinedAttributes", EE_CHAR_XMLATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
- { u"ParaUserDefinedAttributes", EE_PARA_XMLATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
- { u"", 0, css::uno::Type(), 0, 0 }
+ { u"TextUserDefinedAttributes"_ustr, EE_CHAR_XMLATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
+ { u"ParaUserDefinedAttributes"_ustr, EE_PARA_XMLATTRIBS, cppu::UnoType<css::container::XNameContainer>::get(), 0, 0},
};
return aSvxUnoOutlinerTextCursorPropertyMap;
@@ -313,10 +311,10 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart()
{
CheckSelection( maSelection, pForwarder );
- SvxUnoTextBase* pText = comphelper::getUnoTunnelImplementation<SvxUnoTextBase>( getText() );
+ SvxUnoTextBase* pText = comphelper::getFromUnoTunnel<SvxUnoTextBase>( getText() );
if(pText == nullptr)
- throw uno::RuntimeException();
+ throw uno::RuntimeException("Failed to retrieve a valid text base object from the Uno Tunnel");
rtl::Reference<SvxUnoTextRange> pRange = new SvxUnoTextRange( *pText );
xRange = pRange;
@@ -341,10 +339,10 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd()
{
CheckSelection( maSelection, pForwarder );
- SvxUnoTextBase* pText = comphelper::getUnoTunnelImplementation<SvxUnoTextBase>( getText() );
+ SvxUnoTextBase* pText = comphelper::getFromUnoTunnel<SvxUnoTextBase>( getText() );
if(pText == nullptr)
- throw uno::RuntimeException();
+ throw uno::RuntimeException("Failed to retrieve a valid text base object from the Uno Tunnel");
rtl::Reference<SvxUnoTextRange> pNew = new SvxUnoTextRange( *pText );
xRet = pNew;
@@ -433,7 +431,30 @@ void SvxUnoTextRangeBase::_setPropertyValue( const OUString& PropertyName, const
ESelection aSel( GetSelection() );
bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
- if( nPara == -1 && !bParaAttrib )
+ if (pMap->nWID == WID_PARASTYLENAME)
+ {
+ OUString aStyle = aValue.get<OUString>();
+
+ sal_Int32 nEndPara;
+
+ if( nPara == -1 )
+ {
+ nPara = aSel.nStartPara;
+ nEndPara = aSel.nEndPara;
+ }
+ else
+ {
+ // only one paragraph
+ nEndPara = nPara;
+ }
+
+ while( nPara <= nEndPara )
+ {
+ pForwarder->SetStyleSheet(nPara, aStyle);
+ nPara++;
+ }
+ }
+ else if ( nPara == -1 && !bParaAttrib )
{
SfxItemSet aOldSet( pForwarder->GetAttribs( aSel ) );
// we have a selection and no para attribute
@@ -509,7 +530,7 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertyMapEntry*
return !aValue.hasValue() || ((aValue >>= xRule) && !xRule.is());
}
- case WID_NUMLEVEL:
+ case EE_PARA_OUTLLEVEL:
{
SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : nullptr;
if(pForwarder && pSelection)
@@ -521,7 +542,8 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertyMapEntry*
if(! pForwarder->SetDepth( pSelection->nStartPara, nLevel ) )
throw lang::IllegalArgumentException();
- return true;
+ // If valid, then not yet finished. Also needs to be added to paragraph props.
+ return nLevel < -1 || nLevel > 9;
}
}
}
@@ -583,7 +605,7 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyValue(const OUString& Property
aSel.Start.PositionInParagraph = rSel.nStartPos;
aSel.End.Paragraph = rSel.nEndPara;
aSel.End.PositionInParagraph = rSel.nEndPos;
- return uno::makeAny(aSel);
+ return uno::Any(aSel);
}
return _getPropertyValue( PropertyName );
@@ -601,16 +623,16 @@ uno::Any SvxUnoTextRangeBase::_getPropertyValue(const OUString& PropertyName, sa
const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName );
if( pMap )
{
- std::unique_ptr<SfxItemSet> pAttribs;
+ std::optional<SfxItemSet> oAttribs;
if( nPara != -1 )
- pAttribs = pForwarder->GetParaAttribs( nPara ).Clone();
+ oAttribs.emplace(pForwarder->GetParaAttribs( nPara ).CloneAsValue());
else
- pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
+ oAttribs.emplace(pForwarder->GetAttribs( GetSelection() ).CloneAsValue());
// Replace Dontcare with Default, so that one always has a mirror
- pAttribs->ClearInvalidItems();
+ oAttribs->ClearInvalidItems();
- getPropertyValue( pMap, aAny, *pAttribs );
+ getPropertyValue( pMap, aAny, *oAttribs );
return aAny;
}
@@ -633,9 +655,10 @@ void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertyMapEntry* pMap,
// get presentation string for field
std::optional<Color> pTColor;
std::optional<Color> pFColor;
+ std::optional<FontLineStyle> pFldLineStyle;
SvxTextForwarder* pForwarder = mpEditSource->GetTextForwarder();
- OUString aPresentation( pForwarder->CalcFieldValue( SvxFieldItem(*pData, EE_FEATURE_FIELD), maSelection.nStartPara, maSelection.nStartPos, pTColor, pFColor ) );
+ OUString aPresentation( pForwarder->CalcFieldValue( SvxFieldItem(*pData, EE_FEATURE_FIELD), maSelection.nStartPara, maSelection.nStartPos, pTColor, pFColor, pFldLineStyle ) );
uno::Reference< text::XTextField > xField( new SvxUnoTextField( xAnchor, aPresentation, pData ) );
rAny <<= xField;
@@ -653,6 +676,12 @@ void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertyMapEntry* pMap,
}
break;
+ case WID_PARASTYLENAME:
+ {
+ rAny <<= GetEditSource()->GetTextForwarder()->GetStyleSheet(maSelection.nStartPara);
+ }
+ break;
+
default:
if(!GetPropertyValueHelper( *const_cast<SfxItemSet*>(&rSet), pMap, rAny, &maSelection, GetEditSource() ))
rAny = SvxItemPropertySet::getPropertyValue(pMap, rSet, true, false );
@@ -675,18 +704,18 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet const & rSet, cons
{
SfxItemState eState = rSet.GetItemState( EE_PARA_NUMBULLET );
if( eState != SfxItemState::SET && eState != SfxItemState::DEFAULT)
- throw uno::RuntimeException();
+ throw uno::RuntimeException("Invalid item state for paragraph numbering/bullet. Expected SET or DEFAULT.");
const SvxNumBulletItem* pBulletItem = rSet.GetItem( EE_PARA_NUMBULLET );
if( pBulletItem == nullptr )
- throw uno::RuntimeException();
+ throw uno::RuntimeException("Unable to retrieve paragraph numbering/bullet item.");
aAny <<= SvxCreateNumRule( pBulletItem->GetNumRule() );
}
break;
- case WID_NUMLEVEL:
+ case EE_PARA_OUTLLEVEL:
{
SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : nullptr;
if(pForwarder && pSelection)
@@ -747,6 +776,10 @@ void SAL_CALL SvxUnoTextRangeBase::setPropertyValues( const uno::Sequence< OUStr
void SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues, sal_Int32 nPara )
{
+ if (aPropertyNames.getLength() != aValues.getLength())
+ throw lang::IllegalArgumentException("lengths do not match",
+ static_cast<css::beans::XPropertySet*>(this), -1);
+
SolarMutexGuard aGuard;
SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
@@ -770,11 +803,13 @@ void SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< OUString >& a
nEndPara = aSel.nEndPara;
}
- std::unique_ptr<SfxItemSet> pOldAttrSet;
- std::unique_ptr<SfxItemSet> pNewAttrSet;
+ std::optional<SfxItemSet> pOldAttrSet;
+ std::optional<SfxItemSet> pNewAttrSet;
+
+ std::optional<SfxItemSet> pOldParaSet;
+ std::optional<SfxItemSet> pNewParaSet;
- std::unique_ptr<SfxItemSet> pOldParaSet;
- std::unique_ptr<SfxItemSet> pNewParaSet;
+ std::optional<OUString> aStyleName;
for( ; nCount; nCount--, pPropertyNames++, pValues++ )
{
@@ -784,13 +819,16 @@ void SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< OUString >& a
{
bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
- if( (nPara == -1) && !bParaAttrib )
+ if (pMap->nWID == WID_PARASTYLENAME)
{
- if( nullptr == pNewAttrSet )
+ aStyleName.emplace((*pValues).get<OUString>());
+ }
+ else if( (nPara == -1) && !bParaAttrib )
+ {
+ if( !pNewAttrSet )
{
- const SfxItemSet aSet( pForwarder->GetAttribs( aSel ) );
- pOldAttrSet.reset(new SfxItemSet( aSet ));
- pNewAttrSet.reset(new SfxItemSet( *pOldAttrSet->GetPool(), pOldAttrSet->GetRanges() ));
+ pOldAttrSet.emplace( pForwarder->GetAttribs( aSel ) );
+ pNewAttrSet.emplace( *pOldAttrSet->GetPool(), pOldAttrSet->GetRanges() );
}
setPropertyValue( pMap, *pValues, GetSelection(), *pOldAttrSet, *pNewAttrSet );
@@ -806,11 +844,11 @@ void SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< OUString >& a
}
else
{
- if( nullptr == pNewParaSet )
+ if( !pNewParaSet )
{
const SfxItemSet & rSet = pForwarder->GetParaAttribs( nTempPara );
- pOldParaSet.reset(new SfxItemSet( rSet ));
- pNewParaSet.reset(new SfxItemSet( *pOldParaSet->GetPool(), pOldParaSet->GetRanges() ));
+ pOldParaSet.emplace( rSet );
+ pNewParaSet.emplace( *pOldParaSet->GetPool(), pOldParaSet->GetRanges() );
}
setPropertyValue( pMap, *pValues, GetSelection(), *pOldParaSet, *pNewParaSet );
@@ -830,7 +868,7 @@ void SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< OUString >& a
bool bNeedsUpdate = false;
- if( pNewParaSet )
+ if( pNewParaSet || aStyleName )
{
if( pNewParaSet->Count() )
{
@@ -839,6 +877,8 @@ void SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< OUString >& a
SfxItemSet aSet( pForwarder->GetParaAttribs( nTempPara ) );
aSet.Put( *pNewParaSet );
pForwarder->SetParaAttribs( nTempPara, aSet );
+ if (aStyleName)
+ pForwarder->SetStyleSheet(nTempPara, *aStyleName);
nTempPara++;
}
bNeedsUpdate = true;
@@ -880,13 +920,13 @@ uno::Sequence< uno::Any > SvxUnoTextRangeBase::_getPropertyValues( const uno::Se
SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
if( pForwarder )
{
- std::unique_ptr<SfxItemSet> pAttribs;
+ std::optional<SfxItemSet> oAttribs;
if( nPara != -1 )
- pAttribs = pForwarder->GetParaAttribs( nPara ).Clone();
+ oAttribs.emplace(pForwarder->GetParaAttribs( nPara ).CloneAsValue());
else
- pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
+ oAttribs.emplace(pForwarder->GetAttribs( GetSelection() ).CloneAsValue() );
- pAttribs->ClearInvalidItems();
+ oAttribs->ClearInvalidItems();
const OUString* pPropertyNames = aPropertyNames.getConstArray();
uno::Any* pValues = aValues.getArray();
@@ -896,7 +936,7 @@ uno::Sequence< uno::Any > SvxUnoTextRangeBase::_getPropertyValues( const uno::Se
const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
if( pMap )
{
- getPropertyValue( pMap, *pValues, *pAttribs );
+ getPropertyValue( pMap, *pValues, *oAttribs );
}
}
}
@@ -950,8 +990,8 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert
switch( eTempItemState )
{
case SfxItemState::DISABLED:
- case SfxItemState::DONTCARE:
- eItemState = SfxItemState::DONTCARE;
+ case SfxItemState::INVALID:
+ eItemState = SfxItemState::INVALID;
bItemStateSet = true;
break;
@@ -979,9 +1019,9 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert
}
break;
- case WID_NUMLEVEL:
case WID_NUMBERINGSTARTVALUE:
case WID_PARAISNUMBERINGRESTART:
+ case WID_PARASTYLENAME:
eItemState = SfxItemState::SET;
bItemStateSet = true;
break;
@@ -1003,7 +1043,7 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert
{
switch( eItemState )
{
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
case SfxItemState::DISABLED:
return beans::PropertyState_AMBIGUOUS_VALUE;
case SfxItemState::SET:
@@ -1037,23 +1077,23 @@ uno::Sequence< beans::PropertyState > SvxUnoTextRangeBase::_getPropertyStates(co
SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
if( pForwarder )
{
- std::unique_ptr<SfxItemSet> pSet;
+ std::optional<SfxItemSet> pSet;
if( nPara != -1 )
{
- pSet.reset(new SfxItemSet( pForwarder->GetParaAttribs( nPara ) ));
+ pSet.emplace( pForwarder->GetParaAttribs( nPara ) );
}
else
{
ESelection aSel( GetSelection() );
CheckSelection( aSel, pForwarder );
- pSet.reset(new SfxItemSet( pForwarder->GetAttribs( aSel, EditEngineAttribs::OnlyHard ) ));
+ pSet.emplace( pForwarder->GetAttribs( aSel, EditEngineAttribs::OnlyHard ) );
}
beans::PropertyState* pState = aRet.getArray();
for( const OUString& rName : PropertyName )
{
const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry( rName );
- if( !_getOnePropertyStates(pSet.get(), pMap, *pState++) )
+ if( !_getOnePropertyStates(*pSet, pMap, *pState++) )
{
throw beans::UnknownPropertyException(rName);
}
@@ -1063,96 +1103,150 @@ uno::Sequence< beans::PropertyState > SvxUnoTextRangeBase::_getPropertyStates(co
return aRet;
}
-bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertyMapEntry* pMap, beans::PropertyState& rState)
+bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet& rSet, const SfxItemPropertyMapEntry* pMap, beans::PropertyState& rState)
{
+ if (!pMap)
+ return true;
+ SfxItemState eItemState = SfxItemState::DEFAULT;
+ bool bItemStateSet(false);
+
bool bUnknownPropertyFound = false;
- if(pSet && pMap)
+ switch( pMap->nWID )
{
- SfxItemState eItemState = SfxItemState::DEFAULT;
- bool bItemStateSet(false);
-
- switch( pMap->nWID )
- {
- case WID_FONTDESC:
+ case WID_FONTDESC:
+ {
+ const sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap;
+ while( *pWhichId )
{
- const sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap;
- while( *pWhichId )
- {
- const SfxItemState eTempItemState(pSet->GetItemState( *pWhichId ));
+ const SfxItemState eTempItemState(rSet.GetItemState( *pWhichId ));
- switch( eTempItemState )
+ switch( eTempItemState )
+ {
+ case SfxItemState::DISABLED:
+ case SfxItemState::INVALID:
+ eItemState = SfxItemState::INVALID;
+ bItemStateSet = true;
+ break;
+
+ case SfxItemState::DEFAULT:
+ if( !bItemStateSet )
{
- case SfxItemState::DISABLED:
- case SfxItemState::DONTCARE:
- eItemState = SfxItemState::DONTCARE;
+ eItemState = SfxItemState::DEFAULT;
bItemStateSet = true;
- break;
-
- case SfxItemState::DEFAULT:
- if( !bItemStateSet )
- {
- eItemState = SfxItemState::DEFAULT;
- bItemStateSet = true;
- }
- break;
-
- case SfxItemState::SET:
- if( !bItemStateSet )
- {
- eItemState = SfxItemState::SET;
- bItemStateSet = true;
- }
- break;
- default:
- bUnknownPropertyFound = true;
- break;
}
+ break;
- pWhichId++;
+ case SfxItemState::SET:
+ if( !bItemStateSet )
+ {
+ eItemState = SfxItemState::SET;
+ bItemStateSet = true;
+ }
+ break;
+ default:
+ bUnknownPropertyFound = true;
+ break;
}
+
+ pWhichId++;
}
- break;
+ }
+ break;
- case WID_NUMLEVEL:
- case WID_NUMBERINGSTARTVALUE:
- case WID_PARAISNUMBERINGRESTART:
- eItemState = SfxItemState::SET;
- bItemStateSet = true;
- break;
+ case WID_NUMBERINGSTARTVALUE:
+ case WID_PARAISNUMBERINGRESTART:
+ case WID_PARASTYLENAME:
+ eItemState = SfxItemState::SET;
+ bItemStateSet = true;
+ break;
- default:
- if(0 != pMap->nWID)
- {
- eItemState = pSet->GetItemState( pMap->nWID, false );
- bItemStateSet = true;
- }
- break;
- }
+ default:
+ if(0 != pMap->nWID)
+ {
+ eItemState = rSet.GetItemState( pMap->nWID, false );
+ bItemStateSet = true;
+ }
+ break;
+ }
- if( bUnknownPropertyFound )
- return false;
+ if( bUnknownPropertyFound )
+ return false;
- if(bItemStateSet)
+ if(bItemStateSet)
+ {
+ if (pMap->nWID == EE_CHAR_COLOR)
{
- switch( eItemState )
+ // Theme & effects can be DEFAULT_VALUE, even if the same pool item has a color
+ // which is a DIRECT_VALUE.
+ const SvxColorItem* pColor = rSet.GetItem<SvxColorItem>(EE_CHAR_COLOR);
+ if (!pColor)
{
- case SfxItemState::SET:
- rState = beans::PropertyState_DIRECT_VALUE;
+ SAL_WARN("editeng", "Missing EE_CHAR_COLOR SvxColorItem");
+ return false;
+ }
+ switch (pMap->nMemberId)
+ {
+ case MID_COLOR_THEME_INDEX:
+ if (!pColor->getComplexColor().isValidThemeType())
+ {
+ eItemState = SfxItemState::DEFAULT;
+ }
break;
- case SfxItemState::DEFAULT:
- rState = beans::PropertyState_DEFAULT_VALUE;
+ case MID_COLOR_LUM_MOD:
+ {
+ sal_Int16 nLumMod = 10000;
+ for (auto const& rTransform : pColor->getComplexColor().getTransformations())
+ {
+ if (rTransform.meType == model::TransformationType::LumMod)
+ nLumMod = rTransform.mnValue;
+ }
+ if (nLumMod == 10000)
+ {
+ eItemState = SfxItemState::DEFAULT;
+ }
+ break;
+ }
+ case MID_COLOR_LUM_OFF:
+ {
+ sal_Int16 nLumOff = 0;
+ for (auto const& rTransform : pColor->getComplexColor().getTransformations())
+ {
+ if (rTransform.meType == model::TransformationType::LumOff)
+ nLumOff = rTransform.mnValue;
+ }
+ if (nLumOff == 0)
+ {
+ eItemState = SfxItemState::DEFAULT;
+ }
+ break;
+ }
+ case MID_COMPLEX_COLOR:
+ if (pColor->getComplexColor().getType() == model::ColorType::Unused)
+ {
+ eItemState = SfxItemState::DEFAULT;
+ }
break;
-// case SfxItemState::DONTCARE:
-// case SfxItemState::DISABLED:
- default:
- rState = beans::PropertyState_AMBIGUOUS_VALUE;
}
}
- else
+
+ switch( eItemState )
{
- rState = beans::PropertyState_AMBIGUOUS_VALUE;
+ case SfxItemState::SET:
+ rState = beans::PropertyState_DIRECT_VALUE;
+ break;
+ case SfxItemState::DEFAULT:
+ rState = beans::PropertyState_DEFAULT_VALUE;
+ break;
+// case SfxItemState::INVALID:
+// case SfxItemState::DISABLED:
+ default:
+ rState = beans::PropertyState_AMBIGUOUS_VALUE;
}
}
+ else
+ {
+ rState = beans::PropertyState_AMBIGUOUS_VALUE;
+ }
return true;
}
@@ -1191,12 +1285,6 @@ void SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, co
{
SvxUnoFontDescriptor::setPropertyToDefault( aSet );
}
- else if( pMap->nWID == WID_NUMLEVEL )
- {
- // #101004# Call interface method instead of unsafe cast
- pForwarder->SetDepth( maSelection.nStartPara, -1 );
- return;
- }
else if( pMap->nWID == WID_NUMBERINGSTARTVALUE )
{
pForwarder->SetNumberingStartValue( maSelection.nStartPara, -1 );
@@ -1239,7 +1327,7 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aProp
case WID_FONTDESC:
return SvxUnoFontDescriptor::getPropertyDefault( pPool );
- case WID_NUMLEVEL:
+ case EE_PARA_OUTLLEVEL:
{
uno::Any aAny;
return aAny;
@@ -1256,8 +1344,8 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aProp
// Get Default from ItemPool
if(SfxItemPool::IsWhich(pMap->nWID))
{
- SfxItemSet aSet( *pPool, {{pMap->nWID, pMap->nWID}});
- aSet.Put(pPool->GetDefaultItem(pMap->nWID));
+ SfxItemSet aSet( *pPool, pMap->nWID, pMap->nWID );
+ aSet.Put(pPool->GetUserOrPoolDefaultItem(pMap->nWID));
return SvxItemPropertySet::getPropertyValue(pMap, aSet, true, false );
}
}
@@ -1329,13 +1417,13 @@ bool SvxUnoTextRangeBase::IsCollapsed() noexcept
maSelection.nStartPos == maSelection.nEndPos );
}
-bool SvxUnoTextRangeBase::GoLeft(sal_Int16 nCount, bool Expand) noexcept
+bool SvxUnoTextRangeBase::GoLeft(sal_Int32 nCount, bool Expand) noexcept
{
CheckSelection( maSelection, mpEditSource.get() );
// #75098# use end position, as in Writer (start is anchor, end is cursor)
- sal_uInt16 nNewPos = maSelection.nEndPos;
- sal_Int32 nNewPar = maSelection.nEndPara;
+ sal_Int32 nNewPos = maSelection.nEndPos;
+ sal_Int32 nNewPar = maSelection.nEndPara;
bool bOk = true;
SvxTextForwarder* pForwarder = nullptr;
@@ -1367,43 +1455,44 @@ bool SvxUnoTextRangeBase::GoLeft(sal_Int16 nCount, bool Expand) noexcept
return bOk;
}
-bool SvxUnoTextRangeBase::GoRight(sal_Int16 nCount, bool Expand) noexcept
+bool SvxUnoTextRangeBase::GoRight(sal_Int32 nCount, bool Expand) noexcept
{
- SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
- if( pForwarder )
- {
- CheckSelection( maSelection, pForwarder );
+ if (!mpEditSource)
+ return false;
+ SvxTextForwarder* pForwarder = mpEditSource->GetTextForwarder();
+ if( !pForwarder )
+ return false;
- sal_Int32 nNewPos = maSelection.nEndPos + nCount; //! Overflow???
- sal_Int32 nNewPar = maSelection.nEndPara;
+ CheckSelection( maSelection, pForwarder );
- bool bOk = true;
- sal_Int32 nParCount = pForwarder->GetParagraphCount();
- sal_Int32 nThisLen = pForwarder->GetTextLen( nNewPar );
- while ( nNewPos > nThisLen && bOk )
- {
- if ( nNewPar + 1 >= nParCount )
- bOk = false;
- else
- {
- nNewPos -= nThisLen+1;
- ++nNewPar;
- nThisLen = pForwarder->GetTextLen( nNewPar );
- }
- }
+ sal_Int32 nNewPos = maSelection.nEndPos + nCount;
+ sal_Int32 nNewPar = maSelection.nEndPara;
- if (bOk)
+ bool bOk = true;
+ sal_Int32 nParCount = pForwarder->GetParagraphCount();
+ sal_Int32 nThisLen = pForwarder->GetTextLen( nNewPar );
+ while ( nNewPos > nThisLen && bOk )
+ {
+ if ( nNewPar + 1 >= nParCount )
+ bOk = false;
+ else
{
- maSelection.nEndPara = nNewPar;
- maSelection.nEndPos = nNewPos;
+ nNewPos -= nThisLen+1;
+ ++nNewPar;
+ nThisLen = pForwarder->GetTextLen( nNewPar );
}
+ }
- if (!Expand)
- CollapseToEnd();
-
- return bOk;
+ if (bOk)
+ {
+ maSelection.nEndPara = nNewPar;
+ maSelection.nEndPos = nNewPos;
}
- return false;
+
+ if (!Expand)
+ CollapseToEnd();
+
+ return bOk;
}
void SvxUnoTextRangeBase::GotoStart(bool Expand) noexcept
@@ -1455,8 +1544,8 @@ uno::Sequence< OUString > SvxUnoTextRangeBase::getSupportedServiceNames_Static()
// XTextRangeCompare
sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionStarts( const uno::Reference< text::XTextRange >& xR1, const uno::Reference< text::XTextRange >& xR2 )
{
- SvxUnoTextRangeBase* pR1 = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( xR1 );
- SvxUnoTextRangeBase* pR2 = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( xR2 );
+ SvxUnoTextRangeBase* pR1 = comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>( xR1 );
+ SvxUnoTextRangeBase* pR2 = comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>( xR2 );
if( (pR1 == nullptr) || (pR2 == nullptr) )
throw lang::IllegalArgumentException();
@@ -1479,8 +1568,8 @@ sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionStarts( const uno::Referenc
sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionEnds( const uno::Reference< text::XTextRange >& xR1, const uno::Reference< text::XTextRange >& xR2 )
{
- SvxUnoTextRangeBase* pR1 = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( xR1 );
- SvxUnoTextRangeBase* pR2 = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( xR2 );
+ SvxUnoTextRangeBase* pR1 = comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>( xR1 );
+ SvxUnoTextRangeBase* pR2 = comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>( xR2 );
if( (pR1 == nullptr) || (pR2 == nullptr) )
throw lang::IllegalArgumentException();
@@ -1516,13 +1605,13 @@ uno::Any SAL_CALL SvxUnoTextRange::queryAggregation( const uno::Type & rType )
{
QUERYINT( text::XTextRange );
else if( rType == cppu::UnoType<beans::XMultiPropertyStates>::get())
- return uno::makeAny(uno::Reference< beans::XMultiPropertyStates >(this));
+ return uno::Any(uno::Reference< beans::XMultiPropertyStates >(this));
else if( rType == cppu::UnoType<beans::XPropertySet>::get())
- return uno::makeAny(uno::Reference< beans::XPropertySet >(this));
+ return uno::Any(uno::Reference< beans::XPropertySet >(this));
else QUERYINT( beans::XPropertyState );
else QUERYINT( text::XTextRangeCompare );
else if( rType == cppu::UnoType<beans::XMultiPropertySet>::get())
- return uno::makeAny(uno::Reference< beans::XMultiPropertySet >(this));
+ return uno::Any(uno::Reference< beans::XMultiPropertySet >(this));
else QUERYINT( lang::XServiceInfo );
else QUERYINT( lang::XTypeProvider );
else QUERYINT( lang::XUnoTunnel );
@@ -1549,36 +1638,19 @@ void SAL_CALL SvxUnoTextRange::release()
// XTypeProvider
-namespace
-{
- struct theSvxUnoTextRangeTypes :
- public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextRangeTypes>
- {
- uno::Sequence<uno::Type> operator () ()
- {
- uno::Sequence< uno::Type > aTypeSequence;
-
- aTypeSequence.realloc( 9 ); // !DANGER! keep this updated
- uno::Type* pTypes = aTypeSequence.getArray();
-
- *pTypes++ = cppu::UnoType<text::XTextRange>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
- *pTypes++ = cppu::UnoType<text::XTextRangeCompare>::get();
-
- return aTypeSequence;
- }
- };
-}
-
uno::Sequence< uno::Type > SAL_CALL SvxUnoTextRange::getTypes()
{
- return theSvxUnoTextRangeTypes::get();
+ static const uno::Sequence< uno::Type > TYPES {
+ cppu::UnoType<text::XTextRange>::get(),
+ cppu::UnoType<beans::XPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertyStates>::get(),
+ cppu::UnoType<beans::XPropertyState>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<lang::XUnoTunnel>::get(),
+ cppu::UnoType<text::XTextRangeCompare>::get() };
+ return TYPES;
}
uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextRange::getImplementationId()
@@ -1636,7 +1708,7 @@ uno::Any SAL_CALL SvxUnoTextBase::queryAggregation( const uno::Type & rType )
QUERYINT( text::XText );
QUERYINT( text::XSimpleText );
if( rType == cppu::UnoType<text::XTextRange>::get())
- return uno::makeAny(uno::Reference< text::XTextRange >(static_cast<text::XText*>(this)));
+ return uno::Any(uno::Reference< text::XTextRange >(static_cast<text::XText*>(this)));
QUERYINT(container::XEnumerationAccess );
QUERYINT( container::XElementAccess );
QUERYINT( beans::XMultiPropertyStates );
@@ -1658,42 +1730,25 @@ uno::Any SAL_CALL SvxUnoTextBase::queryAggregation( const uno::Type & rType )
// XTypeProvider
-namespace
-{
- struct theSvxUnoTextBaseTypes :
- public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextBaseTypes>
- {
- uno::Sequence<uno::Type> operator () ()
- {
- uno::Sequence< uno::Type > aTypeSequence;
-
- aTypeSequence.realloc( 15 ); // !DANGER! keep this updated
- uno::Type* pTypes = aTypeSequence.getArray();
-
- *pTypes++ = cppu::UnoType<text::XText>::get();
- *pTypes++ = cppu::UnoType<container::XEnumerationAccess>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
- *pTypes++ = cppu::UnoType<text::XTextRangeMover>::get();
- *pTypes++ = cppu::UnoType<text::XTextAppend>::get();
- *pTypes++ = cppu::UnoType<text::XTextCopy>::get();
- *pTypes++ = cppu::UnoType<text::XParagraphAppend>::get();
- *pTypes++ = cppu::UnoType<text::XTextPortionAppend>::get();
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
- *pTypes++ = cppu::UnoType<text::XTextRangeCompare>::get();
-
- return aTypeSequence;
- }
- };
-}
-
uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getTypes()
{
- return theSvxUnoTextBaseTypes::get();
+ static const uno::Sequence< uno::Type > TYPES {
+ cppu::UnoType<text::XText>::get(),
+ cppu::UnoType<container::XEnumerationAccess>::get(),
+ cppu::UnoType<beans::XPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertyStates>::get(),
+ cppu::UnoType<beans::XPropertyState>::get(),
+ cppu::UnoType<text::XTextRangeMover>::get(),
+ cppu::UnoType<text::XTextAppend>::get(),
+ cppu::UnoType<text::XTextCopy>::get(),
+ cppu::UnoType<text::XParagraphAppend>::get(),
+ cppu::UnoType<text::XTextPortionAppend>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<lang::XUnoTunnel>::get(),
+ cppu::UnoType<text::XTextRangeCompare>::get() };
+ return TYPES;
}
uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextBase::getImplementationId()
@@ -1724,7 +1779,7 @@ uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursorByR
if( aTextPosition.is() )
{
- SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( aTextPosition );
+ SvxUnoTextRangeBase* pRange = comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>( aTextPosition );
if(pRange)
xCursor = createTextCursorBySelection( pRange->GetSelection() );
}
@@ -1739,14 +1794,7 @@ void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRan
if( !xRange.is() )
return;
- if (GetEditSource())
- {
- ESelection aSelection;
- ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
- SetSelection( aSelection );
- }
-
- SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange );
+ SvxUnoTextRangeBase* pRange = comphelper::getFromUnoTunnel<SvxUnoTextRange>( xRange );
if(!pRange)
return;
@@ -1761,6 +1809,13 @@ void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRan
pRange->setString( aString );
pRange->CollapseToEnd();
+
+ if (GetEditSource())
+ {
+ ESelection aSelection;
+ ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
+ SetSelection( aSelection );
+ }
}
void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb )
@@ -1786,7 +1841,7 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text
}
case text::ControlCharacter::LINE_BREAK:
{
- SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange );
+ SvxUnoTextRangeBase* pRange = comphelper::getFromUnoTunnel<SvxUnoTextRange>( xRange );
if(pRange)
{
ESelection aRange = pRange->GetSelection();
@@ -1817,7 +1872,7 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text
}
case text::ControlCharacter::APPEND_PARAGRAPH:
{
- SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRange>( xRange );
+ SvxUnoTextRangeBase* pRange = comphelper::getFromUnoTunnel<SvxUnoTextRange>( xRange );
if(pRange)
{
ESelection aRange = pRange->GetSelection();
@@ -1829,7 +1884,8 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text
aRange.nEndPos = aRange.nStartPos;
pRange->SetSelection( aRange );
- pRange->setString( "\x0D" );
+ static constexpr OUStringLiteral CR = u"\x0D";
+ pRange->setString( CR );
aRange.nStartPos = 0;
aRange.nStartPara += 1;
@@ -1874,14 +1930,14 @@ void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTe
GetEditSource()->UpdateData();
uno::Reference<beans::XPropertySet> xPropSetContent(xContent, uno::UNO_QUERY);
- if (!xContent.is())
+ if (!xPropSetContent.is())
throw lang::IllegalArgumentException();
- xPropSetContent->setPropertyValue(UNO_TC_PROP_ANCHOR, uno::makeAny(xRange));
+ xPropSetContent->setPropertyValue(UNO_TC_PROP_ANCHOR, uno::Any(xRange));
aSel.End.PositionInParagraph += 1;
aSel.Start.PositionInParagraph = aSel.End.PositionInParagraph;
- xPropSet->setPropertyValue(UNO_TR_PROP_SELECTION, uno::makeAny(aSel));
+ xPropSet->setPropertyValue(UNO_TR_PROP_SELECTION, uno::Any(aSel));
}
void SAL_CALL SvxUnoTextBase::removeTextContent( const uno::Reference< text::XTextContent >& )
@@ -1929,6 +1985,10 @@ void SAL_CALL SvxUnoTextBase::setString( const OUString& aString )
uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextBase::createEnumeration()
{
SolarMutexGuard aGuard;
+
+ if (!GetEditSource())
+ return uno::Reference< container::XEnumeration >();
+
if( maSelection == ESelection(0,0,0,0) || maSelection == ESelection(EE_PARA_MAX_COUNT,0,0,0) )
{
ESelection aSelection;
@@ -1973,14 +2033,14 @@ static void SvxPropertyValuesToItemSet(
SfxItemSet &rItemSet,
const uno::Sequence< beans::PropertyValue >& rPropertyValues,
const SfxItemPropertySet *pPropSet,
- SvxTextForwarder *pForwarder /*needed for WID_NUMLEVEL*/,
- sal_Int32 nPara /*needed for WID_NUMLEVEL*/)
+ SvxTextForwarder *pForwarder,
+ sal_Int32 nPara)
{
for (const beans::PropertyValue& rProp : rPropertyValues)
{
const SfxItemPropertyMapEntry *pEntry = pPropSet->getPropertyMap().getByName( rProp.Name );
if (!pEntry)
- throw beans::UnknownPropertyException( "Unknown property: " + rProp.Name, static_cast < cppu::OWeakObject * > ( nullptr ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + rProp.Name );
// Note: there is no need to take special care of the properties
// TextField (EE_FEATURE_FIELD) and
// TextPortionType (WID_PORTIONTYPE)
@@ -1988,8 +2048,8 @@ static void SvxPropertyValuesToItemSet(
if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
// should be PropertyVetoException which is not yet defined for the new import API's functions
- throw uno::RuntimeException("Property is read-only: " + rProp.Name, static_cast < cppu::OWeakObject * > ( nullptr ) );
- //throw PropertyVetoException ("Property is read-only: " + rProp.Name, static_cast < cppu::OWeakObject * > ( 0 ) );
+ throw uno::RuntimeException("Property is read-only: " + rProp.Name );
+ //throw PropertyVetoException ("Property is read-only: " + rProp.Name );
if (pEntry->nWID == WID_FONTDESC)
{
@@ -1997,18 +2057,6 @@ static void SvxPropertyValuesToItemSet(
if (rProp.Value >>= aDesc)
SvxUnoFontDescriptor::FillItemSet( aDesc, rItemSet );
}
- else if (pEntry->nWID == WID_NUMLEVEL)
- {
- if (pForwarder)
- {
- sal_Int16 nLevel = -1;
- rProp.Value >>= nLevel;
-
- // #101004# Call interface method instead of unsafe cast
- if (!pForwarder->SetDepth( nPara, nLevel ))
- throw lang::IllegalArgumentException();
- }
- }
else if (pEntry->nWID == WID_NUMBERINGSTARTVALUE )
{
if( pForwarder )
@@ -2074,11 +2122,43 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph(
}
uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::insertTextPortion(
- const OUString& /*rText*/,
- const uno::Sequence< beans::PropertyValue >& /*rCharAndParaProps*/,
- const uno::Reference< text::XTextRange>& /*rTextRange*/ )
+ const OUString& rText,
+ const uno::Sequence< beans::PropertyValue >& rCharAndParaProps,
+ const uno::Reference< text::XTextRange>& rTextRange )
{
+ SolarMutexGuard aGuard;
+
uno::Reference< text::XTextRange > xRet;
+
+ if (!rTextRange.is())
+ return xRet;
+
+ SvxUnoTextRangeBase* pRange = comphelper::getFromUnoTunnel<SvxUnoTextRange>(rTextRange);
+ if (!pRange)
+ return xRet;
+
+ 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.nStartPara );
+ 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;
}
@@ -2129,16 +2209,15 @@ void SvxUnoTextBase::copyText(
SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : nullptr;
if( !pTextForwarder )
return;
- if( xUT.is() )
+ if (auto pSource = comphelper::getFromUnoTunnel<SvxUnoTextBase>(xUT))
{
- SvxUnoTextBase* pSource = reinterpret_cast<SvxUnoTextBase*>(sal::static_int_cast<sal_uIntPtr>(
- xUT->getSomething( SvxUnoTextBase::getUnoTunnelId())));
SvxEditSource *pSourceEditSource = pSource->GetEditSource();
SvxTextForwarder *pSourceTextForwarder = pSourceEditSource ? pSourceEditSource->GetTextForwarder() : nullptr;
if( pSourceTextForwarder )
{
pTextForwarder->CopyText( *pSourceTextForwarder );
pEditSource->UpdateData();
+ SetSelection(pSource->GetSelection());
}
}
else
@@ -2171,20 +2250,14 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames_Stat
const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() noexcept
{
- static const UnoTunnelIdInit theSvxUnoTextBaseUnoTunnelId;
+ static const comphelper::UnoIdInit theSvxUnoTextBaseUnoTunnelId;
return theSvxUnoTextBaseUnoTunnelId.getSeq();
}
sal_Int64 SAL_CALL SvxUnoTextBase::getSomething( const uno::Sequence< sal_Int8 >& rId )
{
- if( isUnoTunnelId<SvxUnoTextBase>(rId) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
- }
- else
- {
- return SvxUnoTextRangeBase::getSomething( rId );
- }
+ return comphelper::getSomethingImpl(
+ rId, this, comphelper::FallbackToGetSomethingOf<SvxUnoTextRangeBase>{});
}
SvxUnoText::SvxUnoText( const SvxItemPropertySet* _pSet ) noexcept
@@ -2245,20 +2318,14 @@ uno::Sequence< sal_Int8 > SAL_CALL SvxUnoText::getImplementationId( )
const uno::Sequence< sal_Int8 > & SvxUnoText::getUnoTunnelId() noexcept
{
- static const UnoTunnelIdInit theSvxUnoTextUnoTunnelId;
+ static const comphelper::UnoIdInit theSvxUnoTextUnoTunnelId;
return theSvxUnoTextUnoTunnelId.getSeq();
}
sal_Int64 SAL_CALL SvxUnoText::getSomething( const uno::Sequence< sal_Int8 >& rId )
{
- if( isUnoTunnelId<SvxUnoText>(rId) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
- }
- else
- {
- return SvxUnoTextBase::getSomething( rId );
- }
+ return comphelper::getSomethingImpl(rId, this,
+ comphelper::FallbackToGetSomethingOf<SvxUnoTextBase>{});
}
@@ -2320,6 +2387,15 @@ void SvxDummyTextSource::GetPortions( sal_Int32, std::vector<sal_Int32>& ) const
{
}
+OUString SvxDummyTextSource::GetStyleSheet(sal_Int32) const
+{
+ return OUString();
+}
+
+void SvxDummyTextSource::SetStyleSheet(sal_Int32, const OUString&)
+{
+}
+
SfxItemState SvxDummyTextSource::GetItemState( const ESelection&, sal_uInt16 ) const
{
return SfxItemState::UNKNOWN;
@@ -2351,7 +2427,7 @@ void SvxDummyTextSource::QuickInsertLineBreak( const ESelection& )
{
};
-OUString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, std::optional<Color>&, std::optional<Color>& )
+OUString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_Int32, sal_Int32, std::optional<Color>&, std::optional<Color>&, std::optional<FontLineStyle>& )
{
return OUString();
}
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index f7a2d462e3b3..54714027b388 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -24,7 +24,6 @@
#include <o3tl/safeint.hxx>
#include <vcl/svapp.hxx>
-#include <rtl/instance.hxx>
#include <editeng/unotext.hxx>
#include <comphelper/sequence.hxx>
@@ -35,7 +34,7 @@ using namespace ::com::sun::star;
#define QUERYINT( xint ) \
if( rType == cppu::UnoType<xint>::get() ) \
- return uno::makeAny(uno::Reference< xint >(this))
+ return uno::Any(uno::Reference< xint >(this))
// SvxUnoTextContentEnumeration
@@ -48,6 +47,9 @@ SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase
mpEditSource = rText.GetEditSource()->Clone();
mnNextParagraph = 0;
+ if (!mpEditSource)
+ return;
+
const SvxTextForwarder* pTextForwarder = rText.GetEditSource()->GetTextForwarder();
const sal_Int32 maxParaIndex = std::min( rSel.nEndPara + 1, pTextForwarder->GetParagraphCount() );
@@ -109,7 +111,7 @@ uno::Any SvxUnoTextContentEnumeration::nextElement()
uno::Reference< text::XTextContent > xRef( maContents.at(mnNextParagraph) );
mnNextParagraph++;
- return uno::makeAny( xRef );
+ return uno::Any( xRef );
}
@@ -119,7 +121,6 @@ SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextBase& rText, sal_Int32 nPa
: SvxUnoTextRangeBase(rText)
, mnParagraph(nPara)
, mrParentText(rText)
-, maDisposeListeners(maDisposeContainerMutex)
, mbDisposing( false )
{
mxParentText = const_cast<SvxUnoTextBase*>(&rText);
@@ -132,7 +133,6 @@ SvxUnoTextContent::SvxUnoTextContent( const SvxUnoTextContent& rContent ) noexce
, lang::XTypeProvider()
, cppu::OWeakAggObject()
, mrParentText(rContent.mrParentText)
-, maDisposeListeners(maDisposeContainerMutex)
, mbDisposing( false )
{
mxParentText = rContent.mxParentText;
@@ -181,38 +181,21 @@ void SAL_CALL SvxUnoTextContent::release() noexcept
// XTypeProvider
-namespace
-{
- struct theSvxUnoTextContentTypes :
- public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextContentTypes>
- {
- uno::Sequence<uno::Type> operator () ()
- {
- uno::Sequence< uno::Type > aTypeSequence;
-
- aTypeSequence.realloc( 11 ); // !DANGER! keep this updated
- uno::Type* pTypes = aTypeSequence.getArray();
-
- *pTypes++ = cppu::UnoType<text::XTextRange>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
- *pTypes++ = cppu::UnoType<text::XTextRangeCompare>::get();
- *pTypes++ = cppu::UnoType<text::XTextContent>::get();
- *pTypes++ = cppu::UnoType<container::XEnumerationAccess>::get();
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
-
- return aTypeSequence;
- }
- };
-}
-
uno::Sequence< uno::Type > SAL_CALL SvxUnoTextContent::getTypes()
{
- return theSvxUnoTextContentTypes::get();
+ static const uno::Sequence< uno::Type > TYPES {
+ cppu::UnoType<text::XTextRange>::get(),
+ cppu::UnoType<beans::XPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertyStates>::get(),
+ cppu::UnoType<beans::XPropertyState>::get(),
+ cppu::UnoType<text::XTextRangeCompare>::get(),
+ cppu::UnoType<text::XTextContent>::get(),
+ cppu::UnoType<container::XEnumerationAccess>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<lang::XUnoTunnel>::get() };
+ return TYPES;
}
uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextContent::getImplementationId()
@@ -250,20 +233,28 @@ void SAL_CALL SvxUnoTextContent::dispose()
lang::EventObject aEvt;
aEvt.Source = *static_cast<OWeakAggObject*>(this);
- maDisposeListeners.disposeAndClear(aEvt);
+ {
+ std::unique_lock aMutexGuard(maDisposeContainerMutex);
+ maDisposeListeners.disposeAndClear(aMutexGuard, aEvt);
+ }
if( mxParentText.is() )
+ {
mxParentText->removeTextContent( this );
+ mxParentText.clear();
+ }
}
void SAL_CALL SvxUnoTextContent::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
{
- maDisposeListeners.addInterface(xListener);
+ std::unique_lock aGuard(maDisposeContainerMutex);
+ maDisposeListeners.addInterface(aGuard, xListener);
}
void SAL_CALL SvxUnoTextContent::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
{
- maDisposeListeners.removeInterface(aListener);
+ std::unique_lock aGuard(maDisposeContainerMutex);
+ maDisposeListeners.removeInterface(aGuard, aListener);
}
// XEnumerationAccess
@@ -444,7 +435,7 @@ uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement()
uno::Reference< text::XTextRange > xRange = maPortions.at(mnNextPortion);
mnNextPortion++;
- return uno::makeAny( xRange );
+ return uno::Any( xRange );
}
SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextBase& rText ) noexcept
@@ -472,7 +463,7 @@ SvxUnoTextCursor::~SvxUnoTextCursor() noexcept
uno::Any SAL_CALL SvxUnoTextCursor::queryAggregation( const uno::Type & rType )
{
if( rType == cppu::UnoType<text::XTextRange>::get())
- return uno::makeAny(uno::Reference< text::XTextRange >(static_cast<SvxUnoTextRangeBase *>(this)));
+ return uno::Any(uno::Reference< text::XTextRange >(static_cast<SvxUnoTextRangeBase *>(this)));
else QUERYINT( text::XTextCursor );
else QUERYINT( beans::XMultiPropertyStates );
else QUERYINT( beans::XPropertySet );
@@ -501,38 +492,21 @@ void SAL_CALL SvxUnoTextCursor::release() noexcept
OWeakAggObject::release();
}
-namespace
-{
- struct theSvxUnoTextCursorTypes :
- public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextCursorTypes>
- {
- uno::Sequence<uno::Type> operator () ()
- {
- uno::Sequence< uno::Type > aTypeSequence;
-
- aTypeSequence.realloc( 10 ); // !DANGER! keep this updated
- uno::Type* pTypes = aTypeSequence.getArray();
-
- *pTypes++ = cppu::UnoType<text::XTextRange>::get();
- *pTypes++ = cppu::UnoType<text::XTextCursor>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
- *pTypes++ = cppu::UnoType<text::XTextRangeCompare>::get();
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
-
- return aTypeSequence;
- }
- };
-}
-
// XTypeProvider
uno::Sequence< uno::Type > SAL_CALL SvxUnoTextCursor::getTypes()
{
- return theSvxUnoTextCursorTypes::get();
+ static const uno::Sequence< uno::Type > TYPES {
+ cppu::UnoType<text::XTextRange>::get(),
+ cppu::UnoType<text::XTextCursor>::get(),
+ cppu::UnoType<beans::XPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertyStates>::get(),
+ cppu::UnoType<beans::XPropertyState>::get(),
+ cppu::UnoType<text::XTextRangeCompare>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<lang::XUnoTunnel>::get() };
+ return TYPES;
}
uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextCursor::getImplementationId()
@@ -588,7 +562,7 @@ void SAL_CALL SvxUnoTextCursor::gotoRange( const uno::Reference< text::XTextRang
if( !xRange.is() )
return;
- SvxUnoTextRangeBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextRangeBase>( xRange );
+ SvxUnoTextRangeBase* pRange = comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>( xRange );
if( !pRange )
return;
diff --git a/editeng/source/uno/unoviwou.cxx b/editeng/source/uno/unoviwou.cxx
index cbad84836610..19f38794e8c6 100644
--- a/editeng/source/uno/unoviwou.cxx
+++ b/editeng/source/uno/unoviwou.cxx
@@ -24,7 +24,7 @@
#include <editeng/outliner.hxx>
SvxDrawOutlinerViewForwarder::SvxDrawOutlinerViewForwarder( OutlinerView& rOutl ) :
- mrOutlinerView ( rOutl ), maTextShapeTopLeft()
+ mrOutlinerView ( rOutl )
{
}