diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-11-28 11:59:00 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-11-28 21:33:54 +0100 |
commit | 232ad2f2588beff50cb5c1f3b689c581ba317583 (patch) | |
tree | 40f7ebd9203de3e679b3578a552e28c7a2f09ee3 | |
parent | 85693bffad5c863e5cd4d4b3664856a9fec607d5 (diff) |
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>
-rw-r--r-- | editeng/inc/editeng/unotext.hxx | 4 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 38 | ||||
-rw-r--r-- | offapi/com/sun/star/text/XParagraphAppend.idl | 21 | ||||
-rw-r--r-- | offapi/com/sun/star/text/XTextContentAppend.idl | 21 | ||||
-rw-r--r-- | offapi/com/sun/star/text/XTextPortionAppend.idl | 25 | ||||
-rw-r--r-- | sw/inc/unotext.hxx | 33 | ||||
-rw-r--r-- | sw/inc/unotextrange.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 95 | ||||
-rw-r--r-- | sw/source/filter/rtf/swparrtf.cxx | 64 | ||||
-rw-r--r-- | writerfilter/inc/dmapper/DomainMapper.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 67 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 16 | ||||
-rw-r--r-- | writerfilter/source/filter/ImportFilter.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/filter/RtfFilter.cxx | 4 |
15 files changed, 302 insertions, 96 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: | |||
440 | 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); | 440 | 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); |
441 | 441 | ||
442 | // com::sun::star::text::XParagraphAppend (new import API) | 442 | // com::sun::star::text::XParagraphAppend (new import API) |
443 | 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); | ||
444 | 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); | 443 | 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); |
444 | 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); | ||
445 | 445 | ||
446 | // com::sun::star::text::XTextPortionAppend (new import API) | 446 | // com::sun::star::text::XTextPortionAppend (new import API) |
447 | 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); | 447 | 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); |
448 | 448 | ||
449 | 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); | ||
450 | |||
449 | // com::sun::star::text::XTextCopy | 451 | // com::sun::star::text::XTextCopy |
450 | virtual void SAL_CALL copyText( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCopy >& xSource ) throw (::com::sun::star::uno::RuntimeException); | 452 | virtual void SAL_CALL copyText( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCopy >& xSource ) throw (::com::sun::star::uno::RuntimeException); |
451 | 453 | ||
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( | |||
2142 | } | 2142 | } |
2143 | } | 2143 | } |
2144 | 2144 | ||
2145 | // com::sun::star::text::XParagraphAppend (new import API) | 2145 | uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraphInsert( |
2146 | uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendParagraph( | 2146 | const uno::Sequence< beans::PropertyValue >& /*rCharAndParaProps*/, |
2147 | const uno::Sequence< beans::PropertyValue >& rCharAndParaProps ) | 2147 | const uno::Reference< text::XTextRange >& /*rTextRange*/ ) |
2148 | throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) | 2148 | throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) |
2149 | { | 2149 | { |
2150 | SolarMutexGuard aGuard; | ||
2151 | uno::Reference< text::XTextRange > xRet; | 2150 | uno::Reference< text::XTextRange > xRet; |
2152 | SvxEditSource *pEditSource = GetEditSource(); | ||
2153 | SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0; | ||
2154 | if (pTextForwarder) | ||
2155 | { | ||
2156 | sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount(); | ||
2157 | DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" ); | ||
2158 | pTextForwarder->AppendParagraph(); | ||
2159 | |||
2160 | // set properties for new appended (now last) paragraph | ||
2161 | ESelection aSel( nParaCount, 0, nParaCount, 0 ); | ||
2162 | SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() ); | ||
2163 | SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps, | ||
2164 | ImplGetSvxUnoOutlinerTextCursorSfxPropertySet(), | ||
2165 | pTextForwarder, | ||
2166 | nParaCount ); | ||
2167 | pTextForwarder->QuickSetAttribs( aItemSet, aSel ); | ||
2168 | pEditSource->UpdateData(); | ||
2169 | SvxUnoTextRange* pRange = new SvxUnoTextRange( *this ); | ||
2170 | xRet = pRange; | ||
2171 | pRange->SetSelection( aSel ); | ||
2172 | } | ||
2173 | return xRet; | 2151 | return xRet; |
2174 | } | 2152 | } |
2175 | 2153 | ||
@@ -2203,6 +2181,16 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph( | |||
2203 | return xRet; | 2181 | return xRet; |
2204 | } | 2182 | } |
2205 | 2183 | ||
2184 | uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::insertTextPortion( | ||
2185 | const ::rtl::OUString& /*rText*/, | ||
2186 | const uno::Sequence< beans::PropertyValue >& /*rCharAndParaProps*/, | ||
2187 | const uno::Reference< text::XTextRange>& /*rTextRange*/ ) | ||
2188 | throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) | ||
2189 | { | ||
2190 | uno::Reference< text::XTextRange > xRet; | ||
2191 | return xRet; | ||
2192 | } | ||
2193 | |||
2206 | // com::sun::star::text::XTextPortionAppend (new import API) | 2194 | // com::sun::star::text::XTextPortionAppend (new import API) |
2207 | uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion( | 2195 | uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion( |
2208 | const ::rtl::OUString& rText, | 2196 | const ::rtl::OUString& rText, |
diff --git a/offapi/com/sun/star/text/XParagraphAppend.idl b/offapi/com/sun/star/text/XParagraphAppend.idl index 9c2ce13ec87b..343ca9eede29 100644 --- a/offapi/com/sun/star/text/XParagraphAppend.idl +++ b/offapi/com/sun/star/text/XParagraphAppend.idl | |||
@@ -35,20 +35,21 @@ | |||
35 | */ | 35 | */ |
36 | interface XParagraphAppend : com::sun::star::uno::XInterface | 36 | interface XParagraphAppend : com::sun::star::uno::XInterface |
37 | { | 37 | { |
38 | /** appends a new and empty paragraph at the end of the text. | 38 | /** appends a new and empty paragraph at the end of the text. |
39 | 39 | ||
40 | <p>The properties are applied to the new paragraph. | 40 | <p>The properties are applied to the last paragraph before the new paragraph is inserted. |
41 | </p> | 41 | </p> |
42 | 42 | ||
43 | @param | 43 | @param |
44 | CharacterAndParagraphProperties can contain all the properties defined by the service | 44 | CharacterAndParagraphProperties can contain all the properties defined by the service |
45 | <type scope="com::sun::star::text">Paragraph. | 45 | <type scope="com::sun::star::text">Paragraph. |
46 | 46 | ||
47 | */ | 47 | */ |
48 | com::sun::star::text::XTextRange appendParagraph( [in] com::sun::star::beans::PropertyValues CharacterAndParagraphProperties ) | 48 | com::sun::star::text::XTextRange finishParagraph( [in] com::sun::star::beans::PropertyValues CharacterAndParagraphProperties ) |
49 | raises( com::sun::star::lang::IllegalArgumentException, | 49 | raises( com::sun::star::lang::IllegalArgumentException, |
50 | com::sun::star::beans::UnknownPropertyException ); | 50 | com::sun::star::beans::UnknownPropertyException ); |
51 | /** appends a new and empty paragraph at the end of the text. | 51 | |
52 | /** inserts a new and empty paragraph to the text at a given position. | ||
52 | 53 | ||
53 | <p>The properties are applied to the last paragraph before the new paragraph is inserted. | 54 | <p>The properties are applied to the last paragraph before the new paragraph is inserted. |
54 | </p> | 55 | </p> |
@@ -57,8 +58,14 @@ interface XParagraphAppend : com::sun::star::uno::XInterface | |||
57 | CharacterAndParagraphProperties can contain all the properties defined by the service | 58 | CharacterAndParagraphProperties can contain all the properties defined by the service |
58 | <type scope="com::sun::star::text">Paragraph. | 59 | <type scope="com::sun::star::text">Paragraph. |
59 | 60 | ||
61 | @param | ||
62 | TextRange specifies the position of the insertion. | ||
63 | |||
64 | @since LibreOffice 4.0 | ||
65 | |||
60 | */ | 66 | */ |
61 | com::sun::star::text::XTextRange finishParagraph( [in] com::sun::star::beans::PropertyValues CharacterAndParagraphProperties ) | 67 | com::sun::star::text::XTextRange finishParagraphInsert( [in] com::sun::star::beans::PropertyValues CharacterAndParagraphProperties, |
68 | [in] com::sun::star::text::XTextRange TextRange ) | ||
62 | raises( com::sun::star::lang::IllegalArgumentException, | 69 | raises( com::sun::star::lang::IllegalArgumentException, |
63 | com::sun::star::beans::UnknownPropertyException ); | 70 | com::sun::star::beans::UnknownPropertyException ); |
64 | 71 | ||
diff --git a/offapi/com/sun/star/text/XTextContentAppend.idl b/offapi/com/sun/star/text/XTextContentAppend.idl index 0e9c46d33073..afac7ab3b76d 100644 --- a/offapi/com/sun/star/text/XTextContentAppend.idl +++ b/offapi/com/sun/star/text/XTextContentAppend.idl | |||
@@ -55,6 +55,27 @@ interface XTextContentAppend : com::sun::star::uno::XInterface | |||
55 | raises( com::sun::star::lang::IllegalArgumentException, | 55 | raises( com::sun::star::lang::IllegalArgumentException, |
56 | com::sun::star::beans::UnknownPropertyException ); | 56 | com::sun::star::beans::UnknownPropertyException ); |
57 | 57 | ||
58 | /** inserts a text content at the given position. | ||
59 | |||
60 | @param TextContent | ||
61 | contains the object to be inserted. | ||
62 | @param CharacterAndParagraphProperties | ||
63 | can contain all the properties defined by the service | ||
64 | <type scope="com::sun::star::text">Paragraph. | ||
65 | @param TextRange | ||
66 | insert position | ||
67 | @return | ||
68 | the anchor text range of the inserted text content. | ||
69 | |||
70 | @since LibreOffice 4.0 | ||
71 | */ | ||
72 | com::sun::star::text::XTextRange insertTextContentWithProperties( | ||
73 | [in] com::sun::star::text::XTextContent TextContent, | ||
74 | [in] com::sun::star::beans::PropertyValues CharacterAndParagraphProperties, | ||
75 | [in] com::sun::star::text::XTextRange TextRange ) | ||
76 | raises( com::sun::star::lang::IllegalArgumentException, | ||
77 | com::sun::star::beans::UnknownPropertyException ); | ||
78 | |||
58 | }; | 79 | }; |
59 | 80 | ||
60 | 81 | ||
diff --git a/offapi/com/sun/star/text/XTextPortionAppend.idl b/offapi/com/sun/star/text/XTextPortionAppend.idl index a1aaf5872e40..3c6c478efa93 100644 --- a/offapi/com/sun/star/text/XTextPortionAppend.idl +++ b/offapi/com/sun/star/text/XTextPortionAppend.idl | |||
@@ -53,6 +53,31 @@ interface XTextPortionAppend : com::sun::star::uno::XInterface | |||
53 | raises( com::sun::star::lang::IllegalArgumentException, | 53 | raises( com::sun::star::lang::IllegalArgumentException, |
54 | com::sun::star::beans::UnknownPropertyException ); | 54 | com::sun::star::beans::UnknownPropertyException ); |
55 | 55 | ||
56 | /** inserts a new text portion to the paragraph at a given position. | ||
57 | |||
58 | <p> The sequence can contain all the properties defined by the service <type scope="com::sun::star::text">TextPortion. | ||
59 | </p> | ||
60 | |||
61 | @param | ||
62 | Text contains the text to be inserted. | ||
63 | |||
64 | @param | ||
65 | CharacterAndParagraphProperties can contain all the properties defined by the service | ||
66 | <type scope="com::sun::star::text">Paragraph. | ||
67 | |||
68 | @param | ||
69 | TextRange specifies the position of the insert. | ||
70 | |||
71 | @since LibreOffice 4.0 | ||
72 | |||
73 | */ | ||
74 | com::sun::star::text::XTextRange insertTextPortion( | ||
75 | [in] string Text, | ||
76 | [in] com::sun::star::beans::PropertyValues CharacterAndParagraphProperties, | ||
77 | [in] com::sun::star::text::XTextRange TextRange) | ||
78 | raises( com::sun::star::lang::IllegalArgumentException, | ||
79 | com::sun::star::beans::UnknownPropertyException ); | ||
80 | |||
56 | }; | 81 | }; |
57 | 82 | ||
58 | 83 | ||
diff --git a/sw/inc/unotext.hxx b/sw/inc/unotext.hxx index 0d5d47bcd552..7c01aed506fa 100644 --- a/sw/inc/unotext.hxx +++ b/sw/inc/unotext.hxx | |||
@@ -206,7 +206,7 @@ public: | |||
206 | // XParagraphAppend | 206 | // XParagraphAppend |
207 | virtual ::com::sun::star::uno::Reference< | 207 | virtual ::com::sun::star::uno::Reference< |
208 | ::com::sun::star::text::XTextRange > SAL_CALL | 208 | ::com::sun::star::text::XTextRange > SAL_CALL |
209 | appendParagraph( | 209 | finishParagraph( |
210 | const ::com::sun::star::uno::Sequence< | 210 | const ::com::sun::star::uno::Sequence< |
211 | ::com::sun::star::beans::PropertyValue >& | 211 | ::com::sun::star::beans::PropertyValue >& |
212 | rCharacterAndParagraphProperties) | 212 | rCharacterAndParagraphProperties) |
@@ -214,10 +214,13 @@ public: | |||
214 | ::com::sun::star::uno::RuntimeException); | 214 | ::com::sun::star::uno::RuntimeException); |
215 | virtual ::com::sun::star::uno::Reference< | 215 | virtual ::com::sun::star::uno::Reference< |
216 | ::com::sun::star::text::XTextRange > SAL_CALL | 216 | ::com::sun::star::text::XTextRange > SAL_CALL |
217 | finishParagraph( | 217 | finishParagraphInsert( |
218 | const ::com::sun::star::uno::Sequence< | 218 | const ::com::sun::star::uno::Sequence< |
219 | ::com::sun::star::beans::PropertyValue >& | 219 | ::com::sun::star::beans::PropertyValue >& |
220 | rCharacterAndParagraphProperties) | 220 | rCharacterAndParagraphProperties, |
221 | const ::com::sun::star::uno::Reference< | ||
222 | ::com::sun::star::text::XTextRange >& | ||
223 | xInsertPosition) | ||
221 | throw (::com::sun::star::lang::IllegalArgumentException, | 224 | throw (::com::sun::star::lang::IllegalArgumentException, |
222 | ::com::sun::star::uno::RuntimeException); | 225 | ::com::sun::star::uno::RuntimeException); |
223 | 226 | ||
@@ -232,6 +235,19 @@ public: | |||
232 | throw (::com::sun::star::lang::IllegalArgumentException, | 235 | throw (::com::sun::star::lang::IllegalArgumentException, |
233 | ::com::sun::star::uno::RuntimeException); | 236 | ::com::sun::star::uno::RuntimeException); |
234 | 237 | ||
238 | virtual ::com::sun::star::uno::Reference< | ||
239 | ::com::sun::star::text::XTextRange > SAL_CALL | ||
240 | insertTextPortion( | ||
241 | const ::rtl::OUString& rText, | ||
242 | const ::com::sun::star::uno::Sequence< | ||
243 | ::com::sun::star::beans::PropertyValue >& | ||
244 | rCharacterAndParagraphProperties, | ||
245 | const ::com::sun::star::uno::Reference< | ||
246 | ::com::sun::star::text::XTextRange >& | ||
247 | rTextRange) | ||
248 | throw (::com::sun::star::lang::IllegalArgumentException, | ||
249 | ::com::sun::star::uno::RuntimeException); | ||
250 | |||
235 | // XTextContentAppend | 251 | // XTextContentAppend |
236 | virtual ::com::sun::star::uno::Reference< | 252 | virtual ::com::sun::star::uno::Reference< |
237 | ::com::sun::star::text::XTextRange > SAL_CALL | 253 | ::com::sun::star::text::XTextRange > SAL_CALL |
@@ -243,6 +259,17 @@ public: | |||
243 | rCharacterAndParagraphProperties) | 259 | rCharacterAndParagraphProperties) |
244 | throw (::com::sun::star::lang::IllegalArgumentException, | 260 | throw (::com::sun::star::lang::IllegalArgumentException, |
245 | ::com::sun::star::uno::RuntimeException); | 261 | ::com::sun::star::uno::RuntimeException); |
262 | virtual ::com::sun::star::uno::Reference< | ||
263 | ::com::sun::star::text::XTextRange > SAL_CALL | ||
264 | insertTextContentWithProperties( | ||
265 | const ::com::sun::star::uno::Reference< | ||
266 | ::com::sun::star::text::XTextContent >& xTextContent, | ||
267 | const ::com::sun::star::uno::Sequence< | ||
268 | ::com::sun::star::beans::PropertyValue >& | ||
269 | rCharacterAndParagraphProperties, | ||
270 | const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xInsertPosition) | ||
271 | throw (::com::sun::star::lang::IllegalArgumentException, | ||
272 | ::com::sun::star::uno::RuntimeException); | ||
246 | 273 | ||
247 | // XTextConvert | 274 | // XTextConvert |
248 | virtual ::com::sun::star::uno::Reference< | 275 | virtual ::com::sun::star::uno::Reference< |
diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx index 46576ef47bf2..cfd373766c38 100644 --- a/sw/inc/unotextrange.hxx +++ b/sw/inc/unotextrange.hxx | |||
@@ -43,7 +43,7 @@ class SwPaM; | |||
43 | class SwUnoCrsr; | 43 | class SwUnoCrsr; |
44 | class SwFrmFmt; | 44 | class SwFrmFmt; |
45 | 45 | ||
46 | class SwUnoInternalPaM | 46 | class SW_DLLPUBLIC SwUnoInternalPaM |
47 | : public SwPaM | 47 | : public SwPaM |
48 | { | 48 | { |
49 | 49 | ||
@@ -62,7 +62,7 @@ namespace sw { | |||
62 | 62 | ||
63 | void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget); | 63 | void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget); |
64 | 64 | ||
65 | bool XTextRangeToSwPaM(SwUnoInternalPaM& rToFill, | 65 | SW_DLLPUBLIC bool XTextRangeToSwPaM(SwUnoInternalPaM& rToFill, |
66 | const ::com::sun::star::uno::Reference< | 66 | const ::com::sun::star::uno::Reference< |
67 | ::com::sun::star::text::XTextRange > & xTextRange); | 67 | ::com::sun::star::text::XTextRange > & xTextRange); |
68 | 68 | ||
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 68e67c2bd81a..a5757192fe40 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx | |||
@@ -108,7 +108,8 @@ public: | |||
108 | finishOrAppendParagraph( | 108 | finishOrAppendParagraph( |
109 | const bool bFinish, | 109 | const bool bFinish, |
110 | const uno::Sequence< beans::PropertyValue >& | 110 | const uno::Sequence< beans::PropertyValue >& |
111 | rCharacterAndParagraphProperties) | 111 | rCharacterAndParagraphProperties, |
112 | const uno::Reference< text::XTextRange >& xInsertPosition) | ||
112 | throw (lang::IllegalArgumentException, uno::RuntimeException); | 113 | throw (lang::IllegalArgumentException, uno::RuntimeException); |
113 | 114 | ||
114 | sal_Int16 ComparePositions( | 115 | sal_Int16 ComparePositions( |
@@ -1251,29 +1252,31 @@ throw (uno::RuntimeException) | |||
1251 | } | 1252 | } |
1252 | 1253 | ||
1253 | uno::Reference< text::XTextRange > SAL_CALL | 1254 | uno::Reference< text::XTextRange > SAL_CALL |
1254 | SwXText::appendParagraph( | 1255 | SwXText::finishParagraph( |
1255 | const uno::Sequence< beans::PropertyValue > & rProperties) | 1256 | const uno::Sequence< beans::PropertyValue > & rProperties) |
1256 | throw (lang::IllegalArgumentException, uno::RuntimeException) | 1257 | throw (lang::IllegalArgumentException, uno::RuntimeException) |
1257 | { | 1258 | { |
1258 | SolarMutexGuard g; | 1259 | SolarMutexGuard g; |
1259 | 1260 | ||
1260 | return m_pImpl->finishOrAppendParagraph(false, rProperties); | 1261 | return m_pImpl->finishOrAppendParagraph(true, rProperties, uno::Reference< text::XTextRange >()); |
1261 | } | 1262 | } |
1262 | 1263 | ||
1263 | uno::Reference< text::XTextRange > SAL_CALL | 1264 | uno::Reference< text::XTextRange > SAL_CALL |
1264 | SwXText::finishParagraph( | 1265 | SwXText::finishParagraphInsert( |
1265 | const uno::Sequence< beans::PropertyValue > & rProperties) | 1266 | const uno::Sequence< beans::PropertyValue > & rProperties, |
1267 | const uno::Reference< text::XTextRange >& xInsertPosition) | ||
1266 | throw (lang::IllegalArgumentException, uno::RuntimeException) | 1268 | throw (lang::IllegalArgumentException, uno::RuntimeException) |
1267 | { | 1269 | { |
1268 | SolarMutexGuard g; | 1270 | SolarMutexGuard g; |
1269 | 1271 | ||
1270 | return m_pImpl->finishOrAppendParagraph(true, rProperties); | 1272 | return m_pImpl->finishOrAppendParagraph(true, rProperties, xInsertPosition); |
1271 | } | 1273 | } |
1272 | 1274 | ||
1273 | uno::Reference< text::XTextRange > | 1275 | uno::Reference< text::XTextRange > |
1274 | SwXText::Impl::finishOrAppendParagraph( | 1276 | SwXText::Impl::finishOrAppendParagraph( |
1275 | const bool bFinish, | 1277 | const bool bFinish, |
1276 | const uno::Sequence< beans::PropertyValue > & rProperties) | 1278 | const uno::Sequence< beans::PropertyValue > & rProperties, |
1279 | const uno::Reference< text::XTextRange >& xInsertPosition) | ||
1277 | throw (lang::IllegalArgumentException, uno::RuntimeException) | 1280 | throw (lang::IllegalArgumentException, uno::RuntimeException) |
1278 | { | 1281 | { |
1279 | if (!m_bIsValid) | 1282 | if (!m_bIsValid) |
@@ -1298,6 +1301,15 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) | |||
1298 | SwPosition aInsertPosition( | 1301 | SwPosition aInsertPosition( |
1299 | SwNodeIndex( *pStartNode->EndOfSectionNode(), -1 ) ); | 1302 | SwNodeIndex( *pStartNode->EndOfSectionNode(), -1 ) ); |
1300 | SwPaM aPam(aInsertPosition); | 1303 | SwPaM aPam(aInsertPosition); |
1304 | // If we got a position reference, then the insert point is not the end of | ||
1305 | // the document. | ||
1306 | if (xInsertPosition.is()) | ||
1307 | { | ||
1308 | SwUnoInternalPaM aStartPam(*m_rThis.GetDoc()); | ||
1309 | ::sw::XTextRangeToSwPaM(aStartPam, xInsertPosition); | ||
1310 | aPam = aStartPam; | ||
1311 | aPam.SetMark(); | ||
1312 | } | ||
1301 | m_pDoc->AppendTxtNode( *aPam.GetPoint() ); | 1313 | m_pDoc->AppendTxtNode( *aPam.GetPoint() ); |
1302 | // remove attributes from the previous paragraph | 1314 | // remove attributes from the previous paragraph |
1303 | m_pDoc->ResetAttrs(aPam); | 1315 | m_pDoc->ResetAttrs(aPam); |
@@ -1371,15 +1383,12 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) | |||
1371 | return xRet; | 1383 | return xRet; |
1372 | } | 1384 | } |
1373 | 1385 | ||
1374 | /*------------------------------------------------------------------------- | ||
1375 | Append text portions at the end of the last paragraph of the text | ||
1376 | interface. Support of import filters. | ||
1377 | -----------------------------------------------------------------------*/ | ||
1378 | uno::Reference< text::XTextRange > SAL_CALL | 1386 | uno::Reference< text::XTextRange > SAL_CALL |
1379 | SwXText::appendTextPortion( | 1387 | SwXText::insertTextPortion( |
1380 | const ::rtl::OUString& rText, | 1388 | const ::rtl::OUString& rText, |
1381 | const uno::Sequence< beans::PropertyValue > & | 1389 | const uno::Sequence< beans::PropertyValue > & |
1382 | rCharacterAndParagraphProperties) | 1390 | rCharacterAndParagraphProperties, |
1391 | const uno::Reference<text::XTextRange>& xInsertPosition) | ||
1383 | throw (lang::IllegalArgumentException, uno::RuntimeException) | 1392 | throw (lang::IllegalArgumentException, uno::RuntimeException) |
1384 | { | 1393 | { |
1385 | SolarMutexGuard aGuard; | 1394 | SolarMutexGuard aGuard; |
@@ -1390,7 +1399,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) | |||
1390 | } | 1399 | } |
1391 | uno::Reference< text::XTextRange > xRet; | 1400 | uno::Reference< text::XTextRange > xRet; |
1392 | const uno::Reference< text::XTextCursor > xTextCursor = CreateCursor(); | 1401 | const uno::Reference< text::XTextCursor > xTextCursor = CreateCursor(); |
1393 | xTextCursor->gotoEnd(sal_False); | 1402 | xTextCursor->gotoRange(xInsertPosition, sal_False); |
1394 | 1403 | ||
1395 | const uno::Reference< lang::XUnoTunnel > xRangeTunnel( | 1404 | const uno::Reference< lang::XUnoTunnel > xRangeTunnel( |
1396 | xTextCursor, uno::UNO_QUERY_THROW ); | 1405 | xTextCursor, uno::UNO_QUERY_THROW ); |
@@ -1405,7 +1414,6 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) | |||
1405 | // SwPaM aPam(*pStartNode->EndOfSectionNode()); | 1414 | // SwPaM aPam(*pStartNode->EndOfSectionNode()); |
1406 | //aPam.Move( fnMoveBackward, fnGoNode ); | 1415 | //aPam.Move( fnMoveBackward, fnGoNode ); |
1407 | SwUnoCrsr *const pCursor = pTextCursor->GetCursor(); | 1416 | SwUnoCrsr *const pCursor = pTextCursor->GetCursor(); |
1408 | pCursor->MovePara( fnParaCurr, fnParaEnd ); | ||
1409 | m_pImpl->m_pDoc->DontExpandFmt( *pCursor->Start() ); | 1417 | m_pImpl->m_pDoc->DontExpandFmt( *pCursor->Start() ); |
1410 | 1418 | ||
1411 | if (!rText.isEmpty()) | 1419 | if (!rText.isEmpty()) |
@@ -1477,14 +1485,32 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) | |||
1477 | } | 1485 | } |
1478 | 1486 | ||
1479 | /*------------------------------------------------------------------------- | 1487 | /*------------------------------------------------------------------------- |
1480 | enable appending text contents like graphic objects, shapes and so on | 1488 | Append text portions at the end of the last paragraph of the text |
1489 | interface. Support of import filters. | ||
1490 | -----------------------------------------------------------------------*/ | ||
1491 | uno::Reference< text::XTextRange > SAL_CALL | ||
1492 | SwXText::appendTextPortion( | ||
1493 | const ::rtl::OUString& rText, | ||
1494 | const uno::Sequence< beans::PropertyValue > & | ||
1495 | rCharacterAndParagraphProperties) | ||
1496 | throw (lang::IllegalArgumentException, uno::RuntimeException) | ||
1497 | { | ||
1498 | // Right now this doesn't need a guard, as it's just calling the insert | ||
1499 | // version, that has it already. | ||
1500 | uno::Reference<text::XTextRange> xInsertPosition = getEnd(); | ||
1501 | return insertTextPortion(rText, rCharacterAndParagraphProperties, xInsertPosition); | ||
1502 | } | ||
1503 | |||
1504 | /*------------------------------------------------------------------------- | ||
1505 | enable inserting/appending text contents like graphic objects, shapes and so on | ||
1481 | to support import filters | 1506 | to support import filters |
1482 | -----------------------------------------------------------------------*/ | 1507 | -----------------------------------------------------------------------*/ |
1483 | uno::Reference< text::XTextRange > SAL_CALL | 1508 | uno::Reference< text::XTextRange > SAL_CALL |
1484 | SwXText::appendTextContent( | 1509 | SwXText::insertTextContentWithProperties( |
1485 | const uno::Reference< text::XTextContent >& xTextContent, | 1510 | const uno::Reference< text::XTextContent >& xTextContent, |
1486 | const uno::Sequence< beans::PropertyValue >& | 1511 | const uno::Sequence< beans::PropertyValue >& |
1487 | rCharacterAndParagraphProperties) | 1512 | rCharacterAndParagraphProperties, |
1513 | const uno::Reference< text::XTextRange >& xInsertPosition) | ||
1488 | throw (lang::IllegalArgumentException, uno::RuntimeException) | 1514 | throw (lang::IllegalArgumentException, uno::RuntimeException) |
1489 | { | 1515 | { |
1490 | SolarMutexGuard aGuard; | 1516 | SolarMutexGuard aGuard; |
@@ -1493,25 +1519,11 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) | |||
1493 | { | 1519 | { |
1494 | throw uno::RuntimeException(); | 1520 | throw uno::RuntimeException(); |
1495 | } | 1521 | } |
1496 | SwStartNode const*const pStartNode = GetStartNode(); | ||
1497 | if(!pStartNode) | ||
1498 | { | ||
1499 | throw uno::RuntimeException(); | ||
1500 | } | ||
1501 | 1522 | ||
1502 | uno::Reference< text::XTextRange > xRet; | ||
1503 | m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL); | 1523 | m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL); |
1504 | // find end node, go backward - don't skip tables because the | 1524 | |
1505 | // new paragraph has to be the last node | ||
1506 | SwPaM aPam(*pStartNode->EndOfSectionNode()); | ||
1507 | aPam.Move( fnMoveBackward, fnGoNode ); | ||
1508 | // set cursor to the end of the last text node | ||
1509 | SwCursor aCursor( *aPam.Start(), 0, false ); | ||
1510 | xRet = new SwXTextRange(aCursor, this); | ||
1511 | aCursor.MovePara( fnParaCurr, fnParaEnd ); | ||
1512 | m_pImpl->m_pDoc->DontExpandFmt( *aCursor.Start() ); | ||
1513 | // now attach the text content here | 1525 | // now attach the text content here |
1514 | insertTextContent( xRet, xTextContent, false ); | 1526 | insertTextContent( xInsertPosition, xTextContent, false ); |
1515 | // now apply the properties to the anchor | 1527 | // now apply the properties to the anchor |
1516 | if (rCharacterAndParagraphProperties.getLength()) | 1528 | if (rCharacterAndParagraphProperties.getLength()) |
1517 | { | 1529 | { |
@@ -1536,7 +1548,20 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) | |||
1536 | } | 1548 | } |
1537 | } | 1549 | } |
1538 | m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL); | 1550 | m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL); |
1539 | return xRet; | 1551 | return xInsertPosition; |
1552 | } | ||
1553 | |||
1554 | uno::Reference< text::XTextRange > SAL_CALL | ||
1555 | SwXText::appendTextContent( | ||
1556 | const uno::Reference< text::XTextContent >& xTextContent, | ||
1557 | const uno::Sequence< beans::PropertyValue >& | ||
1558 | rCharacterAndParagraphProperties) | ||
1559 | throw (lang::IllegalArgumentException, uno::RuntimeException) | ||
1560 | { | ||
1561 | // Right now this doesn't need a guard, as it's just calling the insert | ||
1562 | // version, that has it already. | ||
1563 | uno::Reference<text::XTextRange> xInsertPosition = getEnd(); | ||
1564 | return insertTextContentWithProperties(xTextContent, rCharacterAndParagraphProperties, xInsertPosition); | ||
1540 | } | 1565 | } |
1541 | 1566 | ||
1542 | // move previously appended paragraphs into a text frames | 1567 | // move previously appended paragraphs into a text frames |
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index d4d59c0b62b2..e06c02ba6208 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx | |||
@@ -89,6 +89,7 @@ | |||
89 | 89 | ||
90 | #include <docsh.hxx> | 90 | #include <docsh.hxx> |
91 | #include <fmtlsplt.hxx> // SwLayoutSplit | 91 | #include <fmtlsplt.hxx> // SwLayoutSplit |
92 | #include <unotextrange.hxx> | ||
92 | #include <editeng/keepitem.hxx> | 93 | #include <editeng/keepitem.hxx> |
93 | #include <svx/svdopath.hxx> | 94 | #include <svx/svdopath.hxx> |
94 | #include <svx/svdorect.hxx> | 95 | #include <svx/svdorect.hxx> |
@@ -117,6 +118,7 @@ | |||
117 | #include <com/sun/star/document/XFilter.hpp> | 118 | #include <com/sun/star/document/XFilter.hpp> |
118 | #include <com/sun/star/document/XImporter.hpp> | 119 | #include <com/sun/star/document/XImporter.hpp> |
119 | #include <com/sun/star/document/XExporter.hpp> | 120 | #include <com/sun/star/document/XExporter.hpp> |
121 | #include <com/sun/star/text/XTextRange.hpp> | ||
120 | 122 | ||
121 | 123 | ||
122 | using namespace ::com::sun::star; | 124 | using namespace ::com::sun::star; |
@@ -136,11 +138,31 @@ class SwRTFReader : public Reader | |||
136 | virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &); | 138 | virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &); |
137 | }; | 139 | }; |
138 | 140 | ||
139 | sal_uLong SwRTFReader::Read( SwDoc &rDoc, const String& /*rBaseURL*/, SwPaM& /*rPam*/, const String &) | 141 | sal_uLong SwRTFReader::Read( SwDoc &rDoc, const String& /*rBaseURL*/, SwPaM& rPam, const String &) |
140 | { | 142 | { |
141 | if (!pStrm) | 143 | if (!pStrm) |
142 | return ERR_SWG_READ_ERROR; | 144 | return ERR_SWG_READ_ERROR; |
143 | 145 | ||
146 | // We want to work in an empty paragraph. | ||
147 | // Step 1: XTextRange will be updated when content is inserted, so we know | ||
148 | // the end position. | ||
149 | const uno::Reference<text::XTextRange> xInsertPosition = | ||
150 | SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), 0); | ||
151 | SwNodeIndex *pSttNdIdx = new SwNodeIndex(rDoc.GetNodes()); | ||
152 | const SwPosition* pPos = rPam.GetPoint(); | ||
153 | |||
154 | // Step 2: Split once and remember the node that has been splitted. | ||
155 | rDoc.SplitNode( *pPos, false ); | ||
156 | *pSttNdIdx = pPos->nNode.GetIndex()-1; | ||
157 | |||
158 | // Step 3: Split again. | ||
159 | rDoc.SplitNode( *pPos, false ); | ||
160 | |||
161 | // Step 4: Insert all content into the new node | ||
162 | rPam.Move( fnMoveBackward ); | ||
163 | rDoc.SetTxtFmtColl | ||
164 | ( rPam, rDoc.GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ) ); | ||
165 | |||
144 | SwDocShell *pDocShell(rDoc.GetDocShell()); | 166 | SwDocShell *pDocShell(rDoc.GetDocShell()); |
145 | uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory()); | 167 | uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory()); |
146 | uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance( | 168 | uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance( |
@@ -150,15 +172,53 @@ sal_uLong SwRTFReader::Read( SwDoc &rDoc, const String& /*rBaseURL*/, SwPaM& /*r | |||
150 | uno::Reference<lang::XComponent> xDstDoc(pDocShell->GetModel(), uno::UNO_QUERY_THROW); | 172 | uno::Reference<lang::XComponent> xDstDoc(pDocShell->GetModel(), uno::UNO_QUERY_THROW); |
151 | xImporter->setTargetDocument(xDstDoc); | 173 | xImporter->setTargetDocument(xDstDoc); |
152 | 174 | ||
175 | const uno::Reference<text::XTextRange> xInsertTextRange = | ||
176 | SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), 0); | ||
177 | |||
153 | uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW); | 178 | uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW); |
154 | uno::Sequence<beans::PropertyValue> aDescriptor(2); | 179 | uno::Sequence<beans::PropertyValue> aDescriptor(3); |
155 | aDescriptor[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")); | 180 | aDescriptor[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")); |
156 | uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStrm)); | 181 | uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStrm)); |
157 | aDescriptor[0].Value <<= xStream; | 182 | aDescriptor[0].Value <<= xStream; |
158 | aDescriptor[1].Name = "IsNewDoc"; | 183 | aDescriptor[1].Name = "IsNewDoc"; |
159 | aDescriptor[1].Value <<= sal_False; | 184 | aDescriptor[1].Value <<= sal_False; |
185 | aDescriptor[2].Name = "TextInsertModeRange"; | ||
186 | aDescriptor[2].Value <<= xInsertTextRange; | ||
160 | xFilter->filter(aDescriptor); | 187 | xFilter->filter(aDescriptor); |
161 | 188 | ||
189 | // Clean up the fake paragraphs. | ||
190 | SwUnoInternalPaM aPam(rDoc); | ||
191 | ::sw::XTextRangeToSwPaM(aPam, xInsertPosition); | ||
192 | if (pSttNdIdx->GetIndex()) | ||
193 | { | ||
194 | // If we are in insert mode, join the splitted node that is in front | ||
195 | // of the new content with the first new node. Or in other words: | ||
196 | // Revert the first split node. | ||
197 | SwTxtNode* pTxtNode = pSttNdIdx->GetNode().GetTxtNode(); | ||
198 | SwNodeIndex aNxtIdx( *pSttNdIdx ); | ||
199 | if( pTxtNode && pTxtNode->CanJoinNext( &aNxtIdx ) && | ||
200 | pSttNdIdx->GetIndex() + 1 == aNxtIdx.GetIndex() ) | ||
201 | { | ||
202 | // If the PaM points to the first new node, move the PaM to the | ||
203 | // end of the previous node. | ||
204 | if( aPam.GetPoint()->nNode == aNxtIdx ) | ||
205 | { | ||
206 | aPam.GetPoint()->nNode = *pSttNdIdx; | ||
207 | aPam.GetPoint()->nContent.Assign( pTxtNode, | ||
208 | pTxtNode->GetTxt().Len() ); | ||
209 | } | ||
210 | // If the first new node isn't empty, convert the node's text | ||
211 | // attributes into hints. Otherwise, set the new node's | ||
212 | // paragraph style at the previous (empty) node. | ||
213 | SwTxtNode* pDelNd = aNxtIdx.GetNode().GetTxtNode(); | ||
214 | if( pTxtNode->GetTxt().Len() ) | ||
215 | pDelNd->FmtToTxtAttr( pTxtNode ); | ||
216 | else | ||
217 | pTxtNode->ChgFmtColl( pDelNd->GetTxtColl() ); | ||
218 | pTxtNode->JoinNext(); | ||
219 | } | ||
220 | } | ||
221 | |||
162 | return 0; | 222 | return 0; |
163 | } | 223 | } |
164 | 224 | ||
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx index 87e28d27a234..26654d728c0f 100644 --- a/writerfilter/inc/dmapper/DomainMapper.hxx +++ b/writerfilter/inc/dmapper/DomainMapper.hxx | |||
@@ -82,6 +82,7 @@ public: | |||
82 | ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModel, | 82 | ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModel, |
83 | bool bRepairStorage, | 83 | bool bRepairStorage, |
84 | SourceDocumentType eDocumentType, | 84 | SourceDocumentType eDocumentType, |
85 | ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xInsertTextRange, | ||
85 | bool bIsNewDoc = true); | 86 | bool bIsNewDoc = true); |
86 | virtual ~DomainMapper(); | 87 | virtual ~DomainMapper(); |
87 | 88 | ||
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index a768dc364267..5ae8e1389589 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx | |||
@@ -87,11 +87,12 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon | |||
87 | uno::Reference< lang::XComponent > xModel, | 87 | uno::Reference< lang::XComponent > xModel, |
88 | bool bRepairStorage, | 88 | bool bRepairStorage, |
89 | SourceDocumentType eDocumentType, | 89 | SourceDocumentType eDocumentType, |
90 | uno::Reference< text::XTextRange > xInsertTextRange, | ||
90 | bool bIsNewDoc ) : | 91 | bool bIsNewDoc ) : |
91 | LoggedProperties(dmapper_logger, "DomainMapper"), | 92 | LoggedProperties(dmapper_logger, "DomainMapper"), |
92 | LoggedTable(dmapper_logger, "DomainMapper"), | 93 | LoggedTable(dmapper_logger, "DomainMapper"), |
93 | LoggedStream(dmapper_logger, "DomainMapper"), | 94 | LoggedStream(dmapper_logger, "DomainMapper"), |
94 | m_pImpl( new DomainMapper_Impl( *this, xContext, xModel, eDocumentType, bIsNewDoc )), | 95 | m_pImpl( new DomainMapper_Impl( *this, xContext, xModel, eDocumentType, xInsertTextRange, bIsNewDoc )), |
95 | mnBackgroundColor(0), mbIsHighlightSet(false) | 96 | mnBackgroundColor(0), mbIsHighlightSet(false) |
96 | { | 97 | { |
97 | // #i24363# tab stops relative to indent | 98 | // #i24363# tab stops relative to indent |
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index fbf9acb46caf..a204c690fa4c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx | |||
@@ -156,6 +156,7 @@ DomainMapper_Impl::DomainMapper_Impl( | |||
156 | uno::Reference < uno::XComponentContext > xContext, | 156 | uno::Reference < uno::XComponentContext > xContext, |
157 | uno::Reference< lang::XComponent > xModel, | 157 | uno::Reference< lang::XComponent > xModel, |
158 | SourceDocumentType eDocumentType, | 158 | SourceDocumentType eDocumentType, |
159 | uno::Reference< text::XTextRange > xInsertTextRange, | ||
159 | bool bIsNewDoc) : | 160 | bool bIsNewDoc) : |
160 | m_eDocumentType( eDocumentType ), | 161 | m_eDocumentType( eDocumentType ), |
161 | m_rDMapper( rDMapper ), | 162 | m_rDMapper( rDMapper ), |
@@ -184,12 +185,14 @@ DomainMapper_Impl::DomainMapper_Impl( | |||
184 | m_bParaSectpr( false ), | 185 | m_bParaSectpr( false ), |
185 | m_bUsingEnhancedFields( false ), | 186 | m_bUsingEnhancedFields( false ), |
186 | m_bSdt(false), | 187 | m_bSdt(false), |
188 | m_xInsertTextRange(xInsertTextRange), | ||
187 | m_bIsNewDoc(bIsNewDoc) | 189 | m_bIsNewDoc(bIsNewDoc) |
188 | { | 190 | { |
189 | appendTableManager( ); | 191 | appendTableManager( ); |
190 | GetBodyText(); | 192 | GetBodyText(); |
191 | uno::Reference< text::XTextAppend > xBodyTextAppend = uno::Reference< text::XTextAppend >( m_xBodyText, uno::UNO_QUERY ); | 193 | uno::Reference< text::XTextAppend > xBodyTextAppend = uno::Reference< text::XTextAppend >( m_xBodyText, uno::UNO_QUERY ); |
192 | m_aTextAppendStack.push(xBodyTextAppend); | 194 | m_aTextAppendStack.push(TextAppendContext(xBodyTextAppend, |
195 | m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(m_xInsertTextRange))); | ||
193 | 196 | ||
194 | //todo: does it make sense to set the body text as static text interface? | 197 | //todo: does it make sense to set the body text as static text interface? |
195 | uno::Reference< text::XTextAppendAndConvert > xBodyTextAppendAndConvert( m_xBodyText, uno::UNO_QUERY ); | 198 | uno::Reference< text::XTextAppendAndConvert > xBodyTextAppendAndConvert( m_xBodyText, uno::UNO_QUERY ); |
@@ -268,8 +271,14 @@ void DomainMapper_Impl::RemoveLastParagraph( ) | |||
268 | return; | 271 | return; |
269 | try | 272 | try |
270 | { | 273 | { |
271 | uno::Reference< text::XTextCursor > xCursor = xTextAppend->createTextCursor(); | 274 | uno::Reference< text::XTextCursor > xCursor; |
272 | xCursor->gotoEnd(false); | 275 | if (m_bIsNewDoc) |
276 | { | ||
277 | xCursor = xTextAppend->createTextCursor(); | ||
278 | xCursor->gotoEnd(false); | ||
279 | } | ||
280 | else | ||
281 | xCursor.set(m_aTextAppendStack.top().xCursor, uno::UNO_QUERY); | ||
273 | xCursor->goLeft( 1, true ); | 282 | xCursor->goLeft( 1, true ); |
274 | xCursor->setString(OUString()); | 283 | xCursor->setString(OUString()); |
275 | } | 284 | } |
@@ -1043,13 +1052,22 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) | |||
1043 | aProperties[nLength].Value <<= aDrop; | 1052 | aProperties[nLength].Value <<= aDrop; |
1044 | aProperties[nLength].Name = rPropNameSupplier.GetName(PROP_DROP_CAP_FORMAT); | 1053 | aProperties[nLength].Name = rPropNameSupplier.GetName(PROP_DROP_CAP_FORMAT); |
1045 | } | 1054 | } |
1046 | uno::Reference< text::XTextRange > xTextRange = | 1055 | uno::Reference< text::XTextRange > xTextRange; |
1047 | xTextAppend->finishParagraph( aProperties ); | 1056 | if (rAppendContext.xInsertPosition.is()) |
1057 | { | ||
1058 | xTextRange = xTextAppend->finishParagraphInsert( aProperties, rAppendContext.xInsertPosition ); | ||
1059 | rAppendContext.xCursor->gotoNextParagraph(false); | ||
1060 | } | ||
1061 | else | ||
1062 | xTextRange = xTextAppend->finishParagraph( aProperties ); | ||
1048 | getTableManager( ).handle(xTextRange); | 1063 | getTableManager( ).handle(xTextRange); |
1049 | 1064 | ||
1050 | // Get the end of paragraph character inserted | 1065 | // Get the end of paragraph character inserted |
1051 | uno::Reference< text::XTextCursor > xCur = xTextRange->getText( )->createTextCursor( ); | 1066 | uno::Reference< text::XTextCursor > xCur = xTextRange->getText( )->createTextCursor( ); |
1052 | xCur->gotoEnd( false ); | 1067 | if (rAppendContext.xInsertPosition.is()) |
1068 | xCur->gotoRange( rAppendContext.xInsertPosition, false ); | ||
1069 | else | ||
1070 | xCur->gotoEnd( false ); | ||
1053 | xCur->goLeft( 1 , true ); | 1071 | xCur->goLeft( 1 , true ); |
1054 | uno::Reference< text::XTextRange > xParaEnd( xCur, uno::UNO_QUERY ); | 1072 | uno::Reference< text::XTextRange > xParaEnd( xCur, uno::UNO_QUERY ); |
1055 | CheckParaRedline( xParaEnd ); | 1073 | CheckParaRedline( xParaEnd ); |
@@ -1112,9 +1130,14 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, PropertyMapP | |||
1112 | { | 1130 | { |
1113 | try | 1131 | try |
1114 | { | 1132 | { |
1115 | uno::Reference< text::XTextRange > xTextRange = | 1133 | uno::Reference< text::XTextRange > xTextRange; |
1116 | xTextAppend->appendTextPortion | 1134 | if (m_aTextAppendStack.top().xInsertPosition.is()) |
1117 | (rString, pPropertyMap->GetPropertyValues()); | 1135 | { |
1136 | xTextRange = xTextAppend->insertTextPortion(rString, pPropertyMap->GetPropertyValues(), m_aTextAppendStack.top().xInsertPosition); | ||
1137 | m_aTextAppendStack.top().xCursor->gotoRange(xTextRange->getEnd(), false); | ||
1138 | } | ||
1139 | else | ||
1140 | xTextRange = xTextAppend->appendTextPortion(rString, pPropertyMap->GetPropertyValues()); | ||
1118 | CheckRedline( xTextRange ); | 1141 | CheckRedline( xTextRange ); |
1119 | m_bParaChanged = true; | 1142 | m_bParaChanged = true; |
1120 | 1143 | ||
@@ -1143,7 +1166,10 @@ void DomainMapper_Impl::appendTextContent( | |||
1143 | { | 1166 | { |
1144 | try | 1167 | try |
1145 | { | 1168 | { |
1146 | xTextAppendAndConvert->appendTextContent( xContent, xPropertyValues ); | 1169 | if (m_aTextAppendStack.top().xInsertPosition.is()) |
1170 | xTextAppendAndConvert->insertTextContentWithProperties( xContent, xPropertyValues, m_aTextAppendStack.top().xInsertPosition ); | ||
1171 | else | ||
1172 | xTextAppendAndConvert->appendTextContent( xContent, xPropertyValues ); | ||
1147 | } | 1173 | } |
1148 | catch(const lang::IllegalArgumentException&) | 1174 | catch(const lang::IllegalArgumentException&) |
1149 | { | 1175 | { |
@@ -1249,7 +1275,10 @@ uno::Reference< beans::XPropertySet > DomainMapper_Impl::appendTextSectionAfter( | |||
1249 | xTextAppend->createTextCursorByRange( xBefore ), uno::UNO_QUERY_THROW); | 1275 | xTextAppend->createTextCursorByRange( xBefore ), uno::UNO_QUERY_THROW); |
1250 | //the cursor has been moved to the end of the paragraph because of the appendTextPortion() calls | 1276 | //the cursor has been moved to the end of the paragraph because of the appendTextPortion() calls |
1251 | xCursor->gotoStartOfParagraph( false ); | 1277 | xCursor->gotoStartOfParagraph( false ); |
1252 | xCursor->gotoEnd( true ); | 1278 | if (m_aTextAppendStack.top().xInsertPosition.is()) |
1279 | xCursor->gotoRange( m_aTextAppendStack.top().xInsertPosition, true ); | ||
1280 | else | ||
1281 | xCursor->gotoEnd( true ); | ||
1253 | //the paragraph after this new section is already inserted | 1282 | //the paragraph after this new section is already inserted |
1254 | xCursor->goLeft(1, true); | 1283 | xCursor->goLeft(1, true); |
1255 | static const OUString sSectionService("com.sun.star.text.TextSection"); | 1284 | static const OUString sSectionService("com.sun.star.text.TextSection"); |
@@ -1299,7 +1328,8 @@ void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType) | |||
1299 | //set the interface | 1328 | //set the interface |
1300 | uno::Reference< text::XText > xHeaderText; | 1329 | uno::Reference< text::XText > xHeaderText; |
1301 | xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_HEADER_TEXT_LEFT : PROP_HEADER_TEXT) ) >>= xHeaderText; | 1330 | xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_HEADER_TEXT_LEFT : PROP_HEADER_TEXT) ) >>= xHeaderText; |
1302 | m_aTextAppendStack.push( uno::Reference< text::XTextAppend >( xHeaderText, uno::UNO_QUERY_THROW)); | 1331 | m_aTextAppendStack.push( TextAppendContext(uno::Reference< text::XTextAppend >( xHeaderText, uno::UNO_QUERY_THROW), |
1332 | m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xHeaderText->getStart()))); | ||
1303 | } | 1333 | } |
1304 | catch( const uno::Exception& ) | 1334 | catch( const uno::Exception& ) |
1305 | { | 1335 | { |
@@ -1339,7 +1369,8 @@ void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType) | |||
1339 | //set the interface | 1369 | //set the interface |
1340 | uno::Reference< text::XText > xFooterText; | 1370 | uno::Reference< text::XText > xFooterText; |
1341 | xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_FOOTER_TEXT_LEFT : PROP_FOOTER_TEXT) ) >>= xFooterText; | 1371 | xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_FOOTER_TEXT_LEFT : PROP_FOOTER_TEXT) ) >>= xFooterText; |
1342 | m_aTextAppendStack.push(uno::Reference< text::XTextAppend >( xFooterText, uno::UNO_QUERY_THROW )); | 1372 | m_aTextAppendStack.push(TextAppendContext(uno::Reference< text::XTextAppend >( xFooterText, uno::UNO_QUERY_THROW ), |
1373 | m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xFooterText->getStart()))); | ||
1343 | } | 1374 | } |
1344 | catch( const uno::Exception& ) | 1375 | catch( const uno::Exception& ) |
1345 | { | 1376 | { |
@@ -1394,7 +1425,8 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote ) | |||
1394 | aFontProperties = aFontProps->GetPropertyValues(); | 1425 | aFontProperties = aFontProps->GetPropertyValues(); |
1395 | } | 1426 | } |
1396 | appendTextContent( uno::Reference< text::XTextContent >( xFootnoteText, uno::UNO_QUERY_THROW ), aFontProperties ); | 1427 | appendTextContent( uno::Reference< text::XTextContent >( xFootnoteText, uno::UNO_QUERY_THROW ), aFontProperties ); |
1397 | m_aTextAppendStack.push(uno::Reference< text::XTextAppend >( xFootnoteText, uno::UNO_QUERY_THROW )); | 1428 | m_aTextAppendStack.push(TextAppendContext(uno::Reference< text::XTextAppend >( xFootnoteText, uno::UNO_QUERY_THROW ), |
1429 | m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xFootnoteText->getStart()))); | ||
1398 | 1430 | ||
1399 | // Redlines for the footnote anchor | 1431 | // Redlines for the footnote anchor |
1400 | CheckRedline( xFootnote->getAnchor( ) ); | 1432 | CheckRedline( xFootnote->getAnchor( ) ); |
@@ -1493,7 +1525,8 @@ void DomainMapper_Impl::PushAnnotation() | |||
1493 | uno::UNO_QUERY_THROW ); | 1525 | uno::UNO_QUERY_THROW ); |
1494 | uno::Reference< text::XText > xAnnotationText; | 1526 | uno::Reference< text::XText > xAnnotationText; |
1495 | m_xAnnotationField->getPropertyValue("TextRange") >>= xAnnotationText; | 1527 | m_xAnnotationField->getPropertyValue("TextRange") >>= xAnnotationText; |
1496 | m_aTextAppendStack.push(uno::Reference< text::XTextAppend >( xAnnotationText, uno::UNO_QUERY_THROW )); | 1528 | m_aTextAppendStack.push(TextAppendContext(uno::Reference< text::XTextAppend >( xAnnotationText, uno::UNO_QUERY_THROW ), |
1529 | m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xAnnotationText->getStart()))); | ||
1497 | } | 1530 | } |
1498 | catch( const uno::Exception& ) | 1531 | catch( const uno::Exception& ) |
1499 | { | 1532 | { |
@@ -1548,8 +1581,10 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape | |||
1548 | uno::Reference<text::XTextAppend> xTextAppend = m_aTextAppendStack.top().xTextAppend; | 1581 | uno::Reference<text::XTextAppend> xTextAppend = m_aTextAppendStack.top().xTextAppend; |
1549 | try | 1582 | try |
1550 | { | 1583 | { |
1584 | uno::Reference< text::XTextRange > xShapeText( xShape, uno::UNO_QUERY_THROW); | ||
1551 | // Add the shape to the text append stack | 1585 | // Add the shape to the text append stack |
1552 | m_aTextAppendStack.push( uno::Reference< text::XTextAppend >( xShape, uno::UNO_QUERY_THROW ) ); | 1586 | m_aTextAppendStack.push( TextAppendContext(uno::Reference< text::XTextAppend >( xShape, uno::UNO_QUERY_THROW ), |
1587 | m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xShapeText->getStart() ))); | ||
1553 | 1588 | ||
1554 | // Add the shape to the anchored objects stack | 1589 | // Add the shape to the anchored objects stack |
1555 | uno::Reference< text::XTextContent > xTxtContent( xShape, uno::UNO_QUERY_THROW ); | 1590 | uno::Reference< text::XTextContent > xTxtContent( xShape, uno::UNO_QUERY_THROW ); |
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 87145420d0dd..585745532b20 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx | |||
@@ -19,6 +19,7 @@ | |||
19 | #ifndef INCLUDED_DMAPPER_DOMAINMAPPER_IMPL_HXX | 19 | #ifndef INCLUDED_DMAPPER_DOMAINMAPPER_IMPL_HXX |
20 | #define INCLUDED_DMAPPER_DOMAINMAPPER_IMPL_HXX | 20 | #define INCLUDED_DMAPPER_DOMAINMAPPER_IMPL_HXX |
21 | 21 | ||
22 | #include <com/sun/star/text/XParagraphCursor.hpp> | ||
22 | #include <com/sun/star/text/XTextDocument.hpp> | 23 | #include <com/sun/star/text/XTextDocument.hpp> |
23 | #include <com/sun/star/text/XTextCursor.hpp> | 24 | #include <com/sun/star/text/XTextCursor.hpp> |
24 | #include <com/sun/star/text/XTextAppend.hpp> | 25 | #include <com/sun/star/text/XTextAppend.hpp> |
@@ -167,10 +168,17 @@ public: | |||
167 | struct TextAppendContext | 168 | struct TextAppendContext |
168 | { | 169 | { |
169 | ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend > xTextAppend; | 170 | ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend > xTextAppend; |
171 | ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xInsertPosition; | ||
172 | ::com::sun::star::uno::Reference< ::com::sun::star::text::XParagraphCursor > xCursor; | ||
170 | ParagraphPropertiesPtr pLastParagraphProperties; | 173 | ParagraphPropertiesPtr pLastParagraphProperties; |
171 | 174 | ||
172 | TextAppendContext( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend >& xAppend ) : | 175 | TextAppendContext( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextAppend >& xAppend, |
173 | xTextAppend( xAppend ){} | 176 | const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor >& xCur ) : |
177 | xTextAppend( xAppend ) | ||
178 | { | ||
179 | xCursor.set(xCur, uno::UNO_QUERY); | ||
180 | xInsertPosition.set(xCursor, uno::UNO_QUERY); | ||
181 | } | ||
174 | }; | 182 | }; |
175 | 183 | ||
176 | struct AnchoredContext | 184 | struct AnchoredContext |
@@ -373,6 +381,9 @@ private: | |||
373 | 381 | ||
374 | std::map< sal_Int32, com::sun::star::uno::Any > deferredCharacterProperties; | 382 | std::map< sal_Int32, com::sun::star::uno::Any > deferredCharacterProperties; |
375 | 383 | ||
384 | public: | ||
385 | ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > m_xInsertTextRange; | ||
386 | private: | ||
376 | bool m_bIsNewDoc; | 387 | bool m_bIsNewDoc; |
377 | 388 | ||
378 | public: | 389 | public: |
@@ -381,6 +392,7 @@ public: | |||
381 | uno::Reference < uno::XComponentContext > xContext, | 392 | uno::Reference < uno::XComponentContext > xContext, |
382 | uno::Reference< lang::XComponent > xModel, | 393 | uno::Reference< lang::XComponent > xModel, |
383 | SourceDocumentType eDocumentType, | 394 | SourceDocumentType eDocumentType, |
395 | uno::Reference< text::XTextRange > xInsertTextRange, | ||
384 | bool bIsNewDoc ); | 396 | bool bIsNewDoc ); |
385 | virtual ~DomainMapper_Impl(); | 397 | virtual ~DomainMapper_Impl(); |
386 | 398 | ||
diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx index e482d5b7ffcc..d58e87725178 100644 --- a/writerfilter/source/filter/ImportFilter.cxx +++ b/writerfilter/source/filter/ImportFilter.cxx | |||
@@ -99,7 +99,7 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes | |||
99 | m_sFilterName == "writer_OOXML" || m_sFilterName == "writer_OOXML_Text_Template" ) ? | 99 | m_sFilterName == "writer_OOXML" || m_sFilterName == "writer_OOXML_Text_Template" ) ? |
100 | writerfilter::dmapper::DOCUMENT_OOXML : writerfilter::dmapper::DOCUMENT_DOC; | 100 | writerfilter::dmapper::DOCUMENT_OOXML : writerfilter::dmapper::DOCUMENT_DOC; |
101 | 101 | ||
102 | writerfilter::Stream::Pointer_t pStream(new writerfilter::dmapper::DomainMapper(m_xContext, xInputStream, m_xDstDoc, bRepairStorage, eType)); | 102 | writerfilter::Stream::Pointer_t pStream(new writerfilter::dmapper::DomainMapper(m_xContext, xInputStream, m_xDstDoc, bRepairStorage, eType, uno::Reference<text::XTextRange>())); |
103 | //create the tokenizer and domain mapper | 103 | //create the tokenizer and domain mapper |
104 | if( eType == writerfilter::dmapper::DOCUMENT_OOXML ) | 104 | if( eType == writerfilter::dmapper::DOCUMENT_OOXML ) |
105 | { | 105 | { |
diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx index 27373a44de79..ac84d2982e4d 100644 --- a/writerfilter/source/filter/RtfFilter.cxx +++ b/writerfilter/source/filter/RtfFilter.cxx | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <com/sun/star/task/XStatusIndicator.hpp> | 29 | #include <com/sun/star/task/XStatusIndicator.hpp> |
30 | #include <com/sun/star/io/WrongFormatException.hpp> | 30 | #include <com/sun/star/io/WrongFormatException.hpp> |
31 | #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> | 31 | #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> |
32 | #include <com/sun/star/text/XTextRange.hpp> | ||
32 | #ifdef DBG_COPYPASTE | 33 | #ifdef DBG_COPYPASTE |
33 | #include <unotools/localfilehelper.hxx> | 34 | #include <unotools/localfilehelper.hxx> |
34 | #include <tools/stream.hxx> | 35 | #include <tools/stream.hxx> |
@@ -75,6 +76,7 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri | |||
75 | MediaDescriptor aMediaDesc( aDescriptor ); | 76 | MediaDescriptor aMediaDesc( aDescriptor ); |
76 | bool bRepairStorage = aMediaDesc.getUnpackedValueOrDefault( "RepairPackage", false ); | 77 | bool bRepairStorage = aMediaDesc.getUnpackedValueOrDefault( "RepairPackage", false ); |
77 | bool bIsNewDoc = aMediaDesc.getUnpackedValueOrDefault( "IsNewDoc", true ); | 78 | bool bIsNewDoc = aMediaDesc.getUnpackedValueOrDefault( "IsNewDoc", true ); |
79 | uno::Reference<text::XTextRange> xInsertTextRange = aMediaDesc.getUnpackedValueOrDefault( "TextInsertModeRange", uno::Reference<text::XTextRange>()); | ||
78 | #ifdef DEBUG_IMPORT | 80 | #ifdef DEBUG_IMPORT |
79 | OUString sURL = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), OUString() ); | 81 | OUString sURL = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), OUString() ); |
80 | ::std::string sURLc = OUStringToOString(sURL, RTL_TEXTENCODING_ASCII_US).getStr(); | 82 | ::std::string sURLc = OUStringToOString(sURL, RTL_TEXTENCODING_ASCII_US).getStr(); |
@@ -119,7 +121,7 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri | |||
119 | uno::Reference<task::XStatusIndicator>()); | 121 | uno::Reference<task::XStatusIndicator>()); |
120 | 122 | ||
121 | writerfilter::Stream::Pointer_t pStream( | 123 | writerfilter::Stream::Pointer_t pStream( |
122 | new writerfilter::dmapper::DomainMapper(m_xContext, xInputStream, m_xDstDoc, bRepairStorage, writerfilter::dmapper::DOCUMENT_RTF, bIsNewDoc)); | 124 | new writerfilter::dmapper::DomainMapper(m_xContext, xInputStream, m_xDstDoc, bRepairStorage, writerfilter::dmapper::DOCUMENT_RTF, xInsertTextRange, bIsNewDoc)); |
123 | writerfilter::rtftok::RTFDocument::Pointer_t const pDocument( | 125 | writerfilter::rtftok::RTFDocument::Pointer_t const pDocument( |
124 | writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame, xStatusIndicator)); | 126 | writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame, xStatusIndicator)); |
125 | pDocument->resolve(*pStream); | 127 | pDocument->resolve(*pStream); |