summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editeng/source/editeng/editeng.cxx4
-rw-r--r--editeng/source/editeng/editview.cxx4
-rw-r--r--editeng/source/editeng/impedit.cxx4
-rw-r--r--editeng/source/editeng/impedit.hxx4
-rw-r--r--editeng/source/editeng/impedit2.cxx32
-rw-r--r--editeng/source/outliner/outlvw.cxx8
-rw-r--r--include/editeng/editeng.hxx4
-rw-r--r--include/editeng/editview.hxx3
-rw-r--r--include/editeng/outliner.hxx5
-rw-r--r--sc/source/ui/drawfunc/drtxtob1.cxx3
-rw-r--r--sd/source/ui/func/fuinsert.cxx1
-rw-r--r--sd/source/ui/view/sdview3.cxx30
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx3
13 files changed, 84 insertions, 21 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 6cb28954aedc..728609cd94e2 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -849,9 +849,9 @@ EditSelection EditEngine::InsertText(const EditTextObject& rTextObject, const Ed
EditSelection EditEngine::InsertText(
uno::Reference<datatransfer::XTransferable > const & rxDataObj,
- const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial)
+ const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial, SotClipboardFormatId format)
{
- return pImpEditEngine->PasteText(rxDataObj, rBaseURL, rPaM, bUseSpecial);
+ return pImpEditEngine->PasteText(rxDataObj, rBaseURL, rPaM, bUseSpecial, format);
}
EditPaM EditEngine::EndOfWord(const EditPaM& rPaM)
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index a50dc9ebc6fe..d73cb24ef452 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -685,10 +685,10 @@ void EditView::Paste()
pImpEditView->Paste( aClipBoard );
}
-void EditView::PasteSpecial()
+void EditView::PasteSpecial(SotClipboardFormatId format)
{
Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard());
- pImpEditView->Paste(aClipBoard, true );
+ pImpEditView->Paste(aClipBoard, true, format );
}
Point EditView::GetWindowPosTopLeft( sal_Int32 nParagraph )
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 8813376dacdd..393a208703b4 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1946,7 +1946,7 @@ void ImpEditView::CutCopy( css::uno::Reference< css::datatransfer::clipboard::XC
}
}
-void ImpEditView::Paste( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bUseSpecial )
+void ImpEditView::Paste( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bUseSpecial, SotClipboardFormatId format)
{
if ( !rxClipboard.is() )
return;
@@ -2006,7 +2006,7 @@ void ImpEditView::Paste( css::uno::Reference< css::datatransfer::clipboard::XCli
// paragraphs. Collect and broadcast when done instead.
aSel = pEditEngine->InsertText(
xDataObj, OUString(), aSel.Min(),
- bUseSpecial && pEditEngine->GetInternalEditStatus().AllowPasteSpecial());
+ bUseSpecial && pEditEngine->GetInternalEditStatus().AllowPasteSpecial(), format);
}
aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() );
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index df7a11c97dcb..6fcccccb58dc 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -377,7 +377,7 @@ public:
bool Command(const CommandEvent& rCEvt);
void CutCopy( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bCut );
- void Paste( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bUseSpecial = false );
+ void Paste( css::uno::Reference< css::datatransfer::clipboard::XClipboard > const & rxClipboard, bool bUseSpecial = false, SotClipboardFormatId format = SotClipboardFormatId::NONE);
void SetVisDocStartPos( const Point& rPos ) { aVisDocStartPos = rPos; }
@@ -644,7 +644,7 @@ private:
std::unique_ptr<EditTextObject>
CreateTextObject(EditSelection aSelection, SfxItemPool*, bool bAllowBigObjects = false, sal_Int32 nBigObjStart = 0);
EditSelection InsertTextObject( const EditTextObject&, EditPaM aPaM );
- EditSelection PasteText( css::uno::Reference< css::datatransfer::XTransferable > const & rxDataObj, const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial );
+ EditSelection PasteText( css::uno::Reference< css::datatransfer::XTransferable > const & rxDataObj, const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial, SotClipboardFormatId format = SotClipboardFormatId::NONE);
void CheckPageOverflow();
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index fa5dc5903b60..15f6078dcec6 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -30,6 +30,7 @@
#include "eeobj.hxx"
#include <editeng/txtrange.hxx>
#include <sfx2/app.hxx>
+#include <sfx2/mieclip.hxx>
#include <svtools/colorcfg.hxx>
#include <svl/ctloptions.hxx>
#include <unotools/securityoptions.hxx>
@@ -3879,7 +3880,7 @@ uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable(
return pDataObj;
}
-EditSelection ImpEditEngine::PasteText( uno::Reference< datatransfer::XTransferable > const & rxDataObj, const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial )
+EditSelection ImpEditEngine::PasteText( uno::Reference< datatransfer::XTransferable > const & rxDataObj, const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial, SotClipboardFormatId format)
{
EditSelection aNewSelection( rPaM );
@@ -3893,7 +3894,7 @@ EditSelection ImpEditEngine::PasteText( uno::Reference< datatransfer::XTransfera
{
// XML
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT, aFlavor );
- if ( rxDataObj->isDataFlavorSupported( aFlavor ) )
+ if ( rxDataObj->isDataFlavorSupported( aFlavor ) && (SotClipboardFormatId::NONE == format || SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT == format))
{
try
{
@@ -3921,7 +3922,7 @@ EditSelection ImpEditEngine::PasteText( uno::Reference< datatransfer::XTransfera
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::RICHTEXT, aFlavorRichtext );
bool bRtfSupported = rxDataObj->isDataFlavorSupported( aFlavor );
bool bRichtextSupported = rxDataObj->isDataFlavorSupported( aFlavorRichtext );
- if ( bRtfSupported || bRichtextSupported )
+ if ( (bRtfSupported || bRichtextSupported) && (SotClipboardFormatId::NONE == format || SotClipboardFormatId::RICHTEXT == format || SotClipboardFormatId::RTF == format))
{
if(bRichtextSupported)
{
@@ -3943,6 +3944,31 @@ EditSelection ImpEditEngine::PasteText( uno::Reference< datatransfer::XTransfera
}
}
}
+ if (!bDone) {
+ // HTML
+ SotExchange::GetFormatDataFlavor(SotClipboardFormatId::HTML_SIMPLE, aFlavor);
+ bool bHtmlSupported = rxDataObj->isDataFlavorSupported(aFlavor);
+ if (bHtmlSupported && (SotClipboardFormatId::NONE == format || SotClipboardFormatId::HTML_SIMPLE == format)) {
+ MSE40HTMLClipFormatObj aMSE40HTMLClipFormatObj;
+ try
+ {
+ uno::Any aData = rxDataObj->getTransferData(aFlavor);
+ uno::Sequence< sal_Int8 > aSeq;
+ aData >>= aSeq;
+ {
+ SvMemoryStream aHtmlStream(aSeq.getArray(), aSeq.getLength(), StreamMode::READ);
+ SvStream* pHtmlStream = aMSE40HTMLClipFormatObj.IsValid(aHtmlStream);
+ if (pHtmlStream != nullptr) {
+ aNewSelection = Read(*pHtmlStream, rBaseURL, EETextFormat::Html, rPaM);
+ }
+ }
+ bDone = true;
+ }
+ catch (const css::uno::Exception&)
+ {
+ }
+ }
+ }
}
if ( !bDone )
{
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 382d1d63f7da..adf75cc54afa 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -667,12 +667,12 @@ void OutlinerView::Cut()
}
}
-void OutlinerView::PasteSpecial()
+void OutlinerView::PasteSpecial(SotClipboardFormatId format)
{
- Paste( true );
+ Paste( true, format );
}
-void OutlinerView::Paste( bool bUseSpecial )
+void OutlinerView::Paste( bool bUseSpecial, SotClipboardFormatId format)
{
if ( ImpCalcSelectedPages( false ) && !pOwner->ImpCanDeleteSelectedPages( this ) )
return;
@@ -683,7 +683,7 @@ void OutlinerView::Paste( bool bUseSpecial )
pOwner->bPasting = true;
if ( bUseSpecial )
- pEditView->PasteSpecial();
+ pEditView->PasteSpecial(format);
else
pEditView->Paste();
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 38880d90706f..5e0d26b4b14c 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -30,6 +30,7 @@
#include <com/sun/star/i18n/WordType.hpp>
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
+#include <sot/formats.hxx>
#include <svl/typedwhich.hxx>
#include <editeng/editdata.hxx>
#include <editeng/editstat.hxx>
@@ -154,7 +155,8 @@ public:
EditSelection InsertText(
css::uno::Reference<css::datatransfer::XTransferable > const & rxDataObj,
- const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial);
+ const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial,
+ SotClipboardFormatId format = SotClipboardFormatId::NONE);
private:
std::unique_ptr<ImpEditEngine> pImpEditEngine;
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index c7c7507a9ba8..48019e3c4776 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/i18n/WordType.hpp>
#include <i18nlangtag/lang.h>
+#include <sot/formats.hxx>
#include <tools/color.hxx>
#include <tools/gen.hxx>
#include <comphelper/errcode.hxx>
@@ -258,7 +259,7 @@ public:
void Cut();
void Copy();
void Paste();
- void PasteSpecial();
+ void PasteSpecial(SotClipboardFormatId format = SotClipboardFormatId::NONE);
void Undo();
void Redo();
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 33bb6fae90de..98edc7ef1d72 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -19,6 +19,7 @@
#ifndef INCLUDED_EDITENG_OUTLINER_HXX
#define INCLUDED_EDITENG_OUTLINER_HXX
+#include <sot/formats.hxx>
#include <editeng/editdata.hxx>
#include <editeng/editstat.hxx>
#include <editeng/overflowingtxt.hxx>
@@ -264,8 +265,8 @@ public:
void Cut();
void Copy();
- void Paste( bool bUseSpecial = false );
- void PasteSpecial();
+ void Paste( bool bUseSpecial = false, SotClipboardFormatId format = SotClipboardFormatId::NONE );
+ void PasteSpecial(SotClipboardFormatId format = SotClipboardFormatId::NONE);
void SetStyleSheet(const OUString& rStyleName);
diff --git a/sc/source/ui/drawfunc/drtxtob1.cxx b/sc/source/ui/drawfunc/drtxtob1.cxx
index 63dc62daeb60..4810876a33c4 100644
--- a/sc/source/ui/drawfunc/drtxtob1.cxx
+++ b/sc/source/ui/drawfunc/drtxtob1.cxx
@@ -105,6 +105,7 @@ void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
pDlg->Insert( SotClipboardFormatId::STRING, OUString() );
pDlg->Insert( SotClipboardFormatId::RTF, OUString() );
pDlg->Insert( SotClipboardFormatId::RICHTEXT, OUString() );
+ pDlg->Insert(SotClipboardFormatId::HTML_SIMPLE, OUString());
TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mrViewData.GetActiveWin() ) );
@@ -117,7 +118,7 @@ void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
if (nFormat == SotClipboardFormatId::STRING)
pOutView->Paste();
else
- pOutView->PasteSpecial();
+ pOutView->PasteSpecial(nFormat);
}
}
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 28a4c102b3c0..5f80abc89ebd 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -225,6 +225,7 @@ void FuInsertClipboard::DoExecute( SfxRequest& )
pDlg->Insert( SotClipboardFormatId::NETSCAPE_BOOKMARK, OUString() );
pDlg->Insert( SotClipboardFormatId::STRING, OUString() );
pDlg->Insert( SotClipboardFormatId::HTML, OUString() );
+ pDlg->Insert(SotClipboardFormatId::HTML_SIMPLE, OUString());
pDlg->Insert( SotClipboardFormatId::RTF, OUString() );
pDlg->Insert( SotClipboardFormatId::RICHTEXT, OUString() );
pDlg->Insert( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT, OUString() );
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index c0fa51d1ae67..3288fed35114 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -1491,6 +1491,36 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
}
}
}
+
+ bool bIsHtmlSimple = CHECK_FORMAT_TRANS(SotClipboardFormatId::HTML_SIMPLE);
+ if (bIsHtmlSimple)
+ {
+ ::tools::SvRef<SotTempStream> xStm;
+
+ if (aDataHelper.GetSotStorageStream(SotClipboardFormatId::HTML_SIMPLE, xStm))
+ {
+ xStm->Seek(0);
+
+ OutlinerView* pOLV = GetTextEditOutlinerView();
+
+ if (pOLV)
+ {
+ ::tools::Rectangle aRect(pOLV->GetOutputArea());
+ Point aPos(pOLV->GetWindow()->PixelToLogic(maDropPos));
+
+ if (aRect.Contains(aPos) || (!bDrag && IsTextEdit()))
+ {
+ // mba: clipboard always must contain absolute URLs (could be from alien source)
+ pOLV->Read(*xStm, EETextFormat::Html, mpDocSh->GetHeaderAttributes());
+ bReturn = true;
+ }
+ }
+
+ if (!bReturn)
+ // mba: clipboard always must contain absolute URLs (could be from alien source)
+ bReturn = SdrView::Paste(*xStm, EETextFormat::Html, maDropPos, pPage, nPasteOptions);
+ }
+ }
}
if(!bReturn && CHECK_FORMAT_TRANS(SotClipboardFormatId::FILE_LIST))
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 749a5d76e001..565cb9f348dc 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -1082,6 +1082,7 @@ void SwDrawTextShell::ExecClpbrd(SfxRequest const &rReq)
pDlg->Insert(SotClipboardFormatId::STRING, OUString());
pDlg->Insert(SotClipboardFormatId::RTF, OUString());
pDlg->Insert(SotClipboardFormatId::RICHTEXT, OUString());
+ pDlg->Insert(SotClipboardFormatId::HTML_SIMPLE, OUString());
TransferableDataHelper aDataHelper(TransferableDataHelper::CreateFromSystemClipboard(&GetView().GetEditWin()));
SotClipboardFormatId nFormat = pDlg->GetFormat(aDataHelper.GetTransferable());
@@ -1091,7 +1092,7 @@ void SwDrawTextShell::ExecClpbrd(SfxRequest const &rReq)
if (nFormat == SotClipboardFormatId::STRING)
pOLV->Paste();
else
- pOLV->PasteSpecial();
+ pOLV->PasteSpecial(nFormat);
}
break;