summaryrefslogtreecommitdiffstats
path: root/editeng
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-11-28 11:59:00 +0100
committerMichael Stahl <mstahl@redhat.com>2012-11-28 21:33:54 +0100
commit232ad2f2588beff50cb5c1f3b689c581ba317583 (patch)
tree40f7ebd9203de3e679b3578a552e28c7a2f09ee3 /editeng
parentOUString::trim() does not modify in-place (diff)
downloadcore-232ad2f2588beff50cb5c1f3b689c581ba317583.tar.gz
core-232ad2f2588beff50cb5c1f3b689c581ba317583.zip
API CHANGE: add a "position" parameter to XParagraph/TextPortionAppend methods
So we can use the new RTF import for clipboard pastes in Writer without inserting text content to the end of the document only. Notes: - SwXText::insertTextPortion: the MovePara() call is removed, as all it did was trying to move the cursor beyond the end of the document. - SwRTFReader::Read: the double fake paragraph insertion / deletion is motivated by the ODT filter. - RtfFilter::filter: if TextInsertModeRange is not passed, then the behaviour is not changed. v2: - added missing @since tags - added insertTextContentWithProperties() method - removed unused appendParagraph() method Change-Id: I24cddb00a78e3b798e7d88764e59e6a77a6e98a4 Helped-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/editeng/unotext.hxx4
-rw-r--r--editeng/source/uno/unotext.cxx38
2 files changed, 16 insertions, 26 deletions
diff --git a/editeng/inc/editeng/unotext.hxx b/editeng/inc/editeng/unotext.hxx
index 397e64bbf090..13ab909256ee 100644
--- a/editeng/inc/editeng/unotext.hxx
+++ b/editeng/inc/editeng/unotext.hxx
@@ -440,12 +440,14 @@ public:
virtual void SAL_CALL moveTextRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Int16 nParagraphs ) throw(::com::sun::star::uno::RuntimeException);
// com::sun::star::text::XParagraphAppend (new import API)
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL appendParagraph( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishParagraph( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishParagraphInsert( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xInsertPosition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
// com::sun::star::text::XTextPortionAppend (new import API)
virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL appendTextPortion( const ::rtl::OUString& Text, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL insertTextPortion( const ::rtl::OUString& Text, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties, const com::sun::star::uno::Reference< com::sun::star::text::XTextRange>& rTextRange ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
// com::sun::star::text::XTextCopy
virtual void SAL_CALL copyText( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCopy >& xSource ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 3b5033b6de3e..659f0f163978 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -2142,34 +2142,12 @@ void SvxPropertyValuesToItemSet(
}
}
-// com::sun::star::text::XParagraphAppend (new import API)
-uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendParagraph(
- const uno::Sequence< beans::PropertyValue >& rCharAndParaProps )
+uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraphInsert(
+ const uno::Sequence< beans::PropertyValue >& /*rCharAndParaProps*/,
+ const uno::Reference< text::XTextRange >& /*rTextRange*/ )
throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
{
- SolarMutexGuard aGuard;
uno::Reference< text::XTextRange > xRet;
- SvxEditSource *pEditSource = GetEditSource();
- SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
- if (pTextForwarder)
- {
- sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount();
- DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
- pTextForwarder->AppendParagraph();
-
- // set properties for new appended (now last) paragraph
- ESelection aSel( nParaCount, 0, nParaCount, 0 );
- SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
- SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
- ImplGetSvxUnoOutlinerTextCursorSfxPropertySet(),
- pTextForwarder,
- nParaCount );
- pTextForwarder->QuickSetAttribs( aItemSet, aSel );
- pEditSource->UpdateData();
- SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
- xRet = pRange;
- pRange->SetSelection( aSel );
- }
return xRet;
}
@@ -2203,6 +2181,16 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph(
return xRet;
}
+uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::insertTextPortion(
+ const ::rtl::OUString& /*rText*/,
+ const uno::Sequence< beans::PropertyValue >& /*rCharAndParaProps*/,
+ const uno::Reference< text::XTextRange>& /*rTextRange*/ )
+ throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
+{
+ uno::Reference< text::XTextRange > xRet;
+ return xRet;
+}
+
// com::sun::star::text::XTextPortionAppend (new import API)
uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion(
const ::rtl::OUString& rText,