diff options
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/dialog/regionsw.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/fldui/fldmgr.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/translatehelper.hxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/shells/textfld.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/shells/translatehelper.cxx | 20 |
6 files changed, 18 insertions, 27 deletions
diff --git a/sw/source/uibase/dialog/regionsw.cxx b/sw/source/uibase/dialog/regionsw.cxx index 834f1b332bc5..9eaa64c89456 100644 --- a/sw/source/uibase/dialog/regionsw.cxx +++ b/sw/source/uibase/dialog/regionsw.cxx @@ -161,8 +161,7 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq) SwPaM* pCursorPos = rSh.GetCursor(); pCursorPos->Move(fnMoveBackward, GoInContent); // Paste HTML content. - SwTranslateHelper::PasteHTMLToPaM(rSh, pCursorPos, aSectionContent.toUtf8(), - /*bSetSelection=*/true); + SwTranslateHelper::PasteHTMLToPaM(rSh, pCursorPos, aSectionContent.toUtf8()); if (pCursorPos->GetPoint()->GetContentIndex() == 0) { // The paste created a last empty text node, remove it. diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index 1596b1094e89..b7c3e60e9a84 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -1086,7 +1086,7 @@ bool SwFieldMgr::InsertField( // Paste HTML content. SwTranslateHelper::PasteHTMLToPaM( - *pCurShell, pCursorPos, rRefmarkText.toUtf8(), /*bSetSelection=*/true); + *pCurShell, pCursorPos, rRefmarkText.toUtf8()); // Undo the above SplitNode(). aRefmarkPam.SetMark(); diff --git a/sw/source/uibase/inc/translatehelper.hxx b/sw/source/uibase/inc/translatehelper.hxx index 906b527647b6..64b6dd35d90d 100644 --- a/sw/source/uibase/inc/translatehelper.hxx +++ b/sw/source/uibase/inc/translatehelper.hxx @@ -32,9 +32,8 @@ struct SW_DLLPUBLIC TranslateAPIConfig final const OString m_xAuthKey; const OString m_xTargetLanguage; }; -SW_DLLPUBLIC OString ExportPaMToHTML(SwPaM* pCursor, bool bReplacePTag); -SW_DLLPUBLIC void PasteHTMLToPaM(SwWrtShell& rWrtSh, SwPaM* pCursor, const OString& rData, - bool bSetSelection); +SW_DLLPUBLIC OString ExportPaMToHTML(SwPaM* pCursor); +SW_DLLPUBLIC void PasteHTMLToPaM(SwWrtShell& rWrtSh, SwPaM* pCursor, const OString& rData); SW_DLLPUBLIC void TranslateDocument(SwWrtShell& rWrtSh, const TranslateAPIConfig& rConfig); SW_DLLPUBLIC void TranslateDocumentCancellable(SwWrtShell& rWrtSh, const TranslateAPIConfig& rConfig, diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index c75cb2c2f8d9..70c8ee1c73d9 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -807,8 +807,7 @@ FIELD_INSERT: if (pFieldResult) { // Paste HTML content. - SwTranslateHelper::PasteHTMLToPaM(rSh, pCursorPos, aFieldResult.toUtf8(), - true); + SwTranslateHelper::PasteHTMLToPaM(rSh, pCursorPos, aFieldResult.toUtf8()); if (pCursorPos->GetPoint()->GetContentIndex() == 0) { // The paste created a last empty text node, remove it. @@ -975,7 +974,7 @@ FIELD_INSERT: rSh.GetDoc()->getIDocumentContentOperations().DeleteAndJoin(aPaM); OUString aFieldResult; aMap["FieldResult"] >>= aFieldResult; - SwTranslateHelper::PasteHTMLToPaM(rSh, &aPaM, aFieldResult.toUtf8(), true); + SwTranslateHelper::PasteHTMLToPaM(rSh, &aPaM, aFieldResult.toUtf8()); } rSh.EndAction(); @@ -1394,7 +1393,7 @@ FIELD_INSERT: rSh.GetDoc()->getIDocumentContentOperations().DeleteAndJoin(aPaM); OUString aFieldResult; aMap["FieldResult"] >>= aFieldResult; - SwTranslateHelper::PasteHTMLToPaM(rSh, &aPaM, aFieldResult.toUtf8(), true); + SwTranslateHelper::PasteHTMLToPaM(rSh, &aPaM, aFieldResult.toUtf8()); rSh.EndAction(); rSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::UPDATE_FORM_FIELD, nullptr); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index e5c2416a9cbe..da8b94a33d7b 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -463,7 +463,7 @@ void UpdateSections(SfxRequest& rReq, SwWrtShell& rWrtSh) rWrtSh.EndSelect(); OUString aSectionText = aMap["Content"].get<OUString>(); - SwTranslateHelper::PasteHTMLToPaM(rWrtSh, pCursorPos, aSectionText.toUtf8(), true); + SwTranslateHelper::PasteHTMLToPaM(rWrtSh, pCursorPos, aSectionText.toUtf8()); } } @@ -575,7 +575,7 @@ void UpdateBookmarks(SfxRequest& rReq, SwWrtShell& rWrtSh) // Paste HTML content. SwPaM* pCursorPos = rWrtSh.GetCursor(); *pCursorPos = aPasteEnd; - SwTranslateHelper::PasteHTMLToPaM(rWrtSh, pCursorPos, aBookmarkText.toUtf8(), true); + SwTranslateHelper::PasteHTMLToPaM(rWrtSh, pCursorPos, aBookmarkText.toUtf8()); // Update the bookmark to point to the new content. SwPaM aPasteStart(pMark->GetMarkEnd()); @@ -664,7 +664,7 @@ void UpdateBookmark(SfxRequest& rReq, SwWrtShell& rWrtSh) // Paste HTML content. SwPaM* pCursorPos = rWrtSh.GetCursor(); *pCursorPos = aPasteEnd; - SwTranslateHelper::PasteHTMLToPaM(rWrtSh, pCursorPos, aBookmarkText.toUtf8(), true); + SwTranslateHelper::PasteHTMLToPaM(rWrtSh, pCursorPos, aBookmarkText.toUtf8()); // Update the bookmark to point to the new content. SwPaM aPasteStart(pBookmark->GetMarkEnd()); @@ -1108,7 +1108,7 @@ void SwTextShell::Execute(SfxRequest &rReq) // Paste HTML content. SwTranslateHelper::PasteHTMLToPaM( - rWrtSh, pCursorPos, aBookmarkText.toUtf8(), /*bSetSelection=*/true); + rWrtSh, pCursorPos, aBookmarkText.toUtf8()); if (pCursorPos->GetPoint()->GetContentIndex() == 0) { // The paste created a last empty text node, remove it. diff --git a/sw/source/uibase/shells/translatehelper.cxx b/sw/source/uibase/shells/translatehelper.cxx index 507c2812a675..d949715dd973 100644 --- a/sw/source/uibase/shells/translatehelper.cxx +++ b/sw/source/uibase/shells/translatehelper.cxx @@ -40,7 +40,7 @@ namespace SwTranslateHelper { -OString ExportPaMToHTML(SwPaM* pCursor, bool bReplacePTag) +OString ExportPaMToHTML(SwPaM* pCursor) { SolarMutexGuard gMutex; OString aResult; @@ -58,11 +58,8 @@ OString ExportPaMToHTML(SwPaM* pCursor, bool bReplacePTag) } aResult = OString(static_cast<const char*>(aMemoryStream.GetData()), aMemoryStream.GetSize()); - if (bReplacePTag) - { - aResult = aResult.replaceAll("<p", "<span"); - aResult = aResult.replaceAll("</p>", "</span>"); - } + aResult = aResult.replaceAll("<p", "<span"); + aResult = aResult.replaceAll("</p>", "</span>"); // HTML has for that <br> and <p> also does new line aResult = aResult.replaceAll("<ul>", ""); @@ -75,7 +72,7 @@ OString ExportPaMToHTML(SwPaM* pCursor, bool bReplacePTag) return {}; } -void PasteHTMLToPaM(SwWrtShell& rWrtSh, SwPaM* pCursor, const OString& rData, bool bSetSelection) +void PasteHTMLToPaM(SwWrtShell& rWrtSh, SwPaM* pCursor, const OString& rData) { SolarMutexGuard gMutex; rtl::Reference<vcl::unohelper::HtmlTransferable> pHtmlTransferable @@ -86,10 +83,7 @@ void PasteHTMLToPaM(SwWrtShell& rWrtSh, SwPaM* pCursor, const OString& rData, bo if (aDataHelper.GetXTransferable().is() && SwTransferable::IsPasteSpecial(rWrtSh, aDataHelper)) { - if (bSetSelection) - { - rWrtSh.SetSelection(*pCursor); - } + rWrtSh.SetSelection(*pCursor); SwTransferable::Paste(rWrtSh, aDataHelper); rWrtSh.KillSelection(nullptr, false); } @@ -190,10 +184,10 @@ void TranslateDocumentCancellable(SwWrtShell& rWrtSh, const TranslateAPIConfig& } } - const auto aOut = SwTranslateHelper::ExportPaMToHTML(cursor.get(), true); + const auto aOut = SwTranslateHelper::ExportPaMToHTML(cursor.get()); const auto aTranslatedOut = linguistic::Translate( rConfig.m_xTargetLanguage, rConfig.m_xAPIUrl, rConfig.m_xAuthKey, aOut); - SwTranslateHelper::PasteHTMLToPaM(rWrtSh, cursor.get(), aTranslatedOut, true); + SwTranslateHelper::PasteHTMLToPaM(rWrtSh, cursor.get(), aTranslatedOut); if (xStatusIndicator.is()) xStatusIndicator->setValue((100 * ++nProgress) / nCount); |