20 #include <config_features.h>
22 #include <com/sun/star/embed/XTransactedObject.hpp>
23 #include <com/sun/star/embed/Aspects.hpp>
24 #include <com/sun/star/embed/XEmbedObjectClipboardCreator.hpp>
25 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
26 #include <com/sun/star/embed/MSOLEObjectSystemCreator.hpp>
27 #include <com/sun/star/text/XPasteListener.hpp>
42 #include <osl/endian.h>
72 #include <osl/file.hxx>
88 #include <section.hxx>
107 #include <strings.hrc>
136 #define OLESIZE 11905 - 2 * lMinBorder, 6 * MM50
146 using namespace ::
svx;
152 void collectUIInformation(
const OUString& rAction,
const OUString& aParameters)
155 aDescription.
aAction = rAction;
156 aDescription.
aParameters = {{
"parameters", aParameters}};
157 aDescription.
aID =
"writer_edit";
158 aDescription.
aKeyWord =
"SwEditWinUIObject";
159 aDescription.
aParent =
"MainWindow";
174 bool bDelBookmrk : 1;
175 bool bInDisconnect : 1;
182 virtual ~SwTransferDdeLink()
override;
187 virtual ::sfx2::SvBaseLink::UpdateResult
DataChanged(
188 const OUString& rMimeType,
const css::uno::Any & rValue )
override;
189 virtual void Closed()
override;
217 class SwTrnsfrActionAndUndo
231 pContext->remember();
235 ~SwTrnsfrActionAndUndo() COVERITY_NOEXCEPT_FALSE
245 : m_pWrtShell( &rSh ),
246 m_pCreatorView( nullptr ),
247 m_pOrigGraphic( nullptr ),
349 uno::Reference < embed::XEmbeddedObject > xObj;
353 for(
SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
356 xObj =
static_cast<SwOLENode*
>(pNd)->GetOLEObj().GetOleRef();
357 nAspect =
static_cast<SwOLENode*
>(pNd)->GetAspect();
369 for(
SwContentNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
372 return static_cast<SwOLENode*
>(pNd)->GetGraphic();
403 rSrcWrtShell.
Copy(rDest);
408 void lclCheckAndPerformRotation(
Graphic& aGraphic)
411 if ( !aMetadata.
read(aGraphic) )
417 std::unique_ptr<weld::Builder> xBuilder(
Application::CreateBuilder(
nullptr,
"modules/swriter/ui/queryrotateintostandarddialog.ui"));
418 std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog(
"QueryRotateIntoStandardOrientationDialog"));
419 if (xQueryBox->run() ==
RET_YES)
422 aTransform.rotate( aRotation );
430 sal_Int32 nTextLength = 0;
454 nTextLength += pTextNode->
GetText().getLength();
455 if (nTextLength >= 1024 * 512)
532 static_cast<const SwFormatINetFormat*>(aContentAtPos.
aFnd.
pAttr)->GetValue(),
533 aContentAtPos.
sStr ));
546 else if( !rURL.
GetURL().isEmpty() )
557 sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
558 uno::Reference < embed::XEmbeddedObject > xObj =
FindOLEObj( nAspect );
571 if ( nFormat == SotClipboardFormatId::GDIMETAFILE )
582 case SotClipboardFormatId::LINK:
587 case SotClipboardFormatId::OBJECTDESCRIPTOR:
588 case SotClipboardFormatId::LINKSRCDESCRIPTOR:
592 case SotClipboardFormatId::DRAWING:
600 case SotClipboardFormatId::STRING:
606 case SotClipboardFormatId::RTF:
612 case SotClipboardFormatId::RICHTEXT:
619 case SotClipboardFormatId::HTML:
626 case SotClipboardFormatId::SVXB:
631 case SotClipboardFormatId::GDIMETAFILE:
635 case SotClipboardFormatId::BITMAP:
636 case SotClipboardFormatId::PNG:
642 case SotClipboardFormatId::SVIM:
647 case SotClipboardFormatId::INET_IMAGE:
652 case SotClipboardFormatId::SOLK:
653 case SotClipboardFormatId::NETSCAPE_BOOKMARK:
654 case SotClipboardFormatId::FILEGRPDESCRIPTOR:
655 case SotClipboardFormatId::FILECONTENT:
656 case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
657 case SotClipboardFormatId::SIMPLE_FILE:
662 case SotClipboardFormatId::EMBED_SOURCE:
667 SfxObjectCreateMode::EMBEDDED );
682 void* pObject, sal_uInt32 nObjectType,
688 switch( nObjectType )
694 xStream->SetBufferSize( 16348 );
737 uno::Reference< embed::XStorage > xWorkStore =
743 SfxMedium aMedium( xWorkStore, OUString() );
747 uno::Reference< embed::XTransactedObject > xTransact( xWorkStore, uno::UNO_QUERY );
748 if ( xTransact.is() )
754 xStream->SetBufferSize( 0xff00 );
755 xStream->WriteStream( *pSrcStm );
759 xWorkStore->dispose();
762 catch (
const uno::Exception&)
772 xStream->SetBufferSize( 1024 );
773 SwTransferDdeLink* pDdeLnk =
static_cast<SwTransferDdeLink*
>(pObject);
774 if( pDdeLnk->WriteData( *xStream ) )
799 xWrt->SetAsciiOptions( aAOpt );
802 xWrt->m_bUCS2_WithStartChar =
false;
811 xWrt->m_bWriteClipboardDoc =
true;
813 xWrt->SetShowProgress(
false);
815 #if defined(DEBUGPASTE)
817 "PASTEBUFFER.debug"), StreamMode::WRITE|StreamMode::TRUNC);
818 SwWriter aDbgWrt( aPasteDebug, *pDoc );
819 aDbgWrt.
Write( xWrt );
825 xStream->WriteChar(
'\0' );
835 int nRet =
Copy(
true );
838 collectUIInformation(
"CUT",
"parameter");
875 std::vector< ::sw::mark::IMark* > vDdeMarks;
883 vDdeMarks.push_back(*ppMark);
887 for (
const auto& rpMark : vDdeMarks)
895 std::unique_ptr<SwWait> pWait;
921 SwContentNode *
const pContentNode(aIdx.GetNode().GetContentNode());
923 SwIndex(pContentNode, pContentNode ? pContentNode->Len() : 0));
941 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
943 #if HAVE_FEATURE_DESKTOP
944 AddFormat( SotClipboardFormatId::RICHTEXT );
947 AddFormat( SotClipboardFormatId::STRING );
977 #if HAVE_FEATURE_DESKTOP
983 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
989 #if HAVE_FEATURE_DESKTOP
990 AddFormat( SotClipboardFormatId::GDIMETAFILE );
991 AddFormat( SotClipboardFormatId::BITMAP );
1005 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
1013 #if HAVE_FEATURE_DESKTOP
1014 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
1015 AddFormat( SotClipboardFormatId::GDIMETAFILE );
1018 sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
1019 uno::Reference < embed::XEmbeddedObject > xObj =
FindOLEObj( nAspect );
1028 for(
const auto& rItem : aVector )
1039 std::unique_ptr<SwWait> pWait;
1086 #if HAVE_FEATURE_DESKTOP
1088 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
1095 #if HAVE_FEATURE_DESKTOP
1096 AddFormat( SotClipboardFormatId::RICHTEXT );
1097 AddFormat( SotClipboardFormatId::HTML );
1101 AddFormat( SotClipboardFormatId::STRING );
1105 AddFormat( SotClipboardFormatId::DRAWING );
1108 #if HAVE_FEATURE_DESKTOP
1109 AddFormat( SotClipboardFormatId::GDIMETAFILE );
1110 AddFormat( SotClipboardFormatId::BITMAP );
1128 AddFormat( SotClipboardFormatId::STRING );
1129 #if HAVE_FEATURE_DESKTOP
1130 AddFormat( SotClipboardFormatId::SOLK );
1131 AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
1132 AddFormat( SotClipboardFormatId::FILECONTENT );
1133 AddFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR );
1135 AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR );
1143 if( !bIsCut && bDDELink &&
1147 #if HAVE_FEATURE_DESKTOP
1148 AddFormat( SotClipboardFormatId::LINK );
1160 #if HAVE_FEATURE_DESKTOP
1161 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
1175 AddFormat( SotClipboardFormatId::SVIM );
1177 else if( !rURL.
GetURL().isEmpty() )
1181 AddFormat( SotClipboardFormatId::INET_IMAGE );
1200 collectUIInformation(
"COPY",
"parameter");
1218 AddFormat( SotClipboardFormatId::STRING );
1235 SwPaM aPam( *pCNd );
1250 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
1252 AddFormat( SotClipboardFormatId::RICHTEXT );
1253 AddFormat( SotClipboardFormatId::HTML );
1254 AddFormat( SotClipboardFormatId::STRING );
1263 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
1276 : m_rWrtShell(rWrtShell)
1292 m_pPaM.reset(
new SwPaM(rNodeIndex, rNodeIndex, 0, -1));
1305 beans::PropertyValue aPropertyValue;
1315 aPropertyValue.Name =
"TextGraphicObject";
1316 aPropertyValue.Value
1338 ++
m_pPaM->GetPoint()->nNode;
1344 m_pPaM->GetPoint()->nContent.Assign(static_cast<SwContentNode*>(&rNode),
1347 aPropertyValue.Name =
"TextRange";
1350 aPropertyValue.Value <<= xTextRange;
1355 if (aPropertyValue.Name.isEmpty())
1359 uno::Sequence<beans::PropertyValue>
aEvent{ aPropertyValue };
1362 while (it.hasMoreElements())
1364 uno::Reference<text::XPasteListener> xListener(it.next(), UNO_QUERY);
1366 xListener->notifyPasteEvent(
aEvent);
1369 catch (
const uno::Exception& rException)
1372 "SwPasteContext::~SwPasteContext: uncaught exception: " << rException.Message);
1392 sal_uInt16 nSourceOptions =
1393 (( SotExchangeDest::DOC_TEXTFRAME == nDestination ||
1394 SotExchangeDest::SWDOC_FREE_AREA == nDestination ||
1395 SotExchangeDest::DOC_TEXTFRAME_WEB == nDestination ||
1396 SotExchangeDest::SWDOC_FREE_AREA_WEB == nDestination )
1407 nFormat, nEventAction, SotClipboardFormatId::NONE,
1420 if (nFormat != SotClipboardFormatId::RICHTEXT)
1425 if (!rData.
HasFormat(SotClipboardFormatId::EMBED_SOURCE))
1430 if (!rData.
HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR))
1449 nFormat = SotClipboardFormatId::EMBED_SOURCE;
1460 bool bSingleCellTable =
false;
1468 sal_uInt16 nSourceOptions =
1469 (( SotExchangeDest::DOC_TEXTFRAME == nDestination ||
1470 SotExchangeDest::SWDOC_FREE_AREA == nDestination ||
1471 SotExchangeDest::DOC_TEXTFRAME_WEB == nDestination ||
1472 SotExchangeDest::SWDOC_FREE_AREA_WEB == nDestination )
1482 nFormat, nEventAction, SotClipboardFormatId::NONE,
1492 rData.
HasFormat( SotClipboardFormatId::SYLK_BIGCAPS ) ) )
1496 if( rData.
GetString( SotClipboardFormatId::STRING, aExpand ))
1499 const sal_Int32 nRows = nNewlines ? nNewlines-1 : 0;
1504 bSingleCellTable =
true;
1509 if (!bSingleCellTable && rData.
HasFormat( SotClipboardFormatId::HTML ) &&
1513 sal_uInt32 nLevel = 0;
1520 pDispatch->
Execute(FN_INSERT_NNBSP, SfxCallMode::SYNCHRON);
1525 nDestination,
false,
false,
nullptr, 0,
false, nAnchorType, bIgnoreComments, &aPasteContext, ePasteTable) )
1527 bool bFoundTemporaryTable =
false;
1531 bFoundTemporaryTable =
true;
1533 pDispatch->
Execute(SID_COPY, SfxCallMode::SYNCHRON);
1535 for(sal_uInt32
a = 0;
a < 1 + (nLevel * 2);
a++)
1536 pDispatch->
Execute(SID_UNDO, SfxCallMode::SYNCHRON);
1539 if (!bFoundTemporaryTable)
1548 pDispatch->
Execute(SID_PASTE, SfxCallMode::SYNCHRON);
1551 for(sal_uInt32
a = 0;
a < (nLevel * 2);
a++)
1552 pDispatch->
Execute(SID_UNDO, SfxCallMode::SYNCHRON);
1558 rData.
HasFormat( SotClipboardFormatId::HTML ) &&
1564 if( rData.
GetString( SotClipboardFormatId::HTML, aExpand ) && (nIdx = aExpand.indexOf(
"<table")) > -1 )
1567 bool bShifted = aExpand.indexOf(
"<tbody>") > -1;
1569 sal_Int32 nSelectedRowsOrCols = 0;
1570 const OUString sSearchRowOrCol = bRowMode ? OUString(
"</tr>") : OUString(
"<col ");
1571 while((nIdx = aExpand.indexOf(sSearchRowOrCol, nIdx)) > -1)
1574 if (nIdx > 2 && (aExpand[nIdx-1] !=
'\t' || aExpand[nIdx-2] !=
'\t' || (bShifted && aExpand[nIdx-3] !=
'\t')))
1575 ++nSelectedRowsOrCols;
1579 bool bStartTableBoxNode =
1587 if (!bStartTableBoxNode)
1598 pDispatch->
Execute(nDispatchSlot, SfxCallMode::SYNCHRON);
1602 if ( nSelectedRowsOrCols > 1 )
1604 SfxUInt16Item aCountItem( nDispatchSlot, nSelectedRowsOrCols-1 );
1607 SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
1608 { &aCountItem, &aAfter });
1613 nDestination,
false,
false,
nullptr, 0,
false, nAnchorType, bIgnoreComments, &aPasteContext );
1616 if (pMark !=
nullptr)
1629 if( rData.
HasFormat( SotClipboardFormatId::RTF ) )
1632 nFormat = SotClipboardFormatId::RTF;
1634 else if( rData.
HasFormat( SotClipboardFormatId::RICHTEXT ) )
1637 nFormat = SotClipboardFormatId::RICHTEXT;
1645 collectUIInformation(
"PASTE",
"parameter");
1649 nDestination,
false,
false,
nullptr, 0,
false, nAnchorType, bIgnoreComments, &aPasteContext, ePasteTable);
1657 const Point* pPt,
sal_Int8 nDropAction,
1658 bool bPasteSelection,
RndStdIds nAnchorType,
1659 bool bIgnoreComments,
1664 std::unique_ptr<SwTrnsfrActionAndUndo, o3tl::default_delete<SwTrnsfrActionAndUndo>> pAction;
1668 bool bCallAutoCaption =
false;
1675 switch( nDestination )
1677 case SotExchangeDest::DOC_LNKD_GRAPH_W_IMAP:
1678 case SotExchangeDest::DOC_LNKD_GRAPHOBJ:
1679 case SotExchangeDest::DOC_GRAPH_W_IMAP:
1680 case SotExchangeDest::DOC_GRAPHOBJ:
1681 case SotExchangeDest::DOC_OLEOBJ:
1682 case SotExchangeDest::DOC_DRAWOBJ:
1683 case SotExchangeDest::DOC_URLBUTTON:
1684 case SotExchangeDest::DOC_GROUPOBJ:
1705 bool bDelSel =
false;
1706 switch( nDestination )
1708 case SotExchangeDest::DOC_TEXTFRAME:
1709 case SotExchangeDest::SWDOC_FREE_AREA:
1710 case SotExchangeDest::DOC_TEXTFRAME_WEB:
1711 case SotExchangeDest::SWDOC_FREE_AREA_WEB:
1720 pAction.reset(
new SwTrnsfrActionAndUndo(&rSh,
true, pContext));
1726 bool bPrivateDrop(pPt);
1729 if (bPasteSelection)
1733 bPrivateDrop =
nullptr != pTrans;
1735 bool bNeedToSelectBeforePaste(
false);
1740 bPrivateDrop =
false;
1741 bNeedToSelectBeforePaste =
true;
1750 if(dynamic_cast< const SwDrawFrameFormat* >(pSwFrameFormat))
1752 bPrivateDrop =
false;
1753 bNeedToSelectBeforePaste =
true;
1763 else if( !pPt && pTunneledTrans &&
1767 bRet = pTunneledTrans->PrivatePaste(rSh, pContext, ePasteTable);
1773 pAction.reset(
new SwTrnsfrActionAndUndo( &rSh ));
1777 bool bMsg =
nullptr == pPt;
1784 OSL_ENSURE( pPt,
"EXCHG_OUT_ACTION_INSERT_PRIVATE: what should happen here?" );
1788 OSL_ENSURE( pPt,
"EXCHG_OUT_ACTION_MOVE_PRIVATE: what should happen here?" );
1802 case SotClipboardFormatId::DRAWING:
1805 nActionFlags, bNeedToSelectBeforePaste);
1808 case SotClipboardFormatId::HTML:
1809 case SotClipboardFormatId::HTML_SIMPLE:
1810 case SotClipboardFormatId::HTML_NO_COMMENT:
1811 case SotClipboardFormatId::RTF:
1812 case SotClipboardFormatId::RICHTEXT:
1813 case SotClipboardFormatId::STRING:
1815 nFormat, bMsg, bIgnoreComments );
1818 case SotClipboardFormatId::NETSCAPE_BOOKMARK:
1830 case SotClipboardFormatId::SD_OLE:
1832 nActionFlags, bMsg );
1835 case SotClipboardFormatId::SVIM:
1839 case SotClipboardFormatId::SVXB:
1840 case SotClipboardFormatId::BITMAP:
1841 case SotClipboardFormatId::PNG:
1842 case SotClipboardFormatId::GDIMETAFILE:
1845 nActionFlags, nDropAction, bNeedToSelectBeforePaste);
1848 case SotClipboardFormatId::XFORMS:
1849 case SotClipboardFormatId::SBA_FIELDDATAEXCHANGE:
1850 case SotClipboardFormatId::SBA_DATAEXCHANGE:
1851 case SotClipboardFormatId::SBA_CTRLDATAEXCHANGE:
1857 case SotClipboardFormatId::SIMPLE_FILE:
1864 pPt, nActionFlags,
nullptr );
1867 case SotClipboardFormatId::FILE_LIST:
1874 case SotClipboardFormatId::SONLK:
1878 if( aBkmk.
Paste( rData ) )
1895 case SotClipboardFormatId::INET_IMAGE:
1896 case SotClipboardFormatId::NETSCAPE_IMAGE:
1903 OSL_ENSURE( pPt,
"unknown format" );
1909 bool graphicInserted;
1914 if( graphicInserted )
1915 bCallAutoCaption =
true;
1921 nActionFlags,bMsg );
1933 OUString sURL, sDesc;
1934 if( SotClipboardFormatId::SIMPLE_FILE == nFormat )
1936 if( rData.
GetString( nFormat, sURL ) && !sURL.isEmpty() )
1939 if( sDesc.isEmpty() )
1966 case SotClipboardFormatId::DRAWING:
1969 nActionFlags, bNeedToSelectBeforePaste);
1971 case SotClipboardFormatId::SVXB:
1972 case SotClipboardFormatId::GDIMETAFILE:
1973 case SotClipboardFormatId::BITMAP:
1974 case SotClipboardFormatId::PNG:
1975 case SotClipboardFormatId::NETSCAPE_BOOKMARK:
1976 case SotClipboardFormatId::SIMPLE_FILE:
1977 case SotClipboardFormatId::FILEGRPDESCRIPTOR:
1978 case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
1981 nActionFlags, nDropAction, bNeedToSelectBeforePaste);
1984 OSL_FAIL(
"unknown format" );
1992 nActionFlags, bNeedToSelectBeforePaste);
2000 nActionFlags, nDropAction, bNeedToSelectBeforePaste, nAnchorType );
2006 nActionFlags, bNeedToSelectBeforePaste);
2015 nActionFlags, nDropAction, bNeedToSelectBeforePaste);
2023 OSL_FAIL(
"unknown action" );
2035 if( bCallAutoCaption )
2055 bLink = !aDummy.isEmpty();
2057 if( bLink && bIMap )
2058 nRet = SotExchangeDest::DOC_LNKD_GRAPH_W_IMAP;
2060 nRet = SotExchangeDest::DOC_LNKD_GRAPHOBJ;
2062 nRet = SotExchangeDest::DOC_GRAPH_W_IMAP;
2064 nRet = SotExchangeDest::DOC_GRAPHOBJ;
2070 nRet = SotExchangeDest::DOC_TEXTFRAME_WEB;
2072 nRet = SotExchangeDest::DOC_TEXTFRAME;
2074 case OBJCNT_OLE: nRet = SotExchangeDest::DOC_OLEOBJ;
break;
2077 case OBJCNT_SIMPLE: nRet = SotExchangeDest::DOC_DRAWOBJ;
break;
2085 nRet = SotExchangeDest::SWDOC_FREE_AREA_WEB;
2087 nRet = SotExchangeDest::SWDOC_FREE_AREA;
2097 const char* pResId = STR_CLPBRD_FORMAT_ERROR;
2108 case SotClipboardFormatId::STRING:
2113 pStream =
new SvMemoryStream( const_cast<sal_Unicode *>(sData.getStr()),
2116 #ifdef OSL_BIGENDIAN
2117 pStream->
SetEndian( SvStreamEndian::BIG );
2119 pStream->
SetEndian( SvStreamEndian::LITTLE );
2133 if( ( SotClipboardFormatId::HTML_SIMPLE == nFormat ) ||
2134 ( SotClipboardFormatId::HTML_NO_COMMENT == nFormat ) )
2136 pStream = aMSE40ClpObj.
IsValid( *xStrm );
2141 ( nFormat == SotClipboardFormatId::HTML_NO_COMMENT );
2146 pStream = xStrm.
get();
2147 if( SotClipboardFormatId::RTF == nFormat || SotClipboardFormatId::RICHTEXT == nFormat)
2159 if( pStream && pRead )
2168 if (bIgnoreComments)
2171 if( aReader.Read( *pRead ).IsError() )
2172 pResId = STR_ERROR_CLPBRD_READ;
2184 pResId = STR_CLPBRD_FORMAT_ERROR;
2187 if( pStream && !xStrm.
is() )
2193 VclMessageType::Info, VclButtonsType::Ok,
2205 uno::Reference < io::XInputStream > xStrm;
2206 uno::Reference < embed::XStorage > xStore;
2211 if( rData.
HasFormat( SotClipboardFormatId::EMBEDDED_OBJ ) )
2212 nId = SotClipboardFormatId::EMBEDDED_OBJ;
2213 else if( rData.
HasFormat( SotClipboardFormatId::EMBED_SOURCE ) &&
2214 rData.
HasFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ))
2215 nId = SotClipboardFormatId::EMBED_SOURCE;
2217 nId = SotClipboardFormatId::NONE;
2219 if (nId != SotClipboardFormatId::NONE)
2234 case SotClipboardFormatId::STARWRITER_60:
2235 case SotClipboardFormatId::STARWRITERWEB_60:
2236 case SotClipboardFormatId::STARWRITERGLOB_60:
2237 case SotClipboardFormatId::STARWRITER_8:
2238 case SotClipboardFormatId::STARWRITERWEB_8:
2239 case SotClipboardFormatId::STARWRITERGLOB_8:
2248 catch (
const uno::Exception&)
2255 catch (
const uno::Exception&)
2264 SwReader aReader(xStore, OUString(), rPAM);
2270 VclMessageType::Info, VclButtonsType::Ok,
2271 SwResId(STR_ERROR_CLPBRD_READ)));
2278 uno::Reference< embed::XStorage > xTmpStor;
2279 uno::Reference < embed::XEmbeddedObject > xObj;
2287 OSL_ENSURE( !xStrm.is(),
"An object without descriptor in clipboard!");
2294 xStrm = rData.
GetInputStream(SotClipboardFormatId::EMBED_SOURCE_OLE, OUString());
2296 xStrm = rData.
GetInputStream(SotClipboardFormatId::EMBEDDED_OBJ_OLE, OUString());
2304 uno::Reference < embed::XEmbedObjectClipboardCreator > xClipboardCreator =
2307 embed::InsertedObjectInfo aInfo = xClipboardCreator->createInstanceInitFromClipboard(
2310 uno::Sequence< beans::PropertyValue >() );
2314 xObj = aInfo.Object;
2316 catch (
const uno::Exception&)
2321 else if (rData.
HasFormat(SotClipboardFormatId::SIMPLE_FILE))
2324 if (rData.
GetString(nFormat, sFile) && !sFile.isEmpty())
2327 uno::Sequence< beans::PropertyValue > aMedium(1);
2328 aMedium[0].Name =
"URL";
2329 aMedium[0].Value <<= sFile;
2336 if ( xStrm.is() && !xObj.is() )
2349 if (rData.
GetGDIMetaFile(SotClipboardFormatId::GDIMETAFILE, aMetafile, 100000))
2351 nGrFormat = SotClipboardFormatId::GDIMETAFILE;
2352 aGraphic = aMetafile;
2356 if ( nGrFormat != SotClipboardFormatId::NONE )
2358 DataFlavor aDataFlavor;
2360 xObjRef.
SetGraphic( aGraphic, aDataFlavor.MimeType );
2362 else if ( aObjDesc.
mnViewAspect == embed::Aspects::MSOLE_ICON )
2367 MapMode aMapMode( MapUnit::Map100thMM );
2376 if ( aObjDesc.
mnViewAspect == embed::Aspects::MSOLE_ICON )
2382 MapMode aMapMode( MapUnit::Map100thMM );
2383 aSize = xObjRef.
GetSize( &aMapMode );
2394 aSz = xObj->getVisualAreaSize( aObjDesc.
mnViewAspect );
2396 catch (
const embed::NoVisualAreaSizeException&)
2401 if ( aSz.Width != aSize.Width() || aSz.Height != aSize.Height() )
2403 aSz.Width = aSize.Width();
2404 aSz.Height = aSize.Height();
2417 catch (
const uno::Exception&)
2426 if( bRet && ( nActionFlags & SotExchangeActionFlags::InsertTargetUrl) )
2438 const Point* pPt,
bool bInsertGRF )
2442 if( ( rData.
HasFormat( SotClipboardFormatId::INET_IMAGE ) &&
2443 rData.
GetINetImage( SotClipboardFormatId::INET_IMAGE, aINetImg )) ||
2444 ( rData.
HasFormat( SotClipboardFormatId::NETSCAPE_IMAGE ) &&
2445 rData.
GetINetImage( SotClipboardFormatId::NETSCAPE_IMAGE, aINetImg )) )
2447 if( !aINetImg.
GetImageURL().isEmpty() && bInsertGRF )
2460 lclCheckAndPerformRotation(aGraphic);
2466 rSh.
Insert(sURL, OUString(), aGraphic);
2477 rSh.
ReRead(sURL, OUString(), &aGraphic);
2482 rSh.
Paste( aGraphic, OUString() );
2484 rSh.
ReRead(sURL, OUString(), &aGraphic);
2488 rSh.
Insert(sURL, OUString(), aGraphic);
2549 rSh.SwCursorShell::SetCursor( *pPt,
true );
2558 OUString aApp, aTopic, aItem;
2564 OSL_ENSURE(
false,
"DDE Data not found." );
2568 rtl_TextEncoding eEncoding = osl_getThreadTextEncoding();
2579 if( !rData.
HasFormat( SotClipboardFormatId::RTF ) &&
2580 !rData.
HasFormat( SotClipboardFormatId::RICHTEXT ) &&
2581 !rData.
HasFormat( SotClipboardFormatId::HTML ) &&
2582 !rData.
HasFormat( SotClipboardFormatId::STRING ) &&
2583 (rData.
HasFormat( nFormat = SotClipboardFormatId::GDIMETAFILE ) ||
2584 rData.
HasFormat( nFormat = SotClipboardFormatId::BITMAP )) )
2587 bool bRet = rData.
GetGraphic( nFormat, aGrf );
2590 OUString sLnkTyp(
"DDE");
2592 rWrtShell.
ReRead( aCmd, sLnkTyp, &aGrf );
2594 rWrtShell.
Insert( aCmd, sLnkTyp, aGrf );
2603 bool bDoublePaste =
false;
2608 aName = aApp + OUString::number( i );
2614 if( rColl.isEqual( static_cast<SwDDEFieldType*>(pTyp)->GetCmd(), aCmd ) &&
2615 SfxLinkUpdateMode::ALWAYS == static_cast<SwDDEFieldType*>(pTyp)->GetType() )
2618 bDoublePaste =
true;
2621 else if( rColl.isEqual( aName, pTyp->
GetName() ) )
2629 while( !bDoublePaste );
2640 if( rData.
GetString( SotClipboardFormatId::STRING, aExpand ))
2646 if( !aExpand.isEmpty() &&
2647 ( rData.
HasFormat( SotClipboardFormatId::SYLK ) ||
2648 rData.
HasFormat( SotClipboardFormatId::SYLK_BIGCAPS ) ) )
2650 const sal_Int32 nRows = nNewlines ? nNewlines-1 : 0;
2659 VclMessageType::Info, VclButtonsType::Ok,
2660 SwResId(STR_TABLE_TOO_LARGE)));
2668 if( !nRows || !nCols )
2673 VclMessageType::Info, VclButtonsType::Ok,
2683 pDDETyp, nRows, nCols );
2685 else if( nNewlines > 1 )
2702 rWrtShell.
Insert( aSwDDEField );
2710 if( !pDDETyp && !bDoublePaste )
2734 if(bNeedToSelectBeforePaste && pPt)
2741 rSh.
Paste( *xStrm, nAction, pPt );
2744 if( bRet && ( nActionFlags & SotExchangeActionFlags::InsertTargetUrl ))
2758 bool bCheckForGrf =
false, bCheckForImageMap =
false;
2762 case SotClipboardFormatId::BITMAP:
2763 case SotClipboardFormatId::PNG:
2764 case SotClipboardFormatId::GDIMETAFILE:
2765 bRet = rData.
GetGraphic( nFormat, aGraphic );
2768 case SotClipboardFormatId::SVXB:
2776 bRet = (GraphicType::NONE != aGraphic.
GetType() && GraphicType::Default != aGraphic.
GetType());
2782 case SotClipboardFormatId::NETSCAPE_BOOKMARK:
2783 case SotClipboardFormatId::FILEGRPDESCRIPTOR:
2784 case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
2789 nFormat = SotClipboardFormatId::NETSCAPE_BOOKMARK;
2791 bCheckForGrf =
true;
2795 case SotClipboardFormatId::SIMPLE_FILE:
2798 bRet = rData.
GetString( nFormat, sText );
2816 if (sText.startsWithIgnoreAsciiCase(
"file:"))
2820 osl::FileBase::getSystemPathFromFileURL(sText, sSysPath);
2822 DWORD nCopied = GetLongPathNameW(o3tl::toW(sSysPath.getStr()),
2823 o3tl::toW(aBuf.get()), 32767);
2824 if (nCopied && nCopied < 32767)
2831 bCheckForGrf =
true;
2838 bRet = rData.
GetGraphic( nFormat, aGraphic );
2850 SotClipboardFormatId::SIMPLE_FILE == nFormat &&
2855 nFormat = SotClipboardFormatId::NETSCAPE_BOOKMARK;
2860 if(pPt && bNeedToSelectBeforePaste)
2872 lclCheckAndPerformRotation(aGraphic);
2887 rSh.
Insert(sURL, OUString(), aGraphic,
nullptr, nAnchorType);
2899 rSh.
Paste( aGraphic, sURL );
2908 rSh.
ReRead(sURL, OUString(), &aGraphic);
2916 if( SotClipboardFormatId::NETSCAPE_BOOKMARK == nFormat )
2931 rSh.
Paste( aGraphic, sURL );
2936 rSh.
ReRead(sURL, OUString(), &aGraphic);
2957 ( SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::ReplaceImageMap ) )
2960 if( nActionFlags & SotExchangeActionFlags::InsertTargetUrl )
2963 else if( bCheckForImageMap )
2968 StreamMode::STD_READ );
2969 SvStream* pStream = aMed.GetInStream();
2970 if( pStream !=
nullptr &&
2971 !pStream->GetError() &&
2979 aURL.SetMap( &aMap );
2993 if( rData.
HasFormat( SotClipboardFormatId::SVIM ))
3002 if( rData.
GetImageMap( SotClipboardFormatId::SVIM, aImageMap ) &&
3003 ( !pOld || aImageMap != *pOld ))
3005 aURL.SetMap( &aImageMap );
3019 if( rData.
GetString( nFormat, sFile ) && !sFile.isEmpty() )
3039 aURL2.
SetURL( sFile,
false );
3040 if( aURL2.GetName().isEmpty() )
3041 aURL2.SetName( sFile );
3050 sDesc.isEmpty() ? sFile : sDesc);
3062 bool * graphicInserted)
3065 pPt, nActionFlags, 0,
false);
3066 if (graphicInserted !=
nullptr) {
3067 *graphicInserted = bRet;
3071 OUString sFile, sDesc;
3072 if( rData.
GetString( nFormat, sFile ) && !sFile.isEmpty() )
3074 #if HAVE_FEATURE_AVMEDIA
3082 const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, aMediaURLStr );
3084 SID_INSERT_AVMEDIA, SfxCallMode::SYNCHRON,
3085 { &aMediaURLItem });
3100 if( pFlt && dynamic_cast< const SwWebDocShell *>( rSh.
GetView().
GetDocShell() ) ==
nullptr )
3107 aSect.SetProtectFlag(
true );
3115 PasteOLE(rData, rSh, nFormat, nActionFlags,
nullptr == pPt);
3137 aURL2.
SetURL( sFile,
false );
3138 if( aURL2.GetName().isEmpty() )
3139 aURL2.SetName( sFile );
3148 sDesc.isEmpty() ? sFile : sDesc );
3161 const Point* pDragPt,
bool bMsg )
3165 if( rData.
GetString( nFormat, sText ) && !sText.isEmpty() )
3167 sal_uInt16 nWh = SotClipboardFormatId::SBA_CTRLDATAEXCHANGE == nFormat
3169 : SotClipboardFormatId::SBA_DATAEXCHANGE == nFormat
3177 bool bHaveColumnDescriptor = OColumnTransferable::canExtractColumnDescriptor(rVector, ColumnTransferFormatFlags::COLUMN_DESCRIPTOR | ColumnTransferFormatFlags::CONTROL_EXCHANGE);
3178 if ( SotClipboardFormatId::XFORMS == nFormat )
3182 if (pFmView && pDragPt)
3184 const OXFormsDescriptor &rDesc = OXFormsTransferable::extractDescriptor(rData);
3188 rSh.SwFEShell::InsertDrawObj( *(pObj.release()), *pDragPt );
3194 std::unique_ptr<SfxUnoAnyItem> pConnectionItem;
3195 std::unique_ptr<SfxUnoAnyItem> pCursorItem;
3196 std::unique_ptr<SfxUnoAnyItem> pColumnItem;
3197 std::unique_ptr<SfxUnoAnyItem> pSourceItem;
3198 std::unique_ptr<SfxUnoAnyItem> pCommandItem;
3199 std::unique_ptr<SfxUnoAnyItem> pCommandTypeItem;
3200 std::unique_ptr<SfxUnoAnyItem> pColumnNameItem;
3201 std::unique_ptr<SfxUnoAnyItem> pSelectionItem;
3203 bool bDataAvailable =
true;
3204 ODataAccessDescriptor aDesc;
3205 if(bHaveColumnDescriptor)
3206 aDesc = OColumnTransferable::extractColumnDescriptor(rData);
3207 else if(ODataAccessObjectTransferable::canExtractObjectDescriptor(rVector) )
3208 aDesc = ODataAccessObjectTransferable::extractObjectDescriptor(rData);
3210 bDataAvailable =
false;
3212 if ( bDataAvailable )
3230 nWh, SfxCallMode::ASYNCHRON,
3231 { &aDataDesc, pConnectionItem.get(), pColumnItem.get(),
3232 pSourceItem.get(), pCommandItem.get(), pCommandTypeItem.get(),
3233 pColumnNameItem.get(), pSelectionItem.get(),
3234 pCursorItem.get() });
3240 if (pFmView && bHaveColumnDescriptor && pDragPt)
3244 rSh.SwFEShell::InsertDrawObj( *(pObj.release()), *pDragPt );
3252 VclMessageType::Info, VclButtonsType::Ok,
3253 SwResId(STR_CLPBRD_FORMAT_ERROR)));
3261 const Point* pPt,
bool bMsg )
3265 if( rData.
GetFileList( SotClipboardFormatId::FILE_LIST, aFileList ) &&
3274 pHlp->CopyString( SotClipboardFormatId::SIMPLE_FILE, aFileList.
GetFile(
n ));
3278 pPt, SotExchangeActionFlags::NONE,
nullptr ))
3288 if( !sFlyNm.isEmpty() )
3294 VclMessageType::Info, VclButtonsType::Ok,
3295 SwResId(STR_CLPBRD_FORMAT_ERROR)));
3302 OUString& rFileName, OUString* pTitle )
3304 bool bIsURLFile =
false;
3308 rFileName = aBkmk.
GetURL();
3315 if( rFileName.getLength()>4 && rFileName.endsWithIgnoreAsciiCase(
".url") )
3317 OSL_ENSURE(
false,
"how do we read today .URL - Files?" );
3329 return aClipboardFormatItem.
Count() > 0;
3348 nPrivateFormat = SotClipboardFormatId::EMBED_SOURCE;
3350 if( pClipboard && nPrivateFormat == nFormat )
3357 sal_uInt16 nSourceOptions =
3358 (( SotExchangeDest::DOC_TEXTFRAME == nDestination ||
3359 SotExchangeDest::SWDOC_FREE_AREA == nDestination ||
3360 SotExchangeDest::DOC_TEXTFRAME_WEB == nDestination ||
3361 SotExchangeDest::SWDOC_FREE_AREA_WEB == nDestination )
3370 nFormat, nEventAction, nFormat,
3376 nDestination,
true,
false );
3391 EXCHG_IN_ACTION_COPY, nFormat,
3392 nEventAction, nFormat,
3404 SotClipboardFormatId::HTML,
3405 SotClipboardFormatId::HTML_SIMPLE,
3406 SotClipboardFormatId::HTML_NO_COMMENT,
3407 SotClipboardFormatId::RTF,
3408 SotClipboardFormatId::RICHTEXT,
3409 SotClipboardFormatId::STRING,
3410 SotClipboardFormatId::SONLK,
3411 SotClipboardFormatId::NETSCAPE_BOOKMARK,
3412 SotClipboardFormatId::DRAWING,
3413 SotClipboardFormatId::SVXB,
3414 SotClipboardFormatId::GDIMETAFILE,
3415 SotClipboardFormatId::BITMAP,
3416 SotClipboardFormatId::SVIM,
3417 SotClipboardFormatId::FILEGRPDESCRIPTOR,
3418 SotClipboardFormatId::NONE
3440 pResId = STR_PRIVATETEXT;
3442 pResId = STR_PRIVATEGRAPHIC;
3444 pResId = STR_PRIVATEOLE;
3450 if (strcmp(STR_PRIVATEOLE, pResId) == 0 || strcmp(STR_PRIVATEGRAPHIC, pResId) == 0)
3455 aFlavorEx.
mnSotId = SotClipboardFormatId::EMBED_SOURCE;
3456 aFormats.insert( aFormats.begin(), aFlavorEx );
3460 pDlg->
Insert( SotClipboardFormatId::EMBED_SOURCE, OUString() );
3465 if( rData.
HasFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ) )
3468 SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc );
3472 pDlg->
Insert( SotClipboardFormatId::EMBED_SOURCE, OUString() );
3474 pDlg->
Insert( SotClipboardFormatId::LINK_SOURCE, OUString() );
3478 pDlg->
Insert( SotClipboardFormatId::LINK,
SwResId(STR_DDEFORMAT) );
3480 for(
SotClipboardFormatId* pIds = aPasteSpecialIds; *pIds != SotClipboardFormatId::NONE; ++pIds )
3482 pDlg->
Insert( *pIds, OUString() );
3496 pResId = STR_PRIVATETEXT;
3498 pResId = STR_PRIVATEGRAPHIC;
3500 pResId = STR_PRIVATEOLE;
3511 if (rData.
HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR))
3513 (
void)const_cast<TransferableDataHelper&>(rData).GetTransferableObjectDescriptor(
3514 SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc);
3524 if ( rData.
HasFormat(nFormat = SotClipboardFormatId::EMBED_SOURCE_OLE) || rData.
HasFormat(nFormat = SotClipboardFormatId::EMBEDDED_OBJ_OLE) )
3526 OUString
sName,sSource;
3535 for(
SotClipboardFormatId* pIds = aPasteSpecialIds; *pIds != SotClipboardFormatId::NONE; ++pIds )
3548 AddFormat( SotClipboardFormatId::SVXB );
3552 AddFormat( SotClipboardFormatId::GDIMETAFILE );
3554 AddFormat( SotClipboardFormatId::BITMAP );
3561 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
3563 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
3564 AddFormat( SotClipboardFormatId::GDIMETAFILE );
3584 AddFormat( SotClipboardFormatId::EMBED_SOURCE );
3590 AddFormat( SotClipboardFormatId::RICHTEXT );
3591 AddFormat( SotClipboardFormatId::HTML );
3594 AddFormat( SotClipboardFormatId::STRING );
3598 AddFormat( SotClipboardFormatId::DRAWING );
3601 AddFormat( SotClipboardFormatId::GDIMETAFILE );
3603 AddFormat( SotClipboardFormatId::BITMAP );
3619 AddFormat( SotClipboardFormatId::STRING );
3620 AddFormat( SotClipboardFormatId::SOLK );
3621 AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
3622 AddFormat( SotClipboardFormatId::FILECONTENT );
3623 AddFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR );
3624 AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR );
3636 AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
3646 AddFormat( SotClipboardFormatId::STRING );
3647 AddFormat( SotClipboardFormatId::SOLK );
3648 AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
3649 AddFormat( SotClipboardFormatId::FILECONTENT );
3650 AddFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR );
3651 AddFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR );
3665 AddFormat( SotClipboardFormatId::SVIM );
3667 else if( !rURL.
GetURL().isEmpty() )
3671 AddFormat( SotClipboardFormatId::INET_IMAGE );
3687 SW_MOD()->m_pDragDrop =
this;
3746 bool lcl_checkClassification(
SwDoc* pSourceDoc,
SwDoc* pDestinationDoc)
3748 if (!pSourceDoc || !pDestinationDoc)
3753 if (!pSourceShell || !pDestinationShell)
3766 OSL_ENSURE( !rShell.
ActionPend(),
"Paste must never have an ActionPend" );
3772 SwTrnsfrActionAndUndo aAction( &rShell );
3774 bool bKillPaMs =
false;
3797 rShell.SwCursorShell::SetCursor( aPt,
true );
3799 if (!(nSelection & SelectionType::NumberList))
3804 if ( nSelection & SelectionType::DrawObject)
3809 bool bInWrd =
false, bEndWrd =
false, bSttWrd =
false,
3818 bSmart = bInWrd || bEndWrd;
3822 if (!bSttWrd && (bInWrd || bEndWrd))
3823 rShell.SwEditShell::Insert(
' ');
3836 if( bRet && bSmart && ((bInWrd && !bEndWrd )|| bSttWrd) )
3837 rShell.SwEditShell::Insert(
' ');
3843 bool bMove,
bool bIsXSelection )
3846 bool bInWrd =
false;
3847 bool bEndWrd =
false;
3848 bool bSttWrd =
false;
3849 bool bSttPara =
false;
3850 bool bTableSel =
false;
3851 bool bTableMove =
false;
3852 bool bFrameSel =
false;
3933 rSrcSh.
StartUndo( eUndoId, &aRewriter );
3940 pDispatch->
Execute(SID_COPY, SfxCallMode::SYNCHRON);
3944 rSh.SwCursorShell::SetCursor(rDragPt,
false);
3959 if (pMark !=
nullptr)
3999 rSrcSh.
StartUndo( eUndoId, &aRewriter );
4005 if( &rSrcSh != &rSh )
4008 rSh.SwCursorShell::SetCursor( rDragPt,
true );
4011 else if( !bTableSel && !bFrameSel )
4022 rSh.SwCursorShell::CreateCursor();
4024 rSh.SwCursorShell::SetCursor( rDragPt,
true,
false );
4040 if( &rSrcSh == &rSh )
4043 rSh.SwCursorShell::SetCursor( aSttPt,
true );
4058 rSrcSh.SwCursorShell::SetCursor( aSttPt,
true );
4074 bool bRet = rSrcSh.SwFEShell::Copy(rSh, aSttPt, rDragPt, bMove,
4077 if( !bIsXSelection )
4080 if ( bRet && bMove && !bFrameSel )
4090 rSh.SwCursorShell::DestroyCursor();
4103 if( &rSh == &rSrcSh && ( bTableSel || rSh.
IsBlockMode() ) )
4106 rSrcSh.SwCursorShell::SetCursor(rDragPt);
4111 if( bRet && !bTableSel && !bFrameSel )
4113 if( (bInWrd || bEndWrd) &&
4117 if ( bSttWrd || (bInWrd && !bEndWrd))
4118 rSh.SwEditShell::Insert(
' ', bIsXSelection);
4119 if ( !bSttWrd || (bInWrd && !bSttPara) )
4123 rSh.SwEditShell::Insert(
' ', bIsXSelection);
4130 if( &rSrcSh == &rSh && !rSh.
IsAddMode() )
4132 rSh.SwCursorShell::DestroyCursor();
4138 rSh.SwCursorShell::ClearMark();
4144 rSh.SwCursorShell::CreateCursor();
4153 else if ( bRet && bTableMove )
4159 if( bRet && bMove && bFrameSel )
4182 pNew->m_pCreatorView = _pCreatorView;
4185 pNew->CopyToSelection( rSh.
GetWin() );
4202 class theSwTransferableUnoTunnelId :
public rtl::Static< UnoTunnelIdInit, SwTransferable > {};
4213 if( isUnoTunnelId<SwTransferable>(rId) )
4215 nRet = sal::static_int_cast< sal_Int64 >(
reinterpret_cast< sal_IntPtr
>( this ) );
4224 return comphelper::getUnoTunnelImplementation<SwTransferable>(rData.
GetTransferable());
4229 , pDocShell(nullptr)
4231 , bDelBookmrk(false)
4232 , bInDisconnect(false)
4264 if(
sName.isEmpty() ||
4269 refObj = pDocShell->DdeCreateLinkSource( sName );
4272 refObj->AddConnectAdvise(
this );
4273 refObj->AddDataAdvise(
this,
4275 ADVISEMODE_NODATA | ADVISEMODE_ONLYONCE );
4276 nOldTimeOut = refObj->GetUpdateTimeout();
4277 refObj->SetUpdateTimeout( 0 );
4281 SwTransferDdeLink::~SwTransferDdeLink()
4291 if( !bInDisconnect )
4293 if( FindDocShell() && pDocShell->GetView() )
4294 rTrnsfr.RemoveDDELinkFormat( pDocShell->GetView()->GetEditWin() );
4300 bool SwTransferDdeLink::WriteData(
SvStream& rStrm )
4302 if( !refObj.is() || !FindDocShell() )
4305 rtl_TextEncoding eEncoding = osl_getThreadTextEncoding();
4309 pDocShell->GetTitle(SFX_TITLE_FULLNAME), eEncoding));
4312 std::unique_ptr<char[]> pMem(
new char[ aAppNm.getLength() + aTopic.getLength() +
aName.getLength() + 4 ]);
4314 sal_Int32 nLen = aAppNm.getLength();
4315 memcpy( pMem.get(), aAppNm.getStr(), nLen );
4317 memcpy( pMem.get() + nLen, aTopic.getStr(), aTopic.getLength() );
4318 nLen = nLen + aTopic.getLength();
4320 memcpy( pMem.get() + nLen,
aName.getStr(),
aName.getLength() );
4321 nLen = nLen +
aName.getLength();
4347 OUString sMarkName = pMark->
GetName();
4363 bDelBookmrk =
false;
4367 void SwTransferDdeLink::Disconnect(
bool bRemoveDataAdvise )
4371 bool bOldDisconnect = bInDisconnect;
4372 bInDisconnect =
true;
4375 if( bDelBookmrk && refObj.is() && FindDocShell() )
4377 SwDoc* pDoc = pDocShell->GetDoc();
4394 bDelBookmrk =
false;
4399 refObj->SetUpdateTimeout( nOldTimeOut );
4400 refObj->RemoveConnectAdvise(
this );
4401 if( bRemoveDataAdvise )
4406 refObj->RemoveAllDataAdvise(
this );
4409 bInDisconnect = bOldDisconnect;
4412 bool SwTransferDdeLink::FindDocShell()
4417 if( pTmpSh == pDocShell )
4419 if( pDocShell->GetDoc() )
4426 pDocShell =
nullptr;
4430 void SwTransferDdeLink::Closed()
4432 if( !bInDisconnect && refObj.is() )
4434 refObj->RemoveAllDataAdvise(
this );
4435 refObj->RemoveConnectAdvise(
this );
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SfxViewFrame * GetViewFrame() const
Instances of SwFields and those derived from it occur 0 to n times.
static bool IsPasteOwnFormat(const TransferableDataHelper &)
#define EXCHG_IN_ACTION_COPY
#define FN_DB_CONNECTION_ANY
bool Paste(SwDoc &rClpDoc, bool bNestedTable=false)
#define FN_DB_DATA_SOURCE_ANY
bool GetGraphic(SotClipboardFormatId nFormat, Graphic &rGraphic)
virtual void SetVisArea(const tools::Rectangle &rVisArea)
const ::utl::TransliterationWrapper & GetAppCmpStrIgnore()
bool SetINetImage(const INetImage &rINtImg, const css::datatransfer::DataFlavor &rFlavor)
static OUString GetAppName()
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
#define EXCHG_IN_ACTION_MOVE
void SetDataForDragAndDrop(const Point &rSttPos)
sal_uLong GetIndex() const
SwNode & GetNode(bool bPoint=true) const
static SwTransferable * GetSwTransferable(const TransferableDataHelper &rData)
#define FN_TABLE_INSERT_COL_BEFORE
SwTransferable(const SwTransferable &)=delete
static tools::Long GetDDStartPosX()
static bool PasteAsHyperlink(TransferableDataHelper &rData, SwWrtShell &rSh, SotClipboardFormatId nFormat)
#define EXCHG_OUT_ACTION_INSERT_STRING
bool GetSotStorageStream(SotClipboardFormatId nFormat, tools::SvRef< SotTempStream > &rStreamRef)
virtual const OUString & GetName() const =0
Marks a position in the document model.
virtual UpdateResult DataChanged(const OUString &rMimeType, const css::uno::Any &rValue)
SwTransferable * m_pXSelection
TransferableObjectDescriptor m_aObjDesc
css::uno::Any GetAny(SotClipboardFormatId nFormat, const OUString &rDestDoc) const
bool SetBitmapEx(const BitmapEx &rBitmap, const css::datatransfer::DataFlavor &rFlavor)
bool isContentExtractionLocked() const
void AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId=nullptr)
virtual bool DoSaveCompleted(SfxMedium *pNewStor=nullptr, bool bRegisterRecent=true)
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
const OUString & GetImageURL() const
void readGraphic(Graphic &rGraphic)
void SaveTableBoxContent(const SwPosition *pPos=nullptr)
void InsertDDETable(const SwInsertTableOptions &rInsTableOpts, SwDDEFieldType *pDDEType, sal_uInt16 nRows, sal_uInt16 nCols)
tools::SvRef< sfx2::SvBaseLink > m_xDdeLink
SAL_DLLPRIVATE void SetProtectFlag(bool const bFlag)
SwTable::SearchType GetTableInsertMode() const
void SetLinkFileName(OUString const &rNew)
static css::uno::Reference< css::embed::XStorage > GetStorageFromInputStream(const css::uno::Reference< css::io::XInputStream > &xStream, const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
void ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr)
Re-read if graphic is not ok. Current graphic is replaced by the new one.
const OUString & GetText() const
std::unique_ptr< SwPaM > m_pPaM
bool GoNextCursor()
go to the next SSelection
SwDocShell * GetDocShell()
bool GetURLFromButton(OUString &rURL, OUString &rDescr) const
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
const OUString & GetTargetURL() const
void AddTransferable(SwTransferable &rTransferable)
constexpr sal_uInt32 SWTRANSFER_OBJECTTYPE_DRAWMODEL
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
#define FN_TABLE_DELETE_TABLE
static sal_uInt8 GetExchangeAction(const DataFlavorExVector &rDataFlavorExVector, SotExchangeDest nDestination, sal_uInt16 nSourceOptions, sal_uInt8 nUserAction, SotClipboardFormatId &rFormat, sal_uInt8 &rDefaultAction, SotClipboardFormatId nOnlyTestFormat=SotClipboardFormatId::NONE, const css::uno::Reference< css::datatransfer::XTransferable > *pxTransferable=nullptr, SotExchangeActionFlags *pActionFlags=nullptr)
SfxDispatcher * GetDispatcher()
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
int PrepareForCopy(bool bIsCut=false)
static bool IsPaste(const SwWrtShell &, const TransferableDataHelper &)
::std::vector< DataFlavorEx > DataFlavorExVector
constexpr sal_uInt32 SWTRANSFER_OBJECTTYPE_RICHTEXT
void SetPrefMapMode(const MapMode &rPrefMapMode)
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
bool PrivateDrop(SwWrtShell &rSh, const Point &rDragPt, bool bMove, bool bIsXSelection)
const SfxPoolItem * pAttr
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
bool SetTransferableObjectDescriptor(const TransferableObjectDescriptor &rDesc)
#define EXCHG_OUT_ACTION_INSERT_DDE
bool IsModified() const
Changes in document?
Provides access to the marks of a document.
static bool PasteFileList(TransferableDataHelper &rData, SwWrtShell &rSh, bool bLink, const Point *pPt, bool bMsg)
static bool PasteFormat(SwWrtShell &rSh, TransferableDataHelper &rData, SotClipboardFormatId nFormat)
SwSection const * InsertSection(SwSectionData &rNewData, SfxItemSet const *const =nullptr)
bool IsSupportedGraphic() const
SwCursor * GetSwCursor() const
bool HasFormat(SotClipboardFormatId nFormat)
void SetOle2Link(const Link< bool, void > &rLink)
SVL_DLLPUBLIC OUString removePassword(OUString const &rURI, INetURLObject::EncodeMechanism eEncodeMechanism, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
OUString GetUniqueSectionName(const OUString *pChkStr=nullptr) const
static bool CheckForURLOrLNKFile(TransferableDataHelper &rData, OUString &rFileName, OUString *pTitle=nullptr)
#define EXCHG_OUT_ACTION_REPLACE_SVXB
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false)
comphelper::OInterfaceContainerHelper2 & GetPasteListeners()
bool IsInsideSelectedObj(const Point &rPt)
returns enum values
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(57)
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
#define DND_ACTION_COPYMOVE
#define FN_DB_DATA_COMMAND_ANY
void RemoveDDELinkFormat(const vcl::Window &rWin)
OUString GetSelDescr() const
void SetTmpDocShell(SfxObjectShellLock rLock)
in case during copying of embedded object a new shell is created, it should be set here and cleaned l...
void DestroyCursor()
transform TableCursor to normal cursor, nullify Tablemode
void Pos(const Point &rNew)
ErrCode Write(WriterRef const &rxWriter, const OUString *=nullptr)
void DoUndo(bool bOn=true)
Undo.
void ReplaceCompatibilityOptions(const SwDoc &rSource)
void SetReadUTF8(bool bSet)
IDocumentMarkAccess * getIDocumentMarkAccess()
IDocumentUndoRedo & GetIDocumentUndoRedo()
size_t GetIMapObjectCount() const
void NavigatorPaste(const NaviContentBookmark &rBkmk, const sal_uInt16 nAction)
Of course Writer needs its own rectangles.
void SetClipBoard(bool bNew)
#define EXCHG_OUT_ACTION_MOVE_PRIVATE
bool GetINetBookmark(SotClipboardFormatId nFormat, INetBookmark &rBmk)
IDocumentContentOperations const & getIDocumentContentOperations() const
bool InsertOleObject(const svt::EmbeddedObjectRef &xObj, SwFlyFrameFormat **pFlyFrameFormat=nullptr)
void FillTransferableObjectDescriptor(TransferableObjectDescriptor &rDesc) const
bool HasFormat(SotClipboardFormatId nFormat) const
#define FN_PASTE_NESTED_TABLE
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
sal_Int32 getTokenCount(const OString &rIn, char cTok)
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
bool SetINetBookmark(const INetBookmark &rBmk, const css::datatransfer::DataFlavor &rFlavor)
bool SetObject(void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor)
void StartInsertRegionDialog(const SwSectionData &)
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
virtual void LockExpFields()=0
#define EXCHG_IN_ACTION_DEFAULT
Used by the UI to modify the document model.
bool CopyGlossary(SwTextBlocks &rGlossary, const OUString &rStr)
void AddFormat(SotClipboardFormatId nFormat)
static void SelectPasteFormat(TransferableDataHelper &rData, sal_uInt8 &nAction, SotClipboardFormatId &nFormat)
HashMap_OWString_Interface aMap
static UITestLogger & getInstance()
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
void logEvent(const EventDescription &rDescription)
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
#define EXCHG_OUT_ACTION_INSERT_IMAGEMAP
tools::Long ResetSelect(const Point *, bool)
bool GotoFly(const OUString &rName, FlyCntType eType=FLYCNTTYPE_ALL, bool bSelFrame=true)
const SwView & GetView() const
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
#define FN_TABLE_SELECT_ALL
void ReplaceDefaults(const SwDoc &rSource)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
static void CreateSelection(SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
#define EXCHG_INOUT_ACTION_NONE
static void DeleteDDEMarks(SwDoc &rDest)
const Link< bool, void > & GetOle2Link() const
static tools::Long GetDDStartPosY()
check if target position is in fly anchored at source range
#define FN_PARAM_INSERT_AFTER
virtual ::sw::mark::IMark * makeMark(const SwPaM &rPaM, const OUString &rProposedName, MarkType eMark,::sw::mark::InsertMode eMode, SwPosition const *pSepPos=nullptr)=0
Generates a new mark in the document for a certain selection.
bool Paste(TransferableDataHelper &rData)
static bool PasteData(TransferableDataHelper &rData, SwWrtShell &rSh, sal_uInt8 nAction, SotExchangeActionFlags nActionFlags, SotClipboardFormatId nFormat, SotExchangeDest nDestination, bool bIsPasteFormat, bool bIsDefault, const Point *pDDPos=nullptr, sal_Int8 nDropAction=0, bool bPasteSelection=false, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA, bool bIgnoreComments=false, SwPasteContext *pContext=nullptr, PasteTableType nPaste=PasteTableType::PASTE_DEFAULT)
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
#define FN_QRY_MERGE_FIELD
bool InsertGlossary(SwTextBlocks &rBlock, const OUString &rEntry, SwPaM &rPaM, SwCursorShell *pShell=nullptr)
inserts an AutoText block
const GDIMetaFile & GetGDIMetaFile() const
TransferBufferType m_eBufferType
static bool ShowPasteInfo(SfxClassificationCheckPasteResult eResult)
static bool Paste(SwWrtShell &, TransferableDataHelper &, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA, bool bIgnoreComments=false, PasteTableType ePasteTable=PasteTableType::PASTE_DEFAULT)
union SwContentAtPos::@24 aFnd
void GetGrfNms(OUString *pGrfName, OUString *pFltName, const SwFlyFrameFormat *=nullptr) const
Returns the name and the filter name of a graphic if the pointer is on a graphic. ...
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
#define EXCHG_OUT_ACTION_INSERT_GRAPH
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
virtual bool WriteObject(tools::SvRef< SotTempStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor) override
SfxObjectCreateMode GetCreateMode() const
static SotExchangeDest GetSotDestination(const SwWrtShell &rSh)
static SfxClassificationCheckPasteResult CheckPaste(const css::uno::Reference< css::document::XDocumentProperties > &xSource, const css::uno::Reference< css::document::XDocumentProperties > &xDestination)
void Insert(SwField const &, SwPaM *pAnnotationRange=nullptr)
static SotClipboardFormatId GetFormatID(css::uno::Reference< css::embed::XStorage > const &xStorage)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
static SotClipboardFormatId aPasteSpecialIds[]
the list of formats which will be offered to the user in the 'Paste Special...' dialog and the paste ...
constexpr OUStringLiteral aData
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
std::unique_ptr< SwDocFac, o3tl::default_delete< SwDocFac > > m_pClpDocFac
static ErrCode LoadGraphic(const OUString &rPath, const OUString &rFilter, Graphic &rGraphic, GraphicFilter *pFilter=nullptr, sal_uInt16 *pDeterminedFormat=nullptr)
virtual std::unique_ptr< ILazyDeleter > deleteMark(const IDocumentMarkAccess::const_iterator_t &ppMark)=0
Deletes a mark.
bool GetFlyFrameAttr(SfxItemSet &rSet) const
void SetChgLnk(const Link< LinkParamNone *, void > &rLnk)
virtual const_iterator_t getAllMarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of marks.
#define FN_TABLE_PASTE_ROW_BEFORE
void SetCharSet(rtl_TextEncoding nVal)
PaM is Point and Mark: a selection of the document model.
bool SetGraphic(const Graphic &rGraphic)
const SfxItemPool & GetAttrPool() const
bool ShouldWait() const
Should WaitPtr be switched on for the clipboard?
OUString read_zeroTerminated_uInt8s_ToOUString(SvStream &rStream, rtl_TextEncoding eEnc)
static bool PasteDBData(TransferableDataHelper &rData, SwWrtShell &rSh, SotClipboardFormatId nFormat, bool bLink, const Point *pDragPt, bool bMsg)
bool GetINetImage(SotClipboardFormatId nFormat, INetImage &rINtImg)
SwgReaderOption & GetReaderOpt()
static css::uno::Reference< css::embed::XStorage > GetTemporaryStorage(const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
void RemoveFormat(SotClipboardFormatId nFormat)
#define FN_CHAR_LEFT
Definiti